Esempio n. 1
0
    def region_address(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        region_address_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [LPAREN, INT, HEX]:
                pass
                self.base_address()
                self.addASTChild(currentAST, self.returnAST)
                region_address_AST = currentAST.root
            elif la1 and la1 in [PLUS]:
                pass
                tmp2_AST = None
                tmp2_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp2_AST)
                self.match(PLUS)
                self.offset()
                self.addASTChild(currentAST, self.returnAST)
                region_address_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_3)
Esempio n. 2
0
    def load_region_name(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        load_region_name_AST = None
        a = None
        a_AST = None
        try:  ## for error handling
            pass
            a = self.LT(1)
            a_AST = self.astFactory.create(a)
            self.addASTChild(currentAST, a_AST)
            self.match(IDENT)
            # print "load_region_name found ", a.getText()

            if getattr(self, "segments_to_sections", None) == None:
                self.segments_to_sections = {}
            self.segments_to_sections[a.getText()] = []
            self.current_segment = a.getText()
            load_region_name_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_2)
Esempio n. 3
0
    def declaration(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        declaration_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [IDENT]:
                pass
                self.func_decl()
                self.addASTChild(currentAST, self.returnAST)
                declaration_AST = currentAST.root
            elif la1 and la1 in [LITERAL_module]:
                pass
                self.module_decl()
                self.addASTChild(currentAST, self.returnAST)
                declaration_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_1)
Esempio n. 4
0
    def input_section_attribute_list_item(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        input_section_attribute_list_item_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [PLUS]:
                pass
                tmp25_AST = None
                tmp25_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp25_AST)
                self.match(PLUS)
                self.input_section_attribute()
                self.addASTChild(currentAST, self.returnAST)
                input_section_attribute_list_item_AST = currentAST.root
            elif la1 and la1 in [IDENT, TOKEN_GDEF]:
                pass
                self.input_symbol_pattern()
                self.addASTChild(currentAST, self.returnAST)
                input_section_attribute_list_item_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_15)
Esempio n. 5
0
    def scatter_description(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        scatter_description_AST = None
        try:  ## for error handling
            pass
            while True:
                if (self.LA(1) == IDENT):
                    pass
                    self.load_region_description()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

            tmp1_AST = None
            tmp1_AST = self.astFactory.create(self.LT(1))
            self.addASTChild(currentAST, tmp1_AST)
            self.match(EOF_TYPE)
            scatter_description_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_0)
Esempio n. 6
0
    def input_section_description_list(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        input_section_description_list_AST = None
        try:  ## for error handling
            pass
            _cnt40 = 0
            while True:
                if (self.LA(1) == ANY or self.LA(1) == IDENT
                        or self.LA(1) == STAR):
                    pass
                    self.input_section_description()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

                _cnt40 += 1
            if _cnt40 < 1:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())
            input_section_description_list_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_0)
Esempio n. 7
0
    def size_length(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        size_length_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [INT, HEX]:
                pass
                self.max_size()
                self.addASTChild(currentAST, self.returnAST)
                size_length_AST = currentAST.root
            elif la1 and la1 in [MINUS]:
                pass
                self.length()
                self.addASTChild(currentAST, self.returnAST)
                size_length_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_5)
Esempio n. 8
0
    def literal(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        literal_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [INT]:
                pass
                self.integer_literal()
                self.addASTChild(currentAST, self.returnAST)
                literal_AST = currentAST.root
            elif la1 and la1 in [ATOM]:
                pass
                self.atom_literal()
                self.addASTChild(currentAST, self.returnAST)
                literal_AST = currentAST.root
            elif la1 and la1 in [QUOTEDSTRING]:
                pass
                self.string_literal()
                self.addASTChild(currentAST, self.returnAST)
                literal_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_4)
Esempio n. 9
0
    def execution_region_description_a(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        execution_region_description_a_AST = None
        try:  ## for error handling
            pass
            tmp15_AST = None
            tmp15_AST = self.astFactory.create(self.LT(1))
            self.addASTChild(currentAST, tmp15_AST)
            self.match(LCURLY)
            while True:
                if (self.LA(1) == ANY or self.LA(1) == IDENT
                        or self.LA(1) == STAR):
                    pass
                    self.input_section_description()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

            tmp16_AST = None
            tmp16_AST = self.astFactory.create(self.LT(1))
            self.addASTChild(currentAST, tmp16_AST)
            self.match(RCURLY)
            execution_region_description_a_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_11)
