getAheadSymbol method

int getAheadSymbol(
  1. String lookingFor,
  2. List<Token> searchIn
)
inherited

returns the position of a symbol in ahead

Implementation

int getAheadSymbol(String lookingFor, List<Token> searchIn) {
  for (var index = 0; index < searchIn.length; index++) {
    final value = searchIn[index];
    if (value.lexeme == lookingFor) {
      if (index + 1 < searchIn.length) {
        return index + 1;
      }
      return searchIn.length;
    }
  }
  return -1;
}