public void Run(NodeLinkedList list) { Node currentNode = list.First; NextNodeVisitor visitor = new NextNodeVisitor(this); while(currentNode != null) { AbstractFunctionCallNode node = currentNode as AbstractFunctionCallNode; if(node != null) { string name = node.Parameters[0]; Commands[name].Execute(this, node.Parameters); } currentNode.Accept(visitor); currentNode = visitor.NextNode; if (this.IsDebug) { System.Threading.Thread.Sleep(100); } } }
public void InsertBefore(NodeLinkedList list) { Node last = list.Last; last.Next = this.First; this.First.Previous = last; this.First = list.First; }
public void InsertAfter(NodeLinkedList list) { Node first = list.First; first.Previous = this.Last; Last.Next = first; this.Last = list.Last; }
public NodeLinkedList compile() { LinkedListNode<Token> currentToken = this.TokenList.First; NodeLinkedList LinkedList = new NodeLinkedList(); LinkedList.Add(new DoNothingNode()); while(currentToken != null) { var compiled = CompilerFactory.getInstance().GetCompiled(currentToken); compiled.CurrentToken = currentToken; compiled.Compile(); currentToken = compiled.CurrentToken.Next; LinkedList.InsertAfter(compiled.Compiled); } return LinkedList; }