X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/39a06c251ad9c523b1172835e545d2043431873d..7172e23e8ffb95b8cafee24c4f36c46ca709507f:/tests/conflicts.at diff --git a/tests/conflicts.at b/tests/conflicts.at index 259827bd..436ba858 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -1,6 +1,6 @@ # Exercising Bison on conflicts. -*- Autotest -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,8 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. AT_BANNER([[Conflicts.]]) @@ -55,30 +55,26 @@ AT_DATA_GRAMMAR([input.y], [[ %{ #include - -#if STDC_HEADERS -# include -#endif +#include +#include #define YYERROR_VERBOSE 1 static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); - exit (1); } /* The current argument. */ -static const char *input = NULL; +static const char *input; static int yylex (void) { - /* No token stands for end of file. */ - if (input && *input) - return *input++; - else - return 0; + static size_t toknum; + if (! (toknum <= strlen (input))) + abort (); + return input[toknum++]; } %} @@ -94,8 +90,7 @@ expr: expr '<' expr int main (int argc, const char *argv[]) { - if (argc > 1) - input = argv[1]; + input = argc <= 1 ? "" : argv[1]; return yyparse (); } ]]) @@ -486,9 +481,9 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c input.y], 0, [], +AT_CHECK([bison -o input.c input.y], 1, [], [input.y: conflicts: 1 shift/reduce -input.y: warning: expected 0 shift/reduce conflicts +input.y: expected 0 shift/reduce conflicts ]) AT_CLEANUP @@ -523,9 +518,9 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c input.y], 0, [], +AT_CHECK([bison -o input.c input.y], 1, [], [input.y: conflicts: 1 shift/reduce -input.y: warning: expected 2 shift/reduce conflicts +input.y: expected 2 shift/reduce conflicts ]) AT_CLEANUP @@ -543,18 +538,18 @@ program: a 'a' | a a; a: 'a'; ]]) -AT_CHECK([bison -o input.c input.y], 0, [], +AT_CHECK([bison -o input.c input.y], 1, [], [input.y: conflicts: 1 reduce/reduce -input.y: warning: expected 0 reduce/reduce conflicts +input.y: expected 0 reduce/reduce conflicts ]) AT_CLEANUP -## ---------------------------- ## -## %default-prec without %prec ## -## ---------------------------- ## +## ------------------------------- ## +## %no-default-prec without %prec ## +## ------------------------------- ## -AT_SETUP([%default-prec without %prec]) +AT_SETUP([%no-default-prec without %prec]) AT_DATA([[input.y]], [[%left '+' @@ -562,7 +557,7 @@ AT_DATA([[input.y]], %% -%default-prec 0; +%no-default-prec; e: e '+' e | e '*' e @@ -576,11 +571,11 @@ AT_CHECK([bison -o input.c input.y], 0, [], AT_CLEANUP -## ------------------------- ## -## %default-prec with %prec ## -## ------------------------- ## +## ---------------------------- ## +## %no-default-prec with %prec ## +## ---------------------------- ## -AT_SETUP([%default-prec with %prec]) +AT_SETUP([%no-default-prec with %prec]) AT_DATA([[input.y]], [[%left '+' @@ -588,7 +583,7 @@ AT_DATA([[input.y]], %% -%default-prec 0; +%no-default-prec; e: e '+' e %prec '+' | e '*' e %prec '*' @@ -601,10 +596,10 @@ AT_CLEANUP ## ---------------- ## -## %default-prec 1 ## +## %default-prec ## ## ---------------- ## -AT_SETUP([%default-prec 1]) +AT_SETUP([%default-prec]) AT_DATA([[input.y]], [[%left '+' @@ -612,7 +607,7 @@ AT_DATA([[input.y]], %% -%default-prec 1; +%default-prec; e: e '+' e | e '*' e