package tools;

/** Trait for parsers that work with tokenized strings. */
trait TokenParsers extends Parsers with AdditionalParsers {

  /** The input must match this type. */
  type inputType = Stream[String];

  /** The key method define to make these parsers work. */
  def nextToken(): Parser[String];

  /** Does the expected string occur in the input? */
  def check[a](expected: String): Parser[Unit] =
    for (val actual: String <- nextToken(); actual equals expected)
      yield ();
      
}
