diff options
author | Antonio Cardace <acardace@redhat.com> | 2020-09-25 19:09:28 +0200 |
---|---|---|
committer | Antonio Cardace <acardace@redhat.com> | 2020-09-28 15:08:42 +0200 |
commit | 471c5b7c1df26cc98fc19daa68a23a71f8b221af (patch) | |
tree | f0df907b06b0fcc6e27069ec777912e16e947060 /tools | |
parent | faa8053802f9d655667abe591261822dc5e66700 (diff) |
tools: update script for new code-style
Signed-off-by: Antonio Cardace <acardace@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/enums-to-docbook.pl | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tools/enums-to-docbook.pl b/tools/enums-to-docbook.pl index 697cb631d5..f422acbd80 100755 --- a/tools/enums-to-docbook.pl +++ b/tools/enums-to-docbook.pl @@ -14,6 +14,7 @@ use strict; use warnings; +our $enum_name; our $name; our $desc; our $choice; @@ -75,6 +76,7 @@ chomp; if (/^\/\*\*$/) { # Start of a documentation comment + $enum_name = undef; $name = ''; $desc = ''; $choice = undef; @@ -118,11 +120,24 @@ if (/^\/\*\*$/) { } elsif (/^\s+([^,\s]+),?$/) { # A choice without a literal value next unless @choices; - die "Saw enum value '$1', but didn't see start of enum before" unless defined $val; - my ($this) = grep { $_->[0] eq $1 } @choices; - die "Documentation for value '$1' missing" unless $this; - $val = inc $val; - $this->[2] = "= <literal>$val</literal>"; + + if (defined $enum_name) { + next unless $enum_name; + $val = $1; + my ($this) = grep { $_->[0] eq $enum_name } @choices; + die "Documentation for value '$1' missing" unless $this; + $this->[2] = "= <literal>$val</literal>"; + $enum_name = undef; + } else { + die "Saw enum value '$1', but didn't see start of enum before" unless defined $val; + my ($this) = grep { $_->[0] eq $1 } @choices; + die "Documentation for value '$1' missing" unless $this; + $val = inc $val; + $this->[2] = "= <literal>$val</literal>"; + } +} elsif (/^\s+(\S+)\s+=$/) { + next unless @choices; + $enum_name = $1 } elsif (/^\} ([^;]+);/) { # End of an enum next unless defined $name; |