throwErrorIfDoesntMatch method

void throwErrorIfDoesntMatch(
  1. TokenIterator iterator,
  2. TokenKind expected
)

Implementation

void throwErrorIfDoesntMatch(TokenIterator iterator, TokenKind expected) {
  if (iterator.current.kind != expected) {
    throw UnexpectedToken(iterator.current.lexeme);
  }
}