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=sets 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=sets input.y]], [], [], [stderr])
167 AT_CHECK([[sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr]], [],
168 [[RTC: Firsts Output BEGIN
182 RTC: Firsts Output END
211 AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr])
212 AT_EXTRACT_SETS([stderr], [sets])
213 AT_CHECK([[cat sets]], [],