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