mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 08:31:13 +00:00
scripts: kernel-doc: split typedef complex regex
The typedef regex for function prototypes are very complex. Split them into 3 separate regex and then join them using qr. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/3a4af999a0d62d4ab9dfae1cdefdfcad93383356.1603792384.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
6b80975c63
commit
7efc6c4295
1 changed files with 9 additions and 5 deletions
|
@ -1427,17 +1427,21 @@ sub dump_enum($$) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $typedef_type = qr { ((?:\s+[\w\*]+){1,8})\s* }x;
|
||||||
|
my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
|
||||||
|
my $typedef_args = qr { \s*\((.*)\); }x;
|
||||||
|
|
||||||
|
my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x;
|
||||||
|
my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x;
|
||||||
|
|
||||||
sub dump_typedef($$) {
|
sub dump_typedef($$) {
|
||||||
my $x = shift;
|
my $x = shift;
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
|
|
||||||
$x =~ s@/\*.*?\*/@@gos; # strip comments.
|
$x =~ s@/\*.*?\*/@@gos; # strip comments.
|
||||||
|
|
||||||
# Parse function prototypes
|
# Parse function typedef prototypes
|
||||||
if ($x =~ /typedef((?:\s+[\w\*]+){1,8})\s*\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
|
if ($x =~ $typedef1 || $x =~ $typedef2) {
|
||||||
$x =~ /typedef((?:\s+[\w\*]+\s+){1,8})\s*\*?(\w\S+)\s*\s*\((.*)\);/) {
|
|
||||||
|
|
||||||
# Function typedefs
|
|
||||||
$return_type = $1;
|
$return_type = $1;
|
||||||
$declaration_name = $2;
|
$declaration_name = $2;
|
||||||
my $args = $3;
|
my $args = $3;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue