1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
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)
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.
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. */
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. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
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. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse xmlParserparse
51 #define yylex xmlParserlex
52 #define yyerror xmlParsererror
53 #define yylval xmlParserlval
54 #define yychar xmlParserchar
55 #define yydebug xmlParserdebug
56 #define yynerrs xmlParsernerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
70 #define STRING_TOKEN 259
75 /* Copy the first part of user declarations. */
82 /* Some addn'l includes, necessary but not included by the
88 /* prototypes for the parser callbacks.
94 extern std::vector<std::string> xml_attr_vec;
95 extern std::vector<std::string> xml_val_vec;
96 extern std::string xml_a, xml_v;
97 extern xml_t *xml_leaves;
99 extern int xmlParserdebug;
100 extern void xmlParsererror(char *s);
101 extern int xmlParserlex();
108 /* Enabling traces. */
113 /* Enabling verbose error messages. */
114 #ifdef YYERROR_VERBOSE
115 # undef YYERROR_VERBOSE
116 # define YYERROR_VERBOSE 1
118 # define YYERROR_VERBOSE 0
121 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
123 typedef union YYSTYPE {
129 /* for FTA definition. */
132 /* Line 191 of yacc.c. */
133 #line 134 "xml.tab.cc"
134 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
135 # define YYSTYPE_IS_DECLARED 1
136 # define YYSTYPE_IS_TRIVIAL 1
141 /* Copy the second part of user declarations. */
144 /* Line 214 of yacc.c. */
145 #line 146 "xml.tab.cc"
147 #if ! defined (yyoverflow) || YYERROR_VERBOSE
149 /* The parser invokes alloca or malloc; define the necessary symbols. */
151 # ifdef YYSTACK_USE_ALLOCA
152 # if YYSTACK_USE_ALLOCA
153 # define YYSTACK_ALLOC alloca
156 # if defined (alloca) || defined (_ALLOCA_H)
157 # define YYSTACK_ALLOC alloca
160 # define YYSTACK_ALLOC __builtin_alloca
165 # ifdef YYSTACK_ALLOC
166 /* Pacify GCC's `empty if-body' warning. */
167 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
169 # if defined (__STDC__) || defined (__cplusplus)
170 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
171 # define YYSIZE_T size_t
173 # define YYSTACK_ALLOC malloc
174 # define YYSTACK_FREE free
176 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
179 #if (! defined (yyoverflow) \
180 && (! defined (__cplusplus) \
181 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
183 /* A type that is properly aligned for any stack member. */
190 /* The size of the maximum gap between one aligned stack and the next. */
191 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
193 /* The size of an array large to enough to hold all stacks, each with
195 # define YYSTACK_BYTES(N) \
196 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
197 + YYSTACK_GAP_MAXIMUM)
199 /* Copy COUNT objects from FROM to TO. The source and destination do
202 # if defined (__GNUC__) && 1 < __GNUC__
203 # define YYCOPY(To, From, Count) \
204 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
206 # define YYCOPY(To, From, Count) \
209 register YYSIZE_T yyi; \
210 for (yyi = 0; yyi < (Count); yyi++) \
211 (To)[yyi] = (From)[yyi]; \
217 /* Relocate STACK from its old location to the new one. The
218 local variables YYSIZE and YYSTACKSIZE give the old and new number of
219 elements in the stack, and YYPTR gives the new location of the
220 stack. Advance YYPTR to a properly aligned location for the next
222 # define YYSTACK_RELOCATE(Stack) \
225 YYSIZE_T yynewbytes; \
226 YYCOPY (&yyptr->Stack, Stack, yysize); \
227 Stack = &yyptr->Stack; \
228 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
229 yyptr += yynewbytes / sizeof (*yyptr); \
235 #if defined (__STDC__) || defined (__cplusplus)
236 typedef signed char yysigned_char;
238 typedef short yysigned_char;
241 /* YYFINAL -- State number of the termination state. */
243 /* YYLAST -- Last index in YYTABLE. */
246 /* YYNTOKENS -- Number of terminals. */
248 /* YYNNTS -- Number of nonterminals. */
250 /* YYNRULES -- Number of rules. */
252 /* YYNRULES -- Number of states. */
255 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
257 #define YYMAXUTOK 259
259 #define YYTRANSLATE(YYX) \
260 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
262 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
263 static const unsigned char yytranslate[] =
265 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
266 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
267 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
268 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
269 2, 2, 2, 2, 2, 2, 2, 6, 2, 2,
270 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
271 5, 8, 7, 2, 2, 2, 2, 2, 2, 2,
272 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
273 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
274 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
275 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
276 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
277 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
278 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
281 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
282 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290 2, 2, 2, 2, 2, 2, 1, 2, 3, 4
294 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
296 static const unsigned char yyprhs[] =
298 0, 0, 3, 5, 9, 12, 18, 23, 28, 30,
302 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
303 static const yysigned_char yyrhs[] =
305 10, 0, -1, 11, -1, 12, 14, 13, -1, 12,
306 13, -1, 5, 3, 15, 6, 7, -1, 5, 3,
307 15, 7, -1, 5, 6, 3, 7, -1, 11, -1,
308 14, 11, -1, 16, -1, -1, 17, -1, 16, 17,
312 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
313 static const unsigned char yyrline[] =
315 0, 60, 60, 64, 65, 66, 72, 76, 81, 82,
320 #if YYDEBUG || YYERROR_VERBOSE
321 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
322 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
323 static const char *const yytname[] =
325 "$end", "error", "$undefined", "NAME", "STRING_TOKEN", "'<'", "'/'",
326 "'>'", "'='", "$accept", "parse_result", "resource", "start_tag",
327 "end_tag", "xml_list", "opt_val_list", "val_list", "val", 0
332 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
334 static const unsigned short yytoknum[] =
336 0, 256, 257, 258, 259, 60, 47, 62, 61
340 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
341 static const unsigned char yyr1[] =
343 0, 9, 10, 11, 11, 11, 12, 13, 14, 14,
347 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
348 static const unsigned char yyr2[] =
350 0, 2, 1, 3, 2, 5, 4, 4, 1, 2,
354 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
355 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
356 means the default is an error. */
357 static const unsigned char yydefact[] =
359 0, 0, 0, 2, 0, 11, 1, 0, 8, 4,
360 0, 0, 0, 10, 12, 0, 9, 3, 0, 0,
364 /* YYDEFGOTO[NTERM-NUM]. */
365 static const yysigned_char yydefgoto[] =
367 -1, 2, 3, 4, 9, 10, 12, 13, 14
370 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
372 #define YYPACT_NINF -5
373 static const yysigned_char yypact[] =
375 -3, 0, 5, -5, 4, 7, -5, -2, -5, -5,
376 4, 3, 1, 7, -5, 9, -5, -5, 10, 6,
377 -5, -5, 8, -5, -5, -5
380 /* YYPGOTO[NTERM-NUM]. */
381 static const yysigned_char yypgoto[] =
383 -5, -5, -4, -5, 11, -5, -5, -5, 12
386 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
387 positive, shift that token. If negative, reduce the rule which
388 number is the opposite. If zero, do what YYDEFACT says.
389 If YYTABLE_NINF, syntax error. */
390 #define YYTABLE_NINF -1
391 static const unsigned char yytable[] =
393 8, 5, 1, 5, 15, 6, 16, 19, 20, 7,
394 11, 18, 22, 24, 23, 25, 0, 0, 0, 0,
398 static const yysigned_char yycheck[] =
400 4, 3, 5, 3, 6, 0, 10, 6, 7, 5,
401 3, 8, 3, 7, 4, 7, -1, -1, -1, -1,
402 -1, 10, -1, -1, -1, 13
405 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
406 symbol of state STATE-NUM. */
407 static const unsigned char yystos[] =
409 0, 5, 10, 11, 12, 3, 0, 5, 11, 13,
410 14, 3, 15, 16, 17, 6, 11, 13, 8, 6,
414 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
415 # define YYSIZE_T __SIZE_TYPE__
417 #if ! defined (YYSIZE_T) && defined (size_t)
418 # define YYSIZE_T size_t
420 #if ! defined (YYSIZE_T)
421 # if defined (__STDC__) || defined (__cplusplus)
422 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
423 # define YYSIZE_T size_t
426 #if ! defined (YYSIZE_T)
427 # define YYSIZE_T unsigned int
430 #define yyerrok (yyerrstatus = 0)
431 #define yyclearin (yychar = YYEMPTY)
435 #define YYACCEPT goto yyacceptlab
436 #define YYABORT goto yyabortlab
437 #define YYERROR goto yyerrorlab
440 /* Like YYERROR except do call yyerror. This remains here temporarily
441 to ease the transition to the new meaning of YYERROR, for GCC.
442 Once GCC version 2 has supplanted version 1, this can go. */
444 #define YYFAIL goto yyerrlab
446 #define YYRECOVERING() (!!yyerrstatus)
448 #define YYBACKUP(Token, Value) \
450 if (yychar == YYEMPTY && yylen == 1) \
454 yytoken = YYTRANSLATE (yychar); \
460 yyerror ("syntax error: cannot back up");\
466 #define YYERRCODE 256
468 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
471 #ifndef YYLLOC_DEFAULT
472 # define YYLLOC_DEFAULT(Current, Rhs, N) \
473 ((Current).first_line = (Rhs)[1].first_line, \
474 (Current).first_column = (Rhs)[1].first_column, \
475 (Current).last_line = (Rhs)[N].last_line, \
476 (Current).last_column = (Rhs)[N].last_column)
479 /* YYLEX -- calling `yylex' with the right arguments. */
482 # define YYLEX yylex (YYLEX_PARAM)
484 # define YYLEX yylex ()
487 /* Enable debugging if requested. */
491 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
492 # define YYFPRINTF fprintf
495 # define YYDPRINTF(Args) \
501 # define YYDSYMPRINT(Args) \
507 # define YYDSYMPRINTF(Title, Token, Value, Location) \
511 YYFPRINTF (stderr, "%s ", Title); \
512 yysymprint (stderr, \
514 YYFPRINTF (stderr, "\n"); \
518 /*------------------------------------------------------------------.
519 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
521 `------------------------------------------------------------------*/
523 #if defined (__STDC__) || defined (__cplusplus)
525 yy_stack_print (short *bottom, short *top)
528 yy_stack_print (bottom, top)
533 YYFPRINTF (stderr, "Stack now");
534 for (/* Nothing. */; bottom <= top; ++bottom)
535 YYFPRINTF (stderr, " %d", *bottom);
536 YYFPRINTF (stderr, "\n");
539 # define YY_STACK_PRINT(Bottom, Top) \
542 yy_stack_print ((Bottom), (Top)); \
546 /*------------------------------------------------.
547 | Report that the YYRULE is going to be reduced. |
548 `------------------------------------------------*/
550 #if defined (__STDC__) || defined (__cplusplus)
552 yy_reduce_print (int yyrule)
555 yy_reduce_print (yyrule)
560 unsigned int yylno = yyrline[yyrule];
561 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
563 /* Print the symbols being reduced, and their result. */
564 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
565 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
566 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
569 # define YY_REDUCE_PRINT(Rule) \
572 yy_reduce_print (Rule); \
575 /* Nonzero means print parse trace. It is left uninitialized so that
576 multiple parsers can coexist. */
579 # define YYDPRINTF(Args)
580 # define YYDSYMPRINT(Args)
581 # define YYDSYMPRINTF(Title, Token, Value, Location)
582 # define YY_STACK_PRINT(Bottom, Top)
583 # define YY_REDUCE_PRINT(Rule)
584 #endif /* !YYDEBUG */
587 /* YYINITDEPTH -- initial size of the parser's stacks. */
589 # define YYINITDEPTH 200
592 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
593 if the built-in stack extension method is used).
595 Do not make this value too large; the results are undefined if
596 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
597 evaluated with infinite-precision integer arithmetic. */
599 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
604 # define YYMAXDEPTH 10000
612 # if defined (__GLIBC__) && defined (_STRING_H)
613 # define yystrlen strlen
615 /* Return the length of YYSTR. */
617 # if defined (__STDC__) || defined (__cplusplus)
618 yystrlen (const char *yystr)
624 register const char *yys = yystr;
626 while (*yys++ != '\0')
629 return yys - yystr - 1;
635 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
636 # define yystpcpy stpcpy
638 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
641 # if defined (__STDC__) || defined (__cplusplus)
642 yystpcpy (char *yydest, const char *yysrc)
644 yystpcpy (yydest, yysrc)
649 register char *yyd = yydest;
650 register const char *yys = yysrc;
652 while ((*yyd++ = *yys++) != '\0')
660 #endif /* !YYERROR_VERBOSE */
665 /*--------------------------------.
666 | Print this symbol on YYOUTPUT. |
667 `--------------------------------*/
669 #if defined (__STDC__) || defined (__cplusplus)
671 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
674 yysymprint (yyoutput, yytype, yyvaluep)
680 /* Pacify ``unused variable'' warnings. */
683 if (yytype < YYNTOKENS)
685 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
687 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
691 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
698 YYFPRINTF (yyoutput, ")");
701 #endif /* ! YYDEBUG */
702 /*-----------------------------------------------.
703 | Release the memory associated to this symbol. |
704 `-----------------------------------------------*/
706 #if defined (__STDC__) || defined (__cplusplus)
708 yydestruct (int yytype, YYSTYPE *yyvaluep)
711 yydestruct (yytype, yyvaluep)
716 /* Pacify ``unused variable'' warnings. */
728 /* Prevent warnings from -Wmissing-prototypes. */
731 # if defined (__STDC__) || defined (__cplusplus)
732 int yyparse (void *YYPARSE_PARAM);
736 #else /* ! YYPARSE_PARAM */
737 #if defined (__STDC__) || defined (__cplusplus)
742 #endif /* ! YYPARSE_PARAM */
746 /* The lookahead symbol. */
749 /* The semantic value of the lookahead symbol. */
752 /* Number of syntax errors so far. */
762 # if defined (__STDC__) || defined (__cplusplus)
763 int yyparse (void *YYPARSE_PARAM)
765 int yyparse (YYPARSE_PARAM)
768 #else /* ! YYPARSE_PARAM */
769 #if defined (__STDC__) || defined (__cplusplus)
780 register int yystate;
783 /* Number of tokens to shift before error messages enabled. */
785 /* Lookahead token as an internal (translated) token number. */
788 /* Three stacks and their tools:
789 `yyss': related to states,
790 `yyvs': related to semantic values,
791 `yyls': related to locations.
793 Refer to the stacks thru separate pointers, to allow yyoverflow
794 to reallocate them elsewhere. */
796 /* The state stack. */
797 short yyssa[YYINITDEPTH];
799 register short *yyssp;
801 /* The semantic value stack. */
802 YYSTYPE yyvsa[YYINITDEPTH];
803 YYSTYPE *yyvs = yyvsa;
804 register YYSTYPE *yyvsp;
808 #define YYPOPSTACK (yyvsp--, yyssp--)
810 YYSIZE_T yystacksize = YYINITDEPTH;
812 /* The variables used to return semantic value and location from the
817 /* When reducing, the number of symbols on the RHS of the reduced
821 YYDPRINTF ((stderr, "Starting parse\n"));
826 yychar = YYEMPTY; /* Cause a token to be read. */
828 /* Initialize stack pointers.
829 Waste one element of value and location stack
830 so that they stay on the same level as the state stack.
831 The wasted elements are never initialized. */
838 /*------------------------------------------------------------.
839 | yynewstate -- Push a new state, which is found in yystate. |
840 `------------------------------------------------------------*/
842 /* In all cases, when you get here, the value and location stacks
843 have just been pushed. so pushing a state here evens the stacks.
850 if (yyss + yystacksize - 1 <= yyssp)
852 /* Get the current used size of the three stacks, in elements. */
853 YYSIZE_T yysize = yyssp - yyss + 1;
857 /* Give user a chance to reallocate the stack. Use copies of
858 these so that the &'s don't force the real ones into
860 YYSTYPE *yyvs1 = yyvs;
864 /* Each stack pointer address is followed by the size of the
865 data in use in that stack, in bytes. This used to be a
866 conditional around just the two extra args, but that might
867 be undefined if yyoverflow is a macro. */
868 yyoverflow ("parser stack overflow",
869 &yyss1, yysize * sizeof (*yyssp),
870 &yyvs1, yysize * sizeof (*yyvsp),
877 #else /* no yyoverflow */
878 # ifndef YYSTACK_RELOCATE
881 /* Extend the stack our own way. */
882 if (YYMAXDEPTH <= yystacksize)
885 if (YYMAXDEPTH < yystacksize)
886 yystacksize = YYMAXDEPTH;
890 union yyalloc *yyptr =
891 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
894 YYSTACK_RELOCATE (yyss);
895 YYSTACK_RELOCATE (yyvs);
897 # undef YYSTACK_RELOCATE
899 YYSTACK_FREE (yyss1);
902 #endif /* no yyoverflow */
904 yyssp = yyss + yysize - 1;
905 yyvsp = yyvs + yysize - 1;
908 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
909 (unsigned long int) yystacksize));
911 if (yyss + yystacksize - 1 <= yyssp)
915 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
924 /* Do appropriate processing given the current state. */
925 /* Read a lookahead token if we need one and don't already have one. */
928 /* First try to decide what to do without reference to lookahead token. */
930 yyn = yypact[yystate];
931 if (yyn == YYPACT_NINF)
934 /* Not known => get a lookahead token if don't already have one. */
936 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
937 if (yychar == YYEMPTY)
939 YYDPRINTF ((stderr, "Reading a token: "));
945 yychar = yytoken = YYEOF;
946 YYDPRINTF ((stderr, "Now at end of input.\n"));
950 yytoken = YYTRANSLATE (yychar);
951 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
954 /* If the proper action on seeing token YYTOKEN is to reduce or to
955 detect an error, take that action. */
957 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
962 if (yyn == 0 || yyn == YYTABLE_NINF)
971 /* Shift the lookahead token. */
972 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
974 /* Discard the token being shifted unless it is eof. */
981 /* Count tokens shifted since error; after three, turn off error
990 /*-----------------------------------------------------------.
991 | yydefault -- do the default action for the current state. |
992 `-----------------------------------------------------------*/
994 yyn = yydefact[yystate];
1000 /*-----------------------------.
1001 | yyreduce -- Do a reduction. |
1002 `-----------------------------*/
1004 /* yyn is the number of a rule to reduce with. */
1007 /* If YYLEN is nonzero, implement the default value of the action:
1010 Otherwise, the following line sets YYVAL to garbage.
1011 This behavior is undocumented and Bison
1012 users should not rely upon it. Assigning to YYVAL
1013 unconditionally makes the parser a bit smaller, and it avoids a
1014 GCC warning that YYVAL may be used uninitialized. */
1015 yyval = yyvsp[1-yylen];
1018 YY_REDUCE_PRINT (yyn);
1023 {xml_leaves->add_leaf(new xml_leaf_t(yyvsp[-3].strval, xml_attr_vec, xml_val_vec));
1029 {xml_attr_vec.clear(); xml_val_vec.clear();;}
1034 {xml_attr_vec.clear(); xml_attr_vec.push_back(xml_a);
1035 xml_val_vec.clear(); xml_val_vec.push_back(xml_v); ;}
1040 {xml_attr_vec.push_back(xml_a);
1041 xml_val_vec.push_back(xml_v); ;}
1046 {xml_a = yyvsp[-2].strval; xml_v = yyvsp[0].strval;;}
1052 /* Line 993 of yacc.c. */
1053 #line 1054 "xml.tab.cc"
1059 YY_STACK_PRINT (yyss, yyssp);
1064 /* Now `shift' the result of the reduction. Determine what state
1065 that goes to, based on the state we popped back to and the rule
1066 number reduced by. */
1070 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1071 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1072 yystate = yytable[yystate];
1074 yystate = yydefgoto[yyn - YYNTOKENS];
1079 /*------------------------------------.
1080 | yyerrlab -- here on detecting error |
1081 `------------------------------------*/
1083 /* If not already recovering from an error, report this error. */
1088 yyn = yypact[yystate];
1090 if (YYPACT_NINF < yyn && yyn < YYLAST)
1092 YYSIZE_T yysize = 0;
1093 int yytype = YYTRANSLATE (yychar);
1094 const char* yyprefix;
1098 /* Start YYX at -YYN if negative to avoid negative indexes in
1100 int yyxbegin = yyn < 0 ? -yyn : 0;
1102 /* Stay within bounds of both yycheck and yytname. */
1103 int yychecklim = YYLAST - yyn;
1104 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1107 yyprefix = ", expecting ";
1108 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1109 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1111 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1119 yysize += (sizeof ("syntax error, unexpected ")
1120 + yystrlen (yytname[yytype]));
1121 yymsg = (char *) YYSTACK_ALLOC (yysize);
1124 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1125 yyp = yystpcpy (yyp, yytname[yytype]);
1129 yyprefix = ", expecting ";
1130 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1131 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1133 yyp = yystpcpy (yyp, yyprefix);
1134 yyp = yystpcpy (yyp, yytname[yyx]);
1139 YYSTACK_FREE (yymsg);
1142 yyerror ("syntax error; also virtual memory exhausted");
1145 #endif /* YYERROR_VERBOSE */
1146 yyerror ("syntax error");
1151 if (yyerrstatus == 3)
1153 /* If just tried and failed to reuse lookahead token after an
1154 error, discard it. */
1156 if (yychar <= YYEOF)
1158 /* If at end of input, pop the error token,
1159 then the rest of the stack, then return failure. */
1160 if (yychar == YYEOF)
1166 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1167 yydestruct (yystos[*yyssp], yyvsp);
1172 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1173 yydestruct (yytoken, &yylval);
1179 /* Else will try to reuse lookahead token after shifting the error
1184 /*---------------------------------------------------.
1185 | yyerrorlab -- error raised explicitly by YYERROR. |
1186 `---------------------------------------------------*/
1190 /* Pacify GCC when the user code never invokes YYERROR and the label
1191 yyerrorlab therefore never appears in user code. */
1202 /*-------------------------------------------------------------.
1203 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1204 `-------------------------------------------------------------*/
1206 yyerrstatus = 3; /* Each real token shifted decrements this. */
1210 yyn = yypact[yystate];
1211 if (yyn != YYPACT_NINF)
1214 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1222 /* Pop the current state because it cannot handle the error token. */
1226 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1227 yydestruct (yystos[yystate], yyvsp);
1230 YY_STACK_PRINT (yyss, yyssp);
1236 YYDPRINTF ((stderr, "Shifting error token, "));
1245 /*-------------------------------------.
1246 | yyacceptlab -- YYACCEPT comes here. |
1247 `-------------------------------------*/
1252 /*-----------------------------------.
1253 | yyabortlab -- YYABORT comes here. |
1254 `-----------------------------------*/
1260 /*----------------------------------------------.
1261 | yyoverflowlab -- parser overflow comes here. |
1262 `----------------------------------------------*/
1264 yyerror ("parser stack overflow");
1272 YYSTACK_FREE (yyss);