예제 #1
0
        public override Expression VisitIdentifier([NotNull] calculatorParser.IdentifierContext context)
        {
            if (context.children != null)
            {
                foreach (IParseTree c in context.children)
                {
                    Visit(c);
                }
            }
            var expr = Expression.Variable(typeof(double), context.GetText());

            Results[context] = expr;
            return(expr);
        }
예제 #2
0
        public override bool VisitIdentifier([NotNull] calculatorParser.IdentifierContext context)
        {
            bool res = false;

            if (context.children != null)
            {
                foreach (IParseTree c in context.children)
                {
                    if (!Visit(c))
                    {
                        Results[context] = false;
                        return(false);
                    }
                }
            }
            Results[context] = res;
            return(res);
        }