diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-01-08 15:26:09 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-01-08 15:26:09 +0100 |
commit | 6dd8756fedc8e85120d7c205ece387b5d49019ad (patch) | |
tree | f6ff6cb33600189f8683964058ea7536afa3e7c2 | |
parent | 3cc1d3885007238256e70c100eec938fd94b7ee3 (diff) |
Use recursion to improve matching of function parameter lists
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-x | bin/grepc | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -204,18 +204,18 @@ grepc_enum_constant() grepc_func_proto() { grepc_helper \ - "\b$1\s*\(" \ + "(\($1\)|\b$1)\s*\(" \ '.' \ - '(?s)^[\w[]([\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)([\w\s\(,\)[\]]|::)*;'; + '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,[\]*]|::|(?1))*(?:\.\.\.)?\))(?:[\w\s\(,\)[\]]|::)*;'; } grepc_func_def() { grepc_helper \ - "\b$1\s*\(" \ + "(\($1\)|\b$1)\s*\(" \ '.' \ - '(?s)^[\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)[ \t]*\n([ \t]*){.*?^\4}'; + '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,[\]*]|::|(?1))*(?:\.\.\.)?\))[ \t]*\n([ \t]*){.*?^\2}'; } |