aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2018-02-23 13:47:05 +0100
committerChristian Tismer <tismer@stackless.com>2018-02-23 13:34:26 +0000
commit784df63e6be7339df3872a56baf89ca81c7e7199 (patch)
tree5357a9160922ad650160e9df23a8c845e54bcb8b /sources/pyside2
parented9f21a2ccafdee0e96493b99a249d88d5c4f21a (diff)
Signature: make the parser more complete for 5.11
The parser regex could not handle angle bracket pairs with commas in it. This is needed for template parameter lists. When they contain commata between the angle brackets, the parser did not recognize that. This fix allows for one level of angle brackets with whatever content. It will probably be needed in 5.11, but the syntax that the regex recognizes should always be complete. I had a hard time to understand this split regex again, so I added some more documentation, and it should now be simple to extend it even more. Task-number: PYSIDE-510 Task-number: PYSIDE-616 Change-Id: Ic854852f35af8b4526a63ffe920f2c01204c1f31 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/support/signature/parser.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/support/signature/parser.py b/sources/pyside2/PySide2/support/signature/parser.py
index c55973632..b067f245b 100644
--- a/sources/pyside2/PySide2/support/signature/parser.py
+++ b/sources/pyside2/PySide2/support/signature/parser.py
@@ -82,10 +82,18 @@ def _parse_line(line):
"""
ret = re.match(line_re, line, re.VERBOSE).groupdict()
arglist = ret["arglist"]
+ # The following is a split re. The string is broken into pieces which are
+ # between the recognized strings. Because the re has groups, both the
+ # strings and the delimiters are returned, where the strings are not
+ # interesting at all: They are just the commata.
+ # Note that it is necessary to put the characters with special handling in
+ # the first group (comma, brace, angle bracket).
+ # Then they are not recognized there, and we can handle them differently
+ # in the following expressions.
arglist = list(x.strip() for x in re.split(r"""
(
(?: # inner group is not capturing
- [^,()] # no commas or braces
+ [^,()<>] # no commas or braces or angle brackets
|
\(
(?:
@@ -96,6 +104,10 @@ def _parse_line(line):
\)
)*
\)
+ |
+ < # or one angle bracket pair
+ [^<>]*
+ >
)+ # longest possible span
) # this list is interspersed with "," and surrounded by ""
""", arglist, flags=re.VERBOSE)