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