aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/make-init-lua.pl
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-02-07 14:23:41 -0500
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-02-08 11:29:32 +0000
commit991bd3d7e10966e429bebd71bd7433f61e320482 (patch)
tree8740b0c2a4299b6b9efe6b9e8863cc604636c80a /epan/wslua/make-init-lua.pl
parent8d7b6001bb62c823b814b91ee858ff1ee48bad99 (diff)
Fix bug 9732: ' Lua: recent commit changed some MENU_ key names in init.lua'
A recent fix (made by me) for bug 9707, in Change-Id: If4ee1906aa60dd37366cf2ef9bc4168e0ea024b6, made the perl regex grab too much of the menu name. It changed MENU_STAT_CONVERSATION, MENU_STAT_RESPONSE, and MENU_ANALYZE_CONVERSATION's key names into their longer C-code names. Ugh. The fix for this is a bit brittle, but I think it's impractical to avoid it being brittle, due to needing to support legacy Lua scripts. I put comments in stat_menu.h to warn of the danger. Change-Id: I41408e9d4f5b5bd73e2871fccabff81c7cbd242d Reviewed-on: https://code.wireshark.org/review/140 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/wslua/make-init-lua.pl')
-rwxr-xr-xepan/wslua/make-init-lua.pl6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl
index 27c4e1ae98..2febfecdb1 100755
--- a/epan/wslua/make-init-lua.pl
+++ b/epan/wslua/make-init-lua.pl
@@ -146,8 +146,12 @@ $menu_groups .= "-- menu groups for register_menu\n";
my $menu_i = 0;
open STAT_MENU, "< $WSROOT/stat_menu.h" or die "cannot open '$WSROOT/stat_menu.h': $!";
+my $foundit = 0;
while(<STAT_MENU>) {
- if (/REGISTER_([A-Z]+)_GROUP_([A-Z_]+)/) {
+ # need to skip matching words in comments, and get to the enum
+ if (/^typedef enum {/) { $foundit = 1; }
+ # the problem here is we need to pick carefully, so we don't break existing scripts
+ if ($foundit && /REGISTER_([A-Z]+)_GROUP_(CONVERSATION|RESPONSE|[A-Z_]+)/) {
$menu_groups .= "MENU_$1_$2 = $menu_i\n";
$menu_groups =~ s/_NONE//;
$menu_i++;