summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-03 04:48:39 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-03 04:48:39 +0000
commit474adf4d82a6535123d5b80abb0ed9c352a2a9e5 (patch)
treeb550165dca8dbfb2ea6f339f10dc5a2454b5fc70 /utils
parenta8e7829404c763cd4f69abf602fc722a5ddf1c12 (diff)
Fixing default bug
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@476 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'utils')
-rw-r--r--utils/cli/ledgersmb_cli.pl22
1 files changed, 20 insertions, 2 deletions
diff --git a/utils/cli/ledgersmb_cli.pl b/utils/cli/ledgersmb_cli.pl
index 4bdd0d5f..d6fdac7c 100644
--- a/utils/cli/ledgersmb_cli.pl
+++ b/utils/cli/ledgersmb_cli.pl
@@ -82,12 +82,15 @@ $syntax = << '_END_SYNTAX_';
startrule : instruction
_END_SYNTAX_
+
$::RD_HINT = 1;
$::RD_ERRORS = 1; # Make sure the parser dies when it encounters an error
$::RD_WARN = 1; # Enable warnings. This will warn on unused rules &c.`
#$::RD_TRACE = 1;
-my $stackref;
my @loopstack;
+my $loopindex;
+my $stackref;
+my @control_stack;
push @loopstack, $form;
@@ -122,8 +125,18 @@ sub call_and_assign {
sub push_loop {
my $key = shift;
+ my $is_hash = 0;
+ if (ref($stackref->{$key}) =~ /HASH/){
+ $is_hash = 1;
+ elsif (ref ($stackref->{$key}) !~ /ARRAY/){
+ print STDERR "Warning: Must loop through array or hash.";
+ }
push @loopstack, \$stackref->{$key};
- $stackref = \$loopstack[$#loopstack];
+ push @controlstack,
+ { "key" => $key,
+ 'index' => 0,
+ 'linenum' => $#linestack,
+ is_hash => $is_hash };
}
sub pop_loop {
@@ -152,7 +165,12 @@ sub load_mod {
my $scriptparse = new Parse::RecDescent($syntax);
+
+$loopindex = 0;
+my @linestack;
+
while ($line = <>){
+ push @linestack, $line;
if ($if_count){
if ($line =~ /^\s*IF\s/){
++$if_count;