While.AST.Sequences.VariableSequence.AddVariable C# (CSharp) Method

AddVariable() public method

public AddVariable ( Variable v ) : void
v Variable
return void
        public void AddVariable(Variable v)
        {
            AddChild(v);
        }

Usage Example

 void Proc(ProcedureSequence procs)
 {
     StatementSequence statements;
     string name;
     VariableSequence valArgs = new VariableSequence();
     Variable resultArg = null;
     Expect(5);
     Token ptok = t;
     Expect(1);
     name = t.val;
     Expect(6);
     if (la.kind == 7 || la.kind == 8) {
     if (la.kind == 7) {
         Get();
         Expect(1);
         Variable v = new Variable(t.val);
         v.IsValueArg = true;
         valArgs.AddVariable(v);
         SymbolTable.DefineArgument(t.val);
         if (la.kind == 12) {
             Args(valArgs, out resultArg);
         }
     } else {
         Get();
         Expect(1);
         resultArg = new Variable(t.val);
         resultArg.IsResultArg = true;
         SymbolTable.DefineResultArgument(t.val);
     }
     }
     Expect(9);
     SequencePoint seq1 = new SequencePoint(ptok.line,ptok.col, t.line,t.col+t.val.Length);
     Expect(10);
     StmtSeq(out statements);
     Expect(4);
     SequencePoint seq2 = new SequencePoint(t.line, t.col, t.line, t.col+t.val.Length);
     Expect(11);
     if (procs.ContainsProcedure(name)) {
     errors.SemErr(ptok.line, ptok.col, "Procedure '" + name + "' is already declared");
     } else {
     Procedure proc = new Procedure(name, valArgs, resultArg, statements);
     proc.AddSequencePoint(seq1);
     proc.AddSequencePoint(seq2);
     procs.AddProcedure(proc);
     }
     SymbolTable.Clear();
 }
All Usage Examples Of While.AST.Sequences.VariableSequence::AddVariable
VariableSequence