Пример #1
0
        public Sentence_Trad IF_SENTENCE(ParseTreeNode actual, int cant_tabs)
        {
            /*
             * IF_SENTENCE.Rule = INSTRUCTIONS_BODY
             | Empty
             |  ;
             |
             */
            Sentence_Trad sentence = new Sentence_Trad();

            if (actual.ChildNodes.Count > 0)
            {
                var lista_instrucciones = instrucciones.INSTRUCTIONS_BODY(actual.ChildNodes[0], cant_tabs + 1);
                sentence = new Sentence_Trad(lista_instrucciones);
            }

            return(sentence);
        }
Пример #2
0
        public Sentence_Trad ELIF(ParseTreeNode actual, int cant_tabs)
        {
            Sentence_Trad sentence = new Sentence_Trad();

            if (actual.ChildNodes.Count > 0)
            {
                LinkedList <Instruction_Trad> lista_instrucciones = new LinkedList <Instruction_Trad>();
                // ELSE
                if (actual.ChildNodes[1].Term.ToString().Equals("IF_SENTENCE"))
                {
                    lista_instrucciones = instrucciones.INSTRUCTIONS_BODY(actual.ChildNodes[1].ChildNodes[0], cant_tabs + 1);
                }
                // ELSE IF
                else
                {
                    var ifs = IFTHEN(actual.ChildNodes[1], cant_tabs);
                    lista_instrucciones.AddLast(ifs);
                }

                sentence = new Sentence_Trad(lista_instrucciones);
            }
            return(sentence);
        }