private Expr ParseRelationalExpr() { Expr ret = ParseAdditiveExpr(); if (ret == null) return ret; TotemOperator op; if (IsRelationalToken(PeekToken(), out op)) { Token t = NextToken(); var start = ret.StartIndex; ret = new BinaryExpr(op, ret, ParseRelationalExpr()); ret.SetLoc(_globalParent, start, GetEnd()); } return ret; }
private Expr ParseMultiplicativeExpr() { Expr ret = ParsePrefixedExpr(); if (ret == null) return ret; TotemOperator op; while (IsMultiplicativeToken(PeekToken(), out op)) { Token t = NextToken(); var start = ret.StartIndex; ret = new BinaryExpr(op, ret, ParsePrefixedExpr()); ret.SetLoc(_globalParent, start, GetEnd()); } return ret; }
private Expr ParseLogicalAndExpr() { Expr ret = ParseEqualityExpr(); if (ret == null) return ret; while (MaybeEat(TokenType.LogicalAnd)) { var start = ret.StartIndex; ret = new BinaryExpr(TotemOperator.LogicalAnd, ret, ParseEqualityExpr()); ret.SetLoc(_globalParent, start, GetEnd()); } return ret; }