identifier method

Identifier identifier()

Implementation

Identifier identifier() {
  var tok = _next();

  if (!TokenKind.isIdentifier(tok.kind) && !TokenKind.isKindIdentifier(tok.kind)) {
    if (isChecked) {
      String message;
      try {
        message = 'expected identifier, but found $tok';
      } catch (e) {
        message = 'parsing error expected identifier';
      }
      _warning(message, location: tok.span);
    }
    return Identifier('');
  }
  return Identifier(tok.text);
}