mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2008-08-27 Akim Demaille <demaille@gostai.com>
|
||||
|
||||
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 <demaille@gostai.com>
|
||||
|
||||
Support yyerrok in lalr1.cc.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user