private SpelNode EatSumExpression() { var expr = EatProductExpression(); while (PeekToken(TokenKind.PLUS, TokenKind.MINUS, TokenKind.INC)) { // consume PLUS or MINUS or INC var t = TakeToken(); var rhExpr = EatProductExpression(); CheckRightOperand(t, rhExpr); if (t.Kind == TokenKind.PLUS) { expr = new OpPlus(t.StartPos, t.EndPos, expr, rhExpr); } else if (t.Kind == TokenKind.MINUS) { expr = new OpMinus(t.StartPos, t.EndPos, expr, rhExpr); } } return(expr); }
public static Expr _UnaryMinus(OpMinus op, Expr rhs) { return(new UnaryMinusExpr(rhs)); }
public static Expr _Sub(Expr lhs, OpMinus op, Expr rhs) { return(new SubExpr(lhs, rhs)); }