]> git.saurik.com Git - bison.git/blame - tests/reduce.at
* src/reduce.c: Various comment/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
47AT_CHECK([[bison input.y]])
48
49AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
50[[Terminals which are not used:
51 useless1
52 useless2
53 useless3
54 useless4
55 useless5
56 useless6
57 useless7
58 useless8
59 useless9
60]])
61
62AT_CLEANUP
63
64
65
66## ---------------------- ##
67## Useless Nonterminals. ##
68## ---------------------- ##
69
70AT_SETUP([Useless Nonterminals])
71
72AT_DATA([[input.y]],
73[[%verbose
74%output="input.c"
75
76%nterm useless1
77%nterm useless2
78%nterm useless3
79%nterm useless4
80%nterm useless5
81%nterm useless6
82%nterm useless7
83%nterm useless8
84%nterm useless9
85
86%token useful
87%%
88exp: useful;
89]])
90
91AT_CHECK([[bison input.y]])
92
93AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
94[[Terminals which are not used:
95 useless1
96 useless2
97 useless3
98 useless4
99 useless5
100 useless6
101 useless7
102 useless8
103 useless9
104]])
105
106AT_CLEANUP