@@ -266,10 +266,10 @@ def set_location_info(thing, location):
266
266
267
267
def _split_namespace (namestack ):
268
268
"""
269
- Given a list of name elements, find the namespace portion
270
- and return that as a string
269
+ Given a list of name elements, find the namespace portion
270
+ and return that as a string
271
271
272
- :rtype: Tuple[str, list]
272
+ :rtype: Tuple[str, list]
273
273
"""
274
274
# TODO: this should be using tokens instead of nhack
275
275
@@ -293,9 +293,9 @@ def _split_namespace(namestack):
293
293
294
294
def _iter_ns_str_reversed (namespace ):
295
295
"""
296
- Take a namespace string, and yield successively smaller portions
297
- of it (ex foo::bar::baz::, foo::bar::, foo::). The last item yielded
298
- will always be an empty string
296
+ Take a namespace string, and yield successively smaller portions
297
+ of it (ex foo::bar::baz::, foo::bar::, foo::). The last item yielded
298
+ will always be an empty string
299
299
"""
300
300
if namespace :
301
301
parts = namespace .split ("::" )
@@ -334,13 +334,13 @@ def __init__(self, msg, tok=None):
334
334
335
335
class CppTemplateParam (dict ):
336
336
"""
337
- Dictionary that contains the following:
337
+ Dictionary that contains the following:
338
338
339
- - ``decltype`` - If True, this is a decltype
340
- - ``param`` - Parameter value or typename
341
- - ``params`` - Only present if a template specialization. Is a list of
342
- :class:`.CppTemplateParam`
343
- - ``...`` - If True, indicates a parameter pack
339
+ - ``decltype`` - If True, this is a decltype
340
+ - ``param`` - Parameter value or typename
341
+ - ``params`` - Only present if a template specialization. Is a list of
342
+ :class:`.CppTemplateParam`
343
+ - ``...`` - If True, indicates a parameter pack
344
344
"""
345
345
346
346
def __init__ (self ):
@@ -370,17 +370,17 @@ def __str__(self):
370
370
371
371
class CppBaseDecl (dict ):
372
372
"""
373
- Dictionary that contains the following
374
-
375
- - ``access`` - Anything in supportedAccessSpecifier
376
- - ``class`` - Name of the type, along with template specializations
377
- - ``decl_name`` - Name of the type only
378
- - ``decl_params`` - Only present if a template specialization (Foo<int>).
379
- Is a list of :class:`.CppTemplateParam`.
380
- - ``decltype`` - True/False indicates a decltype, the contents are in
381
- ``decl_name``
382
- - ``virtual`` - True/False indicates virtual inheritance
383
- - ``...`` - True/False indicates a parameter pack
373
+ Dictionary that contains the following
374
+
375
+ - ``access`` - Anything in supportedAccessSpecifier
376
+ - ``class`` - Name of the type, along with template specializations
377
+ - ``decl_name`` - Name of the type only
378
+ - ``decl_params`` - Only present if a template specialization (Foo<int>).
379
+ Is a list of :class:`.CppTemplateParam`.
380
+ - ``decltype`` - True/False indicates a decltype, the contents are in
381
+ ``decl_name``
382
+ - ``virtual`` - True/False indicates virtual inheritance
383
+ - ``...`` - True/False indicates a parameter pack
384
384
385
385
"""
386
386
@@ -599,50 +599,50 @@ def _parse_cpp_base(stack, default_access):
599
599
600
600
class CppClass (dict ):
601
601
"""
602
- Dictionary that contains at least the following keys:
603
-
604
- * ``name`` - Name of the class
605
- * ``doxygen`` - Doxygen comments associated with the class if they exist
606
- * ``inherits`` - List of Classes that this one inherits. Values are
607
- :class:`.CppBaseDecl`
608
- * ``methods`` - Dictionary where keys are from supportedAccessSpecifier
609
- and values are a lists of :class:`.CppMethod`
610
- * ``namespace`` - Namespace of class
611
- * ``properties`` - Dictionary where keys are from supportedAccessSpecifier
612
- and values are lists of :class:`.CppVariable`
613
- * ``enums`` - Dictionary where keys are from supportedAccessSpecifier and
614
- values are lists of :class:`.CppEnum`
615
- * ``nested_classes`` - Classes and structs defined within this class
616
- * ``final`` - True if final
617
- * ``abstract`` - True if abstract
618
- * ``using`` - Using directives in this class scope: key is name for lookup,
619
- value is :class:`.CppVariable`
620
- * ``parent`` - If not None, the class that this class is nested in
621
-
622
- An example of how this could look is as follows::
623
-
602
+ Dictionary that contains at least the following keys:
603
+
604
+ * ``name`` - Name of the class
605
+ * ``doxygen`` - Doxygen comments associated with the class if they exist
606
+ * ``inherits`` - List of Classes that this one inherits. Values are
607
+ :class:`.CppBaseDecl`
608
+ * ``methods`` - Dictionary where keys are from supportedAccessSpecifier
609
+ and values are a lists of :class:`.CppMethod`
610
+ * ``namespace`` - Namespace of class
611
+ * ``properties`` - Dictionary where keys are from supportedAccessSpecifier
612
+ and values are lists of :class:`.CppVariable`
613
+ * ``enums`` - Dictionary where keys are from supportedAccessSpecifier and
614
+ values are lists of :class:`.CppEnum`
615
+ * ``nested_classes`` - Classes and structs defined within this class
616
+ * ``final`` - True if final
617
+ * ``abstract`` - True if abstract
618
+ * ``using`` - Using directives in this class scope: key is name for lookup,
619
+ value is :class:`.CppVariable`
620
+ * ``parent`` - If not None, the class that this class is nested in
621
+
622
+ An example of how this could look is as follows::
623
+
624
+ {
625
+ 'name': ""
626
+ 'inherits':[]
627
+ 'methods':
624
628
{
625
- 'name': ""
626
- 'inherits':[]
627
- 'methods':
628
- {
629
- 'public':[],
630
- 'protected':[],
631
- 'private':[]
632
- },
633
- 'properties':
634
- {
635
- 'public':[],
636
- 'protected':[],
637
- 'private':[]
638
- },
639
- 'enums':
640
- {
641
- 'public':[],
642
- 'protected':[],
643
- 'private':[]
644
- }
629
+ 'public':[],
630
+ 'protected':[],
631
+ 'private':[]
632
+ },
633
+ 'properties':
634
+ {
635
+ 'public':[],
636
+ 'protected':[],
637
+ 'private':[]
638
+ },
639
+ 'enums':
640
+ {
641
+ 'public':[],
642
+ 'protected':[],
643
+ 'private':[]
645
644
}
645
+ }
646
646
"""
647
647
648
648
def get_all_methods (self ):
@@ -837,11 +837,11 @@ def __str__(self):
837
837
838
838
class CppUnion (CppClass ):
839
839
"""
840
- Dictionary that contains at least the following keys:
840
+ Dictionary that contains at least the following keys:
841
841
842
- * ``name`` - Name of the union
843
- * ``doxygen`` - Doxygen comments associated with the union if they exist
844
- * ``members`` - List of members of the union
842
+ * ``name`` - Name of the union
843
+ * ``doxygen`` - Doxygen comments associated with the union if they exist
844
+ * ``members`` - List of members of the union
845
845
"""
846
846
847
847
def __init__ (self , nameStack , doxygen , location ):
@@ -953,13 +953,13 @@ def _params_helper2(self, params):
953
953
954
954
class CppMethod (_CppMethod ):
955
955
"""
956
- Dictionary that contains at least the following keys:
956
+ Dictionary that contains at least the following keys:
957
957
958
- * ``rtnType`` - Return type of the method (ex. "int")
959
- * ``name`` - Name of the method
960
- * ``doxygen`` - Doxygen comments associated with the method if they exist
961
- * ``parameters`` - List of :class:`.CppVariable`
962
- * ``parent`` - If not None, the class this method belongs to
958
+ * ``rtnType`` - Return type of the method (ex. "int")
959
+ * ``name`` - Name of the method
960
+ * ``doxygen`` - Doxygen comments associated with the method if they exist
961
+ * ``parameters`` - List of :class:`.CppVariable`
962
+ * ``parent`` - If not None, the class this method belongs to
963
963
"""
964
964
965
965
def show (self ):
@@ -1173,18 +1173,18 @@ def init(self):
1173
1173
1174
1174
class CppVariable (_CppVariable ):
1175
1175
"""
1176
- Dictionary that contains at least the following keys:
1177
-
1178
- * ``type`` - Type for the variable (ex. "const string &")
1179
- * ``name`` - Name of the variable (ex. "numItems")
1180
- * ``namespace`` - Namespace
1181
- * ``desc`` - If a method/function parameter, doxygen description for this parameter (optional)
1182
- * ``doxygen`` - If a normal property/variable, doxygen description for this
1183
- * ``default`` - Default value of the variable, this key will only
1184
- exist if there is a default value
1185
- * ``extern`` - True if its an extern, False if not
1186
- * ``parent`` - If not None, either the class this is a property of, or the
1187
- method this variable is a parameter in
1176
+ Dictionary that contains at least the following keys:
1177
+
1178
+ * ``type`` - Type for the variable (ex. "const string &")
1179
+ * ``name`` - Name of the variable (ex. "numItems")
1180
+ * ``namespace`` - Namespace
1181
+ * ``desc`` - If a method/function parameter, doxygen description for this parameter (optional)
1182
+ * ``doxygen`` - If a normal property/variable, doxygen description for this
1183
+ * ``default`` - Default value of the variable, this key will only
1184
+ exist if there is a default value
1185
+ * ``extern`` - True if its an extern, False if not
1186
+ * ``parent`` - If not None, either the class this is a property of, or the
1187
+ method this variable is a parameter in
1188
1188
"""
1189
1189
1190
1190
Vars = []
@@ -1308,7 +1308,7 @@ class _CppEnum(dict):
1308
1308
def resolve_enum_values (self , values ):
1309
1309
"""Evaluates the values list of dictionaries passed in and figures out what the enum value
1310
1310
for each enum is editing in place:
1311
-
1311
+
1312
1312
Example
1313
1313
From: [{'name': 'ORANGE'},
1314
1314
{'name': 'RED'},
@@ -1365,9 +1365,9 @@ class CppEnum(_CppEnum):
1365
1365
1366
1366
* ``name`` - Name of the enum (ex. "ItemState")
1367
1367
* ``namespace`` - Namespace containing the enum
1368
- * ``values`` - List of values. The values are a dictionary with
1368
+ * ``values`` - List of values. The values are a dictionary with
1369
1369
the following key/values:
1370
-
1370
+
1371
1371
- ``name`` - name of the key (ex. "PARSING_HEADER"),
1372
1372
- ``value`` - Specified value of the enum, this key will only exist
1373
1373
if a value for a given enum value was defined
@@ -1385,11 +1385,11 @@ def __init__(self, name, doxygen, location):
1385
1385
1386
1386
1387
1387
class _CppPreprocessorLiteral (dict ):
1388
- """ Implementation for #pragmas, #defines and #includes, contains the
1389
- following keys:
1388
+ """Implementation for #pragmas, #defines and #includes, contains the
1389
+ following keys:
1390
1390
1391
- * ``value`` the value literal of the preprocessor item
1392
- * ``line_number`` line number at which the item was found
1391
+ * ``value`` the value literal of the preprocessor item
1392
+ * ``line_number`` line number at which the item was found
1393
1393
"""
1394
1394
1395
1395
def __init__ (self , macro , location ):
@@ -2638,7 +2638,7 @@ def show(self):
2638
2638
2639
2639
def __init__ (self , headerFileName , argType = "file" , encoding = None , ** kwargs ):
2640
2640
"""Create the parsed C++ header file parse tree
2641
-
2641
+
2642
2642
headerFileName - Name of the file to parse OR actual file contents (depends on argType)
2643
2643
argType - Indicates how to interpret headerFileName as a file string or file name
2644
2644
kwargs - Supports the following keywords
@@ -3045,7 +3045,8 @@ def __init__(self, headerFileName, argType="file", encoding=None, **kwargs):
3045
3045
)
3046
3046
3047
3047
raise_exc (
3048
- CppParseError (msg ), e ,
3048
+ CppParseError (msg ),
3049
+ e ,
3049
3050
)
3050
3051
3051
3052
self .finalize ()
@@ -3172,16 +3173,16 @@ def _discard_contents(self, start_type, end_type):
3172
3173
3173
3174
def _discard_ctor_initializer (self ):
3174
3175
"""
3175
- ctor_initializer: ":" mem_initializer_list
3176
+ ctor_initializer: ":" mem_initializer_list
3177
+
3178
+ mem_initializer_list: mem_initializer ["..."]
3179
+ | mem_initializer "," mem_initializer_list ["..."]
3176
3180
3177
- mem_initializer_list: mem_initializer ["..."]
3178
- | mem_initializer "," mem_initializer_list ["..."]
3181
+ mem_initializer: mem_initializer_id "(" [expression_list] ")"
3182
+ | mem_initializer_id braced_init_list
3179
3183
3180
- mem_initializer: mem_initializer_id "(" [expression_list] ")"
3181
- | mem_initializer_id braced_init_list
3182
-
3183
- mem_initializer_id: class_or_decltype
3184
- | IDENTIFIER
3184
+ mem_initializer_id: class_or_decltype
3185
+ | IDENTIFIER
3185
3186
"""
3186
3187
debug_print ("discarding ctor intializer" )
3187
3188
# all of this is discarded.. the challenge is to determine
@@ -3451,19 +3452,19 @@ def _parse_attribute_specifier_seq(self, tok):
3451
3452
3452
3453
def _parse_enum (self ):
3453
3454
"""
3454
- opaque_enum_declaration: enum_key [attribute_specifier_seq] IDENTIFIER [enum_base] ";"
3455
-
3456
- enum_specifier: enum_head "{" [enumerator_list] "}"
3457
- | enum_head "{" enumerator_list "," "}"
3458
-
3459
- enum_head: enum_key [attribute_specifier_seq] [IDENTIFIER] [enum_base]
3460
- | enum_key [attribute_specifier_seq] nested_name_specifier IDENTIFIER [enum_base]
3461
-
3462
- enum_key: "enum"
3463
- | "enum" "class"
3464
- | "enum" "struct"
3465
-
3466
- enum_base: ":" type_specifier_seq
3455
+ opaque_enum_declaration: enum_key [attribute_specifier_seq] IDENTIFIER [enum_base] ";"
3456
+
3457
+ enum_specifier: enum_head "{" [enumerator_list] "}"
3458
+ | enum_head "{" enumerator_list "," "}"
3459
+
3460
+ enum_head: enum_key [attribute_specifier_seq] [IDENTIFIER] [enum_base]
3461
+ | enum_key [attribute_specifier_seq] nested_name_specifier IDENTIFIER [enum_base]
3462
+
3463
+ enum_key: "enum"
3464
+ | "enum" "class"
3465
+ | "enum" "struct"
3466
+
3467
+ enum_base: ":" type_specifier_seq
3467
3468
"""
3468
3469
debug_print ("parsing enum" )
3469
3470
@@ -3573,13 +3574,13 @@ def _install_enum(self, newEnum, instancesData):
3573
3574
3574
3575
def _parse_enumerator_list (self , values ):
3575
3576
"""
3576
- enumerator_list: enumerator_definition
3577
- | enumerator_list "," enumerator_definition
3578
-
3579
- enumerator_definition: enumerator
3580
- | enumerator "=" constant_expression
3581
-
3582
- enumerator: IDENTIFIER
3577
+ enumerator_list: enumerator_definition
3578
+ | enumerator_list "," enumerator_definition
3579
+
3580
+ enumerator_definition: enumerator
3581
+ | enumerator "=" constant_expression
3582
+
3583
+ enumerator: IDENTIFIER
3583
3584
"""
3584
3585
while True :
3585
3586
name_tok = self ._next_token_must_be ("}" , "NAME" )
0 commit comments