Fix regex

This commit is contained in:
Nyall Dawson 2024-08-10 17:51:01 +10:00
parent be8dce7d0d
commit 526b89d205

View File

@ -1805,8 +1805,8 @@ while line_idx < line_count:
python_regex_verbose = r''' python_regex_verbose = r'''
^ # Start of the line ^ # Start of the line
( # Start of capturing group for the left-hand side ( # Start of capturing group for the left-hand side
\s* # Optional leading whitespace \s* # Optional leading whitespace
(?:const\s+)? # Optional const qualifier (?:const\s+)? # Optional const qualifier
(?: # Start of non-capturing group for type (?: # Start of non-capturing group for type
(?:unsigned\s+)? # Optional unsigned qualifier (?:unsigned\s+)? # Optional unsigned qualifier
@ -1821,21 +1821,24 @@ while line_idx < line_count:
) # End of capturing group for the left-hand side ) # End of capturing group for the left-hand side
\s*=\s* # Equals sign with optional surrounding whitespace \s*=\s* # Equals sign with optional surrounding whitespace
( # Start of capturing group for the right-hand side ( # Start of capturing group for the right-hand side
-?\d+(?:\.\d*)? # Integer or floating-point number (possibly negative) -? # Optional negative sign
| # OR (?: # Start of non-capturing group for value
nullptr # nullptr keyword \d+(?:\.\d*)? # Integer or floating-point number
| # OR | # OR
(?:std::)? # Optional std:: prefix nullptr # nullptr keyword
\w+ # Word characters for function/class names | # OR
(?:<[^>]+>)? # Optional template arguments (?:std::)? # Optional std:: prefix
(?:::[\w<>]+)* # Optional nested name specifiers \w+ # Word characters for function/class names
(?: # Start of optional group for function calls (?:<[^>]+>)? # Optional template arguments
\( # Opening parenthesis (?:::[\w<>]+)* # Optional nested name specifiers
[^()]* # Any characters except parentheses (?: # Start of optional group for function calls
(?:\([^()]*\))* # Allows for one level of nested parentheses \( # Opening parenthesis
[^()]* # Any characters except parentheses [^()]* # Any characters except parentheses
\) # Closing parenthesis (?:\([^()]*\))* # Allows for one level of nested parentheses
)? # End of optional group for function calls [^()]* # Any characters except parentheses
\) # Closing parenthesis
)? # End of optional group for function calls
)
) # End of capturing group for the right-hand side ) # End of capturing group for the right-hand side
\s*; # Optional whitespace and semicolon \s*; # Optional whitespace and semicolon
\s* # Optional whitespace after semicolon \s* # Optional whitespace after semicolon