]>
code.delx.au - gnu-emacs/blob - test/etags/y-src/parse.c
1 /* A Bison parser, made from parse.y
4 #define YYBISON 1 /* Identify Bison output. */
31 /* Copyright (C) 1990, 1992, 1993 Free Software Foundation, Inc.
33 This file is part of Oleo, the GNU Spreadsheet.
35 Oleo is free software; you can redistribute it and/or modify
36 it under the terms of the GNU General Public License as published by
37 the Free Software Foundation; either version 2, or (at your option)
40 Oleo is distributed in the hope that it will be useful,
41 but WITHOUT ANY WARRANTY; without even the implied warranty of
42 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 GNU General Public License for more details.
45 You should have received a copy of the GNU General Public License
46 along with Oleo; see the file COPYING. If not, write to
47 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
54 #define obstack_chunk_alloc ck_malloc
55 #define obstack_chunk_free free
67 void yyerror (char *);
72 extern VOIDSTAR
hash_find();
74 /* This table contains a list of the infix single-char functions */
75 unsigned char fnin
[] = {
76 SUM
, DIFF
, DIV
, PROD
, MOD
, /* AND, OR, */ POW
, EQUAL
, IF
, CONCAT
, 0
79 #define YYSTYPE _y_y_s_t_y_p_e
80 typedef struct node
*YYSTYPE
;
83 YYSTYPE
make_list (YYSTYPE
, YYSTYPE
);
90 extern struct obstack tmp_mem
;
102 #define YYFLAG -32768
105 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
106 #define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 47)
108 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
109 static const char yytranslate
[] =
111 0, 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, 19, 2, 2, 2, 16, 5, 2,
115 38, 39, 14, 12, 40, 13, 2, 15, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2, 4, 2,
117 8, 6, 10, 3, 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, 17, 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, 2, 2, 2, 2, 2,
126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
135 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
136 2, 2, 2, 2, 2, 2, 1, 7, 9, 11,
137 18, 20, 21, 22, 23, 24, 25, 26, 27, 28,
138 29, 30, 31, 32, 33, 34, 35, 36, 37
142 static const short yyprhs
[] =
144 0, 0, 2, 4, 6, 8, 12, 17, 24, 33,
145 44, 49, 54, 59, 66, 73, 82, 91, 100, 109,
146 114, 120, 124, 128, 132, 136, 140, 144, 148, 152,
147 156, 160, 164, 168, 172, 175, 178, 182, 186, 189,
148 191, 195, 197, 199, 201, 205, 207
150 static const short yyrhs
[] =
152 42, 0, 1, 0, 23, 0, 46, 0, 24, 38,
153 39, 0, 25, 38, 42, 39, 0, 26, 38, 42,
154 40, 42, 39, 0, 27, 38, 42, 40, 42, 40,
155 42, 39, 0, 28, 38, 42, 40, 42, 40, 42,
156 40, 42, 39, 0, 29, 38, 43, 39, 0, 30,
157 38, 21, 39, 0, 30, 38, 22, 39, 0, 31,
158 38, 21, 40, 42, 39, 0, 31, 38, 22, 40,
159 42, 39, 0, 31, 38, 21, 40, 42, 40, 42,
160 39, 0, 31, 38, 22, 40, 42, 40, 42, 39,
161 0, 32, 38, 21, 40, 42, 40, 42, 39, 0,
162 32, 38, 22, 40, 42, 40, 42, 39, 0, 34,
163 38, 45, 39, 0, 42, 3, 42, 4, 42, 0,
164 42, 5, 42, 0, 42, 8, 42, 0, 42, 9,
165 42, 0, 42, 6, 42, 0, 42, 7, 42, 0,
166 42, 10, 42, 0, 42, 11, 42, 0, 42, 12,
167 42, 0, 42, 13, 42, 0, 42, 14, 42, 0,
168 42, 15, 42, 0, 42, 16, 42, 0, 42, 17,
169 42, 0, 13, 42, 0, 19, 42, 0, 38, 42,
170 39, 0, 38, 42, 1, 0, 38, 1, 0, 42,
171 0, 43, 40, 42, 0, 21, 0, 42, 0, 44,
172 0, 45, 40, 44, 0, 20, 0, 22, 0
178 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
179 static const short yyrline
[] =
181 0, 86, 88, 94, 95, 96, 98, 102, 106, 110,
182 114, 118, 121, 125, 129, 135, 142, 150, 154, 159,
183 163, 174, 178, 182, 186, 190, 194, 198, 202, 206,
184 210, 214, 218, 222, 226, 241, 245, 247, 255, 262,
185 264, 268, 269, 272, 274, 278, 280
190 #if (YYDEBUG) || defined YYERROR_VERBOSE
192 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
193 static const char *const yytname
[] =
195 "$", "error", "$undefined.", "'?'", "':'", "'&'", "'='", "NE", "'<'",
196 "LE", "'>'", "GE", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "NEG",
197 "'!'", "L_CELL", "L_RANGE", "L_VAR", "L_CONST", "L_FN0", "L_FN1",
198 "L_FN2", "L_FN3", "L_FN4", "L_FNN", "L_FN1R", "L_FN2R", "L_FN3R",
199 "L_FN4R", "L_FNNR", "L_LE", "L_NE", "L_GE", "'('", "')'", "','", "line",
200 "exp", "exp_list", "range_exp", "range_exp_list", "cell", NULL
204 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
205 static const short yyr1
[] =
207 0, 41, 41, 42, 42, 42, 42, 42, 42, 42,
208 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
209 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
210 42, 42, 42, 42, 42, 42, 42, 42, 42, 43,
211 43, 44, 44, 45, 45, 46, 46
214 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
215 static const short yyr2
[] =
217 0, 1, 1, 1, 1, 3, 4, 6, 8, 10,
218 4, 4, 4, 6, 6, 8, 8, 8, 8, 4,
219 5, 3, 3, 3, 3, 3, 3, 3, 3, 3,
220 3, 3, 3, 3, 2, 2, 3, 3, 2, 1,
224 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
225 doesn't specify something else to do. Zero means the default is an
227 static const short yydefact
[] =
229 0, 2, 0, 0, 45, 46, 3, 0, 0, 0,
230 0, 0, 0, 0, 0, 0, 0, 0, 1, 4,
231 34, 35, 0, 0, 0, 0, 0, 0, 0, 0,
232 0, 0, 38, 0, 0, 0, 0, 0, 0, 0,
233 0, 0, 0, 0, 0, 0, 0, 0, 5, 0,
234 0, 0, 0, 39, 0, 0, 0, 0, 0, 0,
235 0, 41, 42, 43, 0, 37, 36, 0, 21, 24,
236 25, 22, 23, 26, 27, 28, 29, 30, 31, 32,
237 33, 6, 0, 0, 0, 10, 0, 11, 12, 0,
238 0, 0, 0, 19, 0, 0, 0, 0, 0, 40,
239 0, 0, 0, 0, 44, 20, 7, 0, 0, 13,
240 0, 14, 0, 0, 0, 0, 0, 0, 0, 0,
241 0, 8, 0, 15, 16, 17, 18, 0, 9, 0,
245 static const short yydefgoto
[] =
247 129, 62, 54, 63, 64, 19
250 static const short yypact
[] =
252 104,-32768, 486, 486,-32768,-32768,-32768, -37, -22, -16,
253 10, 12, 14, 29, 43, 47, 50, 124, 537,-32768,
254 -32768,-32768, 59, 486, 486, 486, 486, 486, 7, 9,
255 11, 464,-32768, 48, 486, 486, 486, 486, 486, 486,
256 486, 486, 486, 486, 486, 486, 486, 486,-32768, 332,
257 173, 209, 224, 537, 54, 60, 61, 64, 66, 69,
258 71,-32768, 537,-32768, 57,-32768,-32768, 522, -2, 193,
259 193, 547, 547, 547, 547, 4, 4, 84, 84, 84,
260 84,-32768, 486, 486, 486,-32768, 486,-32768,-32768, 486,
261 486, 486, 486,-32768, 464, 486, 353, 245, 260, 537,
262 63, 158, 281, 296,-32768, 537,-32768, 486, 486,-32768,
263 486,-32768, 486, 486, 486, 369, 317, 388, 404, 423,
264 439,-32768, 486,-32768,-32768,-32768,-32768, 458,-32768, 115,
268 static const short yypgoto
[] =
270 -32768, 0,-32768, 24,-32768,-32768
277 static const short yytable
[] =
279 18, 22, 20, 21, 36, 37, 38, 39, 40, 41,
280 42, 43, 44, 45, 46, 47, 23, 33, 44, 45,
281 46, 47, 24, 49, 50, 51, 52, 53, 55, 56,
282 57, 58, 59, 60, 67, 68, 69, 70, 71, 72,
283 73, 74, 75, 76, 77, 78, 79, 80, 25, 65,
284 26, 34, 27, 35, 36, 37, 38, 39, 40, 41,
285 42, 43, 44, 45, 46, 47, 34, 28, 35, 36,
286 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
287 47, 29, 96, 97, 98, 30, 99, 66, 31, 100,
288 101, 102, 103, 85, 86, 105, 93, 94, 48, 87,
289 88, 47, 109, 110, 89, 1, 90, 115, 116, 91,
290 117, 92, 118, 119, 120, 130, 131, 2, 104, 0,
291 0, 0, 127, 3, 4, 32, 5, 6, 7, 8,
292 9, 10, 11, 12, 13, 14, 15, 2, 16, 0,
293 0, 0, 17, 3, 4, 0, 5, 6, 7, 8,
294 9, 10, 11, 12, 13, 14, 15, 0, 16, 0,
295 0, 34, 17, 35, 36, 37, 38, 39, 40, 41,
296 42, 43, 44, 45, 46, 47, 34, 0, 35, 36,
297 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
298 47, 0, 0, 0, 0, 0, 0, 111, 112,-32768,
299 -32768, 38, 39, 40, 41, 42, 43, 44, 45, 46,
300 47, 0, 34, 82, 35, 36, 37, 38, 39, 40,
301 41, 42, 43, 44, 45, 46, 47, 34, 0, 35,
302 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
303 46, 47, 0, 0, 0, 0, 0, 0, 34, 83,
304 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
305 45, 46, 47, 34, 84, 35, 36, 37, 38, 39,
306 40, 41, 42, 43, 44, 45, 46, 47, 0, 0,
307 0, 0, 0, 0, 34, 107, 35, 36, 37, 38,
308 39, 40, 41, 42, 43, 44, 45, 46, 47, 34,
309 108, 35, 36, 37, 38, 39, 40, 41, 42, 43,
310 44, 45, 46, 47, 0, 0, 0, 0, 0, 0,
311 34, 113, 35, 36, 37, 38, 39, 40, 41, 42,
312 43, 44, 45, 46, 47, 34, 114, 35, 36, 37,
313 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
314 0, 0, 0, 0, 0, 0, 34, 122, 35, 36,
315 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
316 47, 81, 34, 0, 35, 36, 37, 38, 39, 40,
317 41, 42, 43, 44, 45, 46, 47, 0, 0, 0,
318 0, 34, 106, 35, 36, 37, 38, 39, 40, 41,
319 42, 43, 44, 45, 46, 47, 0, 34, 121, 35,
320 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
321 46, 47, 0, 0, 0, 0, 34, 123, 35, 36,
322 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
323 47, 0, 34, 124, 35, 36, 37, 38, 39, 40,
324 41, 42, 43, 44, 45, 46, 47, 0, 0, 0,
325 0, 34, 125, 35, 36, 37, 38, 39, 40, 41,
326 42, 43, 44, 45, 46, 47, 0, 2, 126, 0,
327 0, 0, 0, 3, 4, 61, 5, 6, 7, 8,
328 9, 10, 11, 12, 13, 14, 15, 128, 16, 2,
329 0, 0, 17, 0, 0, 3, 4, 0, 5, 6,
330 7, 8, 9, 10, 11, 12, 13, 14, 15, 0,
331 16, 0, 0, 0, 17, 34, 95, 35, 36, 37,
332 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
333 34, 0, 35, 36, 37, 38, 39, 40, 41, 42,
334 43, 44, 45, 46, 47,-32768,-32768,-32768,-32768, 42,
338 static const short yycheck
[] =
340 0, 38, 2, 3, 6, 7, 8, 9, 10, 11,
341 12, 13, 14, 15, 16, 17, 38, 17, 14, 15,
342 16, 17, 38, 23, 24, 25, 26, 27, 21, 22,
343 21, 22, 21, 22, 34, 35, 36, 37, 38, 39,
344 40, 41, 42, 43, 44, 45, 46, 47, 38, 1,
345 38, 3, 38, 5, 6, 7, 8, 9, 10, 11,
346 12, 13, 14, 15, 16, 17, 3, 38, 5, 6,
347 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
348 17, 38, 82, 83, 84, 38, 86, 39, 38, 89,
349 90, 91, 92, 39, 40, 95, 39, 40, 39, 39,
350 39, 17, 39, 40, 40, 1, 40, 107, 108, 40,
351 110, 40, 112, 113, 114, 0, 0, 13, 94, -1,
352 -1, -1, 122, 19, 20, 1, 22, 23, 24, 25,
353 26, 27, 28, 29, 30, 31, 32, 13, 34, -1,
354 -1, -1, 38, 19, 20, -1, 22, 23, 24, 25,
355 26, 27, 28, 29, 30, 31, 32, -1, 34, -1,
356 -1, 3, 38, 5, 6, 7, 8, 9, 10, 11,
357 12, 13, 14, 15, 16, 17, 3, -1, 5, 6,
358 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
359 17, -1, -1, -1, -1, -1, -1, 39, 40, 6,
360 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
361 17, -1, 3, 40, 5, 6, 7, 8, 9, 10,
362 11, 12, 13, 14, 15, 16, 17, 3, -1, 5,
363 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
364 16, 17, -1, -1, -1, -1, -1, -1, 3, 40,
365 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
366 15, 16, 17, 3, 40, 5, 6, 7, 8, 9,
367 10, 11, 12, 13, 14, 15, 16, 17, -1, -1,
368 -1, -1, -1, -1, 3, 40, 5, 6, 7, 8,
369 9, 10, 11, 12, 13, 14, 15, 16, 17, 3,
370 40, 5, 6, 7, 8, 9, 10, 11, 12, 13,
371 14, 15, 16, 17, -1, -1, -1, -1, -1, -1,
372 3, 40, 5, 6, 7, 8, 9, 10, 11, 12,
373 13, 14, 15, 16, 17, 3, 40, 5, 6, 7,
374 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
375 -1, -1, -1, -1, -1, -1, 3, 40, 5, 6,
376 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
377 17, 39, 3, -1, 5, 6, 7, 8, 9, 10,
378 11, 12, 13, 14, 15, 16, 17, -1, -1, -1,
379 -1, 3, 39, 5, 6, 7, 8, 9, 10, 11,
380 12, 13, 14, 15, 16, 17, -1, 3, 39, 5,
381 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
382 16, 17, -1, -1, -1, -1, 3, 39, 5, 6,
383 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
384 17, -1, 3, 39, 5, 6, 7, 8, 9, 10,
385 11, 12, 13, 14, 15, 16, 17, -1, -1, -1,
386 -1, 3, 39, 5, 6, 7, 8, 9, 10, 11,
387 12, 13, 14, 15, 16, 17, -1, 13, 39, -1,
388 -1, -1, -1, 19, 20, 21, 22, 23, 24, 25,
389 26, 27, 28, 29, 30, 31, 32, 39, 34, 13,
390 -1, -1, 38, -1, -1, 19, 20, -1, 22, 23,
391 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
392 34, -1, -1, -1, 38, 3, 4, 5, 6, 7,
393 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
394 3, -1, 5, 6, 7, 8, 9, 10, 11, 12,
395 13, 14, 15, 16, 17, 8, 9, 10, 11, 12,
398 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
399 #line 3 "/usr/share/bison/bison.simple"
401 /* Skeleton output parser for bison,
402 Copyright (C) 1984, 1989, 1990, 2000, 2001 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 when
425 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 /* All symbols defined below should begin with yy or YY, to avoid
430 infringing on user name space. This should be done even for local
431 variables, as they might otherwise be expanded by user macros.
432 There are some unavoidable exceptions within include files to
433 define necessary library symbols; they are noted "INFRINGES ON
434 USER NAME SPACE" below. */
437 # define YYSTD(x) std::x
442 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
444 /* The parser invokes alloca or malloc; define the necessary symbols. */
446 # if YYSTACK_USE_ALLOCA
447 # define YYSTACK_ALLOC alloca
448 # define YYSIZE_T YYSTD (size_t)
450 # ifndef YYSTACK_USE_ALLOCA
451 # if defined (alloca) || defined (_ALLOCA_H)
452 # define YYSTACK_ALLOC alloca
453 # define YYSIZE_T YYSTD (size_t)
456 # define YYSTACK_ALLOC __builtin_alloca
462 # ifdef YYSTACK_ALLOC
463 /* Pacify GCC's `empty if-body' warning. */
464 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
467 # include <cstdlib> /* INFRINGES ON USER NAME SPACE */
468 # define YYSIZE_T std::size_t
471 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
472 # define YYSIZE_T size_t
475 # define YYSTACK_ALLOC YYSTD (malloc)
476 # define YYSTACK_FREE YYSTD (free)
479 /* A type that is properly aligned for any stack member. */
489 /* The size of the maximum gap between one aligned stack and the next. */
490 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
492 /* The size of an array large to enough to hold all stacks, each with
495 # define YYSTACK_BYTES(N) \
496 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
497 + 2 * YYSTACK_GAP_MAX)
499 # define YYSTACK_BYTES(N) \
500 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
504 /* Relocate the TYPE STACK from its old location to the new one. The
505 local variables YYSIZE and YYSTACKSIZE give the old and new number of
506 elements in the stack, and YYPTR gives the new location of the
507 stack. Advance YYPTR to a properly aligned location for the next
509 # define YYSTACK_RELOCATE(Type, Stack) \
512 YYSIZE_T yynewbytes; \
513 yymemcpy ((char *) yyptr, (char *) (Stack), \
514 yysize * (YYSIZE_T) sizeof (Type)); \
515 Stack = &yyptr->Stack; \
516 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
517 yyptr += yynewbytes / sizeof (*yyptr); \
521 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
524 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
525 # define YYSIZE_T __SIZE_TYPE__
527 #if ! defined (YYSIZE_T) && defined (size_t)
528 # define YYSIZE_T size_t
530 #if ! defined (YYSIZE_T)
532 # include <cstddef> /* INFRINGES ON USER NAME SPACE */
533 # define YYSIZE_T std::size_t
536 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
537 # define YYSIZE_T size_t
541 #if ! defined (YYSIZE_T)
542 # define YYSIZE_T unsigned int
545 #define yyerrok (yyerrstatus = 0)
546 #define yyclearin (yychar = YYEMPTY)
549 #define YYACCEPT goto yyacceptlab
550 #define YYABORT goto yyabortlab
551 #define YYERROR goto yyerrlab1
552 /* Like YYERROR except do call yyerror. This remains here temporarily
553 to ease the transition to the new meaning of YYERROR, for GCC.
554 Once GCC version 2 has supplanted version 1, this can go. */
555 #define YYFAIL goto yyerrlab
556 #define YYRECOVERING() (!!yyerrstatus)
557 #define YYBACKUP(Token, Value) \
559 if (yychar == YYEMPTY && yylen == 1) \
563 yychar1 = YYTRANSLATE (yychar); \
569 yyerror ("syntax error: cannot back up"); \
575 #define YYERRCODE 256
578 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
581 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
582 first token. By default, to implement support for ranges, extend
583 its range to the last symbol. */
585 #ifndef YYLLOC_DEFAULT
586 # define YYLLOC_DEFAULT(Current, Rhs, N) \
587 Current.last_line = Rhs[N].last_line; \
588 Current.last_column = Rhs[N].last_column;
592 /* YYLEX -- calling `yylex' with the right arguments. */
597 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
599 # define YYLEX yylex (&yylval, &yylloc)
601 # else /* !YYLSP_NEEDED */
603 # define YYLEX yylex (&yylval, YYLEX_PARAM)
605 # define YYLEX yylex (&yylval)
607 # endif /* !YYLSP_NEEDED */
609 # define YYLEX yylex ()
613 /* Enable debugging if requested. */
618 # include <cstdio> /* INFRINGES ON USER NAME SPACE */
620 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
622 # define YYFPRINTF YYSTD (fprintf)
625 # define YYDPRINTF(Args) \
630 /* Nonzero means print parse trace. [The following comment makes no
631 sense to me. Could someone clarify it? --akim] Since this is
632 uninitialized, it does not stop multiple parsers from coexisting.
636 # define YYDPRINTF(Args)
637 #endif /* !YYDEBUG */
639 /* YYINITDEPTH -- initial size of the parser's stacks. */
641 # define YYINITDEPTH 200
644 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
645 if the built-in stack extension method is used).
647 Do not make this value too large; the results are undefined if
648 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
649 evaluated with infinite-precision integer arithmetic. */
656 # define YYMAXDEPTH 10000
659 #if ! defined (yyoverflow) && ! defined (yymemcpy)
660 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
661 # define yymemcpy __builtin_memcpy
662 # else /* not GNU C or C++ */
664 /* This is the most reliable way to avoid incompatibilities
665 in available built-in functions on various systems. */
667 # if defined (__STDC__) || defined (__cplusplus)
668 yymemcpy (char *yyto
, const char *yyfrom
, YYSIZE_T yycount
)
670 yymemcpy (yyto
, yyfrom
, yycount
)
676 register const char *yyf
= yyfrom
;
677 register char *yyt
= yyto
;
678 register YYSIZE_T yyi
= yycount
;
686 #ifdef YYERROR_VERBOSE
689 # if defined (__GLIBC__) && defined (_STRING_H)
690 # define yystrlen strlen
692 /* Return the length of YYSTR. */
694 # if defined (__STDC__) || defined (__cplusplus)
695 yystrlen (const char *yystr
)
701 register const char *yys
= yystr
;
703 while (*yys
++ != '\0')
706 return yys
- yystr
- 1;
712 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
713 # define yystpcpy stpcpy
715 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
718 # if defined (__STDC__) || defined (__cplusplus)
719 yystpcpy (char *yydest
, const char *yysrc
)
721 yystpcpy (yydest
, yysrc
)
726 register char *yyd
= yydest
;
727 register const char *yys
= yysrc
;
729 while ((*yyd
++ = *yys
++) != '\0')
738 #line 341 "/usr/share/bison/bison.simple"
741 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
742 into yyparse. The argument should have type void *.
743 It should actually point to an object.
744 Grammar actions can access the variable by casting it
745 to the proper pointer type. */
749 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
750 # define YYPARSE_PARAM_DECL
751 # else /* !__cplusplus */
752 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
753 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
754 # endif /* !__cplusplus */
755 #else /* !YYPARSE_PARAM */
756 # define YYPARSE_PARAM_ARG
757 # define YYPARSE_PARAM_DECL
758 #endif /* !YYPARSE_PARAM */
760 /* Prevent warning if -Wstrict-prototypes. */
762 # ifdef YYPARSE_PARAM
763 int yyparse (void *);
769 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
770 variables are global, or local to YYPARSE. */
772 #define YY_DECL_NON_LSP_VARIABLES \
773 /* The lookahead symbol. */ \
776 /* The semantic value of the lookahead symbol. */ \
779 /* Number of parse errors so far. */ \
783 # define YY_DECL_VARIABLES \
784 YY_DECL_NON_LSP_VARIABLES \
786 /* Location data for the lookahead symbol. */ \
789 # define YY_DECL_VARIABLES \
790 YY_DECL_NON_LSP_VARIABLES
794 /* If nonreentrant, generate the variables here. */
801 yyparse (YYPARSE_PARAM_ARG
)
804 /* If reentrant, generate the variables here. */
809 register int yystate
;
812 /* Number of tokens to shift before error messages enabled. */
814 /* Lookahead token as an internal (translated) token number. */
817 /* Three stacks and their tools:
818 `yyss': related to states,
819 `yyvs': related to semantic values,
820 `yyls': related to locations.
822 Refer to the stacks thru separate pointers, to allow yyoverflow
823 to reallocate them elsewhere. */
825 /* The state stack. */
826 short yyssa
[YYINITDEPTH
];
828 register short *yyssp
;
830 /* The semantic value stack. */
831 YYSTYPE yyvsa
[YYINITDEPTH
];
832 YYSTYPE
*yyvs
= yyvsa
;
833 register YYSTYPE
*yyvsp
;
836 /* The location stack. */
837 YYLTYPE yylsa
[YYINITDEPTH
];
838 YYLTYPE
*yyls
= yylsa
;
843 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
845 # define YYPOPSTACK (yyvsp--, yyssp--)
848 YYSIZE_T yystacksize
= YYINITDEPTH
;
851 /* The variables used to return semantic value and location from the
858 /* When reducing, the number of symbols on the RHS of the reduced
862 YYDPRINTF ((stderr
, "Starting parse\n"));
867 yychar
= YYEMPTY
; /* Cause a token to be read. */
869 /* Initialize stack pointers.
870 Waste one element of value and location stack
871 so that they stay on the same level as the state stack.
872 The wasted elements are never initialized. */
881 /*------------------------------------------------------------.
882 | yynewstate -- Push a new state, which is found in yystate. |
883 `------------------------------------------------------------*/
885 /* In all cases, when you get here, the value and location stacks
886 have just been pushed. so pushing a state here evens the stacks.
893 if (yyssp
>= yyss
+ yystacksize
- 1)
895 /* Get the current used size of the three stacks, in elements. */
896 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
900 /* Give user a chance to reallocate the stack. Use copies of
901 these so that the &'s don't force the real ones into
903 YYSTYPE
*yyvs1
= yyvs
;
906 /* Each stack pointer address is followed by the size of the
907 data in use in that stack, in bytes. */
909 YYLTYPE
*yyls1
= yyls
;
910 /* This used to be a conditional around just the two extra args,
911 but that might be undefined if yyoverflow is a macro. */
912 yyoverflow ("parser stack overflow",
913 &yyss1
, yysize
* sizeof (*yyssp
),
914 &yyvs1
, yysize
* sizeof (*yyvsp
),
915 &yyls1
, yysize
* sizeof (*yylsp
),
919 yyoverflow ("parser stack overflow",
920 &yyss1
, yysize
* sizeof (*yyssp
),
921 &yyvs1
, yysize
* sizeof (*yyvsp
),
927 #else /* no yyoverflow */
928 /* Extend the stack our own way. */
929 if (yystacksize
>= YYMAXDEPTH
)
932 if (yystacksize
> YYMAXDEPTH
)
933 yystacksize
= YYMAXDEPTH
;
937 union yyalloc
*yyptr
=
938 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
941 YYSTACK_RELOCATE (short, yyss
);
942 YYSTACK_RELOCATE (YYSTYPE
, yyvs
);
944 YYSTACK_RELOCATE (YYLTYPE
, yyls
);
946 # undef YYSTACK_RELOCATE
948 YYSTACK_FREE (yyss1
);
950 #endif /* no yyoverflow */
952 yyssp
= yyss
+ yysize
- 1;
953 yyvsp
= yyvs
+ yysize
- 1;
955 yylsp
= yyls
+ yysize
- 1;
958 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
959 (unsigned long int) yystacksize
));
961 if (yyssp
>= yyss
+ yystacksize
- 1)
965 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
975 /* Do appropriate processing given the current state. */
976 /* Read a lookahead token if we need one and don't already have one. */
979 /* First try to decide what to do without reference to lookahead token. */
981 yyn
= yypact
[yystate
];
985 /* Not known => get a lookahead token if don't already have one. */
987 /* yychar is either YYEMPTY or YYEOF
988 or a valid token in external form. */
990 if (yychar
== YYEMPTY
)
992 YYDPRINTF ((stderr
, "Reading a token: "));
996 /* Convert token to internal form (in yychar1) for indexing tables with */
998 if (yychar
<= 0) /* This means end of input. */
1001 yychar
= YYEOF
; /* Don't call YYLEX any more */
1003 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1007 yychar1
= YYTRANSLATE (yychar
);
1010 /* We have to keep this `#if YYDEBUG', since we use variables
1011 which are defined only if `YYDEBUG' is set. */
1014 YYFPRINTF (stderr
, "Next token is %d (%s",
1015 yychar
, yytname
[yychar1
]);
1016 /* Give the individual parser a way to print the precise
1017 meaning of a token, for further debugging info. */
1019 YYPRINT (stderr
, yychar
, yylval
);
1021 YYFPRINTF (stderr
, ")\n");
1027 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
1032 /* yyn is what to do for this token type in this state.
1033 Negative => reduce, -yyn is rule number.
1034 Positive => shift, yyn is new state.
1035 New state is final state => don't bother to shift,
1036 just return success.
1037 0, or most negative number => error. */
1052 /* Shift the lookahead token. */
1053 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
1054 yychar
, yytname
[yychar1
]));
1056 /* Discard the token being shifted unless it is eof. */
1057 if (yychar
!= YYEOF
)
1065 /* Count tokens shifted since error; after three, turn off error
1074 /*-----------------------------------------------------------.
1075 | yydefault -- do the default action for the current state. |
1076 `-----------------------------------------------------------*/
1078 yyn
= yydefact
[yystate
];
1084 /*-----------------------------.
1085 | yyreduce -- Do a reduction. |
1086 `-----------------------------*/
1088 /* yyn is the number of a rule to reduce with. */
1091 /* If YYLEN is nonzero, implement the default value of the action:
1094 Otherwise, the following line sets YYVAL to the semantic value of
1095 the lookahead token. This behavior is undocumented and Bison
1096 users should not rely upon it. Assigning to YYVAL
1097 unconditionally makes the parser a bit smaller, and it avoids a
1098 GCC warning that YYVAL may be used uninitialized. */
1099 yyval
= yyvsp
[1-yylen
];
1102 /* Similarly for the default location. Let the user run additional
1103 commands if for instance locations are ranges. */
1104 yyloc
= yylsp
[1-yylen
];
1105 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1109 /* We have to keep this `#if YYDEBUG', since we use variables which
1110 are defined only if `YYDEBUG' is set. */
1115 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1118 /* Print the symbols being reduced, and their result. */
1119 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] > 0; yyi
++)
1120 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1121 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1129 { parse_return
=yyvsp
[0]; }
1135 parse_error
=PARSE_ERR
;
1146 (yyvsp
[-3])->n_x
.v_subs
[0]=yyvsp
[-1];
1147 (yyvsp
[-3])->n_x
.v_subs
[1]=(struct node
*)0;
1153 (yyvsp
[-5])->n_x
.v_subs
[0]=yyvsp
[-3];
1154 (yyvsp
[-5])->n_x
.v_subs
[1]=yyvsp
[-1];
1160 (yyvsp
[-7])->n_x
.v_subs
[0]=make_list(yyvsp
[-5],yyvsp
[-3]);
1161 (yyvsp
[-7])->n_x
.v_subs
[1]=yyvsp
[-1];
1167 (yyvsp
[-9])->n_x
.v_subs
[0]=make_list(yyvsp
[-7],yyvsp
[-5]);
1168 (yyvsp
[-9])->n_x
.v_subs
[1]=make_list(yyvsp
[-3],yyvsp
[-1]);
1174 (yyvsp
[-3])->n_x
.v_subs
[0]=(struct node
*)0;
1175 (yyvsp
[-3])->n_x
.v_subs
[1]=yyvsp
[-1];
1181 yyvsp
[-3]->n_x
.v_subs
[0]=yyvsp
[-1];
1187 yyvsp
[-3]->n_x
.v_subs
[0]=yyvsp
[-1];
1193 yyvsp
[-5]->n_x
.v_subs
[0]=yyvsp
[-3];
1194 yyvsp
[-5]->n_x
.v_subs
[1]=yyvsp
[-1];
1200 yyvsp
[-5]->n_x
.v_subs
[0]=yyvsp
[-3];
1201 yyvsp
[-5]->n_x
.v_subs
[1]=yyvsp
[-1];
1207 if(yyvsp
[-7]->comp_value
!=F_INDEX
)
1208 parse_error
=PARSE_ERR
;
1209 yyvsp
[-7]->comp_value
=F_INDEX2
;
1210 yyvsp
[-7]->n_x
.v_subs
[0]=make_list(yyvsp
[-5],yyvsp
[-3]);
1211 yyvsp
[-7]->n_x
.v_subs
[1]=yyvsp
[-1];
1217 if(yyvsp
[-7]->comp_value
!=F_INDEX
)
1218 parse_error
=PARSE_ERR
;
1219 yyvsp
[-7]->comp_value
=F_INDEX2
;
1220 yyvsp
[-7]->n_x
.v_subs
[0]=make_list(yyvsp
[-5],yyvsp
[-3]);
1221 yyvsp
[-7]->n_x
.v_subs
[1]=yyvsp
[-1];
1227 (yyvsp
[-7])->n_x
.v_subs
[0]=make_list(yyvsp
[-5],yyvsp
[-3]);
1228 (yyvsp
[-7])->n_x
.v_subs
[1]=yyvsp
[-1];
1234 (yyvsp
[-7])->n_x
.v_subs
[0]=make_list(yyvsp
[-5],yyvsp
[-3]);
1235 (yyvsp
[-7])->n_x
.v_subs
[1]=yyvsp
[-1];
1241 (yyvsp
[-3])->n_x
.v_subs
[0]=(struct node
*)0;
1242 (yyvsp
[-3])->n_x
.v_subs
[1]=yyvsp
[-1];
1248 yyvsp
[-3]->comp_value
=IF
;
1249 yyvsp
[-3]->n_x
.v_subs
[0]=yyvsp
[-1];
1250 yyvsp
[-3]->n_x
.v_subs
[1]=yyvsp
[0];
1251 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-4];
1252 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[-2];
1258 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1259 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1260 yyval
= yyvsp
[-1]; }
1265 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1266 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1267 yyval
= yyvsp
[-1]; }
1272 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1273 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1274 yyval
= yyvsp
[-1]; }
1279 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1280 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1281 yyval
= yyvsp
[-1]; }
1286 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1287 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1288 yyval
= yyvsp
[-1]; }
1293 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1294 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1295 yyval
= yyvsp
[-1]; }
1300 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1301 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1302 yyval
= yyvsp
[-1]; }
1307 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1308 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1309 yyval
= yyvsp
[-1]; }
1314 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1315 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1316 yyval
= yyvsp
[-1]; }
1321 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1322 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1323 yyval
= yyvsp
[-1]; }
1328 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1329 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1330 yyval
= yyvsp
[-1]; }
1335 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1336 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1337 yyval
= yyvsp
[-1]; }
1342 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[-2];
1343 yyvsp
[-1]->n_x
.v_subs
[1]=yyvsp
[0];
1344 yyval
= yyvsp
[-1]; }
1349 if(yyvsp
[0]->comp_value
==CONST_FLT
) {
1350 yyvsp
[0]->n_x
.v_float
= -(yyvsp
[0]->n_x
.v_float
);
1353 } else if(yyvsp
[0]->comp_value
==CONST_INT
) {
1354 yyvsp
[0]->n_x
.v_int
= -(yyvsp
[0]->n_x
.v_int
);
1358 yyvsp
[-1]->comp_value
= NEGATE
;
1359 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[0];
1360 yyvsp
[-1]->n_x
.v_subs
[1]=(struct node
*)0;
1367 yyvsp
[-1]->n_x
.v_subs
[0]=yyvsp
[0];
1368 yyvsp
[-1]->n_x
.v_subs
[1]=(struct node
*)0;
1369 yyval
= yyvsp
[-1]; }
1373 { yyval
= yyvsp
[-1]; }
1379 parse_error
=NO_CLOSE
;
1386 parse_error
=NO_CLOSE
;
1391 { yyval
= make_list(yyvsp
[0], 0); }
1395 { yyval
= make_list(yyvsp
[0], yyvsp
[-2]); }
1399 { yyval
=make_list(yyvsp
[0], 0); }
1403 { yyval
=make_list(yyvsp
[0],yyvsp
[-2]); }
1411 #line 727 "/usr/share/bison/bison.simple"
1423 short *yyssp1
= yyss
- 1;
1424 YYFPRINTF (stderr
, "state stack now");
1425 while (yyssp1
!= yyssp
)
1426 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1427 YYFPRINTF (stderr
, "\n");
1436 /* Now `shift' the result of the reduction. Determine what state
1437 that goes to, based on the state we popped back to and the rule
1438 number reduced by. */
1442 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1443 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1444 yystate
= yytable
[yystate
];
1446 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1451 /*------------------------------------.
1452 | yyerrlab -- here on detecting error |
1453 `------------------------------------*/
1455 /* If not already recovering from an error, report this error. */
1460 #ifdef YYERROR_VERBOSE
1461 yyn
= yypact
[yystate
];
1463 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1465 YYSIZE_T yysize
= 0;
1470 /* Start YYX at -YYN if negative to avoid negative indexes in
1472 for (yyx
= yyn
< 0 ? -yyn
: 0;
1473 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1474 if (yycheck
[yyx
+ yyn
] == yyx
)
1475 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1476 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1477 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1478 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1481 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1482 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1487 for (yyx
= yyn
< 0 ? -yyn
: 0;
1488 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1490 if (yycheck
[yyx
+ yyn
] == yyx
)
1492 const char *yyq
= ! yycount
? ", expecting " : " or ";
1493 yyp
= yystpcpy (yyp
, yyq
);
1494 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1499 YYSTACK_FREE (yymsg
);
1502 yyerror ("parse error; also virtual memory exhausted");
1505 #endif /* defined (YYERROR_VERBOSE) */
1506 yyerror ("parse error");
1511 /*--------------------------------------------------.
1512 | yyerrlab1 -- error raised explicitly by an action |
1513 `--------------------------------------------------*/
1515 if (yyerrstatus
== 3)
1517 /* If just tried and failed to reuse lookahead token after an
1518 error, discard it. */
1520 /* return failure if at end of input */
1521 if (yychar
== YYEOF
)
1523 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1524 yychar
, yytname
[yychar1
]));
1528 /* Else will try to reuse lookahead token after shifting the error
1531 yyerrstatus
= 3; /* Each real token shifted decrements this */
1536 /*-------------------------------------------------------------------.
1537 | yyerrdefault -- current state does not do anything special for the |
1539 `-------------------------------------------------------------------*/
1542 /* This is wrong; only states that explicitly want error tokens
1543 should shift them. */
1545 /* If its default is to accept any token, ok. Otherwise pop it. */
1546 yyn
= yydefact
[yystate
];
1552 /*---------------------------------------------------------------.
1553 | yyerrpop -- pop the current state because it cannot handle the |
1555 `---------------------------------------------------------------*/
1568 short *yyssp1
= yyss
- 1;
1569 YYFPRINTF (stderr
, "Error: state stack now");
1570 while (yyssp1
!= yyssp
)
1571 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1572 YYFPRINTF (stderr
, "\n");
1580 yyn
= yypact
[yystate
];
1585 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1602 YYDPRINTF ((stderr
, "Shifting error token, "));
1613 /*-------------------------------------.
1614 | yyacceptlab -- YYACCEPT comes here. |
1615 `-------------------------------------*/
1620 /*-----------------------------------.
1621 | yyabortlab -- YYABORT comes here. |
1622 `-----------------------------------*/
1627 /*---------------------------------------------.
1628 | yyoverflowab -- parser overflow comes here. |
1629 `---------------------------------------------*/
1631 yyerror ("parser stack overflow");
1638 YYSTACK_FREE (yyss
);
1646 yyerror
FUN1(char *, s
)
1649 parse_error
=PARSE_ERR
;
1653 make_list
FUN2(YYSTYPE
, car
, YYSTYPE
, cdr
)
1657 ret
=(YYSTYPE
)obstack_alloc(&tmp_mem
,sizeof(*ret
));
1658 ret
->comp_value
= 0;
1659 ret
->n_x
.v_subs
[0]=car
;
1660 ret
->n_x
.v_subs
[1]=cdr
;
1666 extern struct node
*yylval
;
1669 unsigned char parse_cell_or_range (char **,struct rng
*);
1671 unsigned char parse_cell_or_range ();
1682 unsigned char byte_value
;
1685 /* unsigned char *ptr; */
1687 struct function
*fp
;
1694 while(isspace(*instr
))
1697 if(ch
=='(' || ch
==',' || ch
==')')
1700 new=(struct node
*)obstack_alloc(&tmp_mem
,sizeof(struct node
));
1707 case '0': case '1': case '2': case '3': case '4': case '5': case '6':
1708 case '7': case '8': case '9': case '.':
1714 while(isdigit(*tmp_str
) || (!isflt
&& *tmp_str
=='.' && ++isflt
))
1716 if(*tmp_str
=='e' || *tmp_str
=='E') {
1719 if(*tmp_str
=='-' || *tmp_str
=='+')
1721 while(isdigit(*tmp_str
))
1725 new->n_x
.v_float
=astof((char **)(&begin
));
1726 byte_value
=CONST_FLT
;
1728 new->n_x
.v_int
=astol((char **)(&begin
));
1729 if(begin
!=tmp_str
) {
1731 new->n_x
.v_float
=astof((char **)(&begin
));
1732 byte_value
=CONST_FLT
;
1734 byte_value
=CONST_INT
;
1742 while(*instr
&& *instr
!='"') {
1743 if(*instr
=='\\' && instr
[1])
1748 parse_error
=NO_QUOTE
;
1751 tmp_str
=new->n_x
.v_string
=(char *)ck_malloc(1+instr
-begin
);
1752 while(begin
!=instr
) {
1757 if(begin
[0]>='0' && begin
[0]<='7') {
1758 if(begin
[1]>='0' && begin
[1]<='7') {
1759 if(begin
[2]>='0' && begin
[2]<='7') {
1760 n
=(begin
[2]-'0') + (010 * (begin
[1]-'0')) + ( 0100 * (begin
[0]-'0'));
1763 n
=(begin
[1]-'0') + (010 * (begin
[0]-'0'));
1774 *tmp_str
++= *begin
++;
1778 byte_value
=CONST_STR
;
1784 case '*': case '/': case '%': case '&':
1785 /* case '|': */ case '^': case '=':
1791 for(ptr
= fnin
;*ptr
;ptr
++)
1792 if(the_funs
[*ptr
].fn_str
[0]==ch
)
1796 panic("Can't find fnin[] entry for '%c'",ch
);
1810 byte_value
= (ch
=='<') ? LESS
: (ch
=='>') ? GREATER
: NOT
;
1814 byte_value
= (ch
=='<') ? LESSEQ
: (ch
=='>') ? GREATEQ
: NOTEQUAL
;
1815 ch
= (ch
=='<') ? LE
: (ch
=='>') ? GE
: NE
;
1828 parse_error
=BAD_CHAR
;
1833 while(*instr
&& (isalnum(*instr
) || *instr
=='_'))
1837 if(!stricmp(begin
,tname
))
1839 else if(!stricmp(begin
,fname
))
1841 else if(!stricmp(begin
,iname
) && (begin
[4]==0 || !stricmp(begin
+4,"inity")))
1842 byte_value
=CONST_INF
;
1843 else if(!stricmp(begin
,mname
) ||
1844 !stricmp(begin
,"#ninf"))
1845 byte_value
=CONST_NINF
;
1846 else if(!stricmp(begin
,nname
) ||
1847 !stricmp(begin
,"#nan"))
1848 byte_value
=CONST_NAN
;
1850 for(n
=1;n
<=ERR_MAX
;n
++)
1851 if(!stricmp(begin
,ename
[n
]))
1856 byte_value
=CONST_ERR
;
1863 if(!a0
&& (ch
=='@' || ch
=='$'))
1868 while(*instr
&& (isalpha(*instr
) || isdigit(*instr
) || *instr
=='_'))
1873 byte_value
=parse_cell_or_range(&begin
,&(new->n_x
.v_rng
));
1875 if((byte_value
& ~0x3)==R_CELL
)
1883 while(*instr
&& (isalpha(*instr
) || isdigit(*instr
) || *instr
=='_'))
1887 while(isspace(*instr
))
1893 new->n_x
.v_var
=find_or_make_var(begin
,n
);
1899 fp
=hash_find(parse_hash
,begin
);
1903 parse_error
=BAD_FUNC
;
1907 if(fp
>=the_funs
&& fp
<=&the_funs
[USR1
])
1908 byte_value
=fp
-the_funs
;
1910 for(nn
=0;nn
<n_usr_funs
;nn
++) {
1911 if(fp
>=&usr_funs
[nn
][0] && fp
<=&usr_funs
[nn
][usr_n_funs
[nn
]]) {
1913 new->sub_value
=fp
-&usr_funs
[nn
][0];
1918 if(nn
==n_usr_funs
) {
1919 io_error_msg("Couln't turn fp into a ##");
1920 parse_error
=BAD_FUNC
;
1927 ch
= byte_value
==F_IF
? L_FN3
: L_FN2
;
1928 else if(fp
->fn_argt
[0]=='R' || fp
->fn_argt
[0]=='E')
1929 ch
=L_FN1R
-1+fp
->fn_argn
-X_A0
;
1931 ch
=L_FN0
+ fp
->fn_argn
-X_A0
;
1935 /* new->node_type=ch; */
1936 new->comp_value
=byte_value
;
1942 0 if it doesn't look like a cell or a range,
1943 R_CELL if it is a cell (ptr now points past the characters, lr and lc hold the row and col of the cell)
1944 RANGE if it is a range (ptr points past the chars)
1947 parse_cell_or_range
FUN2(char **,ptr
, struct rng
*,retp
)
1952 int abz
= ROWREL
|COLREL
;
1962 tmpc
=str_to_col(&p
);
1963 if(tmpc
<MIN_COL
|| tmpc
>MAX_COL
)
1971 for(tmpr
=0;isdigit(*p
);p
++)
1972 tmpr
=tmpr
*10 + *p
- '0';
1974 if(tmpr
<MIN_ROW
|| tmpr
>MAX_ROW
)
1977 if(*p
==':' || *p
=='.') {
1978 unsigned tmpc1
,tmpr1
;
1980 abz
= ((abz
&COLREL
) ? LCREL
: 0)|((abz
&ROWREL
) ? LRREL
: 0)|HRREL
|HCREL
;
1988 tmpc1
=str_to_col(&p
);
1989 if(tmpc1
<MIN_COL
|| tmpc1
>MAX_COL
)
1997 for(tmpr1
=0;isdigit(*p
);p
++)
1998 tmpr1
=tmpr1
*10 + *p
- '0';
1999 if(tmpr1
<MIN_ROW
|| tmpr1
>MAX_ROW
)
2019 retp
->lr
= retp
->hr
= tmpr
;
2020 retp
->lc
= retp
->hc
= tmpc
;
2022 return R_CELL
| abz
;
2031 #define CK_ABS_R(x) if((x)<MIN_ROW || (x)>MAX_ROW) \
2035 #define CK_REL_R(x) if( ((x)>0 && MAX_ROW-(x)<cur_row) \
2036 || ((x)<0 && MIN_ROW-(x)>cur_row)) \
2040 #define CK_ABS_C(x) if((x)<MIN_COL || (x)>MAX_COL) \
2044 #define CK_REL_C(x) if( ((x)>0 && MAX_COL-(x)<cur_col) \
2045 || ((x)<0 && MIN_COL-(x)>cur_col)) \
2049 #define MAYBEREL(p) (*(p)=='[' && (isdigit((p)[1]) || (((p)[1]=='+' || (p)[1]=='-') && isdigit((p)[2]))))
2068 retp
->lr
= retp
->hr
=num
;
2069 } else if(MAYBEREL(p
)) {
2073 retp
->lr
= retp
->hr
=num
+cur_row
;
2076 retr
=RANGE
|LRREL
|HRREL
;
2080 retp
->hr
=num
+cur_row
;
2084 } else if(retc
|| *p
=='c' || *p
=='C') {
2086 retp
->lr
= retp
->hr
=cur_row
;
2089 if(*p
==':' && retr
!=(RANGE
|LRREL
|HRREL
)) {
2090 retr
= (retr
&ROWREL
) ? RANGE
|LRREL
: RANGE
;
2096 } else if(MAYBEREL(p
)) {
2100 retp
->hr
=num
+cur_row
;
2123 retp
->lc
= retp
->hc
=num
;
2124 } else if(MAYBEREL(p
)) {
2128 retp
->lc
= retp
->hc
=num
+cur_col
;
2131 retc
=RANGE
|LCREL
|HCREL
;
2135 retp
->hc
=num
+cur_col
;
2139 } else if(retr
|| *p
=='r' || *p
=='R') {
2141 retp
->lc
= retp
->hc
=cur_col
;
2144 if(*p
==':' && retc
!=(RANGE
|LCREL
|HCREL
)) {
2145 retc
= (retc
&COLREL
) ? RANGE
|LCREL
: RANGE
;
2151 } else if(MAYBEREL(p
)) {
2155 retp
->hc
=num
+cur_col
;
2171 if((retr
|ROWREL
)==(R_CELL
|ROWREL
))
2172 return (retr
&ROWREL
) ? (RANGE
|LRREL
|HRREL
) : RANGE
;
2179 if((retc
|COLREL
)==(R_CELL
|COLREL
))
2180 return (retc
&COLREL
) ? (RANGE
|LCREL
|HCREL
) : RANGE
;
2190 if(retp
->lr
>retp
->hr
)
2191 tmp
=retp
->lr
,retp
->lr
=retp
->hr
,retp
->hr
=tmp
;
2192 if(retp
->lc
>retp
->hc
)
2193 tmp
=retp
->lc
,retp
->lc
=retp
->hc
,retp
->hc
=tmp
;
2195 if((retr
|ROWREL
)==(R_CELL
|ROWREL
)) {
2196 if((retc
|COLREL
)==(R_CELL
|COLREL
))
2198 return (retr
&ROWREL
) ? (retc
|LRREL
|HRREL
) : retc
;
2200 if((retc
|COLREL
)==(R_CELL
|COLREL
))
2201 return (retc
&COLREL
) ? (retr
|LCREL
|HCREL
) : retr
;
2207 str_to_col
FUN1(char **,str
)
2217 if(!isalpha((cc
=str
[0][1]))) {
2219 return MIN_COL
+ (isupper(c
) ? c
-'A' : c
-'a');
2221 if(!isalpha((ccc
=str
[0][2]))) {
2223 return MIN_COL
+26 + (isupper(c
) ? c
-'A' : c
-'a')*26 + (isupper(cc
) ? cc
-'A' : cc
-'a');
2226 if(!isalpha((cccc
=str
[0][3]))) {
2228 return MIN_COL
+702 + (isupper(c
) ? c
-'A' : c
-'a')*26*26 + (isupper(cc
) ? cc
-'A' : cc
-'a')*26 + (isupper(ccc
) ? ccc
-'A' : ccc
-'a');
2230 if(!isalpha(str
[0][4])) {
2232 return MIN_COL
+18278 + (isupper(c
) ? c
-'A' : c
-'a')*26*26*26 + (isupper(cc
) ? cc
-'A' : cc
-'a')*26*26 + (isupper(ccc
) ? ccc
-'A' : ccc
-'a')*26 + (isupper(cccc
) ? cccc
-'A' : cccc
-'a');