public void Insert(Statement instruction)
 {
     if (instruction != null)
         Statements.Insert(0, instruction);
 }
 public ContainerStatement(Statement instruction, Location location)
     : base(location)
 {
     if (instruction != null)
         Statements.Add(instruction);
 }
 public void Add(Statement instruction)
 {
     if (instruction != null)
         Statements.Add(instruction);
 }
Beispiel #4
0
        private ForRofContainerStatement CreateForrof(List<string> comments, Expression expression, Statement statement, List<LabelName> statementlabels, NonterminalToken token)
        {
            ForRofContainerStatement forrof;
            forrof = new ForRofContainerStatement(token.Location);
            forrof.Comments = comments;
            forrof.Labels = statementlabels;
            forrof.Add(statement);

            LabelName l = new LabelName(expression.Location, "#forof" + rofforCounter);
            if (statementlabels.Count > 0)
            {
                l = statementlabels[statementlabels.Count - 1];
            }
            else
            {
                statementlabels.Add(l);
            }

            //for label could be reused
            //CheckName(l, token.Tokens[1].Location);
            variables[l.Name] = expression;

            //for label could be reused
            //CheckName(l, token.Tokens[1].Location);
            forrof.LimitName = l.Name + "#" + rofforCounter + "#limit";
            variables[forrof.LimitName] = expression;

            rofforCounter++;
            return forrof;
        }