示例#1
0
        public override bool VisitExpression([NotNull] calculatorParser.ExpressionContext context)
        {
            if (context.children != null)
            {
                foreach (IParseTree c in context.children)
                {
                    if (!Visit(c))
                    {
                        Results[context] = false;
                        return(false);
                    }
                }
            }
            if (context.ChildCount == 0)
            {
                Results[context] = false;
                return(false);
            }
            bool lhs = Results[context.GetChild(0)];

            if (context.ChildCount == 1)
            {
                Results[context] = lhs;
                return(lhs);
            }
            Results[context] = false;
            return(false);
        }
示例#2
0
 public override Expression VisitExpression([NotNull] calculatorParser.ExpressionContext context)
 {
     if (context.children != null)
     {
         foreach (IParseTree c in context.children)
         {
             Visit(c);
         }
     }
     if (_completeness.Results[context])
     {
         Expression lhs = Results[context.GetChild(0)];
         Results[context] = lhs;
         return(lhs);
     }
     Results[context] = null;
     return(null);
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="calculatorParser.expression"/>.
 /// <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 VisitExpression([NotNull] calculatorParser.ExpressionContext context)
 {
     return(VisitChildren(context));
 }
示例#4
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="calculatorParser.expression"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitExpression([NotNull] calculatorParser.ExpressionContext context)
 {
 }