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