Ejemplo n.º 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);
                }

            }
        }
Ejemplo n.º 2
0
        public void InsertBefore(NodeLinkedList list)
        {
            Node last = list.Last;

            last.Next = this.First;
            this.First.Previous = last;
            this.First = list.First;
        }
Ejemplo n.º 3
0
        public void InsertAfter(NodeLinkedList list)
        {
            Node first = list.First;

            first.Previous = this.Last;
            Last.Next = first;
            this.Last = list.Last;
        }
Ejemplo n.º 4
0
        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;
        }