diff options
Diffstat (limited to 'pidl/lib/Parse/Pidl/Wireshark/Conformance.pm')
-rw-r--r-- | pidl/lib/Parse/Pidl/Wireshark/Conformance.pm | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm b/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm index b81cf5edaf5..8057ab3b7ee 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm @@ -396,6 +396,7 @@ sub ReadConformanceFH($$$) my ($fh,$data,$f) = @_; my $incodeblock = 0; + my $inheaderblock = 0; my $ln = 0; @@ -407,9 +408,27 @@ sub ReadConformanceFH($$$) s/[\r\n]//g; if ($_ eq "CODE START") { + if ($incodeblock) { + warning({ FILE => $f, LINE => $ln }, + "CODE START inside CODE section"); + } + if ($inheaderblock) { + error({ FILE => $f, LINE => $ln }, + "CODE START inside HEADER section"); + return undef; + } $incodeblock = 1; next; - } elsif ($incodeblock and $_ eq "CODE END") { + } elsif ($_ eq "CODE END") { + if (!$incodeblock) { + warning({ FILE => $f, LINE => $ln }, + "CODE END outside CODE section"); + } + if ($inheaderblock) { + error({ FILE => $f, LINE => $ln }, + "CODE END inside HEADER section"); + return undef; + } $incodeblock = 0; next; } elsif ($incodeblock) { @@ -419,6 +438,37 @@ sub ReadConformanceFH($$$) $data->{override} = "$_\n"; } next; + } elsif ($_ eq "HEADER START") { + if ($inheaderblock) { + warning({ FILE => $f, LINE => $ln }, + "HEADER START inside HEADER section"); + } + if ($incodeblock) { + error({ FILE => $f, LINE => $ln }, + "HEADER START inside CODE section"); + return undef; + } + $inheaderblock = 1; + next; + } elsif ($_ eq "HEADER END") { + if (!$inheaderblock) { + warning({ FILE => $f, LINE => $ln }, + "HEADER END outside HEADER section"); + } + if ($incodeblock) { + error({ FILE => $f, LINE => $ln }, + "CODE END inside HEADER section"); + return undef; + } + $inheaderblock = 0; + next; + } elsif ($inheaderblock) { + if (exists $data->{header}) { + $data->{header}.="$_\n"; + } else { + $data->{header} = "$_\n"; + } + next; } my @fields = /([^ "]+|"[^"]+")/g; |