diff options
Diffstat (limited to 'utils/cli/ledgersmb_cli.pl')
-rw-r--r-- | utils/cli/ledgersmb_cli.pl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/cli/ledgersmb_cli.pl b/utils/cli/ledgersmb_cli.pl index 39d550e7..4bdd0d5f 100644 --- a/utils/cli/ledgersmb_cli.pl +++ b/utils/cli/ledgersmb_cli.pl @@ -134,9 +134,7 @@ sub pop_loop { sub if_handler { my $key = shift; if (!$stackref->{$key}){ - while ($line !~ /^(\s*FI\s*|\s*END\s+IF\s*)$/ ){ - $line = <>; - } + $if_count = 1; } } @@ -155,6 +153,15 @@ sub load_mod { my $scriptparse = new Parse::RecDescent($syntax); while ($line = <>){ + if ($if_count){ + if ($line =~ /^\s*IF\s/){ + ++$if_count; + } + if ($line =~ /^(\s*FI\s*|\s*END\s+IF\s*)$/){ + --$if_count; + } + } + next if ($if_count); $line =~ s/#.*$//; # strip comments $scriptparse->startrule($line); } |