X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/77519a7d18266500754693b5e9e4b89608d6ed2c..a0c45dd5d2697b726add2bbc81947e9cb98c2799:/tests/glr-regression.at diff --git a/tests/glr-regression.at b/tests/glr-regression.at index 288de258..07c9fe25 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -383,7 +383,7 @@ B: 'a' { $$ = make_value ("B", "'a'"); } ; %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE([a])[ +]AT_YYLEX_DEFINE(["a"])[ int main (void) @@ -466,7 +466,7 @@ start: ; %% -]AT_YYLEX_DEFINE(a)[ +]AT_YYLEX_DEFINE(["a"])[ ]AT_YYERROR_DEFINE[ int main (void) @@ -519,7 +519,7 @@ start: 'a' | 'a' ; %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE(a)[ +]AT_YYLEX_DEFINE(["a"])[ int main (void) { @@ -834,7 +834,7 @@ start: %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE()[ +]AT_YYLEX_DEFINE[ int main (void) @@ -889,7 +889,7 @@ start: %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE([a])[ +]AT_YYLEX_DEFINE(["a"])[ int main (void) @@ -998,16 +998,9 @@ merge (YYSTYPE s1, YYSTYPE s2) } ]AT_YYERROR_DEFINE[ -static int -yylex (void) -{ - static int const input[] = { PARENT_RHS_AFTER, 0 }; - static size_t toknum; - assert (toknum < sizeof input / sizeof *input); - if (input[toknum] == PARENT_RHS_AFTER) - parent_rhs_after_value = 1; - return input[toknum++]; -} +]AT_YYLEX_DEFINE([{ PARENT_RHS_AFTER, 0 }], + [if (res == PARENT_RHS_AFTER) + parent_rhs_after_value = 1;])[ int main (void) @@ -1117,17 +1110,8 @@ change_lookahead: %% ]AT_YYERROR_DEFINE[ -static int -yylex (void) -{ - static char const input[] = "ab"; - static size_t toknum; - assert (toknum < sizeof input); - yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = toknum + 1; - yylval.value = input[toknum] + 'A' - 'a'; - return input[toknum++]; -} +]AT_YYLEX_DEFINE(["ab"], + [yylval.value = res + 'A' - 'a'])[ static void print_lookahead (char const *reduction) @@ -1449,7 +1433,7 @@ ambiguity2: ; %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE()[ +]AT_YYLEX_DEFINE[ int main (void) @@ -1507,16 +1491,9 @@ alt2: ; %% ]AT_YYERROR_DEFINE[ -static int -yylex (void) -{ - static char const input[] = "ab"; - static size_t toknum; - assert (toknum < sizeof input); - if (input[toknum] == 'b') - lookahead_value = 1; - return input[toknum++]; -} +]AT_YYLEX_DEFINE(["ab"], + [if (res == 'b') + lookahead_value = 1])[ int main (void) @@ -1550,7 +1527,8 @@ AT_CLEANUP AT_SETUP([Uninitialized location when reporting ambiguity]) -AT_BISON_OPTION_PUSHDEFS +AT_BISON_OPTION_PUSHDEFS([%glr-parser %locations %define api.pure]) + AT_DATA_GRAMMAR([glr-regr17.y], [[ %glr-parser @@ -1561,8 +1539,8 @@ AT_DATA_GRAMMAR([glr-regr17.y], %union { int dummy; } %{ - static void yyerror (YYLTYPE *, char const *); - static int yylex (YYSTYPE *, YYLTYPE *); + ]AT_YYERROR_DECLARE[ + ]AT_YYLEX_DECLARE[ %} %initial-action { @@ -1594,13 +1572,7 @@ empty2: ; %% # include -static void -yyerror (YYLTYPE *locp, char const *msg) -{ - fprintf (stderr, "%d.%d-%d.%d: %s.\n", locp->first_line, - locp->first_column, locp->last_line, locp->last_column, msg); -} - +]AT_YYERROR_DEFINE[ static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { @@ -1628,7 +1600,7 @@ AT_BISON_CHECK([[-o glr-regr17.c glr-regr17.y]], 0, [], AT_COMPILE([glr-regr17]) AT_PARSER_CHECK([[./glr-regr17]], 0, [], -[1.1-2.3: syntax is ambiguous. +[1.1-2.2: syntax is ambiguous ]) AT_CLEANUP @@ -1668,7 +1640,7 @@ sym3: %merge { $$ = 0; } ; %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE()[ +]AT_YYLEX_DEFINE[ int main (void) { @@ -1714,7 +1686,7 @@ start: b: 'b'; d: /* nada. */; %% -]AT_YYLEX_DEFINE([abc])[ +]AT_YYLEX_DEFINE(["abc"])[ ]AT_YYERROR_DEFINE[ int main (void)