private SpelNode EatProductExpression() { var expr = EatPowerIncDecExpression(); while (PeekToken(TokenKind.STAR, TokenKind.DIV, TokenKind.MOD)) { var t = TakeToken(); // consume STAR/DIV/MOD var rhExpr = EatPowerIncDecExpression(); CheckOperands(t, expr, rhExpr); if (t.Kind == TokenKind.STAR) { expr = new OpMultiply(t.StartPos, t.EndPos, expr, rhExpr); } else if (t.Kind == TokenKind.DIV) { expr = new OpDivide(t.StartPos, t.EndPos, expr, rhExpr); } else { if (t.Kind != TokenKind.MOD) { throw new InvalidOperationException("Mod token expected"); } expr = new OpModulus(t.StartPos, t.EndPos, expr, rhExpr); } } return(expr); }
public GetOperation() { operationIndex["1"] = new OpSum(); operationIndex["2"] = new OpSubtraction(); operationIndex["3"] = new OpMultiply(); operationIndex["4"] = new OpDivide(); operationIndex["5"] = new OpSquare(); operationIndex["6"] = new OpSquareRoot(); }
public static void Rule(BinaryOp400 lhs, OpDivide op) { lhs.CodeFunctor = new CodeFunctor(op.Text, 2, true); }