diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-09 16:04:54 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-09 16:20:01 +0200 |
commit | 64b1acc2b88b2dff3e930b3d9b723f8a52030638 (patch) | |
tree | 25d57de11c24fc92e16a44db4bff9b22f982bf6c /bin | |
parent | 59a932e849078501f7aa4b92c6ed2f44e4d1e54d (diff) |
grepc: Fix some corner cases
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/grepc | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -49,7 +49,7 @@ function grepc_enum_constant() grepc_helper '\.[ch]$' \ "^enum\s" \ "^\s*$1\s*[,=]" \ - "(?s)\benum\b\s*[\w\s[\]]*{[^}]*^\s*$1\s*[=,].*?^}.*?;"; + "(?s)\benum\b\s*([\w\s[\]]|::)*\s*{[^}]*^\s*$1\s*[=,].*?^}.*?;"; } @@ -58,7 +58,7 @@ function grepc_func_decl() grepc_helper '\.[ch]$' \ "\b$1\s*\(" \ "." \ - "(?s)^[\w[][\w\s(,)[:\]*]+\s+\**$1\s*\([\w\s(,)[\]*]+?(...)?\)[\w\s(,)[:\]]*;"; + "(?s)^[\w[]([\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**$1\s*\([\w\s\(,\)[\]*]+?(...)?\)[\w\s\(,\)[:\]]*;"; } @@ -67,7 +67,7 @@ function grepc_func_def() grepc_helper '\.[ch]$' \ "\b$1\s*\(" \ "." \ - "(?s)^[\w[][\w\s(,)[:\]*]+\s+\**$1\s*\([\w\s(,)[\]*]+?(...)?\)\s*{.*?^}"; + "(?s)^[\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**$1\s*\([\w\s\(,\)[\]*]+?(...)?\)\s*{.*?^}"; } @@ -120,7 +120,7 @@ function grepc_type_struct_union_enum() grepc_helper '\.[ch]$' \ "\b(struct|union|enum)\s+$1\b" \ "." \ - "(?s)^(?!^\s*typedef\b)([\w[][\w\s(,)[:\]*]+\s+)?\b(struct|union|enum)\s+$1\b\s*[\w\s[\]]*{.*?^}.*?;"; + "(?s)^(?!^\s*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\s+$1\b\s*[\w\s[\]]*{.*?^}.*?;"; } |