diff --git a/ChangeLog b/ChangeLog index a750392e48..52b7489596 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-03-05 Joshua Sled + + * src/app-utils/test/test-exp-parser.c (test_parser): Hack-fix + test errors due to missing function now required by + expression-parser. In the future, we should have a better way to + setup the application/test state. + + * src/calculation/expression_parser.c (primary_exp): Fix + function-parsing bug I introduced during the week with another bug + fix. + 2006-03-05 Derek Atkins * src/register/ledger-core/split-register.c: diff --git a/src/app-utils/test/test-exp-parser.c b/src/app-utils/test/test-exp-parser.c index 08608f2e04..779d4df63b 100644 --- a/src/app-utils/test/test-exp-parser.c +++ b/src/app-utils/test/test-exp-parser.c @@ -150,7 +150,10 @@ test_parser (void) "- 42.72 + 13.32 + 15.48 + 23.4 + 115.4", gnc_numeric_create(35897, 100) ); + scm_c_eval_string("(define (gnc:error->string tag args) (define (write-error port) (if (and (list? args) (not (null? args))) (let ((func (car args))) (if func (begin (display \"Function: \" port) (display func port) (display \", \" port) (display tag port) (display \"\n\n\" port))))) (false-if-exception (apply display-error (fluid-ref the-last-stack) port args)) (display-backtrace (fluid-ref the-last-stack) port) (force-output port)) (false-if-exception (call-with-output-string write-error)))"); + scm_c_eval_string( "(define (gnc:plus a b) (+ a b))" ); + add_pass_test("plus(2 : 1)", NULL, gnc_numeric_create(3,1)); add_pass_test( "plus( 1 : 2 ) + 3", NULL, gnc_numeric_create( 6, 1 ) ); add_pass_test( "plus( 1 : 2 ) * 3", NULL, gnc_numeric_create( 9, 1 ) ); add_pass_test( "plus( 1 + 2 : 3 ) * 5", NULL, gnc_numeric_create( 30, 1 ) ); diff --git a/src/calculation/expression_parser.c b/src/calculation/expression_parser.c index 8ff9afa91c..6baf20d50b 100644 --- a/src/calculation/expression_parser.c +++ b/src/calculation/expression_parser.c @@ -1067,7 +1067,7 @@ multiply_divide_op (parser_env_ptr pe) * named variables * numerics * grouped expressions, "()" - * functions [ ( [exp, exp, ..., exp] ) ] + * functions [ ( [exp : exp : ... : exp] ) ] * strings */ static void @@ -1147,10 +1147,10 @@ primary_exp (parser_env_ptr pe) assignment_op(pe); if ( pe->error_code ) return; + funcArgCount++; if (!pe->Token || pe->Token == ')') { break; } - funcArgCount++; next_token(pe); } while (pe->Token != ARG_TOKEN);