Example #1
0
        public override String VisitForeachCommand([NotNull] NewGrammarParser.ForeachCommandContext context)
        {
            String temp_tab = this.tab;

            this.tab += "\t";
            String lines = "";

            for (int i = 4; i < context.ChildCount; i++)
            {
                if (context.GetChild(i).GetType().Name.Equals("LineContext"))
                {
                    lines += Visit(context.GetChild(i));
                }
                else if (context.GetChild(i).GetText().Equals("end for"))
                {
                    break;
                }
            }

            this.tab = temp_tab;

            /*if (this.attributesList.Contains(context.GetChild(3).GetText()))
             * {
             *  return "for " + context.GetChild(1).GetText() + " in self." + context.GetChild(3).GetText() + ":" + Environment.NewLine + lines;
             * }*/

            return("for " + context.GetChild(1).GetText() + " in " + Visit(context.GetChild(3)) + ":" + Environment.NewLine + lines);
            //return base.VisitForeachStatement(context);
        }
 /// <summary>
 /// Exit a parse tree produced by <see cref="NewGrammarParser.foreachCommand"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitForeachCommand([NotNull] NewGrammarParser.ForeachCommandContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="NewGrammarParser.foreachCommand"/>.
 /// <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 VisitForeachCommand([NotNull] NewGrammarParser.ForeachCommandContext context)
 {
     return(VisitChildren(context));
 }