parseBinary method

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

Implementation

Expression parseBinary(int minPrecedence, bool allowIn) {
  int start = token?.startOffset??0;
  Expression exp = parseUnary();
  while ( null!=token && 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??0 + 1, allowIn);
    exp = new BinaryExpression(exp, operator?.text??'', right)
      ..start = start
      ..end = endOffset
      ..line = operator?.line??0;
  }
  return exp;
}