From aa9f56085374fd506ebee629315d15e86ad9bf30 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Tue, 5 Jul 2016 20:15:09 -0400 Subject: 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 Reviewed-by: Anders Broman --- tools/checkhf.pl | 36 +++++++++++++++++------------------- 1 file 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; } -- cgit v1.2.3