66 _STORAGE_CLASS ,
77 _TYPE_QUALIFIER ,
88 _TYPE_SPEC_SIMPLE ,
9- _TokenStream ,
109)
1110
1211
@@ -50,7 +49,8 @@ def _compare_ast_nodes(self, node1, node2):
5049 children2 = node2 .children ()
5150 if len (children1 ) != len (children2 ):
5251 return False
53- for (name1 , child1 ), (name2 , child2 ) in zip (children1 , children2 ):
52+ for (name1 , child1 ), (name2 , child2 ) in zip (
53+ children1 , children2 , strict = False ):
5454 if name1 != name2 :
5555 return False
5656 if not self ._compare_ast_nodes (child1 , child2 ):
@@ -542,14 +542,13 @@ def _parse_function_decl(self, base_decl):
542542 coord = base_decl .coord ,
543543 )
544544
545- if self ._peek_type () == "LBRACE" :
546- if func .args is not None :
547- for param in func .args .params :
548- if isinstance (param , c_ast .EllipsisParam ):
549- break
550- name = getattr (param , "name" , None )
551- if name :
552- self ._add_identifier (name , param .coord )
545+ if self ._peek_type () == "LBRACE" and func .args is not None :
546+ for param in func .args .params :
547+ if isinstance (param , c_ast .EllipsisParam ):
548+ break
549+ name = getattr (param , "name" , None )
550+ if name :
551+ self ._add_identifier (name , param .coord )
553552
554553 return func
555554
@@ -659,12 +658,12 @@ def _parse_struct_declaration(self):
659658 decl_type = c_ast .IdentifierType (node )
660659 self ._expect ("SEMI" )
661660 return self ._build_declarations (
662- spec = spec , decls = [dict ( decl = decl_type , init = None , bitsize = None ) ]
661+ spec = spec , decls = [{ " decl" : decl_type , " init" : None , " bitsize" : None } ]
663662 )
664663
665664 self ._expect ("SEMI" )
666665 return self ._build_declarations (
667- spec = spec , decls = [dict ( decl = None , init = None , bitsize = None ) ]
666+ spec = spec , decls = [{ " decl" : None , " init" : None , " bitsize" : None } ]
668667 )
669668
670669# }}}
@@ -941,15 +940,15 @@ def _parse_specifier_qualifier_list(self):
941940
942941 def _parse_type_qualifier_list (self ):
943942 quals = []
944- _all_quals = _TYPE_QUALIFIER | _GNU_TYPE_QUALIFIERS
945- while self ._peek_type () in _all_quals :
943+ all_quals = _TYPE_QUALIFIER | _GNU_TYPE_QUALIFIERS
944+ while self ._peek_type () in all_quals :
946945 quals .append (self ._advance ().value )
947946 return quals
948947
949948 def _parse_array_decl_common (self , base_type , coord = None ):
950949 """Override to handle GNU type qualifiers inside array dimensions."""
951950 from pycparser .c_parser import _TYPE_QUALIFIER
952- _all_quals = _TYPE_QUALIFIER | _GNU_TYPE_QUALIFIERS
951+ all_quals = _TYPE_QUALIFIER | _GNU_TYPE_QUALIFIERS
953952
954953 lbrack_tok = self ._expect ("LBRACKET" )
955954 if coord is None :
@@ -966,10 +965,10 @@ def make_array_decl(dim, dim_quals):
966965 self ._expect ("RBRACKET" )
967966 return make_array_decl (dim , dim_quals )
968967
969- if self ._peek_type () in _all_quals :
968+ if self ._peek_type () in all_quals :
970969 dim_quals = self ._parse_type_qualifier_list () or []
971970 if self ._accept ("STATIC" ):
972- dim_quals = dim_quals + [ "static" ]
971+ dim_quals = [ * dim_quals , "static" ]
973972 dim = self ._parse_assignment_expression ()
974973 self ._expect ("RBRACKET" )
975974 return make_array_decl (dim , dim_quals )
@@ -1355,8 +1354,8 @@ def _parse_specifier_qualifier_list(self):
13551354
13561355 def _parse_type_qualifier_list (self ):
13571356 quals = []
1358- _all_quals = _TYPE_QUALIFIER | _OCL_TYPE_QUALIFIERS
1359- while self ._peek_type () in _all_quals :
1357+ all_quals = _TYPE_QUALIFIER | _OCL_TYPE_QUALIFIERS
1358+ while self ._peek_type () in all_quals :
13601359 quals .append (self ._advance ().value )
13611360 return quals
13621361
0 commit comments