public Expression Parse(Parser parser, Expression lhs, Token current) { var thenExpression = parser.ParseNext(); parser.Consume("COLON"); var elseExpression = parser.ParseExpression(Precedence - 1); return new ConditionalExpr(lhs, thenExpression, elseExpression); }
private Question CreateQuestion(string id, string label, Expression computation) { return new Question( new Id(id, position), new Types.BoolType(), new Label(label, position), computation, position ); }
public Expression Parse(Parser parser, Expression lhs, Token current) { var functionName = ((IdentifierExpr) lhs); // we should already be on the leftparen token. var arguments = ParseArguments(parser).ToArray(); parser.Consume("RIGHTPAREN"); return new FunctionCallExpr(functionName, arguments); }