Commit | Line | Data |
---|---|---|
0de566d7 DM |
1 | /* perly.c |
2 | * | |
3 | * Copyright (c) 2004 Larry Wall | |
4 | * | |
5 | * You may distribute under the terms of either the GNU General Public | |
6 | * License or the Artistic License, as specified in the README file. | |
7 | * | |
8 | * Note that this file was originally generated as an output from | |
9 | * GNU bison version 1.875, but now the code is statically maintained | |
10 | * and edited; the bits that are dependent on perly.y are now #included | |
11 | * from the files perly.tab and perly.act. | |
12 | * | |
13 | * Here is an important copyright statement from the original, generated | |
14 | * file: | |
15 | * | |
16 | * As a special exception, when this file is copied by Bison into a | |
17 | * Bison output file, you may use that output file without | |
18 | * restriction. This special exception was added by the Free | |
19 | * Software Foundation in version 1.24 of Bison. | |
20 | */ | |
21 | ||
22 | ||
23 | /* allow stack size to grow effectively without limit */ | |
24 | #define YYMAXDEPTH 10000000 | |
25 | ||
79072805 | 26 | #include "EXTERN.h" |
864dbfa3 | 27 | #define PERL_IN_PERLY_C |
79072805 | 28 | #include "perl.h" |
09bef843 | 29 | |
0de566d7 DM |
30 | typedef signed char yysigned_char; |
31 | ||
32 | #ifdef DEBUGGING | |
33 | # define YYDEBUG 1 | |
93a17b20 | 34 | #else |
0de566d7 | 35 | # define YYDEBUG 0 |
93a17b20 | 36 | #endif |
09bef843 | 37 | |
0de566d7 DM |
38 | /* contains all the parser state tables; auto-generated from perly.y */ |
39 | #include "perly.tab" | |
40 | ||
41 | # define YYSIZE_T size_t | |
42 | ||
43 | #define yyerrok (yyerrstatus = 0) | |
44 | #define yyclearin (yychar = YYEMPTY) | |
45 | #define YYEMPTY (-2) | |
46 | #define YYEOF 0 | |
47 | ||
48 | #define YYACCEPT goto yyacceptlab | |
49 | #define YYABORT goto yyabortlab | |
50 | #define YYERROR goto yyerrlab1 | |
51 | ||
52 | ||
53 | /* Like YYERROR except do call yyerror. This remains here temporarily | |
54 | to ease the transition to the new meaning of YYERROR, for GCC. | |
55 | Once GCC version 2 has supplanted version 1, this can go. */ | |
56 | ||
57 | #define YYFAIL goto yyerrlab | |
58 | ||
59 | #define YYRECOVERING() (!!yyerrstatus) | |
60 | ||
61 | #define YYBACKUP(Token, Value) \ | |
62 | do \ | |
63 | if (yychar == YYEMPTY && yylen == 1) { \ | |
64 | yychar = (Token); \ | |
65 | yylval = (Value); \ | |
66 | yytoken = YYTRANSLATE (yychar); \ | |
67 | YYPOPSTACK; \ | |
68 | goto yybackup; \ | |
69 | } \ | |
70 | else { \ | |
71 | yyerror ("syntax error: cannot back up"); \ | |
72 | YYERROR; \ | |
73 | } \ | |
74 | while (0) | |
75 | ||
76 | #define YYTERROR 1 | |
77 | #define YYERRCODE 256 | |
78 | ||
79 | /* YYLEX -- calling `yylex' with the right arguments. */ | |
80 | ||
81 | # define YYLEX yylex_r (&yylval, &yychar) | |
82 | ||
83 | /* Enable debugging if requested. */ | |
9388183f | 84 | #ifdef DEBUGGING |
0de566d7 DM |
85 | |
86 | # define yydebug (DEBUG_p_TEST) | |
87 | ||
88 | # define YYFPRINTF PerlIO_printf | |
89 | ||
90 | # define YYDPRINTF(Args) \ | |
91 | do { \ | |
92 | if (yydebug) \ | |
93 | YYFPRINTF Args; \ | |
94 | } while (0) | |
95 | ||
96 | # define YYDSYMPRINT(Args) \ | |
97 | do { \ | |
98 | if (yydebug) \ | |
99 | yysymprint Args; \ | |
100 | } while (0) | |
101 | ||
9388183f | 102 | # define YYDSYMPRINTF(Title, Token, Value) \ |
0de566d7 DM |
103 | do { \ |
104 | if (yydebug) { \ | |
105 | YYFPRINTF (Perl_debug_log, "%s ", Title); \ | |
9388183f | 106 | yysymprint (aTHX_ Perl_debug_log, Token, Value); \ |
0de566d7 DM |
107 | YYFPRINTF (Perl_debug_log, "\n"); \ |
108 | } \ | |
109 | } while (0) | |
110 | ||
111 | /*--------------------------------. | |
112 | | Print this symbol on YYOUTPUT. | | |
113 | `--------------------------------*/ | |
114 | ||
115 | static void | |
116 | yysymprint (pTHX_ PerlIO *yyoutput, int yytype, YYSTYPE *yyvaluep) | |
117 | { | |
118 | /* Pacify ``unused variable'' warnings. */ | |
119 | (void) yyvaluep; | |
120 | ||
121 | if (yytype < YYNTOKENS) { | |
122 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | |
123 | # ifdef YYPRINT | |
124 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | |
9388183f CB |
125 | # else |
126 | YYFPRINTF (yyoutput, "0x%x", yyvaluep->ival); | |
0de566d7 DM |
127 | # endif |
128 | } | |
129 | else | |
130 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | |
131 | ||
132 | switch (yytype) { | |
133 | default: | |
134 | break; | |
135 | } | |
136 | YYFPRINTF (yyoutput, ")"); | |
137 | } | |
138 | ||
139 | ||
9388183f CB |
140 | /* yy_stack_print() |
141 | * print the top 8 items on the parse stack. The args have the same | |
142 | * meanings as the local vars in yyparse() of the same name */ | |
0de566d7 DM |
143 | |
144 | static void | |
9388183f | 145 | yy_stack_print (pTHX_ short *yyss, short *yyssp, YYSTYPE *yyvs, char**yyns) |
0de566d7 | 146 | { |
9388183f CB |
147 | int i; |
148 | int start = 1; | |
149 | int count = (int)(yyssp - yyss); | |
150 | ||
151 | if (count > 8) { | |
152 | start = count - 8 + 1; | |
153 | count = 8; | |
154 | } | |
155 | ||
156 | PerlIO_printf(Perl_debug_log, "\nindex:"); | |
157 | for (i=0; i < count; i++) | |
158 | PerlIO_printf(Perl_debug_log, " %8d", start+i); | |
159 | PerlIO_printf(Perl_debug_log, "\nstate:"); | |
160 | for (i=0, yyss += start; i < count; i++, yyss++) | |
161 | PerlIO_printf(Perl_debug_log, " %8d", *yyss); | |
162 | PerlIO_printf(Perl_debug_log, "\ntoken:"); | |
163 | for (i=0, yyns += start; i < count; i++, yyns++) | |
164 | PerlIO_printf(Perl_debug_log, " %8.8s", *yyns); | |
165 | PerlIO_printf(Perl_debug_log, "\nvalue:"); | |
166 | for (i=0, yyvs += start; i < count; i++, yyvs++) | |
167 | PerlIO_printf(Perl_debug_log, " %8x", yyvs->ival); | |
168 | PerlIO_printf(Perl_debug_log, "\n\n"); | |
0de566d7 DM |
169 | } |
170 | ||
9388183f | 171 | # define YY_STACK_PRINT(yyss, yyssp, yyvs, yyns) \ |
0de566d7 | 172 | do { \ |
9388183f CB |
173 | if (yydebug && DEBUG_v_TEST) \ |
174 | yy_stack_print (aTHX_ (yyss), (yyssp), (yyvs), (yyns)); \ | |
0de566d7 DM |
175 | } while (0) |
176 | ||
09bef843 | 177 | |
0de566d7 DM |
178 | /*------------------------------------------------. |
179 | | Report that the YYRULE is going to be reduced. | | |
180 | `------------------------------------------------*/ | |
181 | ||
182 | static void | |
183 | yy_reduce_print (pTHX_ int yyrule) | |
184 | { | |
185 | int yyi; | |
186 | unsigned int yylineno = yyrline[yyrule]; | |
187 | YYFPRINTF (Perl_debug_log, "Reducing stack by rule %d (line %u), ", | |
188 | yyrule - 1, yylineno); | |
189 | /* Print the symbols being reduced, and their result. */ | |
190 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | |
191 | YYFPRINTF (Perl_debug_log, "%s ", yytname [yyrhs[yyi]]); | |
192 | YYFPRINTF (Perl_debug_log, "-> %s\n", yytname [yyr1[yyrule]]); | |
193 | } | |
194 | ||
195 | # define YY_REDUCE_PRINT(Rule) \ | |
196 | do { \ | |
197 | if (yydebug) \ | |
198 | yy_reduce_print (aTHX_ Rule); \ | |
199 | } while (0) | |
200 | ||
201 | #else /* !DEBUGGING */ | |
202 | # define YYDPRINTF(Args) | |
203 | # define YYDSYMPRINT(Args) | |
9388183f CB |
204 | # define YYDSYMPRINTF(Title, Token, Value) |
205 | # define YY_STACK_PRINT(yyss, yyssp, yyvs, yyns) | |
0de566d7 DM |
206 | # define YY_REDUCE_PRINT(Rule) |
207 | #endif /* !DEBUGGING */ | |
208 | ||
209 | ||
210 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
211 | #ifndef YYINITDEPTH | |
212 | # define YYINITDEPTH 200 | |
09bef843 | 213 | #endif |
09bef843 | 214 | |
0de566d7 DM |
215 | |
216 | #if YYERROR_VERBOSE | |
217 | # ifndef yystrlen | |
218 | # if defined (__GLIBC__) && defined (_STRING_H) | |
219 | # define yystrlen strlen | |
220 | # else | |
221 | /* Return the length of YYSTR. */ | |
222 | static YYSIZE_T | |
223 | yystrlen (const char *yystr) | |
224 | { | |
225 | register const char *yys = yystr; | |
226 | ||
227 | while (*yys++ != '\0') | |
228 | continue; | |
229 | ||
230 | return yys - yystr - 1; | |
231 | } | |
232 | # endif | |
233 | # endif | |
234 | ||
235 | # ifndef yystpcpy | |
236 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | |
237 | # define yystpcpy stpcpy | |
238 | # else | |
239 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
240 | YYDEST. */ | |
241 | static char * | |
242 | yystpcpy (pTHX_ char *yydest, const char *yysrc) | |
243 | { | |
244 | register char *yyd = yydest; | |
245 | register const char *yys = yysrc; | |
246 | ||
247 | while ((*yyd++ = *yys++) != '\0') | |
248 | continue; | |
249 | ||
250 | return yyd - 1; | |
251 | } | |
252 | # endif | |
253 | # endif | |
254 | ||
255 | #endif /* !YYERROR_VERBOSE */ | |
256 | ||
257 | ||
258 | /*-----------------------------------------------. | |
259 | | Release the memory associated to this symbol. | | |
260 | `-----------------------------------------------*/ | |
261 | ||
262 | static void | |
263 | yydestruct (int yytype, YYSTYPE *yyvaluep) | |
264 | { | |
265 | /* Pacify ``unused variable'' warnings. */ | |
266 | (void) yyvaluep; | |
267 | ||
268 | switch (yytype) { | |
269 | default: | |
270 | break; | |
271 | } | |
272 | } | |
273 | ||
274 | ||
275 | ||
276 | ||
277 | /*----------. | |
278 | | yyparse. | | |
279 | `----------*/ | |
280 | ||
79072805 | 281 | int |
0de566d7 | 282 | Perl_yyparse (pTHX) |
79072805 | 283 | { |
0de566d7 DM |
284 | int yychar; /* The lookahead symbol. */ |
285 | YYSTYPE yylval; /* The semantic value of the lookahead symbol. */ | |
286 | int yynerrs; /* Number of syntax errors so far. */ | |
287 | register int yystate; | |
288 | register int yyn; | |
289 | int yyresult; | |
290 | ||
291 | /* Number of tokens to shift before error messages enabled. */ | |
292 | int yyerrstatus; | |
293 | /* Lookahead token as an internal (translated) token number. */ | |
294 | int yytoken = 0; | |
295 | ||
296 | /* two stacks and their tools: | |
297 | `yyss': related to states, | |
298 | `yyvs': related to semantic values, | |
299 | ||
300 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
301 | to reallocate them elsewhere. */ | |
302 | ||
303 | /* The state stack. */ | |
304 | short *yyss; | |
93a17b20 | 305 | register short *yyssp; |
0de566d7 DM |
306 | |
307 | /* The semantic value stack. */ | |
308 | YYSTYPE *yyvs; | |
93a17b20 | 309 | register YYSTYPE *yyvsp; |
a0d0e21e | 310 | |
0de566d7 DM |
311 | /* for ease of re-allocation and automatic freeing, have two SVs whose |
312 | * SvPVX points to the stacks */ | |
313 | SV *yyss_sv, *yyvs_sv; | |
314 | ||
9388183f CB |
315 | #ifdef DEBUGGING |
316 | /* maintain also a stack of token/rule names for debugging with -Dpv */ | |
317 | char **yyns, **yynsp; | |
318 | SV *yyns_sv; | |
319 | # define YYPOPSTACK (yyvsp--, yyssp--, yynsp--) | |
320 | #else | |
321 | # define YYPOPSTACK (yyvsp--, yyssp--) | |
322 | #endif | |
323 | ||
0de566d7 DM |
324 | |
325 | YYSIZE_T yystacksize = YYINITDEPTH; | |
326 | ||
327 | /* The variables used to return semantic value and location from the | |
328 | action routines. */ | |
329 | YYSTYPE yyval; | |
330 | ||
331 | ||
332 | /* When reducing, the number of symbols on the RHS of the reduced | |
333 | rule. */ | |
334 | int yylen; | |
335 | ||
336 | YYDPRINTF ((Perl_debug_log, "Starting parse\n")); | |
337 | ||
f4dd75d9 | 338 | #ifdef USE_ITHREADS |
0de566d7 DM |
339 | /* XXX is this needed anymore? DAPM 13-Feb-04; |
340 | * if not, delete the correspinding LEAVE too */ | |
341 | ENTER; /* force stack free before we return */ | |
93a17b20 | 342 | #endif |
9388183f CB |
343 | yyss_sv = NEWSV(73, YYINITDEPTH * sizeof(short)); |
344 | yyvs_sv = NEWSV(73, YYINITDEPTH * sizeof(YYSTYPE)); | |
0de566d7 DM |
345 | SAVEFREESV(yyss_sv); |
346 | SAVEFREESV(yyvs_sv); | |
347 | yyss = (short *) SvPVX(yyss_sv); | |
348 | yyvs = (YYSTYPE *) SvPVX(yyvs_sv); | |
9388183f CB |
349 | /* note that elements zero of yyvs and yyns are not used */ |
350 | yyssp = yyss; | |
351 | yyvsp = yyvs; | |
352 | #ifdef DEBUGGING | |
353 | yyns_sv = NEWSV(73, YYINITDEPTH * sizeof(char *)); | |
354 | SAVEFREESV(yyns_sv); | |
355 | yyns = (char **) SvPVX(yyns_sv); | |
356 | yynsp = yyns; | |
357 | #endif | |
79072805 | 358 | |
0de566d7 DM |
359 | yystate = 0; |
360 | yyerrstatus = 0; | |
93a17b20 | 361 | yynerrs = 0; |
0de566d7 DM |
362 | yychar = YYEMPTY; /* Cause a token to be read. */ |
363 | ||
79072805 | 364 | |
9388183f CB |
365 | |
366 | YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate)); | |
0de566d7 DM |
367 | |
368 | goto yysetstate; | |
369 | ||
370 | /*------------------------------------------------------------. | |
371 | | yynewstate -- Push a new state, which is found in yystate. | | |
372 | `------------------------------------------------------------*/ | |
373 | yynewstate: | |
374 | /* In all cases, when you get here, the value and location stacks | |
375 | have just been pushed. so pushing a state here evens the stacks. | |
376 | */ | |
377 | yyssp++; | |
378 | ||
379 | yysetstate: | |
380 | *yyssp = yystate; | |
381 | ||
382 | if (yyss + yystacksize - 1 <= yyssp) { | |
383 | /* Get the current used size of the three stacks, in elements. */ | |
384 | YYSIZE_T yysize = yyssp - yyss + 1; | |
385 | ||
386 | /* Extend the stack our own way. */ | |
387 | if (YYMAXDEPTH <= yystacksize) | |
388 | goto yyoverflowlab; | |
389 | yystacksize *= 2; | |
390 | if (YYMAXDEPTH < yystacksize) | |
391 | yystacksize = YYMAXDEPTH; | |
392 | ||
393 | SvGROW(yyss_sv, yystacksize * sizeof(short)); | |
394 | SvGROW(yyvs_sv, yystacksize * sizeof(YYSTYPE)); | |
395 | yyss = (short *) SvPVX(yyss_sv); | |
396 | yyvs = (YYSTYPE *) SvPVX(yyvs_sv); | |
9388183f CB |
397 | #ifdef DEBUGGING |
398 | SvGROW(yyns_sv, yystacksize * sizeof(char *)); | |
399 | yyns = (char **) SvPVX(yyns_sv); | |
400 | if (! yyns) | |
401 | goto yyoverflowlab; | |
402 | yynsp = yyns + yysize - 1; | |
403 | #endif | |
0de566d7 DM |
404 | if (!yyss || ! yyvs) |
405 | goto yyoverflowlab; | |
406 | ||
407 | yyssp = yyss + yysize - 1; | |
408 | yyvsp = yyvs + yysize - 1; | |
409 | ||
410 | ||
411 | YYDPRINTF ((Perl_debug_log, "Stack size increased to %lu\n", | |
412 | (unsigned long int) yystacksize)); | |
413 | ||
414 | if (yyss + yystacksize - 1 <= yyssp) | |
415 | YYABORT; | |
93a17b20 | 416 | } |
0de566d7 | 417 | |
0de566d7 DM |
418 | goto yybackup; |
419 | ||
420 | /*-----------. | |
421 | | yybackup. | | |
422 | `-----------*/ | |
423 | yybackup: | |
424 | ||
425 | /* Do appropriate processing given the current state. */ | |
426 | /* Read a lookahead token if we need one and don't already have one. */ | |
427 | /* yyresume: */ | |
428 | ||
429 | /* First try to decide what to do without reference to lookahead token. */ | |
430 | ||
431 | yyn = yypact[yystate]; | |
432 | if (yyn == YYPACT_NINF) | |
433 | goto yydefault; | |
434 | ||
435 | /* Not known => get a lookahead token if don't already have one. */ | |
436 | ||
437 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | |
438 | if (yychar == YYEMPTY) { | |
439 | YYDPRINTF ((Perl_debug_log, "Reading a token: ")); | |
440 | yychar = YYLEX; | |
441 | } | |
442 | ||
443 | if (yychar <= YYEOF) { | |
444 | yychar = yytoken = YYEOF; | |
445 | YYDPRINTF ((Perl_debug_log, "Now at end of input.\n")); | |
93a17b20 | 446 | } |
0de566d7 DM |
447 | else { |
448 | yytoken = YYTRANSLATE (yychar); | |
9388183f | 449 | YYDSYMPRINTF ("Next token is", yytoken, &yylval); |
93a17b20 | 450 | } |
771df094 | 451 | |
0de566d7 DM |
452 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
453 | detect an error, take that action. */ | |
454 | yyn += yytoken; | |
455 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | |
456 | goto yydefault; | |
457 | yyn = yytable[yyn]; | |
458 | if (yyn <= 0) { | |
459 | if (yyn == 0 || yyn == YYTABLE_NINF) | |
460 | goto yyerrlab; | |
461 | yyn = -yyn; | |
462 | goto yyreduce; | |
463 | } | |
7b57b0ea | 464 | |
0de566d7 DM |
465 | if (yyn == YYFINAL) |
466 | YYACCEPT; | |
771df094 | 467 | |
0de566d7 DM |
468 | /* Shift the lookahead token. */ |
469 | YYDPRINTF ((Perl_debug_log, "Shifting token %s, ", yytname[yytoken])); | |
470 | ||
471 | /* Discard the token being shifted unless it is eof. */ | |
472 | if (yychar != YYEOF) | |
473 | yychar = YYEMPTY; | |
474 | ||
475 | *++yyvsp = yylval; | |
9388183f CB |
476 | #ifdef DEBUGGING |
477 | *++yynsp = (char *)(yytname[yytoken]); | |
478 | #endif | |
0de566d7 DM |
479 | |
480 | ||
481 | /* Count tokens shifted since error; after three, turn off error | |
482 | status. */ | |
483 | if (yyerrstatus) | |
484 | yyerrstatus--; | |
485 | ||
486 | yystate = yyn; | |
9388183f CB |
487 | YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate)); |
488 | ||
0de566d7 DM |
489 | goto yynewstate; |
490 | ||
491 | ||
492 | /*-----------------------------------------------------------. | |
493 | | yydefault -- do the default action for the current state. | | |
494 | `-----------------------------------------------------------*/ | |
495 | yydefault: | |
496 | yyn = yydefact[yystate]; | |
497 | if (yyn == 0) | |
498 | goto yyerrlab; | |
499 | goto yyreduce; | |
500 | ||
501 | ||
502 | /*-----------------------------. | |
503 | | yyreduce -- Do a reduction. | | |
504 | `-----------------------------*/ | |
505 | yyreduce: | |
506 | /* yyn is the number of a rule to reduce with. */ | |
507 | yylen = yyr2[yyn]; | |
508 | ||
509 | /* If YYLEN is nonzero, implement the default value of the action: | |
510 | `$$ = $1'. | |
511 | ||
512 | Otherwise, the following line sets YYVAL to garbage. | |
513 | This behavior is undocumented and Bison | |
514 | users should not rely upon it. Assigning to YYVAL | |
515 | unconditionally makes the parser a bit smaller, and it avoids a | |
516 | GCC warning that YYVAL may be used uninitialized. */ | |
517 | yyval = yyvsp[1-yylen]; | |
518 | ||
519 | ||
520 | YY_REDUCE_PRINT (yyn); | |
521 | switch (yyn) { | |
522 | ||
523 | /* contains all the rule actions; auto-generated from perly.y */ | |
524 | ||
525 | #define dep() deprecate("\"do\" to call subroutines") | |
526 | #include "perly.act" | |
7b57b0ea | 527 | |
93a17b20 | 528 | } |
0de566d7 DM |
529 | |
530 | yyvsp -= yylen; | |
531 | yyssp -= yylen; | |
9388183f CB |
532 | #ifdef DEBUGGING |
533 | yynsp -= yylen; | |
534 | #endif | |
0de566d7 | 535 | |
0de566d7 DM |
536 | |
537 | *++yyvsp = yyval; | |
9388183f CB |
538 | #ifdef DEBUGGING |
539 | *++yynsp = (char *)(yytname [yyr1[yyn]]); | |
540 | #endif | |
0de566d7 DM |
541 | |
542 | /* Now `shift' the result of the reduction. Determine what state | |
543 | that goes to, based on the state we popped back to and the rule | |
544 | number reduced by. */ | |
545 | ||
546 | yyn = yyr1[yyn]; | |
547 | ||
548 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | |
549 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
550 | yystate = yytable[yystate]; | |
93a17b20 | 551 | else |
0de566d7 DM |
552 | yystate = yydefgoto[yyn - YYNTOKENS]; |
553 | ||
9388183f CB |
554 | YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate)); |
555 | ||
556 | #ifdef DEBUGGING | |
557 | /* tmp push yystate for stack print; this is normally pushed later in | |
558 | * yynewstate */ | |
559 | yyssp++; | |
560 | *yyssp = yystate; | |
561 | YY_STACK_PRINT (yyss, yyssp, yyvs, yyns); | |
562 | yyssp--; | |
563 | #endif | |
564 | ||
0de566d7 DM |
565 | goto yynewstate; |
566 | ||
567 | ||
568 | /*------------------------------------. | |
569 | | yyerrlab -- here on detecting error | | |
570 | `------------------------------------*/ | |
571 | yyerrlab: | |
572 | /* If not already recovering from an error, report this error. */ | |
573 | if (!yyerrstatus) { | |
574 | ++yynerrs; | |
575 | #if YYERROR_VERBOSE | |
576 | yyn = yypact[yystate]; | |
577 | ||
578 | if (YYPACT_NINF < yyn && yyn < YYLAST) { | |
579 | YYSIZE_T yysize = 0; | |
580 | int yytype = YYTRANSLATE (yychar); | |
581 | char *yymsg; | |
582 | int yyx, yycount; | |
583 | ||
584 | yycount = 0; | |
585 | /* Start YYX at -YYN if negative to avoid negative indexes in | |
586 | YYCHECK. */ | |
587 | for (yyx = yyn < 0 ? -yyn : 0; | |
588 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) | |
589 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | |
590 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; | |
591 | yysize += yystrlen ("syntax error, unexpected ") + 1; | |
592 | yysize += yystrlen (yytname[yytype]); | |
593 | New(yymsg, yysize, char *); | |
594 | if (yymsg != 0) { | |
595 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); | |
596 | yyp = yystpcpy (yyp, yytname[yytype]); | |
597 | ||
598 | if (yycount < 5) { | |
599 | yycount = 0; | |
600 | for (yyx = yyn < 0 ? -yyn : 0; | |
601 | yyx < (int) (sizeof (yytname) / sizeof (char *)); | |
602 | yyx++) | |
603 | { | |
604 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { | |
605 | const char *yyq = ! yycount ? | |
606 | ", expecting " : " or "; | |
607 | yyp = yystpcpy (yyp, yyq); | |
608 | yyp = yystpcpy (yyp, yytname[yyx]); | |
609 | yycount++; | |
610 | } | |
611 | } | |
ecb2f335 | 612 | } |
0de566d7 DM |
613 | yyerror (yymsg); |
614 | YYSTACK_FREE (yymsg); | |
615 | } | |
616 | else | |
617 | yyerror ("syntax error; also virtual memory exhausted"); | |
618 | } | |
619 | else | |
620 | #endif /* YYERROR_VERBOSE */ | |
621 | yyerror ("syntax error"); | |
93a17b20 | 622 | } |
0de566d7 DM |
623 | |
624 | ||
625 | if (yyerrstatus == 3) { | |
626 | /* If just tried and failed to reuse lookahead token after an | |
627 | error, discard it. */ | |
628 | ||
629 | /* Return failure if at end of input. */ | |
630 | if (yychar == YYEOF) { | |
631 | /* Pop the error token. */ | |
632 | YYPOPSTACK; | |
633 | /* Pop the rest of the stack. */ | |
634 | while (yyss < yyssp) { | |
9388183f | 635 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp); |
0de566d7 DM |
636 | yydestruct (yystos[*yyssp], yyvsp); |
637 | YYPOPSTACK; | |
638 | } | |
639 | YYABORT; | |
640 | } | |
641 | ||
9388183f | 642 | YYDSYMPRINTF ("Error: discarding", yytoken, &yylval); |
0de566d7 DM |
643 | yydestruct (yytoken, &yylval); |
644 | yychar = YYEMPTY; | |
645 | ||
93a17b20 | 646 | } |
0de566d7 DM |
647 | |
648 | /* Else will try to reuse lookahead token after shifting the error | |
649 | token. */ | |
650 | goto yyerrlab1; | |
651 | ||
652 | ||
653 | /*----------------------------------------------------. | |
654 | | yyerrlab1 -- error raised explicitly by an action. | | |
655 | `----------------------------------------------------*/ | |
656 | yyerrlab1: | |
657 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | |
658 | ||
659 | for (;;) { | |
660 | yyn = yypact[yystate]; | |
661 | if (yyn != YYPACT_NINF) { | |
662 | yyn += YYTERROR; | |
663 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { | |
664 | yyn = yytable[yyn]; | |
665 | if (0 < yyn) | |
666 | break; | |
667 | } | |
668 | } | |
669 | ||
670 | /* Pop the current state because it cannot handle the error token. */ | |
671 | if (yyssp == yyss) | |
672 | YYABORT; | |
673 | ||
9388183f | 674 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp); |
0de566d7 DM |
675 | yydestruct (yystos[yystate], yyvsp); |
676 | yyvsp--; | |
9388183f CB |
677 | #ifdef DEBUGGING |
678 | yynsp--; | |
679 | #endif | |
0de566d7 DM |
680 | yystate = *--yyssp; |
681 | ||
9388183f | 682 | YY_STACK_PRINT (yyss, yyssp, yyvs, yyns); |
93a17b20 | 683 | } |
0de566d7 DM |
684 | |
685 | if (yyn == YYFINAL) | |
686 | YYACCEPT; | |
687 | ||
688 | YYDPRINTF ((Perl_debug_log, "Shifting error token, ")); | |
689 | ||
690 | *++yyvsp = yylval; | |
9388183f CB |
691 | #ifdef DEBUGGING |
692 | *++yynsp ="<err>"; | |
693 | #endif | |
0de566d7 DM |
694 | |
695 | yystate = yyn; | |
9388183f CB |
696 | YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate)); |
697 | ||
0de566d7 DM |
698 | goto yynewstate; |
699 | ||
700 | ||
701 | /*-------------------------------------. | |
702 | | yyacceptlab -- YYACCEPT comes here. | | |
703 | `-------------------------------------*/ | |
704 | yyacceptlab: | |
705 | yyresult = 0; | |
706 | goto yyreturn; | |
707 | ||
708 | /*-----------------------------------. | |
709 | | yyabortlab -- YYABORT comes here. | | |
710 | `-----------------------------------*/ | |
711 | yyabortlab: | |
712 | yyresult = 1; | |
713 | goto yyreturn; | |
714 | ||
715 | /*----------------------------------------------. | |
716 | | yyoverflowlab -- parser overflow comes here. | | |
717 | `----------------------------------------------*/ | |
718 | yyoverflowlab: | |
719 | yyerror ("parser stack overflow"); | |
720 | yyresult = 2; | |
721 | /* Fall through. */ | |
722 | ||
723 | yyreturn: | |
724 | ||
f4dd75d9 | 725 | #ifdef USE_ITHREADS |
0de566d7 | 726 | LEAVE; /* force stack free before we return */ |
f4dd75d9 | 727 | #endif |
e1f15930 | 728 | |
0de566d7 | 729 | return yyresult; |
e1f15930 | 730 | } |