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 * This program 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 2, or (at your option)
57 * This program 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 this program; see the file COPYING. If not, write to
64 * the Free Software Foundation, 59 Temple Place - Suite 330,
65 * Boston, MA 02111-1307, USA.
69 * $Id: gram.c,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
97 #define YYTRANSLATE(x) ((unsigned)(x) <= 288 ? yytranslate[x] : 68)
99 static const char yytranslate[] = { 0,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 41, 2, 2, 2, 2, 2, 2, 50,
104 51, 39, 37, 49, 38, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 28, 48, 33,
106 22, 34, 27, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 44, 2, 45, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 46, 2, 47, 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, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
126 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
127 17, 18, 19, 20, 21, 23, 24, 25, 26, 29,
128 30, 31, 32, 35, 36, 40, 42, 43
132 static const short yyprhs[] = { 0,
133 0, 1, 4, 9, 14, 19, 25, 33, 35, 36,
134 41, 42, 45, 50, 55, 60, 65, 66, 68, 70,
135 74, 75, 79, 81, 85, 87, 91, 92, 95, 98,
136 102, 112, 116, 122, 130, 136, 146, 149, 151, 153,
137 155, 157, 159, 162, 166, 170, 175, 179, 183, 187,
138 191, 195, 198, 201, 204, 207, 214, 218, 223, 229,
139 233, 237, 241, 245, 249, 253, 257, 261, 265, 269,
140 270, 272, 273, 275, 277
143 static const short yyrhs[] = { -1,
144 52, 53, 0, 10, 46, 62, 47, 0, 11, 46,
145 54, 47, 0, 12, 46, 54, 47, 0, 9, 3,
146 46, 55, 47, 0, 9, 3, 21, 3, 46, 55,
147 47, 0, 63, 0, 0, 54, 4, 3, 48, 0,
148 0, 55, 56, 0, 13, 46, 62, 47, 0, 14,
149 46, 62, 47, 0, 4, 46, 62, 47, 0, 3,
150 46, 62, 47, 0, 0, 58, 0, 3, 0, 58,
151 49, 3, 0, 0, 18, 60, 48, 0, 61, 0,
152 60, 49, 61, 0, 3, 0, 3, 22, 64, 0,
153 0, 62, 63, 0, 15, 48, 0, 15, 64, 48,
154 0, 8, 3, 50, 57, 51, 46, 59, 62, 47,
155 0, 46, 62, 47, 0, 16, 50, 64, 51, 63,
156 0, 16, 50, 64, 51, 63, 17, 63, 0, 19,
157 50, 64, 51, 63, 0, 20, 50, 65, 48, 64,
158 48, 65, 51, 63, 0, 64, 48, 0, 5, 0,
159 4, 0, 6, 0, 7, 0, 3, 0, 41, 64,
160 0, 64, 30, 64, 0, 64, 29, 64, 0, 3,
161 50, 66, 51, 0, 3, 22, 64, 0, 3, 23,
162 64, 0, 3, 24, 64, 0, 3, 25, 64, 0,
163 3, 26, 64, 0, 3, 42, 0, 3, 43, 0,
164 42, 3, 0, 43, 3, 0, 64, 44, 64, 45,
165 22, 64, 0, 50, 64, 51, 0, 64, 44, 64,
166 45, 0, 64, 27, 64, 28, 64, 0, 64, 39,
167 64, 0, 64, 40, 64, 0, 64, 37, 64, 0,
168 64, 38, 64, 0, 64, 33, 64, 0, 64, 34,
169 64, 0, 64, 31, 64, 0, 64, 32, 64, 0,
170 64, 35, 64, 0, 64, 36, 64, 0, 0, 64,
171 0, 0, 67, 0, 64, 0, 67, 49, 64, 0
177 static const short yyrline[] = { 0,
178 67, 68, 71, 72, 74, 76, 78, 80, 83, 84,
179 88, 89, 91, 92, 93, 94, 97, 98, 101, 102,
180 105, 106, 109, 110, 113, 114, 117, 118, 121, 123,
181 125, 130, 132, 134, 137, 139, 142, 146, 148, 150,
182 152, 154, 156, 158, 159, 160, 162, 164, 166, 168,
183 170, 172, 174, 176, 178, 180, 182, 183, 185, 187,
184 188, 189, 190, 192, 193, 194, 195, 196, 197, 200,
185 201, 204, 205, 208, 209
190 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
192 static const char * const yytname[] = { "$","error","$undefined.","tSYMBOL",
193 "tREGEXP","tSTRING","tINTEGER","tREAL","tSUB","tSTATE","tSTART","tSTARTRULES",
194 "tNAMERULES","tBEGIN","tEND","tRETURN","tIF","tELSE","tLOCAL","tWHILE","tFOR",
195 "tEXTENDS","'='","tADDASSIGN","tSUBASSIGN","tMULASSIGN","tDIVASSIGN","'?'","':'",
196 "tOR","tAND","tEQ","tNE","'<'","'>'","tGE","tLE","'+'","'-'","'*'","tDIV","'!'",
197 "tPLUSPLUS","tMINUSMINUS","'['","']'","'{'","'}'","';'","','","'('","')'","file",
198 "toplevel","regexp_sym_list","staterules","staterule","symbol_list","rest_symbol_list",
199 "locals","locals_rest","local_def","stmt_list","stmt","expr","cond_expr","expr_list",
200 "rest_expr_list", NULL
204 static const short yyr1[] = { 0,
205 52, 52, 53, 53, 53, 53, 53, 53, 54, 54,
206 55, 55, 56, 56, 56, 56, 57, 57, 58, 58,
207 59, 59, 60, 60, 61, 61, 62, 62, 63, 63,
208 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
209 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
210 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
211 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
215 static const short yyr2[] = { 0,
216 0, 2, 4, 4, 4, 5, 7, 1, 0, 4,
217 0, 2, 4, 4, 4, 4, 0, 1, 1, 3,
218 0, 3, 1, 3, 1, 3, 0, 2, 2, 3,
219 9, 3, 5, 7, 5, 9, 2, 1, 1, 1,
220 1, 1, 2, 3, 3, 4, 3, 3, 3, 3,
221 3, 2, 2, 2, 2, 6, 3, 4, 5, 3,
222 3, 3, 3, 3, 3, 3, 3, 3, 3, 0,
226 static const short yydefact[] = { 1,
227 0, 42, 39, 38, 40, 41, 0, 0, 0, 0,
228 0, 0, 0, 0, 0, 0, 0, 0, 27, 0,
229 2, 8, 0, 0, 0, 0, 0, 0, 52, 53,
230 72, 0, 0, 27, 9, 9, 29, 0, 0, 0,
231 70, 43, 54, 55, 0, 0, 0, 0, 0, 0,
232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
233 37, 47, 48, 49, 50, 51, 74, 0, 73, 17,
234 0, 11, 0, 0, 0, 30, 0, 0, 71, 0,
235 32, 28, 57, 0, 45, 44, 66, 67, 64, 65,
236 68, 69, 62, 63, 60, 61, 0, 46, 0, 19,
237 0, 18, 0, 0, 3, 0, 4, 5, 0, 0,
238 0, 0, 58, 75, 0, 0, 11, 0, 0, 0,
239 0, 6, 12, 0, 33, 35, 0, 59, 0, 21,
240 20, 0, 27, 27, 27, 27, 10, 0, 70, 56,
241 0, 27, 7, 0, 0, 0, 0, 34, 0, 25,
242 0, 23, 0, 16, 15, 13, 14, 0, 0, 22,
243 0, 31, 36, 26, 24, 0, 0
246 static const short yydefgoto[] = { 1,
247 21, 74, 104, 123, 101, 102, 142, 151, 152, 45,
251 static const short yypact[] = {-32768,
252 71, 270,-32768,-32768,-32768,-32768, 1, 9, -40, -28,
253 -27, 18, -24, -18, -17, 90, 28, 31,-32768, 90,
254 -32768,-32768, 374, 90, 90, 90, 90, 90,-32768,-32768,
255 90, -15, -19,-32768,-32768,-32768,-32768, 394, 90, 90,
256 90, 12,-32768,-32768, 119, 305, 90, 90, 90, 90,
257 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
258 -32768, 469, 469, 469, 469, 469, 469, 7, 20, 64,
259 67,-32768, 139, 3, 4,-32768, 328, 351, 469, 36,
260 -32768,-32768,-32768, 453, 484, 498, 510, 510, 112, 112,
261 112, 112, 13, 13, 12, 12, 434,-32768, 90,-32768,
262 34, 40, 46, 51,-32768, 96,-32768,-32768, 283, 283,
263 90, 90, 85, 469, 69, 107,-32768, 70, 73, 74,
264 83,-32768,-32768, 82, 124,-32768, 414, 469, 90, 118,
265 -32768, 59,-32768,-32768,-32768,-32768,-32768, 283, 90, 469,
266 150,-32768,-32768, 168, 187, 216, 235,-32768, 113, 141,
267 -38,-32768, 264,-32768,-32768,-32768,-32768, 283, 90,-32768,
268 150,-32768,-32768, 469,-32768, 167,-32768
271 static const short yypgoto[] = {-32768,
272 -32768, 132, 53,-32768,-32768,-32768,-32768,-32768, 16, -31,
273 -1, -11, 39,-32768,-32768
280 static const short yytable[] = { 22,
281 38, 71, 73, 32, 42, 34, 106, 106, 46, 160,
282 161, 33, 62, 63, 64, 65, 66, 35, 36, 67,
283 2, 3, 4, 5, 6, 39, 72, 77, 78, 79,
284 43, 40, 41, 44, 70, 84, 85, 86, 87, 88,
285 89, 90, 91, 92, 93, 94, 95, 96, 97, 107,
286 108, 58, 59, 118, 119, 60, 60, 98, 16, 17,
287 18, 118, 119, 120, 121, 37, 100, 20, 99, 103,
288 166, 120, 121, 2, 3, 4, 5, 6, 7, 8,
289 9, 10, 11, 111, 115, 12, 13, 114, 116, 14,
290 15, 117, 2, 3, 4, 5, 6, 122, 124, 127,
291 128, 144, 145, 146, 147, 143, 129, 125, 126, 131,
292 153, 16, 17, 18, 130, 133, 19, 140, 134, 135,
293 20, 2, 3, 4, 5, 6, 7, 79, 136, 137,
294 16, 17, 18, 12, 13, 141, 148, 14, 15, 20,
295 138, 2, 3, 4, 5, 6, 7, 164, 56, 57,
296 58, 59, 150, 12, 13, 60, 163, 14, 15, 16,
297 17, 18, 159, 158, 19, 81, 167, 75, 20, 132,
298 2, 3, 4, 5, 6, 7, 165, 149, 0, 16,
299 17, 18, 12, 13, 19, 105, 14, 15, 20, 2,
300 3, 4, 5, 6, 7, 0, 0, 0, 0, 0,
301 0, 12, 13, 0, 0, 14, 15, 0, 16, 17,
302 18, 0, 0, 19, 154, 0, 0, 20, 2, 3,
303 4, 5, 6, 7, 0, 0, 0, 16, 17, 18,
304 12, 13, 19, 155, 14, 15, 20, 2, 3, 4,
305 5, 6, 7, 0, 0, 0, 0, 0, 0, 12,
306 13, 0, 0, 14, 15, 0, 16, 17, 18, 0,
307 0, 19, 156, 0, 0, 20, 2, 3, 4, 5,
308 6, 7, 0, 0, 0, 16, 17, 18, 12, 13,
309 19, 157, 14, 15, 20, 2, 3, 4, 5, 6,
310 7, 24, 25, 26, 27, 28, 0, 12, 13, 0,
311 0, 14, 15, 0, 16, 17, 18, 0, 0, 19,
312 162, 29, 30, 20, 0, 0, 0, 0, 0, 31,
313 0, 0, 0, 16, 17, 18, 0, 0, 19, 0,
314 0, 47, 20, 48, 49, 50, 51, 52, 53, 54,
315 55, 56, 57, 58, 59, 0, 0, 0, 60, 0,
316 0, 0, 0, 0, 47, 83, 48, 49, 50, 51,
317 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
318 0, 60, 0, 0, 0, 0, 0, 47, 109, 48,
319 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
320 59, 0, 0, 0, 60, 0, 0, 0, 0, 0,
321 47, 110, 48, 49, 50, 51, 52, 53, 54, 55,
322 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
323 47, 61, 48, 49, 50, 51, 52, 53, 54, 55,
324 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
325 47, 76, 48, 49, 50, 51, 52, 53, 54, 55,
326 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
327 47, 139, 48, 49, 50, 51, 52, 53, 54, 55,
328 56, 57, 58, 59, 0, 0, 0, 60, 113, 47,
329 112, 48, 49, 50, 51, 52, 53, 54, 55, 56,
330 57, 58, 59, 0, 0, 47, 60, 48, 49, 50,
331 51, 52, 53, 54, 55, 56, 57, 58, 59, 0,
332 0, 0, 60, 49, 50, 51, 52, 53, 54, 55,
333 56, 57, 58, 59, 0, 0, 0, 60, 50, 51,
334 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
335 0, 60, 52, 53, 54, 55, 56, 57, 58, 59,
339 static const short yycheck[] = { 1,
340 12, 21, 34, 3, 16, 46, 4, 4, 20, 48,
341 49, 3, 24, 25, 26, 27, 28, 46, 46, 31,
342 3, 4, 5, 6, 7, 50, 46, 39, 40, 41,
343 3, 50, 50, 3, 50, 47, 48, 49, 50, 51,
344 52, 53, 54, 55, 56, 57, 58, 59, 60, 47,
345 47, 39, 40, 3, 4, 44, 44, 51, 41, 42,
346 43, 3, 4, 13, 14, 48, 3, 50, 49, 3,
347 0, 13, 14, 3, 4, 5, 6, 7, 8, 9,
348 10, 11, 12, 48, 51, 15, 16, 99, 49, 19,
349 20, 46, 3, 4, 5, 6, 7, 47, 3, 111,
350 112, 133, 134, 135, 136, 47, 22, 109, 110, 3,
351 142, 41, 42, 43, 46, 46, 46, 129, 46, 46,
352 50, 3, 4, 5, 6, 7, 8, 139, 46, 48,
353 41, 42, 43, 15, 16, 18, 138, 19, 20, 50,
354 17, 3, 4, 5, 6, 7, 8, 159, 37, 38,
355 39, 40, 3, 15, 16, 44, 158, 19, 20, 41,
356 42, 43, 22, 51, 46, 47, 0, 36, 50, 117,
357 3, 4, 5, 6, 7, 8, 161, 139, -1, 41,
358 42, 43, 15, 16, 46, 47, 19, 20, 50, 3,
359 4, 5, 6, 7, 8, -1, -1, -1, -1, -1,
360 -1, 15, 16, -1, -1, 19, 20, -1, 41, 42,
361 43, -1, -1, 46, 47, -1, -1, 50, 3, 4,
362 5, 6, 7, 8, -1, -1, -1, 41, 42, 43,
363 15, 16, 46, 47, 19, 20, 50, 3, 4, 5,
364 6, 7, 8, -1, -1, -1, -1, -1, -1, 15,
365 16, -1, -1, 19, 20, -1, 41, 42, 43, -1,
366 -1, 46, 47, -1, -1, 50, 3, 4, 5, 6,
367 7, 8, -1, -1, -1, 41, 42, 43, 15, 16,
368 46, 47, 19, 20, 50, 3, 4, 5, 6, 7,
369 8, 22, 23, 24, 25, 26, -1, 15, 16, -1,
370 -1, 19, 20, -1, 41, 42, 43, -1, -1, 46,
371 47, 42, 43, 50, -1, -1, -1, -1, -1, 50,
372 -1, -1, -1, 41, 42, 43, -1, -1, 46, -1,
373 -1, 27, 50, 29, 30, 31, 32, 33, 34, 35,
374 36, 37, 38, 39, 40, -1, -1, -1, 44, -1,
375 -1, -1, -1, -1, 27, 51, 29, 30, 31, 32,
376 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
377 -1, 44, -1, -1, -1, -1, -1, 27, 51, 29,
378 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
379 40, -1, -1, -1, 44, -1, -1, -1, -1, -1,
380 27, 51, 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, -1, -1,
386 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
387 37, 38, 39, 40, -1, -1, -1, 44, 45, 27,
388 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
389 38, 39, 40, -1, -1, 27, 44, 29, 30, 31,
390 32, 33, 34, 35, 36, 37, 38, 39, 40, -1,
391 -1, -1, 44, 30, 31, 32, 33, 34, 35, 36,
392 37, 38, 39, 40, -1, -1, -1, 44, 31, 32,
393 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
394 -1, 44, 33, 34, 35, 36, 37, 38, 39, 40,
397 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
398 #line 3 "/l/mtr/gnu/share/bison.simple"
399 /* This file comes from bison-1.28. */
401 /* Skeleton output parser for bison,
402 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
404 This program is free software; you can redistribute it and/or modify
405 it under the terms of the GNU General Public License as published by
406 the Free Software Foundation; either version 2, or (at your option)
409 This program is distributed in the hope that it will be useful,
410 but WITHOUT ANY WARRANTY; without even the implied warranty of
411 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
412 GNU General Public License for more details.
414 You should have received a copy of the GNU General Public License
415 along with this program; if not, write to the Free Software
416 Foundation, Inc., 59 Temple Place - Suite 330,
417 Boston, MA 02111-1307, USA. */
419 /* As a special exception, when this file is copied by Bison into a
420 Bison output file, you may use that output file without restriction.
421 This special exception was added by the Free Software Foundation
422 in version 1.24 of Bison. */
424 /* This is the parser code that is written into each bison parser
425 when the %semantic_parser declaration is not specified in the grammar.
426 It was written by Richard Stallman by simplifying the hairy parser
427 used when %semantic_parser is specified. */
429 #ifndef YYSTACK_USE_ALLOCA
431 #define YYSTACK_USE_ALLOCA
432 #else /* alloca not defined */
434 #define YYSTACK_USE_ALLOCA
435 #define alloca __builtin_alloca
436 #else /* not GNU C. */
437 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
438 #define YYSTACK_USE_ALLOCA
440 #else /* not sparc */
441 /* We think this test detects Watcom and Microsoft C. */
442 /* This used to test MSDOS, but that is a bad idea
443 since that symbol is in the user namespace. */
444 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
445 #if 0 /* No need for malloc.h, which pollutes the namespace;
446 instead, just don't use alloca. */
449 #else /* not MSDOS, or __TURBOC__ */
451 /* I don't know what this was needed for, but it pollutes the namespace.
452 So I turned it off. rms, 2 May 1997. */
453 /* #include <malloc.h> */
455 #define YYSTACK_USE_ALLOCA
456 #else /* not MSDOS, or __TURBOC__, or _AIX */
458 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
459 and on HPUX 10. Eventually we can turn this on. */
460 #define YYSTACK_USE_ALLOCA
461 #define alloca __builtin_alloca
464 #endif /* not _AIX */
465 #endif /* not MSDOS, or __TURBOC__ */
466 #endif /* not sparc */
467 #endif /* not GNU C */
468 #endif /* alloca not defined */
469 #endif /* YYSTACK_USE_ALLOCA not defined */
471 #ifdef YYSTACK_USE_ALLOCA
472 #define YYSTACK_ALLOC alloca
474 #define YYSTACK_ALLOC malloc
477 /* Note: there must be only one dollar sign in this file.
478 It is replaced by the list of actions, each action
479 as one case of the switch. */
481 #define yyerrok (yyerrstatus = 0)
482 #define yyclearin (yychar = YYEMPTY)
485 #define YYACCEPT goto yyacceptlab
486 #define YYABORT goto yyabortlab
487 #define YYERROR goto yyerrlab1
488 /* Like YYERROR except do call yyerror.
489 This remains here temporarily to ease the
490 transition to the new meaning of YYERROR, for GCC.
491 Once GCC version 2 has supplanted version 1, this can go. */
492 #define YYFAIL goto yyerrlab
493 #define YYRECOVERING() (!!yyerrstatus)
494 #define YYBACKUP(token, value) \
496 if (yychar == YYEMPTY && yylen == 1) \
497 { yychar = (token), yylval = (value); \
498 yychar1 = YYTRANSLATE (yychar); \
503 { yyerror ("syntax error: cannot back up"); YYERROR; } \
507 #define YYERRCODE 256
510 #define YYLEX yylex()
516 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
518 #define YYLEX yylex(&yylval, &yylloc)
520 #else /* not YYLSP_NEEDED */
522 #define YYLEX yylex(&yylval, YYLEX_PARAM)
524 #define YYLEX yylex(&yylval)
526 #endif /* not YYLSP_NEEDED */
529 /* If nonreentrant, generate the variables here */
533 int yychar; /* the lookahead symbol */
534 YYSTYPE yylval; /* the semantic value of the */
535 /* lookahead symbol */
538 YYLTYPE yylloc; /* location data for the lookahead */
542 int yynerrs; /* number of parse errors so far */
543 #endif /* not YYPURE */
546 int yydebug; /* nonzero means print parse trace */
547 /* Since this is uninitialized, it does not stop multiple parsers
551 /* YYINITDEPTH indicates the initial size of the parser's stacks */
554 #define YYINITDEPTH 200
557 /* YYMAXDEPTH is the maximum size the stacks can grow to
558 (effective only if the built-in stack extension method is used). */
565 #define YYMAXDEPTH 10000
568 /* Define __yy_memcpy. Note that the size argument
569 should be passed with type unsigned int, because that is what the non-GCC
570 definitions require. With GCC, __builtin_memcpy takes an arg
571 of type size_t, but it can handle unsigned int. */
573 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
574 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
575 #else /* not GNU C or C++ */
578 /* This is the most reliable way to avoid incompatibilities
579 in available built-in functions on various systems. */
581 __yy_memcpy (to, from, count)
586 register char *f = from;
587 register char *t = to;
588 register int i = count;
594 #else /* __cplusplus */
596 /* This is the most reliable way to avoid incompatibilities
597 in available built-in functions on various systems. */
599 __yy_memcpy (char *to, char *from, unsigned int count)
601 register char *t = to;
602 register char *f = from;
603 register int i = count;
612 #line 217 "/l/mtr/gnu/share/bison.simple"
614 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
615 into yyparse. The argument should have type void *.
616 It should actually point to an object.
617 Grammar actions can access the variable by casting it
618 to the proper pointer type. */
622 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
623 #define YYPARSE_PARAM_DECL
624 #else /* not __cplusplus */
625 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
626 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
627 #endif /* not __cplusplus */
628 #else /* not YYPARSE_PARAM */
629 #define YYPARSE_PARAM_ARG
630 #define YYPARSE_PARAM_DECL
631 #endif /* not YYPARSE_PARAM */
633 /* Prevent warning if -Wstrict-prototypes. */
636 int yyparse (void *);
643 yyparse(YYPARSE_PARAM_ARG)
646 register int yystate;
648 register short *yyssp;
649 register YYSTYPE *yyvsp;
650 int yyerrstatus; /* number of tokens to shift before error messages enabled */
651 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
653 short yyssa[YYINITDEPTH]; /* the state stack */
654 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
656 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
657 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
660 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
661 YYLTYPE *yyls = yylsa;
664 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
666 #define YYPOPSTACK (yyvsp--, yyssp--)
669 int yystacksize = YYINITDEPTH;
670 int yyfree_stacks = 0;
681 YYSTYPE yyval; /* the variable used to return */
682 /* semantic values from the action */
689 fprintf(stderr, "Starting parse\n");
695 yychar = YYEMPTY; /* Cause a token to be read. */
697 /* Initialize stack pointers.
698 Waste one element of value and location stack
699 so that they stay on the same level as the state stack.
700 The wasted elements are never initialized. */
708 /* Push a new state, which is found in yystate . */
709 /* In all cases, when you get here, the value and location stacks
710 have just been pushed. so pushing a state here evens the stacks. */
715 if (yyssp >= yyss + yystacksize - 1)
717 /* Give user a chance to reallocate the stack */
718 /* Use copies of these so that the &'s don't force the real ones into memory. */
719 YYSTYPE *yyvs1 = yyvs;
722 YYLTYPE *yyls1 = yyls;
725 /* Get the current used size of the three stacks, in elements. */
726 int size = yyssp - yyss + 1;
729 /* Each stack pointer address is followed by the size of
730 the data in use in that stack, in bytes. */
732 /* This used to be a conditional around just the two extra args,
733 but that might be undefined if yyoverflow is a macro. */
734 yyoverflow("parser stack overflow",
735 &yyss1, size * sizeof (*yyssp),
736 &yyvs1, size * sizeof (*yyvsp),
737 &yyls1, size * sizeof (*yylsp),
740 yyoverflow("parser stack overflow",
741 &yyss1, size * sizeof (*yyssp),
742 &yyvs1, size * sizeof (*yyvsp),
746 yyss = yyss1; yyvs = yyvs1;
750 #else /* no yyoverflow */
751 /* Extend the stack our own way. */
752 if (yystacksize >= YYMAXDEPTH)
754 yyerror("parser stack overflow");
766 if (yystacksize > YYMAXDEPTH)
767 yystacksize = YYMAXDEPTH;
768 #ifndef YYSTACK_USE_ALLOCA
771 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
772 __yy_memcpy ((char *)yyss, (char *)yyss1,
773 size * (unsigned int) sizeof (*yyssp));
774 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
775 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
776 size * (unsigned int) sizeof (*yyvsp));
778 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
779 __yy_memcpy ((char *)yyls, (char *)yyls1,
780 size * (unsigned int) sizeof (*yylsp));
782 #endif /* no yyoverflow */
784 yyssp = yyss + size - 1;
785 yyvsp = yyvs + size - 1;
787 yylsp = yyls + size - 1;
792 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
795 if (yyssp >= yyss + yystacksize - 1)
801 fprintf(stderr, "Entering state %d\n", yystate);
807 /* Do appropriate processing given the current state. */
808 /* Read a lookahead token if we need one and don't already have one. */
811 /* First try to decide what to do without reference to lookahead token. */
813 yyn = yypact[yystate];
817 /* Not known => get a lookahead token if don't already have one. */
819 /* yychar is either YYEMPTY or YYEOF
820 or a valid token in external form. */
822 if (yychar == YYEMPTY)
826 fprintf(stderr, "Reading a token: ");
831 /* Convert token to internal form (in yychar1) for indexing tables with */
833 if (yychar <= 0) /* This means end of input. */
836 yychar = YYEOF; /* Don't call YYLEX any more */
840 fprintf(stderr, "Now at end of input.\n");
845 yychar1 = YYTRANSLATE(yychar);
850 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
851 /* Give the individual parser a way to print the precise meaning
852 of a token, for further debugging info. */
854 YYPRINT (stderr, yychar, yylval);
856 fprintf (stderr, ")\n");
862 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
867 /* yyn is what to do for this token type in this state.
868 Negative => reduce, -yyn is rule number.
869 Positive => shift, yyn is new state.
870 New state is final state => don't bother to shift,
872 0, or most negative number => error. */
887 /* Shift the lookahead token. */
891 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
894 /* Discard the token being shifted unless it is eof. */
903 /* count tokens shifted since error; after three, turn off error status. */
904 if (yyerrstatus) yyerrstatus--;
909 /* Do the default action for the current state. */
912 yyn = yydefact[yystate];
916 /* Do a reduction. yyn is the number of a rule to reduce with. */
920 yyval = yyvsp[1-yylen]; /* implement default value of the action */
927 fprintf (stderr, "Reducing via rule %d (line %d), ",
930 /* Print the symbols being reduced, and their result. */
931 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
932 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
933 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
942 { start_stmts = yyvsp[-1].lst; ;
946 { startrules = yyvsp[-1].lst; ;
950 { namerules = yyvsp[-1].lst; ;
954 { define_state (yyvsp[-3].node, NULL, yyvsp[-1].lst); ;
958 { define_state (yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].lst); ;
962 { list_append (global_stmts, yyvsp[0].stmt); ;
966 { yyval.lst = list (); ;
970 { list_append (yyvsp[-3].lst, cons (yyvsp[-2].node, yyvsp[-1].node)); ;
974 { yyval.lst = list (); ;
978 { list_append (yyvsp[-1].lst, yyvsp[0].cons); ;
982 { yyval.cons = cons (RULE_BEGIN, yyvsp[-1].lst); ;
986 { yyval.cons = cons (RULE_END, yyvsp[-1].lst); ;
990 { yyval.cons = cons (yyvsp[-3].node, yyvsp[-1].lst); ;
994 { yyval.cons = cons (yyvsp[-3].node, yyvsp[-1].lst); ;
998 { yyval.lst = list (); ;
1002 { yyval.lst = yyvsp[0].lst; ;
1006 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].node); ;
1010 { list_append (yyvsp[-2].lst, yyvsp[0].node); ;
1014 { yyval.lst = list (); ;
1018 { yyval.lst = yyvsp[-1].lst; ;
1022 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].cons); ;
1026 { list_append (yyvsp[-2].lst, yyvsp[0].cons); ;
1030 { yyval.cons = cons (yyvsp[0].node, NULL); ;
1034 { yyval.cons = cons (yyvsp[-2].node, yyvsp[0].expr); ;
1038 { yyval.lst = list (); ;
1042 { list_append (yyvsp[-1].lst, yyvsp[0].stmt); ;
1046 { yyval.stmt = mk_stmt (sRETURN, NULL, NULL,
1051 { yyval.stmt = mk_stmt (sRETURN, yyvsp[-1].expr, NULL,
1056 { yyval.stmt = mk_stmt (sDEFSUB, yyvsp[-7].node,
1057 cons (cons (yyvsp[-5].lst, yyvsp[-2].lst),
1063 { yyval.stmt = mk_stmt (sBLOCK, yyvsp[-1].lst, NULL,
1068 { yyval.stmt = mk_stmt (sIF, yyvsp[-2].expr, yyvsp[0].stmt, NULL,
1073 { yyval.stmt = mk_stmt (sIF, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt,
1078 { yyval.stmt = mk_stmt (sWHILE, yyvsp[-2].expr, yyvsp[0].stmt,
1083 { yyval.stmt = mk_stmt (sFOR, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr,
1088 { yyval.stmt = mk_stmt (sEXPR, yyvsp[-1].expr, NULL,
1093 { yyval.expr = mk_expr (eSTRING, yyvsp[0].node, NULL,
1098 { yyval.expr = mk_expr (eREGEXP, yyvsp[0].node, NULL,
1103 { yyval.expr = mk_expr (eINTEGER, yyvsp[0].node, NULL,
1108 { yyval.expr = mk_expr (eREAL, yyvsp[0].node, NULL,
1113 { yyval.expr = mk_expr (eSYMBOL, yyvsp[0].node, NULL,
1118 { yyval.expr = mk_expr (eNOT, yyvsp[0].expr, NULL,
1123 { yyval.expr = mk_expr (eAND, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1127 { yyval.expr = mk_expr (eOR, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1131 { yyval.expr = mk_expr (eFCALL, yyvsp[-3].node, yyvsp[-1].lst,
1136 { yyval.expr = mk_expr (eASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1141 { yyval.expr = mk_expr (eADDASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1146 { yyval.expr = mk_expr (eSUBASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1151 { yyval.expr = mk_expr (eMULASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1156 { yyval.expr = mk_expr (eDIVASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1161 { yyval.expr = mk_expr (ePOSTFIXADD, yyvsp[-1].node, NULL,
1166 { yyval.expr = mk_expr (ePOSTFIXSUB, yyvsp[-1].node, NULL,
1171 { yyval.expr = mk_expr (ePREFIXADD, yyvsp[0].node, NULL,
1176 { yyval.expr = mk_expr (ePREFIXSUB, yyvsp[0].node, NULL,
1181 { yyval.expr = mk_expr (eARRAYASSIGN, yyvsp[-5].expr, yyvsp[-3].expr,
1186 { yyval.expr = yyvsp[-1].expr; ;
1190 { yyval.expr = mk_expr (eARRAYREF, yyvsp[-3].expr, yyvsp[-1].expr,
1195 { yyval.expr = mk_expr (eQUESTCOLON, yyvsp[-4].expr, yyvsp[-2].expr,
1200 { yyval.expr = mk_expr (eMULT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1204 { yyval.expr = mk_expr (eDIV, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1208 { yyval.expr = mk_expr (ePLUS, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1212 { yyval.expr = mk_expr (eMINUS, yyvsp[-2].expr, yyvsp[0].expr,
1217 { yyval.expr = mk_expr (eLT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1221 { yyval.expr = mk_expr (eGT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1225 { yyval.expr = mk_expr (eEQ, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1229 { yyval.expr = mk_expr (eNE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1233 { yyval.expr = mk_expr (eGE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1237 { yyval.expr = mk_expr (eLE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1241 { yyval.expr = NULL; ;
1245 { yyval.expr = yyvsp[0].expr; ;
1249 { yyval.lst = list (); ;
1253 { yyval.lst = yyvsp[0].lst; ;
1257 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].expr); ;
1261 { list_append (yyvsp[-2].lst, yyvsp[0].expr); ;
1264 /* the action file gets copied in in place of this dollarsign */
1265 #line 543 "/l/mtr/gnu/share/bison.simple"
1276 short *ssp1 = yyss - 1;
1277 fprintf (stderr, "state stack now");
1278 while (ssp1 != yyssp)
1279 fprintf (stderr, " %d", *++ssp1);
1280 fprintf (stderr, "\n");
1290 yylsp->first_line = yylloc.first_line;
1291 yylsp->first_column = yylloc.first_column;
1292 yylsp->last_line = (yylsp-1)->last_line;
1293 yylsp->last_column = (yylsp-1)->last_column;
1298 yylsp->last_line = (yylsp+yylen-1)->last_line;
1299 yylsp->last_column = (yylsp+yylen-1)->last_column;
1303 /* Now "shift" the result of the reduction.
1304 Determine what state that goes to,
1305 based on the state we popped back to
1306 and the rule number reduced by. */
1310 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1311 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1312 yystate = yytable[yystate];
1314 yystate = yydefgoto[yyn - YYNTBASE];
1318 yyerrlab: /* here on detecting error */
1321 /* If not already recovering from an error, report this error. */
1325 #ifdef YYERROR_VERBOSE
1326 yyn = yypact[yystate];
1328 if (yyn > YYFLAG && yyn < YYLAST)
1335 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1336 for (x = (yyn < 0 ? -yyn : 0);
1337 x < (sizeof(yytname) / sizeof(char *)); x++)
1338 if (yycheck[x + yyn] == x)
1339 size += strlen(yytname[x]) + 15, count++;
1340 msg = (char *) malloc(size + 15);
1343 strcpy(msg, "parse error");
1348 for (x = (yyn < 0 ? -yyn : 0);
1349 x < (sizeof(yytname) / sizeof(char *)); x++)
1350 if (yycheck[x + yyn] == x)
1352 strcat(msg, count == 0 ? ", expecting `" : " or `");
1353 strcat(msg, yytname[x]);
1362 yyerror ("parse error; also virtual memory exceeded");
1365 #endif /* YYERROR_VERBOSE */
1366 yyerror("parse error");
1370 yyerrlab1: /* here on error raised explicitly by an action */
1372 if (yyerrstatus == 3)
1374 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1376 /* return failure if at end of input */
1377 if (yychar == YYEOF)
1382 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1388 /* Else will try to reuse lookahead token
1389 after shifting the error token. */
1391 yyerrstatus = 3; /* Each real token shifted decrements this */
1395 yyerrdefault: /* current state does not do anything special for the error token. */
1398 /* This is wrong; only states that explicitly want error tokens
1399 should shift them. */
1400 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1401 if (yyn) goto yydefault;
1404 yyerrpop: /* pop the current state because it cannot handle the error token */
1406 if (yyssp == yyss) YYABORT;
1416 short *ssp1 = yyss - 1;
1417 fprintf (stderr, "Error: state stack now");
1418 while (ssp1 != yyssp)
1419 fprintf (stderr, " %d", *++ssp1);
1420 fprintf (stderr, "\n");
1426 yyn = yypact[yystate];
1431 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1450 fprintf(stderr, "Shifting error token, ");
1462 /* YYACCEPT comes here. */
1474 /* YYABORT comes here. */
1492 fprintf (stderr, "%s:%d: %s\n", yyin_name, linenum, msg);