def p_direct_declarator_1(self, p): """ direct_declarator : ID """ p[0] = c_ast.TypeDecl( declname=p[1], type=None, quals=None, coord=self._token_coord(p, 1))
def p_direct_abstract_declarator_3(self, p): """ direct_abstract_declarator : LBRACKET constant_expression_opt RBRACKET """ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], coord=self._coord(p.lineno(1)))
def p_direct_abstract_declarator_5(self, p): """ direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN """ p[0] = c_ast.FuncDecl( args=p[2], type=c_ast.TypeDecl(None, None, None), coord=p[1].coord)
def p_abstract_declarator_1(self, p): """ abstract_declarator : pointer """ dummytype = c_ast.TypeDecl(None, None, None) p[0] = self._type_modify_decl( decl=dummytype, modifier=p[1])
def p_direct_declarator_2(self, p): """ direct_declarator : ID """ p[0] = c_ast.TypeDecl(declname=p[1], type=None, quals=None, coord=self._coord(p.lineno(1)))
def p_parameter_declaration_2(self, p): """ parameter_declaration : declaration_specifiers abstract_declarator_opt """ spec = p[1] decl = c_ast.Typename(quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None)) typename = spec['type'] or ['int'] p[0] = self._fix_decl_name_type(decl, typename)
def p_struct_declarator_3(self, p): """ struct_declarator : empty """ p[0] = { 'decl': c_ast.TypeDecl(declname=None, type=None, quals=None, coord=self._coord(p.lineno(1))), 'bitsize': None }
def p_type_name(self, p): """ type_name : specifier_qualifier_list abstract_declarator_opt """ #~ print '==========' #~ print p[1] #~ print p[2] #~ print p[2].children() #~ print '==========' typename = c_ast.Typename( quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None)) p[0] = self._fix_decl_name_type(typename, p[1]['type'])