예제 #1
0
        private Expr Conditional()
        {
            Expr expression = Equality();

            if (Match(TokenType.Question))
            {
                Expr thenBranch = Expression();
                Consume(TokenType.Colon, "Expect ':' after then branch of conditional expression.");
                Expr elseBranch = Conditional();
                expression = new Expr.Conditional(expression, thenBranch, elseBranch);
            }
            return(expression);
        }
예제 #2
0
 string Expr.IVisitor <string> .Visit(Expr.Conditional conditional)
 {
     return(Parenthesize("Conditional", conditional.thenBranch, conditional.elseBranch));
 }
예제 #3
0
 public object Visit(Expr.Conditional _conditional)
 {
     return(null);
 }
예제 #4
0
 public object Visit(Expr.Conditional conditional)
 {
     throw new NotImplementedException();
 }