コード例 #1
0
        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);
                }

            }
        }
コード例 #2
0
        public void InsertBefore(NodeLinkedList list)
        {
            Node last = list.Last;

            last.Next = this.First;
            this.First.Previous = last;
            this.First = list.First;
        }
コード例 #3
0
        public void InsertAfter(NodeLinkedList list)
        {
            Node first = list.First;

            first.Previous = this.Last;
            Last.Next = first;
            this.Last = list.Last;
        }
コード例 #4
0
ファイル: Compiler.cs プロジェクト: JoepvdBroek/DP2_Compiler
        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;
        }