Пример #1
0
        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);
        }
Пример #2
0
 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
         );
 }
Пример #3
0
        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);
        }