From 6501566813190e211a55a44216044135b19259b0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 4 Aug 2008 23:23:27 +0200 Subject: [PATCH] Check yyerrok in calc.at. * tests/calc.at (calc.y): Use yyerrok on "( error )". (AT_CHECK_CALC): Add a check that ensures that yyerrok works as expected. --- ChangeLog | 7 +++++++ tests/calc.at | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c961b7b6..e146d19d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-27 Akim Demaille + + Check yyerrok in calc.at. + * tests/calc.at (calc.y): Use yyerrok on "( error )". + (AT_CHECK_CALC): Add a check that ensures that yyerrok works as + expected. + 2008-08-27 Akim Demaille Support yyerrok in lalr1.cc. diff --git a/tests/calc.at b/tests/calc.at index 189b5b35..26249088 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -1,6 +1,6 @@ # Simple calculator. -*- Autotest -*- -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -139,7 +139,7 @@ exp: | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } +| '(' error ')' { $$ = 1111; yyerrok; } | '!' { $$ = 0; YYERROR; } | '-' error { $$ = 0; YYERROR; } ; @@ -529,6 +529,14 @@ _AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113], [1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!' 1.12: syntax error, unexpected number calc: error: 2222 != 1]) + +# Check that yyerrok works properly: second error is not reported, +# third and fourth are. Parse status is succesfull. +_AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)], [113], +[1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' +1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!']) + AT_BISON_OPTION_POPDEFS AT_CLEANUP -- 2.47.2