Exemple #1
0
        public override void Compile(LinkedListNode<Token> node, Listitem lastInsertedAction)
        {
            node = node.Next;
            if (node.Value.Text == "(")
            {
                DoNothing end = new DoNothing();

                JumpConditional jc = new JumpConditional();
                jc.Condition = GetExpression(ref node);
                jc.OnTrue = new DoNothing();
                ActionList.AddLast(jc);
                ActionList.AddLast(jc.OnTrue);

                node = node.Next;

                if (node.Value.Text == "{")
                {
                    List<LinkedListNode<Token>> statement = GetStatement(ref node);
                    Jump tmpjump = new Jump();
                    tmpjump.Goto = end;
                    tmpjump.Statement = statement;
                    ActionList.AddLast(tmpjump);
                }

                // Hier moet eigelijk nog een else check komen
                jc.OnFalse = end;

                ActionList.AddLast(end);
            }
            else
                Console.WriteLine("Expected '(' exception");
        }
Exemple #2
0
        public override void Compile(LinkedListNode<Token> node, Listitem lastInsertedAction)
        {
            node = node.Next;
            if (node.Value.Text == "(")
            {
                List<LinkedListNode<Token>> expression = GetExpression(ref node);

                JumpConditional temp = new JumpConditional();
                temp.Condition = expression;
                temp.OnTrue = new DoNothing();
                ActionList.AddLast(temp);
                ActionList.AddLast(temp.OnTrue);

                node = node.Next;

                if (node.Value.Text == "{") {
                    List<LinkedListNode<Token>> statement = GetStatement(ref node);
                    Jump tempjump = new Jump();
                    tempjump.Goto = (Action) lastInsertedAction;
                    tempjump.Statement = statement;
                    ActionList.AddLast(tempjump);
                }
                temp.OnFalse = new DoNothing();
                ActionList.AddLast(temp.OnFalse);
            }
            else
                Console.WriteLine("Expected '(' exception");
        }