readNextToken method

  1. @override
Token? readNextToken()
override

Reads the next token. Returns next token

Implementation

@override
Token? readNextToken() {
  if (scanner == null) {
    return null;
  }

  // Check for initial state
  if (nextTokenValue == null && lastTokenType == TokenType.Unknown) {
    _special = true;
  }

  // Process quotes
  if (_special) {
    var token = _specialState.nextToken(scanner!, this);
    if (token != null && token.value != '') {
      return token;
    }
  }

  // Proces other tokens
  _special = false;
  var token = super.readNextToken();
  // Switch to quote when '{{' or '{{{' symbols found
  if (token != null && (token.value == '}}' || token.value == '}}}')) {
    _special = true;
  }
  return token;
}