1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse xmlParserparse
63 #define yylex xmlParserlex
64 #define yyerror xmlParsererror
65 #define yylval xmlParserlval
66 #define yychar xmlParserchar
67 #define yydebug xmlParserdebug
68 #define yynerrs xmlParsernerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
83 #define STRING_TOKEN 259
88 /* Copy the first part of user declarations. */
95 /* Some addn'l includes, necessary but not included by the
101 /* prototypes for the parser callbacks.
107 extern xml_t *xml_result;
109 extern int xmlParserdebug;
110 extern void xmlParsererror(char *s);
111 extern int xmlParserlex();
118 /* Enabling traces. */
123 /* Enabling verbose error messages. */
124 #ifdef YYERROR_VERBOSE
125 # undef YYERROR_VERBOSE
126 # define YYERROR_VERBOSE 1
128 # define YYERROR_VERBOSE 0
131 /* Enabling the token table. */
132 #ifndef YYTOKEN_TABLE
133 # define YYTOKEN_TABLE 0
136 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
137 typedef union YYSTYPE
144 struct name_val_pair_t *nvpt;
145 struct name_val_list_t *nvpl;
147 struct xml_list_t *xlist_t;
150 /* Line 193 of yacc.c. */
151 #line 152 "xml.tab.cc"
153 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
154 # define YYSTYPE_IS_DECLARED 1
155 # define YYSTYPE_IS_TRIVIAL 1
160 /* Copy the second part of user declarations. */
163 /* Line 216 of yacc.c. */
164 #line 165 "xml.tab.cc"
171 typedef YYTYPE_UINT8 yytype_uint8;
173 typedef unsigned char yytype_uint8;
177 typedef YYTYPE_INT8 yytype_int8;
178 #elif (defined __STDC__ || defined __C99__FUNC__ \
179 || defined __cplusplus || defined _MSC_VER)
180 typedef signed char yytype_int8;
182 typedef short int yytype_int8;
186 typedef YYTYPE_UINT16 yytype_uint16;
188 typedef unsigned short int yytype_uint16;
192 typedef YYTYPE_INT16 yytype_int16;
194 typedef short int yytype_int16;
198 # ifdef __SIZE_TYPE__
199 # define YYSIZE_T __SIZE_TYPE__
200 # elif defined size_t
201 # define YYSIZE_T size_t
202 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
203 || defined __cplusplus || defined _MSC_VER)
204 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
205 # define YYSIZE_T size_t
207 # define YYSIZE_T unsigned int
211 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
216 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
217 # define YY_(msgid) dgettext ("bison-runtime", msgid)
221 # define YY_(msgid) msgid
225 /* Suppress unused-variable warnings by "using" E. */
226 #if ! defined lint || defined __GNUC__
227 # define YYUSE(e) ((void) (e))
229 # define YYUSE(e) /* empty */
232 /* Identity function, used to suppress warnings about constant conditions. */
236 #if (defined __STDC__ || defined __C99__FUNC__ \
237 || defined __cplusplus || defined _MSC_VER)
250 #if ! defined yyoverflow || YYERROR_VERBOSE
252 /* The parser invokes alloca or malloc; define the necessary symbols. */
254 # ifdef YYSTACK_USE_ALLOCA
255 # if YYSTACK_USE_ALLOCA
257 # define YYSTACK_ALLOC __builtin_alloca
258 # elif defined __BUILTIN_VA_ARG_INCR
259 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
261 # define YYSTACK_ALLOC __alloca
262 # elif defined _MSC_VER
263 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
264 # define alloca _alloca
266 # define YYSTACK_ALLOC alloca
267 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
268 || defined __cplusplus || defined _MSC_VER)
269 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
278 # ifdef YYSTACK_ALLOC
279 /* Pacify GCC's `empty if-body' warning. */
280 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
281 # ifndef YYSTACK_ALLOC_MAXIMUM
282 /* The OS might guarantee only one guard page at the bottom of the stack,
283 and a page size can be as small as 4096 bytes. So we cannot safely
284 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
285 to allow for a few compiler-allocated temporary stack slots. */
286 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
289 # define YYSTACK_ALLOC YYMALLOC
290 # define YYSTACK_FREE YYFREE
291 # ifndef YYSTACK_ALLOC_MAXIMUM
292 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
294 # if (defined __cplusplus && ! defined _STDLIB_H \
295 && ! ((defined YYMALLOC || defined malloc) \
296 && (defined YYFREE || defined free)))
297 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
303 # define YYMALLOC malloc
304 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
305 || defined __cplusplus || defined _MSC_VER)
306 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
311 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
312 || defined __cplusplus || defined _MSC_VER)
313 void free (void *); /* INFRINGES ON USER NAME SPACE */
317 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
320 #if (! defined yyoverflow \
321 && (! defined __cplusplus \
322 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
324 /* A type that is properly aligned for any stack member. */
331 /* The size of the maximum gap between one aligned stack and the next. */
332 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
334 /* The size of an array large to enough to hold all stacks, each with
336 # define YYSTACK_BYTES(N) \
337 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
338 + YYSTACK_GAP_MAXIMUM)
340 /* Copy COUNT objects from FROM to TO. The source and destination do
343 # if defined __GNUC__ && 1 < __GNUC__
344 # define YYCOPY(To, From, Count) \
345 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
347 # define YYCOPY(To, From, Count) \
351 for (yyi = 0; yyi < (Count); yyi++) \
352 (To)[yyi] = (From)[yyi]; \
358 /* Relocate STACK from its old location to the new one. The
359 local variables YYSIZE and YYSTACKSIZE give the old and new number of
360 elements in the stack, and YYPTR gives the new location of the
361 stack. Advance YYPTR to a properly aligned location for the next
363 # define YYSTACK_RELOCATE(Stack) \
366 YYSIZE_T yynewbytes; \
367 YYCOPY (&yyptr->Stack, Stack, yysize); \
368 Stack = &yyptr->Stack; \
369 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
370 yyptr += yynewbytes / sizeof (*yyptr); \
376 /* YYFINAL -- State number of the termination state. */
378 /* YYLAST -- Last index in YYTABLE. */
381 /* YYNTOKENS -- Number of terminals. */
383 /* YYNNTS -- Number of nonterminals. */
385 /* YYNRULES -- Number of rules. */
387 /* YYNRULES -- Number of states. */
390 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
392 #define YYMAXUTOK 259
394 #define YYTRANSLATE(YYX) \
395 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
397 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
398 static const yytype_uint8 yytranslate[] =
400 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 6, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 5, 8, 7, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 1, 2, 3, 4
429 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
431 static const yytype_uint8 yyprhs[] =
433 0, 0, 3, 5, 9, 12, 18, 23, 28, 30,
437 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
438 static const yytype_int8 yyrhs[] =
440 10, 0, -1, 11, -1, 12, 14, 13, -1, 12,
441 13, -1, 5, 3, 15, 6, 7, -1, 5, 3,
442 15, 7, -1, 5, 6, 3, 7, -1, 11, -1,
443 14, 11, -1, 16, -1, -1, 17, -1, 16, 17,
447 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
448 static const yytype_uint8 yyrline[] =
450 0, 65, 65, 69, 70, 71, 75, 79, 84, 85,
455 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
456 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
457 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
458 static const char *const yytname[] =
460 "$end", "error", "$undefined", "NAME", "STRING_TOKEN", "'<'", "'/'",
461 "'>'", "'='", "$accept", "parse_result", "resource", "start_tag",
462 "end_tag", "xml_list", "opt_val_list", "val_list", "val", 0
467 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
469 static const yytype_uint16 yytoknum[] =
471 0, 256, 257, 258, 259, 60, 47, 62, 61
475 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
476 static const yytype_uint8 yyr1[] =
478 0, 9, 10, 11, 11, 11, 12, 13, 14, 14,
482 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
483 static const yytype_uint8 yyr2[] =
485 0, 2, 1, 3, 2, 5, 4, 4, 1, 2,
489 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
490 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
491 means the default is an error. */
492 static const yytype_uint8 yydefact[] =
494 0, 0, 0, 2, 0, 11, 1, 0, 8, 4,
495 0, 0, 0, 10, 12, 0, 9, 3, 0, 0,
499 /* YYDEFGOTO[NTERM-NUM]. */
500 static const yytype_int8 yydefgoto[] =
502 -1, 2, 3, 4, 9, 10, 12, 13, 14
505 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
507 #define YYPACT_NINF -5
508 static const yytype_int8 yypact[] =
510 -3, 0, 5, -5, 4, 7, -5, -2, -5, -5,
511 4, 3, 1, 7, -5, 9, -5, -5, 10, 6,
512 -5, -5, 8, -5, -5, -5
515 /* YYPGOTO[NTERM-NUM]. */
516 static const yytype_int8 yypgoto[] =
518 -5, -5, -4, -5, 11, -5, -5, -5, 12
521 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
522 positive, shift that token. If negative, reduce the rule which
523 number is the opposite. If zero, do what YYDEFACT says.
524 If YYTABLE_NINF, syntax error. */
525 #define YYTABLE_NINF -1
526 static const yytype_uint8 yytable[] =
528 8, 5, 1, 5, 15, 6, 16, 19, 20, 7,
529 11, 18, 22, 24, 23, 25, 0, 0, 0, 0,
533 static const yytype_int8 yycheck[] =
535 4, 3, 5, 3, 6, 0, 10, 6, 7, 5,
536 3, 8, 3, 7, 4, 7, -1, -1, -1, -1,
537 -1, 10, -1, -1, -1, 13
540 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
541 symbol of state STATE-NUM. */
542 static const yytype_uint8 yystos[] =
544 0, 5, 10, 11, 12, 3, 0, 5, 11, 13,
545 14, 3, 15, 16, 17, 6, 11, 13, 8, 6,
549 #define yyerrok (yyerrstatus = 0)
550 #define yyclearin (yychar = YYEMPTY)
554 #define YYACCEPT goto yyacceptlab
555 #define YYABORT goto yyabortlab
556 #define YYERROR goto yyerrorlab
559 /* Like YYERROR except do call yyerror. This remains here temporarily
560 to ease the transition to the new meaning of YYERROR, for GCC.
561 Once GCC version 2 has supplanted version 1, this can go. */
563 #define YYFAIL goto yyerrlab
565 #define YYRECOVERING() (!!yyerrstatus)
567 #define YYBACKUP(Token, Value) \
569 if (yychar == YYEMPTY && yylen == 1) \
573 yytoken = YYTRANSLATE (yychar); \
579 yyerror (YY_("syntax error: cannot back up")); \
586 #define YYERRCODE 256
589 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
590 If N is 0, then set CURRENT to the empty location which ends
591 the previous symbol: RHS[0] (always defined). */
593 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
594 #ifndef YYLLOC_DEFAULT
595 # define YYLLOC_DEFAULT(Current, Rhs, N) \
599 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
600 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
601 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
602 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
606 (Current).first_line = (Current).last_line = \
607 YYRHSLOC (Rhs, 0).last_line; \
608 (Current).first_column = (Current).last_column = \
609 YYRHSLOC (Rhs, 0).last_column; \
615 /* YY_LOCATION_PRINT -- Print the location on the stream.
616 This macro was not mandated originally: define only if we know
617 we won't break user code: when these are the locations we know. */
619 #ifndef YY_LOCATION_PRINT
620 # if YYLTYPE_IS_TRIVIAL
621 # define YY_LOCATION_PRINT(File, Loc) \
622 fprintf (File, "%d.%d-%d.%d", \
623 (Loc).first_line, (Loc).first_column, \
624 (Loc).last_line, (Loc).last_column)
626 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
631 /* YYLEX -- calling `yylex' with the right arguments. */
634 # define YYLEX yylex (YYLEX_PARAM)
636 # define YYLEX yylex ()
639 /* Enable debugging if requested. */
643 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
644 # define YYFPRINTF fprintf
647 # define YYDPRINTF(Args) \
653 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
657 YYFPRINTF (stderr, "%s ", Title); \
658 yy_symbol_print (stderr, \
660 YYFPRINTF (stderr, "\n"); \
665 /*--------------------------------.
666 | Print this symbol on YYOUTPUT. |
667 `--------------------------------*/
670 #if (defined __STDC__ || defined __C99__FUNC__ \
671 || defined __cplusplus || defined _MSC_VER)
673 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
676 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
679 YYSTYPE const * const yyvaluep;
685 if (yytype < YYNTOKENS)
686 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
698 /*--------------------------------.
699 | Print this symbol on YYOUTPUT. |
700 `--------------------------------*/
702 #if (defined __STDC__ || defined __C99__FUNC__ \
703 || defined __cplusplus || defined _MSC_VER)
705 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
708 yy_symbol_print (yyoutput, yytype, yyvaluep)
711 YYSTYPE const * const yyvaluep;
714 if (yytype < YYNTOKENS)
715 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
717 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
719 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
720 YYFPRINTF (yyoutput, ")");
723 /*------------------------------------------------------------------.
724 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
726 `------------------------------------------------------------------*/
728 #if (defined __STDC__ || defined __C99__FUNC__ \
729 || defined __cplusplus || defined _MSC_VER)
731 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
734 yy_stack_print (bottom, top)
735 yytype_int16 *bottom;
739 YYFPRINTF (stderr, "Stack now");
740 for (; bottom <= top; ++bottom)
741 YYFPRINTF (stderr, " %d", *bottom);
742 YYFPRINTF (stderr, "\n");
745 # define YY_STACK_PRINT(Bottom, Top) \
748 yy_stack_print ((Bottom), (Top)); \
752 /*------------------------------------------------.
753 | Report that the YYRULE is going to be reduced. |
754 `------------------------------------------------*/
756 #if (defined __STDC__ || defined __C99__FUNC__ \
757 || defined __cplusplus || defined _MSC_VER)
759 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
762 yy_reduce_print (yyvsp, yyrule)
767 int yynrhs = yyr2[yyrule];
769 unsigned long int yylno = yyrline[yyrule];
770 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
772 /* The symbols being reduced. */
773 for (yyi = 0; yyi < yynrhs; yyi++)
775 fprintf (stderr, " $%d = ", yyi + 1);
776 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
777 &(yyvsp[(yyi + 1) - (yynrhs)])
779 fprintf (stderr, "\n");
783 # define YY_REDUCE_PRINT(Rule) \
786 yy_reduce_print (yyvsp, Rule); \
789 /* Nonzero means print parse trace. It is left uninitialized so that
790 multiple parsers can coexist. */
793 # define YYDPRINTF(Args)
794 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
795 # define YY_STACK_PRINT(Bottom, Top)
796 # define YY_REDUCE_PRINT(Rule)
797 #endif /* !YYDEBUG */
800 /* YYINITDEPTH -- initial size of the parser's stacks. */
802 # define YYINITDEPTH 200
805 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
806 if the built-in stack extension method is used).
808 Do not make this value too large; the results are undefined if
809 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
810 evaluated with infinite-precision integer arithmetic. */
813 # define YYMAXDEPTH 10000
821 # if defined __GLIBC__ && defined _STRING_H
822 # define yystrlen strlen
824 /* Return the length of YYSTR. */
825 #if (defined __STDC__ || defined __C99__FUNC__ \
826 || defined __cplusplus || defined _MSC_VER)
828 yystrlen (const char *yystr)
836 for (yylen = 0; yystr[yylen]; yylen++)
844 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
845 # define yystpcpy stpcpy
847 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
849 #if (defined __STDC__ || defined __C99__FUNC__ \
850 || defined __cplusplus || defined _MSC_VER)
852 yystpcpy (char *yydest, const char *yysrc)
855 yystpcpy (yydest, yysrc)
861 const char *yys = yysrc;
863 while ((*yyd++ = *yys++) != '\0')
872 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
873 quotes and backslashes, so that it's suitable for yyerror. The
874 heuristic is that double-quoting is unnecessary unless the string
875 contains an apostrophe, a comma, or backslash (other than
876 backslash-backslash). YYSTR is taken from yytname. If YYRES is
877 null, do not copy; instead, return the length of what the result
880 yytnamerr (char *yyres, const char *yystr)
885 char const *yyp = yystr;
892 goto do_not_strip_quotes;
896 goto do_not_strip_quotes;
909 do_not_strip_quotes: ;
913 return yystrlen (yystr);
915 return yystpcpy (yyres, yystr) - yyres;
919 /* Copy into YYRESULT an error message about the unexpected token
920 YYCHAR while in state YYSTATE. Return the number of bytes copied,
921 including the terminating null byte. If YYRESULT is null, do not
922 copy anything; just return the number of bytes that would be
923 copied. As a special case, return 0 if an ordinary "syntax error"
924 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
927 yysyntax_error (char *yyresult, int yystate, int yychar)
929 int yyn = yypact[yystate];
931 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
935 int yytype = YYTRANSLATE (yychar);
936 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
937 YYSIZE_T yysize = yysize0;
939 int yysize_overflow = 0;
940 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
941 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
945 /* This is so xgettext sees the translatable formats that are
946 constructed on the fly. */
947 YY_("syntax error, unexpected %s");
948 YY_("syntax error, unexpected %s, expecting %s");
949 YY_("syntax error, unexpected %s, expecting %s or %s");
950 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
951 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
955 static char const yyunexpected[] = "syntax error, unexpected %s";
956 static char const yyexpecting[] = ", expecting %s";
957 static char const yyor[] = " or %s";
958 char yyformat[sizeof yyunexpected
959 + sizeof yyexpecting - 1
960 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
961 * (sizeof yyor - 1))];
962 char const *yyprefix = yyexpecting;
964 /* Start YYX at -YYN if negative to avoid negative indexes in
966 int yyxbegin = yyn < 0 ? -yyn : 0;
968 /* Stay within bounds of both yycheck and yytname. */
969 int yychecklim = YYLAST - yyn + 1;
970 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
973 yyarg[0] = yytname[yytype];
974 yyfmt = yystpcpy (yyformat, yyunexpected);
976 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
977 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
979 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
983 yyformat[sizeof yyunexpected - 1] = '\0';
986 yyarg[yycount++] = yytname[yyx];
987 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
988 yysize_overflow |= (yysize1 < yysize);
990 yyfmt = yystpcpy (yyfmt, yyprefix);
995 yysize1 = yysize + yystrlen (yyf);
996 yysize_overflow |= (yysize1 < yysize);
1000 return YYSIZE_MAXIMUM;
1004 /* Avoid sprintf, as that infringes on the user's name space.
1005 Don't have undefined behavior even if the translation
1006 produced a string with the wrong number of "%s"s. */
1007 char *yyp = yyresult;
1009 while ((*yyp = *yyf) != '\0')
1011 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1013 yyp += yytnamerr (yyp, yyarg[yyi++]);
1026 #endif /* YYERROR_VERBOSE */
1029 /*-----------------------------------------------.
1030 | Release the memory associated to this symbol. |
1031 `-----------------------------------------------*/
1034 #if (defined __STDC__ || defined __C99__FUNC__ \
1035 || defined __cplusplus || defined _MSC_VER)
1037 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1040 yydestruct (yymsg, yytype, yyvaluep)
1050 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1061 /* Prevent warnings from -Wmissing-prototypes. */
1063 #ifdef YYPARSE_PARAM
1064 #if defined __STDC__ || defined __cplusplus
1065 int yyparse (void *YYPARSE_PARAM);
1069 #else /* ! YYPARSE_PARAM */
1070 #if defined __STDC__ || defined __cplusplus
1075 #endif /* ! YYPARSE_PARAM */
1079 /* The look-ahead symbol. */
1082 /* The semantic value of the look-ahead symbol. */
1085 /* Number of syntax errors so far. */
1094 #ifdef YYPARSE_PARAM
1095 #if (defined __STDC__ || defined __C99__FUNC__ \
1096 || defined __cplusplus || defined _MSC_VER)
1098 yyparse (void *YYPARSE_PARAM)
1101 yyparse (YYPARSE_PARAM)
1102 void *YYPARSE_PARAM;
1104 #else /* ! YYPARSE_PARAM */
1105 #if (defined __STDC__ || defined __C99__FUNC__ \
1106 || defined __cplusplus || defined _MSC_VER)
1120 /* Number of tokens to shift before error messages enabled. */
1122 /* Look-ahead token as an internal (translated) token number. */
1125 /* Buffer for error messages, and its allocated size. */
1127 char *yymsg = yymsgbuf;
1128 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1131 /* Three stacks and their tools:
1132 `yyss': related to states,
1133 `yyvs': related to semantic values,
1134 `yyls': related to locations.
1136 Refer to the stacks thru separate pointers, to allow yyoverflow
1137 to reallocate them elsewhere. */
1139 /* The state stack. */
1140 yytype_int16 yyssa[YYINITDEPTH];
1141 yytype_int16 *yyss = yyssa;
1142 yytype_int16 *yyssp;
1144 /* The semantic value stack. */
1145 YYSTYPE yyvsa[YYINITDEPTH];
1146 YYSTYPE *yyvs = yyvsa;
1151 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1153 YYSIZE_T yystacksize = YYINITDEPTH;
1155 /* The variables used to return semantic value and location from the
1160 /* The number of symbols on the RHS of the reduced rule.
1161 Keep to zero when no symbol should be popped. */
1164 YYDPRINTF ((stderr, "Starting parse\n"));
1169 yychar = YYEMPTY; /* Cause a token to be read. */
1171 /* Initialize stack pointers.
1172 Waste one element of value and location stack
1173 so that they stay on the same level as the state stack.
1174 The wasted elements are never initialized. */
1181 /*------------------------------------------------------------.
1182 | yynewstate -- Push a new state, which is found in yystate. |
1183 `------------------------------------------------------------*/
1185 /* In all cases, when you get here, the value and location stacks
1186 have just been pushed. So pushing a state here evens the stacks. */
1192 if (yyss + yystacksize - 1 <= yyssp)
1194 /* Get the current used size of the three stacks, in elements. */
1195 YYSIZE_T yysize = yyssp - yyss + 1;
1199 /* Give user a chance to reallocate the stack. Use copies of
1200 these so that the &'s don't force the real ones into
1202 YYSTYPE *yyvs1 = yyvs;
1203 yytype_int16 *yyss1 = yyss;
1206 /* Each stack pointer address is followed by the size of the
1207 data in use in that stack, in bytes. This used to be a
1208 conditional around just the two extra args, but that might
1209 be undefined if yyoverflow is a macro. */
1210 yyoverflow (YY_("memory exhausted"),
1211 &yyss1, yysize * sizeof (*yyssp),
1212 &yyvs1, yysize * sizeof (*yyvsp),
1219 #else /* no yyoverflow */
1220 # ifndef YYSTACK_RELOCATE
1221 goto yyexhaustedlab;
1223 /* Extend the stack our own way. */
1224 if (YYMAXDEPTH <= yystacksize)
1225 goto yyexhaustedlab;
1227 if (YYMAXDEPTH < yystacksize)
1228 yystacksize = YYMAXDEPTH;
1231 yytype_int16 *yyss1 = yyss;
1232 union yyalloc *yyptr =
1233 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1235 goto yyexhaustedlab;
1236 YYSTACK_RELOCATE (yyss);
1237 YYSTACK_RELOCATE (yyvs);
1239 # undef YYSTACK_RELOCATE
1241 YYSTACK_FREE (yyss1);
1244 #endif /* no yyoverflow */
1246 yyssp = yyss + yysize - 1;
1247 yyvsp = yyvs + yysize - 1;
1250 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1251 (unsigned long int) yystacksize));
1253 if (yyss + yystacksize - 1 <= yyssp)
1257 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1266 /* Do appropriate processing given the current state. Read a
1267 look-ahead token if we need one and don't already have one. */
1269 /* First try to decide what to do without reference to look-ahead token. */
1270 yyn = yypact[yystate];
1271 if (yyn == YYPACT_NINF)
1274 /* Not known => get a look-ahead token if don't already have one. */
1276 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1277 if (yychar == YYEMPTY)
1279 YYDPRINTF ((stderr, "Reading a token: "));
1283 if (yychar <= YYEOF)
1285 yychar = yytoken = YYEOF;
1286 YYDPRINTF ((stderr, "Now at end of input.\n"));
1290 yytoken = YYTRANSLATE (yychar);
1291 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1294 /* If the proper action on seeing token YYTOKEN is to reduce or to
1295 detect an error, take that action. */
1297 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1302 if (yyn == 0 || yyn == YYTABLE_NINF)
1311 /* Count tokens shifted since error; after three, turn off error
1316 /* Shift the look-ahead token. */
1317 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1319 /* Discard the shifted token unless it is eof. */
1320 if (yychar != YYEOF)
1329 /*-----------------------------------------------------------.
1330 | yydefault -- do the default action for the current state. |
1331 `-----------------------------------------------------------*/
1333 yyn = yydefact[yystate];
1339 /*-----------------------------.
1340 | yyreduce -- Do a reduction. |
1341 `-----------------------------*/
1343 /* yyn is the number of a rule to reduce with. */
1346 /* If YYLEN is nonzero, implement the default value of the action:
1349 Otherwise, the following line sets YYVAL to garbage.
1350 This behavior is undocumented and Bison
1351 users should not rely upon it. Assigning to YYVAL
1352 unconditionally makes the parser a bit smaller, and it avoids a
1353 GCC warning that YYVAL may be used uninitialized. */
1354 yyval = yyvsp[1-yylen];
1357 YY_REDUCE_PRINT (yyn);
1362 {xml_result = (yyvsp[(1) - (1)].x_t);;}
1367 {(yyval.x_t) = new xml_t((yyvsp[(1) - (3)].tg_t),(yyvsp[(2) - (3)].xlist_t),(yyvsp[(3) - (3)].strval));;}
1372 {(yyval.x_t)=new xml_t((yyvsp[(1) - (2)].tg_t),(yyvsp[(2) - (2)].strval));;}
1377 {(yyval.x_t)=new xml_t((yyvsp[(2) - (5)].strval),(yyvsp[(3) - (5)].nvpl));;}
1382 {(yyval.tg_t) = new tag_t((yyvsp[(2) - (4)].strval), (yyvsp[(3) - (4)].nvpl));;}
1387 {(yyval.strval)=(yyvsp[(3) - (4)].strval);;}
1392 {(yyval.xlist_t)=new xml_list_t((yyvsp[(1) - (1)].x_t));;}
1397 {(yyval.xlist_t)=(yyvsp[(1) - (2)].xlist_t)->append((yyvsp[(2) - (2)].x_t));;}
1402 {(yyval.nvpl)=(yyvsp[(1) - (1)].nvpl);;}
1407 {(yyval.nvpl)=new name_val_list_t();;}
1412 {(yyval.nvpl) = new name_val_list_t((yyvsp[(1) - (1)].nvpt));;}
1417 {(yyval.nvpl) = (yyvsp[(1) - (2)].nvpl)->append((yyvsp[(2) - (2)].nvpt));;}
1422 {(yyval.nvpt) = new name_val_pair_t((yyvsp[(1) - (3)].strval),(yyvsp[(3) - (3)].strval));;}
1426 /* Line 1267 of yacc.c. */
1427 #line 1428 "xml.tab.cc"
1430 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1434 YY_STACK_PRINT (yyss, yyssp);
1439 /* Now `shift' the result of the reduction. Determine what state
1440 that goes to, based on the state we popped back to and the rule
1441 number reduced by. */
1445 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1446 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1447 yystate = yytable[yystate];
1449 yystate = yydefgoto[yyn - YYNTOKENS];
1454 /*------------------------------------.
1455 | yyerrlab -- here on detecting error |
1456 `------------------------------------*/
1458 /* If not already recovering from an error, report this error. */
1462 #if ! YYERROR_VERBOSE
1463 yyerror (YY_("syntax error"));
1466 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1467 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1469 YYSIZE_T yyalloc = 2 * yysize;
1470 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1471 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1472 if (yymsg != yymsgbuf)
1473 YYSTACK_FREE (yymsg);
1474 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1476 yymsg_alloc = yyalloc;
1480 yymsg_alloc = sizeof yymsgbuf;
1484 if (0 < yysize && yysize <= yymsg_alloc)
1486 (void) yysyntax_error (yymsg, yystate, yychar);
1491 yyerror (YY_("syntax error"));
1493 goto yyexhaustedlab;
1501 if (yyerrstatus == 3)
1503 /* If just tried and failed to reuse look-ahead token after an
1504 error, discard it. */
1506 if (yychar <= YYEOF)
1508 /* Return failure if at end of input. */
1509 if (yychar == YYEOF)
1514 yydestruct ("Error: discarding",
1520 /* Else will try to reuse look-ahead token after shifting the error
1525 /*---------------------------------------------------.
1526 | yyerrorlab -- error raised explicitly by YYERROR. |
1527 `---------------------------------------------------*/
1530 /* Pacify compilers like GCC when the user code never invokes
1531 YYERROR and the label yyerrorlab therefore never appears in user
1533 if (/*CONSTCOND*/ 0)
1536 /* Do not reclaim the symbols of the rule which action triggered
1540 YY_STACK_PRINT (yyss, yyssp);
1545 /*-------------------------------------------------------------.
1546 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1547 `-------------------------------------------------------------*/
1549 yyerrstatus = 3; /* Each real token shifted decrements this. */
1553 yyn = yypact[yystate];
1554 if (yyn != YYPACT_NINF)
1557 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1565 /* Pop the current state because it cannot handle the error token. */
1570 yydestruct ("Error: popping",
1571 yystos[yystate], yyvsp);
1574 YY_STACK_PRINT (yyss, yyssp);
1583 /* Shift the error token. */
1584 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1590 /*-------------------------------------.
1591 | yyacceptlab -- YYACCEPT comes here. |
1592 `-------------------------------------*/
1597 /*-----------------------------------.
1598 | yyabortlab -- YYABORT comes here. |
1599 `-----------------------------------*/
1605 /*-------------------------------------------------.
1606 | yyexhaustedlab -- memory exhaustion comes here. |
1607 `-------------------------------------------------*/
1609 yyerror (YY_("memory exhausted"));
1615 if (yychar != YYEOF && yychar != YYEMPTY)
1616 yydestruct ("Cleanup: discarding lookahead",
1618 /* Do not reclaim the symbols of the rule which action triggered
1619 this YYABORT or YYACCEPT. */
1621 YY_STACK_PRINT (yyss, yyssp);
1622 while (yyssp != yyss)
1624 yydestruct ("Cleanup: popping",
1625 yystos[*yyssp], yyvsp);
1630 YYSTACK_FREE (yyss);
1633 if (yymsg != yymsgbuf)
1634 YYSTACK_FREE (yymsg);
1636 /* Make sure YYID is used. */
1637 return YYID (yyresult);