identifier method

void identifier()

Implementation

void identifier() {
  while (peek() != null && isAlphaNumeric(peek()!)) {
    advance();
  }

  String text = source.substring(start, current);
  TokenType type = keywords[text] ?? TokenType.identifier;

  if (type == TokenType.boolean) {
    addToken(type, text == 'true');
  } else {
    addToken(type);
  }
}