X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/d782395d52519fabb2cac3bd479246cc6de7efa8..432ac57aaae89de7a4305dc72c5a5b716c6defc4:/tests/calc.at diff --git a/tests/calc.at b/tests/calc.at index d13d0c1d..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; } ; @@ -455,9 +455,9 @@ AT_BISON_OPTION_PUSHDEFS([$1]) AT_DATA_CALC_Y([$1]) AT_SKEL_CC_IF( - [AT_CHECK([bison -o calc.cc calc.y]) + [AT_BISON_CHECK([-o calc.cc calc.y]) AT_COMPILE_CXX([calc])], - [AT_CHECK([bison -o calc.c calc.y]) + [AT_BISON_CHECK([-o calc.c calc.y]) AT_COMPILE([calc])]) # Test the priorities. @@ -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 @@ -559,8 +567,8 @@ AT_CHECK_CALC_LALR([%verbose]) AT_CHECK_CALC_LALR([%yacc]) AT_CHECK_CALC_LALR([%error-verbose]) -AT_CHECK_CALC_LALR([%pure-parser %locations]) -AT_CHECK_CALC_LALR([%define push_pull "both" %pure-parser %locations]) +AT_CHECK_CALC_LALR([%define api.pure %locations]) +AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %locations]) AT_CHECK_CALC_LALR([%error-verbose %locations]) AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) @@ -568,10 +576,10 @@ AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verb AT_CHECK_CALC_LALR([%debug]) AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%define push_pull "both" %pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) # ----------------------- # @@ -597,7 +605,7 @@ AT_CHECK_CALC_GLR([%verbose]) AT_CHECK_CALC_GLR([%yacc]) AT_CHECK_CALC_GLR([%error-verbose]) -AT_CHECK_CALC_GLR([%pure-parser %locations]) +AT_CHECK_CALC_GLR([%define api.pure %locations]) AT_CHECK_CALC_GLR([%error-verbose %locations]) AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) @@ -605,9 +613,9 @@ AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbo AT_CHECK_CALC_GLR([%debug]) AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) # ----------------------------- #