summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-01-08 15:26:09 +0100
committerAlejandro Colomar <alx@kernel.org>2023-01-08 15:26:09 +0100
commit6dd8756fedc8e85120d7c205ece387b5d49019ad (patch)
treef6ff6cb33600189f8683964058ea7536afa3e7c2
parent3cc1d3885007238256e70c100eec938fd94b7ee3 (diff)
Use recursion to improve matching of function parameter lists
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-xbin/grepc8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/grepc b/bin/grepc
index 8e55e1a..758349e 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -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}';
}