]>
Commit | Line | Data |
---|---|---|
a8289c62 RA |
1 | /* -*- C -*- */ |
2 | ||
3 | /* A Bison parser, made from %%filename | |
4 | by GNU bison %%version. */ | |
5 | ||
10fa2066 | 6 | /* Skeleton output parser for bison, |
fabd3b43 | 7 | Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc. |
10fa2066 RS |
8 | |
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
21b14802 | 11 | the Free Software Foundation; either version 2, or (at your option) |
10fa2066 RS |
12 | any later version. |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with this program; if not, write to the Free Software | |
c49a8e71 JT |
21 | Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. */ | |
10fa2066 | 23 | |
c71f8bba RS |
24 | /* As a special exception, when this file is copied by Bison into a |
25 | Bison output file, you may use that output file without restriction. | |
26 | This special exception was added by the Free Software Foundation | |
cfeaeb52 | 27 | in version 1.24 of Bison. */ |
10fa2066 | 28 | |
71da9eea AD |
29 | /* This is the parser code that is written into each bison parser when |
30 | the %semantic_parser declaration is not specified in the grammar. | |
31 | It was written by Richard Stallman by simplifying the hairy parser | |
32 | used when %semantic_parser is specified. */ | |
444fbf65 | 33 | |
a8289c62 RA |
34 | #include <stdio.h> |
35 | ||
36 | #ifndef __cplusplus | |
37 | # ifndef __STDC__ | |
38 | # define const | |
39 | # endif | |
40 | #endif | |
41 | ||
70ddf897 | 42 | #ifndef YYSTACK_USE_ALLOCA |
361f60b3 | 43 | # ifdef alloca |
78d09da9 | 44 | # define YYSTACK_USE_ALLOCA 1 |
361f60b3 AD |
45 | # else /* alloca not defined */ |
46 | # ifdef __GNUC__ | |
78d09da9 | 47 | # define YYSTACK_USE_ALLOCA 1 |
361f60b3 AD |
48 | # define alloca __builtin_alloca |
49 | # else /* not GNU C. */ | |
50 | # if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) | |
78d09da9 | 51 | # define YYSTACK_USE_ALLOCA 1 |
361f60b3 AD |
52 | # include <alloca.h> |
53 | # else /* not sparc */ | |
54 | /* We think this test detects Watcom and Microsoft C. */ | |
55 | /* This used to test MSDOS, but that is a bad idea since that | |
56 | symbol is in the user namespace. */ | |
57 | # if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | |
58 | # if 0 | |
59 | /* No need for malloc.h, which pollutes the namespace; instead, | |
60 | just don't use alloca. */ | |
61 | # include <malloc.h> | |
62 | # endif | |
63 | # else /* not MSDOS, or __TURBOC__ */ | |
64 | # if defined(_AIX) | |
65 | /* I don't know what this was needed for, but it pollutes the | |
66 | namespace. So I turned it off. rms, 2 May 1997. */ | |
67 | /* #include <malloc.h> */ | |
bbb5bcc6 | 68 | #pragma alloca |
78d09da9 | 69 | # define YYSTACK_USE_ALLOCA 1 |
361f60b3 AD |
70 | # else /* not MSDOS, or __TURBOC__, or _AIX */ |
71 | # if 0 | |
72 | /* haible@ilog.fr says this works for HPUX 9.05 and up, and on | |
73 | HPUX 10. Eventually we can turn this on. */ | |
74 | # ifdef __hpux | |
78d09da9 | 75 | # define YYSTACK_USE_ALLOCA 1 |
361f60b3 AD |
76 | # define alloca __builtin_alloca |
77 | # endif /* __hpux */ | |
78 | # endif | |
79 | # endif /* not _AIX */ | |
80 | # endif /* not MSDOS, or __TURBOC__ */ | |
81 | # endif /* not sparc */ | |
82 | # endif /* not GNU C */ | |
83 | # endif /* alloca not defined */ | |
70ddf897 RS |
84 | #endif /* YYSTACK_USE_ALLOCA not defined */ |
85 | ||
78d09da9 | 86 | #if YYSTACK_USE_ALLOCA |
361f60b3 | 87 | # define YYSTACK_ALLOC alloca |
70ddf897 | 88 | #else |
361f60b3 | 89 | # define YYSTACK_ALLOC malloc |
70ddf897 | 90 | #endif |
10fa2066 | 91 | |
a8289c62 RA |
92 | #define YYBISON 1 /* Identify Bison output. */ |
93 | #define YYPURE %%pure /* Identify pure parsers. */ | |
94 | ||
95 | #ifndef YYDEBUG | |
96 | # define YYDEBUG %%debug | |
97 | #endif | |
98 | ||
99 | #ifndef YYSTYPE | |
100 | # define YYSTYPE %%stype | |
101 | #endif | |
102 | ||
103 | #ifndef YYLTYPE | |
104 | typedef struct yyltype | |
105 | { | |
106 | int first_line; | |
107 | int first_column; | |
108 | int last_line; | |
109 | int last_column; | |
110 | } yyltype; | |
111 | # define YYLTYPE %%ltype | |
112 | #endif | |
113 | ||
114 | #ifndef YYERROR_VERBOSE | |
115 | # define YYERROR_VERBOSE %%verbose | |
116 | #endif | |
117 | ||
118 | /* Tokens. */ | |
119 | %%tokendef | |
120 | ||
121 | #define YYFINAL %%final | |
122 | #define YYFLAG %%flag | |
123 | #define YYNTBASE %%ntbase | |
124 | #define YYLAST %%last | |
125 | ||
126 | #define YYNTOKENS %%ntokens | |
127 | #define YYNNTS %%nnts | |
128 | #define YYNRULES %%nrules | |
129 | #define YYNSTATES %%nstates | |
130 | #define YYMAXUTOK %%maxtok | |
131 | ||
132 | /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ | |
133 | #define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym) | |
134 | ||
135 | /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ | |
136 | static const char yytranslate[] = | |
137 | { | |
138 | %%translate | |
139 | }; | |
140 | ||
141 | #if YYDEBUG | |
142 | static const short yyprhs[] = | |
143 | { | |
144 | %%prhs | |
145 | }; | |
146 | ||
147 | static const short yyrhs[] = | |
148 | { | |
149 | %%rhs | |
150 | }; | |
151 | ||
152 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | |
153 | static const short yyrline[] = | |
154 | { | |
155 | %%rline | |
156 | }; | |
157 | #endif | |
158 | ||
159 | #if YYDEBUG || YYERROR_VERBOSE | |
160 | /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ | |
161 | static const char* const yytname[] = | |
162 | { | |
163 | %%tname | |
164 | }; | |
165 | #endif | |
166 | ||
167 | /* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */ | |
168 | static const short yytoknum[] = | |
169 | { | |
170 | %%toknum | |
171 | }; | |
172 | ||
173 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | |
174 | static const short yyr1[] = | |
175 | { | |
176 | %%r1 | |
177 | }; | |
178 | ||
179 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | |
180 | static const short yyr2[] = | |
181 | { | |
182 | %%r2 | |
183 | }; | |
184 | ||
185 | /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE | |
186 | doesn't specify something else to do. Zero means the default is an | |
187 | error. */ | |
188 | static const short yydefact[] = | |
189 | { | |
190 | %%defact | |
191 | }; | |
192 | ||
193 | static const short yydefgoto[] = | |
194 | { | |
195 | %%defgoto | |
196 | }; | |
197 | ||
198 | static const short yypact[] = | |
199 | { | |
200 | %%pact | |
201 | }; | |
202 | ||
203 | static const short yypgoto[] = | |
204 | { | |
205 | %%pgoto | |
206 | }; | |
207 | ||
208 | static const short yytable[] = | |
209 | { | |
210 | %%table | |
211 | }; | |
212 | ||
213 | static const short yycheck[] = | |
214 | { | |
215 | %%check | |
216 | }; | |
217 | ||
10fa2066 | 218 | #define yyerrok (yyerrstatus = 0) |
a8289c62 | 219 | #define yyclearin (%%yychar = YYEMPTY) |
10fa2066 RS |
220 | #define YYEMPTY -2 |
221 | #define YYEOF 0 | |
a8289c62 | 222 | |
70ddf897 | 223 | #define YYACCEPT goto yyacceptlab |
a8289c62 | 224 | #define YYABORT goto yyabortlab |
10fa2066 | 225 | #define YYERROR goto yyerrlab1 |
a8289c62 | 226 | |
71da9eea AD |
227 | /* Like YYERROR except do call yyerror. This remains here temporarily |
228 | to ease the transition to the new meaning of YYERROR, for GCC. | |
10fa2066 | 229 | Once GCC version 2 has supplanted version 1, this can go. */ |
a8289c62 | 230 | |
10fa2066 | 231 | #define YYFAIL goto yyerrlab |
a8289c62 | 232 | |
10fa2066 | 233 | #define YYRECOVERING() (!!yyerrstatus) |
a8289c62 | 234 | |
69b4e0c5 | 235 | #define YYBACKUP(Token, Value) \ |
10fa2066 | 236 | do \ |
a8289c62 | 237 | if (%%yychar == YYEMPTY && yylen == 1) \ |
71da9eea | 238 | { \ |
a8289c62 RA |
239 | %%yychar = (Token); \ |
240 | %%yylval = (Value); \ | |
241 | yychar1 = YYTRANSLATE (%%yychar); \ | |
10fa2066 RS |
242 | YYPOPSTACK; \ |
243 | goto yybackup; \ | |
244 | } \ | |
245 | else \ | |
71da9eea | 246 | { \ |
a8289c62 | 247 | %%yyerror ("syntax error: cannot back up"); \ |
71da9eea AD |
248 | YYERROR; \ |
249 | } \ | |
10fa2066 RS |
250 | while (0) |
251 | ||
252 | #define YYTERROR 1 | |
253 | #define YYERRCODE 256 | |
254 | ||
3abcd459 AD |
255 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
256 | are run). | |
257 | ||
258 | When YYLLOC_DEFAULT is run, CURRENT is set the location of the | |
259 | first token. By default, to implement support for ranges, extend | |
260 | its range to the last symbol. */ | |
261 | ||
262 | #ifndef YYLLOC_DEFAULT | |
ca96bc2d MA |
263 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
264 | Current.last_line = Rhs[N].last_line; \ | |
265 | Current.last_column = Rhs[N].last_column; | |
3abcd459 AD |
266 | #endif |
267 | ||
3abcd459 | 268 | /* YYLEX -- calling `yylex' with the right arguments. */ |
553e2b22 AD |
269 | |
270 | #if YYPURE | |
5af1f549 | 271 | # if YYLSP_NEEDED |
b07b484a | 272 | # ifdef YYLEX_PARAM |
a8289c62 | 273 | # define YYLEX %%yylex (&%%yylval, &yylloc, YYLEX_PARAM) |
b07b484a | 274 | # else |
a8289c62 | 275 | # define YYLEX %%yylex (&%%yylval, &yylloc) |
b07b484a | 276 | # endif |
71da9eea | 277 | # else /* !YYLSP_NEEDED */ |
b07b484a | 278 | # ifdef YYLEX_PARAM |
a8289c62 | 279 | # define YYLEX %%yylex (&%%yylval, YYLEX_PARAM) |
b07b484a | 280 | # else |
a8289c62 | 281 | # define YYLEX %%yylex (&%%yylval) |
b07b484a | 282 | # endif |
71da9eea | 283 | # endif /* !YYLSP_NEEDED */ |
553e2b22 | 284 | #else /* !YYPURE */ |
a8289c62 | 285 | # define YYLEX %%yylex () |
553e2b22 AD |
286 | #endif /* !YYPURE */ |
287 | ||
5a35a6cb | 288 | /* Enable debugging if requested. */ |
0d533154 | 289 | #if YYDEBUG |
5a35a6cb AD |
290 | # define YYDPRINTF(Args) \ |
291 | do { \ | |
a8289c62 | 292 | if (%%yydebug) \ |
5a35a6cb AD |
293 | fprintf Args; \ |
294 | } while (0) | |
295 | /* Nonzero means print parse trace. [The following comment makes no | |
296 | sense to me. Could someone clarify it? --akim] Since this is | |
297 | uninitialized, it does not stop multiple parsers from coexisting. | |
298 | */ | |
a8289c62 | 299 | int %%yydebug; |
5a35a6cb AD |
300 | #else /* !YYDEBUG */ |
301 | # define YYDPRINTF(Args) | |
302 | #endif /* !YYDEBUG */ | |
303 | ||
304 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
10fa2066 | 305 | #ifndef YYINITDEPTH |
a8289c62 | 306 | # define YYINITDEPTH %%initdepth |
10fa2066 RS |
307 | #endif |
308 | ||
5a35a6cb AD |
309 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
310 | if the built-in stack extension method is used). */ | |
10fa2066 | 311 | #if YYMAXDEPTH == 0 |
b07b484a | 312 | # undef YYMAXDEPTH |
10fa2066 RS |
313 | #endif |
314 | ||
315 | #ifndef YYMAXDEPTH | |
a8289c62 | 316 | # define YYMAXDEPTH %%maxdepth |
10fa2066 | 317 | #endif |
a8289c62 | 318 | |
10fa2066 | 319 | \f |
a8289c62 | 320 | |
5e02f2ad RS |
321 | /* Define __yy_memcpy. Note that the size argument |
322 | should be passed with type unsigned int, because that is what the non-GCC | |
323 | definitions require. With GCC, __builtin_memcpy takes an arg | |
324 | of type size_t, but it can handle unsigned int. */ | |
325 | ||
10fa2066 | 326 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
5a35a6cb | 327 | # define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count) |
10fa2066 | 328 | #else /* not GNU C or C++ */ |
10fa2066 RS |
329 | |
330 | /* This is the most reliable way to avoid incompatibilities | |
331 | in available built-in functions on various systems. */ | |
332 | static void | |
5a009f2c | 333 | # ifndef __cplusplus |
c245d0d3 | 334 | __yy_memcpy (to, from, count) |
10fa2066 | 335 | char *to; |
5a009f2c | 336 | const char *from; |
5e02f2ad | 337 | unsigned int count; |
b07b484a | 338 | # else /* __cplusplus */ |
5a009f2c MA |
339 | __yy_memcpy (char *to, const char *from, unsigned int count) |
340 | # endif | |
10fa2066 | 341 | { |
5a009f2c | 342 | register const char *f = from; |
10fa2066 RS |
343 | register char *t = to; |
344 | register int i = count; | |
345 | ||
346 | while (i-- > 0) | |
347 | *t++ = *f++; | |
348 | } | |
bbb5bcc6 | 349 | #endif |
a8289c62 | 350 | |
10fa2066 | 351 | \f |
a8289c62 RA |
352 | |
353 | #line %%line "%%filename" | |
b658bf92 RS |
354 | |
355 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
356 | into yyparse. The argument should have type void *. | |
357 | It should actually point to an object. | |
358 | Grammar actions can access the variable by casting it | |
359 | to the proper pointer type. */ | |
360 | ||
361 | #ifdef YYPARSE_PARAM | |
b07b484a AD |
362 | # ifdef __cplusplus |
363 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
364 | # define YYPARSE_PARAM_DECL | |
71da9eea | 365 | # else /* !__cplusplus */ |
b07b484a AD |
366 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM |
367 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
71da9eea AD |
368 | # endif /* !__cplusplus */ |
369 | #else /* !YYPARSE_PARAM */ | |
b07b484a AD |
370 | # define YYPARSE_PARAM_ARG |
371 | # define YYPARSE_PARAM_DECL | |
71da9eea | 372 | #endif /* !YYPARSE_PARAM */ |
b658bf92 | 373 | |
1b181651 PE |
374 | /* Prevent warning if -Wstrict-prototypes. */ |
375 | #ifdef __GNUC__ | |
b07b484a | 376 | # ifdef YYPARSE_PARAM |
a8289c62 | 377 | int %%yyparse (void *); |
b07b484a | 378 | # else |
a8289c62 | 379 | int %%yyparse (void); |
b07b484a | 380 | # endif |
1b181651 PE |
381 | #endif |
382 | ||
a35f64ea AD |
383 | /* YY_DECL_VARIABLES -- depending whether we use a pure parser, |
384 | variables are global, or local to YYPARSE. */ | |
385 | ||
386 | #define _YY_DECL_VARIABLES \ | |
387 | /* The lookahead symbol. */ \ | |
a8289c62 | 388 | int %%yychar; \ |
a35f64ea AD |
389 | \ |
390 | /* The semantic value of the lookahead symbol. */ \ | |
a8289c62 | 391 | YYSTYPE %%yylval; \ |
a35f64ea AD |
392 | \ |
393 | /* Number of parse errors so far. */ \ | |
a8289c62 | 394 | int %%yynerrs; |
a35f64ea AD |
395 | |
396 | #if YYLSP_NEEDED | |
397 | # define YY_DECL_VARIABLES \ | |
398 | _YY_DECL_VARIABLES \ | |
399 | \ | |
400 | /* Location data for the lookahead symbol. */ \ | |
401 | YYLTYPE yylloc; | |
402 | #else | |
403 | # define YY_DECL_VARIABLES \ | |
404 | _YY_DECL_VARIABLES | |
405 | #endif | |
406 | ||
a35f64ea AD |
407 | /* If nonreentrant, generate the variables here. */ |
408 | ||
409 | #if !YYPURE | |
410 | YY_DECL_VARIABLES | |
411 | #endif /* !YYPURE */ | |
412 | ||
10fa2066 | 413 | int |
a8289c62 | 414 | %%yyparse (YYPARSE_PARAM_ARG) |
b658bf92 | 415 | YYPARSE_PARAM_DECL |
10fa2066 | 416 | { |
a35f64ea AD |
417 | /* If reentrant, generate the variables here. */ |
418 | #if YYPURE | |
419 | YY_DECL_VARIABLES | |
420 | #endif /* !YYPURE */ | |
421 | ||
10fa2066 RS |
422 | register int yystate; |
423 | register int yyn; | |
b07b484a AD |
424 | /* Number of tokens to shift before error messages enabled. */ |
425 | int yyerrstatus; | |
426 | /* Lookahead token as an internal (translated) token number. */ | |
427 | int yychar1 = 0; | |
10fa2066 | 428 | |
bb10be54 AD |
429 | /* Three stacks and their tools: |
430 | `yyss': related to states, | |
431 | `yysv': related to semantic values, | |
432 | `yyls': related to locations. | |
433 | ||
434 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
435 | to reallocate them elsewhere. */ | |
436 | ||
b07b484a AD |
437 | /* The state stack. */ |
438 | short yyssa[YYINITDEPTH]; | |
bb10be54 AD |
439 | short *yyss = yyssa; |
440 | register short *yyssp; | |
441 | ||
b07b484a AD |
442 | /* The semantic value stack. */ |
443 | YYSTYPE yyvsa[YYINITDEPTH]; | |
b07b484a | 444 | YYSTYPE *yyvs = yyvsa; |
bb10be54 | 445 | register YYSTYPE *yyvsp; |
10fa2066 | 446 | |
5af1f549 | 447 | #if YYLSP_NEEDED |
b07b484a AD |
448 | /* The location stack. */ |
449 | YYLTYPE yylsa[YYINITDEPTH]; | |
10fa2066 RS |
450 | YYLTYPE *yyls = yylsa; |
451 | YYLTYPE *yylsp; | |
bb10be54 | 452 | #endif |
10fa2066 | 453 | |
5af1f549 | 454 | #if YYLSP_NEEDED |
b07b484a | 455 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
10fa2066 | 456 | #else |
b07b484a | 457 | # define YYPOPSTACK (yyvsp--, yyssp--) |
10fa2066 RS |
458 | #endif |
459 | ||
460 | int yystacksize = YYINITDEPTH; | |
70ddf897 | 461 | int yyfree_stacks = 0; |
10fa2066 | 462 | |
6666f98f AD |
463 | /* The variables used to return semantic value and location from the |
464 | action routines. */ | |
bb10be54 | 465 | YYSTYPE yyval; |
5af1f549 | 466 | # if YYLSP_NEEDED |
6666f98f AD |
467 | YYLTYPE yyloc; |
468 | # endif | |
10fa2066 | 469 | |
6666f98f AD |
470 | /* When reducing, the number of symbols on the RHS of the reduced |
471 | rule. */ | |
10fa2066 RS |
472 | int yylen; |
473 | ||
5a35a6cb | 474 | YYDPRINTF ((stderr, "Starting parse\n")); |
10fa2066 RS |
475 | |
476 | yystate = 0; | |
477 | yyerrstatus = 0; | |
a8289c62 RA |
478 | %%yynerrs = 0; |
479 | %%yychar = YYEMPTY; /* Cause a token to be read. */ | |
10fa2066 RS |
480 | |
481 | /* Initialize stack pointers. | |
482 | Waste one element of value and location stack | |
483 | so that they stay on the same level as the state stack. | |
484 | The wasted elements are never initialized. */ | |
485 | ||
486 | yyssp = yyss - 1; | |
487 | yyvsp = yyvs; | |
5af1f549 | 488 | #if YYLSP_NEEDED |
10fa2066 RS |
489 | yylsp = yyls; |
490 | #endif | |
491 | ||
71da9eea AD |
492 | /*------------------------------------------------------------. |
493 | | yynewstate -- Push a new state, which is found in yystate. | | |
494 | `------------------------------------------------------------*/ | |
495 | yynewstate: | |
496 | /* In all cases, when you get here, the value and location stacks | |
497 | have just been pushed. so pushing a state here evens the stacks. | |
498 | */ | |
10fa2066 RS |
499 | *++yyssp = yystate; |
500 | ||
501 | if (yyssp >= yyss + yystacksize - 1) | |
502 | { | |
71da9eea AD |
503 | /* Give user a chance to reallocate the stack. Use copies of |
504 | these so that the &'s don't force the real ones into memory. | |
505 | */ | |
10fa2066 RS |
506 | YYSTYPE *yyvs1 = yyvs; |
507 | short *yyss1 = yyss; | |
5af1f549 | 508 | #if YYLSP_NEEDED |
10fa2066 RS |
509 | YYLTYPE *yyls1 = yyls; |
510 | #endif | |
511 | ||
512 | /* Get the current used size of the three stacks, in elements. */ | |
513 | int size = yyssp - yyss + 1; | |
514 | ||
515 | #ifdef yyoverflow | |
69b4e0c5 AD |
516 | /* Each stack pointer address is followed by the size of the |
517 | data in use in that stack, in bytes. */ | |
5af1f549 | 518 | # if YYLSP_NEEDED |
be4bf877 RS |
519 | /* This used to be a conditional around just the two extra args, |
520 | but that might be undefined if yyoverflow is a macro. */ | |
bb10be54 AD |
521 | yyoverflow ("parser stack overflow", |
522 | &yyss1, size * sizeof (*yyssp), | |
523 | &yyvs1, size * sizeof (*yyvsp), | |
524 | &yyls1, size * sizeof (*yylsp), | |
525 | &yystacksize); | |
b07b484a | 526 | # else |
bb10be54 AD |
527 | yyoverflow ("parser stack overflow", |
528 | &yyss1, size * sizeof (*yyssp), | |
529 | &yyvs1, size * sizeof (*yyvsp), | |
530 | &yystacksize); | |
b07b484a | 531 | # endif |
10fa2066 RS |
532 | |
533 | yyss = yyss1; yyvs = yyvs1; | |
5af1f549 | 534 | # if YYLSP_NEEDED |
10fa2066 | 535 | yyls = yyls1; |
b07b484a | 536 | # endif |
10fa2066 RS |
537 | #else /* no yyoverflow */ |
538 | /* Extend the stack our own way. */ | |
539 | if (yystacksize >= YYMAXDEPTH) | |
540 | { | |
a8289c62 | 541 | %%yyerror ("parser stack overflow"); |
70ddf897 RS |
542 | if (yyfree_stacks) |
543 | { | |
544 | free (yyss); | |
545 | free (yyvs); | |
5af1f549 | 546 | # if YYLSP_NEEDED |
70ddf897 | 547 | free (yyls); |
b07b484a | 548 | # endif |
70ddf897 | 549 | } |
10fa2066 RS |
550 | return 2; |
551 | } | |
552 | yystacksize *= 2; | |
553 | if (yystacksize > YYMAXDEPTH) | |
554 | yystacksize = YYMAXDEPTH; | |
a8289c62 | 555 | # if !YYSTACK_USE_ALLOCA |
70ddf897 | 556 | yyfree_stacks = 1; |
b07b484a | 557 | # endif |
70ddf897 | 558 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); |
5e02f2ad RS |
559 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
560 | size * (unsigned int) sizeof (*yyssp)); | |
70ddf897 | 561 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); |
5e02f2ad RS |
562 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
563 | size * (unsigned int) sizeof (*yyvsp)); | |
5af1f549 | 564 | # if YYLSP_NEEDED |
70ddf897 | 565 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
5e02f2ad RS |
566 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
567 | size * (unsigned int) sizeof (*yylsp)); | |
b07b484a | 568 | # endif |
10fa2066 RS |
569 | #endif /* no yyoverflow */ |
570 | ||
571 | yyssp = yyss + size - 1; | |
572 | yyvsp = yyvs + size - 1; | |
5af1f549 | 573 | #if YYLSP_NEEDED |
10fa2066 RS |
574 | yylsp = yyls + size - 1; |
575 | #endif | |
576 | ||
5a35a6cb | 577 | YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize)); |
10fa2066 RS |
578 | |
579 | if (yyssp >= yyss + yystacksize - 1) | |
580 | YYABORT; | |
581 | } | |
582 | ||
5a35a6cb | 583 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
10fa2066 RS |
584 | |
585 | goto yybackup; | |
71da9eea | 586 | |
71da9eea AD |
587 | /*-----------. |
588 | | yybackup. | | |
589 | `-----------*/ | |
590 | yybackup: | |
10fa2066 RS |
591 | |
592 | /* Do appropriate processing given the current state. */ | |
593 | /* Read a lookahead token if we need one and don't already have one. */ | |
594 | /* yyresume: */ | |
595 | ||
596 | /* First try to decide what to do without reference to lookahead token. */ | |
597 | ||
598 | yyn = yypact[yystate]; | |
599 | if (yyn == YYFLAG) | |
600 | goto yydefault; | |
601 | ||
602 | /* Not known => get a lookahead token if don't already have one. */ | |
603 | ||
604 | /* yychar is either YYEMPTY or YYEOF | |
605 | or a valid token in external form. */ | |
606 | ||
a8289c62 | 607 | if (%%yychar == YYEMPTY) |
10fa2066 | 608 | { |
5a35a6cb | 609 | YYDPRINTF ((stderr, "Reading a token: ")); |
a8289c62 | 610 | %%yychar = YYLEX; |
10fa2066 RS |
611 | } |
612 | ||
613 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
614 | ||
a8289c62 | 615 | if (%%yychar <= 0) /* This means end of input. */ |
10fa2066 RS |
616 | { |
617 | yychar1 = 0; | |
a8289c62 | 618 | %%yychar = YYEOF; /* Don't call YYLEX any more */ |
10fa2066 | 619 | |
5a35a6cb | 620 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
10fa2066 RS |
621 | } |
622 | else | |
623 | { | |
a8289c62 | 624 | yychar1 = YYTRANSLATE (%%yychar); |
10fa2066 | 625 | |
0d533154 AD |
626 | #if YYDEBUG |
627 | /* We have to keep this `#if YYDEBUG', since we use variables | |
628 | which are defined only if `YYDEBUG' is set. */ | |
a8289c62 | 629 | if (%%yydebug) |
10fa2066 | 630 | { |
a8289c62 | 631 | fprintf (stderr, "Next token is %d (%s", %%yychar, yytname[yychar1]); |
0d533154 AD |
632 | /* Give the individual parser a way to print the precise |
633 | meaning of a token, for further debugging info. */ | |
b07b484a | 634 | # ifdef YYPRINT |
a8289c62 | 635 | YYPRINT (stderr, %%yychar, %%yylval); |
b07b484a | 636 | # endif |
10fa2066 RS |
637 | fprintf (stderr, ")\n"); |
638 | } | |
0d533154 | 639 | #endif |
10fa2066 RS |
640 | } |
641 | ||
642 | yyn += yychar1; | |
643 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
644 | goto yydefault; | |
645 | ||
646 | yyn = yytable[yyn]; | |
647 | ||
648 | /* yyn is what to do for this token type in this state. | |
649 | Negative => reduce, -yyn is rule number. | |
650 | Positive => shift, yyn is new state. | |
651 | New state is final state => don't bother to shift, | |
652 | just return success. | |
653 | 0, or most negative number => error. */ | |
654 | ||
655 | if (yyn < 0) | |
656 | { | |
657 | if (yyn == YYFLAG) | |
658 | goto yyerrlab; | |
659 | yyn = -yyn; | |
660 | goto yyreduce; | |
661 | } | |
662 | else if (yyn == 0) | |
663 | goto yyerrlab; | |
664 | ||
665 | if (yyn == YYFINAL) | |
666 | YYACCEPT; | |
667 | ||
668 | /* Shift the lookahead token. */ | |
a8289c62 | 669 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", %%yychar, yytname[yychar1])); |
10fa2066 RS |
670 | |
671 | /* Discard the token being shifted unless it is eof. */ | |
a8289c62 RA |
672 | if (%%yychar != YYEOF) |
673 | %%yychar = YYEMPTY; | |
10fa2066 | 674 | |
a8289c62 | 675 | *++yyvsp = %%yylval; |
5af1f549 | 676 | #if YYLSP_NEEDED |
10fa2066 RS |
677 | *++yylsp = yylloc; |
678 | #endif | |
679 | ||
71da9eea AD |
680 | /* Count tokens shifted since error; after three, turn off error |
681 | status. */ | |
682 | if (yyerrstatus) | |
683 | yyerrstatus--; | |
10fa2066 RS |
684 | |
685 | yystate = yyn; | |
686 | goto yynewstate; | |
687 | ||
10fa2066 | 688 | |
71da9eea AD |
689 | /*-----------------------------------------------------------. |
690 | | yydefault -- do the default action for the current state. | | |
691 | `-----------------------------------------------------------*/ | |
692 | yydefault: | |
10fa2066 RS |
693 | yyn = yydefact[yystate]; |
694 | if (yyn == 0) | |
695 | goto yyerrlab; | |
71da9eea | 696 | goto yyreduce; |
10fa2066 | 697 | |
71da9eea AD |
698 | |
699 | /*-----------------------------. | |
700 | | yyreduce -- Do a reduction. | | |
701 | `-----------------------------*/ | |
10fa2066 | 702 | yyreduce: |
71da9eea | 703 | /* yyn is the number of a rule to reduce with. */ |
10fa2066 | 704 | yylen = yyr2[yyn]; |
da9abf43 AD |
705 | |
706 | /* If YYLEN is nonzero, implement the default value of the action: | |
573c1d9f | 707 | `$$ = $1'. |
da9abf43 AD |
708 | |
709 | Otherwise, the following line sets YYVAL to the semantic value of | |
710 | the lookahead token. This behavior is undocumented and Bison | |
711 | users should not rely upon it. Assigning to YYVAL | |
712 | unconditionally makes the parser a bit smaller, and it avoids a | |
713 | GCC warning that YYVAL may be used uninitialized. */ | |
714 | yyval = yyvsp[1-yylen]; | |
3abcd459 | 715 | |
5af1f549 | 716 | #if YYLSP_NEEDED |
3abcd459 AD |
717 | /* Similarly for the default location. Let the user run additional |
718 | commands if for instance locations are ranges. */ | |
719 | yyloc = yylsp[1-yylen]; | |
ca96bc2d | 720 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); |
6666f98f | 721 | #endif |
10fa2066 | 722 | |
0de741ca AD |
723 | #if YYDEBUG |
724 | /* We have to keep this `#if YYDEBUG', since we use variables which | |
725 | are defined only if `YYDEBUG' is set. */ | |
a8289c62 | 726 | if (%%yydebug) |
10fa2066 RS |
727 | { |
728 | int i; | |
729 | ||
730 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
731 | yyn, yyrline[yyn]); | |
732 | ||
733 | /* Print the symbols being reduced, and their result. */ | |
734 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
735 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
736 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
737 | } | |
738 | #endif | |
a8289c62 RA |
739 | switch (yyn) |
740 | { | |
741 | %%action /* The action file replaces this line. */ | |
742 | } | |
743 | #line %%line "%%filename" | |
10fa2066 RS |
744 | \f |
745 | yyvsp -= yylen; | |
746 | yyssp -= yylen; | |
5af1f549 | 747 | #if YYLSP_NEEDED |
10fa2066 RS |
748 | yylsp -= yylen; |
749 | #endif | |
750 | ||
5a35a6cb | 751 | #if YYDEBUG |
a8289c62 | 752 | if (%%yydebug) |
10fa2066 RS |
753 | { |
754 | short *ssp1 = yyss - 1; | |
755 | fprintf (stderr, "state stack now"); | |
756 | while (ssp1 != yyssp) | |
757 | fprintf (stderr, " %d", *++ssp1); | |
758 | fprintf (stderr, "\n"); | |
759 | } | |
5a35a6cb | 760 | #endif |
10fa2066 RS |
761 | |
762 | *++yyvsp = yyval; | |
5af1f549 | 763 | #if YYLSP_NEEDED |
6666f98f | 764 | *++yylsp = yyloc; |
10fa2066 RS |
765 | #endif |
766 | ||
41aca2e0 AD |
767 | /* Now `shift' the result of the reduction. Determine what state |
768 | that goes to, based on the state we popped back to and the rule | |
769 | number reduced by. */ | |
10fa2066 RS |
770 | |
771 | yyn = yyr1[yyn]; | |
772 | ||
773 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
774 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
775 | yystate = yytable[yystate]; | |
776 | else | |
777 | yystate = yydefgoto[yyn - YYNTBASE]; | |
778 | ||
779 | goto yynewstate; | |
780 | ||
10fa2066 | 781 | |
71da9eea AD |
782 | /*------------------------------------. |
783 | | yyerrlab -- here on detecting error | | |
784 | `------------------------------------*/ | |
785 | yyerrlab: | |
786 | /* If not already recovering from an error, report this error. */ | |
787 | if (!yyerrstatus) | |
10fa2066 | 788 | { |
a8289c62 | 789 | ++%%yynerrs; |
10fa2066 | 790 | |
a8289c62 | 791 | #if YYERROR_VERBOSE |
10fa2066 RS |
792 | yyn = yypact[yystate]; |
793 | ||
794 | if (yyn > YYFLAG && yyn < YYLAST) | |
795 | { | |
796 | int size = 0; | |
797 | char *msg; | |
798 | int x, count; | |
799 | ||
800 | count = 0; | |
801 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
802 | for (x = (yyn < 0 ? -yyn : 0); | |
3419715d | 803 | x < (int) (sizeof (yytname) / sizeof (char *)); x++) |
10fa2066 | 804 | if (yycheck[x + yyn] == x) |
71da9eea | 805 | size += strlen (yytname[x]) + 15, count++; |
75bbe78d | 806 | size += strlen ("parse error, unexpected `") + 1; |
a8289c62 | 807 | size += strlen (yytname[YYTRANSLATE (%%yychar)]); |
75bbe78d | 808 | msg = (char *) malloc (size); |
10fa2066 RS |
809 | if (msg != 0) |
810 | { | |
75bbe78d | 811 | strcpy (msg, "parse error, unexpected `"); |
a8289c62 | 812 | strcat (msg, yytname[YYTRANSLATE (%%yychar)]); |
75bbe78d | 813 | strcat (msg, "'"); |
10fa2066 RS |
814 | |
815 | if (count < 5) | |
816 | { | |
817 | count = 0; | |
818 | for (x = (yyn < 0 ? -yyn : 0); | |
a8289c62 | 819 | x < (int) (sizeof (yytname) / sizeof (char *)); x++) |
10fa2066 RS |
820 | if (yycheck[x + yyn] == x) |
821 | { | |
a8289c62 RA |
822 | strcat (msg, count == 0 ? ", expecting `" : " or `"); |
823 | strcat (msg, yytname[x]); | |
75bbe78d | 824 | strcat (msg, "'"); |
10fa2066 RS |
825 | count++; |
826 | } | |
827 | } | |
a8289c62 | 828 | %%yyerror (msg); |
75bbe78d | 829 | free (msg); |
10fa2066 | 830 | } |
a8289c62 RA |
831 | else |
832 | %%yyerror ("parse error; also virtual memory exceeded"); | |
833 | } | |
10fa2066 RS |
834 | else |
835 | #endif /* YYERROR_VERBOSE */ | |
a8289c62 | 836 | %%yyerror ("parse error"); |
10fa2066 | 837 | } |
10fa2066 | 838 | goto yyerrlab1; |
10fa2066 | 839 | |
71da9eea AD |
840 | |
841 | /*--------------------------------------------------. | |
842 | | yyerrlab1 -- error raised explicitly by an action | | |
843 | `--------------------------------------------------*/ | |
844 | yyerrlab1: | |
10fa2066 RS |
845 | if (yyerrstatus == 3) |
846 | { | |
71da9eea AD |
847 | /* If just tried and failed to reuse lookahead token after an |
848 | error, discard it. */ | |
10fa2066 RS |
849 | |
850 | /* return failure if at end of input */ | |
a8289c62 | 851 | if (%%yychar == YYEOF) |
10fa2066 | 852 | YYABORT; |
5a35a6cb | 853 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
a8289c62 RA |
854 | %%yychar, yytname[yychar1])); |
855 | %%yychar = YYEMPTY; | |
10fa2066 RS |
856 | } |
857 | ||
71da9eea AD |
858 | /* Else will try to reuse lookahead token after shifting the error |
859 | token. */ | |
10fa2066 RS |
860 | |
861 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
862 | ||
863 | goto yyerrhandle; | |
864 | ||
10fa2066 | 865 | |
71da9eea AD |
866 | /*-------------------------------------------------------------------. |
867 | | yyerrdefault -- current state does not do anything special for the | | |
868 | | error token. | | |
869 | `-------------------------------------------------------------------*/ | |
870 | yyerrdefault: | |
10fa2066 RS |
871 | #if 0 |
872 | /* This is wrong; only states that explicitly want error tokens | |
873 | should shift them. */ | |
71da9eea AD |
874 | |
875 | /* If its default is to accept any token, ok. Otherwise pop it. */ | |
876 | yyn = yydefact[yystate]; | |
877 | if (yyn) | |
878 | goto yydefault; | |
10fa2066 RS |
879 | #endif |
880 | ||
10fa2066 | 881 | |
71da9eea AD |
882 | /*---------------------------------------------------------------. |
883 | | yyerrpop -- pop the current state because it cannot handle the | | |
884 | | error token | | |
885 | `---------------------------------------------------------------*/ | |
886 | yyerrpop: | |
887 | if (yyssp == yyss) | |
888 | YYABORT; | |
10fa2066 RS |
889 | yyvsp--; |
890 | yystate = *--yyssp; | |
5af1f549 | 891 | #if YYLSP_NEEDED |
10fa2066 RS |
892 | yylsp--; |
893 | #endif | |
894 | ||
5a35a6cb | 895 | #if YYDEBUG |
a8289c62 | 896 | if (%%yydebug) |
10fa2066 RS |
897 | { |
898 | short *ssp1 = yyss - 1; | |
899 | fprintf (stderr, "Error: state stack now"); | |
900 | while (ssp1 != yyssp) | |
901 | fprintf (stderr, " %d", *++ssp1); | |
902 | fprintf (stderr, "\n"); | |
903 | } | |
5a35a6cb | 904 | #endif |
10fa2066 | 905 | |
71da9eea AD |
906 | /*--------------. |
907 | | yyerrhandle. | | |
908 | `--------------*/ | |
909 | yyerrhandle: | |
10fa2066 RS |
910 | yyn = yypact[yystate]; |
911 | if (yyn == YYFLAG) | |
912 | goto yyerrdefault; | |
913 | ||
914 | yyn += YYTERROR; | |
915 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
916 | goto yyerrdefault; | |
917 | ||
918 | yyn = yytable[yyn]; | |
919 | if (yyn < 0) | |
920 | { | |
921 | if (yyn == YYFLAG) | |
922 | goto yyerrpop; | |
923 | yyn = -yyn; | |
924 | goto yyreduce; | |
925 | } | |
926 | else if (yyn == 0) | |
927 | goto yyerrpop; | |
928 | ||
929 | if (yyn == YYFINAL) | |
930 | YYACCEPT; | |
931 | ||
5a35a6cb | 932 | YYDPRINTF ((stderr, "Shifting error token, ")); |
10fa2066 | 933 | |
a8289c62 | 934 | *++yyvsp = %%yylval; |
5af1f549 | 935 | #if YYLSP_NEEDED |
10fa2066 RS |
936 | *++yylsp = yylloc; |
937 | #endif | |
938 | ||
939 | yystate = yyn; | |
940 | goto yynewstate; | |
70ddf897 | 941 | |
71da9eea AD |
942 | |
943 | /*-------------------------------------. | |
944 | | yyacceptlab -- YYACCEPT comes here. | | |
945 | `-------------------------------------*/ | |
946 | yyacceptlab: | |
70ddf897 RS |
947 | if (yyfree_stacks) |
948 | { | |
949 | free (yyss); | |
950 | free (yyvs); | |
5af1f549 | 951 | #if YYLSP_NEEDED |
70ddf897 RS |
952 | free (yyls); |
953 | #endif | |
954 | } | |
955 | return 0; | |
956 | ||
71da9eea AD |
957 | |
958 | /*-----------------------------------. | |
959 | | yyabortlab -- YYABORT comes here. | | |
960 | `-----------------------------------*/ | |
961 | yyabortlab: | |
70ddf897 RS |
962 | if (yyfree_stacks) |
963 | { | |
964 | free (yyss); | |
965 | free (yyvs); | |
5af1f549 | 966 | #if YYLSP_NEEDED |
70ddf897 RS |
967 | free (yyls); |
968 | #endif | |
969 | } | |
970 | return 1; | |
10fa2066 | 971 | } |