public override Value VisitIdAtom(AbstractIfStmtParser.IdAtomContext context)
        {
            //return base.VisitIdAtom(context);

            string id          = context.GetText();
            string strVal      = "false";
            bool   bKeyPresent = false;

            if (memory.ContainsKey(id))
            {
                Value memVal = memory[id];
                if (memVal != null)
                {
                    strVal = memVal.ToString();
                }
                bKeyPresent = true;
            }

            double dbl;


            bool isNumerical = double.TryParse(strVal, out dbl);

            bool isBoolean = (strVal == "False" || strVal == "false" || strVal == "True" || strVal == "true");


            if (!isNumerical && !isBoolean && bKeyPresent)
            {
                strVal = strVal.Substring(1, strVal.Length - 1).Replace("\"\"", "\"");
            }

            Value value = new Value(strVal);

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