예제 #1
0
파일: ASTBuilder.cs 프로젝트: Deaxz/ML4D
        public override Node VisitInfixBoolExpr(ML4DParser.InfixBoolExprContext context)
        {
            InfixExpressionNode node;

            switch (context.op.Type)
            {
            case ML4DLexer.AND:
                node = new AndNode("and");
                break;

            case ML4DLexer.OR:
                node = new OrNode("or");
                break;

            default:
                throw new NotSupportedException(
                          $"The operator {context.op.Text}, is not a valid bool operator.");
            }
            node.Left  = (ExpressionNode)Visit(context.left);
            node.Right = (ExpressionNode)Visit(context.right);
            return(node);
        }
예제 #2
0
 /// <summary>
 /// Exit a parse tree produced by the <c>infixBoolExpr</c>
 /// labeled alternative in <see cref="ML4DParser.bool_expr"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitInfixBoolExpr([NotNull] ML4DParser.InfixBoolExprContext context)
 {
 }
예제 #3
0
 /// <summary>
 /// Visit a parse tree produced by the <c>infixBoolExpr</c>
 /// labeled alternative in <see cref="ML4DParser.bool_expr"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitInfixBoolExpr([NotNull] ML4DParser.InfixBoolExprContext context)
 {
     return(VisitChildren(context));
 }