]>
Commit | Line | Data |
---|---|---|
10fa2066 RS |
1 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
2 | #line 3 "bison.simple" | |
7d369561 | 3 | /* This file comes from bison-@bison_version@. */ |
10fa2066 RS |
4 | |
5 | /* Skeleton output parser for bison, | |
21b14802 | 6 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
10fa2066 RS |
7 | |
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
21b14802 | 10 | the Free Software Foundation; either version 2, or (at your option) |
10fa2066 RS |
11 | any later version. |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
c49a8e71 JT |
20 | Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. */ | |
10fa2066 | 22 | |
c71f8bba RS |
23 | /* As a special exception, when this file is copied by Bison into a |
24 | Bison output file, you may use that output file without restriction. | |
25 | This special exception was added by the Free Software Foundation | |
cfeaeb52 | 26 | in version 1.24 of Bison. */ |
10fa2066 | 27 | |
444fbf65 RS |
28 | /* This is the parser code that is written into each bison parser |
29 | when the %semantic_parser declaration is not specified in the grammar. | |
30 | It was written by Richard Stallman by simplifying the hairy parser | |
31 | used when %semantic_parser is specified. */ | |
32 | ||
70ddf897 | 33 | #ifndef YYSTACK_USE_ALLOCA |
361f60b3 AD |
34 | # ifdef alloca |
35 | # define YYSTACK_USE_ALLOCA | |
36 | # else /* alloca not defined */ | |
37 | # ifdef __GNUC__ | |
38 | # define YYSTACK_USE_ALLOCA | |
39 | # define alloca __builtin_alloca | |
40 | # else /* not GNU C. */ | |
41 | # if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) | |
42 | # define YYSTACK_USE_ALLOCA | |
43 | # include <alloca.h> | |
44 | # else /* not sparc */ | |
45 | /* We think this test detects Watcom and Microsoft C. */ | |
46 | /* This used to test MSDOS, but that is a bad idea since that | |
47 | symbol is in the user namespace. */ | |
48 | # if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | |
49 | # if 0 | |
50 | /* No need for malloc.h, which pollutes the namespace; instead, | |
51 | just don't use alloca. */ | |
52 | # include <malloc.h> | |
53 | # endif | |
54 | # else /* not MSDOS, or __TURBOC__ */ | |
55 | # if defined(_AIX) | |
56 | /* I don't know what this was needed for, but it pollutes the | |
57 | namespace. So I turned it off. rms, 2 May 1997. */ | |
58 | /* #include <malloc.h> */ | |
10fa2066 | 59 | #pragma alloca |
361f60b3 AD |
60 | # define YYSTACK_USE_ALLOCA |
61 | # else /* not MSDOS, or __TURBOC__, or _AIX */ | |
62 | # if 0 | |
63 | /* haible@ilog.fr says this works for HPUX 9.05 and up, and on | |
64 | HPUX 10. Eventually we can turn this on. */ | |
65 | # ifdef __hpux | |
66 | # define YYSTACK_USE_ALLOCA | |
67 | # define alloca __builtin_alloca | |
68 | # endif /* __hpux */ | |
69 | # endif | |
70 | # endif /* not _AIX */ | |
71 | # endif /* not MSDOS, or __TURBOC__ */ | |
72 | # endif /* not sparc */ | |
73 | # endif /* not GNU C */ | |
74 | # endif /* alloca not defined */ | |
70ddf897 RS |
75 | #endif /* YYSTACK_USE_ALLOCA not defined */ |
76 | ||
77 | #ifdef YYSTACK_USE_ALLOCA | |
361f60b3 | 78 | # define YYSTACK_ALLOC alloca |
70ddf897 | 79 | #else |
361f60b3 | 80 | # define YYSTACK_ALLOC malloc |
70ddf897 | 81 | #endif |
10fa2066 | 82 | |
10fa2066 RS |
83 | /* Note: there must be only one dollar sign in this file. |
84 | It is replaced by the list of actions, each action | |
85 | as one case of the switch. */ | |
86 | ||
87 | #define yyerrok (yyerrstatus = 0) | |
88 | #define yyclearin (yychar = YYEMPTY) | |
89 | #define YYEMPTY -2 | |
90 | #define YYEOF 0 | |
70ddf897 RS |
91 | #define YYACCEPT goto yyacceptlab |
92 | #define YYABORT goto yyabortlab | |
10fa2066 RS |
93 | #define YYERROR goto yyerrlab1 |
94 | /* Like YYERROR except do call yyerror. | |
95 | This remains here temporarily to ease the | |
96 | transition to the new meaning of YYERROR, for GCC. | |
97 | Once GCC version 2 has supplanted version 1, this can go. */ | |
98 | #define YYFAIL goto yyerrlab | |
99 | #define YYRECOVERING() (!!yyerrstatus) | |
100 | #define YYBACKUP(token, value) \ | |
101 | do \ | |
102 | if (yychar == YYEMPTY && yylen == 1) \ | |
103 | { yychar = (token), yylval = (value); \ | |
104 | yychar1 = YYTRANSLATE (yychar); \ | |
105 | YYPOPSTACK; \ | |
106 | goto yybackup; \ | |
107 | } \ | |
108 | else \ | |
109 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
110 | while (0) | |
111 | ||
112 | #define YYTERROR 1 | |
113 | #define YYERRCODE 256 | |
114 | ||
115 | #ifndef YYPURE | |
b07b484a | 116 | # define YYLEX yylex() |
10fa2066 RS |
117 | #endif |
118 | ||
119 | #ifdef YYPURE | |
b07b484a AD |
120 | # ifdef YYLSP_NEEDED |
121 | # ifdef YYLEX_PARAM | |
122 | # define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
123 | # else | |
124 | # define YYLEX yylex(&yylval, &yylloc) | |
125 | # endif | |
126 | # else /* not YYLSP_NEEDED */ | |
127 | # ifdef YYLEX_PARAM | |
128 | # define YYLEX yylex(&yylval, YYLEX_PARAM) | |
129 | # else | |
130 | # define YYLEX yylex(&yylval) | |
131 | # endif | |
132 | # endif /* not YYLSP_NEEDED */ | |
10fa2066 RS |
133 | #endif |
134 | ||
135 | /* If nonreentrant, generate the variables here */ | |
136 | ||
137 | #ifndef YYPURE | |
138 | ||
139 | int yychar; /* the lookahead symbol */ | |
140 | YYSTYPE yylval; /* the semantic value of the */ | |
141 | /* lookahead symbol */ | |
142 | ||
b07b484a | 143 | # ifdef YYLSP_NEEDED |
10fa2066 RS |
144 | YYLTYPE yylloc; /* location data for the lookahead */ |
145 | /* symbol */ | |
b07b484a | 146 | # endif |
10fa2066 RS |
147 | |
148 | int yynerrs; /* number of parse errors so far */ | |
149 | #endif /* not YYPURE */ | |
150 | ||
151 | #if YYDEBUG != 0 | |
152 | int yydebug; /* nonzero means print parse trace */ | |
153 | /* Since this is uninitialized, it does not stop multiple parsers | |
154 | from coexisting. */ | |
155 | #endif | |
156 | ||
157 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
158 | ||
159 | #ifndef YYINITDEPTH | |
b07b484a | 160 | # define YYINITDEPTH 200 |
10fa2066 RS |
161 | #endif |
162 | ||
163 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
164 | (effective only if the built-in stack extension method is used). */ | |
165 | ||
166 | #if YYMAXDEPTH == 0 | |
b07b484a | 167 | # undef YYMAXDEPTH |
10fa2066 RS |
168 | #endif |
169 | ||
170 | #ifndef YYMAXDEPTH | |
b07b484a | 171 | # define YYMAXDEPTH 10000 |
10fa2066 | 172 | #endif |
10fa2066 | 173 | \f |
5e02f2ad RS |
174 | /* Define __yy_memcpy. Note that the size argument |
175 | should be passed with type unsigned int, because that is what the non-GCC | |
176 | definitions require. With GCC, __builtin_memcpy takes an arg | |
177 | of type size_t, but it can handle unsigned int. */ | |
178 | ||
10fa2066 | 179 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
b07b484a | 180 | # define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
10fa2066 | 181 | #else /* not GNU C or C++ */ |
b07b484a | 182 | # ifndef __cplusplus |
10fa2066 RS |
183 | |
184 | /* This is the most reliable way to avoid incompatibilities | |
185 | in available built-in functions on various systems. */ | |
186 | static void | |
c245d0d3 | 187 | __yy_memcpy (to, from, count) |
10fa2066 | 188 | char *to; |
c245d0d3 | 189 | char *from; |
5e02f2ad | 190 | unsigned int count; |
10fa2066 RS |
191 | { |
192 | register char *f = from; | |
193 | register char *t = to; | |
194 | register int i = count; | |
195 | ||
196 | while (i-- > 0) | |
197 | *t++ = *f++; | |
198 | } | |
199 | ||
b07b484a | 200 | # else /* __cplusplus */ |
10fa2066 RS |
201 | |
202 | /* This is the most reliable way to avoid incompatibilities | |
203 | in available built-in functions on various systems. */ | |
204 | static void | |
5e02f2ad | 205 | __yy_memcpy (char *to, char *from, unsigned int count) |
10fa2066 | 206 | { |
10fa2066 | 207 | register char *t = to; |
4cf401b2 | 208 | register char *f = from; |
10fa2066 RS |
209 | register int i = count; |
210 | ||
211 | while (i-- > 0) | |
212 | *t++ = *f++; | |
213 | } | |
214 | ||
b07b484a | 215 | # endif |
10fa2066 RS |
216 | #endif |
217 | \f | |
ca1d9e53 | 218 | #line 217 "bison.simple" |
b658bf92 RS |
219 | |
220 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
221 | into yyparse. The argument should have type void *. | |
222 | It should actually point to an object. | |
223 | Grammar actions can access the variable by casting it | |
224 | to the proper pointer type. */ | |
225 | ||
226 | #ifdef YYPARSE_PARAM | |
b07b484a AD |
227 | # ifdef __cplusplus |
228 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
229 | # define YYPARSE_PARAM_DECL | |
230 | # else /* not __cplusplus */ | |
231 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
232 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
233 | # endif /* not __cplusplus */ | |
30f5b1cc | 234 | #else /* not YYPARSE_PARAM */ |
b07b484a AD |
235 | # define YYPARSE_PARAM_ARG |
236 | # define YYPARSE_PARAM_DECL | |
30f5b1cc | 237 | #endif /* not YYPARSE_PARAM */ |
b658bf92 | 238 | |
1b181651 PE |
239 | /* Prevent warning if -Wstrict-prototypes. */ |
240 | #ifdef __GNUC__ | |
b07b484a | 241 | # ifdef YYPARSE_PARAM |
1b181651 | 242 | int yyparse (void *); |
b07b484a | 243 | # else |
1b181651 | 244 | int yyparse (void); |
b07b484a | 245 | # endif |
1b181651 PE |
246 | #endif |
247 | ||
10fa2066 | 248 | int |
30f5b1cc | 249 | yyparse(YYPARSE_PARAM_ARG) |
b658bf92 | 250 | YYPARSE_PARAM_DECL |
10fa2066 RS |
251 | { |
252 | register int yystate; | |
253 | register int yyn; | |
254 | register short *yyssp; | |
255 | register YYSTYPE *yyvsp; | |
b07b484a AD |
256 | /* Number of tokens to shift before error messages enabled. */ |
257 | int yyerrstatus; | |
258 | /* Lookahead token as an internal (translated) token number. */ | |
259 | int yychar1 = 0; | |
10fa2066 | 260 | |
b07b484a AD |
261 | /* The state stack. */ |
262 | short yyssa[YYINITDEPTH]; | |
263 | /* The semantic value stack. */ | |
264 | YYSTYPE yyvsa[YYINITDEPTH]; | |
10fa2066 | 265 | |
b07b484a AD |
266 | /* Refer to the stacks thru separate pointers. */ |
267 | short *yyss = yyssa; | |
268 | /* To allow yyoverflow to reallocate them elsewhere. */ | |
269 | YYSTYPE *yyvs = yyvsa; | |
10fa2066 RS |
270 | |
271 | #ifdef YYLSP_NEEDED | |
b07b484a AD |
272 | /* The location stack. */ |
273 | YYLTYPE yylsa[YYINITDEPTH]; | |
10fa2066 RS |
274 | YYLTYPE *yyls = yylsa; |
275 | YYLTYPE *yylsp; | |
276 | ||
b07b484a | 277 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
10fa2066 | 278 | #else |
b07b484a | 279 | # define YYPOPSTACK (yyvsp--, yyssp--) |
10fa2066 RS |
280 | #endif |
281 | ||
282 | int yystacksize = YYINITDEPTH; | |
70ddf897 | 283 | int yyfree_stacks = 0; |
10fa2066 RS |
284 | |
285 | #ifdef YYPURE | |
286 | int yychar; | |
287 | YYSTYPE yylval; | |
288 | int yynerrs; | |
b07b484a | 289 | # ifdef YYLSP_NEEDED |
10fa2066 | 290 | YYLTYPE yylloc; |
b07b484a | 291 | # endif |
10fa2066 RS |
292 | #endif |
293 | ||
294 | YYSTYPE yyval; /* the variable used to return */ | |
295 | /* semantic values from the action */ | |
296 | /* routines */ | |
297 | ||
298 | int yylen; | |
299 | ||
300 | #if YYDEBUG != 0 | |
301 | if (yydebug) | |
302 | fprintf(stderr, "Starting parse\n"); | |
303 | #endif | |
304 | ||
305 | yystate = 0; | |
306 | yyerrstatus = 0; | |
307 | yynerrs = 0; | |
308 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
309 | ||
310 | /* Initialize stack pointers. | |
311 | Waste one element of value and location stack | |
312 | so that they stay on the same level as the state stack. | |
313 | The wasted elements are never initialized. */ | |
314 | ||
315 | yyssp = yyss - 1; | |
316 | yyvsp = yyvs; | |
317 | #ifdef YYLSP_NEEDED | |
318 | yylsp = yyls; | |
319 | #endif | |
320 | ||
321 | /* Push a new state, which is found in yystate . */ | |
322 | /* In all cases, when you get here, the value and location stacks | |
323 | have just been pushed. so pushing a state here evens the stacks. */ | |
324 | yynewstate: | |
325 | ||
326 | *++yyssp = yystate; | |
327 | ||
328 | if (yyssp >= yyss + yystacksize - 1) | |
329 | { | |
330 | /* Give user a chance to reallocate the stack */ | |
331 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
332 | YYSTYPE *yyvs1 = yyvs; | |
333 | short *yyss1 = yyss; | |
334 | #ifdef YYLSP_NEEDED | |
335 | YYLTYPE *yyls1 = yyls; | |
336 | #endif | |
337 | ||
338 | /* Get the current used size of the three stacks, in elements. */ | |
339 | int size = yyssp - yyss + 1; | |
340 | ||
341 | #ifdef yyoverflow | |
342 | /* Each stack pointer address is followed by the size of | |
343 | the data in use in that stack, in bytes. */ | |
b07b484a | 344 | # ifdef YYLSP_NEEDED |
be4bf877 RS |
345 | /* This used to be a conditional around just the two extra args, |
346 | but that might be undefined if yyoverflow is a macro. */ | |
10fa2066 RS |
347 | yyoverflow("parser stack overflow", |
348 | &yyss1, size * sizeof (*yyssp), | |
349 | &yyvs1, size * sizeof (*yyvsp), | |
10fa2066 | 350 | &yyls1, size * sizeof (*yylsp), |
10fa2066 | 351 | &yystacksize); |
b07b484a | 352 | # else |
be4bf877 RS |
353 | yyoverflow("parser stack overflow", |
354 | &yyss1, size * sizeof (*yyssp), | |
355 | &yyvs1, size * sizeof (*yyvsp), | |
356 | &yystacksize); | |
b07b484a | 357 | # endif |
10fa2066 RS |
358 | |
359 | yyss = yyss1; yyvs = yyvs1; | |
b07b484a | 360 | # ifdef YYLSP_NEEDED |
10fa2066 | 361 | yyls = yyls1; |
b07b484a | 362 | # endif |
10fa2066 RS |
363 | #else /* no yyoverflow */ |
364 | /* Extend the stack our own way. */ | |
365 | if (yystacksize >= YYMAXDEPTH) | |
366 | { | |
367 | yyerror("parser stack overflow"); | |
70ddf897 RS |
368 | if (yyfree_stacks) |
369 | { | |
370 | free (yyss); | |
371 | free (yyvs); | |
b07b484a | 372 | # ifdef YYLSP_NEEDED |
70ddf897 | 373 | free (yyls); |
b07b484a | 374 | # endif |
70ddf897 | 375 | } |
10fa2066 RS |
376 | return 2; |
377 | } | |
378 | yystacksize *= 2; | |
379 | if (yystacksize > YYMAXDEPTH) | |
380 | yystacksize = YYMAXDEPTH; | |
b07b484a | 381 | # ifndef YYSTACK_USE_ALLOCA |
70ddf897 | 382 | yyfree_stacks = 1; |
b07b484a | 383 | # endif |
70ddf897 | 384 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); |
5e02f2ad RS |
385 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
386 | size * (unsigned int) sizeof (*yyssp)); | |
70ddf897 | 387 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); |
5e02f2ad RS |
388 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
389 | size * (unsigned int) sizeof (*yyvsp)); | |
b07b484a | 390 | # ifdef YYLSP_NEEDED |
70ddf897 | 391 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
5e02f2ad RS |
392 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
393 | size * (unsigned int) sizeof (*yylsp)); | |
b07b484a | 394 | # endif |
10fa2066 RS |
395 | #endif /* no yyoverflow */ |
396 | ||
397 | yyssp = yyss + size - 1; | |
398 | yyvsp = yyvs + size - 1; | |
399 | #ifdef YYLSP_NEEDED | |
400 | yylsp = yyls + size - 1; | |
401 | #endif | |
402 | ||
403 | #if YYDEBUG != 0 | |
404 | if (yydebug) | |
405 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
406 | #endif | |
407 | ||
408 | if (yyssp >= yyss + yystacksize - 1) | |
409 | YYABORT; | |
410 | } | |
411 | ||
412 | #if YYDEBUG != 0 | |
413 | if (yydebug) | |
414 | fprintf(stderr, "Entering state %d\n", yystate); | |
415 | #endif | |
416 | ||
417 | goto yybackup; | |
418 | yybackup: | |
419 | ||
420 | /* Do appropriate processing given the current state. */ | |
421 | /* Read a lookahead token if we need one and don't already have one. */ | |
422 | /* yyresume: */ | |
423 | ||
424 | /* First try to decide what to do without reference to lookahead token. */ | |
425 | ||
426 | yyn = yypact[yystate]; | |
427 | if (yyn == YYFLAG) | |
428 | goto yydefault; | |
429 | ||
430 | /* Not known => get a lookahead token if don't already have one. */ | |
431 | ||
432 | /* yychar is either YYEMPTY or YYEOF | |
433 | or a valid token in external form. */ | |
434 | ||
435 | if (yychar == YYEMPTY) | |
436 | { | |
437 | #if YYDEBUG != 0 | |
438 | if (yydebug) | |
439 | fprintf(stderr, "Reading a token: "); | |
440 | #endif | |
441 | yychar = YYLEX; | |
442 | } | |
443 | ||
444 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
445 | ||
446 | if (yychar <= 0) /* This means end of input. */ | |
447 | { | |
448 | yychar1 = 0; | |
449 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
450 | ||
451 | #if YYDEBUG != 0 | |
452 | if (yydebug) | |
453 | fprintf(stderr, "Now at end of input.\n"); | |
454 | #endif | |
455 | } | |
456 | else | |
457 | { | |
458 | yychar1 = YYTRANSLATE(yychar); | |
459 | ||
460 | #if YYDEBUG != 0 | |
461 | if (yydebug) | |
462 | { | |
463 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
464 | /* Give the individual parser a way to print the precise meaning | |
465 | of a token, for further debugging info. */ | |
b07b484a | 466 | # ifdef YYPRINT |
10fa2066 | 467 | YYPRINT (stderr, yychar, yylval); |
b07b484a | 468 | # endif |
10fa2066 RS |
469 | fprintf (stderr, ")\n"); |
470 | } | |
471 | #endif | |
472 | } | |
473 | ||
474 | yyn += yychar1; | |
475 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
476 | goto yydefault; | |
477 | ||
478 | yyn = yytable[yyn]; | |
479 | ||
480 | /* yyn is what to do for this token type in this state. | |
481 | Negative => reduce, -yyn is rule number. | |
482 | Positive => shift, yyn is new state. | |
483 | New state is final state => don't bother to shift, | |
484 | just return success. | |
485 | 0, or most negative number => error. */ | |
486 | ||
487 | if (yyn < 0) | |
488 | { | |
489 | if (yyn == YYFLAG) | |
490 | goto yyerrlab; | |
491 | yyn = -yyn; | |
492 | goto yyreduce; | |
493 | } | |
494 | else if (yyn == 0) | |
495 | goto yyerrlab; | |
496 | ||
497 | if (yyn == YYFINAL) | |
498 | YYACCEPT; | |
499 | ||
500 | /* Shift the lookahead token. */ | |
501 | ||
502 | #if YYDEBUG != 0 | |
503 | if (yydebug) | |
504 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
505 | #endif | |
506 | ||
507 | /* Discard the token being shifted unless it is eof. */ | |
508 | if (yychar != YYEOF) | |
509 | yychar = YYEMPTY; | |
510 | ||
511 | *++yyvsp = yylval; | |
512 | #ifdef YYLSP_NEEDED | |
513 | *++yylsp = yylloc; | |
514 | #endif | |
515 | ||
516 | /* count tokens shifted since error; after three, turn off error status. */ | |
517 | if (yyerrstatus) yyerrstatus--; | |
518 | ||
519 | yystate = yyn; | |
520 | goto yynewstate; | |
521 | ||
522 | /* Do the default action for the current state. */ | |
523 | yydefault: | |
524 | ||
525 | yyn = yydefact[yystate]; | |
526 | if (yyn == 0) | |
527 | goto yyerrlab; | |
528 | ||
529 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
530 | yyreduce: | |
531 | yylen = yyr2[yyn]; | |
fb75fa82 RS |
532 | if (yylen > 0) |
533 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
10fa2066 RS |
534 | |
535 | #if YYDEBUG != 0 | |
536 | if (yydebug) | |
537 | { | |
538 | int i; | |
539 | ||
540 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
541 | yyn, yyrline[yyn]); | |
542 | ||
543 | /* Print the symbols being reduced, and their result. */ | |
544 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
545 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
546 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
547 | } | |
548 | #endif | |
549 | ||
550 | $ /* the action file gets copied in in place of this dollarsign */ | |
ca1d9e53 | 551 | #line 543 "bison.simple" |
10fa2066 RS |
552 | \f |
553 | yyvsp -= yylen; | |
554 | yyssp -= yylen; | |
555 | #ifdef YYLSP_NEEDED | |
556 | yylsp -= yylen; | |
557 | #endif | |
558 | ||
559 | #if YYDEBUG != 0 | |
560 | if (yydebug) | |
561 | { | |
562 | short *ssp1 = yyss - 1; | |
563 | fprintf (stderr, "state stack now"); | |
564 | while (ssp1 != yyssp) | |
565 | fprintf (stderr, " %d", *++ssp1); | |
566 | fprintf (stderr, "\n"); | |
567 | } | |
568 | #endif | |
569 | ||
570 | *++yyvsp = yyval; | |
571 | ||
572 | #ifdef YYLSP_NEEDED | |
573 | yylsp++; | |
574 | if (yylen == 0) | |
575 | { | |
576 | yylsp->first_line = yylloc.first_line; | |
577 | yylsp->first_column = yylloc.first_column; | |
578 | yylsp->last_line = (yylsp-1)->last_line; | |
579 | yylsp->last_column = (yylsp-1)->last_column; | |
580 | yylsp->text = 0; | |
581 | } | |
582 | else | |
583 | { | |
584 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
585 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
586 | } | |
587 | #endif | |
588 | ||
589 | /* Now "shift" the result of the reduction. | |
590 | Determine what state that goes to, | |
591 | based on the state we popped back to | |
592 | and the rule number reduced by. */ | |
593 | ||
594 | yyn = yyr1[yyn]; | |
595 | ||
596 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
597 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
598 | yystate = yytable[yystate]; | |
599 | else | |
600 | yystate = yydefgoto[yyn - YYNTBASE]; | |
601 | ||
602 | goto yynewstate; | |
603 | ||
604 | yyerrlab: /* here on detecting error */ | |
605 | ||
606 | if (! yyerrstatus) | |
607 | /* If not already recovering from an error, report this error. */ | |
608 | { | |
609 | ++yynerrs; | |
610 | ||
611 | #ifdef YYERROR_VERBOSE | |
612 | yyn = yypact[yystate]; | |
613 | ||
614 | if (yyn > YYFLAG && yyn < YYLAST) | |
615 | { | |
616 | int size = 0; | |
617 | char *msg; | |
618 | int x, count; | |
619 | ||
620 | count = 0; | |
621 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
622 | for (x = (yyn < 0 ? -yyn : 0); | |
623 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
624 | if (yycheck[x + yyn] == x) | |
625 | size += strlen(yytname[x]) + 15, count++; | |
626 | msg = (char *) malloc(size + 15); | |
627 | if (msg != 0) | |
628 | { | |
629 | strcpy(msg, "parse error"); | |
630 | ||
631 | if (count < 5) | |
632 | { | |
633 | count = 0; | |
634 | for (x = (yyn < 0 ? -yyn : 0); | |
635 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
636 | if (yycheck[x + yyn] == x) | |
637 | { | |
638 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
639 | strcat(msg, yytname[x]); | |
640 | strcat(msg, "'"); | |
641 | count++; | |
642 | } | |
643 | } | |
644 | yyerror(msg); | |
645 | free(msg); | |
646 | } | |
647 | else | |
648 | yyerror ("parse error; also virtual memory exceeded"); | |
649 | } | |
650 | else | |
651 | #endif /* YYERROR_VERBOSE */ | |
652 | yyerror("parse error"); | |
653 | } | |
654 | ||
655 | goto yyerrlab1; | |
656 | yyerrlab1: /* here on error raised explicitly by an action */ | |
657 | ||
658 | if (yyerrstatus == 3) | |
659 | { | |
660 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
661 | ||
662 | /* return failure if at end of input */ | |
663 | if (yychar == YYEOF) | |
664 | YYABORT; | |
665 | ||
666 | #if YYDEBUG != 0 | |
667 | if (yydebug) | |
668 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
669 | #endif | |
670 | ||
671 | yychar = YYEMPTY; | |
672 | } | |
673 | ||
674 | /* Else will try to reuse lookahead token | |
675 | after shifting the error token. */ | |
676 | ||
677 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
678 | ||
679 | goto yyerrhandle; | |
680 | ||
681 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
682 | ||
683 | #if 0 | |
684 | /* This is wrong; only states that explicitly want error tokens | |
685 | should shift them. */ | |
686 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
687 | if (yyn) goto yydefault; | |
688 | #endif | |
689 | ||
690 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
691 | ||
692 | if (yyssp == yyss) YYABORT; | |
693 | yyvsp--; | |
694 | yystate = *--yyssp; | |
695 | #ifdef YYLSP_NEEDED | |
696 | yylsp--; | |
697 | #endif | |
698 | ||
699 | #if YYDEBUG != 0 | |
700 | if (yydebug) | |
701 | { | |
702 | short *ssp1 = yyss - 1; | |
703 | fprintf (stderr, "Error: state stack now"); | |
704 | while (ssp1 != yyssp) | |
705 | fprintf (stderr, " %d", *++ssp1); | |
706 | fprintf (stderr, "\n"); | |
707 | } | |
708 | #endif | |
709 | ||
710 | yyerrhandle: | |
711 | ||
712 | yyn = yypact[yystate]; | |
713 | if (yyn == YYFLAG) | |
714 | goto yyerrdefault; | |
715 | ||
716 | yyn += YYTERROR; | |
717 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
718 | goto yyerrdefault; | |
719 | ||
720 | yyn = yytable[yyn]; | |
721 | if (yyn < 0) | |
722 | { | |
723 | if (yyn == YYFLAG) | |
724 | goto yyerrpop; | |
725 | yyn = -yyn; | |
726 | goto yyreduce; | |
727 | } | |
728 | else if (yyn == 0) | |
729 | goto yyerrpop; | |
730 | ||
731 | if (yyn == YYFINAL) | |
732 | YYACCEPT; | |
733 | ||
734 | #if YYDEBUG != 0 | |
735 | if (yydebug) | |
736 | fprintf(stderr, "Shifting error token, "); | |
737 | #endif | |
738 | ||
739 | *++yyvsp = yylval; | |
740 | #ifdef YYLSP_NEEDED | |
741 | *++yylsp = yylloc; | |
742 | #endif | |
743 | ||
744 | yystate = yyn; | |
745 | goto yynewstate; | |
70ddf897 RS |
746 | |
747 | yyacceptlab: | |
748 | /* YYACCEPT comes here. */ | |
749 | if (yyfree_stacks) | |
750 | { | |
751 | free (yyss); | |
752 | free (yyvs); | |
753 | #ifdef YYLSP_NEEDED | |
754 | free (yyls); | |
755 | #endif | |
756 | } | |
757 | return 0; | |
758 | ||
759 | yyabortlab: | |
760 | /* YYABORT comes here. */ | |
761 | if (yyfree_stacks) | |
762 | { | |
763 | free (yyss); | |
764 | free (yyvs); | |
765 | #ifdef YYLSP_NEEDED | |
766 | free (yyls); | |
767 | #endif | |
768 | } | |
769 | return 1; | |
10fa2066 | 770 | } |