diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2016-07-05 20:15:09 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-07-10 15:06:20 +0000 |
commit | aa9f56085374fd506ebee629315d15e86ad9bf30 (patch) | |
tree | ede5b989e0604d4685a6c3fa6ff508e9af81d02f /tools | |
parent | 448c89e30b2b2ee8168d22fa66fbd030f9cfa22b (diff) |
Cleanup and extend the regex for matching expert info entries.
Match each entity in the structure explicitly rather than skipping a bunch at
the end. This makes it possible to easily (and clearly) specify where we
allow white space.
Don't capture the event group and severity: we don't use them anyway.
Don't put single character matches in []: that makes it hard to read (for
me anyway).
There's no need for both the "m"(ultiline) and "s"(ingle line) options. Nor
the "o"optimize (make buggy) option.
These same changes should/will be applied to the hf regex later.
Change-Id: I3bf307dcd6432eb1a0c2b9aceea201f8403e08c0
Reviewed-on: https://code.wireshark.org/review/16313
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/checkhf.pl | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/tools/checkhf.pl b/tools/checkhf.pl index 27d51d3c05..93bcb316a5 100755 --- a/tools/checkhf.pl +++ b/tools/checkhf.pl @@ -639,34 +639,32 @@ sub find_remove_ei_array_entries { # ei[] entry regex (to extract an ei_index_name and associated field type) my $ei_array_entry_regex = qr / - [{] + { \s* & \s* ( [a-zA-Z0-9_]+ ) # &ei (?: - \s* [[] [^]]+ []] # optional array ref + \s* [ [^]]+ ] # optional array ref ) ? \s* , \s* - [{] - [^}]+ - , \s* - (PI_[a-zA-Z0-9_]+) # event group - \s* , \s* - (PI_[a-zA-Z0-9_]+) # event severity - \s* , - [^}]+ - , \s* - (?: + { + # \s* "[^"]+" # (filter string has been removed already) + \s* , \s* + PI_[A-Z0-9_]+ # event group + \s* , \s* + PI_[A-Z0-9_]+ # event severity + \s* , + [^,]* # description string (already removed) or NULL + , \s* EXPFILL - ) - [^}]* + \s* + } + \s* } - [\s,]* - [}] - /xmso; + /xs; # find all the ei[] entries (searching ${$code_ref}). - while (${$code_ref} =~ m{ $ei_array_entry_regex }xmsog) { - ($debug == 98) && print "+++ $1 $2\n"; + while (${$code_ref} =~ m{ $ei_array_entry_regex }xsg) { + ($debug == 98) && print "+++ $1\n"; $ei_array_entries_eiref->{$1} = undef; } |