X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/bf70fa8729594f339189575d3a90782014eef6d0..d40ba6c2725f98cbbf8991f55023dd2e392efec9:/tests/glr-regression.at?ds=sidebyside diff --git a/tests/glr-regression.at b/tests/glr-regression.at index 7ccb37fa..536f5eb8 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -1,5 +1,5 @@ # Checking GLR Parsing: Regression Tests -*- Autotest -*- -# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006 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 @@ -240,7 +240,7 @@ AT_DATA_GRAMMAR([glr-regr3.y], #include static int MergeRule (int x0, int x1); -static void yyerror(char const * s); +static void yyerror (char const * s); int yylex (void); #define RULE(x) (1 << (x)) @@ -650,7 +650,7 @@ AT_DATA_GRAMMAR([glr-regr8.y], #include static void yyerror (char const *); static int yylex (void); - static void yyerror(const char *msg); + static void yyerror (char const *msg); %} %token T_CONSTANT @@ -684,9 +684,10 @@ OptSignalWord : /* empty */ %% -void yyerror(const char *msg) +void +yyerror (char const *msg) { - fprintf (stderr, "error\n"); + fprintf (stderr, "%s\n", msg); } static int lexIndex; @@ -856,9 +857,9 @@ yylex (void) int main (void) { - int index; - for (index = 0; index < GARBAGE_SIZE; index+=1) - garbage[index] = 108; + int i; + for (i = 0; i < GARBAGE_SIZE; i+=1) + garbage[i] = 108; return yyparse (); } ]]) @@ -1087,11 +1088,11 @@ static int yylex (void) { static char const *input = "ab"; - static int index = 0; + static int i = 0; yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = index+1; - yylval.value = input[index] + 'A' - 'a'; - return input[index++]; + yylloc.first_column = yylloc.last_column = i + 1; + yylval.value = input[i] + 'A' - 'a'; + return input[i++]; } static void @@ -1151,17 +1152,17 @@ AT_SETUP([Incorrect lookahead during nondeterministic GLR]) AT_DATA_GRAMMAR([glr-regr14.y], [[ /* Tests: - - Conflicting actions (split-off parse, which copies lookahead status, + - Conflicting actions (split-off parse, which copies lookahead need, which is necessarily yytrue) and nonconflicting actions (non-split-off parse) for nondefaulted state: yychar != YYEMPTY. - - Merged deferred actions (lookahead status and RHS from different stack + - Merged deferred actions (lookahead need and RHS from different stack than the target state) and nonmerged deferred actions (same stack). - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - - yychar != YYEMPTY but lookahead status is yyfalse (a previous stack has + - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has seen the lookahead but current stack has not). - Exceeding stack capacity (stack explosion), and thus reallocating - lookahead status array. + lookahead need array. Note that it does not seem possible to see the initial yychar value during nondeterministic operation since: - In order to preserve the initial yychar, only defaulted states may be @@ -1193,8 +1194,7 @@ start: } ; -/* When merging the 2 deferred actions, the lookahead statuses are - different. */ +/* When merging the 2 deferred actions, the lookahead needs are different. */ merge: nonconflict1 'a' 'b' nonconflict2 %dprec 1 { USE ($2); USE ($3); @@ -1232,7 +1232,7 @@ defstate_look: } ; -/* yychar != YYEMPTY but lookahead status is yyfalse. */ +/* yychar != YYEMPTY but lookahead need is yyfalse. */ defstate_shift: { print_look_ahead ("defstate_shift <- empty string"); @@ -1294,11 +1294,11 @@ static int yylex (void) { static char const *input = "abcdddd"; - static int index = 0; + static int i = 0; yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = index+1; - yylval.value = input[index] + 'A' - 'a'; - return input[index++]; + yylloc.first_column = yylloc.last_column = i + 1; + yylval.value = input[i] + 'A' - 'a'; + return input[i++]; } static void