[gnumeric] process-amath: fix assignment parsing.



commit e1eb1d9411c3bd45e0285b4382aa379e0ec0829f
Author: Morten Welinder <terra gnome org>
Date:   Fri Nov 1 20:31:55 2013 -0400

    process-amath: fix assignment parsing.
    
    When we saw an assignment we could not handler, such as "f := PosInf_d;",
    we used to just keep the previous value of f.  That's no good.

 samples/amath.gnumeric |  Bin 38239 -> 38224 bytes
 tools/ChangeLog        |    5 +++++
 tools/process-amath.pl |    9 ++++++---
 3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/samples/amath.gnumeric b/samples/amath.gnumeric
index a641460..81c00db 100644
Binary files a/samples/amath.gnumeric and b/samples/amath.gnumeric differ
diff --git a/tools/ChangeLog b/tools/ChangeLog
index ad26222..beb7faf 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-01  Morten Welinder  <terra gnome org>
+
+       * process-amath.pl: When parsing a variable assignment fails,
+       remove previous values for that variable.
+
 2013-10-30  Morten Welinder  <terra gnome org>
 
        * process-amath.pl: First cut at new tool to import more test
diff --git a/tools/process-amath.pl b/tools/process-amath.pl
index 2b7c3d0..259faf5 100755
--- a/tools/process-amath.pl
+++ b/tools/process-amath.pl
@@ -201,7 +201,6 @@ sub non_negative_handler {
 
     foreach (@$pargs) {
        my $x = &interpret_number ($_);
-       print STDERR "$_ -> $x\n";
        return undef unless defined ($x) && $x >= 0;
     }    
 
@@ -297,11 +296,15 @@ foreach my $f (@test_files) {
            $expr = &$h ($gfunc,\ args);
        }
 
-       while (s/^\s*([a-zA-Z0-9]+)\s*:=\s*([-+.eE0-9_]+)\s*;//) {
+       while (s/^\s*([a-zA-Z0-9]+)\s*:=\s*([^;]+)\s*;//) {
            my $var = $1;
            my $val = $2;
            $val = &simplify_val ($val, \%vars);
-           $vars{$var} = $val;
+           if (defined $val) {
+               $vars{$var} = $val;
+           } else {
+               delete $vars{$var};
+           }
        }
 
        if (/^\s*test(rel|rele|abs)\s*/ && exists $vars{'f'} && defined ($expr)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]