aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
authorAlejandro Colomar <alx@kernel.org>2025-11-05 14:22:36 +0100
committerAlejandro Colomar <alx@kernel.org>2025-11-06 01:43:03 +0100
commit0e1436452b30393b4eaaa9e979b0fc7c7abe9df2 (patch)
tree726680a1a16636936b7e333020c3cbe43295e344 /src
parent78488ed5ccbba073402be9514c7b7847de450084 (diff)
downloadman-pages-0e1436452b30393b4eaaa9e979b0fc7c7abe9df2.tar.gz
src/bin/grepc_c: Split regex
The regex for a function declarator is too complex. Split it into helper functions that prints the parts of the regex, so that each one is easier to understand. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bin/grepc_c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bin/grepc_c b/src/bin/grepc_c
index a28992a0f3..ca9e0581de 100755
--- a/src/bin/grepc_c
+++ b/src/bin/grepc_c
@@ -107,7 +107,11 @@ fi;
grepc_c_e() { echo '(?s)^([\w[]+[\w\s]*)?\benum\b[ \t]*([\w \t[\]]|::)*\n*([ \t]*){[^}]*^[ \t]*'"$1"'\b\s*[=,].*?^\3}.*?;'; }
-grepc_c_f_decl_() { printf '%s' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,;[\]*]|::|(?1))*(?:\.\.\.)?\))'; }
+grepc_c_f_return_() { printf '%s' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**'; }
+grepc_c_f_params_() { printf '%s' '\s*(\((?:[\w\s,;[\]*]|::|(?1))*(?:\.\.\.)?\))'; }
+grepc_c_f_decl_() { grepc_c_f_return_;
+ printf '%s' '\(?'"$1"'\)?';
+ grepc_c_f_params_; }
grepc_c_fp() { grepc_c_f_decl_ "$1";
echo '(?:[\w\s\(,\)[\]]|::)*;'; }
grepc_c_fd() { grepc_c_f_decl_ "$1";