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