]> git.saurik.com Git - bison.git/blame - tests/reduce.at
* src/reduce.c (reduce_output): Formatting changes.
[bison.git] / tests / reduce.at
CommitLineData
cb4956ee
AD
1# Exercising Bison Grammar Reduction. -*- Autotest -*-
2# Copyright 2001 Free Software Foundation, Inc.
3
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)
7# any later version.
8
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.
13
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
17# 02111-1307, USA.
18
19AT_BANNER([[Grammar Reduction.]])
20
21
22## ------------------- ##
23## Useless Terminals. ##
24## ------------------- ##
25
26AT_SETUP([Useless Terminals])
27
28AT_DATA([[input.y]],
29[[%verbose
30%output="input.c"
31
32%token useless1
33%token useless2
34%token useless3
35%token useless4
36%token useless5
37%token useless6
38%token useless7
39%token useless8
40%token useless9
41
42%token useful
43%%
44exp: useful;
45]])
46
d2d1b42b
AD
47AT_CHECK([[bison input.y]], 0, [],
48[[input.y contains 9 useless nonterminals
49]])
cb4956ee
AD
50
51AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
d2d1b42b 52[[Useless nonterminals:
cb4956ee
AD
53 useless1
54 useless2
55 useless3
56 useless4
57 useless5
58 useless6
59 useless7
60 useless8
61 useless9
62]])
63
64AT_CLEANUP
65
66
67
68## ---------------------- ##
69## Useless Nonterminals. ##
70## ---------------------- ##
71
72AT_SETUP([Useless Nonterminals])
73
74AT_DATA([[input.y]],
75[[%verbose
76%output="input.c"
77
78%nterm useless1
79%nterm useless2
80%nterm useless3
81%nterm useless4
82%nterm useless5
83%nterm useless6
84%nterm useless7
85%nterm useless8
86%nterm useless9
87
88%token useful
89%%
90exp: useful;
91]])
92
760b53a8
AD
93AT_CHECK([[bison input.y]], 0, [],
94[[input.y contains 9 useless nonterminals
95]])
cb4956ee
AD
96
97AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
760b53a8 98[[Useless nonterminals:
cb4956ee
AD
99 useless1
100 useless2
101 useless3
102 useless4
103 useless5
104 useless6
105 useless7
106 useless8
107 useless9
108]])
109
110AT_CLEANUP