cxxheaderparser 1.7.3__tar.gz → 1.7.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/PKG-INFO +1 -1
  2. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/parser.py +41 -20
  3. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/version.py +2 -2
  4. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/.gitignore +0 -0
  5. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/LICENSE.txt +0 -0
  6. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/README.md +0 -0
  7. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/__init__.py +0 -0
  8. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/__main__.py +0 -0
  9. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/_ply/__init__.py +0 -0
  10. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/_ply/lex.py +0 -0
  11. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/dump.py +0 -0
  12. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/errors.py +0 -0
  13. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/gentest.py +0 -0
  14. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/lexer.py +0 -0
  15. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/options.py +0 -0
  16. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/parserstate.py +0 -0
  17. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/preprocessor.py +0 -0
  18. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/py.typed +0 -0
  19. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/simple.py +0 -0
  20. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/tokfmt.py +0 -0
  21. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/types.py +0 -0
  22. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/cxxheaderparser/visitor.py +0 -0
  23. {cxxheaderparser-1.7.3 → cxxheaderparser-1.7.4}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cxxheaderparser
3
- Version: 1.7.3
3
+ Version: 1.7.4
4
4
  Summary: Modern C++ header parser
5
5
  Project-URL: Source code, https://github.com/robotpy/cxxheaderparser
6
6
  Author-email: Dustin Spicuzza <robotpy@googlegroups.com>
@@ -1606,7 +1606,7 @@ class CxxParser:
1606
1606
 
1607
1607
  else:
1608
1608
  # default value initializer
1609
- tok = self.lex.token_if("{")
1609
+ tok = self.lex.token_if("{", "(")
1610
1610
  if tok:
1611
1611
  if is_typedef:
1612
1612
  raise self._parse_error(tok)
@@ -2537,6 +2537,22 @@ class CxxParser:
2537
2537
 
2538
2538
  _parse_type_ptr_ref_paren = {"*", "&", "DBL_AMP", "("}
2539
2539
 
2540
+ _parameter_start_tokens = (
2541
+ _pqname_start_tokens
2542
+ | _attribute_start_tokens
2543
+ | _type_kwd_both
2544
+ | _type_kwd_meth
2545
+ | {
2546
+ "volatile",
2547
+ "mutable",
2548
+ "__inline",
2549
+ "__forceinline",
2550
+ "this",
2551
+ "ELLIPSIS",
2552
+ ")",
2553
+ }
2554
+ )
2555
+
2540
2556
  def _parse_type(
2541
2557
  self,
2542
2558
  tok: typing.Optional[LexToken],
@@ -2735,29 +2751,34 @@ class CxxParser:
2735
2751
 
2736
2752
  # TODO: "type fn(x);" is ambiguous here. Because this is a header
2737
2753
  # parser, we assume it's a function, not a variable declaration
2738
- # calling a constructor
2754
+ # calling a constructor, unless the token after ( cannot start a
2755
+ # parameter declaration.
2739
2756
 
2740
- # if ( then it's a function/method
2741
- if self.lex.token_if("("):
2757
+ # if ( then it's usually a function/method
2758
+ tok = self.lex.token_if("(")
2759
+ if tok:
2742
2760
  if not pqname:
2743
2761
  raise self._parse_error(None)
2744
2762
 
2745
- return self._parse_function(
2746
- mods,
2747
- dtype,
2748
- pqname,
2749
- op,
2750
- template,
2751
- doxygen,
2752
- location,
2753
- constructor,
2754
- destructor,
2755
- is_friend,
2756
- is_typedef,
2757
- msvc_convention,
2758
- is_guide,
2759
- attributes,
2760
- )
2763
+ if not self.lex.token_peek_if(*self._parameter_start_tokens):
2764
+ self.lex.return_token(tok)
2765
+ else:
2766
+ return self._parse_function(
2767
+ mods,
2768
+ dtype,
2769
+ pqname,
2770
+ op,
2771
+ template,
2772
+ doxygen,
2773
+ location,
2774
+ constructor,
2775
+ destructor,
2776
+ is_friend,
2777
+ is_typedef,
2778
+ msvc_convention,
2779
+ is_guide,
2780
+ attributes,
2781
+ )
2761
2782
  elif msvc_convention:
2762
2783
  raise self._parse_error(msvc_convention)
2763
2784
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.7.3'
22
- __version_tuple__ = version_tuple = (1, 7, 3)
21
+ __version__ = version = '1.7.4'
22
+ __version_tuple__ = version_tuple = (1, 7, 4)
23
23
 
24
24
  __commit_id__ = commit_id = None