1 /* A Bison parser, made by GNU Bison 2.5.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5       Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19 
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29 
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
42 
43 /* Identify Bison output.  */
44 #define YYBISON 1
45 
46 /* Bison version.  */
47 #define YYBISON_VERSION "2.5"
48 
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers.  */
53 #define YYPURE 1
54 
55 /* Push parsers.  */
56 #define YYPUSH 0
57 
58 /* Pull parsers.  */
59 #define YYPULL 1
60 
61 /* Using locations.  */
62 #define YYLSP_NEEDED 0
63 
64 /* Substitute the variable and function names.  */
65 #define yyparse         xpathyyparse
66 #define yylex           xpathyylex
67 #define yyerror         xpathyyerror
68 #define yylval          xpathyylval
69 #define yychar          xpathyychar
70 #define yydebug         xpathyydebug
71 #define yynerrs         xpathyynerrs
72 
73 
74 /* Copy the first part of user declarations.  */
75 
76 /* Line 268 of yacc.c  */
77 #line 28 "../Source/WebCore/xml/XPathGrammar.y"
78 
79 
80 #include "config.h"
81 
82 #if ENABLE(XPATH)
83 
84 #include "XPathFunctions.h"
85 #include "XPathNSResolver.h"
86 #include "XPathParser.h"
87 #include "XPathPath.h"
88 #include "XPathPredicate.h"
89 #include "XPathVariableReference.h"
90 #include <wtf/FastMalloc.h>
91 
92 #define YYMALLOC fastMalloc
93 #define YYFREE fastFree
94 
95 #define YYENABLE_NLS 0
96 #define YYLTYPE_IS_TRIVIAL 1
97 #define YYDEBUG 0
98 #define YYMAXDEPTH 10000
99 #define YYPARSE_PARAM parserParameter
100 #define PARSER static_cast<Parser*>(parserParameter)
101 
102 using namespace WebCore;
103 using namespace XPath;
104 
105 
106 
107 /* Line 268 of yacc.c  */
108 #line 109 "/Source/WebCore/generated/XPathGrammar.tab.c"
109 
110 /* Enabling traces.  */
111 #ifndef YYDEBUG
112 # define YYDEBUG 0
113 #endif
114 
115 /* Enabling verbose error messages.  */
116 #ifdef YYERROR_VERBOSE
117 # undef YYERROR_VERBOSE
118 # define YYERROR_VERBOSE 1
119 #else
120 # define YYERROR_VERBOSE 0
121 #endif
122 
123 /* Enabling the token table.  */
124 #ifndef YYTOKEN_TABLE
125 # define YYTOKEN_TABLE 0
126 #endif
127 
128 
129 /* Tokens.  */
130 #ifndef YYTOKENTYPE
131 # define YYTOKENTYPE
132    /* Put the tokens into the symbol table, so that GDB and other debuggers
133       know about them.  */
134    enum yytokentype {
135      MULOP = 258,
136      RELOP = 259,
137      EQOP = 260,
138      MINUS = 261,
139      PLUS = 262,
140      AND = 263,
141      OR = 264,
142      AXISNAME = 265,
143      NODETYPE = 266,
144      PI = 267,
145      FUNCTIONNAME = 268,
146      LITERAL = 269,
147      VARIABLEREFERENCE = 270,
148      NUMBER = 271,
149      DOTDOT = 272,
150      SLASHSLASH = 273,
151      NAMETEST = 274,
152      XPATH_ERROR = 275
153    };
154 #endif
155 
156 
157 
158 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
159 typedef union YYSTYPE
160 {
161 
162 /* Line 293 of yacc.c  */
163 #line 60 "../Source/WebCore/xml/XPathGrammar.y"
164 
165     Step::Axis axis;
166     Step::NodeTest* nodeTest;
167     NumericOp::Opcode numop;
168     EqTestOp::Opcode eqop;
169     String* str;
170     Expression* expr;
171     Vector<Predicate*>* predList;
172     Vector<Expression*>* argList;
173     Step* step;
174     LocationPath* locationPath;
175 
176 
177 
178 /* Line 293 of yacc.c  */
179 #line 180 "/Source/WebCore/generated/XPathGrammar.tab.c"
180 } YYSTYPE;
181 # define YYSTYPE_IS_TRIVIAL 1
182 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
183 # define YYSTYPE_IS_DECLARED 1
184 #endif
185 
186 
187 /* Copy the second part of user declarations.  */
188 
189 /* Line 343 of yacc.c  */
190 #line 73 "../Source/WebCore/xml/XPathGrammar.y"
191 
192 
xpathyylex(YYSTYPE * yylval)193 static int xpathyylex(YYSTYPE* yylval) { return Parser::current()->lex(yylval); }
xpathyyerror(const char *)194 static void xpathyyerror(const char*) { }
195 
196 
197 
198 /* Line 343 of yacc.c  */
199 #line 200 "/Source/WebCore/generated/XPathGrammar.tab.c"
200 
201 #ifdef short
202 # undef short
203 #endif
204 
205 #ifdef YYTYPE_UINT8
206 typedef YYTYPE_UINT8 yytype_uint8;
207 #else
208 typedef unsigned char yytype_uint8;
209 #endif
210 
211 #ifdef YYTYPE_INT8
212 typedef YYTYPE_INT8 yytype_int8;
213 #elif (defined __STDC__ || defined __C99__FUNC__ \
214      || defined __cplusplus || defined _MSC_VER)
215 typedef signed char yytype_int8;
216 #else
217 typedef short int yytype_int8;
218 #endif
219 
220 #ifdef YYTYPE_UINT16
221 typedef YYTYPE_UINT16 yytype_uint16;
222 #else
223 typedef unsigned short int yytype_uint16;
224 #endif
225 
226 #ifdef YYTYPE_INT16
227 typedef YYTYPE_INT16 yytype_int16;
228 #else
229 typedef short int yytype_int16;
230 #endif
231 
232 #ifndef YYSIZE_T
233 # ifdef __SIZE_TYPE__
234 #  define YYSIZE_T __SIZE_TYPE__
235 # elif defined size_t
236 #  define YYSIZE_T size_t
237 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
238      || defined __cplusplus || defined _MSC_VER)
239 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
240 #  define YYSIZE_T size_t
241 # else
242 #  define YYSIZE_T unsigned int
243 # endif
244 #endif
245 
246 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
247 
248 #ifndef YY_
249 # if defined YYENABLE_NLS && YYENABLE_NLS
250 #  if ENABLE_NLS
251 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
252 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
253 #  endif
254 # endif
255 # ifndef YY_
256 #  define YY_(msgid) msgid
257 # endif
258 #endif
259 
260 /* Suppress unused-variable warnings by "using" E.  */
261 #if ! defined lint || defined __GNUC__
262 # define YYUSE(e) ((void) (e))
263 #else
264 # define YYUSE(e) /* empty */
265 #endif
266 
267 /* Identity function, used to suppress warnings about constant conditions.  */
268 #ifndef lint
269 # define YYID(n) (n)
270 #else
271 #if (defined __STDC__ || defined __C99__FUNC__ \
272      || defined __cplusplus || defined _MSC_VER)
273 static int
YYID(int yyi)274 YYID (int yyi)
275 #else
276 static int
277 YYID (yyi)
278     int yyi;
279 #endif
280 {
281   return yyi;
282 }
283 #endif
284 
285 #if ! defined yyoverflow || YYERROR_VERBOSE
286 
287 /* The parser invokes alloca or malloc; define the necessary symbols.  */
288 
289 # ifdef YYSTACK_USE_ALLOCA
290 #  if YYSTACK_USE_ALLOCA
291 #   ifdef __GNUC__
292 #    define YYSTACK_ALLOC __builtin_alloca
293 #   elif defined __BUILTIN_VA_ARG_INCR
294 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
295 #   elif defined _AIX
296 #    define YYSTACK_ALLOC __alloca
297 #   elif defined _MSC_VER
298 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
299 #    define alloca _alloca
300 #   else
301 #    define YYSTACK_ALLOC alloca
302 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
303      || defined __cplusplus || defined _MSC_VER)
304 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
305 #     ifndef EXIT_SUCCESS
306 #      define EXIT_SUCCESS 0
307 #     endif
308 #    endif
309 #   endif
310 #  endif
311 # endif
312 
313 # ifdef YYSTACK_ALLOC
314    /* Pacify GCC's `empty if-body' warning.  */
315 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
316 #  ifndef YYSTACK_ALLOC_MAXIMUM
317     /* The OS might guarantee only one guard page at the bottom of the stack,
318        and a page size can be as small as 4096 bytes.  So we cannot safely
319        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
320        to allow for a few compiler-allocated temporary stack slots.  */
321 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
322 #  endif
323 # else
324 #  define YYSTACK_ALLOC YYMALLOC
325 #  define YYSTACK_FREE YYFREE
326 #  ifndef YYSTACK_ALLOC_MAXIMUM
327 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
328 #  endif
329 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
330        && ! ((defined YYMALLOC || defined malloc) \
331 	     && (defined YYFREE || defined free)))
332 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
333 #   ifndef EXIT_SUCCESS
334 #    define EXIT_SUCCESS 0
335 #   endif
336 #  endif
337 #  ifndef YYMALLOC
338 #   define YYMALLOC malloc
339 #   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
340      || defined __cplusplus || defined _MSC_VER)
341 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
342 #   endif
343 #  endif
344 #  ifndef YYFREE
345 #   define YYFREE free
346 #   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
347      || defined __cplusplus || defined _MSC_VER)
348 void free (void *); /* INFRINGES ON USER NAME SPACE */
349 #   endif
350 #  endif
351 # endif
352 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
353 
354 
355 #if (! defined yyoverflow \
356      && (! defined __cplusplus \
357 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
358 
359 /* A type that is properly aligned for any stack member.  */
360 union yyalloc
361 {
362   yytype_int16 yyss_alloc;
363   YYSTYPE yyvs_alloc;
364 };
365 
366 /* The size of the maximum gap between one aligned stack and the next.  */
367 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
368 
369 /* The size of an array large to enough to hold all stacks, each with
370    N elements.  */
371 # define YYSTACK_BYTES(N) \
372      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
373       + YYSTACK_GAP_MAXIMUM)
374 
375 # define YYCOPY_NEEDED 1
376 
377 /* Relocate STACK from its old location to the new one.  The
378    local variables YYSIZE and YYSTACKSIZE give the old and new number of
379    elements in the stack, and YYPTR gives the new location of the
380    stack.  Advance YYPTR to a properly aligned location for the next
381    stack.  */
382 # define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
383     do									\
384       {									\
385 	YYSIZE_T yynewbytes;						\
386 	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
387 	Stack = &yyptr->Stack_alloc;					\
388 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
389 	yyptr += yynewbytes / sizeof (*yyptr);				\
390       }									\
391     while (YYID (0))
392 
393 #endif
394 
395 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
396 /* Copy COUNT objects from FROM to TO.  The source and destination do
397    not overlap.  */
398 # ifndef YYCOPY
399 #  if defined __GNUC__ && 1 < __GNUC__
400 #   define YYCOPY(To, From, Count) \
401       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
402 #  else
403 #   define YYCOPY(To, From, Count)		\
404       do					\
405 	{					\
406 	  YYSIZE_T yyi;				\
407 	  for (yyi = 0; yyi < (Count); yyi++)	\
408 	    (To)[yyi] = (From)[yyi];		\
409 	}					\
410       while (YYID (0))
411 #  endif
412 # endif
413 #endif /* !YYCOPY_NEEDED */
414 
415 /* YYFINAL -- State number of the termination state.  */
416 #define YYFINAL  47
417 /* YYLAST -- Last index in YYTABLE.  */
418 #define YYLAST   120
419 
420 /* YYNTOKENS -- Number of terminals.  */
421 #define YYNTOKENS  30
422 /* YYNNTS -- Number of nonterminals.  */
423 #define YYNNTS  27
424 /* YYNRULES -- Number of rules.  */
425 #define YYNRULES  61
426 /* YYNRULES -- Number of states.  */
427 #define YYNSTATES  94
428 
429 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
430 #define YYUNDEFTOK  2
431 #define YYMAXUTOK   275
432 
433 #define YYTRANSLATE(YYX)						\
434   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
435 
436 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
437 static const yytype_uint8 yytranslate[] =
438 {
439        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
441        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
443       23,    24,     2,     2,    28,     2,    27,    21,     2,     2,
444        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
445        2,     2,     2,     2,    22,     2,     2,     2,     2,     2,
446        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
447        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
448        2,    25,     2,    26,     2,     2,     2,     2,     2,     2,
449        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
450        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
451        2,     2,     2,     2,    29,     2,     2,     2,     2,     2,
452        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
453        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
454        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
455        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
457        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
458        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
464        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
465        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
466       15,    16,    17,    18,    19,    20
467 };
468 
469 #if YYDEBUG
470 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
471    YYRHS.  */
472 static const yytype_uint8 yyprhs[] =
473 {
474        0,     0,     3,     5,     7,     9,    11,    14,    17,    19,
475       23,    27,    30,    33,    37,    41,    43,    45,    47,    51,
476       55,    60,    61,    63,    65,    68,    72,    74,    76,    78,
477       80,    84,    86,    88,    90,    94,    99,   101,   105,   107,
478      109,   113,   115,   117,   121,   125,   127,   130,   132,   136,
479      138,   142,   144,   148,   150,   154,   156,   160,   164,   166,
480      170,   172
481 };
482 
483 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
484 static const yytype_int8 yyrhs[] =
485 {
486       31,     0,    -1,    50,    -1,    34,    -1,    33,    -1,    21,
487       -1,    21,    34,    -1,    41,    34,    -1,    35,    -1,    34,
488       21,    35,    -1,    34,    41,    35,    -1,    37,    38,    -1,
489       19,    38,    -1,    36,    37,    38,    -1,    36,    19,    38,
490       -1,    42,    -1,    10,    -1,    22,    -1,    11,    23,    24,
491       -1,    12,    23,    24,    -1,    12,    23,    14,    24,    -1,
492       -1,    39,    -1,    40,    -1,    39,    40,    -1,    25,    31,
493       26,    -1,    18,    -1,    27,    -1,    17,    -1,    15,    -1,
494       23,    31,    24,    -1,    14,    -1,    16,    -1,    44,    -1,
495       13,    23,    24,    -1,    13,    23,    45,    24,    -1,    46,
496       -1,    45,    28,    46,    -1,    31,    -1,    48,    -1,    47,
497       29,    48,    -1,    32,    -1,    49,    -1,    49,    21,    34,
498       -1,    49,    41,    34,    -1,    43,    -1,    43,    39,    -1,
499       51,    -1,    50,     9,    51,    -1,    52,    -1,    51,     8,
500       52,    -1,    53,    -1,    52,     5,    53,    -1,    54,    -1,
501       53,     4,    54,    -1,    55,    -1,    54,     7,    55,    -1,
502       54,     6,    55,    -1,    56,    -1,    55,     3,    56,    -1,
503       47,    -1,     6,    56,    -1
504 };
505 
506 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
507 static const yytype_uint16 yyrline[] =
508 {
509        0,   121,   121,   128,   133,   140,   146,   151,   160,   168,
510      174,   184,   195,   213,   224,   242,   246,   248,   255,   268,
511      275,   286,   290,   294,   302,   310,   317,   325,   331,   339,
512      346,   351,   358,   365,   369,   378,   390,   398,   406,   410,
513      412,   424,   429,   431,   440,   453,   455,   465,   467,   477,
514      479,   489,   491,   501,   503,   513,   515,   523,   533,   535,
515      545,   547
516 };
517 #endif
518 
519 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
520 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
521    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
522 static const char *const yytname[] =
523 {
524   "$end", "error", "$undefined", "MULOP", "RELOP", "EQOP", "MINUS",
525   "PLUS", "AND", "OR", "AXISNAME", "NODETYPE", "PI", "FUNCTIONNAME",
526   "LITERAL", "VARIABLEREFERENCE", "NUMBER", "DOTDOT", "SLASHSLASH",
527   "NAMETEST", "XPATH_ERROR", "'/'", "'@'", "'('", "')'", "'['", "']'",
528   "'.'", "','", "'|'", "$accept", "Expr", "LocationPath",
529   "AbsoluteLocationPath", "RelativeLocationPath", "Step", "AxisSpecifier",
530   "NodeTest", "OptionalPredicateList", "PredicateList", "Predicate",
531   "DescendantOrSelf", "AbbreviatedStep", "PrimaryExpr", "FunctionCall",
532   "ArgumentList", "Argument", "UnionExpr", "PathExpr", "FilterExpr",
533   "OrExpr", "AndExpr", "EqualityExpr", "RelationalExpr", "AdditiveExpr",
534   "MultiplicativeExpr", "UnaryExpr", 0
535 };
536 #endif
537 
538 # ifdef YYPRINT
539 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
540    token YYLEX-NUM.  */
541 static const yytype_uint16 yytoknum[] =
542 {
543        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
544      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
545      275,    47,    64,    40,    41,    91,    93,    46,    44,   124
546 };
547 # endif
548 
549 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
550 static const yytype_uint8 yyr1[] =
551 {
552        0,    30,    31,    32,    32,    33,    33,    33,    34,    34,
553       34,    35,    35,    35,    35,    35,    36,    36,    37,    37,
554       37,    38,    38,    39,    39,    40,    41,    42,    42,    43,
555       43,    43,    43,    43,    44,    44,    45,    45,    46,    47,
556       47,    48,    48,    48,    48,    49,    49,    50,    50,    51,
557       51,    52,    52,    53,    53,    54,    54,    54,    55,    55,
558       56,    56
559 };
560 
561 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
562 static const yytype_uint8 yyr2[] =
563 {
564        0,     2,     1,     1,     1,     1,     2,     2,     1,     3,
565        3,     2,     2,     3,     3,     1,     1,     1,     3,     3,
566        4,     0,     1,     1,     2,     3,     1,     1,     1,     1,
567        3,     1,     1,     1,     3,     4,     1,     3,     1,     1,
568        3,     1,     1,     3,     3,     1,     2,     1,     3,     1,
569        3,     1,     3,     1,     3,     1,     3,     3,     1,     3,
570        1,     2
571 };
572 
573 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
574    Performed when YYTABLE doesn't specify something else to do.  Zero
575    means the default is an error.  */
576 static const yytype_uint8 yydefact[] =
577 {
578        0,     0,    16,     0,     0,     0,    31,    29,    32,    28,
579       26,    21,     5,    17,     0,    27,     0,    41,     4,     3,
580        8,     0,    21,     0,    15,    45,    33,    60,    39,    42,
581        2,    47,    49,    51,    53,    55,    58,    61,     0,     0,
582        0,     0,    12,    22,    23,     6,     0,     1,     0,     0,
583       21,    21,    11,     7,    46,     0,     0,     0,     0,     0,
584        0,     0,     0,     0,     0,    18,     0,    19,    34,    38,
585        0,    36,     0,    24,    30,     9,    10,    14,    13,    40,
586       43,    44,    48,    50,    52,    54,    57,    56,    59,    20,
587       35,     0,    25,    37
588 };
589 
590 /* YYDEFGOTO[NTERM-NUM].  */
591 static const yytype_int8 yydefgoto[] =
592 {
593       -1,    69,    17,    18,    19,    20,    21,    22,    42,    43,
594       44,    23,    24,    25,    26,    70,    71,    27,    28,    29,
595       30,    31,    32,    33,    34,    35,    36
596 };
597 
598 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
599    STATE-NUM.  */
600 #define YYPACT_NINF -44
601 static const yytype_int8 yypact[] =
602 {
603       75,    75,   -44,    -9,    -4,    18,   -44,   -44,   -44,   -44,
604      -44,    19,    -2,   -44,    75,   -44,    36,   -44,   -44,    13,
605      -44,    11,    19,    -2,   -44,    19,   -44,    21,   -44,    17,
606       33,    39,    43,    45,    20,    48,   -44,   -44,    28,    -3,
607       56,    75,   -44,    19,   -44,    13,    29,   -44,    -2,    -2,
608       19,    19,   -44,    13,    19,    93,    -2,    -2,    75,    75,
609       75,    75,    75,    75,    75,   -44,    30,   -44,   -44,   -44,
610        0,   -44,    31,   -44,   -44,   -44,   -44,   -44,   -44,   -44,
611       13,    13,    39,    43,    45,    20,    48,    48,   -44,   -44,
612      -44,    75,   -44,   -44
613 };
614 
615 /* YYPGOTO[NTERM-NUM].  */
616 static const yytype_int8 yypgoto[] =
617 {
618      -44,     2,   -44,   -44,   -11,   -43,   -44,    34,   -18,    35,
619      -36,   -16,   -44,   -44,   -44,   -44,   -35,   -44,     3,   -44,
620      -44,     1,    23,    16,    38,   -23,    -1
621 };
622 
623 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
624    positive, shift that token.  If negative, reduce the rule which
625    number is the opposite.  If YYTABLE_NINF, syntax error.  */
626 #define YYTABLE_NINF -1
627 static const yytype_uint8 yytable[] =
628 {
629       37,    45,    16,    49,    52,    75,    76,    73,     2,     3,
630        4,    66,    53,    57,    38,     9,    46,    11,    73,    39,
631       13,    67,     3,     4,    90,    15,    62,    63,    91,    49,
632       50,    10,    77,    78,    48,    10,    47,    49,    56,    86,
633       87,    40,    58,    72,    41,    80,    81,    59,    60,    61,
634       55,    64,    65,    74,    89,    51,    93,    92,    79,    82,
635       54,     0,     1,    88,    49,    49,     2,     3,     4,     5,
636        6,     7,     8,     9,    10,    11,    84,    12,    13,    14,
637       68,     1,    83,    15,     0,     2,     3,     4,     5,     6,
638        7,     8,     9,    10,    11,     0,    12,    13,    14,    85,
639        0,     0,    15,     2,     3,     4,     5,     6,     7,     8,
640        9,    10,    11,     0,    12,    13,    14,     0,     0,     0,
641       15
642 };
643 
644 #define yypact_value_is_default(yystate) \
645   ((yystate) == (-44))
646 
647 #define yytable_value_is_error(yytable_value) \
648   YYID (0)
649 
650 static const yytype_int8 yycheck[] =
651 {
652        1,    12,     0,    19,    22,    48,    49,    43,    10,    11,
653       12,    14,    23,    29,    23,    17,    14,    19,    54,    23,
654       22,    24,    11,    12,    24,    27,     6,     7,    28,    45,
655       19,    18,    50,    51,    21,    18,     0,    53,    21,    62,
656       63,    23,     9,    41,    25,    56,    57,     8,     5,     4,
657       29,     3,    24,    24,    24,    21,    91,    26,    55,    58,
658       25,    -1,     6,    64,    80,    81,    10,    11,    12,    13,
659       14,    15,    16,    17,    18,    19,    60,    21,    22,    23,
660       24,     6,    59,    27,    -1,    10,    11,    12,    13,    14,
661       15,    16,    17,    18,    19,    -1,    21,    22,    23,    61,
662       -1,    -1,    27,    10,    11,    12,    13,    14,    15,    16,
663       17,    18,    19,    -1,    21,    22,    23,    -1,    -1,    -1,
664       27
665 };
666 
667 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
668    symbol of state STATE-NUM.  */
669 static const yytype_uint8 yystos[] =
670 {
671        0,     6,    10,    11,    12,    13,    14,    15,    16,    17,
672       18,    19,    21,    22,    23,    27,    31,    32,    33,    34,
673       35,    36,    37,    41,    42,    43,    44,    47,    48,    49,
674       50,    51,    52,    53,    54,    55,    56,    56,    23,    23,
675       23,    25,    38,    39,    40,    34,    31,     0,    21,    41,
676       19,    37,    38,    34,    39,    29,    21,    41,     9,     8,
677        5,     4,     6,     7,     3,    24,    14,    24,    24,    31,
678       45,    46,    31,    40,    24,    35,    35,    38,    38,    48,
679       34,    34,    51,    52,    53,    54,    55,    55,    56,    24,
680       24,    28,    26,    46
681 };
682 
683 #define yyerrok		(yyerrstatus = 0)
684 #define yyclearin	(yychar = YYEMPTY)
685 #define YYEMPTY		(-2)
686 #define YYEOF		0
687 
688 #define YYACCEPT	goto yyacceptlab
689 #define YYABORT		goto yyabortlab
690 #define YYERROR		goto yyerrorlab
691 
692 
693 /* Like YYERROR except do call yyerror.  This remains here temporarily
694    to ease the transition to the new meaning of YYERROR, for GCC.
695    Once GCC version 2 has supplanted version 1, this can go.  However,
696    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
697    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
698    discussed.  */
699 
700 #define YYFAIL		goto yyerrlab
701 #if defined YYFAIL
702   /* This is here to suppress warnings from the GCC cpp's
703      -Wunused-macros.  Normally we don't worry about that warning, but
704      some users do, and we want to make it easy for users to remove
705      YYFAIL uses, which will produce warnings from Bison 2.5.  */
706 #endif
707 
708 #define YYRECOVERING()  (!!yyerrstatus)
709 
710 #define YYBACKUP(Token, Value)					\
711 do								\
712   if (yychar == YYEMPTY && yylen == 1)				\
713     {								\
714       yychar = (Token);						\
715       yylval = (Value);						\
716       YYPOPSTACK (1);						\
717       goto yybackup;						\
718     }								\
719   else								\
720     {								\
721       yyerror (YY_("syntax error: cannot back up")); \
722       YYERROR;							\
723     }								\
724 while (YYID (0))
725 
726 
727 #define YYTERROR	1
728 #define YYERRCODE	256
729 
730 
731 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
732    If N is 0, then set CURRENT to the empty location which ends
733    the previous symbol: RHS[0] (always defined).  */
734 
735 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
736 #ifndef YYLLOC_DEFAULT
737 # define YYLLOC_DEFAULT(Current, Rhs, N)				\
738     do									\
739       if (YYID (N))                                                    \
740 	{								\
741 	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
742 	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
743 	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
744 	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
745 	}								\
746       else								\
747 	{								\
748 	  (Current).first_line   = (Current).last_line   =		\
749 	    YYRHSLOC (Rhs, 0).last_line;				\
750 	  (Current).first_column = (Current).last_column =		\
751 	    YYRHSLOC (Rhs, 0).last_column;				\
752 	}								\
753     while (YYID (0))
754 #endif
755 
756 
757 /* This macro is provided for backward compatibility. */
758 
759 #ifndef YY_LOCATION_PRINT
760 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
761 #endif
762 
763 
764 /* YYLEX -- calling `yylex' with the right arguments.  */
765 
766 #ifdef YYLEX_PARAM
767 # define YYLEX yylex (&yylval, YYLEX_PARAM)
768 #else
769 # define YYLEX yylex (&yylval)
770 #endif
771 
772 /* Enable debugging if requested.  */
773 #if YYDEBUG
774 
775 # ifndef YYFPRINTF
776 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
777 #  define YYFPRINTF fprintf
778 # endif
779 
780 # define YYDPRINTF(Args)			\
781 do {						\
782   if (yydebug)					\
783     YYFPRINTF Args;				\
784 } while (YYID (0))
785 
786 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
787 do {									  \
788   if (yydebug)								  \
789     {									  \
790       YYFPRINTF (stderr, "%s ", Title);					  \
791       yy_symbol_print (stderr,						  \
792 		  Type, Value); \
793       YYFPRINTF (stderr, "\n");						  \
794     }									  \
795 } while (YYID (0))
796 
797 
798 /*--------------------------------.
799 | Print this symbol on YYOUTPUT.  |
800 `--------------------------------*/
801 
802 /*ARGSUSED*/
803 #if (defined __STDC__ || defined __C99__FUNC__ \
804      || defined __cplusplus || defined _MSC_VER)
805 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)806 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
807 #else
808 static void
809 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
810     FILE *yyoutput;
811     int yytype;
812     YYSTYPE const * const yyvaluep;
813 #endif
814 {
815   if (!yyvaluep)
816     return;
817 # ifdef YYPRINT
818   if (yytype < YYNTOKENS)
819     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
820 # else
821   YYUSE (yyoutput);
822 # endif
823   switch (yytype)
824     {
825       default:
826 	break;
827     }
828 }
829 
830 
831 /*--------------------------------.
832 | Print this symbol on YYOUTPUT.  |
833 `--------------------------------*/
834 
835 #if (defined __STDC__ || defined __C99__FUNC__ \
836      || defined __cplusplus || defined _MSC_VER)
837 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)838 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
839 #else
840 static void
841 yy_symbol_print (yyoutput, yytype, yyvaluep)
842     FILE *yyoutput;
843     int yytype;
844     YYSTYPE const * const yyvaluep;
845 #endif
846 {
847   if (yytype < YYNTOKENS)
848     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
849   else
850     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
851 
852   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
853   YYFPRINTF (yyoutput, ")");
854 }
855 
856 /*------------------------------------------------------------------.
857 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
858 | TOP (included).                                                   |
859 `------------------------------------------------------------------*/
860 
861 #if (defined __STDC__ || defined __C99__FUNC__ \
862      || defined __cplusplus || defined _MSC_VER)
863 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)864 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
865 #else
866 static void
867 yy_stack_print (yybottom, yytop)
868     yytype_int16 *yybottom;
869     yytype_int16 *yytop;
870 #endif
871 {
872   YYFPRINTF (stderr, "Stack now");
873   for (; yybottom <= yytop; yybottom++)
874     {
875       int yybot = *yybottom;
876       YYFPRINTF (stderr, " %d", yybot);
877     }
878   YYFPRINTF (stderr, "\n");
879 }
880 
881 # define YY_STACK_PRINT(Bottom, Top)				\
882 do {								\
883   if (yydebug)							\
884     yy_stack_print ((Bottom), (Top));				\
885 } while (YYID (0))
886 
887 
888 /*------------------------------------------------.
889 | Report that the YYRULE is going to be reduced.  |
890 `------------------------------------------------*/
891 
892 #if (defined __STDC__ || defined __C99__FUNC__ \
893      || defined __cplusplus || defined _MSC_VER)
894 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)895 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
896 #else
897 static void
898 yy_reduce_print (yyvsp, yyrule)
899     YYSTYPE *yyvsp;
900     int yyrule;
901 #endif
902 {
903   int yynrhs = yyr2[yyrule];
904   int yyi;
905   unsigned long int yylno = yyrline[yyrule];
906   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
907 	     yyrule - 1, yylno);
908   /* The symbols being reduced.  */
909   for (yyi = 0; yyi < yynrhs; yyi++)
910     {
911       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
912       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
913 		       &(yyvsp[(yyi + 1) - (yynrhs)])
914 		       		       );
915       YYFPRINTF (stderr, "\n");
916     }
917 }
918 
919 # define YY_REDUCE_PRINT(Rule)		\
920 do {					\
921   if (yydebug)				\
922     yy_reduce_print (yyvsp, Rule); \
923 } while (YYID (0))
924 
925 /* Nonzero means print parse trace.  It is left uninitialized so that
926    multiple parsers can coexist.  */
927 int yydebug;
928 #else /* !YYDEBUG */
929 # define YYDPRINTF(Args)
930 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
931 # define YY_STACK_PRINT(Bottom, Top)
932 # define YY_REDUCE_PRINT(Rule)
933 #endif /* !YYDEBUG */
934 
935 
936 /* YYINITDEPTH -- initial size of the parser's stacks.  */
937 #ifndef	YYINITDEPTH
938 # define YYINITDEPTH 200
939 #endif
940 
941 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
942    if the built-in stack extension method is used).
943 
944    Do not make this value too large; the results are undefined if
945    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
946    evaluated with infinite-precision integer arithmetic.  */
947 
948 #ifndef YYMAXDEPTH
949 # define YYMAXDEPTH 10000
950 #endif
951 
952 
953 #if YYERROR_VERBOSE
954 
955 # ifndef yystrlen
956 #  if defined __GLIBC__ && defined _STRING_H
957 #   define yystrlen strlen
958 #  else
959 /* Return the length of YYSTR.  */
960 #if (defined __STDC__ || defined __C99__FUNC__ \
961      || defined __cplusplus || defined _MSC_VER)
962 static YYSIZE_T
yystrlen(const char * yystr)963 yystrlen (const char *yystr)
964 #else
965 static YYSIZE_T
966 yystrlen (yystr)
967     const char *yystr;
968 #endif
969 {
970   YYSIZE_T yylen;
971   for (yylen = 0; yystr[yylen]; yylen++)
972     continue;
973   return yylen;
974 }
975 #  endif
976 # endif
977 
978 # ifndef yystpcpy
979 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
980 #   define yystpcpy stpcpy
981 #  else
982 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
983    YYDEST.  */
984 #if (defined __STDC__ || defined __C99__FUNC__ \
985      || defined __cplusplus || defined _MSC_VER)
986 static char *
yystpcpy(char * yydest,const char * yysrc)987 yystpcpy (char *yydest, const char *yysrc)
988 #else
989 static char *
990 yystpcpy (yydest, yysrc)
991     char *yydest;
992     const char *yysrc;
993 #endif
994 {
995   char *yyd = yydest;
996   const char *yys = yysrc;
997 
998   while ((*yyd++ = *yys++) != '\0')
999     continue;
1000 
1001   return yyd - 1;
1002 }
1003 #  endif
1004 # endif
1005 
1006 # ifndef yytnamerr
1007 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1008    quotes and backslashes, so that it's suitable for yyerror.  The
1009    heuristic is that double-quoting is unnecessary unless the string
1010    contains an apostrophe, a comma, or backslash (other than
1011    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1012    null, do not copy; instead, return the length of what the result
1013    would have been.  */
1014 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1015 yytnamerr (char *yyres, const char *yystr)
1016 {
1017   if (*yystr == '"')
1018     {
1019       YYSIZE_T yyn = 0;
1020       char const *yyp = yystr;
1021 
1022       for (;;)
1023 	switch (*++yyp)
1024 	  {
1025 	  case '\'':
1026 	  case ',':
1027 	    goto do_not_strip_quotes;
1028 
1029 	  case '\\':
1030 	    if (*++yyp != '\\')
1031 	      goto do_not_strip_quotes;
1032 	    /* Fall through.  */
1033 	  default:
1034 	    if (yyres)
1035 	      yyres[yyn] = *yyp;
1036 	    yyn++;
1037 	    break;
1038 
1039 	  case '"':
1040 	    if (yyres)
1041 	      yyres[yyn] = '\0';
1042 	    return yyn;
1043 	  }
1044     do_not_strip_quotes: ;
1045     }
1046 
1047   if (! yyres)
1048     return yystrlen (yystr);
1049 
1050   return yystpcpy (yyres, yystr) - yyres;
1051 }
1052 # endif
1053 
1054 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1055    about the unexpected token YYTOKEN for the state stack whose top is
1056    YYSSP.
1057 
1058    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1059    not large enough to hold the message.  In that case, also set
1060    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1061    required number of bytes is too large to store.  */
1062 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1063 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1064                 yytype_int16 *yyssp, int yytoken)
1065 {
1066   YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1067   YYSIZE_T yysize = yysize0;
1068   YYSIZE_T yysize1;
1069   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1070   /* Internationalized format string. */
1071   const char *yyformat = 0;
1072   /* Arguments of yyformat. */
1073   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1074   /* Number of reported tokens (one for the "unexpected", one per
1075      "expected"). */
1076   int yycount = 0;
1077 
1078   /* There are many possibilities here to consider:
1079      - Assume YYFAIL is not used.  It's too flawed to consider.  See
1080        <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1081        for details.  YYERROR is fine as it does not invoke this
1082        function.
1083      - If this state is a consistent state with a default action, then
1084        the only way this function was invoked is if the default action
1085        is an error action.  In that case, don't check for expected
1086        tokens because there are none.
1087      - The only way there can be no lookahead present (in yychar) is if
1088        this state is a consistent state with a default action.  Thus,
1089        detecting the absence of a lookahead is sufficient to determine
1090        that there is no unexpected or expected token to report.  In that
1091        case, just report a simple "syntax error".
1092      - Don't assume there isn't a lookahead just because this state is a
1093        consistent state with a default action.  There might have been a
1094        previous inconsistent state, consistent state with a non-default
1095        action, or user semantic action that manipulated yychar.
1096      - Of course, the expected token list depends on states to have
1097        correct lookahead information, and it depends on the parser not
1098        to perform extra reductions after fetching a lookahead from the
1099        scanner and before detecting a syntax error.  Thus, state merging
1100        (from LALR or IELR) and default reductions corrupt the expected
1101        token list.  However, the list is correct for canonical LR with
1102        one exception: it will still contain any token that will not be
1103        accepted due to an error action in a later state.
1104   */
1105   if (yytoken != YYEMPTY)
1106     {
1107       int yyn = yypact[*yyssp];
1108       yyarg[yycount++] = yytname[yytoken];
1109       if (!yypact_value_is_default (yyn))
1110         {
1111           /* Start YYX at -YYN if negative to avoid negative indexes in
1112              YYCHECK.  In other words, skip the first -YYN actions for
1113              this state because they are default actions.  */
1114           int yyxbegin = yyn < 0 ? -yyn : 0;
1115           /* Stay within bounds of both yycheck and yytname.  */
1116           int yychecklim = YYLAST - yyn + 1;
1117           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1118           int yyx;
1119 
1120           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1121             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1122                 && !yytable_value_is_error (yytable[yyx + yyn]))
1123               {
1124                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1125                   {
1126                     yycount = 1;
1127                     yysize = yysize0;
1128                     break;
1129                   }
1130                 yyarg[yycount++] = yytname[yyx];
1131                 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1132                 if (! (yysize <= yysize1
1133                        && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1134                   return 2;
1135                 yysize = yysize1;
1136               }
1137         }
1138     }
1139 
1140   switch (yycount)
1141     {
1142 # define YYCASE_(N, S)                      \
1143       case N:                               \
1144         yyformat = S;                       \
1145       break
1146       YYCASE_(0, YY_("syntax error"));
1147       YYCASE_(1, YY_("syntax error, unexpected %s"));
1148       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1149       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1150       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1151       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1152 # undef YYCASE_
1153     }
1154 
1155   yysize1 = yysize + yystrlen (yyformat);
1156   if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1157     return 2;
1158   yysize = yysize1;
1159 
1160   if (*yymsg_alloc < yysize)
1161     {
1162       *yymsg_alloc = 2 * yysize;
1163       if (! (yysize <= *yymsg_alloc
1164              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1165         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1166       return 1;
1167     }
1168 
1169   /* Avoid sprintf, as that infringes on the user's name space.
1170      Don't have undefined behavior even if the translation
1171      produced a string with the wrong number of "%s"s.  */
1172   {
1173     char *yyp = *yymsg;
1174     int yyi = 0;
1175     while ((*yyp = *yyformat) != '\0')
1176       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1177         {
1178           yyp += yytnamerr (yyp, yyarg[yyi++]);
1179           yyformat += 2;
1180         }
1181       else
1182         {
1183           yyp++;
1184           yyformat++;
1185         }
1186   }
1187   return 0;
1188 }
1189 #endif /* YYERROR_VERBOSE */
1190 
1191 /*-----------------------------------------------.
1192 | Release the memory associated to this symbol.  |
1193 `-----------------------------------------------*/
1194 
1195 /*ARGSUSED*/
1196 #if (defined __STDC__ || defined __C99__FUNC__ \
1197      || defined __cplusplus || defined _MSC_VER)
1198 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1199 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1200 #else
1201 static void
1202 yydestruct (yymsg, yytype, yyvaluep)
1203     const char *yymsg;
1204     int yytype;
1205     YYSTYPE *yyvaluep;
1206 #endif
1207 {
1208   YYUSE (yyvaluep);
1209 
1210   if (!yymsg)
1211     yymsg = "Deleting";
1212   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1213 
1214   switch (yytype)
1215     {
1216 
1217       default:
1218 	break;
1219     }
1220 }
1221 
1222 
1223 /* Prevent warnings from -Wmissing-prototypes.  */
1224 #ifdef YYPARSE_PARAM
1225 #if defined __STDC__ || defined __cplusplus
1226 int yyparse (void *YYPARSE_PARAM);
1227 #else
1228 int yyparse ();
1229 #endif
1230 #else /* ! YYPARSE_PARAM */
1231 #if defined __STDC__ || defined __cplusplus
1232 int yyparse (void);
1233 #else
1234 int yyparse ();
1235 #endif
1236 #endif /* ! YYPARSE_PARAM */
1237 
1238 
1239 /*----------.
1240 | yyparse.  |
1241 `----------*/
1242 
1243 #ifdef YYPARSE_PARAM
1244 #if (defined __STDC__ || defined __C99__FUNC__ \
1245      || defined __cplusplus || defined _MSC_VER)
1246 int
yyparse(void * YYPARSE_PARAM)1247 yyparse (void *YYPARSE_PARAM)
1248 #else
1249 int
1250 yyparse (YYPARSE_PARAM)
1251     void *YYPARSE_PARAM;
1252 #endif
1253 #else /* ! YYPARSE_PARAM */
1254 #if (defined __STDC__ || defined __C99__FUNC__ \
1255      || defined __cplusplus || defined _MSC_VER)
1256 int
1257 yyparse (void)
1258 #else
1259 int
1260 yyparse ()
1261 
1262 #endif
1263 #endif
1264 {
1265 /* The lookahead symbol.  */
1266 int yychar;
1267 
1268 /* The semantic value of the lookahead symbol.  */
1269 YYSTYPE yylval;
1270 
1271     /* Number of syntax errors so far.  */
1272     int yynerrs;
1273 
1274     int yystate;
1275     /* Number of tokens to shift before error messages enabled.  */
1276     int yyerrstatus;
1277 
1278     /* The stacks and their tools:
1279        `yyss': related to states.
1280        `yyvs': related to semantic values.
1281 
1282        Refer to the stacks thru separate pointers, to allow yyoverflow
1283        to reallocate them elsewhere.  */
1284 
1285     /* The state stack.  */
1286     yytype_int16 yyssa[YYINITDEPTH];
1287     yytype_int16 *yyss;
1288     yytype_int16 *yyssp;
1289 
1290     /* The semantic value stack.  */
1291     YYSTYPE yyvsa[YYINITDEPTH];
1292     YYSTYPE *yyvs;
1293     YYSTYPE *yyvsp;
1294 
1295     YYSIZE_T yystacksize;
1296 
1297   int yyn;
1298   int yyresult;
1299   /* Lookahead token as an internal (translated) token number.  */
1300   int yytoken;
1301   /* The variables used to return semantic value and location from the
1302      action routines.  */
1303   YYSTYPE yyval;
1304 
1305 #if YYERROR_VERBOSE
1306   /* Buffer for error messages, and its allocated size.  */
1307   char yymsgbuf[128];
1308   char *yymsg = yymsgbuf;
1309   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1310 #endif
1311 
1312 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1313 
1314   /* The number of symbols on the RHS of the reduced rule.
1315      Keep to zero when no symbol should be popped.  */
1316   int yylen = 0;
1317 
1318   yytoken = 0;
1319   yyss = yyssa;
1320   yyvs = yyvsa;
1321   yystacksize = YYINITDEPTH;
1322 
1323   YYDPRINTF ((stderr, "Starting parse\n"));
1324 
1325   yystate = 0;
1326   yyerrstatus = 0;
1327   yynerrs = 0;
1328   yychar = YYEMPTY; /* Cause a token to be read.  */
1329 
1330   /* Initialize stack pointers.
1331      Waste one element of value and location stack
1332      so that they stay on the same level as the state stack.
1333      The wasted elements are never initialized.  */
1334   yyssp = yyss;
1335   yyvsp = yyvs;
1336 
1337   goto yysetstate;
1338 
1339 /*------------------------------------------------------------.
1340 | yynewstate -- Push a new state, which is found in yystate.  |
1341 `------------------------------------------------------------*/
1342  yynewstate:
1343   /* In all cases, when you get here, the value and location stacks
1344      have just been pushed.  So pushing a state here evens the stacks.  */
1345   yyssp++;
1346 
1347  yysetstate:
1348   *yyssp = yystate;
1349 
1350   if (yyss + yystacksize - 1 <= yyssp)
1351     {
1352       /* Get the current used size of the three stacks, in elements.  */
1353       YYSIZE_T yysize = yyssp - yyss + 1;
1354 
1355 #ifdef yyoverflow
1356       {
1357 	/* Give user a chance to reallocate the stack.  Use copies of
1358 	   these so that the &'s don't force the real ones into
1359 	   memory.  */
1360 	YYSTYPE *yyvs1 = yyvs;
1361 	yytype_int16 *yyss1 = yyss;
1362 
1363 	/* Each stack pointer address is followed by the size of the
1364 	   data in use in that stack, in bytes.  This used to be a
1365 	   conditional around just the two extra args, but that might
1366 	   be undefined if yyoverflow is a macro.  */
1367 	yyoverflow (YY_("memory exhausted"),
1368 		    &yyss1, yysize * sizeof (*yyssp),
1369 		    &yyvs1, yysize * sizeof (*yyvsp),
1370 		    &yystacksize);
1371 
1372 	yyss = yyss1;
1373 	yyvs = yyvs1;
1374       }
1375 #else /* no yyoverflow */
1376 # ifndef YYSTACK_RELOCATE
1377       goto yyexhaustedlab;
1378 # else
1379       /* Extend the stack our own way.  */
1380       if (YYMAXDEPTH <= yystacksize)
1381 	goto yyexhaustedlab;
1382       yystacksize *= 2;
1383       if (YYMAXDEPTH < yystacksize)
1384 	yystacksize = YYMAXDEPTH;
1385 
1386       {
1387 	yytype_int16 *yyss1 = yyss;
1388 	union yyalloc *yyptr =
1389 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1390 	if (! yyptr)
1391 	  goto yyexhaustedlab;
1392 	YYSTACK_RELOCATE (yyss_alloc, yyss);
1393 	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1394 #  undef YYSTACK_RELOCATE
1395 	if (yyss1 != yyssa)
1396 	  YYSTACK_FREE (yyss1);
1397       }
1398 # endif
1399 #endif /* no yyoverflow */
1400 
1401       yyssp = yyss + yysize - 1;
1402       yyvsp = yyvs + yysize - 1;
1403 
1404       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1405 		  (unsigned long int) yystacksize));
1406 
1407       if (yyss + yystacksize - 1 <= yyssp)
1408 	YYABORT;
1409     }
1410 
1411   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1412 
1413   if (yystate == YYFINAL)
1414     YYACCEPT;
1415 
1416   goto yybackup;
1417 
1418 /*-----------.
1419 | yybackup.  |
1420 `-----------*/
1421 yybackup:
1422 
1423   /* Do appropriate processing given the current state.  Read a
1424      lookahead token if we need one and don't already have one.  */
1425 
1426   /* First try to decide what to do without reference to lookahead token.  */
1427   yyn = yypact[yystate];
1428   if (yypact_value_is_default (yyn))
1429     goto yydefault;
1430 
1431   /* Not known => get a lookahead token if don't already have one.  */
1432 
1433   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1434   if (yychar == YYEMPTY)
1435     {
1436       YYDPRINTF ((stderr, "Reading a token: "));
1437       yychar = YYLEX;
1438     }
1439 
1440   if (yychar <= YYEOF)
1441     {
1442       yychar = yytoken = YYEOF;
1443       YYDPRINTF ((stderr, "Now at end of input.\n"));
1444     }
1445   else
1446     {
1447       yytoken = YYTRANSLATE (yychar);
1448       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1449     }
1450 
1451   /* If the proper action on seeing token YYTOKEN is to reduce or to
1452      detect an error, take that action.  */
1453   yyn += yytoken;
1454   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1455     goto yydefault;
1456   yyn = yytable[yyn];
1457   if (yyn <= 0)
1458     {
1459       if (yytable_value_is_error (yyn))
1460         goto yyerrlab;
1461       yyn = -yyn;
1462       goto yyreduce;
1463     }
1464 
1465   /* Count tokens shifted since error; after three, turn off error
1466      status.  */
1467   if (yyerrstatus)
1468     yyerrstatus--;
1469 
1470   /* Shift the lookahead token.  */
1471   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1472 
1473   /* Discard the shifted token.  */
1474   yychar = YYEMPTY;
1475 
1476   yystate = yyn;
1477   *++yyvsp = yylval;
1478 
1479   goto yynewstate;
1480 
1481 
1482 /*-----------------------------------------------------------.
1483 | yydefault -- do the default action for the current state.  |
1484 `-----------------------------------------------------------*/
1485 yydefault:
1486   yyn = yydefact[yystate];
1487   if (yyn == 0)
1488     goto yyerrlab;
1489   goto yyreduce;
1490 
1491 
1492 /*-----------------------------.
1493 | yyreduce -- Do a reduction.  |
1494 `-----------------------------*/
1495 yyreduce:
1496   /* yyn is the number of a rule to reduce with.  */
1497   yylen = yyr2[yyn];
1498 
1499   /* If YYLEN is nonzero, implement the default value of the action:
1500      `$$ = $1'.
1501 
1502      Otherwise, the following line sets YYVAL to garbage.
1503      This behavior is undocumented and Bison
1504      users should not rely upon it.  Assigning to YYVAL
1505      unconditionally makes the parser a bit smaller, and it avoids a
1506      GCC warning that YYVAL may be used uninitialized.  */
1507   yyval = yyvsp[1-yylen];
1508 
1509 
1510   YY_REDUCE_PRINT (yyn);
1511   switch (yyn)
1512     {
1513         case 2:
1514 
1515 /* Line 1806 of yacc.c  */
1516 #line 122 "../Source/WebCore/xml/XPathGrammar.y"
1517     {
1518         PARSER->m_topExpr = (yyvsp[(1) - (1)].expr);
1519     }
1520     break;
1521 
1522   case 3:
1523 
1524 /* Line 1806 of yacc.c  */
1525 #line 129 "../Source/WebCore/xml/XPathGrammar.y"
1526     {
1527         (yyval.locationPath)->setAbsolute(false);
1528     }
1529     break;
1530 
1531   case 4:
1532 
1533 /* Line 1806 of yacc.c  */
1534 #line 134 "../Source/WebCore/xml/XPathGrammar.y"
1535     {
1536         (yyval.locationPath)->setAbsolute(true);
1537     }
1538     break;
1539 
1540   case 5:
1541 
1542 /* Line 1806 of yacc.c  */
1543 #line 141 "../Source/WebCore/xml/XPathGrammar.y"
1544     {
1545         (yyval.locationPath) = new LocationPath;
1546         PARSER->registerParseNode((yyval.locationPath));
1547     }
1548     break;
1549 
1550   case 6:
1551 
1552 /* Line 1806 of yacc.c  */
1553 #line 147 "../Source/WebCore/xml/XPathGrammar.y"
1554     {
1555         (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath);
1556     }
1557     break;
1558 
1559   case 7:
1560 
1561 /* Line 1806 of yacc.c  */
1562 #line 152 "../Source/WebCore/xml/XPathGrammar.y"
1563     {
1564         (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath);
1565         (yyval.locationPath)->insertFirstStep((yyvsp[(1) - (2)].step));
1566         PARSER->unregisterParseNode((yyvsp[(1) - (2)].step));
1567     }
1568     break;
1569 
1570   case 8:
1571 
1572 /* Line 1806 of yacc.c  */
1573 #line 161 "../Source/WebCore/xml/XPathGrammar.y"
1574     {
1575         (yyval.locationPath) = new LocationPath;
1576         (yyval.locationPath)->appendStep((yyvsp[(1) - (1)].step));
1577         PARSER->unregisterParseNode((yyvsp[(1) - (1)].step));
1578         PARSER->registerParseNode((yyval.locationPath));
1579     }
1580     break;
1581 
1582   case 9:
1583 
1584 /* Line 1806 of yacc.c  */
1585 #line 169 "../Source/WebCore/xml/XPathGrammar.y"
1586     {
1587         (yyval.locationPath)->appendStep((yyvsp[(3) - (3)].step));
1588         PARSER->unregisterParseNode((yyvsp[(3) - (3)].step));
1589     }
1590     break;
1591 
1592   case 10:
1593 
1594 /* Line 1806 of yacc.c  */
1595 #line 175 "../Source/WebCore/xml/XPathGrammar.y"
1596     {
1597         (yyval.locationPath)->appendStep((yyvsp[(2) - (3)].step));
1598         (yyval.locationPath)->appendStep((yyvsp[(3) - (3)].step));
1599         PARSER->unregisterParseNode((yyvsp[(2) - (3)].step));
1600         PARSER->unregisterParseNode((yyvsp[(3) - (3)].step));
1601     }
1602     break;
1603 
1604   case 11:
1605 
1606 /* Line 1806 of yacc.c  */
1607 #line 185 "../Source/WebCore/xml/XPathGrammar.y"
1608     {
1609         if ((yyvsp[(2) - (2)].predList)) {
1610             (yyval.step) = new Step(Step::ChildAxis, *(yyvsp[(1) - (2)].nodeTest), *(yyvsp[(2) - (2)].predList));
1611             PARSER->deletePredicateVector((yyvsp[(2) - (2)].predList));
1612         } else
1613             (yyval.step) = new Step(Step::ChildAxis, *(yyvsp[(1) - (2)].nodeTest));
1614         PARSER->deleteNodeTest((yyvsp[(1) - (2)].nodeTest));
1615         PARSER->registerParseNode((yyval.step));
1616     }
1617     break;
1618 
1619   case 12:
1620 
1621 /* Line 1806 of yacc.c  */
1622 #line 196 "../Source/WebCore/xml/XPathGrammar.y"
1623     {
1624         String localName;
1625         String namespaceURI;
1626         if (!PARSER->expandQName(*(yyvsp[(1) - (2)].str), localName, namespaceURI)) {
1627             PARSER->m_gotNamespaceError = true;
1628             YYABORT;
1629         }
1630 
1631         if ((yyvsp[(2) - (2)].predList)) {
1632             (yyval.step) = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), *(yyvsp[(2) - (2)].predList));
1633             PARSER->deletePredicateVector((yyvsp[(2) - (2)].predList));
1634         } else
1635             (yyval.step) = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI));
1636         PARSER->deleteString((yyvsp[(1) - (2)].str));
1637         PARSER->registerParseNode((yyval.step));
1638     }
1639     break;
1640 
1641   case 13:
1642 
1643 /* Line 1806 of yacc.c  */
1644 #line 214 "../Source/WebCore/xml/XPathGrammar.y"
1645     {
1646         if ((yyvsp[(3) - (3)].predList)) {
1647             (yyval.step) = new Step((yyvsp[(1) - (3)].axis), *(yyvsp[(2) - (3)].nodeTest), *(yyvsp[(3) - (3)].predList));
1648             PARSER->deletePredicateVector((yyvsp[(3) - (3)].predList));
1649         } else
1650             (yyval.step) = new Step((yyvsp[(1) - (3)].axis), *(yyvsp[(2) - (3)].nodeTest));
1651         PARSER->deleteNodeTest((yyvsp[(2) - (3)].nodeTest));
1652         PARSER->registerParseNode((yyval.step));
1653     }
1654     break;
1655 
1656   case 14:
1657 
1658 /* Line 1806 of yacc.c  */
1659 #line 225 "../Source/WebCore/xml/XPathGrammar.y"
1660     {
1661         String localName;
1662         String namespaceURI;
1663         if (!PARSER->expandQName(*(yyvsp[(2) - (3)].str), localName, namespaceURI)) {
1664             PARSER->m_gotNamespaceError = true;
1665             YYABORT;
1666         }
1667 
1668         if ((yyvsp[(3) - (3)].predList)) {
1669             (yyval.step) = new Step((yyvsp[(1) - (3)].axis), Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), *(yyvsp[(3) - (3)].predList));
1670             PARSER->deletePredicateVector((yyvsp[(3) - (3)].predList));
1671         } else
1672             (yyval.step) = new Step((yyvsp[(1) - (3)].axis), Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI));
1673         PARSER->deleteString((yyvsp[(2) - (3)].str));
1674         PARSER->registerParseNode((yyval.step));
1675     }
1676     break;
1677 
1678   case 17:
1679 
1680 /* Line 1806 of yacc.c  */
1681 #line 249 "../Source/WebCore/xml/XPathGrammar.y"
1682     {
1683         (yyval.axis) = Step::AttributeAxis;
1684     }
1685     break;
1686 
1687   case 18:
1688 
1689 /* Line 1806 of yacc.c  */
1690 #line 256 "../Source/WebCore/xml/XPathGrammar.y"
1691     {
1692         if (*(yyvsp[(1) - (3)].str) == "node")
1693             (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::AnyNodeTest);
1694         else if (*(yyvsp[(1) - (3)].str) == "text")
1695             (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::TextNodeTest);
1696         else if (*(yyvsp[(1) - (3)].str) == "comment")
1697             (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::CommentNodeTest);
1698 
1699         PARSER->deleteString((yyvsp[(1) - (3)].str));
1700         PARSER->registerNodeTest((yyval.nodeTest));
1701     }
1702     break;
1703 
1704   case 19:
1705 
1706 /* Line 1806 of yacc.c  */
1707 #line 269 "../Source/WebCore/xml/XPathGrammar.y"
1708     {
1709         (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest);
1710         PARSER->deleteString((yyvsp[(1) - (3)].str));
1711         PARSER->registerNodeTest((yyval.nodeTest));
1712     }
1713     break;
1714 
1715   case 20:
1716 
1717 /* Line 1806 of yacc.c  */
1718 #line 276 "../Source/WebCore/xml/XPathGrammar.y"
1719     {
1720         (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, (yyvsp[(3) - (4)].str)->stripWhiteSpace());
1721         PARSER->deleteString((yyvsp[(1) - (4)].str));
1722         PARSER->deleteString((yyvsp[(3) - (4)].str));
1723         PARSER->registerNodeTest((yyval.nodeTest));
1724     }
1725     break;
1726 
1727   case 21:
1728 
1729 /* Line 1806 of yacc.c  */
1730 #line 286 "../Source/WebCore/xml/XPathGrammar.y"
1731     {
1732         (yyval.predList) = 0;
1733     }
1734     break;
1735 
1736   case 23:
1737 
1738 /* Line 1806 of yacc.c  */
1739 #line 295 "../Source/WebCore/xml/XPathGrammar.y"
1740     {
1741         (yyval.predList) = new Vector<Predicate*>;
1742         (yyval.predList)->append(new Predicate((yyvsp[(1) - (1)].expr)));
1743         PARSER->unregisterParseNode((yyvsp[(1) - (1)].expr));
1744         PARSER->registerPredicateVector((yyval.predList));
1745     }
1746     break;
1747 
1748   case 24:
1749 
1750 /* Line 1806 of yacc.c  */
1751 #line 303 "../Source/WebCore/xml/XPathGrammar.y"
1752     {
1753         (yyval.predList)->append(new Predicate((yyvsp[(2) - (2)].expr)));
1754         PARSER->unregisterParseNode((yyvsp[(2) - (2)].expr));
1755     }
1756     break;
1757 
1758   case 25:
1759 
1760 /* Line 1806 of yacc.c  */
1761 #line 311 "../Source/WebCore/xml/XPathGrammar.y"
1762     {
1763         (yyval.expr) = (yyvsp[(2) - (3)].expr);
1764     }
1765     break;
1766 
1767   case 26:
1768 
1769 /* Line 1806 of yacc.c  */
1770 #line 318 "../Source/WebCore/xml/XPathGrammar.y"
1771     {
1772         (yyval.step) = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
1773         PARSER->registerParseNode((yyval.step));
1774     }
1775     break;
1776 
1777   case 27:
1778 
1779 /* Line 1806 of yacc.c  */
1780 #line 326 "../Source/WebCore/xml/XPathGrammar.y"
1781     {
1782         (yyval.step) = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
1783         PARSER->registerParseNode((yyval.step));
1784     }
1785     break;
1786 
1787   case 28:
1788 
1789 /* Line 1806 of yacc.c  */
1790 #line 332 "../Source/WebCore/xml/XPathGrammar.y"
1791     {
1792         (yyval.step) = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
1793         PARSER->registerParseNode((yyval.step));
1794     }
1795     break;
1796 
1797   case 29:
1798 
1799 /* Line 1806 of yacc.c  */
1800 #line 340 "../Source/WebCore/xml/XPathGrammar.y"
1801     {
1802         (yyval.expr) = new VariableReference(*(yyvsp[(1) - (1)].str));
1803         PARSER->deleteString((yyvsp[(1) - (1)].str));
1804         PARSER->registerParseNode((yyval.expr));
1805     }
1806     break;
1807 
1808   case 30:
1809 
1810 /* Line 1806 of yacc.c  */
1811 #line 347 "../Source/WebCore/xml/XPathGrammar.y"
1812     {
1813         (yyval.expr) = (yyvsp[(2) - (3)].expr);
1814     }
1815     break;
1816 
1817   case 31:
1818 
1819 /* Line 1806 of yacc.c  */
1820 #line 352 "../Source/WebCore/xml/XPathGrammar.y"
1821     {
1822         (yyval.expr) = new StringExpression(*(yyvsp[(1) - (1)].str));
1823         PARSER->deleteString((yyvsp[(1) - (1)].str));
1824         PARSER->registerParseNode((yyval.expr));
1825     }
1826     break;
1827 
1828   case 32:
1829 
1830 /* Line 1806 of yacc.c  */
1831 #line 359 "../Source/WebCore/xml/XPathGrammar.y"
1832     {
1833         (yyval.expr) = new Number((yyvsp[(1) - (1)].str)->toDouble());
1834         PARSER->deleteString((yyvsp[(1) - (1)].str));
1835         PARSER->registerParseNode((yyval.expr));
1836     }
1837     break;
1838 
1839   case 34:
1840 
1841 /* Line 1806 of yacc.c  */
1842 #line 370 "../Source/WebCore/xml/XPathGrammar.y"
1843     {
1844         (yyval.expr) = createFunction(*(yyvsp[(1) - (3)].str));
1845         if (!(yyval.expr))
1846             YYABORT;
1847         PARSER->deleteString((yyvsp[(1) - (3)].str));
1848         PARSER->registerParseNode((yyval.expr));
1849     }
1850     break;
1851 
1852   case 35:
1853 
1854 /* Line 1806 of yacc.c  */
1855 #line 379 "../Source/WebCore/xml/XPathGrammar.y"
1856     {
1857         (yyval.expr) = createFunction(*(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].argList));
1858         if (!(yyval.expr))
1859             YYABORT;
1860         PARSER->deleteString((yyvsp[(1) - (4)].str));
1861         PARSER->deleteExpressionVector((yyvsp[(3) - (4)].argList));
1862         PARSER->registerParseNode((yyval.expr));
1863     }
1864     break;
1865 
1866   case 36:
1867 
1868 /* Line 1806 of yacc.c  */
1869 #line 391 "../Source/WebCore/xml/XPathGrammar.y"
1870     {
1871         (yyval.argList) = new Vector<Expression*>;
1872         (yyval.argList)->append((yyvsp[(1) - (1)].expr));
1873         PARSER->unregisterParseNode((yyvsp[(1) - (1)].expr));
1874         PARSER->registerExpressionVector((yyval.argList));
1875     }
1876     break;
1877 
1878   case 37:
1879 
1880 /* Line 1806 of yacc.c  */
1881 #line 399 "../Source/WebCore/xml/XPathGrammar.y"
1882     {
1883         (yyval.argList)->append((yyvsp[(3) - (3)].expr));
1884         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
1885     }
1886     break;
1887 
1888   case 40:
1889 
1890 /* Line 1806 of yacc.c  */
1891 #line 413 "../Source/WebCore/xml/XPathGrammar.y"
1892     {
1893         (yyval.expr) = new Union;
1894         (yyval.expr)->addSubExpression((yyvsp[(1) - (3)].expr));
1895         (yyval.expr)->addSubExpression((yyvsp[(3) - (3)].expr));
1896         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1897         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
1898         PARSER->registerParseNode((yyval.expr));
1899     }
1900     break;
1901 
1902   case 41:
1903 
1904 /* Line 1806 of yacc.c  */
1905 #line 425 "../Source/WebCore/xml/XPathGrammar.y"
1906     {
1907         (yyval.expr) = (yyvsp[(1) - (1)].locationPath);
1908     }
1909     break;
1910 
1911   case 43:
1912 
1913 /* Line 1806 of yacc.c  */
1914 #line 432 "../Source/WebCore/xml/XPathGrammar.y"
1915     {
1916         (yyvsp[(3) - (3)].locationPath)->setAbsolute(true);
1917         (yyval.expr) = new Path(static_cast<Filter*>((yyvsp[(1) - (3)].expr)), (yyvsp[(3) - (3)].locationPath));
1918         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1919         PARSER->unregisterParseNode((yyvsp[(3) - (3)].locationPath));
1920         PARSER->registerParseNode((yyval.expr));
1921     }
1922     break;
1923 
1924   case 44:
1925 
1926 /* Line 1806 of yacc.c  */
1927 #line 441 "../Source/WebCore/xml/XPathGrammar.y"
1928     {
1929         (yyvsp[(3) - (3)].locationPath)->insertFirstStep((yyvsp[(2) - (3)].step));
1930         (yyvsp[(3) - (3)].locationPath)->setAbsolute(true);
1931         (yyval.expr) = new Path(static_cast<Filter*>((yyvsp[(1) - (3)].expr)), (yyvsp[(3) - (3)].locationPath));
1932         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1933         PARSER->unregisterParseNode((yyvsp[(2) - (3)].step));
1934         PARSER->unregisterParseNode((yyvsp[(3) - (3)].locationPath));
1935         PARSER->registerParseNode((yyval.expr));
1936     }
1937     break;
1938 
1939   case 46:
1940 
1941 /* Line 1806 of yacc.c  */
1942 #line 456 "../Source/WebCore/xml/XPathGrammar.y"
1943     {
1944         (yyval.expr) = new Filter((yyvsp[(1) - (2)].expr), *(yyvsp[(2) - (2)].predList));
1945         PARSER->unregisterParseNode((yyvsp[(1) - (2)].expr));
1946         PARSER->deletePredicateVector((yyvsp[(2) - (2)].predList));
1947         PARSER->registerParseNode((yyval.expr));
1948     }
1949     break;
1950 
1951   case 48:
1952 
1953 /* Line 1806 of yacc.c  */
1954 #line 468 "../Source/WebCore/xml/XPathGrammar.y"
1955     {
1956         (yyval.expr) = new LogicalOp(LogicalOp::OP_Or, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
1957         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1958         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
1959         PARSER->registerParseNode((yyval.expr));
1960     }
1961     break;
1962 
1963   case 50:
1964 
1965 /* Line 1806 of yacc.c  */
1966 #line 480 "../Source/WebCore/xml/XPathGrammar.y"
1967     {
1968         (yyval.expr) = new LogicalOp(LogicalOp::OP_And, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
1969         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1970         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
1971         PARSER->registerParseNode((yyval.expr));
1972     }
1973     break;
1974 
1975   case 52:
1976 
1977 /* Line 1806 of yacc.c  */
1978 #line 492 "../Source/WebCore/xml/XPathGrammar.y"
1979     {
1980         (yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
1981         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1982         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
1983         PARSER->registerParseNode((yyval.expr));
1984     }
1985     break;
1986 
1987   case 54:
1988 
1989 /* Line 1806 of yacc.c  */
1990 #line 504 "../Source/WebCore/xml/XPathGrammar.y"
1991     {
1992         (yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
1993         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
1994         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
1995         PARSER->registerParseNode((yyval.expr));
1996     }
1997     break;
1998 
1999   case 56:
2000 
2001 /* Line 1806 of yacc.c  */
2002 #line 516 "../Source/WebCore/xml/XPathGrammar.y"
2003     {
2004         (yyval.expr) = new NumericOp(NumericOp::OP_Add, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
2005         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
2006         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
2007         PARSER->registerParseNode((yyval.expr));
2008     }
2009     break;
2010 
2011   case 57:
2012 
2013 /* Line 1806 of yacc.c  */
2014 #line 524 "../Source/WebCore/xml/XPathGrammar.y"
2015     {
2016         (yyval.expr) = new NumericOp(NumericOp::OP_Sub, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
2017         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
2018         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
2019         PARSER->registerParseNode((yyval.expr));
2020     }
2021     break;
2022 
2023   case 59:
2024 
2025 /* Line 1806 of yacc.c  */
2026 #line 536 "../Source/WebCore/xml/XPathGrammar.y"
2027     {
2028         (yyval.expr) = new NumericOp((yyvsp[(2) - (3)].numop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr));
2029         PARSER->unregisterParseNode((yyvsp[(1) - (3)].expr));
2030         PARSER->unregisterParseNode((yyvsp[(3) - (3)].expr));
2031         PARSER->registerParseNode((yyval.expr));
2032     }
2033     break;
2034 
2035   case 61:
2036 
2037 /* Line 1806 of yacc.c  */
2038 #line 548 "../Source/WebCore/xml/XPathGrammar.y"
2039     {
2040         (yyval.expr) = new Negative;
2041         (yyval.expr)->addSubExpression((yyvsp[(2) - (2)].expr));
2042         PARSER->unregisterParseNode((yyvsp[(2) - (2)].expr));
2043         PARSER->registerParseNode((yyval.expr));
2044     }
2045     break;
2046 
2047 
2048 
2049 /* Line 1806 of yacc.c  */
2050 #line 2051 "/Source/WebCore/generated/XPathGrammar.tab.c"
2051       default: break;
2052     }
2053   /* User semantic actions sometimes alter yychar, and that requires
2054      that yytoken be updated with the new translation.  We take the
2055      approach of translating immediately before every use of yytoken.
2056      One alternative is translating here after every semantic action,
2057      but that translation would be missed if the semantic action invokes
2058      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2059      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2060      incorrect destructor might then be invoked immediately.  In the
2061      case of YYERROR or YYBACKUP, subsequent parser actions might lead
2062      to an incorrect destructor call or verbose syntax error message
2063      before the lookahead is translated.  */
2064   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2065 
2066   YYPOPSTACK (yylen);
2067   yylen = 0;
2068   YY_STACK_PRINT (yyss, yyssp);
2069 
2070   *++yyvsp = yyval;
2071 
2072   /* Now `shift' the result of the reduction.  Determine what state
2073      that goes to, based on the state we popped back to and the rule
2074      number reduced by.  */
2075 
2076   yyn = yyr1[yyn];
2077 
2078   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2079   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2080     yystate = yytable[yystate];
2081   else
2082     yystate = yydefgoto[yyn - YYNTOKENS];
2083 
2084   goto yynewstate;
2085 
2086 
2087 /*------------------------------------.
2088 | yyerrlab -- here on detecting error |
2089 `------------------------------------*/
2090 yyerrlab:
2091   /* Make sure we have latest lookahead translation.  See comments at
2092      user semantic actions for why this is necessary.  */
2093   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2094 
2095   /* If not already recovering from an error, report this error.  */
2096   if (!yyerrstatus)
2097     {
2098       ++yynerrs;
2099 #if ! YYERROR_VERBOSE
2100       yyerror (YY_("syntax error"));
2101 #else
2102 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2103                                         yyssp, yytoken)
2104       {
2105         char const *yymsgp = YY_("syntax error");
2106         int yysyntax_error_status;
2107         yysyntax_error_status = YYSYNTAX_ERROR;
2108         if (yysyntax_error_status == 0)
2109           yymsgp = yymsg;
2110         else if (yysyntax_error_status == 1)
2111           {
2112             if (yymsg != yymsgbuf)
2113               YYSTACK_FREE (yymsg);
2114             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2115             if (!yymsg)
2116               {
2117                 yymsg = yymsgbuf;
2118                 yymsg_alloc = sizeof yymsgbuf;
2119                 yysyntax_error_status = 2;
2120               }
2121             else
2122               {
2123                 yysyntax_error_status = YYSYNTAX_ERROR;
2124                 yymsgp = yymsg;
2125               }
2126           }
2127         yyerror (yymsgp);
2128         if (yysyntax_error_status == 2)
2129           goto yyexhaustedlab;
2130       }
2131 # undef YYSYNTAX_ERROR
2132 #endif
2133     }
2134 
2135 
2136 
2137   if (yyerrstatus == 3)
2138     {
2139       /* If just tried and failed to reuse lookahead token after an
2140 	 error, discard it.  */
2141 
2142       if (yychar <= YYEOF)
2143 	{
2144 	  /* Return failure if at end of input.  */
2145 	  if (yychar == YYEOF)
2146 	    YYABORT;
2147 	}
2148       else
2149 	{
2150 	  yydestruct ("Error: discarding",
2151 		      yytoken, &yylval);
2152 	  yychar = YYEMPTY;
2153 	}
2154     }
2155 
2156   /* Else will try to reuse lookahead token after shifting the error
2157      token.  */
2158   goto yyerrlab1;
2159 
2160 
2161 /*---------------------------------------------------.
2162 | yyerrorlab -- error raised explicitly by YYERROR.  |
2163 `---------------------------------------------------*/
2164 yyerrorlab:
2165 
2166   /* Pacify compilers like GCC when the user code never invokes
2167      YYERROR and the label yyerrorlab therefore never appears in user
2168      code.  */
2169   if (/*CONSTCOND*/ 0)
2170      goto yyerrorlab;
2171 
2172   /* Do not reclaim the symbols of the rule which action triggered
2173      this YYERROR.  */
2174   YYPOPSTACK (yylen);
2175   yylen = 0;
2176   YY_STACK_PRINT (yyss, yyssp);
2177   yystate = *yyssp;
2178   goto yyerrlab1;
2179 
2180 
2181 /*-------------------------------------------------------------.
2182 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2183 `-------------------------------------------------------------*/
2184 yyerrlab1:
2185   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
2186 
2187   for (;;)
2188     {
2189       yyn = yypact[yystate];
2190       if (!yypact_value_is_default (yyn))
2191 	{
2192 	  yyn += YYTERROR;
2193 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2194 	    {
2195 	      yyn = yytable[yyn];
2196 	      if (0 < yyn)
2197 		break;
2198 	    }
2199 	}
2200 
2201       /* Pop the current state because it cannot handle the error token.  */
2202       if (yyssp == yyss)
2203 	YYABORT;
2204 
2205 
2206       yydestruct ("Error: popping",
2207 		  yystos[yystate], yyvsp);
2208       YYPOPSTACK (1);
2209       yystate = *yyssp;
2210       YY_STACK_PRINT (yyss, yyssp);
2211     }
2212 
2213   *++yyvsp = yylval;
2214 
2215 
2216   /* Shift the error token.  */
2217   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2218 
2219   yystate = yyn;
2220   goto yynewstate;
2221 
2222 
2223 /*-------------------------------------.
2224 | yyacceptlab -- YYACCEPT comes here.  |
2225 `-------------------------------------*/
2226 yyacceptlab:
2227   yyresult = 0;
2228   goto yyreturn;
2229 
2230 /*-----------------------------------.
2231 | yyabortlab -- YYABORT comes here.  |
2232 `-----------------------------------*/
2233 yyabortlab:
2234   yyresult = 1;
2235   goto yyreturn;
2236 
2237 #if !defined(yyoverflow) || YYERROR_VERBOSE
2238 /*-------------------------------------------------.
2239 | yyexhaustedlab -- memory exhaustion comes here.  |
2240 `-------------------------------------------------*/
2241 yyexhaustedlab:
2242   yyerror (YY_("memory exhausted"));
2243   yyresult = 2;
2244   /* Fall through.  */
2245 #endif
2246 
2247 yyreturn:
2248   if (yychar != YYEMPTY)
2249     {
2250       /* Make sure we have latest lookahead translation.  See comments at
2251          user semantic actions for why this is necessary.  */
2252       yytoken = YYTRANSLATE (yychar);
2253       yydestruct ("Cleanup: discarding lookahead",
2254                   yytoken, &yylval);
2255     }
2256   /* Do not reclaim the symbols of the rule which action triggered
2257      this YYABORT or YYACCEPT.  */
2258   YYPOPSTACK (yylen);
2259   YY_STACK_PRINT (yyss, yyssp);
2260   while (yyssp != yyss)
2261     {
2262       yydestruct ("Cleanup: popping",
2263 		  yystos[*yyssp], yyvsp);
2264       YYPOPSTACK (1);
2265     }
2266 #ifndef yyoverflow
2267   if (yyss != yyssa)
2268     YYSTACK_FREE (yyss);
2269 #endif
2270 #if YYERROR_VERBOSE
2271   if (yymsg != yymsgbuf)
2272     YYSTACK_FREE (yymsg);
2273 #endif
2274   /* Make sure YYID is used.  */
2275   return YYID (yyresult);
2276 }
2277 
2278 
2279 
2280 /* Line 2067 of yacc.c  */
2281 #line 556 "../Source/WebCore/xml/XPathGrammar.y"
2282 
2283 
2284 #endif
2285 
2286