Initial commit
[com/gs-lite.git] / src / ftacmp / xml.tab.cc
1 /* A Bison parser, made by GNU Bison 1.875c.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 /* Skeleton name.  */
40 #define YYSKELETON_NAME "yacc.c"
41
42 /* Pure parsers.  */
43 #define YYPURE 0
44
45 /* Using locations.  */
46 #define YYLSP_NEEDED 0
47
48 /* If NAME_PREFIX is specified substitute the variables and functions
49    names.  */
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
57
58
59 /* Tokens.  */
60 #ifndef YYTOKENTYPE
61 # define YYTOKENTYPE
62    /* Put the tokens into the symbol table, so that GDB and other debuggers
63       know about them.  */
64    enum yytokentype {
65      NAME = 258,
66      STRING_TOKEN = 259
67    };
68 #endif
69 #define NAME 258
70 #define STRING_TOKEN 259
71
72
73
74
75 /* Copy the first part of user declarations.  */
76 #line 8 "xml.y"
77
78
79
80 #include <stdio.h>
81
82 /*              Some addn'l includes, necessary but not included by the
83                 bison generated code.
84 */
85
86 #include <stdlib.h>
87
88 /*              prototypes for the parser callbacks.
89 */
90
91 #include "xml_t.h"
92
93
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;
98
99 extern int xmlParserdebug;
100 extern void xmlParsererror(char *s);
101 extern int xmlParserlex();
102
103
104 #define YYDEBUG 1
105
106
107
108 /* Enabling traces.  */
109 #ifndef YYDEBUG
110 # define YYDEBUG 0
111 #endif
112
113 /* Enabling verbose error messages.  */
114 #ifdef YYERROR_VERBOSE
115 # undef YYERROR_VERBOSE
116 # define YYERROR_VERBOSE 1
117 #else
118 # define YYERROR_VERBOSE 0
119 #endif
120
121 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
122 #line 42 "xml.y"
123 typedef union YYSTYPE {
124         int intval;
125         double floatval;
126         char *strval;
127         int subtok;
128
129         /*                      for FTA definition.     */
130
131 } YYSTYPE;
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
137 #endif
138
139
140
141 /* Copy the second part of user declarations.  */
142
143
144 /* Line 214 of yacc.c.  */
145 #line 146 "xml.tab.cc"
146
147 #if ! defined (yyoverflow) || YYERROR_VERBOSE
148
149 /* The parser invokes alloca or malloc; define the necessary symbols.  */
150
151 # ifdef YYSTACK_USE_ALLOCA
152 #  if YYSTACK_USE_ALLOCA
153 #   define YYSTACK_ALLOC alloca
154 #  endif
155 # else
156 #  if defined (alloca) || defined (_ALLOCA_H)
157 #   define YYSTACK_ALLOC alloca
158 #  else
159 #   ifdef __GNUC__
160 #    define YYSTACK_ALLOC __builtin_alloca
161 #   endif
162 #  endif
163 # endif
164
165 # ifdef YYSTACK_ALLOC
166    /* Pacify GCC's `empty if-body' warning. */
167 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
168 # else
169 #  if defined (__STDC__) || defined (__cplusplus)
170 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
171 #   define YYSIZE_T size_t
172 #  endif
173 #  define YYSTACK_ALLOC malloc
174 #  define YYSTACK_FREE free
175 # endif
176 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
177
178
179 #if (! defined (yyoverflow) \
180      && (! defined (__cplusplus) \
181          || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
182
183 /* A type that is properly aligned for any stack member.  */
184 union yyalloc
185 {
186   short yyss;
187   YYSTYPE yyvs;
188   };
189
190 /* The size of the maximum gap between one aligned stack and the next.  */
191 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
192
193 /* The size of an array large to enough to hold all stacks, each with
194    N elements.  */
195 # define YYSTACK_BYTES(N) \
196      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
197       + YYSTACK_GAP_MAXIMUM)
198
199 /* Copy COUNT objects from FROM to TO.  The source and destination do
200    not overlap.  */
201 # ifndef YYCOPY
202 #  if defined (__GNUC__) && 1 < __GNUC__
203 #   define YYCOPY(To, From, Count) \
204       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
205 #  else
206 #   define YYCOPY(To, From, Count)              \
207       do                                        \
208         {                                       \
209           register YYSIZE_T yyi;                \
210           for (yyi = 0; yyi < (Count); yyi++)   \
211             (To)[yyi] = (From)[yyi];            \
212         }                                       \
213       while (0)
214 #  endif
215 # endif
216
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
221    stack.  */
222 # define YYSTACK_RELOCATE(Stack)                                        \
223     do                                                                  \
224       {                                                                 \
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);                          \
230       }                                                                 \
231     while (0)
232
233 #endif
234
235 #if defined (__STDC__) || defined (__cplusplus)
236    typedef signed char yysigned_char;
237 #else
238    typedef short yysigned_char;
239 #endif
240
241 /* YYFINAL -- State number of the termination state. */
242 #define YYFINAL  6
243 /* YYLAST -- Last index in YYTABLE.  */
244 #define YYLAST   25
245
246 /* YYNTOKENS -- Number of terminals. */
247 #define YYNTOKENS  9
248 /* YYNNTS -- Number of nonterminals. */
249 #define YYNNTS  9
250 /* YYNRULES -- Number of rules. */
251 #define YYNRULES  14
252 /* YYNRULES -- Number of states. */
253 #define YYNSTATES  26
254
255 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
256 #define YYUNDEFTOK  2
257 #define YYMAXUTOK   259
258
259 #define YYTRANSLATE(YYX)                                                \
260   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
261
262 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
263 static const unsigned char yytranslate[] =
264 {
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
291 };
292
293 #if YYDEBUG
294 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
295    YYRHS.  */
296 static const unsigned char yyprhs[] =
297 {
298        0,     0,     3,     5,     9,    12,    18,    23,    28,    30,
299       33,    35,    36,    38,    41
300 };
301
302 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
303 static const yysigned_char yyrhs[] =
304 {
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,
309       -1,     3,     8,     4,    -1
310 };
311
312 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
313 static const unsigned char yyrline[] =
314 {
315        0,    60,    60,    64,    65,    66,    72,    76,    81,    82,
316       86,    87,    91,    93,    98
317 };
318 #endif
319
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[] =
324 {
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
328 };
329 #endif
330
331 # ifdef YYPRINT
332 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
333    token YYLEX-NUM.  */
334 static const unsigned short yytoknum[] =
335 {
336        0,   256,   257,   258,   259,    60,    47,    62,    61
337 };
338 # endif
339
340 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
341 static const unsigned char yyr1[] =
342 {
343        0,     9,    10,    11,    11,    11,    12,    13,    14,    14,
344       15,    15,    16,    16,    17
345 };
346
347 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
348 static const unsigned char yyr2[] =
349 {
350        0,     2,     1,     3,     2,     5,     4,     4,     1,     2,
351        1,     0,     1,     2,     3
352 };
353
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[] =
358 {
359        0,     0,     0,     2,     0,    11,     1,     0,     8,     4,
360        0,     0,     0,    10,    12,     0,     9,     3,     0,     0,
361        6,    13,     0,    14,     5,     7
362 };
363
364 /* YYDEFGOTO[NTERM-NUM]. */
365 static const yysigned_char yydefgoto[] =
366 {
367       -1,     2,     3,     4,     9,    10,    12,    13,    14
368 };
369
370 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
371    STATE-NUM.  */
372 #define YYPACT_NINF -5
373 static const yysigned_char yypact[] =
374 {
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
378 };
379
380 /* YYPGOTO[NTERM-NUM].  */
381 static const yysigned_char yypgoto[] =
382 {
383       -5,    -5,    -4,    -5,    11,    -5,    -5,    -5,    12
384 };
385
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[] =
392 {
393        8,     5,     1,     5,    15,     6,    16,    19,    20,     7,
394       11,    18,    22,    24,    23,    25,     0,     0,     0,     0,
395        0,    17,     0,     0,     0,    21
396 };
397
398 static const yysigned_char yycheck[] =
399 {
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
403 };
404
405 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
406    symbol of state STATE-NUM.  */
407 static const unsigned char yystos[] =
408 {
409        0,     5,    10,    11,    12,     3,     0,     5,    11,    13,
410       14,     3,    15,    16,    17,     6,    11,    13,     8,     6,
411        7,    17,     3,     4,     7,     7
412 };
413
414 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
415 # define YYSIZE_T __SIZE_TYPE__
416 #endif
417 #if ! defined (YYSIZE_T) && defined (size_t)
418 # define YYSIZE_T size_t
419 #endif
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
424 # endif
425 #endif
426 #if ! defined (YYSIZE_T)
427 # define YYSIZE_T unsigned int
428 #endif
429
430 #define yyerrok         (yyerrstatus = 0)
431 #define yyclearin       (yychar = YYEMPTY)
432 #define YYEMPTY         (-2)
433 #define YYEOF           0
434
435 #define YYACCEPT        goto yyacceptlab
436 #define YYABORT         goto yyabortlab
437 #define YYERROR         goto yyerrorlab
438
439
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.  */
443
444 #define YYFAIL          goto yyerrlab
445
446 #define YYRECOVERING()  (!!yyerrstatus)
447
448 #define YYBACKUP(Token, Value)                                  \
449 do                                                              \
450   if (yychar == YYEMPTY && yylen == 1)                          \
451     {                                                           \
452       yychar = (Token);                                         \
453       yylval = (Value);                                         \
454       yytoken = YYTRANSLATE (yychar);                           \
455       YYPOPSTACK;                                               \
456       goto yybackup;                                            \
457     }                                                           \
458   else                                                          \
459     {                                                           \
460       yyerror ("syntax error: cannot back up");\
461       YYERROR;                                                  \
462     }                                                           \
463 while (0)
464
465 #define YYTERROR        1
466 #define YYERRCODE       256
467
468 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
469    are run).  */
470
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)
477 #endif
478
479 /* YYLEX -- calling `yylex' with the right arguments.  */
480
481 #ifdef YYLEX_PARAM
482 # define YYLEX yylex (YYLEX_PARAM)
483 #else
484 # define YYLEX yylex ()
485 #endif
486
487 /* Enable debugging if requested.  */
488 #if YYDEBUG
489
490 # ifndef YYFPRINTF
491 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
492 #  define YYFPRINTF fprintf
493 # endif
494
495 # define YYDPRINTF(Args)                        \
496 do {                                            \
497   if (yydebug)                                  \
498     YYFPRINTF Args;                             \
499 } while (0)
500
501 # define YYDSYMPRINT(Args)                      \
502 do {                                            \
503   if (yydebug)                                  \
504     yysymprint Args;                            \
505 } while (0)
506
507 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
508 do {                                                            \
509   if (yydebug)                                                  \
510     {                                                           \
511       YYFPRINTF (stderr, "%s ", Title);                         \
512       yysymprint (stderr,                                       \
513                   Token, Value);        \
514       YYFPRINTF (stderr, "\n");                                 \
515     }                                                           \
516 } while (0)
517
518 /*------------------------------------------------------------------.
519 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
520 | TOP (included).                                                   |
521 `------------------------------------------------------------------*/
522
523 #if defined (__STDC__) || defined (__cplusplus)
524 static void
525 yy_stack_print (short *bottom, short *top)
526 #else
527 static void
528 yy_stack_print (bottom, top)
529     short *bottom;
530     short *top;
531 #endif
532 {
533   YYFPRINTF (stderr, "Stack now");
534   for (/* Nothing. */; bottom <= top; ++bottom)
535     YYFPRINTF (stderr, " %d", *bottom);
536   YYFPRINTF (stderr, "\n");
537 }
538
539 # define YY_STACK_PRINT(Bottom, Top)                            \
540 do {                                                            \
541   if (yydebug)                                                  \
542     yy_stack_print ((Bottom), (Top));                           \
543 } while (0)
544
545
546 /*------------------------------------------------.
547 | Report that the YYRULE is going to be reduced.  |
548 `------------------------------------------------*/
549
550 #if defined (__STDC__) || defined (__cplusplus)
551 static void
552 yy_reduce_print (int yyrule)
553 #else
554 static void
555 yy_reduce_print (yyrule)
556     int yyrule;
557 #endif
558 {
559   int yyi;
560   unsigned int yylno = yyrline[yyrule];
561   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
562              yyrule - 1, yylno);
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]]);
567 }
568
569 # define YY_REDUCE_PRINT(Rule)          \
570 do {                                    \
571   if (yydebug)                          \
572     yy_reduce_print (Rule);             \
573 } while (0)
574
575 /* Nonzero means print parse trace.  It is left uninitialized so that
576    multiple parsers can coexist.  */
577 int yydebug;
578 #else /* !YYDEBUG */
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 */
585
586
587 /* YYINITDEPTH -- initial size of the parser's stacks.  */
588 #ifndef YYINITDEPTH
589 # define YYINITDEPTH 200
590 #endif
591
592 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
593    if the built-in stack extension method is used).
594
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.  */
598
599 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
600 # undef YYMAXDEPTH
601 #endif
602
603 #ifndef YYMAXDEPTH
604 # define YYMAXDEPTH 10000
605 #endif
606
607 \f
608
609 #if YYERROR_VERBOSE
610
611 # ifndef yystrlen
612 #  if defined (__GLIBC__) && defined (_STRING_H)
613 #   define yystrlen strlen
614 #  else
615 /* Return the length of YYSTR.  */
616 static YYSIZE_T
617 #   if defined (__STDC__) || defined (__cplusplus)
618 yystrlen (const char *yystr)
619 #   else
620 yystrlen (yystr)
621      const char *yystr;
622 #   endif
623 {
624   register const char *yys = yystr;
625
626   while (*yys++ != '\0')
627     continue;
628
629   return yys - yystr - 1;
630 }
631 #  endif
632 # endif
633
634 # ifndef yystpcpy
635 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
636 #   define yystpcpy stpcpy
637 #  else
638 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
639    YYDEST.  */
640 static char *
641 #   if defined (__STDC__) || defined (__cplusplus)
642 yystpcpy (char *yydest, const char *yysrc)
643 #   else
644 yystpcpy (yydest, yysrc)
645      char *yydest;
646      const char *yysrc;
647 #   endif
648 {
649   register char *yyd = yydest;
650   register const char *yys = yysrc;
651
652   while ((*yyd++ = *yys++) != '\0')
653     continue;
654
655   return yyd - 1;
656 }
657 #  endif
658 # endif
659
660 #endif /* !YYERROR_VERBOSE */
661
662 \f
663
664 #if YYDEBUG
665 /*--------------------------------.
666 | Print this symbol on YYOUTPUT.  |
667 `--------------------------------*/
668
669 #if defined (__STDC__) || defined (__cplusplus)
670 static void
671 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
672 #else
673 static void
674 yysymprint (yyoutput, yytype, yyvaluep)
675     FILE *yyoutput;
676     int yytype;
677     YYSTYPE *yyvaluep;
678 #endif
679 {
680   /* Pacify ``unused variable'' warnings.  */
681   (void) yyvaluep;
682
683   if (yytype < YYNTOKENS)
684     {
685       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
686 # ifdef YYPRINT
687       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
688 # endif
689     }
690   else
691     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
692
693   switch (yytype)
694     {
695       default:
696         break;
697     }
698   YYFPRINTF (yyoutput, ")");
699 }
700
701 #endif /* ! YYDEBUG */
702 /*-----------------------------------------------.
703 | Release the memory associated to this symbol.  |
704 `-----------------------------------------------*/
705
706 #if defined (__STDC__) || defined (__cplusplus)
707 static void
708 yydestruct (int yytype, YYSTYPE *yyvaluep)
709 #else
710 static void
711 yydestruct (yytype, yyvaluep)
712     int yytype;
713     YYSTYPE *yyvaluep;
714 #endif
715 {
716   /* Pacify ``unused variable'' warnings.  */
717   (void) yyvaluep;
718
719   switch (yytype)
720     {
721
722       default:
723         break;
724     }
725 }
726 \f
727
728 /* Prevent warnings from -Wmissing-prototypes.  */
729
730 #ifdef YYPARSE_PARAM
731 # if defined (__STDC__) || defined (__cplusplus)
732 int yyparse (void *YYPARSE_PARAM);
733 # else
734 int yyparse ();
735 # endif
736 #else /* ! YYPARSE_PARAM */
737 #if defined (__STDC__) || defined (__cplusplus)
738 int yyparse (void);
739 #else
740 int yyparse ();
741 #endif
742 #endif /* ! YYPARSE_PARAM */
743
744
745
746 /* The lookahead symbol.  */
747 int yychar;
748
749 /* The semantic value of the lookahead symbol.  */
750 YYSTYPE yylval;
751
752 /* Number of syntax errors so far.  */
753 int yynerrs;
754
755
756
757 /*----------.
758 | yyparse.  |
759 `----------*/
760
761 #ifdef YYPARSE_PARAM
762 # if defined (__STDC__) || defined (__cplusplus)
763 int yyparse (void *YYPARSE_PARAM)
764 # else
765 int yyparse (YYPARSE_PARAM)
766   void *YYPARSE_PARAM;
767 # endif
768 #else /* ! YYPARSE_PARAM */
769 #if defined (__STDC__) || defined (__cplusplus)
770 int
771 yyparse (void)
772 #else
773 int
774 yyparse ()
775
776 #endif
777 #endif
778 {
779   
780   register int yystate;
781   register int yyn;
782   int yyresult;
783   /* Number of tokens to shift before error messages enabled.  */
784   int yyerrstatus;
785   /* Lookahead token as an internal (translated) token number.  */
786   int yytoken = 0;
787
788   /* Three stacks and their tools:
789      `yyss': related to states,
790      `yyvs': related to semantic values,
791      `yyls': related to locations.
792
793      Refer to the stacks thru separate pointers, to allow yyoverflow
794      to reallocate them elsewhere.  */
795
796   /* The state stack.  */
797   short yyssa[YYINITDEPTH];
798   short *yyss = yyssa;
799   register short *yyssp;
800
801   /* The semantic value stack.  */
802   YYSTYPE yyvsa[YYINITDEPTH];
803   YYSTYPE *yyvs = yyvsa;
804   register YYSTYPE *yyvsp;
805
806
807
808 #define YYPOPSTACK   (yyvsp--, yyssp--)
809
810   YYSIZE_T yystacksize = YYINITDEPTH;
811
812   /* The variables used to return semantic value and location from the
813      action routines.  */
814   YYSTYPE yyval;
815
816
817   /* When reducing, the number of symbols on the RHS of the reduced
818      rule.  */
819   int yylen;
820
821   YYDPRINTF ((stderr, "Starting parse\n"));
822
823   yystate = 0;
824   yyerrstatus = 0;
825   yynerrs = 0;
826   yychar = YYEMPTY;             /* Cause a token to be read.  */
827
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.  */
832
833   yyssp = yyss;
834   yyvsp = yyvs;
835
836   goto yysetstate;
837
838 /*------------------------------------------------------------.
839 | yynewstate -- Push a new state, which is found in yystate.  |
840 `------------------------------------------------------------*/
841  yynewstate:
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.
844      */
845   yyssp++;
846
847  yysetstate:
848   *yyssp = yystate;
849
850   if (yyss + yystacksize - 1 <= yyssp)
851     {
852       /* Get the current used size of the three stacks, in elements.  */
853       YYSIZE_T yysize = yyssp - yyss + 1;
854
855 #ifdef yyoverflow
856       {
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
859            memory.  */
860         YYSTYPE *yyvs1 = yyvs;
861         short *yyss1 = yyss;
862
863
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),
871
872                     &yystacksize);
873
874         yyss = yyss1;
875         yyvs = yyvs1;
876       }
877 #else /* no yyoverflow */
878 # ifndef YYSTACK_RELOCATE
879       goto yyoverflowlab;
880 # else
881       /* Extend the stack our own way.  */
882       if (YYMAXDEPTH <= yystacksize)
883         goto yyoverflowlab;
884       yystacksize *= 2;
885       if (YYMAXDEPTH < yystacksize)
886         yystacksize = YYMAXDEPTH;
887
888       {
889         short *yyss1 = yyss;
890         union yyalloc *yyptr =
891           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
892         if (! yyptr)
893           goto yyoverflowlab;
894         YYSTACK_RELOCATE (yyss);
895         YYSTACK_RELOCATE (yyvs);
896
897 #  undef YYSTACK_RELOCATE
898         if (yyss1 != yyssa)
899           YYSTACK_FREE (yyss1);
900       }
901 # endif
902 #endif /* no yyoverflow */
903
904       yyssp = yyss + yysize - 1;
905       yyvsp = yyvs + yysize - 1;
906
907
908       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
909                   (unsigned long int) yystacksize));
910
911       if (yyss + yystacksize - 1 <= yyssp)
912         YYABORT;
913     }
914
915   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
916
917   goto yybackup;
918
919 /*-----------.
920 | yybackup.  |
921 `-----------*/
922 yybackup:
923
924 /* Do appropriate processing given the current state.  */
925 /* Read a lookahead token if we need one and don't already have one.  */
926 /* yyresume: */
927
928   /* First try to decide what to do without reference to lookahead token.  */
929
930   yyn = yypact[yystate];
931   if (yyn == YYPACT_NINF)
932     goto yydefault;
933
934   /* Not known => get a lookahead token if don't already have one.  */
935
936   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
937   if (yychar == YYEMPTY)
938     {
939       YYDPRINTF ((stderr, "Reading a token: "));
940       yychar = YYLEX;
941     }
942
943   if (yychar <= YYEOF)
944     {
945       yychar = yytoken = YYEOF;
946       YYDPRINTF ((stderr, "Now at end of input.\n"));
947     }
948   else
949     {
950       yytoken = YYTRANSLATE (yychar);
951       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
952     }
953
954   /* If the proper action on seeing token YYTOKEN is to reduce or to
955      detect an error, take that action.  */
956   yyn += yytoken;
957   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
958     goto yydefault;
959   yyn = yytable[yyn];
960   if (yyn <= 0)
961     {
962       if (yyn == 0 || yyn == YYTABLE_NINF)
963         goto yyerrlab;
964       yyn = -yyn;
965       goto yyreduce;
966     }
967
968   if (yyn == YYFINAL)
969     YYACCEPT;
970
971   /* Shift the lookahead token.  */
972   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
973
974   /* Discard the token being shifted unless it is eof.  */
975   if (yychar != YYEOF)
976     yychar = YYEMPTY;
977
978   *++yyvsp = yylval;
979
980
981   /* Count tokens shifted since error; after three, turn off error
982      status.  */
983   if (yyerrstatus)
984     yyerrstatus--;
985
986   yystate = yyn;
987   goto yynewstate;
988
989
990 /*-----------------------------------------------------------.
991 | yydefault -- do the default action for the current state.  |
992 `-----------------------------------------------------------*/
993 yydefault:
994   yyn = yydefact[yystate];
995   if (yyn == 0)
996     goto yyerrlab;
997   goto yyreduce;
998
999
1000 /*-----------------------------.
1001 | yyreduce -- Do a reduction.  |
1002 `-----------------------------*/
1003 yyreduce:
1004   /* yyn is the number of a rule to reduce with.  */
1005   yylen = yyr2[yyn];
1006
1007   /* If YYLEN is nonzero, implement the default value of the action:
1008      `$$ = $1'.
1009
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];
1016
1017
1018   YY_REDUCE_PRINT (yyn);
1019   switch (yyn)
1020     {
1021         case 5:
1022 #line 67 "xml.y"
1023     {xml_leaves->add_leaf(new xml_leaf_t(yyvsp[-3].strval, xml_attr_vec, xml_val_vec));
1024                 ;}
1025     break;
1026
1027   case 11:
1028 #line 87 "xml.y"
1029     {xml_attr_vec.clear(); xml_val_vec.clear();;}
1030     break;
1031
1032   case 12:
1033 #line 91 "xml.y"
1034     {xml_attr_vec.clear();  xml_attr_vec.push_back(xml_a);
1035                          xml_val_vec.clear(); xml_val_vec.push_back(xml_v); ;}
1036     break;
1037
1038   case 13:
1039 #line 93 "xml.y"
1040     {xml_attr_vec.push_back(xml_a);
1041                                         xml_val_vec.push_back(xml_v); ;}
1042     break;
1043
1044   case 14:
1045 #line 98 "xml.y"
1046     {xml_a = yyvsp[-2].strval; xml_v = yyvsp[0].strval;;}
1047     break;
1048
1049
1050     }
1051
1052 /* Line 993 of yacc.c.  */
1053 #line 1054 "xml.tab.cc"
1054 \f
1055   yyvsp -= yylen;
1056   yyssp -= yylen;
1057
1058
1059   YY_STACK_PRINT (yyss, yyssp);
1060
1061   *++yyvsp = yyval;
1062
1063
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.  */
1067
1068   yyn = yyr1[yyn];
1069
1070   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1071   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1072     yystate = yytable[yystate];
1073   else
1074     yystate = yydefgoto[yyn - YYNTOKENS];
1075
1076   goto yynewstate;
1077
1078
1079 /*------------------------------------.
1080 | yyerrlab -- here on detecting error |
1081 `------------------------------------*/
1082 yyerrlab:
1083   /* If not already recovering from an error, report this error.  */
1084   if (!yyerrstatus)
1085     {
1086       ++yynerrs;
1087 #if YYERROR_VERBOSE
1088       yyn = yypact[yystate];
1089
1090       if (YYPACT_NINF < yyn && yyn < YYLAST)
1091         {
1092           YYSIZE_T yysize = 0;
1093           int yytype = YYTRANSLATE (yychar);
1094           const char* yyprefix;
1095           char *yymsg;
1096           int yyx;
1097
1098           /* Start YYX at -YYN if negative to avoid negative indexes in
1099              YYCHECK.  */
1100           int yyxbegin = yyn < 0 ? -yyn : 0;
1101
1102           /* Stay within bounds of both yycheck and yytname.  */
1103           int yychecklim = YYLAST - yyn;
1104           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1105           int yycount = 0;
1106
1107           yyprefix = ", expecting ";
1108           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1109             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1110               {
1111                 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1112                 yycount += 1;
1113                 if (yycount == 5)
1114                   {
1115                     yysize = 0;
1116                     break;
1117                   }
1118               }
1119           yysize += (sizeof ("syntax error, unexpected ")
1120                      + yystrlen (yytname[yytype]));
1121           yymsg = (char *) YYSTACK_ALLOC (yysize);
1122           if (yymsg != 0)
1123             {
1124               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1125               yyp = yystpcpy (yyp, yytname[yytype]);
1126
1127               if (yycount < 5)
1128                 {
1129                   yyprefix = ", expecting ";
1130                   for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1131                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1132                       {
1133                         yyp = yystpcpy (yyp, yyprefix);
1134                         yyp = yystpcpy (yyp, yytname[yyx]);
1135                         yyprefix = " or ";
1136                       }
1137                 }
1138               yyerror (yymsg);
1139               YYSTACK_FREE (yymsg);
1140             }
1141           else
1142             yyerror ("syntax error; also virtual memory exhausted");
1143         }
1144       else
1145 #endif /* YYERROR_VERBOSE */
1146         yyerror ("syntax error");
1147     }
1148
1149
1150
1151   if (yyerrstatus == 3)
1152     {
1153       /* If just tried and failed to reuse lookahead token after an
1154          error, discard it.  */
1155
1156       if (yychar <= YYEOF)
1157         {
1158           /* If at end of input, pop the error token,
1159              then the rest of the stack, then return failure.  */
1160           if (yychar == YYEOF)
1161              for (;;)
1162                {
1163                  YYPOPSTACK;
1164                  if (yyssp == yyss)
1165                    YYABORT;
1166                  YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1167                  yydestruct (yystos[*yyssp], yyvsp);
1168                }
1169         }
1170       else
1171         {
1172           YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1173           yydestruct (yytoken, &yylval);
1174           yychar = YYEMPTY;
1175
1176         }
1177     }
1178
1179   /* Else will try to reuse lookahead token after shifting the error
1180      token.  */
1181   goto yyerrlab1;
1182
1183
1184 /*---------------------------------------------------.
1185 | yyerrorlab -- error raised explicitly by YYERROR.  |
1186 `---------------------------------------------------*/
1187 yyerrorlab:
1188
1189 #ifdef __GNUC__
1190   /* Pacify GCC when the user code never invokes YYERROR and the label
1191      yyerrorlab therefore never appears in user code.  */
1192   if (0)
1193      goto yyerrorlab;
1194 #endif
1195
1196   yyvsp -= yylen;
1197   yyssp -= yylen;
1198   yystate = *yyssp;
1199   goto yyerrlab1;
1200
1201
1202 /*-------------------------------------------------------------.
1203 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1204 `-------------------------------------------------------------*/
1205 yyerrlab1:
1206   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1207
1208   for (;;)
1209     {
1210       yyn = yypact[yystate];
1211       if (yyn != YYPACT_NINF)
1212         {
1213           yyn += YYTERROR;
1214           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1215             {
1216               yyn = yytable[yyn];
1217               if (0 < yyn)
1218                 break;
1219             }
1220         }
1221
1222       /* Pop the current state because it cannot handle the error token.  */
1223       if (yyssp == yyss)
1224         YYABORT;
1225
1226       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1227       yydestruct (yystos[yystate], yyvsp);
1228       YYPOPSTACK;
1229       yystate = *yyssp;
1230       YY_STACK_PRINT (yyss, yyssp);
1231     }
1232
1233   if (yyn == YYFINAL)
1234     YYACCEPT;
1235
1236   YYDPRINTF ((stderr, "Shifting error token, "));
1237
1238   *++yyvsp = yylval;
1239
1240
1241   yystate = yyn;
1242   goto yynewstate;
1243
1244
1245 /*-------------------------------------.
1246 | yyacceptlab -- YYACCEPT comes here.  |
1247 `-------------------------------------*/
1248 yyacceptlab:
1249   yyresult = 0;
1250   goto yyreturn;
1251
1252 /*-----------------------------------.
1253 | yyabortlab -- YYABORT comes here.  |
1254 `-----------------------------------*/
1255 yyabortlab:
1256   yyresult = 1;
1257   goto yyreturn;
1258
1259 #ifndef yyoverflow
1260 /*----------------------------------------------.
1261 | yyoverflowlab -- parser overflow comes here.  |
1262 `----------------------------------------------*/
1263 yyoverflowlab:
1264   yyerror ("parser stack overflow");
1265   yyresult = 2;
1266   /* Fall through.  */
1267 #endif
1268
1269 yyreturn:
1270 #ifndef yyoverflow
1271   if (yyss != yyssa)
1272     YYSTACK_FREE (yyss);
1273 #endif
1274   return yyresult;
1275 }
1276
1277
1278 #line 105 "xml.y"
1279
1280
1281
1282