match method

Token match(
  1. String lexeme
)

If the token lexeme the lexeme provided, advance 1 and return the original token. If not, generate an error.

Implementation

Token match(String lexeme) {
  if (curTok.lexeme != lexeme) {
    final err = HTError.unexpectedToken(lexeme, curTok.lexeme,
        filename: currrentFileName,
        line: curTok.line,
        column: curTok.column,
        offset: curTok.offset,
        length: curTok.length);
    errors.add(err);
  }

  return advance();
}