parseBinary method

Expression parseBinary(
  1. int minPrecedence,
  2. bool allowIn
)

Implementation

Expression parseBinary(int minPrecedence, bool allowIn) {
  int? start = token!.startOffset;
  Expression exp = parseUnary();
  while (token!.binaryPrecedence >= minPrecedence) {
    if (token!.type == Token.NAME) {
      // All name tokens are given precedence of RELATIONAL
      // Weed out name tokens that are not actually binary operators
      if (token!.value != 'instanceof' &&
          (token!.value != 'in' || !allowIn)) {
        break;
      }
    }
    Token operator = next();
    Expression right = parseBinary(operator.binaryPrecedence + 1, allowIn);
    exp = BinaryExpression(exp, operator.text, right)
      ..start = start
      ..end = endOffset
      ..line = operator.line;
  }
  return exp;
}