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