2 /* A Bison parser, made from gram.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
15 #define tSTARTRULES 265
16 #define tNAMERULES 266
26 #define tADDASSIGN 276
27 #define tSUBASSIGN 277
28 #define tMULASSIGN 278
29 #define tDIVASSIGN 279
38 #define tMINUSMINUS 288
44 * Copyright (c) 1997-1998 Markku Rossi.
46 * Author: Markku Rossi <mtr@iki.fi>
50 * This file is part of GNU Enscript.
52 * Enscript is free software: you can redistribute it and/or modify
53 * it under the terms of the GNU General Public License as published by
54 * the Free Software Foundation, either version 3 of the License, or
55 * (at your option) any later version.
57 * Enscript is distributed in the hope that it will be useful,
58 * but WITHOUT ANY WARRANTY; without even the implied warranty of
59 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60 * GNU General Public License for more details.
62 * You should have received a copy of the GNU General Public License
63 * along with Enscript. If not, see <http://www.gnu.org/licenses/>.
67 * $Id: gram.c,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
95 #define YYTRANSLATE(x) ((unsigned)(x) <= 288 ? yytranslate[x] : 68)
97 static const char yytranslate[] = { 0,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 41, 2, 2, 2, 2, 2, 2, 50,
102 51, 39, 37, 49, 38, 2, 2, 2, 2, 2,
103 2, 2, 2, 2, 2, 2, 2, 28, 48, 33,
104 22, 34, 27, 2, 2, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 44, 2, 45, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 46, 2, 47, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
113 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
117 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
118 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
124 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
125 17, 18, 19, 20, 21, 23, 24, 25, 26, 29,
126 30, 31, 32, 35, 36, 40, 42, 43
130 static const short yyprhs[] = { 0,
131 0, 1, 4, 9, 14, 19, 25, 33, 35, 36,
132 41, 42, 45, 50, 55, 60, 65, 66, 68, 70,
133 74, 75, 79, 81, 85, 87, 91, 92, 95, 98,
134 102, 112, 116, 122, 130, 136, 146, 149, 151, 153,
135 155, 157, 159, 162, 166, 170, 175, 179, 183, 187,
136 191, 195, 198, 201, 204, 207, 214, 218, 223, 229,
137 233, 237, 241, 245, 249, 253, 257, 261, 265, 269,
138 270, 272, 273, 275, 277
141 static const short yyrhs[] = { -1,
142 52, 53, 0, 10, 46, 62, 47, 0, 11, 46,
143 54, 47, 0, 12, 46, 54, 47, 0, 9, 3,
144 46, 55, 47, 0, 9, 3, 21, 3, 46, 55,
145 47, 0, 63, 0, 0, 54, 4, 3, 48, 0,
146 0, 55, 56, 0, 13, 46, 62, 47, 0, 14,
147 46, 62, 47, 0, 4, 46, 62, 47, 0, 3,
148 46, 62, 47, 0, 0, 58, 0, 3, 0, 58,
149 49, 3, 0, 0, 18, 60, 48, 0, 61, 0,
150 60, 49, 61, 0, 3, 0, 3, 22, 64, 0,
151 0, 62, 63, 0, 15, 48, 0, 15, 64, 48,
152 0, 8, 3, 50, 57, 51, 46, 59, 62, 47,
153 0, 46, 62, 47, 0, 16, 50, 64, 51, 63,
154 0, 16, 50, 64, 51, 63, 17, 63, 0, 19,
155 50, 64, 51, 63, 0, 20, 50, 65, 48, 64,
156 48, 65, 51, 63, 0, 64, 48, 0, 5, 0,
157 4, 0, 6, 0, 7, 0, 3, 0, 41, 64,
158 0, 64, 30, 64, 0, 64, 29, 64, 0, 3,
159 50, 66, 51, 0, 3, 22, 64, 0, 3, 23,
160 64, 0, 3, 24, 64, 0, 3, 25, 64, 0,
161 3, 26, 64, 0, 3, 42, 0, 3, 43, 0,
162 42, 3, 0, 43, 3, 0, 64, 44, 64, 45,
163 22, 64, 0, 50, 64, 51, 0, 64, 44, 64,
164 45, 0, 64, 27, 64, 28, 64, 0, 64, 39,
165 64, 0, 64, 40, 64, 0, 64, 37, 64, 0,
166 64, 38, 64, 0, 64, 33, 64, 0, 64, 34,
167 64, 0, 64, 31, 64, 0, 64, 32, 64, 0,
168 64, 35, 64, 0, 64, 36, 64, 0, 0, 64,
169 0, 0, 67, 0, 64, 0, 67, 49, 64, 0
175 static const short yyrline[] = { 0,
176 67, 68, 71, 72, 74, 76, 78, 80, 83, 84,
177 88, 89, 91, 92, 93, 94, 97, 98, 101, 102,
178 105, 106, 109, 110, 113, 114, 117, 118, 121, 123,
179 125, 130, 132, 134, 137, 139, 142, 146, 148, 150,
180 152, 154, 156, 158, 159, 160, 162, 164, 166, 168,
181 170, 172, 174, 176, 178, 180, 182, 183, 185, 187,
182 188, 189, 190, 192, 193, 194, 195, 196, 197, 200,
183 201, 204, 205, 208, 209
188 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
190 static const char * const yytname[] = { "$","error","$undefined.","tSYMBOL",
191 "tREGEXP","tSTRING","tINTEGER","tREAL","tSUB","tSTATE","tSTART","tSTARTRULES",
192 "tNAMERULES","tBEGIN","tEND","tRETURN","tIF","tELSE","tLOCAL","tWHILE","tFOR",
193 "tEXTENDS","'='","tADDASSIGN","tSUBASSIGN","tMULASSIGN","tDIVASSIGN","'?'","':'",
194 "tOR","tAND","tEQ","tNE","'<'","'>'","tGE","tLE","'+'","'-'","'*'","tDIV","'!'",
195 "tPLUSPLUS","tMINUSMINUS","'['","']'","'{'","'}'","';'","','","'('","')'","file",
196 "toplevel","regexp_sym_list","staterules","staterule","symbol_list","rest_symbol_list",
197 "locals","locals_rest","local_def","stmt_list","stmt","expr","cond_expr","expr_list",
198 "rest_expr_list", NULL
202 static const short yyr1[] = { 0,
203 52, 52, 53, 53, 53, 53, 53, 53, 54, 54,
204 55, 55, 56, 56, 56, 56, 57, 57, 58, 58,
205 59, 59, 60, 60, 61, 61, 62, 62, 63, 63,
206 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
207 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
208 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
209 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
213 static const short yyr2[] = { 0,
214 0, 2, 4, 4, 4, 5, 7, 1, 0, 4,
215 0, 2, 4, 4, 4, 4, 0, 1, 1, 3,
216 0, 3, 1, 3, 1, 3, 0, 2, 2, 3,
217 9, 3, 5, 7, 5, 9, 2, 1, 1, 1,
218 1, 1, 2, 3, 3, 4, 3, 3, 3, 3,
219 3, 2, 2, 2, 2, 6, 3, 4, 5, 3,
220 3, 3, 3, 3, 3, 3, 3, 3, 3, 0,
224 static const short yydefact[] = { 1,
225 0, 42, 39, 38, 40, 41, 0, 0, 0, 0,
226 0, 0, 0, 0, 0, 0, 0, 0, 27, 0,
227 2, 8, 0, 0, 0, 0, 0, 0, 52, 53,
228 72, 0, 0, 27, 9, 9, 29, 0, 0, 0,
229 70, 43, 54, 55, 0, 0, 0, 0, 0, 0,
230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
231 37, 47, 48, 49, 50, 51, 74, 0, 73, 17,
232 0, 11, 0, 0, 0, 30, 0, 0, 71, 0,
233 32, 28, 57, 0, 45, 44, 66, 67, 64, 65,
234 68, 69, 62, 63, 60, 61, 0, 46, 0, 19,
235 0, 18, 0, 0, 3, 0, 4, 5, 0, 0,
236 0, 0, 58, 75, 0, 0, 11, 0, 0, 0,
237 0, 6, 12, 0, 33, 35, 0, 59, 0, 21,
238 20, 0, 27, 27, 27, 27, 10, 0, 70, 56,
239 0, 27, 7, 0, 0, 0, 0, 34, 0, 25,
240 0, 23, 0, 16, 15, 13, 14, 0, 0, 22,
241 0, 31, 36, 26, 24, 0, 0
244 static const short yydefgoto[] = { 1,
245 21, 74, 104, 123, 101, 102, 142, 151, 152, 45,
249 static const short yypact[] = {-32768,
250 71, 270,-32768,-32768,-32768,-32768, 1, 9, -40, -28,
251 -27, 18, -24, -18, -17, 90, 28, 31,-32768, 90,
252 -32768,-32768, 374, 90, 90, 90, 90, 90,-32768,-32768,
253 90, -15, -19,-32768,-32768,-32768,-32768, 394, 90, 90,
254 90, 12,-32768,-32768, 119, 305, 90, 90, 90, 90,
255 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
256 -32768, 469, 469, 469, 469, 469, 469, 7, 20, 64,
257 67,-32768, 139, 3, 4,-32768, 328, 351, 469, 36,
258 -32768,-32768,-32768, 453, 484, 498, 510, 510, 112, 112,
259 112, 112, 13, 13, 12, 12, 434,-32768, 90,-32768,
260 34, 40, 46, 51,-32768, 96,-32768,-32768, 283, 283,
261 90, 90, 85, 469, 69, 107,-32768, 70, 73, 74,
262 83,-32768,-32768, 82, 124,-32768, 414, 469, 90, 118,
263 -32768, 59,-32768,-32768,-32768,-32768,-32768, 283, 90, 469,
264 150,-32768,-32768, 168, 187, 216, 235,-32768, 113, 141,
265 -38,-32768, 264,-32768,-32768,-32768,-32768, 283, 90,-32768,
266 150,-32768,-32768, 469,-32768, 167,-32768
269 static const short yypgoto[] = {-32768,
270 -32768, 132, 53,-32768,-32768,-32768,-32768,-32768, 16, -31,
271 -1, -11, 39,-32768,-32768
278 static const short yytable[] = { 22,
279 38, 71, 73, 32, 42, 34, 106, 106, 46, 160,
280 161, 33, 62, 63, 64, 65, 66, 35, 36, 67,
281 2, 3, 4, 5, 6, 39, 72, 77, 78, 79,
282 43, 40, 41, 44, 70, 84, 85, 86, 87, 88,
283 89, 90, 91, 92, 93, 94, 95, 96, 97, 107,
284 108, 58, 59, 118, 119, 60, 60, 98, 16, 17,
285 18, 118, 119, 120, 121, 37, 100, 20, 99, 103,
286 166, 120, 121, 2, 3, 4, 5, 6, 7, 8,
287 9, 10, 11, 111, 115, 12, 13, 114, 116, 14,
288 15, 117, 2, 3, 4, 5, 6, 122, 124, 127,
289 128, 144, 145, 146, 147, 143, 129, 125, 126, 131,
290 153, 16, 17, 18, 130, 133, 19, 140, 134, 135,
291 20, 2, 3, 4, 5, 6, 7, 79, 136, 137,
292 16, 17, 18, 12, 13, 141, 148, 14, 15, 20,
293 138, 2, 3, 4, 5, 6, 7, 164, 56, 57,
294 58, 59, 150, 12, 13, 60, 163, 14, 15, 16,
295 17, 18, 159, 158, 19, 81, 167, 75, 20, 132,
296 2, 3, 4, 5, 6, 7, 165, 149, 0, 16,
297 17, 18, 12, 13, 19, 105, 14, 15, 20, 2,
298 3, 4, 5, 6, 7, 0, 0, 0, 0, 0,
299 0, 12, 13, 0, 0, 14, 15, 0, 16, 17,
300 18, 0, 0, 19, 154, 0, 0, 20, 2, 3,
301 4, 5, 6, 7, 0, 0, 0, 16, 17, 18,
302 12, 13, 19, 155, 14, 15, 20, 2, 3, 4,
303 5, 6, 7, 0, 0, 0, 0, 0, 0, 12,
304 13, 0, 0, 14, 15, 0, 16, 17, 18, 0,
305 0, 19, 156, 0, 0, 20, 2, 3, 4, 5,
306 6, 7, 0, 0, 0, 16, 17, 18, 12, 13,
307 19, 157, 14, 15, 20, 2, 3, 4, 5, 6,
308 7, 24, 25, 26, 27, 28, 0, 12, 13, 0,
309 0, 14, 15, 0, 16, 17, 18, 0, 0, 19,
310 162, 29, 30, 20, 0, 0, 0, 0, 0, 31,
311 0, 0, 0, 16, 17, 18, 0, 0, 19, 0,
312 0, 47, 20, 48, 49, 50, 51, 52, 53, 54,
313 55, 56, 57, 58, 59, 0, 0, 0, 60, 0,
314 0, 0, 0, 0, 47, 83, 48, 49, 50, 51,
315 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
316 0, 60, 0, 0, 0, 0, 0, 47, 109, 48,
317 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
318 59, 0, 0, 0, 60, 0, 0, 0, 0, 0,
319 47, 110, 48, 49, 50, 51, 52, 53, 54, 55,
320 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
321 47, 61, 48, 49, 50, 51, 52, 53, 54, 55,
322 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
323 47, 76, 48, 49, 50, 51, 52, 53, 54, 55,
324 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
325 47, 139, 48, 49, 50, 51, 52, 53, 54, 55,
326 56, 57, 58, 59, 0, 0, 0, 60, 113, 47,
327 112, 48, 49, 50, 51, 52, 53, 54, 55, 56,
328 57, 58, 59, 0, 0, 47, 60, 48, 49, 50,
329 51, 52, 53, 54, 55, 56, 57, 58, 59, 0,
330 0, 0, 60, 49, 50, 51, 52, 53, 54, 55,
331 56, 57, 58, 59, 0, 0, 0, 60, 50, 51,
332 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
333 0, 60, 52, 53, 54, 55, 56, 57, 58, 59,
337 static const short yycheck[] = { 1,
338 12, 21, 34, 3, 16, 46, 4, 4, 20, 48,
339 49, 3, 24, 25, 26, 27, 28, 46, 46, 31,
340 3, 4, 5, 6, 7, 50, 46, 39, 40, 41,
341 3, 50, 50, 3, 50, 47, 48, 49, 50, 51,
342 52, 53, 54, 55, 56, 57, 58, 59, 60, 47,
343 47, 39, 40, 3, 4, 44, 44, 51, 41, 42,
344 43, 3, 4, 13, 14, 48, 3, 50, 49, 3,
345 0, 13, 14, 3, 4, 5, 6, 7, 8, 9,
346 10, 11, 12, 48, 51, 15, 16, 99, 49, 19,
347 20, 46, 3, 4, 5, 6, 7, 47, 3, 111,
348 112, 133, 134, 135, 136, 47, 22, 109, 110, 3,
349 142, 41, 42, 43, 46, 46, 46, 129, 46, 46,
350 50, 3, 4, 5, 6, 7, 8, 139, 46, 48,
351 41, 42, 43, 15, 16, 18, 138, 19, 20, 50,
352 17, 3, 4, 5, 6, 7, 8, 159, 37, 38,
353 39, 40, 3, 15, 16, 44, 158, 19, 20, 41,
354 42, 43, 22, 51, 46, 47, 0, 36, 50, 117,
355 3, 4, 5, 6, 7, 8, 161, 139, -1, 41,
356 42, 43, 15, 16, 46, 47, 19, 20, 50, 3,
357 4, 5, 6, 7, 8, -1, -1, -1, -1, -1,
358 -1, 15, 16, -1, -1, 19, 20, -1, 41, 42,
359 43, -1, -1, 46, 47, -1, -1, 50, 3, 4,
360 5, 6, 7, 8, -1, -1, -1, 41, 42, 43,
361 15, 16, 46, 47, 19, 20, 50, 3, 4, 5,
362 6, 7, 8, -1, -1, -1, -1, -1, -1, 15,
363 16, -1, -1, 19, 20, -1, 41, 42, 43, -1,
364 -1, 46, 47, -1, -1, 50, 3, 4, 5, 6,
365 7, 8, -1, -1, -1, 41, 42, 43, 15, 16,
366 46, 47, 19, 20, 50, 3, 4, 5, 6, 7,
367 8, 22, 23, 24, 25, 26, -1, 15, 16, -1,
368 -1, 19, 20, -1, 41, 42, 43, -1, -1, 46,
369 47, 42, 43, 50, -1, -1, -1, -1, -1, 50,
370 -1, -1, -1, 41, 42, 43, -1, -1, 46, -1,
371 -1, 27, 50, 29, 30, 31, 32, 33, 34, 35,
372 36, 37, 38, 39, 40, -1, -1, -1, 44, -1,
373 -1, -1, -1, -1, 27, 51, 29, 30, 31, 32,
374 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
375 -1, 44, -1, -1, -1, -1, -1, 27, 51, 29,
376 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
377 40, -1, -1, -1, 44, -1, -1, -1, -1, -1,
378 27, 51, 29, 30, 31, 32, 33, 34, 35, 36,
379 37, 38, 39, 40, -1, -1, -1, 44, -1, -1,
380 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
381 37, 38, 39, 40, -1, -1, -1, 44, -1, -1,
382 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
383 37, 38, 39, 40, -1, -1, -1, 44, -1, -1,
384 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
385 37, 38, 39, 40, -1, -1, -1, 44, 45, 27,
386 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
387 38, 39, 40, -1, -1, 27, 44, 29, 30, 31,
388 32, 33, 34, 35, 36, 37, 38, 39, 40, -1,
389 -1, -1, 44, 30, 31, 32, 33, 34, 35, 36,
390 37, 38, 39, 40, -1, -1, -1, 44, 31, 32,
391 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
392 -1, 44, 33, 34, 35, 36, 37, 38, 39, 40,
395 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
396 #line 3 "/l/mtr/gnu/share/bison.simple"
397 /* This file comes from bison-1.28. */
399 /* Skeleton output parser for bison,
400 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
402 This program is free software; you can redistribute it and/or modify
403 it under the terms of the GNU General Public License as published by
404 the Free Software Foundation; either version 2, or (at your option)
407 This program is distributed in the hope that it will be useful,
408 but WITHOUT ANY WARRANTY; without even the implied warranty of
409 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
410 GNU General Public License for more details.
412 You should have received a copy of the GNU General Public License
413 along with this program; if not, write to the Free Software
414 Foundation, Inc., 51 Franklin Street, Fifth Floor,
415 Boston, MA 02110-1301, USA. */
417 /* As a special exception, when this file is copied by Bison into a
418 Bison output file, you may use that output file without restriction.
419 This special exception was added by the Free Software Foundation
420 in version 1.24 of Bison. */
422 /* This is the parser code that is written into each bison parser
423 when the %semantic_parser declaration is not specified in the grammar.
424 It was written by Richard Stallman by simplifying the hairy parser
425 used when %semantic_parser is specified. */
427 #ifndef YYSTACK_USE_ALLOCA
429 #define YYSTACK_USE_ALLOCA
430 #else /* alloca not defined */
432 #define YYSTACK_USE_ALLOCA
433 #define alloca __builtin_alloca
434 #else /* not GNU C. */
435 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
436 #define YYSTACK_USE_ALLOCA
438 #else /* not sparc */
439 /* We think this test detects Watcom and Microsoft C. */
440 /* This used to test MSDOS, but that is a bad idea
441 since that symbol is in the user namespace. */
442 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
443 #if 0 /* No need for malloc.h, which pollutes the namespace;
444 instead, just don't use alloca. */
447 #else /* not MSDOS, or __TURBOC__ */
449 /* I don't know what this was needed for, but it pollutes the namespace.
450 So I turned it off. rms, 2 May 1997. */
451 /* #include <malloc.h> */
453 #define YYSTACK_USE_ALLOCA
454 #else /* not MSDOS, or __TURBOC__, or _AIX */
456 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
457 and on HPUX 10. Eventually we can turn this on. */
458 #define YYSTACK_USE_ALLOCA
459 #define alloca __builtin_alloca
462 #endif /* not _AIX */
463 #endif /* not MSDOS, or __TURBOC__ */
464 #endif /* not sparc */
465 #endif /* not GNU C */
466 #endif /* alloca not defined */
467 #endif /* YYSTACK_USE_ALLOCA not defined */
469 #ifdef YYSTACK_USE_ALLOCA
470 #define YYSTACK_ALLOC alloca
472 #define YYSTACK_ALLOC malloc
475 /* Note: there must be only one dollar sign in this file.
476 It is replaced by the list of actions, each action
477 as one case of the switch. */
479 #define yyerrok (yyerrstatus = 0)
480 #define yyclearin (yychar = YYEMPTY)
483 #define YYACCEPT goto yyacceptlab
484 #define YYABORT goto yyabortlab
485 #define YYERROR goto yyerrlab1
486 /* Like YYERROR except do call yyerror.
487 This remains here temporarily to ease the
488 transition to the new meaning of YYERROR, for GCC.
489 Once GCC version 2 has supplanted version 1, this can go. */
490 #define YYFAIL goto yyerrlab
491 #define YYRECOVERING() (!!yyerrstatus)
492 #define YYBACKUP(token, value) \
494 if (yychar == YYEMPTY && yylen == 1) \
495 { yychar = (token), yylval = (value); \
496 yychar1 = YYTRANSLATE (yychar); \
501 { yyerror ("syntax error: cannot back up"); YYERROR; } \
505 #define YYERRCODE 256
508 #define YYLEX yylex()
514 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
516 #define YYLEX yylex(&yylval, &yylloc)
518 #else /* not YYLSP_NEEDED */
520 #define YYLEX yylex(&yylval, YYLEX_PARAM)
522 #define YYLEX yylex(&yylval)
524 #endif /* not YYLSP_NEEDED */
527 /* If nonreentrant, generate the variables here */
531 int yychar; /* the lookahead symbol */
532 YYSTYPE yylval; /* the semantic value of the */
533 /* lookahead symbol */
536 YYLTYPE yylloc; /* location data for the lookahead */
540 int yynerrs; /* number of parse errors so far */
541 #endif /* not YYPURE */
544 int yydebug; /* nonzero means print parse trace */
545 /* Since this is uninitialized, it does not stop multiple parsers
549 /* YYINITDEPTH indicates the initial size of the parser's stacks */
552 #define YYINITDEPTH 200
555 /* YYMAXDEPTH is the maximum size the stacks can grow to
556 (effective only if the built-in stack extension method is used). */
563 #define YYMAXDEPTH 10000
566 /* Define __yy_memcpy. Note that the size argument
567 should be passed with type unsigned int, because that is what the non-GCC
568 definitions require. With GCC, __builtin_memcpy takes an arg
569 of type size_t, but it can handle unsigned int. */
571 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
572 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
573 #else /* not GNU C or C++ */
576 /* This is the most reliable way to avoid incompatibilities
577 in available built-in functions on various systems. */
579 __yy_memcpy (to, from, count)
584 register char *f = from;
585 register char *t = to;
586 register int i = count;
592 #else /* __cplusplus */
594 /* This is the most reliable way to avoid incompatibilities
595 in available built-in functions on various systems. */
597 __yy_memcpy (char *to, char *from, unsigned int count)
599 register char *t = to;
600 register char *f = from;
601 register int i = count;
610 #line 217 "/l/mtr/gnu/share/bison.simple"
612 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
613 into yyparse. The argument should have type void *.
614 It should actually point to an object.
615 Grammar actions can access the variable by casting it
616 to the proper pointer type. */
620 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
621 #define YYPARSE_PARAM_DECL
622 #else /* not __cplusplus */
623 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
624 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
625 #endif /* not __cplusplus */
626 #else /* not YYPARSE_PARAM */
627 #define YYPARSE_PARAM_ARG
628 #define YYPARSE_PARAM_DECL
629 #endif /* not YYPARSE_PARAM */
631 /* Prevent warning if -Wstrict-prototypes. */
634 int yyparse (void *);
641 yyparse(YYPARSE_PARAM_ARG)
644 register int yystate;
646 register short *yyssp;
647 register YYSTYPE *yyvsp;
648 int yyerrstatus; /* number of tokens to shift before error messages enabled */
649 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
651 short yyssa[YYINITDEPTH]; /* the state stack */
652 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
654 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
655 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
658 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
659 YYLTYPE *yyls = yylsa;
662 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
664 #define YYPOPSTACK (yyvsp--, yyssp--)
667 int yystacksize = YYINITDEPTH;
668 int yyfree_stacks = 0;
679 YYSTYPE yyval; /* the variable used to return */
680 /* semantic values from the action */
687 fprintf(stderr, "Starting parse\n");
693 yychar = YYEMPTY; /* Cause a token to be read. */
695 /* Initialize stack pointers.
696 Waste one element of value and location stack
697 so that they stay on the same level as the state stack.
698 The wasted elements are never initialized. */
706 /* Push a new state, which is found in yystate . */
707 /* In all cases, when you get here, the value and location stacks
708 have just been pushed. so pushing a state here evens the stacks. */
713 if (yyssp >= yyss + yystacksize - 1)
715 /* Give user a chance to reallocate the stack */
716 /* Use copies of these so that the &'s don't force the real ones into memory. */
717 YYSTYPE *yyvs1 = yyvs;
720 YYLTYPE *yyls1 = yyls;
723 /* Get the current used size of the three stacks, in elements. */
724 int size = yyssp - yyss + 1;
727 /* Each stack pointer address is followed by the size of
728 the data in use in that stack, in bytes. */
730 /* This used to be a conditional around just the two extra args,
731 but that might be undefined if yyoverflow is a macro. */
732 yyoverflow("parser stack overflow",
733 &yyss1, size * sizeof (*yyssp),
734 &yyvs1, size * sizeof (*yyvsp),
735 &yyls1, size * sizeof (*yylsp),
738 yyoverflow("parser stack overflow",
739 &yyss1, size * sizeof (*yyssp),
740 &yyvs1, size * sizeof (*yyvsp),
744 yyss = yyss1; yyvs = yyvs1;
748 #else /* no yyoverflow */
749 /* Extend the stack our own way. */
750 if (yystacksize >= YYMAXDEPTH)
752 yyerror("parser stack overflow");
764 if (yystacksize > YYMAXDEPTH)
765 yystacksize = YYMAXDEPTH;
766 #ifndef YYSTACK_USE_ALLOCA
769 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
770 __yy_memcpy ((char *)yyss, (char *)yyss1,
771 size * (unsigned int) sizeof (*yyssp));
772 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
773 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
774 size * (unsigned int) sizeof (*yyvsp));
776 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
777 __yy_memcpy ((char *)yyls, (char *)yyls1,
778 size * (unsigned int) sizeof (*yylsp));
780 #endif /* no yyoverflow */
782 yyssp = yyss + size - 1;
783 yyvsp = yyvs + size - 1;
785 yylsp = yyls + size - 1;
790 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
793 if (yyssp >= yyss + yystacksize - 1)
799 fprintf(stderr, "Entering state %d\n", yystate);
805 /* Do appropriate processing given the current state. */
806 /* Read a lookahead token if we need one and don't already have one. */
809 /* First try to decide what to do without reference to lookahead token. */
811 yyn = yypact[yystate];
815 /* Not known => get a lookahead token if don't already have one. */
817 /* yychar is either YYEMPTY or YYEOF
818 or a valid token in external form. */
820 if (yychar == YYEMPTY)
824 fprintf(stderr, "Reading a token: ");
829 /* Convert token to internal form (in yychar1) for indexing tables with */
831 if (yychar <= 0) /* This means end of input. */
834 yychar = YYEOF; /* Don't call YYLEX any more */
838 fprintf(stderr, "Now at end of input.\n");
843 yychar1 = YYTRANSLATE(yychar);
848 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
849 /* Give the individual parser a way to print the precise meaning
850 of a token, for further debugging info. */
852 YYPRINT (stderr, yychar, yylval);
854 fprintf (stderr, ")\n");
860 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
865 /* yyn is what to do for this token type in this state.
866 Negative => reduce, -yyn is rule number.
867 Positive => shift, yyn is new state.
868 New state is final state => don't bother to shift,
870 0, or most negative number => error. */
885 /* Shift the lookahead token. */
889 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
892 /* Discard the token being shifted unless it is eof. */
901 /* count tokens shifted since error; after three, turn off error status. */
902 if (yyerrstatus) yyerrstatus--;
907 /* Do the default action for the current state. */
910 yyn = yydefact[yystate];
914 /* Do a reduction. yyn is the number of a rule to reduce with. */
918 yyval = yyvsp[1-yylen]; /* implement default value of the action */
925 fprintf (stderr, "Reducing via rule %d (line %d), ",
928 /* Print the symbols being reduced, and their result. */
929 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
930 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
931 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
940 { start_stmts = yyvsp[-1].lst; ;
944 { startrules = yyvsp[-1].lst; ;
948 { namerules = yyvsp[-1].lst; ;
952 { define_state (yyvsp[-3].node, NULL, yyvsp[-1].lst); ;
956 { define_state (yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].lst); ;
960 { list_append (global_stmts, yyvsp[0].stmt); ;
964 { yyval.lst = list (); ;
968 { list_append (yyvsp[-3].lst, cons (yyvsp[-2].node, yyvsp[-1].node)); ;
972 { yyval.lst = list (); ;
976 { list_append (yyvsp[-1].lst, yyvsp[0].cons); ;
980 { yyval.cons = cons (RULE_BEGIN, yyvsp[-1].lst); ;
984 { yyval.cons = cons (RULE_END, yyvsp[-1].lst); ;
988 { yyval.cons = cons (yyvsp[-3].node, yyvsp[-1].lst); ;
992 { yyval.cons = cons (yyvsp[-3].node, yyvsp[-1].lst); ;
996 { yyval.lst = list (); ;
1000 { yyval.lst = yyvsp[0].lst; ;
1004 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].node); ;
1008 { list_append (yyvsp[-2].lst, yyvsp[0].node); ;
1012 { yyval.lst = list (); ;
1016 { yyval.lst = yyvsp[-1].lst; ;
1020 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].cons); ;
1024 { list_append (yyvsp[-2].lst, yyvsp[0].cons); ;
1028 { yyval.cons = cons (yyvsp[0].node, NULL); ;
1032 { yyval.cons = cons (yyvsp[-2].node, yyvsp[0].expr); ;
1036 { yyval.lst = list (); ;
1040 { list_append (yyvsp[-1].lst, yyvsp[0].stmt); ;
1044 { yyval.stmt = mk_stmt (sRETURN, NULL, NULL,
1049 { yyval.stmt = mk_stmt (sRETURN, yyvsp[-1].expr, NULL,
1054 { yyval.stmt = mk_stmt (sDEFSUB, yyvsp[-7].node,
1055 cons (cons (yyvsp[-5].lst, yyvsp[-2].lst),
1061 { yyval.stmt = mk_stmt (sBLOCK, yyvsp[-1].lst, NULL,
1066 { yyval.stmt = mk_stmt (sIF, yyvsp[-2].expr, yyvsp[0].stmt, NULL,
1071 { yyval.stmt = mk_stmt (sIF, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt,
1076 { yyval.stmt = mk_stmt (sWHILE, yyvsp[-2].expr, yyvsp[0].stmt,
1081 { yyval.stmt = mk_stmt (sFOR, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr,
1086 { yyval.stmt = mk_stmt (sEXPR, yyvsp[-1].expr, NULL,
1091 { yyval.expr = mk_expr (eSTRING, yyvsp[0].node, NULL,
1096 { yyval.expr = mk_expr (eREGEXP, yyvsp[0].node, NULL,
1101 { yyval.expr = mk_expr (eINTEGER, yyvsp[0].node, NULL,
1106 { yyval.expr = mk_expr (eREAL, yyvsp[0].node, NULL,
1111 { yyval.expr = mk_expr (eSYMBOL, yyvsp[0].node, NULL,
1116 { yyval.expr = mk_expr (eNOT, yyvsp[0].expr, NULL,
1121 { yyval.expr = mk_expr (eAND, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1125 { yyval.expr = mk_expr (eOR, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1129 { yyval.expr = mk_expr (eFCALL, yyvsp[-3].node, yyvsp[-1].lst,
1134 { yyval.expr = mk_expr (eASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1139 { yyval.expr = mk_expr (eADDASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1144 { yyval.expr = mk_expr (eSUBASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1149 { yyval.expr = mk_expr (eMULASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1154 { yyval.expr = mk_expr (eDIVASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1159 { yyval.expr = mk_expr (ePOSTFIXADD, yyvsp[-1].node, NULL,
1164 { yyval.expr = mk_expr (ePOSTFIXSUB, yyvsp[-1].node, NULL,
1169 { yyval.expr = mk_expr (ePREFIXADD, yyvsp[0].node, NULL,
1174 { yyval.expr = mk_expr (ePREFIXSUB, yyvsp[0].node, NULL,
1179 { yyval.expr = mk_expr (eARRAYASSIGN, yyvsp[-5].expr, yyvsp[-3].expr,
1184 { yyval.expr = yyvsp[-1].expr; ;
1188 { yyval.expr = mk_expr (eARRAYREF, yyvsp[-3].expr, yyvsp[-1].expr,
1193 { yyval.expr = mk_expr (eQUESTCOLON, yyvsp[-4].expr, yyvsp[-2].expr,
1198 { yyval.expr = mk_expr (eMULT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1202 { yyval.expr = mk_expr (eDIV, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1206 { yyval.expr = mk_expr (ePLUS, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1210 { yyval.expr = mk_expr (eMINUS, yyvsp[-2].expr, yyvsp[0].expr,
1215 { yyval.expr = mk_expr (eLT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1219 { yyval.expr = mk_expr (eGT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1223 { yyval.expr = mk_expr (eEQ, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1227 { yyval.expr = mk_expr (eNE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1231 { yyval.expr = mk_expr (eGE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1235 { yyval.expr = mk_expr (eLE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1239 { yyval.expr = NULL; ;
1243 { yyval.expr = yyvsp[0].expr; ;
1247 { yyval.lst = list (); ;
1251 { yyval.lst = yyvsp[0].lst; ;
1255 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].expr); ;
1259 { list_append (yyvsp[-2].lst, yyvsp[0].expr); ;
1262 /* the action file gets copied in in place of this dollarsign */
1263 #line 543 "/l/mtr/gnu/share/bison.simple"
1274 short *ssp1 = yyss - 1;
1275 fprintf (stderr, "state stack now");
1276 while (ssp1 != yyssp)
1277 fprintf (stderr, " %d", *++ssp1);
1278 fprintf (stderr, "\n");
1288 yylsp->first_line = yylloc.first_line;
1289 yylsp->first_column = yylloc.first_column;
1290 yylsp->last_line = (yylsp-1)->last_line;
1291 yylsp->last_column = (yylsp-1)->last_column;
1296 yylsp->last_line = (yylsp+yylen-1)->last_line;
1297 yylsp->last_column = (yylsp+yylen-1)->last_column;
1301 /* Now "shift" the result of the reduction.
1302 Determine what state that goes to,
1303 based on the state we popped back to
1304 and the rule number reduced by. */
1308 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1309 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1310 yystate = yytable[yystate];
1312 yystate = yydefgoto[yyn - YYNTBASE];
1316 yyerrlab: /* here on detecting error */
1319 /* If not already recovering from an error, report this error. */
1323 #ifdef YYERROR_VERBOSE
1324 yyn = yypact[yystate];
1326 if (yyn > YYFLAG && yyn < YYLAST)
1333 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1334 for (x = (yyn < 0 ? -yyn : 0);
1335 x < (sizeof(yytname) / sizeof(char *)); x++)
1336 if (yycheck[x + yyn] == x)
1337 size += strlen(yytname[x]) + 15, count++;
1338 msg = (char *) malloc(size + 15);
1341 strcpy(msg, "parse error");
1346 for (x = (yyn < 0 ? -yyn : 0);
1347 x < (sizeof(yytname) / sizeof(char *)); x++)
1348 if (yycheck[x + yyn] == x)
1350 strcat(msg, count == 0 ? ", expecting `" : " or `");
1351 strcat(msg, yytname[x]);
1360 yyerror ("parse error; also virtual memory exceeded");
1363 #endif /* YYERROR_VERBOSE */
1364 yyerror("parse error");
1368 yyerrlab1: /* here on error raised explicitly by an action */
1370 if (yyerrstatus == 3)
1372 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1374 /* return failure if at end of input */
1375 if (yychar == YYEOF)
1380 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1386 /* Else will try to reuse lookahead token
1387 after shifting the error token. */
1389 yyerrstatus = 3; /* Each real token shifted decrements this */
1393 yyerrdefault: /* current state does not do anything special for the error token. */
1396 /* This is wrong; only states that explicitly want error tokens
1397 should shift them. */
1398 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1399 if (yyn) goto yydefault;
1402 yyerrpop: /* pop the current state because it cannot handle the error token */
1404 if (yyssp == yyss) YYABORT;
1414 short *ssp1 = yyss - 1;
1415 fprintf (stderr, "Error: state stack now");
1416 while (ssp1 != yyssp)
1417 fprintf (stderr, " %d", *++ssp1);
1418 fprintf (stderr, "\n");
1424 yyn = yypact[yystate];
1429 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1448 fprintf(stderr, "Shifting error token, ");
1460 /* YYACCEPT comes here. */
1472 /* YYABORT comes here. */
1490 fprintf (stderr, "%s:%d: %s\n", yyin_name, linenum, msg);