public void AddListLast(DoubleLinkedList list) { var currentNode = list.First; while(currentNode != null) { AddLast(currentNode); currentNode = currentNode.Next; } }
public DoubleLinkedList CompileLinkedList(LinkedList<Token> tokens) { DoubleLinkedList nodeList = new DoubleLinkedList(); nodeList.AddLast(NodeFactory.Create("DoNothing")); LinkedListNode<Token> currentToken = tokens.First; while (currentToken != null) { Statement statement = StatementFactory.Create(currentToken.Value.Type); if (statement != null) { nodeList.AddListLast(statement.Compile(ref currentToken)); } currentToken = currentToken.Next; } return nodeList; }
public void Run(DoubleLinkedList list) { var currentNode = list.First; NextNodeVisitor visitor = new NextNodeVisitor (this); while (currentNode != null) { AbstractFunctionCall functionNode = currentNode as AbstractFunctionCall; if (functionNode != null) { BaseCommand foundCommand = Commands.GetValue(functionNode.Identifier); if (foundCommand != null) { foundCommand.Execute (this, functionNode.Parameters); } else { Console.WriteLine ("No function named: " + functionNode.Identifier); } } currentNode.Accept (visitor); currentNode = visitor.NextNode; } Console.WriteLine ("##End of code!##"); }
public Statement() { compiledStatement = new DoubleLinkedList(); }
public WhileStatement() { condition = new DoubleLinkedList(); body = new DoubleLinkedList(); }