Beispiel #1
0
        public override AstNode VisitPrimaryExpression(ALangParser.PrimaryExpressionContext context)
        {
            ExpressionNode node;

            if (context.BOOLOP().Length > 0)
            {
                node = new ExpressionNode(context);
                for (int n = 0; n < context.BOOLOP().Length; n++)
                {
                    node.Operator = GetOperatorKind(context.BOOLOP(n).GetText());
                    node.Left     = context.predicateExpression(n).Accept(this);
                    node.Right    = context.predicateExpression(n + 1).Accept(this);
                }
            }
            else
            {
                return(context.predicateExpression(0).Accept(this));
            }

            return(node);
        }
Beispiel #2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="ALangParser.primaryExpression"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitPrimaryExpression([NotNull] ALangParser.PrimaryExpressionContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="ALangParser.primaryExpression"/>.
 /// <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 VisitPrimaryExpression([NotNull] ALangParser.PrimaryExpressionContext context)
 {
     return(VisitChildren(context));
 }