seek method

Token seek(
  1. String type
)

Search for a token type, return the token next to it.

Implementation

Token seek(String type) {
  late Token current;
  var distance = 0;
  do {
    current = peek(distance);
    ++distance;
  } while (current.type != type && curTok.type != Semantic.endOfFile);
  return peek(distance);
}