X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/3ef9fa8f83316f7955babee666546feb5d9bdefc..952416114729b95209dccfc4edacfc1ff13b4e82:/tests/glr-regression.at diff --git a/tests/glr-regression.at b/tests/glr-regression.at index e5e758cd..a815008d 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -1,6 +1,6 @@ # Checking GLR Parsing: Regression Tests -*- Autotest -*- -# Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software +# Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -67,12 +67,12 @@ static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) return 0; } -const char *input = YY_NULL; +const char *input = YY_NULLPTR; int main (int argc, const char* argv[]) { - assert (argc == 2); + assert (argc == 2); (void) argc; input = argv[1]; return yyparse (); } @@ -304,7 +304,7 @@ MergeRule (int x0, int x1) } ]AT_YYERROR_DEFINE[ -FILE *input = YY_NULL; +FILE *input = YY_NULLPTR; int P[] = { P1, P2 }; int O[] = { O1, O2 }; @@ -486,8 +486,8 @@ start: ; %% -]AT_YYLEX_DEFINE(["a"])[ ]AT_YYERROR_DEFINE[ +]AT_YYLEX_DEFINE(["a"])[ ]AT_MAIN_DEFINE[ ]]) AT_BISON_OPTION_POPDEFS @@ -1015,17 +1015,17 @@ main (void) int exit_status = yyparse (); if (parent_rhs_before_value) { - fprintf (stderr, "`parent_rhs_before' destructor not called.\n"); + fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); exit_status = 1; } if (merged_value) { - fprintf (stderr, "`merged' destructor not called.\n"); + fprintf (stderr, "'merged' destructor not called.\n"); exit_status = 1; } if (parent_rhs_after_value) { - fprintf (stderr, "`PARENT_RHS_AFTER' destructor not called.\n"); + fprintf (stderr, "'PARENT_RHS_AFTER' destructor not called.\n"); exit_status = 1; } return exit_status; @@ -1449,7 +1449,7 @@ main (void) int exit_status = yyparse () != 1; if (parent_rhs_before_value) { - fprintf (stderr, "`parent_rhs_before' destructor not called.\n"); + fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); exit_status = 1; } return exit_status; @@ -1643,10 +1643,10 @@ sym3: %merge { $$ = 0; } ; AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr18.c glr-regr18.y]], 1, [], -[[glr-regr18.y:26.18-24: error: result type clash on merge function 'merge': != -glr-regr18.y:25.18-24: previous declaration -glr-regr18.y:27.13-19: error: result type clash on merge function 'merge': != -glr-regr18.y:26.18-24: previous declaration +[[glr-regr18.y:28.18-24: error: result type clash on merge function 'merge': != +glr-regr18.y:27.18-24: previous declaration +glr-regr18.y:29.13-19: error: result type clash on merge function 'merge': != +glr-regr18.y:28.18-24: previous declaration ]]) AT_CLEANUP @@ -1658,7 +1658,7 @@ AT_CLEANUP AT_SETUP([Ambiguity reports]) -AT_BISON_OPTION_PUSHDEFS +AT_BISON_OPTION_PUSHDEFS([%debug]) AT_DATA_GRAMMAR([input.y], [[ %{ @@ -1679,14 +1679,9 @@ start: b: 'b'; d: /* nada. */; %% -]AT_YYLEX_DEFINE(["abc"])[ ]AT_YYERROR_DEFINE[ -int -main (void) -{ - yydebug = 1; - return !!yyparse (); -} +]AT_YYLEX_DEFINE(["abc"])[ +]AT_MAIN_DEFINE[ ]]) AT_BISON_OPTION_POPDEFS @@ -1695,7 +1690,7 @@ AT_BISON_CHECK([[-o input.c input.y]], 0, [], ]]) AT_COMPILE([input]) -AT_PARSER_CHECK([[./input]], 1, [], +AT_PARSER_CHECK([[./input --debug]], 1, [], [Starting parse Entering state 0 Reading a token: Next token is token 'a' () @@ -1704,14 +1699,14 @@ Entering state 1 Reading a token: Next token is token 'b' () Shifting token 'b' () Entering state 3 -Reducing stack 0 by rule 3 (line 25): +Reducing stack 0 by rule 3 (line 27): $1 = token 'b' () -> $$ = nterm b () Entering state 4 Reading a token: Next token is token 'c' () Shifting token 'c' () Entering state 6 -Reducing stack 0 by rule 4 (line 26): +Reducing stack 0 by rule 4 (line 28): -> $$ = nterm d () Entering state 7 Reading a token: Now at end of input. @@ -1754,3 +1749,33 @@ Cleanup: popping token 'a' () ]) AT_CLEANUP + + +## ----------------------------------------------------------------- ## +## Predicates. ## +## ## +## http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html ## +## ----------------------------------------------------------------- ## + +AT_SETUP([Predicates]) + +# FIXME: We need genuine test cases with uses of %?. + +AT_DATA_GRAMMAR([input.y], +[[%glr-parser +%expect-rr 1 +%% +// Exercise "%?{...}" and "%? {...}". +widget: + %? {new_syntax} "widget" id new_args { $$ = f($3, $4); } +| %?{!new_syntax} "widget" id old_args { $$ = f($3, $4); } +; +id:; +new_args:; +old_args:; +%% +]]) + +AT_BISON_CHECK([[input.y]]) + +AT_CLEANUP