1 # Checking GLR Parsing: Regression Test -*- Autotest -*-
2 # Copyright (C) 2002 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 AT_BANNER([[GLR Regression Test #1.]])
21 AT_SETUP([Badly Collapsed GLR States])
23 AT_DATA_GRAMMAR([glr-regr1.y],
24 [[/* Regression Test: Improper state compression */
25 /* Reported by Scott McPeak */
31 static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1);
33 int yyerror (char const *msg);
40 /* -------- productions ------ */
43 StartSymbol: E { $$=0; } %merge <exprMerge>
46 E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge <exprMerge>
47 | 'B' { $$=2; printf("E -> 'B'\n"); } %merge <exprMerge>
52 /* ---------- C code ----------- */
55 static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1)
70 yyerror (char const *msg)
72 fprintf (stderr, "%s\n", msg);
85 else if (ch == 'B' || ch == 'P')
91 AT_CHECK([[bison -o glr-regr1.c glr-regr1.y]], 0, [],
92 [glr-regr1.y: warning: 1 shift/reduce conflict
94 AT_COMPILE([glr-regr1])
95 AT_CHECK([[echo BPBPB | ./glr-regr1]], 0,