Esempio n. 10
0
    def scoped_name(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        scoped_name_AST = None
        try:  ## for error handling
            pass
            if (self.LA(1) == IDENT) and (self.LA(2) == PERIOD):
                pass
                self.scope()
                self.addASTChild(currentAST, self.returnAST)
            elif (self.LA(1) == IDENT) and (_tokenSet_7.member(self.LA(2))):
                pass
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

            self.func_name()
            self.addASTChild(currentAST, self.returnAST)
            scoped_name_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_6)
Esempio n. 11
0
    def execution_region_description(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        execution_region_description_AST = None
        try:  ## for error handling
            pass
            self.execution_region_name()
            self.addASTChild(currentAST, self.returnAST)
            self.region_address()
            self.addASTChild(currentAST, self.returnAST)
            self.execution_attribute_list()
            self.addASTChild(currentAST, self.returnAST)
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [MINUS, INT, HEX]:
                pass
                self.size_length()
                self.addASTChild(currentAST, self.returnAST)
            elif la1 and la1 in [LCURLY]:
                pass
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

            self.execution_region_description_a()
            self.addASTChild(currentAST, self.returnAST)
            execution_region_description_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_11)
Esempio n. 12
0
    def atom(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        atom_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [INT, HEX]:
                pass
                self.number()
                self.addASTChild(currentAST, self.returnAST)
                atom_AST = currentAST.root
            elif la1 and la1 in [LPAREN]:
                pass
                tmp8_AST = None
                tmp8_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp8_AST)
                self.match(LPAREN)
                self.expr()
                self.addASTChild(currentAST, self.returnAST)
                tmp9_AST = None
                tmp9_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp9_AST)
                self.match(RPAREN)
                atom_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_8)
Esempio n. 13
0
    def number(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        number_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [INT]:
                pass
                tmp6_AST = None
                tmp6_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp6_AST)
                self.match(INT)
                number_AST = currentAST.root
            elif la1 and la1 in [HEX]:
                pass
                tmp7_AST = None
                tmp7_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp7_AST)
                self.match(HEX)
                number_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_8)
Esempio n. 14
0
    def expr(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        expr_AST = None
        try:  ## for error handling
            pass
            self.atom()
            self.addASTChild(currentAST, self.returnAST)
            while True:
                if (self.LA(1) == PLUS):
                    pass
                    pass
                    tmp5_AST = None
                    tmp5_AST = self.astFactory.create(self.LT(1))
                    self.addASTChild(currentAST, tmp5_AST)
                    self.match(PLUS)
                    self.atom()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

            expr_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_7)
Esempio n. 15
0
    def input_section_attribute_list_items(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        input_section_attribute_list_items_AST = None
        try:  ## for error handling
            pass
            self.input_section_attribute_list_item()
            self.addASTChild(currentAST, self.returnAST)
            while True:
                if (self.LA(1) == COMMA):
                    pass
                    tmp24_AST = None
                    tmp24_AST = self.astFactory.create(self.LT(1))
                    self.addASTChild(currentAST, tmp24_AST)
                    self.match(COMMA)
                    self.input_section_attribute_list_item()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

            input_section_attribute_list_items_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_14)
Esempio n. 16
0
    def unary_expr(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        unary_expr_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [PLUS, MINUS, TILDE]:
                pass
                la1 = self.LA(1)
                if False:
                    pass
                elif la1 and la1 in [MINUS]:
                    pass
                    tmp17_AST = None
                    tmp17_AST = self.astFactory.create(self.LT(1))
                    self.addASTChild(currentAST, tmp17_AST)
                    self.match(MINUS)
                elif la1 and la1 in [PLUS]:
                    pass
                    tmp18_AST = None
                    tmp18_AST = self.astFactory.create(self.LT(1))
                    self.addASTChild(currentAST, tmp18_AST)
                    self.match(PLUS)
                elif la1 and la1 in [TILDE]:
                    pass
                    tmp19_AST = None
                    tmp19_AST = self.astFactory.create(self.LT(1))
                    self.addASTChild(currentAST, tmp19_AST)
                    self.match(TILDE)
                else:
                    raise antlr.NoViableAltException(self.LT(1),
                                                     self.getFilename())

                self.primary_expr()
                self.addASTChild(currentAST, self.returnAST)
                unary_expr_AST = currentAST.root
            elif la1 and la1 in [
                    IDENT, LBRACKET, HASH, INT, ATOM, QUOTEDSTRING
            ]:
                pass
                self.primary_expr()
                self.addASTChild(currentAST, self.returnAST)
                unary_expr_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_6)
