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