validateNext method

  1. @override
bool validateNext(
  1. ComputeContext ctx,
  2. String rawBuildingToken,
  3. Token<TokenType>? nextToken
)
override

Signals the caller if the token type is compatible with the next token.

Implementation

@override
bool validateNext(ComputeContext ctx, String rawBuildingToken,
    Token<TokenType>? nextToken) {
  if (!super.validateNext(ctx, rawBuildingToken, nextToken)) {
    return false;
  }

  return nextToken == null ||
      (nextToken is OperatorToken &&
          nextToken.operator.precedence == Precedence.additive);
}