1 # Exercising Bison Grammar Sets. -*- Autotest -*-
2 # Copyright 2001, 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_EXTRACT_SETS(INPUT, OUTPUT)
20 # ------------------------------
21 # Extract the information about the grammar sets from a bison
22 # trace output (INPUT), and save it in OUTPUT.
23 # And remember, there is no alternation in portable sed.
24 m4_define([AT_EXTRACT_SETS],
25 [AT_DATA([extract.sed],
52 AT_CHECK([sed -f extract.sed $1], 0, [stdout])
53 AT_CHECK([mv stdout $2])
58 AT_BANNER([[Grammar Sets (Firsts etc.).]])
67 # At some point, nullable had been smoking grass, and managed to say:
69 # Entering set_nullable
77 e: 'e' | /* Nothing */;
80 AT_CHECK([[bison --trace input.y]], [], [], [stderr])
81 AT_EXTRACT_SETS([stderr], [sets])
82 AT_CHECK([[cat sets]], [],
111 ## ---------------- ##
112 ## Broken Closure. ##
113 ## ---------------- ##
115 # TC was once broken during a massive `simplification' of the code.
116 # It resulted in bison dumping core on the following grammar (the
117 # computation of FIRSTS uses TC). It managed to produce a pretty
148 # instead of that below.
150 AT_SETUP([Broken Closure])
164 AT_CHECK([[bison --trace input.y]], [], [], [stderr])
166 AT_CHECK([[sed -n 's/[ ]*$//;/^TC: Output BEGIN/,/^TC: Output END/p' stderr]], [],
210 AT_CHECK([[bison --trace input.y]], [], [], [stderr])
211 AT_EXTRACT_SETS([stderr], [sets])
212 AT_CHECK([[cat sets]], [],
217 2: exp '<' exp (rule 1)
218 3: exp '>' exp (rule 2)
219 4: exp '+' exp (rule 3)
220 5: exp '-' exp (rule 4)
221 6: exp '^' exp (rule 5)
222 7: exp '=' exp (rule 6)