parse method

  1. @override
Token<Lexeme> parse(
  1. String string, [
  2. Lexeme? main
])
override

Parses the provided input and returns the resulting token. If the input is invalid, LexicalSyntaxError is thrown.

The main lexeme is used to tokenize the input, this can be changed by setting the main argument.

Implementation

@override
Token<Lexeme> parse(String string, [Lexeme? main]) {
  final timer = Stopwatch()..start();
  final result = super.parse(string, main);
  timer.stop();
  print(
      '\n> Debugging Grammar parsed the input in ${timer.elapsedMilliseconds} ms.\n');
  return result;
}