Esempio n. 17
0
    def input_section_description(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        input_section_description_AST = None
        a = None
        a_AST = None
        b = None
        b_AST = None
        c = None
        c_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [IDENT]:
                pass
                a = self.LT(1)
                a_AST = self.astFactory.create(a)
                self.addASTChild(currentAST, a_AST)
                self.match(IDENT)
                self.input_section_attribute_list()
                self.addASTChild(currentAST, self.returnAST)
                # print "IDENT input_section_description found ", a.getText()
                input_section_description_AST = currentAST.root
            elif la1 and la1 in [ANY]:
                pass
                b = self.LT(1)
                b_AST = self.astFactory.create(b)
                self.addASTChild(currentAST, b_AST)
                self.match(ANY)
                self.input_section_attribute_list()
                self.addASTChild(currentAST, self.returnAST)
                # print "ANY input_section_description found ", b.getText()
                input_section_description_AST = currentAST.root
            elif la1 and la1 in [STAR]:
                pass
                c = self.LT(1)
                c_AST = self.astFactory.create(c)
                self.addASTChild(currentAST, c_AST)
                self.match(STAR)
                self.input_section_attribute_list()
                self.addASTChild(currentAST, self.returnAST)
                # print "STAR input_section_description found ", c.getText()
                input_section_description_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_13)
Esempio n. 18
0
    def max_size(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        max_size_AST = None
        try:  ## for error handling
            pass
            self.number()
            self.addASTChild(currentAST, self.returnAST)
            max_size_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_5)
Esempio n. 19
0
    def constructed_type(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        constructed_type_AST = None
        try:  ## for error handling
            pass
            self.node_constructor()
            self.addASTChild(currentAST, self.returnAST)
            constructed_type_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_4)
Esempio n. 20
0
    def expression(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        expression_AST = None
        try:  ## for error handling
            pass
            self.add_expr()
            self.addASTChild(currentAST, self.returnAST)
            expression_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_3)
Esempio n. 21
0
    def mult_expr(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        mult_expr_AST = None
        try:  ## for error handling
            pass
            self.unary_expr()
            self.addASTChild(currentAST, self.returnAST)
            while True:
                if ((self.LA(1) >= STAR and self.LA(1) <= MOD)):
                    pass
                    la1 = self.LA(1)
                    if False:
                        pass
                    elif la1 and la1 in [STAR]:
                        pass
                        tmp14_AST = None
                        tmp14_AST = self.astFactory.create(self.LT(1))
                        self.addASTChild(currentAST, tmp14_AST)
                        self.match(STAR)
                    elif la1 and la1 in [DIV]:
                        pass
                        tmp15_AST = None
                        tmp15_AST = self.astFactory.create(self.LT(1))
                        self.addASTChild(currentAST, tmp15_AST)
                        self.match(DIV)
                    elif la1 and la1 in [MOD]:
                        pass
                        tmp16_AST = None
                        tmp16_AST = self.astFactory.create(self.LT(1))
                        self.addASTChild(currentAST, tmp16_AST)
                        self.match(MOD)
                    else:
                        raise antlr.NoViableAltException(
                            self.LT(1), self.getFilename())

                    self.unary_expr()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

            mult_expr_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_5)
Esempio n. 22
0
    def initialisation_option(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        initialisation_option_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [TOKEN_EMPTY]:
                pass
                tmp17_AST = None
                tmp17_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp17_AST)
                self.match(TOKEN_EMPTY)
                initialisation_option_AST = currentAST.root
            elif la1 and la1 in [TOKEN_PADVALUE]:
                pass
                tmp18_AST = None
                tmp18_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp18_AST)
                self.match(TOKEN_PADVALUE)
                self.number()
                self.addASTChild(currentAST, self.returnAST)
                initialisation_option_AST = currentAST.root
            elif la1 and la1 in [TOKEN_ZEROPAD]:
                pass
                tmp19_AST = None
                tmp19_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp19_AST)
                self.match(TOKEN_ZEROPAD)
                initialisation_option_AST = currentAST.root
            elif la1 and la1 in [TOKEN_UNINT]:
                pass
                tmp20_AST = None
                tmp20_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp20_AST)
                self.match(TOKEN_UNINT)
                initialisation_option_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_12)
Esempio n. 23
0
    def string_literal(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        string_literal_AST = None
        try:  ## for error handling
            pass
            tmp28_AST = None
            tmp28_AST = self.astFactory.create(self.LT(1))
            self.addASTChild(currentAST, tmp28_AST)
            self.match(QUOTEDSTRING)
            string_literal_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_4)
Esempio n. 24
0
    def node_constructor(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        node_constructor_AST = None
        try:  ## for error handling
            pass
            self.match(HASH)
            self.expression()
            self.addASTChild(currentAST, self.returnAST)
            self.match(HASH)
            node_constructor_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_4)
