• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KHTML

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

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal