summaryrefslogtreecommitdiffstats
path: root/Tools/c-analyzer/c_parser/parser/_regexes.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-05-03 19:18:27 (GMT)
committerGitHub <noreply@github.com>2022-05-03 19:18:27 (GMT)
commit456cd513e360ccd17e51ae3711ec48976b1be0c0 (patch)
tree7d168a0aca4d353922828ae2e205f1e8d157598e /Tools/c-analyzer/c_parser/parser/_regexes.py
parentf03d3dd9afd5a2df8ffb6db80c0bb45f2d8909f5 (diff)
downloadcpython-456cd513e360ccd17e51ae3711ec48976b1be0c0.zip
cpython-456cd513e360ccd17e51ae3711ec48976b1be0c0.tar.gz
cpython-456cd513e360ccd17e51ae3711ec48976b1be0c0.tar.bz2
gh-81057: Get the c-analyzer tool working again. (gh-92246)
Diffstat (limited to 'Tools/c-analyzer/c_parser/parser/_regexes.py')
-rw-r--r--Tools/c-analyzer/c_parser/parser/_regexes.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/c-analyzer/c_parser/parser/_regexes.py b/Tools/c-analyzer/c_parser/parser/_regexes.py
index cb85a59..b7f22b1 100644
--- a/Tools/c-analyzer/c_parser/parser/_regexes.py
+++ b/Tools/c-analyzer/c_parser/parser/_regexes.py
@@ -176,6 +176,7 @@ DECLARATOR = textwrap.dedent(rf'''
(?: # <IDENTIFIER>
{STRICT_IDENTIFIER}
)
+ # Inside the brackets is actually a "constant expression".
(?: \s* \[ (?: \s* [^\]]+ \s* )? [\]] )* # arrays
)
|
@@ -184,6 +185,7 @@ DECLARATOR = textwrap.dedent(rf'''
(?: # <WRAPPED_IDENTIFIER>
{STRICT_IDENTIFIER}
)
+ # Inside the brackets is actually a "constant expression".
(?: \s* \[ (?: \s* [^\]]+ \s* )? [\]] )* # arrays
\s* [)]
)
@@ -194,6 +196,7 @@ DECLARATOR = textwrap.dedent(rf'''
(?: # <FUNC_IDENTIFIER>
{STRICT_IDENTIFIER}
)
+ # Inside the brackets is actually a "constant expression".
(?: \s* \[ (?: \s* [^\]]+ \s* )? [\]] )* # arrays
\s* [)]
# We allow for a single level of paren nesting in parameters.
@@ -322,7 +325,10 @@ STRUCT_MEMBER_DECL = textwrap.dedent(rf'''
(?:
\s* [:] \s*
(?: # <SIZE>
+ # This is actually a "constant expression".
\d+
+ |
+ [^'",}}]+
)
)?
\s*
@@ -357,6 +363,7 @@ ENUM_MEMBER_DECL = textwrap.dedent(rf'''
(?:
\s* = \s*
(?: # <INIT>
+ # This is actually a "constant expression".
{_ind(STRING_LITERAL, 4)}
|
[^'",}}]+