File indexing completed on 2024-04-28 11:39:40
0001 /* A Bison parser, made by GNU Bison 2.4.2. */ 0002 0003 /* Skeleton implementation for Bison's Yacc-like parsers in C 0004 0005 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software 0006 Foundation, Inc. 0007 0008 This program is free software: you can redistribute it and/or modify 0009 it under the terms of the GNU General Public License as published by 0010 the Free Software Foundation, either version 3 of the License, or 0011 (at your option) any later version. 0012 0013 This program is distributed in the hope that it will be useful, 0014 but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0016 GNU General Public License for more details. 0017 0018 You should have received a copy of the GNU General Public License 0019 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 0020 0021 /* As a special exception, you may create a larger work that contains 0022 part or all of the Bison parser skeleton and distribute that work 0023 under terms of your choice, so long as that work isn't itself a 0024 parser generator using the skeleton or a modified version thereof 0025 as a parser skeleton. Alternatively, if you modify or redistribute 0026 the parser skeleton itself, you may (at your option) remove this 0027 special exception, which will cause the skeleton and the resulting 0028 Bison output files to be licensed under the GNU General Public 0029 License without this special exception. 0030 0031 This special exception was added by the Free Software Foundation in 0032 version 2.2 of Bison. */ 0033 0034 /* C LALR(1) parser skeleton written by Richard Stallman, by 0035 simplifying the original so-called "semantic" parser. */ 0036 0037 /* All symbols defined below should begin with yy or YY, to avoid 0038 infringing on user name space. This should be done even for local 0039 variables, as they might otherwise be expanded by user macros. 0040 There are some unavoidable exceptions within include files to 0041 define necessary library symbols; they are noted "INFRINGES ON 0042 USER NAME SPACE" below. */ 0043 0044 /* Identify Bison output. */ 0045 #define YYBISON 1 0046 0047 /* Bison version. */ 0048 #define YYBISON_VERSION "2.4.2" 0049 0050 /* Skeleton name. */ 0051 #define YYSKELETON_NAME "yacc.c" 0052 0053 /* Pure parsers. */ 0054 #define YYPURE 0 0055 0056 /* Push parsers. */ 0057 #define YYPUSH 0 0058 0059 /* Pull parsers. */ 0060 #define YYPULL 1 0061 0062 /* Using locations. */ 0063 #define YYLSP_NEEDED 0 0064 0065 /* Substitute the variable and function names. */ 0066 #define yyparse khtmlxpathyyparse 0067 #define yylex khtmlxpathyylex 0068 #define yyerror khtmlxpathyyerror 0069 #define yylval khtmlxpathyylval 0070 #define yychar khtmlxpathyychar 0071 #define yydebug khtmlxpathyydebug 0072 #define yynerrs khtmlxpathyynerrs 0073 0074 /* Copy the first part of user declarations. */ 0075 0076 /* Line 189 of yacc.c */ 0077 #line 1 "parser.y" 0078 0079 #include "functions.h" 0080 #include "path.h" 0081 #include "predicate.h" 0082 #include "util.h" 0083 #include "tokenizer.h" 0084 0085 #include "expression.h" 0086 #include "util.h" 0087 #include "variablereference.h" 0088 0089 #include "dom/dom_string.h" 0090 #include "dom/dom_exception.h" 0091 #include "dom/dom3_xpath.h" 0092 #include "xml/dom_stringimpl.h" 0093 #include "xml/dom3_xpathimpl.h" 0094 0095 using namespace DOM; 0096 using namespace DOM::XPath; 0097 using namespace khtml; 0098 using namespace khtml::XPath; 0099 0100 #include <QList> 0101 #include <QPair> 0102 #include <QtDebug> 0103 0104 #define YYDEBUG 1 0105 0106 Expression *khtmlParseXPathStatement(const DOM::DOMString &statement, int &ec); 0107 0108 static Expression *_topExpr; 0109 static int xpathParseException; 0110 0111 /* Line 189 of yacc.c */ 0112 #line 118 "parser.tab.c" 0113 0114 /* Enabling traces. */ 0115 #ifndef YYDEBUG 0116 # define YYDEBUG 0 0117 #endif 0118 0119 /* Enabling verbose error messages. */ 0120 #ifdef YYERROR_VERBOSE 0121 # undef YYERROR_VERBOSE 0122 # define YYERROR_VERBOSE 1 0123 #else 0124 # define YYERROR_VERBOSE 0 0125 #endif 0126 0127 /* Enabling the token table. */ 0128 #ifndef YYTOKEN_TABLE 0129 # define YYTOKEN_TABLE 0 0130 #endif 0131 0132 /* Tokens. */ 0133 #ifndef YYTOKENTYPE 0134 # define YYTOKENTYPE 0135 /* Put the tokens into the symbol table, so that GDB and other debuggers 0136 know about them. */ 0137 enum yytokentype { 0138 EQOP = 258, 0139 RELOP = 259, 0140 MULOP = 260, 0141 MINUS = 261, 0142 PLUS = 262, 0143 AND = 263, 0144 OR = 264, 0145 AXISNAME = 265, 0146 NODETYPE = 266, 0147 PI = 267, 0148 FUNCTIONNAME = 268, 0149 LITERAL = 269, 0150 VARIABLEREFERENCE = 270, 0151 NUMBER = 271, 0152 DOTDOT = 272, 0153 SLASHSLASH = 273, 0154 NAMETEST = 274, 0155 ERROR = 275 0156 }; 0157 #endif 0158 0159 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 0160 typedef union YYSTYPE { 0161 0162 /* Line 214 of yacc.c */ 0163 #line 39 "parser.y" 0164 0165 khtml::XPath::Step::AxisType axisType; 0166 int num; 0167 DOM::DOMString *str; // we use this and not DOMStringImpl*, so the 0168 // memory management for this is entirely manual, 0169 // and not an RC/manual hybrid 0170 khtml::XPath::Expression *expr; 0171 QList<khtml::XPath::Predicate *> *predList; 0172 QList<khtml::XPath::Expression *> *argList; 0173 khtml::XPath::Step *step; 0174 khtml::XPath::LocationPath *locationPath; 0175 0176 /* Line 214 of yacc.c */ 0177 #line 189 "parser.tab.c" 0178 } YYSTYPE; 0179 # define YYSTYPE_IS_TRIVIAL 1 0180 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 0181 # define YYSTYPE_IS_DECLARED 1 0182 #endif 0183 0184 /* Copy the second part of user declarations. */ 0185 0186 /* Line 264 of yacc.c */ 0187 #line 52 "parser.y" 0188 0189 /* Line 264 of yacc.c */ 0190 #line 205 "parser.tab.c" 0191 0192 #ifdef short 0193 # undef short 0194 #endif 0195 0196 #ifdef YYTYPE_UINT8 0197 typedef YYTYPE_UINT8 yytype_uint8; 0198 #else 0199 typedef unsigned char yytype_uint8; 0200 #endif 0201 0202 #ifdef YYTYPE_INT8 0203 typedef YYTYPE_INT8 yytype_int8; 0204 #elif (defined __STDC__ || defined __C99__FUNC__ \ 0205 || defined __cplusplus || defined _MSC_VER) 0206 typedef signed char yytype_int8; 0207 #else 0208 typedef short int yytype_int8; 0209 #endif 0210 0211 #ifdef YYTYPE_UINT16 0212 typedef YYTYPE_UINT16 yytype_uint16; 0213 #else 0214 typedef unsigned short int yytype_uint16; 0215 #endif 0216 0217 #ifdef YYTYPE_INT16 0218 typedef YYTYPE_INT16 yytype_int16; 0219 #else 0220 typedef short int yytype_int16; 0221 #endif 0222 0223 #ifndef YYSIZE_T 0224 # ifdef __SIZE_TYPE__ 0225 # define YYSIZE_T __SIZE_TYPE__ 0226 # elif defined size_t 0227 # define YYSIZE_T size_t 0228 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 0229 || defined __cplusplus || defined _MSC_VER) 0230 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 0231 # define YYSIZE_T size_t 0232 # else 0233 # define YYSIZE_T unsigned int 0234 # endif 0235 #endif 0236 0237 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 0238 0239 #ifndef YY_ 0240 # if defined YYENABLE_NLS && YYENABLE_NLS 0241 # if ENABLE_NLS 0242 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 0243 # define YY_(msgid) dgettext ("bison-runtime", msgid) 0244 # endif 0245 # endif 0246 # ifndef YY_ 0247 # define YY_(msgid) msgid 0248 # endif 0249 #endif 0250 0251 /* Suppress unused-variable warnings by "using" E. */ 0252 #if ! defined lint || defined __GNUC__ 0253 # define YYUSE(e) ((void) (e)) 0254 #else 0255 # define YYUSE(e) /* empty */ 0256 #endif 0257 0258 /* Identity function, used to suppress warnings about constant conditions. */ 0259 #ifndef lint 0260 # define YYID(n) (n) 0261 #else 0262 #if (defined __STDC__ || defined __C99__FUNC__ \ 0263 || defined __cplusplus || defined _MSC_VER) 0264 static int 0265 YYID(int yyi) 0266 #else 0267 static int 0268 YYID(yyi) 0269 int yyi; 0270 #endif 0271 { 0272 return yyi; 0273 } 0274 #endif 0275 0276 #if ! defined yyoverflow || YYERROR_VERBOSE 0277 0278 /* The parser invokes alloca or malloc; define the necessary symbols. */ 0279 0280 # ifdef YYSTACK_USE_ALLOCA 0281 # if YYSTACK_USE_ALLOCA 0282 # ifdef __GNUC__ 0283 # define YYSTACK_ALLOC __builtin_alloca 0284 # elif defined __BUILTIN_VA_ARG_INCR 0285 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 0286 # elif defined _AIX 0287 # define YYSTACK_ALLOC __alloca 0288 # elif defined _MSC_VER 0289 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 0290 # define alloca _alloca 0291 # else 0292 # define YYSTACK_ALLOC alloca 0293 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 0294 || defined __cplusplus || defined _MSC_VER) 0295 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 0296 # ifndef _STDLIB_H 0297 # define _STDLIB_H 1 0298 # endif 0299 # endif 0300 # endif 0301 # endif 0302 # endif 0303 0304 # ifdef YYSTACK_ALLOC 0305 /* Pacify GCC's `empty if-body' warning. */ 0306 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 0307 # ifndef YYSTACK_ALLOC_MAXIMUM 0308 /* The OS might guarantee only one guard page at the bottom of the stack, 0309 and a page size can be as small as 4096 bytes. So we cannot safely 0310 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 0311 to allow for a few compiler-allocated temporary stack slots. */ 0312 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 0313 # endif 0314 # else 0315 # define YYSTACK_ALLOC YYMALLOC 0316 # define YYSTACK_FREE YYFREE 0317 # ifndef YYSTACK_ALLOC_MAXIMUM 0318 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 0319 # endif 0320 # if (defined __cplusplus && ! defined _STDLIB_H \ 0321 && ! ((defined YYMALLOC || defined malloc) \ 0322 && (defined YYFREE || defined free))) 0323 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 0324 # ifndef _STDLIB_H 0325 # define _STDLIB_H 1 0326 # endif 0327 # endif 0328 # ifndef YYMALLOC 0329 # define YYMALLOC malloc 0330 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 0331 || defined __cplusplus || defined _MSC_VER) 0332 void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 0333 # endif 0334 # endif 0335 # ifndef YYFREE 0336 # define YYFREE free 0337 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 0338 || defined __cplusplus || defined _MSC_VER) 0339 void free(void *); /* INFRINGES ON USER NAME SPACE */ 0340 # endif 0341 # endif 0342 # endif 0343 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 0344 0345 #if (! defined yyoverflow \ 0346 && (! defined __cplusplus \ 0347 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 0348 0349 /* A type that is properly aligned for any stack member. */ 0350 union yyalloc { 0351 yytype_int16 yyss_alloc; 0352 YYSTYPE yyvs_alloc; 0353 }; 0354 0355 /* The size of the maximum gap between one aligned stack and the next. */ 0356 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 0357 0358 /* The size of an array large to enough to hold all stacks, each with 0359 N elements. */ 0360 # define YYSTACK_BYTES(N) \ 0361 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 0362 + YYSTACK_GAP_MAXIMUM) 0363 0364 /* Copy COUNT objects from FROM to TO. The source and destination do 0365 not overlap. */ 0366 # ifndef YYCOPY 0367 # if defined __GNUC__ && 1 < __GNUC__ 0368 # define YYCOPY(To, From, Count) \ 0369 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 0370 # else 0371 # define YYCOPY(To, From, Count) \ 0372 do \ 0373 { \ 0374 YYSIZE_T yyi; \ 0375 for (yyi = 0; yyi < (Count); yyi++) \ 0376 (To)[yyi] = (From)[yyi]; \ 0377 } \ 0378 while (YYID (0)) 0379 # endif 0380 # endif 0381 0382 /* Relocate STACK from its old location to the new one. The 0383 local variables YYSIZE and YYSTACKSIZE give the old and new number of 0384 elements in the stack, and YYPTR gives the new location of the 0385 stack. Advance YYPTR to a properly aligned location for the next 0386 stack. */ 0387 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 0388 do \ 0389 { \ 0390 YYSIZE_T yynewbytes; \ 0391 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 0392 Stack = &yyptr->Stack_alloc; \ 0393 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 0394 yyptr += yynewbytes / sizeof (*yyptr); \ 0395 } \ 0396 while (YYID (0)) 0397 0398 #endif 0399 0400 /* YYFINAL -- State number of the termination state. */ 0401 #define YYFINAL 43 0402 /* YYLAST -- Last index in YYTABLE. */ 0403 #define YYLAST 115 0404 0405 /* YYNTOKENS -- Number of terminals. */ 0406 #define YYNTOKENS 30 0407 /* YYNNTS -- Number of nonterminals. */ 0408 #define YYNNTS 26 0409 /* YYNRULES -- Number of rules. */ 0410 #define YYNRULES 60 0411 /* YYNRULES -- Number of states. */ 0412 #define YYNSTATES 90 0413 0414 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 0415 #define YYUNDEFTOK 2 0416 #define YYMAXUTOK 275 0417 0418 #define YYTRANSLATE(YYX) \ 0419 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 0420 0421 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 0422 static const yytype_uint8 yytranslate[] = { 0423 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0427 23, 24, 2, 2, 28, 2, 27, 21, 2, 2, 0428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0429 2, 2, 2, 2, 22, 2, 2, 2, 2, 2, 0430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0432 2, 25, 2, 26, 2, 2, 2, 2, 2, 2, 0433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0435 2, 2, 2, 2, 29, 2, 2, 2, 2, 2, 0436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0448 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 0449 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0450 15, 16, 17, 18, 19, 20 0451 }; 0452 0453 #if YYDEBUG 0454 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 0455 YYRHS. */ 0456 static const yytype_uint8 yyprhs[] = { 0457 0, 0, 3, 5, 7, 9, 11, 14, 17, 19, 0458 23, 27, 29, 32, 35, 39, 41, 43, 45, 47, 0459 51, 55, 60, 62, 65, 69, 71, 73, 75, 77, 0460 81, 83, 85, 87, 91, 96, 98, 102, 104, 106, 0461 110, 112, 114, 118, 122, 124, 127, 129, 133, 135, 0462 139, 141, 145, 147, 151, 153, 157, 161, 163, 167, 0463 169 0464 }; 0465 0466 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 0467 static const yytype_int8 yyrhs[] = { 0468 31, 0, -1, 49, -1, 34, -1, 33, -1, 21, 0469 -1, 21, 34, -1, 40, 34, -1, 35, -1, 34, 0470 21, 35, -1, 34, 40, 35, -1, 37, -1, 37, 0471 38, -1, 36, 37, -1, 36, 37, 38, -1, 41, 0472 -1, 10, -1, 22, -1, 19, -1, 11, 23, 24, 0473 -1, 12, 23, 24, -1, 12, 23, 14, 24, -1, 0474 39, -1, 38, 39, -1, 25, 31, 26, -1, 18, 0475 -1, 27, -1, 17, -1, 15, -1, 23, 31, 24, 0476 -1, 14, -1, 16, -1, 43, -1, 13, 23, 24, 0477 -1, 13, 23, 44, 24, -1, 45, -1, 44, 28, 0478 45, -1, 31, -1, 47, -1, 46, 29, 47, -1, 0479 32, -1, 48, -1, 48, 21, 34, -1, 48, 40, 0480 34, -1, 42, -1, 42, 38, -1, 50, -1, 49, 0481 9, 50, -1, 51, -1, 50, 8, 51, -1, 52, 0482 -1, 51, 3, 52, -1, 53, -1, 52, 4, 53, 0483 -1, 54, -1, 53, 7, 54, -1, 53, 6, 54, 0484 -1, 55, -1, 54, 5, 55, -1, 46, -1, 6, 0485 55, -1 0486 }; 0487 0488 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 0489 static const yytype_uint16 yyrline[] = { 0490 0, 93, 93, 100, 105, 112, 117, 122, 130, 136, 0491 141, 149, 155, 162, 168, 175, 179, 181, 188, 202, 0492 207, 209, 220, 226, 233, 240, 247, 252, 259, 265, 0493 270, 276, 282, 286, 298, 312, 318, 325, 330, 332, 0494 341, 346, 351, 356, 364, 369, 376, 378, 385, 387, 0495 394, 396, 403, 405, 412, 414, 419, 426, 428, 435, 0496 437 0497 }; 0498 #endif 0499 0500 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 0501 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 0502 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 0503 static const char *const yytname[] = { 0504 "$end", "error", "$undefined", "EQOP", "RELOP", "MULOP", "MINUS", 0505 "PLUS", "AND", "OR", "AXISNAME", "NODETYPE", "PI", "FUNCTIONNAME", 0506 "LITERAL", "VARIABLEREFERENCE", "NUMBER", "DOTDOT", "SLASHSLASH", 0507 "NAMETEST", "ERROR", "'/'", "'@'", "'('", "')'", "'['", "']'", "'.'", 0508 "','", "'|'", "$accept", "Expr", "LocationPath", "AbsoluteLocationPath", 0509 "RelativeLocationPath", "Step", "AxisSpecifier", "NodeTest", 0510 "PredicateList", "Predicate", "DescendantOrSelf", "AbbreviatedStep", 0511 "PrimaryExpr", "FunctionCall", "ArgumentList", "Argument", "UnionExpr", 0512 "PathExpr", "FilterExpr", "OrExpr", "AndExpr", "EqualityExpr", 0513 "RelationalExpr", "AdditiveExpr", "MultiplicativeExpr", "UnaryExpr", nullptr 0514 }; 0515 #endif 0516 0517 # ifdef YYPRINT 0518 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 0519 token YYLEX-NUM. */ 0520 static const yytype_uint16 yytoknum[] = { 0521 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0522 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 0523 275, 47, 64, 40, 41, 91, 93, 46, 44, 124 0524 }; 0525 # endif 0526 0527 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 0528 static const yytype_uint8 yyr1[] = { 0529 0, 30, 31, 32, 32, 33, 33, 33, 34, 34, 0530 34, 35, 35, 35, 35, 35, 36, 36, 37, 37, 0531 37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 0532 42, 42, 42, 43, 43, 44, 44, 45, 46, 46, 0533 47, 47, 47, 47, 48, 48, 49, 49, 50, 50, 0534 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 0535 55 0536 }; 0537 0538 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 0539 static const yytype_uint8 yyr2[] = { 0540 0, 2, 1, 1, 1, 1, 2, 2, 1, 3, 0541 3, 1, 2, 2, 3, 1, 1, 1, 1, 3, 0542 3, 4, 1, 2, 3, 1, 1, 1, 1, 3, 0543 1, 1, 1, 3, 4, 1, 3, 1, 1, 3, 0544 1, 1, 3, 3, 1, 2, 1, 3, 1, 3, 0545 1, 3, 1, 3, 1, 3, 3, 1, 3, 1, 0546 2 0547 }; 0548 0549 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 0550 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 0551 means the default is an error. */ 0552 static const yytype_uint8 yydefact[] = { 0553 0, 0, 16, 0, 0, 0, 30, 28, 31, 27, 0554 25, 18, 5, 17, 0, 26, 0, 40, 4, 3, 0555 8, 0, 11, 0, 15, 44, 32, 59, 38, 41, 0556 2, 46, 48, 50, 52, 54, 57, 60, 0, 0, 0557 0, 6, 0, 1, 0, 0, 13, 0, 12, 22, 0558 7, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0559 0, 0, 19, 0, 20, 33, 37, 0, 35, 29, 0560 9, 10, 14, 0, 23, 39, 42, 43, 47, 49, 0561 51, 53, 56, 55, 58, 21, 34, 0, 24, 36 0562 }; 0563 0564 /* YYDEFGOTO[NTERM-NUM]. */ 0565 static const yytype_int8 yydefgoto[] = { 0566 -1, 66, 17, 18, 19, 20, 21, 22, 48, 49, 0567 23, 24, 25, 26, 67, 68, 27, 28, 29, 30, 0568 31, 32, 33, 34, 35, 36 0569 }; 0570 0571 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 0572 STATE-NUM. */ 0573 #define YYPACT_NINF -45 0574 static const yytype_int8 yypact[] = { 0575 70, 70, -45, -17, 4, 14, -45, -45, -45, -45, 0576 -45, -45, -2, -45, 70, -45, 39, -45, -45, 3, 0577 -45, 19, 17, -2, -45, 17, -45, 18, -45, 15, 0578 34, 38, 45, 46, 6, 47, -45, -45, 27, 5, 0579 51, 3, 29, -45, -2, -2, 17, 70, 17, -45, 0580 3, 17, 88, -2, -2, 70, 70, 70, 70, 70, 0581 70, 70, -45, 30, -45, -45, -45, -6, -45, -45, 0582 -45, -45, 17, 53, -45, -45, 3, 3, 38, 45, 0583 46, 6, 47, 47, -45, -45, -45, 70, -45, -45 0584 }; 0585 0586 /* YYPGOTO[NTERM-NUM]. */ 0587 static const yytype_int8 yypgoto[] = { 0588 -45, 2, -45, -45, -9, -10, -45, 35, -20, -44, 0589 -18, -45, -45, -45, -45, -32, -45, 25, -45, -45, 0590 16, 40, 33, 36, -19, -1 0591 }; 0592 0593 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 0594 positive, shift that token. If negative, reduce the rule which 0595 number is the opposite. If zero, do what YYDEFACT says. 0596 If YYTABLE_NINF, syntax error. */ 0597 #define YYTABLE_NINF -1 0598 static const yytype_uint8 yytable[] = { 0599 37, 45, 16, 41, 74, 51, 38, 74, 2, 3, 0600 4, 54, 59, 60, 50, 9, 42, 11, 86, 63, 0601 13, 10, 87, 45, 44, 15, 72, 39, 74, 64, 0602 3, 4, 45, 10, 70, 71, 53, 40, 11, 43, 0603 82, 83, 47, 55, 76, 77, 56, 52, 57, 73, 0604 58, 62, 61, 69, 85, 89, 46, 1, 45, 45, 0605 84, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0606 11, 78, 12, 13, 14, 65, 1, 75, 15, 88, 0607 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0608 80, 12, 13, 14, 81, 0, 79, 15, 2, 3, 0609 4, 5, 6, 7, 8, 9, 10, 11, 0, 12, 0610 13, 14, 0, 0, 0, 15 0611 }; 0612 0613 static const yytype_int8 yycheck[] = { 0614 1, 19, 0, 12, 48, 25, 23, 51, 10, 11, 0615 12, 29, 6, 7, 23, 17, 14, 19, 24, 14, 0616 22, 18, 28, 41, 21, 27, 46, 23, 72, 24, 0617 11, 12, 50, 18, 44, 45, 21, 23, 19, 0, 0618 59, 60, 25, 9, 53, 54, 8, 29, 3, 47, 0619 4, 24, 5, 24, 24, 87, 21, 6, 76, 77, 0620 61, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0621 19, 55, 21, 22, 23, 24, 6, 52, 27, 26, 0622 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0623 57, 21, 22, 23, 58, -1, 56, 27, 10, 11, 0624 12, 13, 14, 15, 16, 17, 18, 19, -1, 21, 0625 22, 23, -1, -1, -1, 27 0626 }; 0627 0628 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 0629 symbol of state STATE-NUM. */ 0630 static const yytype_uint8 yystos[] = { 0631 0, 6, 10, 11, 12, 13, 14, 15, 16, 17, 0632 18, 19, 21, 22, 23, 27, 31, 32, 33, 34, 0633 35, 36, 37, 40, 41, 42, 43, 46, 47, 48, 0634 49, 50, 51, 52, 53, 54, 55, 55, 23, 23, 0635 23, 34, 31, 0, 21, 40, 37, 25, 38, 39, 0636 34, 38, 29, 21, 40, 9, 8, 3, 4, 6, 0637 7, 5, 24, 14, 24, 24, 31, 44, 45, 24, 0638 35, 35, 38, 31, 39, 47, 34, 34, 50, 51, 0639 52, 53, 54, 54, 55, 24, 24, 28, 26, 45 0640 }; 0641 0642 #define yyerrok (yyerrstatus = 0) 0643 #define yyclearin (yychar = YYEMPTY) 0644 #define YYEMPTY (-2) 0645 #define YYEOF 0 0646 0647 #define YYACCEPT goto yyacceptlab 0648 #define YYABORT goto yyabortlab 0649 #define YYERROR goto yyerrorlab 0650 0651 /* Like YYERROR except do call yyerror. This remains here temporarily 0652 to ease the transition to the new meaning of YYERROR, for GCC. 0653 Once GCC version 2 has supplanted version 1, this can go. However, 0654 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 0655 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 0656 discussed. */ 0657 0658 #define YYFAIL goto yyerrlab 0659 #if defined YYFAIL 0660 /* This is here to suppress warnings from the GCC cpp's 0661 -Wunused-macros. Normally we don't worry about that warning, but 0662 some users do, and we want to make it easy for users to remove 0663 YYFAIL uses, which will produce warnings from Bison 2.5. */ 0664 #endif 0665 0666 #define YYRECOVERING() (!!yyerrstatus) 0667 0668 #define YYBACKUP(Token, Value) \ 0669 do \ 0670 if (yychar == YYEMPTY && yylen == 1) \ 0671 { \ 0672 yychar = (Token); \ 0673 yylval = (Value); \ 0674 yytoken = YYTRANSLATE (yychar); \ 0675 YYPOPSTACK (1); \ 0676 goto yybackup; \ 0677 } \ 0678 else \ 0679 { \ 0680 yyerror (YY_("syntax error: cannot back up")); \ 0681 YYERROR; \ 0682 } \ 0683 while (YYID (0)) 0684 0685 #define YYTERROR 1 0686 #define YYERRCODE 256 0687 0688 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 0689 If N is 0, then set CURRENT to the empty location which ends 0690 the previous symbol: RHS[0] (always defined). */ 0691 0692 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 0693 #ifndef YYLLOC_DEFAULT 0694 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 0695 do \ 0696 if (YYID (N)) \ 0697 { \ 0698 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 0699 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 0700 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 0701 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 0702 } \ 0703 else \ 0704 { \ 0705 (Current).first_line = (Current).last_line = \ 0706 YYRHSLOC (Rhs, 0).last_line; \ 0707 (Current).first_column = (Current).last_column = \ 0708 YYRHSLOC (Rhs, 0).last_column; \ 0709 } \ 0710 while (YYID (0)) 0711 #endif 0712 0713 /* YY_LOCATION_PRINT -- Print the location on the stream. 0714 This macro was not mandated originally: define only if we know 0715 we won't break user code: when these are the locations we know. */ 0716 0717 #ifndef YY_LOCATION_PRINT 0718 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 0719 # define YY_LOCATION_PRINT(File, Loc) \ 0720 fprintf (File, "%d.%d-%d.%d", \ 0721 (Loc).first_line, (Loc).first_column, \ 0722 (Loc).last_line, (Loc).last_column) 0723 # else 0724 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 0725 # endif 0726 #endif 0727 0728 /* YYLEX -- calling `yylex' with the right arguments. */ 0729 0730 #ifdef YYLEX_PARAM 0731 # define YYLEX yylex (YYLEX_PARAM) 0732 #else 0733 # define YYLEX yylex () 0734 #endif 0735 0736 /* Enable debugging if requested. */ 0737 #if YYDEBUG 0738 0739 # ifndef YYFPRINTF 0740 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 0741 # define YYFPRINTF fprintf 0742 # endif 0743 0744 # define YYDPRINTF(Args) \ 0745 do { \ 0746 if (yydebug) \ 0747 YYFPRINTF Args; \ 0748 } while (YYID (0)) 0749 0750 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 0751 do { \ 0752 if (yydebug) \ 0753 { \ 0754 YYFPRINTF (stderr, "%s ", Title); \ 0755 yy_symbol_print (stderr, \ 0756 Type, Value); \ 0757 YYFPRINTF (stderr, "\n"); \ 0758 } \ 0759 } while (YYID (0)) 0760 0761 /*--------------------------------. 0762 | Print this symbol on YYOUTPUT. | 0763 `--------------------------------*/ 0764 0765 /*ARGSUSED*/ 0766 #if (defined __STDC__ || defined __C99__FUNC__ \ 0767 || defined __cplusplus || defined _MSC_VER) 0768 static void 0769 yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep) 0770 #else 0771 static void 0772 yy_symbol_value_print(yyoutput, yytype, yyvaluep) 0773 FILE *yyoutput; 0774 int yytype; 0775 YYSTYPE const *const yyvaluep; 0776 #endif 0777 { 0778 if (!yyvaluep) { 0779 return; 0780 } 0781 # ifdef YYPRINT 0782 if (yytype < YYNTOKENS) { 0783 YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); 0784 } 0785 # else 0786 YYUSE(yyoutput); 0787 # endif 0788 switch (yytype) { 0789 default: 0790 break; 0791 } 0792 } 0793 0794 /*--------------------------------. 0795 | Print this symbol on YYOUTPUT. | 0796 `--------------------------------*/ 0797 0798 #if (defined __STDC__ || defined __C99__FUNC__ \ 0799 || defined __cplusplus || defined _MSC_VER) 0800 static void 0801 yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep) 0802 #else 0803 static void 0804 yy_symbol_print(yyoutput, yytype, yyvaluep) 0805 FILE *yyoutput; 0806 int yytype; 0807 YYSTYPE const *const yyvaluep; 0808 #endif 0809 { 0810 if (yytype < YYNTOKENS) { 0811 YYFPRINTF(yyoutput, "token %s (", yytname[yytype]); 0812 } else { 0813 YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]); 0814 } 0815 0816 yy_symbol_value_print(yyoutput, yytype, yyvaluep); 0817 YYFPRINTF(yyoutput, ")"); 0818 } 0819 0820 /*------------------------------------------------------------------. 0821 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 0822 | TOP (included). | 0823 `------------------------------------------------------------------*/ 0824 0825 #if (defined __STDC__ || defined __C99__FUNC__ \ 0826 || defined __cplusplus || defined _MSC_VER) 0827 static void 0828 yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop) 0829 #else 0830 static void 0831 yy_stack_print(yybottom, yytop) 0832 yytype_int16 *yybottom; 0833 yytype_int16 *yytop; 0834 #endif 0835 { 0836 YYFPRINTF(stderr, "Stack now"); 0837 for (; yybottom <= yytop; yybottom++) { 0838 int yybot = *yybottom; 0839 YYFPRINTF(stderr, " %d", yybot); 0840 } 0841 YYFPRINTF(stderr, "\n"); 0842 } 0843 0844 # define YY_STACK_PRINT(Bottom, Top) \ 0845 do { \ 0846 if (yydebug) \ 0847 yy_stack_print ((Bottom), (Top)); \ 0848 } while (YYID (0)) 0849 0850 /*------------------------------------------------. 0851 | Report that the YYRULE is going to be reduced. | 0852 `------------------------------------------------*/ 0853 0854 #if (defined __STDC__ || defined __C99__FUNC__ \ 0855 || defined __cplusplus || defined _MSC_VER) 0856 static void 0857 yy_reduce_print(YYSTYPE *yyvsp, int yyrule) 0858 #else 0859 static void 0860 yy_reduce_print(yyvsp, yyrule) 0861 YYSTYPE *yyvsp; 0862 int yyrule; 0863 #endif 0864 { 0865 int yynrhs = yyr2[yyrule]; 0866 int yyi; 0867 unsigned long int yylno = yyrline[yyrule]; 0868 YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", 0869 yyrule - 1, yylno); 0870 /* The symbols being reduced. */ 0871 for (yyi = 0; yyi < yynrhs; yyi++) { 0872 YYFPRINTF(stderr, " $%d = ", yyi + 1); 0873 yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], 0874 &(yyvsp[(yyi + 1) - (yynrhs)]) 0875 ); 0876 YYFPRINTF(stderr, "\n"); 0877 } 0878 } 0879 0880 # define YY_REDUCE_PRINT(Rule) \ 0881 do { \ 0882 if (yydebug) \ 0883 yy_reduce_print (yyvsp, Rule); \ 0884 } while (YYID (0)) 0885 0886 /* Nonzero means print parse trace. It is left uninitialized so that 0887 multiple parsers can coexist. */ 0888 int yydebug; 0889 #else /* !YYDEBUG */ 0890 # define YYDPRINTF(Args) 0891 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 0892 # define YY_STACK_PRINT(Bottom, Top) 0893 # define YY_REDUCE_PRINT(Rule) 0894 #endif /* !YYDEBUG */ 0895 0896 /* YYINITDEPTH -- initial size of the parser's stacks. */ 0897 #ifndef YYINITDEPTH 0898 # define YYINITDEPTH 200 0899 #endif 0900 0901 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 0902 if the built-in stack extension method is used). 0903 0904 Do not make this value too large; the results are undefined if 0905 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 0906 evaluated with infinite-precision integer arithmetic. */ 0907 0908 #ifndef YYMAXDEPTH 0909 # define YYMAXDEPTH 10000 0910 #endif 0911 0912 #if YYERROR_VERBOSE 0913 0914 # ifndef yystrlen 0915 # if defined __GLIBC__ && defined _STRING_H 0916 # define yystrlen strlen 0917 # else 0918 /* Return the length of YYSTR. */ 0919 #if (defined __STDC__ || defined __C99__FUNC__ \ 0920 || defined __cplusplus || defined _MSC_VER) 0921 static YYSIZE_T 0922 yystrlen(const char *yystr) 0923 #else 0924 static YYSIZE_T 0925 yystrlen(yystr) 0926 const char *yystr; 0927 #endif 0928 { 0929 YYSIZE_T yylen; 0930 for (yylen = 0; yystr[yylen]; yylen++) { 0931 continue; 0932 } 0933 return yylen; 0934 } 0935 # endif 0936 # endif 0937 0938 # ifndef yystpcpy 0939 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 0940 # define yystpcpy stpcpy 0941 # else 0942 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 0943 YYDEST. */ 0944 #if (defined __STDC__ || defined __C99__FUNC__ \ 0945 || defined __cplusplus || defined _MSC_VER) 0946 static char * 0947 yystpcpy(char *yydest, const char *yysrc) 0948 #else 0949 static char * 0950 yystpcpy(yydest, yysrc) 0951 char *yydest; 0952 const char *yysrc; 0953 #endif 0954 { 0955 char *yyd = yydest; 0956 const char *yys = yysrc; 0957 0958 while ((*yyd++ = *yys++) != '\0') { 0959 continue; 0960 } 0961 0962 return yyd - 1; 0963 } 0964 # endif 0965 # endif 0966 0967 # ifndef yytnamerr 0968 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 0969 quotes and backslashes, so that it's suitable for yyerror. The 0970 heuristic is that double-quoting is unnecessary unless the string 0971 contains an apostrophe, a comma, or backslash (other than 0972 backslash-backslash). YYSTR is taken from yytname. If YYRES is 0973 null, do not copy; instead, return the length of what the result 0974 would have been. */ 0975 static YYSIZE_T 0976 yytnamerr(char *yyres, const char *yystr) 0977 { 0978 if (*yystr == '"') { 0979 YYSIZE_T yyn = 0; 0980 char const *yyp = yystr; 0981 0982 for (;;) 0983 switch (*++yyp) { 0984 case '\'': 0985 case ',': 0986 goto do_not_strip_quotes; 0987 0988 case '\\': 0989 if (*++yyp != '\\') { 0990 goto do_not_strip_quotes; 0991 } 0992 /* Fall through. */ 0993 default: 0994 if (yyres) { 0995 yyres[yyn] = *yyp; 0996 } 0997 yyn++; 0998 break; 0999 1000 case '"': 1001 if (yyres) { 1002 yyres[yyn] = '\0'; 1003 } 1004 return yyn; 1005 } 1006 do_not_strip_quotes:; 1007 } 1008 1009 if (! yyres) { 1010 return yystrlen(yystr); 1011 } 1012 1013 return yystpcpy(yyres, yystr) - yyres; 1014 } 1015 # endif 1016 1017 /* Copy into YYRESULT an error message about the unexpected token 1018 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1019 including the terminating null byte. If YYRESULT is null, do not 1020 copy anything; just return the number of bytes that would be 1021 copied. As a special case, return 0 if an ordinary "syntax error" 1022 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 1023 size calculation. */ 1024 static YYSIZE_T 1025 yysyntax_error(char *yyresult, int yystate, int yychar) 1026 { 1027 int yyn = yypact[yystate]; 1028 1029 if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) { 1030 return 0; 1031 } else { 1032 int yytype = YYTRANSLATE(yychar); 1033 YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]); 1034 YYSIZE_T yysize = yysize0; 1035 YYSIZE_T yysize1; 1036 int yysize_overflow = 0; 1037 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1038 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1039 int yyx; 1040 1041 # if 0 1042 /* This is so xgettext sees the translatable formats that are 1043 constructed on the fly. */ 1044 YY_("syntax error, unexpected %s"); 1045 YY_("syntax error, unexpected %s, expecting %s"); 1046 YY_("syntax error, unexpected %s, expecting %s or %s"); 1047 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1048 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1049 # endif 1050 char *yyfmt; 1051 char const *yyf; 1052 static char const yyunexpected[] = "syntax error, unexpected %s"; 1053 static char const yyexpecting[] = ", expecting %s"; 1054 static char const yyor[] = " or %s"; 1055 char yyformat[sizeof yyunexpected 1056 + sizeof yyexpecting - 1 1057 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1058 * (sizeof yyor - 1))]; 1059 char const *yyprefix = yyexpecting; 1060 1061 /* Start YYX at -YYN if negative to avoid negative indexes in 1062 YYCHECK. */ 1063 int yyxbegin = yyn < 0 ? -yyn : 0; 1064 1065 /* Stay within bounds of both yycheck and yytname. */ 1066 int yychecklim = YYLAST - yyn + 1; 1067 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1068 int yycount = 1; 1069 1070 yyarg[0] = yytname[yytype]; 1071 yyfmt = yystpcpy(yyformat, yyunexpected); 1072 1073 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1074 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { 1075 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { 1076 yycount = 1; 1077 yysize = yysize0; 1078 yyformat[sizeof yyunexpected - 1] = '\0'; 1079 break; 1080 } 1081 yyarg[yycount++] = yytname[yyx]; 1082 yysize1 = yysize + yytnamerr(0, yytname[yyx]); 1083 yysize_overflow |= (yysize1 < yysize); 1084 yysize = yysize1; 1085 yyfmt = yystpcpy(yyfmt, yyprefix); 1086 yyprefix = yyor; 1087 } 1088 1089 yyf = YY_(yyformat); 1090 yysize1 = yysize + yystrlen(yyf); 1091 yysize_overflow |= (yysize1 < yysize); 1092 yysize = yysize1; 1093 1094 if (yysize_overflow) { 1095 return YYSIZE_MAXIMUM; 1096 } 1097 1098 if (yyresult) { 1099 /* Avoid sprintf, as that infringes on the user's name space. 1100 Don't have undefined behavior even if the translation 1101 produced a string with the wrong number of "%s"s. */ 1102 char *yyp = yyresult; 1103 int yyi = 0; 1104 while ((*yyp = *yyf) != '\0') { 1105 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { 1106 yyp += yytnamerr(yyp, yyarg[yyi++]); 1107 yyf += 2; 1108 } else { 1109 yyp++; 1110 yyf++; 1111 } 1112 } 1113 } 1114 return yysize; 1115 } 1116 } 1117 #endif /* YYERROR_VERBOSE */ 1118 1119 /*-----------------------------------------------. 1120 | Release the memory associated to this symbol. | 1121 `-----------------------------------------------*/ 1122 1123 /*ARGSUSED*/ 1124 #if (defined __STDC__ || defined __C99__FUNC__ \ 1125 || defined __cplusplus || defined _MSC_VER) 1126 static void 1127 yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1128 #else 1129 static void 1130 yydestruct(yymsg, yytype, yyvaluep) 1131 const char *yymsg; 1132 int yytype; 1133 YYSTYPE *yyvaluep; 1134 #endif 1135 { 1136 YYUSE(yyvaluep); 1137 1138 if (!yymsg) { 1139 yymsg = "Deleting"; 1140 } 1141 YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp); 1142 1143 switch (yytype) { 1144 1145 default: 1146 break; 1147 } 1148 } 1149 1150 /* Prevent warnings from -Wmissing-prototypes. */ 1151 #ifdef YYPARSE_PARAM 1152 #if defined __STDC__ || defined __cplusplus 1153 int yyparse(void *YYPARSE_PARAM); 1154 #else 1155 int yyparse(); 1156 #endif 1157 #else /* ! YYPARSE_PARAM */ 1158 #if defined __STDC__ || defined __cplusplus 1159 int yyparse(void); 1160 #else 1161 int yyparse(); 1162 #endif 1163 #endif /* ! YYPARSE_PARAM */ 1164 1165 /* The lookahead symbol. */ 1166 int yychar; 1167 1168 /* The semantic value of the lookahead symbol. */ 1169 YYSTYPE yylval; 1170 1171 /* Number of syntax errors so far. */ 1172 int yynerrs; 1173 1174 /*-------------------------. 1175 | yyparse or yypush_parse. | 1176 `-------------------------*/ 1177 1178 #ifdef YYPARSE_PARAM 1179 #if (defined __STDC__ || defined __C99__FUNC__ \ 1180 || defined __cplusplus || defined _MSC_VER) 1181 int 1182 yyparse(void *YYPARSE_PARAM) 1183 #else 1184 int 1185 yyparse(YYPARSE_PARAM) 1186 void *YYPARSE_PARAM; 1187 #endif 1188 #else /* ! YYPARSE_PARAM */ 1189 #if (defined __STDC__ || defined __C99__FUNC__ \ 1190 || defined __cplusplus || defined _MSC_VER) 1191 int 1192 yyparse(void) 1193 #else 1194 int 1195 yyparse() 1196 1197 #endif 1198 #endif 1199 { 1200 1201 int yystate; 1202 /* Number of tokens to shift before error messages enabled. */ 1203 int yyerrstatus; 1204 1205 /* The stacks and their tools: 1206 `yyss': related to states. 1207 `yyvs': related to semantic values. 1208 1209 Refer to the stacks thru separate pointers, to allow yyoverflow 1210 to reallocate them elsewhere. */ 1211 1212 /* The state stack. */ 1213 yytype_int16 yyssa[YYINITDEPTH]; 1214 yytype_int16 *yyss; 1215 yytype_int16 *yyssp; 1216 1217 /* The semantic value stack. */ 1218 YYSTYPE yyvsa[YYINITDEPTH]; 1219 YYSTYPE *yyvs; 1220 YYSTYPE *yyvsp; 1221 1222 YYSIZE_T yystacksize; 1223 1224 int yyn; 1225 int yyresult; 1226 /* Lookahead token as an internal (translated) token number. */ 1227 int yytoken; 1228 /* The variables used to return semantic value and location from the 1229 action routines. */ 1230 YYSTYPE yyval; 1231 1232 #if YYERROR_VERBOSE 1233 /* Buffer for error messages, and its allocated size. */ 1234 char yymsgbuf[128]; 1235 char *yymsg = yymsgbuf; 1236 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1237 #endif 1238 1239 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1240 1241 /* The number of symbols on the RHS of the reduced rule. 1242 Keep to zero when no symbol should be popped. */ 1243 int yylen = 0; 1244 1245 yytoken = 0; 1246 yyss = yyssa; 1247 yyvs = yyvsa; 1248 yystacksize = YYINITDEPTH; 1249 1250 YYDPRINTF((stderr, "Starting parse\n")); 1251 1252 yystate = 0; 1253 yyerrstatus = 0; 1254 yynerrs = 0; 1255 yychar = YYEMPTY; /* Cause a token to be read. */ 1256 1257 /* Initialize stack pointers. 1258 Waste one element of value and location stack 1259 so that they stay on the same level as the state stack. 1260 The wasted elements are never initialized. */ 1261 yyssp = yyss; 1262 yyvsp = yyvs; 1263 1264 goto yysetstate; 1265 1266 /*------------------------------------------------------------. 1267 | yynewstate -- Push a new state, which is found in yystate. | 1268 `------------------------------------------------------------*/ 1269 yynewstate: 1270 /* In all cases, when you get here, the value and location stacks 1271 have just been pushed. So pushing a state here evens the stacks. */ 1272 yyssp++; 1273 1274 yysetstate: 1275 *yyssp = yystate; 1276 1277 if (yyss + yystacksize - 1 <= yyssp) { 1278 /* Get the current used size of the three stacks, in elements. */ 1279 YYSIZE_T yysize = yyssp - yyss + 1; 1280 1281 #ifdef yyoverflow 1282 { 1283 /* Give user a chance to reallocate the stack. Use copies of 1284 these so that the &'s don't force the real ones into 1285 memory. */ 1286 YYSTYPE *yyvs1 = yyvs; 1287 yytype_int16 *yyss1 = yyss; 1288 1289 /* Each stack pointer address is followed by the size of the 1290 data in use in that stack, in bytes. This used to be a 1291 conditional around just the two extra args, but that might 1292 be undefined if yyoverflow is a macro. */ 1293 yyoverflow(YY_("memory exhausted"), 1294 &yyss1, yysize * sizeof(*yyssp), 1295 &yyvs1, yysize * sizeof(*yyvsp), 1296 &yystacksize); 1297 1298 yyss = yyss1; 1299 yyvs = yyvs1; 1300 } 1301 #else /* no yyoverflow */ 1302 # ifndef YYSTACK_RELOCATE 1303 goto yyexhaustedlab; 1304 # else 1305 /* Extend the stack our own way. */ 1306 if (YYMAXDEPTH <= yystacksize) { 1307 goto yyexhaustedlab; 1308 } 1309 yystacksize *= 2; 1310 if (YYMAXDEPTH < yystacksize) { 1311 yystacksize = YYMAXDEPTH; 1312 } 1313 1314 { 1315 yytype_int16 *yyss1 = yyss; 1316 union yyalloc *yyptr = 1317 (union yyalloc *) YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); 1318 if (! yyptr) { 1319 goto yyexhaustedlab; 1320 } 1321 YYSTACK_RELOCATE(yyss_alloc, yyss); 1322 YYSTACK_RELOCATE(yyvs_alloc, yyvs); 1323 # undef YYSTACK_RELOCATE 1324 if (yyss1 != yyssa) { 1325 YYSTACK_FREE(yyss1); 1326 } 1327 } 1328 # endif 1329 #endif /* no yyoverflow */ 1330 1331 yyssp = yyss + yysize - 1; 1332 yyvsp = yyvs + yysize - 1; 1333 1334 YYDPRINTF((stderr, "Stack size increased to %lu\n", 1335 (unsigned long int) yystacksize)); 1336 1337 if (yyss + yystacksize - 1 <= yyssp) { 1338 YYABORT; 1339 } 1340 } 1341 1342 YYDPRINTF((stderr, "Entering state %d\n", yystate)); 1343 1344 if (yystate == YYFINAL) { 1345 YYACCEPT; 1346 } 1347 1348 goto yybackup; 1349 1350 /*-----------. 1351 | yybackup. | 1352 `-----------*/ 1353 yybackup: 1354 1355 /* Do appropriate processing given the current state. Read a 1356 lookahead token if we need one and don't already have one. */ 1357 1358 /* First try to decide what to do without reference to lookahead token. */ 1359 yyn = yypact[yystate]; 1360 if (yyn == YYPACT_NINF) { 1361 goto yydefault; 1362 } 1363 1364 /* Not known => get a lookahead token if don't already have one. */ 1365 1366 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1367 if (yychar == YYEMPTY) { 1368 YYDPRINTF((stderr, "Reading a token: ")); 1369 yychar = YYLEX; 1370 } 1371 1372 if (yychar <= YYEOF) { 1373 yychar = yytoken = YYEOF; 1374 YYDPRINTF((stderr, "Now at end of input.\n")); 1375 } else { 1376 yytoken = YYTRANSLATE(yychar); 1377 YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); 1378 } 1379 1380 /* If the proper action on seeing token YYTOKEN is to reduce or to 1381 detect an error, take that action. */ 1382 yyn += yytoken; 1383 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) { 1384 goto yydefault; 1385 } 1386 yyn = yytable[yyn]; 1387 if (yyn <= 0) { 1388 if (yyn == 0 || yyn == YYTABLE_NINF) { 1389 goto yyerrlab; 1390 } 1391 yyn = -yyn; 1392 goto yyreduce; 1393 } 1394 1395 /* Count tokens shifted since error; after three, turn off error 1396 status. */ 1397 if (yyerrstatus) { 1398 yyerrstatus--; 1399 } 1400 1401 /* Shift the lookahead token. */ 1402 YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); 1403 1404 /* Discard the shifted token. */ 1405 yychar = YYEMPTY; 1406 1407 yystate = yyn; 1408 *++yyvsp = yylval; 1409 1410 goto yynewstate; 1411 1412 /*-----------------------------------------------------------. 1413 | yydefault -- do the default action for the current state. | 1414 `-----------------------------------------------------------*/ 1415 yydefault: 1416 yyn = yydefact[yystate]; 1417 if (yyn == 0) { 1418 goto yyerrlab; 1419 } 1420 goto yyreduce; 1421 1422 /*-----------------------------. 1423 | yyreduce -- Do a reduction. | 1424 `-----------------------------*/ 1425 yyreduce: 1426 /* yyn is the number of a rule to reduce with. */ 1427 yylen = yyr2[yyn]; 1428 1429 /* If YYLEN is nonzero, implement the default value of the action: 1430 `$$ = $1'. 1431 1432 Otherwise, the following line sets YYVAL to garbage. 1433 This behavior is undocumented and Bison 1434 users should not rely upon it. Assigning to YYVAL 1435 unconditionally makes the parser a bit smaller, and it avoids a 1436 GCC warning that YYVAL may be used uninitialized. */ 1437 yyval = yyvsp[1 - yylen]; 1438 1439 YY_REDUCE_PRINT(yyn); 1440 switch (yyn) { 1441 case 2: 1442 1443 /* Line 1464 of yacc.c */ 1444 #line 94 "parser.y" 1445 { 1446 _topExpr = (yyvsp[(1) - (1)].expr); 1447 ; 1448 } 1449 break; 1450 1451 case 3: 1452 1453 /* Line 1464 of yacc.c */ 1454 #line 101 "parser.y" 1455 { 1456 (yyval.locationPath)->m_absolute = false; 1457 ; 1458 } 1459 break; 1460 1461 case 4: 1462 1463 /* Line 1464 of yacc.c */ 1464 #line 106 "parser.y" 1465 { 1466 (yyval.locationPath)->m_absolute = true; 1467 ; 1468 } 1469 break; 1470 1471 case 5: 1472 1473 /* Line 1464 of yacc.c */ 1474 #line 113 "parser.y" 1475 { 1476 (yyval.locationPath) = new LocationPath; 1477 ; 1478 } 1479 break; 1480 1481 case 6: 1482 1483 /* Line 1464 of yacc.c */ 1484 #line 118 "parser.y" 1485 { 1486 (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); 1487 ; 1488 } 1489 break; 1490 1491 case 7: 1492 1493 /* Line 1464 of yacc.c */ 1494 #line 123 "parser.y" 1495 { 1496 (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); 1497 (yyval.locationPath)->m_steps.prepend((yyvsp[(1) - (2)].step)); 1498 ; 1499 } 1500 break; 1501 1502 case 8: 1503 1504 /* Line 1464 of yacc.c */ 1505 #line 131 "parser.y" 1506 { 1507 (yyval.locationPath) = new LocationPath; 1508 (yyval.locationPath)->m_steps.append((yyvsp[(1) - (1)].step)); 1509 ; 1510 } 1511 break; 1512 1513 case 9: 1514 1515 /* Line 1464 of yacc.c */ 1516 #line 137 "parser.y" 1517 { 1518 (yyval.locationPath)->m_steps.append((yyvsp[(3) - (3)].step)); 1519 ; 1520 } 1521 break; 1522 1523 case 10: 1524 1525 /* Line 1464 of yacc.c */ 1526 #line 142 "parser.y" 1527 { 1528 (yyval.locationPath)->m_steps.append((yyvsp[(2) - (3)].step)); 1529 (yyval.locationPath)->m_steps.append((yyvsp[(3) - (3)].step)); 1530 ; 1531 } 1532 break; 1533 1534 case 11: 1535 1536 /* Line 1464 of yacc.c */ 1537 #line 150 "parser.y" 1538 { 1539 (yyval.step) = new Step(Step::ChildAxis, *(yyvsp[(1) - (1)].str)); 1540 delete(yyvsp[(1) - (1)].str); 1541 ; 1542 } 1543 break; 1544 1545 case 12: 1546 1547 /* Line 1464 of yacc.c */ 1548 #line 156 "parser.y" 1549 { 1550 (yyval.step) = new Step(Step::ChildAxis, *(yyvsp[(1) - (2)].str), *(yyvsp[(2) - (2)].predList)); 1551 delete(yyvsp[(1) - (2)].str); 1552 delete(yyvsp[(2) - (2)].predList); 1553 ; 1554 } 1555 break; 1556 1557 case 13: 1558 1559 /* Line 1464 of yacc.c */ 1560 #line 163 "parser.y" 1561 { 1562 (yyval.step) = new Step((yyvsp[(1) - (2)].axisType), *(yyvsp[(2) - (2)].str)); 1563 delete(yyvsp[(2) - (2)].str); 1564 ; 1565 } 1566 break; 1567 1568 case 14: 1569 1570 /* Line 1464 of yacc.c */ 1571 #line 169 "parser.y" 1572 { 1573 (yyval.step) = new Step((yyvsp[(1) - (3)].axisType), *(yyvsp[(2) - (3)].str), *(yyvsp[(3) - (3)].predList)); 1574 delete(yyvsp[(2) - (3)].str); 1575 delete(yyvsp[(3) - (3)].predList); 1576 ; 1577 } 1578 break; 1579 1580 case 17: 1581 1582 /* Line 1464 of yacc.c */ 1583 #line 182 "parser.y" 1584 { 1585 (yyval.axisType) = Step::AttributeAxis; 1586 ; 1587 } 1588 break; 1589 1590 case 18: 1591 1592 /* Line 1464 of yacc.c */ 1593 #line 189 "parser.y" 1594 { 1595 const int colon = (yyvsp[(1) - (1)].str)->find(':'); 1596 if (colon > -1) { 1597 DOMString prefix((yyvsp[(1) - (1)].str)->substring(0, colon)); 1598 XPathNSResolverImpl *resolver = Expression::evaluationContext().resolver; 1599 if (!resolver || resolver->lookupNamespaceURI(prefix).isNull()) { 1600 qCWarning(KHTML_LOG) << "Found unknown namespace prefix " << prefix.string(); 1601 xpathParseException = DOMException::NAMESPACE_ERR; 1602 YYABORT; 1603 } 1604 } 1605 ; 1606 } 1607 break; 1608 1609 case 19: 1610 1611 /* Line 1464 of yacc.c */ 1612 #line 203 "parser.y" 1613 { 1614 (yyval.str) = new DOMString(*(yyvsp[(1) - (3)].str) + DOMString("()")); 1615 ; 1616 } 1617 break; 1618 1619 case 21: 1620 1621 /* Line 1464 of yacc.c */ 1622 #line 210 "parser.y" 1623 { 1624 QString s = (yyvsp[(1) - (4)].str)->string() + QLatin1Char(' ') + (yyvsp[(3) - (4)].str)->string(); 1625 s = s.trimmed(); 1626 (yyval.str) = new DOMString(s); 1627 delete(yyvsp[(1) - (4)].str); 1628 delete(yyvsp[(3) - (4)].str); 1629 ; 1630 } 1631 break; 1632 1633 case 22: 1634 1635 /* Line 1464 of yacc.c */ 1636 #line 221 "parser.y" 1637 { 1638 (yyval.predList) = new QList<Predicate *>; 1639 (yyval.predList)->append(new Predicate((yyvsp[(1) - (1)].expr))); 1640 ; 1641 } 1642 break; 1643 1644 case 23: 1645 1646 /* Line 1464 of yacc.c */ 1647 #line 227 "parser.y" 1648 { 1649 (yyval.predList)->append(new Predicate((yyvsp[(2) - (2)].expr))); 1650 ; 1651 } 1652 break; 1653 1654 case 24: 1655 1656 /* Line 1464 of yacc.c */ 1657 #line 234 "parser.y" 1658 { 1659 (yyval.expr) = (yyvsp[(2) - (3)].expr); 1660 ; 1661 } 1662 break; 1663 1664 case 25: 1665 1666 /* Line 1464 of yacc.c */ 1667 #line 241 "parser.y" 1668 { 1669 (yyval.step) = new Step(Step::DescendantOrSelfAxis, "node()"); 1670 ; 1671 } 1672 break; 1673 1674 case 26: 1675 1676 /* Line 1464 of yacc.c */ 1677 #line 248 "parser.y" 1678 { 1679 (yyval.step) = new Step(Step::SelfAxis, "node()"); 1680 ; 1681 } 1682 break; 1683 1684 case 27: 1685 1686 /* Line 1464 of yacc.c */ 1687 #line 253 "parser.y" 1688 { 1689 (yyval.step) = new Step(Step::ParentAxis, "node()"); 1690 ; 1691 } 1692 break; 1693 1694 case 28: 1695 1696 /* Line 1464 of yacc.c */ 1697 #line 260 "parser.y" 1698 { 1699 (yyval.expr) = new VariableReference(*(yyvsp[(1) - (1)].str)); 1700 delete(yyvsp[(1) - (1)].str); 1701 ; 1702 } 1703 break; 1704 1705 case 29: 1706 1707 /* Line 1464 of yacc.c */ 1708 #line 266 "parser.y" 1709 { 1710 (yyval.expr) = (yyvsp[(2) - (3)].expr); 1711 ; 1712 } 1713 break; 1714 1715 case 30: 1716 1717 /* Line 1464 of yacc.c */ 1718 #line 271 "parser.y" 1719 { 1720 (yyval.expr) = new String(*(yyvsp[(1) - (1)].str)); 1721 delete(yyvsp[(1) - (1)].str); 1722 ; 1723 } 1724 break; 1725 1726 case 31: 1727 1728 /* Line 1464 of yacc.c */ 1729 #line 277 "parser.y" 1730 { 1731 (yyval.expr) = new Number((yyvsp[(1) - (1)].str)->toFloat()); 1732 delete(yyvsp[(1) - (1)].str); 1733 ; 1734 } 1735 break; 1736 1737 case 33: 1738 1739 /* Line 1464 of yacc.c */ 1740 #line 287 "parser.y" 1741 { 1742 Function *f = FunctionLibrary::self().getFunction(*(yyvsp[(1) - (3)].str)); 1743 delete(yyvsp[(1) - (3)].str); 1744 if (!f) { 1745 xpathParseException = XPathException::toCode(INVALID_EXPRESSION_ERR); 1746 YYABORT; 1747 } 1748 1749 (yyval.expr) = f; 1750 ; 1751 } 1752 break; 1753 1754 case 34: 1755 1756 /* Line 1464 of yacc.c */ 1757 #line 299 "parser.y" 1758 { 1759 Function *f = FunctionLibrary::self().getFunction(*(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].argList)); 1760 delete(yyvsp[(1) - (4)].str); 1761 delete(yyvsp[(3) - (4)].argList); 1762 if (!f) { 1763 xpathParseException = XPathException::toCode(INVALID_EXPRESSION_ERR); 1764 YYABORT; 1765 } 1766 (yyval.expr) = f; 1767 ; 1768 } 1769 break; 1770 1771 case 35: 1772 1773 /* Line 1464 of yacc.c */ 1774 #line 313 "parser.y" 1775 { 1776 (yyval.argList) = new QList<Expression *>; 1777 (yyval.argList)->append((yyvsp[(1) - (1)].expr)); 1778 ; 1779 } 1780 break; 1781 1782 case 36: 1783 1784 /* Line 1464 of yacc.c */ 1785 #line 319 "parser.y" 1786 { 1787 (yyval.argList)->append((yyvsp[(3) - (3)].expr)); 1788 ; 1789 } 1790 break; 1791 1792 case 39: 1793 1794 /* Line 1464 of yacc.c */ 1795 #line 333 "parser.y" 1796 { 1797 (yyval.expr) = new Union; 1798 (yyval.expr)->addSubExpression((yyvsp[(1) - (3)].expr)); 1799 (yyval.expr)->addSubExpression((yyvsp[(3) - (3)].expr)); 1800 ; 1801 } 1802 break; 1803 1804 case 40: 1805 1806 /* Line 1464 of yacc.c */ 1807 #line 342 "parser.y" 1808 { 1809 (yyval.expr) = (yyvsp[(1) - (1)].locationPath); 1810 ; 1811 } 1812 break; 1813 1814 case 41: 1815 1816 /* Line 1464 of yacc.c */ 1817 #line 347 "parser.y" 1818 { 1819 (yyval.expr) = (yyvsp[(1) - (1)].expr); 1820 ; 1821 } 1822 break; 1823 1824 case 42: 1825 1826 /* Line 1464 of yacc.c */ 1827 #line 352 "parser.y" 1828 { 1829 (yyval.expr) = new Path(static_cast<Filter *>((yyvsp[(1) - (3)].expr)), (yyvsp[(3) - (3)].locationPath)); 1830 ; 1831 } 1832 break; 1833 1834 case 43: 1835 1836 /* Line 1464 of yacc.c */ 1837 #line 357 "parser.y" 1838 { 1839 (yyvsp[(3) - (3)].locationPath)->m_steps.prepend((yyvsp[(2) - (3)].step)); 1840 (yyval.expr) = new Path(static_cast<Filter *>((yyvsp[(1) - (3)].expr)), (yyvsp[(3) - (3)].locationPath)); 1841 ; 1842 } 1843 break; 1844 1845 case 44: 1846 1847 /* Line 1464 of yacc.c */ 1848 #line 365 "parser.y" 1849 { 1850 (yyval.expr) = (yyvsp[(1) - (1)].expr); 1851 ; 1852 } 1853 break; 1854 1855 case 45: 1856 1857 /* Line 1464 of yacc.c */ 1858 #line 370 "parser.y" 1859 { 1860 (yyval.expr) = new Filter((yyvsp[(1) - (2)].expr), *(yyvsp[(2) - (2)].predList)); 1861 ; 1862 } 1863 break; 1864 1865 case 47: 1866 1867 /* Line 1464 of yacc.c */ 1868 #line 379 "parser.y" 1869 { 1870 (yyval.expr) = new LogicalOp(LogicalOp::OP_Or, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1871 ; 1872 } 1873 break; 1874 1875 case 49: 1876 1877 /* Line 1464 of yacc.c */ 1878 #line 388 "parser.y" 1879 { 1880 (yyval.expr) = new LogicalOp(LogicalOp::OP_And, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1881 ; 1882 } 1883 break; 1884 1885 case 51: 1886 1887 /* Line 1464 of yacc.c */ 1888 #line 397 "parser.y" 1889 { 1890 (yyval.expr) = new RelationOp((yyvsp[(2) - (3)].num), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1891 ; 1892 } 1893 break; 1894 1895 case 53: 1896 1897 /* Line 1464 of yacc.c */ 1898 #line 406 "parser.y" 1899 { 1900 (yyval.expr) = new RelationOp((yyvsp[(2) - (3)].num), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1901 ; 1902 } 1903 break; 1904 1905 case 55: 1906 1907 /* Line 1464 of yacc.c */ 1908 #line 415 "parser.y" 1909 { 1910 (yyval.expr) = new NumericOp(NumericOp::OP_Add, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1911 ; 1912 } 1913 break; 1914 1915 case 56: 1916 1917 /* Line 1464 of yacc.c */ 1918 #line 420 "parser.y" 1919 { 1920 (yyval.expr) = new NumericOp(NumericOp::OP_Sub, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1921 ; 1922 } 1923 break; 1924 1925 case 58: 1926 1927 /* Line 1464 of yacc.c */ 1928 #line 429 "parser.y" 1929 { 1930 (yyval.expr) = new NumericOp((yyvsp[(2) - (3)].num), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); 1931 ; 1932 } 1933 break; 1934 1935 case 60: 1936 1937 /* Line 1464 of yacc.c */ 1938 #line 438 "parser.y" 1939 { 1940 (yyval.expr) = new Negative; 1941 (yyval.expr)->addSubExpression((yyvsp[(2) - (2)].expr)); 1942 ; 1943 } 1944 break; 1945 1946 /* Line 1464 of yacc.c */ 1947 #line 1953 "parser.tab.c" 1948 default: break; 1949 } 1950 YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1951 1952 YYPOPSTACK(yylen); 1953 yylen = 0; 1954 YY_STACK_PRINT(yyss, yyssp); 1955 1956 *++yyvsp = yyval; 1957 1958 /* Now `shift' the result of the reduction. Determine what state 1959 that goes to, based on the state we popped back to and the rule 1960 number reduced by. */ 1961 1962 yyn = yyr1[yyn]; 1963 1964 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1965 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) { 1966 yystate = yytable[yystate]; 1967 } else { 1968 yystate = yydefgoto[yyn - YYNTOKENS]; 1969 } 1970 1971 goto yynewstate; 1972 1973 /*------------------------------------. 1974 | yyerrlab -- here on detecting error | 1975 `------------------------------------*/ 1976 yyerrlab: 1977 /* If not already recovering from an error, report this error. */ 1978 if (!yyerrstatus) { 1979 ++yynerrs; 1980 #if ! YYERROR_VERBOSE 1981 yyerror(YY_("syntax error")); 1982 #else 1983 { 1984 YYSIZE_T yysize = yysyntax_error(0, yystate, yychar); 1985 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { 1986 YYSIZE_T yyalloc = 2 * yysize; 1987 if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) { 1988 yyalloc = YYSTACK_ALLOC_MAXIMUM; 1989 } 1990 if (yymsg != yymsgbuf) { 1991 YYSTACK_FREE(yymsg); 1992 } 1993 yymsg = (char *) YYSTACK_ALLOC(yyalloc); 1994 if (yymsg) { 1995 yymsg_alloc = yyalloc; 1996 } else { 1997 yymsg = yymsgbuf; 1998 yymsg_alloc = sizeof yymsgbuf; 1999 } 2000 } 2001 2002 if (0 < yysize && yysize <= yymsg_alloc) { 2003 (void) yysyntax_error(yymsg, yystate, yychar); 2004 yyerror(yymsg); 2005 } else { 2006 yyerror(YY_("syntax error")); 2007 if (yysize != 0) { 2008 goto yyexhaustedlab; 2009 } 2010 } 2011 } 2012 #endif 2013 } 2014 2015 if (yyerrstatus == 3) { 2016 /* If just tried and failed to reuse lookahead token after an 2017 error, discard it. */ 2018 2019 if (yychar <= YYEOF) { 2020 /* Return failure if at end of input. */ 2021 if (yychar == YYEOF) { 2022 YYABORT; 2023 } 2024 } else { 2025 yydestruct("Error: discarding", 2026 yytoken, &yylval); 2027 yychar = YYEMPTY; 2028 } 2029 } 2030 2031 /* Else will try to reuse lookahead token after shifting the error 2032 token. */ 2033 goto yyerrlab1; 2034 2035 /*---------------------------------------------------. 2036 | yyerrorlab -- error raised explicitly by YYERROR. | 2037 `---------------------------------------------------*/ 2038 yyerrorlab: 2039 2040 /* Pacify compilers like GCC when the user code never invokes 2041 YYERROR and the label yyerrorlab therefore never appears in user 2042 code. */ 2043 if (/*CONSTCOND*/ 0) { 2044 goto yyerrorlab; 2045 } 2046 2047 /* Do not reclaim the symbols of the rule which action triggered 2048 this YYERROR. */ 2049 YYPOPSTACK(yylen); 2050 yylen = 0; 2051 YY_STACK_PRINT(yyss, yyssp); 2052 yystate = *yyssp; 2053 goto yyerrlab1; 2054 2055 /*-------------------------------------------------------------. 2056 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2057 `-------------------------------------------------------------*/ 2058 yyerrlab1: 2059 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2060 2061 for (;;) { 2062 yyn = yypact[yystate]; 2063 if (yyn != YYPACT_NINF) { 2064 yyn += YYTERROR; 2065 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { 2066 yyn = yytable[yyn]; 2067 if (0 < yyn) { 2068 break; 2069 } 2070 } 2071 } 2072 2073 /* Pop the current state because it cannot handle the error token. */ 2074 if (yyssp == yyss) { 2075 YYABORT; 2076 } 2077 2078 yydestruct("Error: popping", 2079 yystos[yystate], yyvsp); 2080 YYPOPSTACK(1); 2081 yystate = *yyssp; 2082 YY_STACK_PRINT(yyss, yyssp); 2083 } 2084 2085 *++yyvsp = yylval; 2086 2087 /* Shift the error token. */ 2088 YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); 2089 2090 yystate = yyn; 2091 goto yynewstate; 2092 2093 /*-------------------------------------. 2094 | yyacceptlab -- YYACCEPT comes here. | 2095 `-------------------------------------*/ 2096 yyacceptlab: 2097 yyresult = 0; 2098 goto yyreturn; 2099 2100 /*-----------------------------------. 2101 | yyabortlab -- YYABORT comes here. | 2102 `-----------------------------------*/ 2103 yyabortlab: 2104 yyresult = 1; 2105 goto yyreturn; 2106 2107 #if !defined(yyoverflow) || YYERROR_VERBOSE 2108 /*-------------------------------------------------. 2109 | yyexhaustedlab -- memory exhaustion comes here. | 2110 `-------------------------------------------------*/ 2111 yyexhaustedlab: 2112 yyerror(YY_("memory exhausted")); 2113 yyresult = 2; 2114 /* Fall through. */ 2115 #endif 2116 2117 yyreturn: 2118 if (yychar != YYEMPTY) 2119 yydestruct("Cleanup: discarding lookahead", 2120 yytoken, &yylval); 2121 /* Do not reclaim the symbols of the rule which action triggered 2122 this YYABORT or YYACCEPT. */ 2123 YYPOPSTACK(yylen); 2124 YY_STACK_PRINT(yyss, yyssp); 2125 while (yyssp != yyss) { 2126 yydestruct("Cleanup: popping", 2127 yystos[*yyssp], yyvsp); 2128 YYPOPSTACK(1); 2129 } 2130 #ifndef yyoverflow 2131 if (yyss != yyssa) { 2132 YYSTACK_FREE(yyss); 2133 } 2134 #endif 2135 #if YYERROR_VERBOSE 2136 if (yymsg != yymsgbuf) { 2137 YYSTACK_FREE(yymsg); 2138 } 2139 #endif 2140 /* Make sure YYID is used. */ 2141 return YYID(yyresult); 2142 } 2143 2144 /* Line 1684 of yacc.c */ 2145 #line 444 "parser.y" 2146 2147 namespace khtml 2148 { 2149 namespace XPath 2150 { 2151 2152 Expression *khtmlParseXPathStatement(const DOM::DOMString &statement, int &ec) 2153 { 2154 // qCDebug(KHTML_LOG) << "Parsing " << statement; 2155 xpathParseException = 0; 2156 _topExpr = nullptr; 2157 initTokenizer(statement); 2158 yyparse(); 2159 2160 if (xpathParseException) { 2161 ec = xpathParseException; 2162 } 2163 return _topExpr; 2164 } 2165 2166 void khtmlxpathyyerror(const char *str) 2167 { 2168 // XXX Clean xpathyylval.str up to avoid leaking it. 2169 fprintf(stderr, "error: %s\n", str); 2170 xpathParseException = XPathException::toCode(INVALID_EXPRESSION_ERR); 2171 } 2172 2173 } // namespace XPath 2174 } // namespace khtml 2175