Debian Codegraph @

documentation/manual/algorithm/demos/rr1.tab.c

raw
1 /* A Bison parser, made from rr1, by GNU bison 1.75. */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
25
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36 /* Identify Bison output. */
37 #define YYBISON 1
38
39 /* Pure parsers. */
40 #define YYPURE 0
41
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
44
45
46
47 /* Tokens. */
48 #ifndef YYTOKENTYPE
49 # define YYTOKENTYPE
50 /* Put the tokens into the symbol table, so that GDB and other debuggers
51 know about them. */
52 enum yytokentype {
53 WORD = 258
54 };
55 #endif
56 #define WORD 258
57
58
59
60
61 /* Copy the first part of user declarations. */
62 #line 1 "rr1"
63
64 #define YYSSTYPE char *
65
66
67 /* Enabling traces. */
68 #ifndef YYDEBUG
69 # define YYDEBUG 0
70 #endif
71
72 /* Enabling verbose error messages. */
73 #ifdef YYERROR_VERBOSE
74 # undef YYERROR_VERBOSE
75 # define YYERROR_VERBOSE 1
76 #else
77 # define YYERROR_VERBOSE 0
78 #endif
79
80 #ifndef YYSTYPE
81 typedef int yystype;
82 # define YYSTYPE yystype
83 # define YYSTYPE_IS_TRIVIAL 1
84 #endif
85
86 #ifndef YYLTYPE
87 typedef struct yyltype
88 {
89 int first_line;
90 int first_column;
91 int last_line;
92 int last_column;
93 } yyltype;
94 # define YYLTYPE yyltype
95 # define YYLTYPE_IS_TRIVIAL 1
96 #endif
97
98 /* Copy the second part of user declarations. */
99
100
101 /* Line 213 of /usr/share/bison/yacc.c. */
102 #line 103 "rr1.tab.c"
103
104 #if ! defined (yyoverflow) || YYERROR_VERBOSE
105
106 /* The parser invokes alloca or malloc; define the necessary symbols. */
107
108 # if YYSTACK_USE_ALLOCA
109 # define YYSTACK_ALLOC alloca
110 # else
111 # ifndef YYSTACK_USE_ALLOCA
112 # if defined (alloca) || defined (_ALLOCA_H)
113 # define YYSTACK_ALLOC alloca
114 # else
115 # ifdef _GNUC_
116 # define YYSTACK_ALLOC _builtin_alloca
117 # endif
118 # endif
119 # endif
120 # endif
121
122 # ifdef YYSTACK_ALLOC
123 /* Pacify GCC's `empty if-body' warning. */
124 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
125 # else
126 # if defined (_STDC_) || defined (_cplusplus)
127 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
128 # define YYSIZE_T size_t
129 # endif
130 # define YYSTACK_ALLOC malloc
131 # define YYSTACK_FREE free
132 # endif
133 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
134
135
136 #if (! defined (yyoverflow) \
137 && (! defined (_cplusplus) \
138 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
139
140 /* A type that is properly aligned for any stack member. */
141 union yyalloc
142 {
143 short yyss;
144 YYSTYPE yyvs;
145 };
146
147 /* The size of the maximum gap between one aligned stack and the next. */
148 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
149
150 /* The size of an array large to enough to hold all stacks, each with
151 N elements. */
152 # define YYSTACK_BYTES(N) \
153 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
154 + YYSTACK_GAP_MAX)
155
156 /* Copy COUNT objects from FROM to TO. The source and destination do
157 not overlap. */
158 # ifndef YYCOPY
159 # if 1 < _GNUC_
160 # define YYCOPY(To, From, Count) \
161 _builtin_memcpy (To, From, (Count) * sizeof (*(From)))
162 # else
163 # define YYCOPY(To, From, Count) \
164 do \
165 { \
166 register YYSIZE_T yyi; \
167 for (yyi = 0; yyi < (Count); yyi++) \
168 (To)[yyi] = (From)[yyi]; \
169 } \
170 while (0)
171 # endif
172 # endif
173
174 /* Relocate STACK from its old location to the new one. The
175 local variables YYSIZE and YYSTACKSIZE give the old and new number of
176 elements in the stack, and YYPTR gives the new location of the
177 stack. Advance YYPTR to a properly aligned location for the next
178 stack. */
179 # define YYSTACK_RELOCATE(Stack) \
180 do \
181 { \
182 YYSIZE_T yynewbytes; \
183 YYCOPY (&yyptr->Stack, Stack, yysize); \
184 Stack = &yyptr->Stack; \
185 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
186 yyptr += yynewbytes / sizeof (*yyptr); \
187 } \
188 while (0)
189
190 #endif
191
192 #if defined (_STDC_) || defined (_cplusplus)
193 typedef signed char yysigned_char;
194 #else
195 typedef short yysigned_char;
196 #endif
197
198 /* YYFINAL -- State number of the termination state. */
199 #define YYFINAL 4
200 #define YYLAST 3
201
202 /* YYNTOKENS -- Number of terminals. */
203 #define YYNTOKENS 4
204 /* YYNNTS -- Number of nonterminals. */
205 #define YYNNTS 3
206 /* YYNRULES -- Number of rules. */
207 #define YYNRULES 6
208 /* YYNRULES -- Number of states. */
209 #define YYNSTATES 6
210
211 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
212 #define YYUNDEFTOK 2
213 #define YYMAXUTOK 258
214
215 #define YYTRANSLATE(X) \
216 ((size_t)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
217
218 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
219 static const size_t char yytranslate[] =
220 {
221 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
222 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
223 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
224 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
225 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
226 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
227 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
228 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
229 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
230 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
231 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
232 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
233 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
234 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
235 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
236 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
237 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
238 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
239 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
240 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
241 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
242 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
243 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
244 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
245 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
246 2, 2, 2, 2, 2, 2, 1, 2, 3
247 };
248
249 #if YYDEBUG
250 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
251 YYRHS. */
252 static const size_t char yyprhs[] =
253 {
254 0, 0, 3, 4, 6, 9, 10
255 };
256
257 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
258 static const yysigned_char yyrhs[] =
259 {
260 5, 0, -1, -1, 6, -1, 5, 3, -1, -1,
261 3, -1
262 };
263
264 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
265 static const size_t char yyrline[] =
266 {
267 0, 9, 9, 14, 16, 23, 28
268 };
269 #endif
270
271 #if YYDEBUG || YYERROR_VERBOSE
272 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
273 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
274 static const char *const yytname[] =
275 {
276 "$end", "error", "$undefined", "WORD", "$accept", "sequence", "maybeword", 0
277 };
278 #endif
279
280 # ifdef YYPRINT
281 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
282 token YYLEX-NUM. */
283 static const size_t short yytoknum[] =
284 {
285 0, 256, 257, 258
286 };
287 # endif
288
289 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
290 static const size_t char yyr1[] =
291 {
292 0, 4, 5, 5, 5, 6, 6
293 };
294
295 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
296 static const size_t char yyr2[] =
297 {
298 0, 2, 0, 1, 2, 0, 1
299 };
300
301 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
302 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
303 means the default is an error. */
304 static const size_t char yydefact[] =
305 {
306 2, 6, 0, 3, 1, 4
307 };
308
309 /* YYDEFGOTO[NTERM-NUM]. */
310 static const yysigned_char yydefgoto[] =
311 {
312 -1, 2, 3
313 };
314
315 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
316 STATE-NUM. */
317 #define YYPACT_NINF -3
318 static const yysigned_char yypact[] =
319 {
320 -2, -3, 0, -3, -3, -3
321 };
322
323 /* YYPGOTO[NTERM-NUM]. */
324 static const yysigned_char yypgoto[] =
325 {
326 -3, -3, -3
327 };
328
329 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
330 positive, shift that token. If negative, reduce the rule which
331 number is the opposite. If zero, do what YYDEFACT says.
332 If YYTABLE_NINF, parse error. */
333 #define YYTABLE_NINF -1
334 static const size_t char yytable[] =
335 {
336 4, 1, 0, 5
337 };
338
339 static const yysigned_char yycheck[] =
340 {
341 0, 3, -1, 3
342 };
343
344 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
345 symbol of state STATE-NUM. */
346 static const size_t char yystos[] =
347 {
348 0, 3, 5, 6, 0, 3
349 };
350
351 #if ! defined (YYSIZE_T) && defined (_SIZE_TYPE_)
352 # define YYSIZE_T _SIZE_TYPE_
353 #endif
354 #if ! defined (YYSIZE_T) && defined (size_t)
355 # define YYSIZE_T size_t
356 #endif
357 #if ! defined (YYSIZE_T)
358 # if defined (_STDC_) || defined (_cplusplus)
359 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
360 # define YYSIZE_T size_t
361 # endif
362 #endif
363 #if ! defined (YYSIZE_T)
364 # define YYSIZE_T size_t int
365 #endif
366
367 #define yyerrok (yyerrstatus = 0)
368 #define yyclearin (yychar = YYEMPTY)
369 #define YYEMPTY -2
370 #define YYEOF 0
371
372 #define YYACCEPT goto yyacceptlab
373 #define YYABORT goto yyabortlab
374 #define YYERROR goto yyerrlab1
375
376 /* Like YYERROR except do call yyerror. This remains here temporarily
377 to ease the transition to the new meaning of YYERROR, for GCC.
378 Once GCC version 2 has supplanted version 1, this can go. */
379
380 #define YYFAIL goto yyerrlab
381
382 #define YYRECOVERING() (!!yyerrstatus)
383
384 #define YYBACKUP(Token, Value) \
385 do \
386 if (yychar == YYEMPTY && yylen == 1) \
387 { \
388 yychar = (Token); \
389 yylval = (Value); \
390 yychar1 = YYTRANSLATE (yychar); \
391 YYPOPSTACK; \
392 goto yybackup; \
393 } \
394 else \
395 { \
396 yyerror ("syntax error: cannot back up"); \
397 YYERROR; \
398 } \
399 while (0)
400
401 #define YYTERROR 1
402 #define YYERRCODE 256
403
404 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
405 are run). */
406
407 #ifndef YYLLOC_DEFAULT
408 # define YYLLOC_DEFAULT(Current, Rhs, N) \
409 Current.first_line = Rhs[1].first_line; \
410 Current.first_column = Rhs[1].first_column; \
411 Current.last_line = Rhs[N].last_line; \
412 Current.last_column = Rhs[N].last_column;
413 #endif
414
415 /* YYLEX -- calling `yylex' with the right arguments. */
416
417 #define YYLEX yylex ()
418
419 /* Enable debugging if requested. */
420 #if YYDEBUG
421
422 # ifndef YYFPRINTF
423 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
424 # define YYFPRINTF fprintf
425 # endif
426
427 # define YYDPRINTF(Args) \
428 do { \
429 if (yydebug) \
430 YYFPRINTF Args; \
431 } while (0)
432 # define YYDSYMPRINT(Args) \
433 do { \
434 if (yydebug) \
435 yysymprint Args; \
436 } while (0)
437 /* Nonzero means print parse trace. It is left uninitialized so that
438 multiple parsers can coexist. */
439 int yydebug;
440 #else /* !YYDEBUG */
441 # define YYDPRINTF(Args)
442 # define YYDSYMPRINT(Args)
443 #endif /* !YYDEBUG */
444
445 /* YYINITDEPTH -- initial size of the parser's stacks. */
446 #ifndef YYINITDEPTH
447 # define YYINITDEPTH 200
448 #endif
449
450 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
451 if the built-in stack extension method is used).
452
453 Do not make this value too large; the results are undefined if
454 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
455 evaluated with infinite-precision integer arithmetic. */
456
457 #if YYMAXDEPTH == 0
458 # undef YYMAXDEPTH
459 #endif
460
461 #ifndef YYMAXDEPTH
462 # define YYMAXDEPTH 10000
463 #endif
464
465
466
467 #if YYERROR_VERBOSE
468
469 # ifndef yystrlen
470 # if defined (_GLIBC_) && defined (_STRING_H)
471 # define yystrlen strlen
472 # else
473 /* Return the length of YYSTR. */
474 static YYSIZE_T
475 # if defined (_STDC_) || defined (_cplusplus)
476 yystrlen (const char *yystr)
477 # else
478 yystrlen (yystr)
479 const char *yystr;
480 # endif
481 {
482 register const char *yys = yystr;
483
484 while (*yys++ != '\0')
485 continue;
486
487 return yys - yystr - 1;
488 }
489 # endif
490 # endif
491
492 # ifndef yystpcpy
493 # if defined (_GLIBC_) && defined (_STRING_H) && defined (_GNU_SOURCE)
494 # define yystpcpy stpcpy
495 # else
496 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
497 YYDEST. */
498 static char *
499 # if defined (_STDC_) || defined (_cplusplus)
500 yystpcpy (char *yydest, const char *yysrc)
501 # else
502 yystpcpy (yydest, yysrc)
503 char *yydest;
504 const char *yysrc;
505 # endif
506 {
507 register char *yyd = yydest;
508 register const char *yys = yysrc;
509
510 while ((*yyd++ = *yys++) != '\0')
511 continue;
512
513 return yyd - 1;
514 }
515 # endif
516 # endif
517
518 #endif /* !YYERROR_VERBOSE */
519
520
521
522 #if YYDEBUG
523 /*-----------------------------.
524 | Print this symbol on YYOUT. |
525 `-----------------------------*/
526
527 static void
528 #if defined (_STDC_) || defined (_cplusplus)
529 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
530 #else
531 yysymprint (yyout, yytype, yyvalue)
532 FILE* yyout;
533 int yytype;
534 YYSTYPE yyvalue;
535 #endif
536 {
537 /* Pacify ``unused variable'' warnings. */
538 (void) yyvalue;
539
540 if (yytype < YYNTOKENS)
541 {
542 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
543 # ifdef YYPRINT
544 YYPRINT (yyout, yytoknum[yytype], yyvalue);
545 # endif
546 }
547 else
548 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
549
550 switch (yytype)
551 {
552 default:
553 break;
554 }
555 YYFPRINTF (yyout, ")");
556 }
557 #endif /* YYDEBUG. */
558
559
560 /*-----------------------------------------------.
561 | Release the memory associated to this symbol. |
562 `-----------------------------------------------*/
563
564 static void
565 #if defined (_STDC_) || defined (_cplusplus)
566 yydestruct (int yytype, YYSTYPE yyvalue)
567 #else
568 yydestruct (yytype, yyvalue)
569 int yytype;
570 YYSTYPE yyvalue;
571 #endif
572 {
573 /* Pacify ``unused variable'' warnings. */
574 (void) yyvalue;
575
576 switch (yytype)
577 {
578 default:
579 break;
580 }
581 }
582
583
584
585 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
586 into yyparse. The argument should have type void *.
587 It should actually point to an object.
588 Grammar actions can access the variable by casting it
589 to the proper pointer type. */
590
591 #ifdef YYPARSE_PARAM
592 # if defined (_STDC_) || defined (_cplusplus)
593 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
594 # define YYPARSE_PARAM_DECL
595 # else
596 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
597 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
598 # endif
599 #else /* !YYPARSE_PARAM */
600 # define YYPARSE_PARAM_ARG
601 # define YYPARSE_PARAM_DECL
602 #endif /* !YYPARSE_PARAM */
603
604 /* Prevent warning if -Wstrict-prototypes. */
605 #ifdef _GNUC_
606 # ifdef YYPARSE_PARAM
607 int yyparse (void *);
608 # else
609 int yyparse (void);
610 # endif
611 #endif
612
613
614 /* The lookahead symbol. */
615 int yychar;
616
617 /* The semantic value of the lookahead symbol. */
618 YYSTYPE yylval;
619
620 /* Number of parse errors so far. */
621 int yynerrs;
622
623
624 int
625 yyparse (YYPARSE_PARAM_ARG)
626 YYPARSE_PARAM_DECL
627 {
628
629 register int yystate;
630 register int yyn;
631 int yyresult;
632 /* Number of tokens to shift before error messages enabled. */
633 int yyerrstatus;
634 /* Lookahead token as an internal (translated) token number. */
635 int yychar1 = 0;
636
637 /* Three stacks and their tools:
638 `yyss': related to states,
639 `yyvs': related to semantic values,
640 `yyls': related to locations.
641
642 Refer to the stacks thru separate pointers, to allow yyoverflow
643 to reallocate them elsewhere. */
644
645 /* The state stack. */
646 short yyssa[YYINITDEPTH];
647 short *yyss = yyssa;
648 register short *yyssp;
649
650 /* The semantic value stack. */
651 YYSTYPE yyvsa[YYINITDEPTH];
652 YYSTYPE *yyvs = yyvsa;
653 register YYSTYPE *yyvsp;
654
655
656
657 #define YYPOPSTACK (yyvsp--, yyssp--)
658
659 YYSIZE_T yystacksize = YYINITDEPTH;
660
661 /* The variables used to return semantic value and location from the
662 action routines. */
663 YYSTYPE yyval;
664
665
666 /* When reducing, the number of symbols on the RHS of the reduced
667 rule. */
668 int yylen;
669
670 YYDPRINTF ((stderr, "Starting parse\n"));
671
672 yystate = 0;
673 yyerrstatus = 0;
674 yynerrs = 0;
675 yychar = YYEMPTY; /* Cause a token to be read. */
676
677 /* Initialize stack pointers.
678 Waste one element of value and location stack
679 so that they stay on the same level as the state stack.
680 The wasted elements are never initialized. */
681
682 yyssp = yyss;
683 yyvsp = yyvs;
684
685 goto yysetstate;
686
687 /*------------------------------------------------------------.
688 | yynewstate -- Push a new state, which is found in yystate. |
689 `------------------------------------------------------------*/
690 yynewstate:
691 /* In all cases, when you get here, the value and location stacks
692 have just been pushed. so pushing a state here evens the stacks.
693 */
694 yyssp++;
695
696 yysetstate:
697 *yyssp = yystate;
698
699 if (yyssp >= yyss + yystacksize - 1)
700 {
701 /* Get the current used size of the three stacks, in elements. */
702 YYSIZE_T yysize = yyssp - yyss + 1;
703
704 #ifdef yyoverflow
705 {
706 /* Give user a chance to reallocate the stack. Use copies of
707 these so that the &'s don't force the real ones into
708 memory. */
709 YYSTYPE *yyvs1 = yyvs;
710 short *yyss1 = yyss;
711
712
713 /* Each stack pointer address is followed by the size of the
714 data in use in that stack, in bytes. This used to be a
715 conditional around just the two extra args, but that might
716 be undefined if yyoverflow is a macro. */
717 yyoverflow ("parser stack overflow",
718 &yyss1, yysize * sizeof (*yyssp),
719 &yyvs1, yysize * sizeof (*yyvsp),
720
721 &yystacksize);
722
723 yyss = yyss1;
724 yyvs = yyvs1;
725 }
726 #else /* no yyoverflow */
727 # ifndef YYSTACK_RELOCATE
728 goto yyoverflowlab;
729 # else
730 /* Extend the stack our own way. */
731 if (yystacksize >= YYMAXDEPTH)
732 goto yyoverflowlab;
733 yystacksize *= 2;
734 if (yystacksize > YYMAXDEPTH)
735 yystacksize = YYMAXDEPTH;
736
737 {
738 short *yyss1 = yyss;
739 union yyalloc *yyptr =
740 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
741 if (! yyptr)
742 goto yyoverflowlab;
743 YYSTACK_RELOCATE (yyss);
744 YYSTACK_RELOCATE (yyvs);
745
746 # undef YYSTACK_RELOCATE
747 if (yyss1 != yyssa)
748 YYSTACK_FREE (yyss1);
749 }
750 # endif
751 #endif /* no yyoverflow */
752
753 yyssp = yyss + yysize - 1;
754 yyvsp = yyvs + yysize - 1;
755
756
757 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
758 (size_t long int) yystacksize));
759
760 if (yyssp >= yyss + yystacksize - 1)
761 YYABORT;
762 }
763
764 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
765
766 goto yybackup;
767
768 /*-----------.
769 | yybackup. |
770 `-----------*/
771 yybackup:
772
773 /* Do appropriate processing given the current state. */
774 /* Read a lookahead token if we need one and don't already have one. */
775 /* yyresume: */
776
777 /* First try to decide what to do without reference to lookahead token. */
778
779 yyn = yypact[yystate];
780 if (yyn == YYPACT_NINF)
781 goto yydefault;
782
783 /* Not known => get a lookahead token if don't already have one. */
784
785 /* yychar is either YYEMPTY or YYEOF
786 or a valid token in external form. */
787
788 if (yychar == YYEMPTY)
789 {
790 YYDPRINTF ((stderr, "Reading a token: "));
791 yychar = YYLEX;
792 }
793
794 /* Convert token to internal form (in yychar1) for indexing tables with. */
795
796 if (yychar <= 0) /* This means end of input. */
797 {
798 yychar1 = 0;
799 yychar = YYEOF; /* Don't call YYLEX any more. */
800
801 YYDPRINTF ((stderr, "Now at end of input.\n"));
802 }
803 else
804 {
805 yychar1 = YYTRANSLATE (yychar);
806
807 /* We have to keep this `#if YYDEBUG', since we use variables
808 which are defined only if `YYDEBUG' is set. */
809 YYDPRINTF ((stderr, "Next token is "));
810 YYDSYMPRINT ((stderr, yychar1, yylval));
811 YYDPRINTF ((stderr, "\n"));
812 }
813
814 /* If the proper action on seeing token YYCHAR1 is to reduce or to
815 detect an error, take that action. */
816 yyn += yychar1;
817 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
818 goto yydefault;
819 yyn = yytable[yyn];
820 if (yyn <= 0)
821 {
822 if (yyn == 0 || yyn == YYTABLE_NINF)
823 goto yyerrlab;
824 yyn = -yyn;
825 goto yyreduce;
826 }
827
828 if (yyn == YYFINAL)
829 YYACCEPT;
830
831 /* Shift the lookahead token. */
832 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
833 yychar, yytname[yychar1]));
834
835 /* Discard the token being shifted unless it is eof. */
836 if (yychar != YYEOF)
837 yychar = YYEMPTY;
838
839 *++yyvsp = yylval;
840
841
842 /* Count tokens shifted since error; after three, turn off error
843 status. */
844 if (yyerrstatus)
845 yyerrstatus--;
846
847 yystate = yyn;
848 goto yynewstate;
849
850
851 /*-----------------------------------------------------------.
852 | yydefault -- do the default action for the current state. |
853 `-----------------------------------------------------------*/
854 yydefault:
855 yyn = yydefact[yystate];
856 if (yyn == 0)
857 goto yyerrlab;
858 goto yyreduce;
859
860
861 /*-----------------------------.
862 | yyreduce -- Do a reduction. |
863 `-----------------------------*/
864 yyreduce:
865 /* yyn is the number of a rule to reduce with. */
866 yylen = yyr2[yyn];
867
868 /* If YYLEN is nonzero, implement the default value of the action:
869 `$$ = $1'.
870
871 Otherwise, the following line sets YYVAL to garbage.
872 This behavior is undocumented and Bison
873 users should not rely upon it. Assigning to YYVAL
874 unconditionally makes the parser a bit smaller, and it avoids a
875 GCC warning that YYVAL may be used uninitialized. */
876 yyval = yyvsp[1-yylen];
877
878
879
880 #if YYDEBUG
881 /* We have to keep this `#if YYDEBUG', since we use variables which
882 are defined only if `YYDEBUG' is set. */
883 if (yydebug)
884 {
885 int yyi;
886
887 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
888 yyn - 1, yyrline[yyn]);
889
890 /* Print the symbols being reduced, and their result. */
891 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
892 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
893 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
894 }
895 #endif
896 switch (yyn)
897 {
898 case 2:
899 #line 11 "rr1"
900 {
901 cout << "empty sequence\n";
902 }
903 break;
904
905 case 4:
906 #line 18 "rr1"
907 {
908 cout << "added word " << yyvsp[0] << endl;
909 }
910 break;
911
912 case 5:
913 #line 25 "rr1"
914 {
915 cout << "empty maybeword\n";
916 }
917 break;
918
919 case 6:
920 #line 30 "rr1"
921 {
922 cout << "single word " << yyvsp[0] << endl;
923 }
924 break;
925
926
927 }
928
929 /* Line 1016 of /usr/share/bison/yacc.c. */
930 #line 931 "rr1.tab.c"
931
932 yyvsp -= yylen;
933 yyssp -= yylen;
934
935
936 #if YYDEBUG
937 if (yydebug)
938 {
939 short *yyssp1 = yyss - 1;
940 YYFPRINTF (stderr, "state stack now");
941 while (yyssp1 != yyssp)
942 YYFPRINTF (stderr, " %d", *++yyssp1);
943 YYFPRINTF (stderr, "\n");
944 }
945 #endif
946
947 *++yyvsp = yyval;
948
949
950 /* Now `shift' the result of the reduction. Determine what state
951 that goes to, based on the state we popped back to and the rule
952 number reduced by. */
953
954 yyn = yyr1[yyn];
955
956 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
957 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
958 yystate = yytable[yystate];
959 else
960 yystate = yydefgoto[yyn - YYNTOKENS];
961
962 goto yynewstate;
963
964
965 /*------------------------------------.
966 | yyerrlab -- here on detecting error |
967 `------------------------------------*/
968 yyerrlab:
969 /* If not already recovering from an error, report this error. */
970 if (!yyerrstatus)
971 {
972 ++yynerrs;
973 #if YYERROR_VERBOSE
974 yyn = yypact[yystate];
975
976 if (YYPACT_NINF < yyn && yyn < YYLAST)
977 {
978 YYSIZE_T yysize = 0;
979 int yytype = YYTRANSLATE (yychar);
980 char *yymsg;
981 int yyx, yycount;
982
983 yycount = 0;
984 /* Start YYX at -YYN if negative to avoid negative indexes in
985 YYCHECK. */
986 for (yyx = yyn < 0 ? -yyn : 0;
987 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
988 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
989 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
990 yysize += yystrlen ("parse error, unexpected ") + 1;
991 yysize += yystrlen (yytname[yytype]);
992 yymsg = (char *) YYSTACK_ALLOC (yysize);
993 if (yymsg != 0)
994 {
995 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
996 yyp = yystpcpy (yyp, yytname[yytype]);
997
998 if (yycount < 5)
999 {
1000 yycount = 0;
1001 for (yyx = yyn < 0 ? -yyn : 0;
1002 yyx < (int) (sizeof (yytname) / sizeof (char *));
1003 yyx++)
1004 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1005 {
1006 const char *yyq = ! yycount ? ", expecting " : " or ";
1007 yyp = yystpcpy (yyp, yyq);
1008 yyp = yystpcpy (yyp, yytname[yyx]);
1009 yycount++;
1010 }
1011 }
1012 yyerror (yymsg);
1013 YYSTACK_FREE (yymsg);
1014 }
1015 else
1016 yyerror ("parse error; also virtual memory exhausted");
1017 }
1018 else
1019 #endif /* YYERROR_VERBOSE */
1020 yyerror ("parse error");
1021 }
1022 goto yyerrlab1;
1023
1024
1025 /*----------------------------------------------------.
1026 | yyerrlab1 -- error raised explicitly by an action. |
1027 `----------------------------------------------------*/
1028 yyerrlab1:
1029 if (yyerrstatus == 3)
1030 {
1031 /* If just tried and failed to reuse lookahead token after an
1032 error, discard it. */
1033
1034 /* Return failure if at end of input. */
1035 if (yychar == YYEOF)
1036 {
1037 /* Pop the error token. */
1038 YYPOPSTACK;
1039 /* Pop the rest of the stack. */
1040 while (yyssp > yyss)
1041 {
1042 YYDPRINTF ((stderr, "Error: popping "));
1043 YYDSYMPRINT ((stderr,
1044 yystos[*yyssp],
1045 *yyvsp));
1046 YYDPRINTF ((stderr, "\n"));
1047 yydestruct (yystos[*yyssp], *yyvsp);
1048 YYPOPSTACK;
1049 }
1050 YYABORT;
1051 }
1052
1053 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1054 yychar, yytname[yychar1]));
1055 yydestruct (yychar1, yylval);
1056 yychar = YYEMPTY;
1057 }
1058
1059 /* Else will try to reuse lookahead token after shifting the error
1060 token. */
1061
1062 yyerrstatus = 3; /* Each real token shifted decrements this. */
1063
1064 for (;;)
1065 {
1066 yyn = yypact[yystate];
1067 if (yyn != YYPACT_NINF)
1068 {
1069 yyn += YYTERROR;
1070 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1071 {
1072 yyn = yytable[yyn];
1073 if (0 < yyn)
1074 break;
1075 }
1076 }
1077
1078 /* Pop the current state because it cannot handle the error token. */
1079 if (yyssp == yyss)
1080 YYABORT;
1081
1082 YYDPRINTF ((stderr, "Error: popping "));
1083 YYDSYMPRINT ((stderr,
1084 yystos[*yyssp], *yyvsp));
1085 YYDPRINTF ((stderr, "\n"));
1086
1087 yydestruct (yystos[yystate], *yyvsp);
1088 yyvsp--;
1089 yystate = *--yyssp;
1090
1091
1092 #if YYDEBUG
1093 if (yydebug)
1094 {
1095 short *yyssp1 = yyss - 1;
1096 YYFPRINTF (stderr, "Error: state stack now");
1097 while (yyssp1 != yyssp)
1098 YYFPRINTF (stderr, " %d", *++yyssp1);
1099 YYFPRINTF (stderr, "\n");
1100 }
1101 #endif
1102 }
1103
1104 if (yyn == YYFINAL)
1105 YYACCEPT;
1106
1107 YYDPRINTF ((stderr, "Shifting error token, "));
1108
1109 *++yyvsp = yylval;
1110
1111
1112 yystate = yyn;
1113 goto yynewstate;
1114
1115
1116 /*-------------------------------------.
1117 | yyacceptlab -- YYACCEPT comes here. |
1118 `-------------------------------------*/
1119 yyacceptlab:
1120 yyresult = 0;
1121 goto yyreturn;
1122
1123 /*-----------------------------------.
1124 | yyabortlab -- YYABORT comes here. |
1125 `-----------------------------------*/
1126 yyabortlab:
1127 yyresult = 1;
1128 goto yyreturn;
1129
1130 #ifndef yyoverflow
1131 /*----------------------------------------------.
1132 | yyoverflowlab -- parser overflow comes here. |
1133 `----------------------------------------------*/
1134 yyoverflowlab:
1135 yyerror ("parser stack overflow");
1136 yyresult = 2;
1137 /* Fall through. */
1138 #endif
1139
1140 yyreturn:
1141 #ifndef yyoverflow
1142 if (yyss != yyssa)
1143 YYSTACK_FREE (yyss);
1144 #endif
1145 return yyresult;
1146 }
1147
1148
1149 #line 9 "rr1"
1150
1151