Esempio n. 25
0
    def compression_option(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        compression_option_AST = None
        try:  ## for error handling
            pass
            tmp14_AST = None
            tmp14_AST = self.astFactory.create(self.LT(1))
            self.addASTChild(currentAST, tmp14_AST)
            self.match(TOKEN_NOCOMPRESS)
            compression_option_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_10)
Esempio n. 26
0
    def position_option(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        position_option_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [TOKEN_ABSOLUTE]:
                pass
                tmp10_AST = None
                tmp10_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp10_AST)
                self.match(TOKEN_ABSOLUTE)
                position_option_AST = currentAST.root
            elif la1 and la1 in [TOKEN_PI]:
                pass
                tmp11_AST = None
                tmp11_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp11_AST)
                self.match(TOKEN_PI)
                position_option_AST = currentAST.root
            elif la1 and la1 in [TOKEN_RELOC]:
                pass
                tmp12_AST = None
                tmp12_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp12_AST)
                self.match(TOKEN_RELOC)
                position_option_AST = currentAST.root
            elif la1 and la1 in [TOKEN_OVERLAY]:
                pass
                tmp13_AST = None
                tmp13_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp13_AST)
                self.match(TOKEN_OVERLAY)
                position_option_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_9)
Esempio n. 27
0
    def primary_expr(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        primary_expr_AST = None
        try:  ## for error handling
            la1 = self.LA(1)
            if False:
                pass
            elif la1 and la1 in [INT, ATOM, QUOTEDSTRING]:
                pass
                self.literal()
                self.addASTChild(currentAST, self.returnAST)
                primary_expr_AST = currentAST.root
            elif la1 and la1 in [HASH]:
                pass
                self.constructed_type()
                self.addASTChild(currentAST, self.returnAST)
                primary_expr_AST = currentAST.root
            elif la1 and la1 in [IDENT]:
                pass
                self.scoped_name()
                self.addASTChild(currentAST, self.returnAST)
                primary_expr_AST = currentAST.root
            elif la1 and la1 in [LBRACKET]:
                pass
                tmp20_AST = None
                tmp20_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp20_AST)
                self.match(LBRACKET)
                self.expression()
                self.addASTChild(currentAST, self.returnAST)
                tmp21_AST = None
                tmp21_AST = self.astFactory.create(self.LT(1))
                self.addASTChild(currentAST, tmp21_AST)
                self.match(RBRACKET)
                primary_expr_AST = currentAST.root
            else:
                raise antlr.NoViableAltException(self.LT(1),
                                                 self.getFilename())

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_6)
Esempio n. 28
0
    def length(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        length_AST = None
        try:  ## for error handling
            pass
            tmp21_AST = None
            tmp21_AST = self.astFactory.create(self.LT(1))
            self.addASTChild(currentAST, tmp21_AST)
            self.match(MINUS)
            self.number()
            self.addASTChild(currentAST, self.returnAST)
            length_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_5)
Esempio n. 29
0
    def func_decl(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        func_decl_AST = None
        try:  ## for error handling
            pass
            self.func_name()
            self.addASTChild(currentAST, self.returnAST)
            self.match(DEFINED_AS)
            self.expression()
            self.addASTChild(currentAST, self.returnAST)
            self.match(SEMI)
            func_decl_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_1)
Esempio n. 30
0
    def add_expr(self):

        self.returnAST = None
        currentAST = antlr.ASTPair()
        add_expr_AST = None
        try:  ## for error handling
            pass
            self.mult_expr()
            self.addASTChild(currentAST, self.returnAST)
            while True:
                if (self.LA(1) == PLUS or self.LA(1) == MINUS):
                    pass
                    la1 = self.LA(1)
                    if False:
                        pass
                    elif la1 and la1 in [PLUS]:
                        pass
                        tmp12_AST = None
                        tmp12_AST = self.astFactory.create(self.LT(1))
                        self.addASTChild(currentAST, tmp12_AST)
                        self.match(PLUS)
                    elif la1 and la1 in [MINUS]:
                        pass
                        tmp13_AST = None
                        tmp13_AST = self.astFactory.create(self.LT(1))
                        self.addASTChild(currentAST, tmp13_AST)
                        self.match(MINUS)
                    else:
                        raise antlr.NoViableAltException(
                            self.LT(1), self.getFilename())

                    self.mult_expr()
                    self.addASTChild(currentAST, self.returnAST)
                else:
                    break

            add_expr_AST = currentAST.root

        except antlr.RecognitionException, ex:
            self.reportError(ex)
            self.consume()
            self.consumeUntil(_tokenSet_3)