gdb: refactor make-target-delegates.py's ARGTYPES

Refactor the ARGTYPES regular expression in make-target-delegates.py
to eliminate '.*' for better control on what is matched.  Also,
simplify the "E" match group, for which the optional SYMBOL becomes
redundant because that case can be matched by the "T" group.

After applying this patch, running './make-target-delegates.py' does not
change anything in 'target-delegates.c'.

Approved-By: Pedro Alves <pedro@palves.net>
This commit is contained in:
Tankut Baris Aktemur 2023-11-14 15:00:49 +01:00
parent 5baaed487b
commit c7be5fa993

View File

@ -73,17 +73,18 @@ METHOD = re.compile(
+ METHOD_TRAILER
)
# Space-separated symbols.
CP_SYMBOLS = CP_SYMBOL + r"(\s+" + CP_SYMBOL + r")*"
# Regular expression used to dissect argument types.
ARGTYPES = re.compile(
"^("
+ r"(?P<E>enum\s+"
+ SYMBOL
+ r"\s*)("
+ SYMBOL
+ ")?"
+ r"|(?P<T>.*(enum\s+)?"
+ SYMBOL
+ r".*(\s|\*|&))"
+ r")"
+ r"|(?P<T>"
+ CP_SYMBOLS
+ r"(\s|\*|&)+)"
+ SYMBOL
+ ")$"
)