[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [460] trunk/utils/cli/ledgersmb_cli.pl
- Subject: SF.net SVN: ledger-smb: [460] trunk/utils/cli/ledgersmb_cli.pl
- From: ..hidden..
- Date: Wed, 01 Nov 2006 20:53:43 -0800
Revision: 460
http://svn.sourceforge.net/ledger-smb/?rev=460&view=rev
Author: einhverfr
Date: 2006-11-01 20:53:42 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
Fewer errors. CLI script wrapper still doesn't work though
Modified Paths:
--------------
trunk/utils/cli/ledgersmb_cli.pl
Modified: trunk/utils/cli/ledgersmb_cli.pl
===================================================================
--- trunk/utils/cli/ledgersmb_cli.pl 2006-11-02 04:36:12 UTC (rev 459)
+++ trunk/utils/cli/ledgersmb_cli.pl 2006-11-02 04:53:42 UTC (rev 460)
@@ -39,10 +39,10 @@
expression : NUMBER OP expression
{ return main::expression(@item) }
- | key OP expression
+ | KEY OP expression
{ return main::expression(@item) }
- | INTEGER
- | VARIABLE
+ | NUMBER
+ | KEY
assign_instruction : KEY "=" expression
{ ${main::stackref}->{$item{key}} = $item{expression} }
@@ -82,10 +82,19 @@
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.`
my $stackref;
my @loopstack;
+sub expression {
+ shift;
+ my ($lhs,$op,$rhs) = @_;
+ $lhs = $VARIABLE{$lhs} if $lhs=~/[^-+0-9]/;
+ return eval "$lhs $op $rhs";
+}
+
sub call {
my ($call, $argstr) = @_;
$argstr =~ s/form/\\\%\$form/;
@@ -130,10 +139,10 @@
eval { require "$mod.pm"; };
}
-my $scriptparse = new Parse::RecDescent($grammer);
+my $scriptparse = new Parse::RecDescent($syntax);
while ($line = <>){
- $scriptparse->instruction($line);
+ $scriptparse->startrule($line);
}
delete $form->{password};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.