KHTML
parser.cpp
Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.4.2. */ 00002 00003 /* Skeleton implementation for Bison's Yacc-like parsers in C 00004 00005 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software 00006 Foundation, Inc. 00007 00008 This program is free software: you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation, either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00020 00021 /* As a special exception, you may create a larger work that contains 00022 part or all of the Bison parser skeleton and distribute that work 00023 under terms of your choice, so long as that work isn't itself a 00024 parser generator using the skeleton or a modified version thereof 00025 as a parser skeleton. Alternatively, if you modify or redistribute 00026 the parser skeleton itself, you may (at your option) remove this 00027 special exception, which will cause the skeleton and the resulting 00028 Bison output files to be licensed under the GNU General Public 00029 License without this special exception. 00030 00031 This special exception was added by the Free Software Foundation in 00032 version 2.2 of Bison. */ 00033 00034 /* C LALR(1) parser skeleton written by Richard Stallman, by 00035 simplifying the original so-called "semantic" parser. */ 00036 00037 /* All symbols defined below should begin with yy or YY, to avoid 00038 infringing on user name space. This should be done even for local 00039 variables, as they might otherwise be expanded by user macros. 00040 There are some unavoidable exceptions within include files to 00041 define necessary library symbols; they are noted "INFRINGES ON 00042 USER NAME SPACE" below. */ 00043 00044 /* Identify Bison output. */ 00045 #define YYBISON 1 00046 00047 /* Bison version. */ 00048 #define YYBISON_VERSION "2.4.2" 00049 00050 /* Skeleton name. */ 00051 #define YYSKELETON_NAME "yacc.c" 00052 00053 /* Pure parsers. */ 00054 #define YYPURE 0 00055 00056 /* Push parsers. */ 00057 #define YYPUSH 0 00058 00059 /* Pull parsers. */ 00060 #define YYPULL 1 00061 00062 /* Using locations. */ 00063 #define YYLSP_NEEDED 0 00064 00065 /* Substitute the variable and function names. */ 00066 #define yyparse khtmlxpathyyparse 00067 #define yylex khtmlxpathyylex 00068 #define yyerror khtmlxpathyyerror 00069 #define yylval khtmlxpathyylval 00070 #define yychar khtmlxpathyychar 00071 #define yydebug khtmlxpathyydebug 00072 #define yynerrs khtmlxpathyynerrs 00073 00074 00075 /* Copy the first part of user declarations. */ 00076 00077 /* Line 189 of yacc.c */ 00078 #line 1 "parser.y" 00079 00080 #include "functions.h" 00081 #include "path.h" 00082 #include "predicate.h" 00083 #include "util.h" 00084 #include "tokenizer.h" 00085 00086 #include "expression.h" 00087 #include "util.h" 00088 #include "variablereference.h" 00089 00090 #include "dom/dom_string.h" 00091 #include "dom/dom_exception.h" 00092 #include "dom/dom3_xpath.h" 00093 #include "xml/dom_stringimpl.h" 00094 #include "xml/dom3_xpathimpl.h" 00095 00096 using namespace DOM; 00097 using namespace DOM::XPath; 00098 using namespace khtml; 00099 using namespace khtml::XPath; 00100 00101 00102 00103 #include <QList> 00104 #include <QPair> 00105 #include <QtDebug> 00106 00107 #define YYDEBUG 1 00108 00109 Expression * khtmlParseXPathStatement( const DOM::DOMString &statement, int& ec ); 00110 00111 static Expression *_topExpr; 00112 static int xpathParseException; 00113 00114 00115 00116 /* Line 189 of yacc.c */ 00117 #line 118 "parser.tab.c" 00118 00119 /* Enabling traces. */ 00120 #ifndef YYDEBUG 00121 # define YYDEBUG 0 00122 #endif 00123 00124 /* Enabling verbose error messages. */ 00125 #ifdef YYERROR_VERBOSE 00126 # undef YYERROR_VERBOSE 00127 # define YYERROR_VERBOSE 1 00128 #else 00129 # define YYERROR_VERBOSE 0 00130 #endif 00131 00132 /* Enabling the token table. */ 00133 #ifndef YYTOKEN_TABLE 00134 # define YYTOKEN_TABLE 0 00135 #endif 00136 00137 00138 /* Tokens. */ 00139 #ifndef YYTOKENTYPE 00140 # define YYTOKENTYPE 00141 /* Put the tokens into the symbol table, so that GDB and other debuggers 00142 know about them. */ 00143 enum yytokentype { 00144 EQOP = 258, 00145 RELOP = 259, 00146 MULOP = 260, 00147 MINUS = 261, 00148 PLUS = 262, 00149 AND = 263, 00150 OR = 264, 00151 AXISNAME = 265, 00152 NODETYPE = 266, 00153 PI = 267, 00154 FUNCTIONNAME = 268, 00155 LITERAL = 269, 00156 VARIABLEREFERENCE = 270, 00157 NUMBER = 271, 00158 DOTDOT = 272, 00159 SLASHSLASH = 273, 00160 NAMETEST = 274, 00161 ERROR = 275 00162 }; 00163 #endif 00164 00165 00166 00167 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00168 typedef union YYSTYPE 00169 { 00170 00171 /* Line 214 of yacc.c */ 00172 #line 39 "parser.y" 00173 00174 khtml::XPath::Step::AxisType axisType; 00175 int num; 00176 DOM::DOMString *str; // we use this and not DOMStringImpl*, so the 00177 // memory management for this is entirely manual, 00178 // and not an RC/manual hybrid 00179 khtml::XPath::Expression *expr; 00180 QList<khtml::XPath::Predicate *> *predList; 00181 QList<khtml::XPath::Expression *> *argList; 00182 khtml::XPath::Step *step; 00183 khtml::XPath::LocationPath *locationPath; 00184 00185 00186 00187 /* Line 214 of yacc.c */ 00188 #line 189 "parser.tab.c" 00189 } YYSTYPE; 00190 # define YYSTYPE_IS_TRIVIAL 1 00191 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00192 # define YYSTYPE_IS_DECLARED 1 00193 #endif 00194 00195 00196 /* Copy the second part of user declarations. */ 00197 00198 /* Line 264 of yacc.c */ 00199 #line 52 "parser.y" 00200 00201 00202 00203 /* Line 264 of yacc.c */ 00204 #line 205 "parser.tab.c" 00205 00206 #ifdef short 00207 # undef short 00208 #endif 00209 00210 #ifdef YYTYPE_UINT8 00211 typedef YYTYPE_UINT8 yytype_uint8; 00212 #else 00213 typedef unsigned char yytype_uint8; 00214 #endif 00215 00216 #ifdef YYTYPE_INT8 00217 typedef YYTYPE_INT8 yytype_int8; 00218 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00219 || defined __cplusplus || defined _MSC_VER) 00220 typedef signed char yytype_int8; 00221 #else 00222 typedef short int yytype_int8; 00223 #endif 00224 00225 #ifdef YYTYPE_UINT16 00226 typedef YYTYPE_UINT16 yytype_uint16; 00227 #else 00228 typedef unsigned short int yytype_uint16; 00229 #endif 00230 00231 #ifdef YYTYPE_INT16 00232 typedef YYTYPE_INT16 yytype_int16; 00233 #else 00234 typedef short int yytype_int16; 00235 #endif 00236 00237 #ifndef YYSIZE_T 00238 # ifdef __SIZE_TYPE__ 00239 # define YYSIZE_T __SIZE_TYPE__ 00240 # elif defined size_t 00241 # define YYSIZE_T size_t 00242 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00243 || defined __cplusplus || defined _MSC_VER) 00244 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00245 # define YYSIZE_T size_t 00246 # else 00247 # define YYSIZE_T unsigned int 00248 # endif 00249 #endif 00250 00251 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00252 00253 #ifndef YY_ 00254 # if defined YYENABLE_NLS && YYENABLE_NLS 00255 # if ENABLE_NLS 00256 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00257 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00258 # endif 00259 # endif 00260 # ifndef YY_ 00261 # define YY_(msgid) msgid 00262 # endif 00263 #endif 00264 00265 /* Suppress unused-variable warnings by "using" E. */ 00266 #if ! defined lint || defined __GNUC__ 00267 # define YYUSE(e) ((void) (e)) 00268 #else 00269 # define YYUSE(e) /* empty */ 00270 #endif 00271 00272 /* Identity function, used to suppress warnings about constant conditions. */ 00273 #ifndef lint 00274 # define YYID(n) (n) 00275 #else 00276 #if (defined __STDC__ || defined __C99__FUNC__ \ 00277 || defined __cplusplus || defined _MSC_VER) 00278 static int 00279 YYID (int yyi) 00280 #else 00281 static int 00282 YYID (yyi) 00283 int yyi; 00284 #endif 00285 { 00286 return yyi; 00287 } 00288 #endif 00289 00290 #if ! defined yyoverflow || YYERROR_VERBOSE 00291 00292 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00293 00294 # ifdef YYSTACK_USE_ALLOCA 00295 # if YYSTACK_USE_ALLOCA 00296 # ifdef __GNUC__ 00297 # define YYSTACK_ALLOC __builtin_alloca 00298 # elif defined __BUILTIN_VA_ARG_INCR 00299 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00300 # elif defined _AIX 00301 # define YYSTACK_ALLOC __alloca 00302 # elif defined _MSC_VER 00303 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00304 # define alloca _alloca 00305 # else 00306 # define YYSTACK_ALLOC alloca 00307 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00308 || defined __cplusplus || defined _MSC_VER) 00309 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00310 # ifndef _STDLIB_H 00311 # define _STDLIB_H 1 00312 # endif 00313 # endif 00314 # endif 00315 # endif 00316 # endif 00317 00318 # ifdef YYSTACK_ALLOC 00319 /* Pacify GCC's `empty if-body' warning. */ 00320 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00321 # ifndef YYSTACK_ALLOC_MAXIMUM 00322 /* The OS might guarantee only one guard page at the bottom of the stack, 00323 and a page size can be as small as 4096 bytes. So we cannot safely 00324 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00325 to allow for a few compiler-allocated temporary stack slots. */ 00326 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00327 # endif 00328 # else 00329 # define YYSTACK_ALLOC YYMALLOC 00330 # define YYSTACK_FREE YYFREE 00331 # ifndef YYSTACK_ALLOC_MAXIMUM 00332 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00333 # endif 00334 # if (defined __cplusplus && ! defined _STDLIB_H \ 00335 && ! ((defined YYMALLOC || defined malloc) \ 00336 && (defined YYFREE || defined free))) 00337 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00338 # ifndef _STDLIB_H 00339 # define _STDLIB_H 1 00340 # endif 00341 # endif 00342 # ifndef YYMALLOC 00343 # define YYMALLOC malloc 00344 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00345 || defined __cplusplus || defined _MSC_VER) 00346 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00347 # endif 00348 # endif 00349 # ifndef YYFREE 00350 # define YYFREE free 00351 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00352 || defined __cplusplus || defined _MSC_VER) 00353 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00354 # endif 00355 # endif 00356 # endif 00357 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00358 00359 00360 #if (! defined yyoverflow \ 00361 && (! defined __cplusplus \ 00362 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00363 00364 /* A type that is properly aligned for any stack member. */ 00365 union yyalloc 00366 { 00367 yytype_int16 yyss_alloc; 00368 YYSTYPE yyvs_alloc; 00369 }; 00370 00371 /* The size of the maximum gap between one aligned stack and the next. */ 00372 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00373 00374 /* The size of an array large to enough to hold all stacks, each with 00375 N elements. */ 00376 # define YYSTACK_BYTES(N) \ 00377 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00378 + YYSTACK_GAP_MAXIMUM) 00379 00380 /* Copy COUNT objects from FROM to TO. The source and destination do 00381 not overlap. */ 00382 # ifndef YYCOPY 00383 # if defined __GNUC__ && 1 < __GNUC__ 00384 # define YYCOPY(To, From, Count) \ 00385 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00386 # else 00387 # define YYCOPY(To, From, Count) \ 00388 do \ 00389 { \ 00390 YYSIZE_T yyi; \ 00391 for (yyi = 0; yyi < (Count); yyi++) \ 00392 (To)[yyi] = (From)[yyi]; \ 00393 } \ 00394 while (YYID (0)) 00395 # endif 00396 # endif 00397 00398 /* Relocate STACK from its old location to the new one. The 00399 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00400 elements in the stack, and YYPTR gives the new location of the 00401 stack. Advance YYPTR to a properly aligned location for the next 00402 stack. */ 00403 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00404 do \ 00405 { \ 00406 YYSIZE_T yynewbytes; \ 00407 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00408 Stack = &yyptr->Stack_alloc; \ 00409 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00410 yyptr += yynewbytes / sizeof (*yyptr); \ 00411 } \ 00412 while (YYID (0)) 00413 00414 #endif 00415 00416 /* YYFINAL -- State number of the termination state. */ 00417 #define YYFINAL 43 00418 /* YYLAST -- Last index in YYTABLE. */ 00419 #define YYLAST 115 00420 00421 /* YYNTOKENS -- Number of terminals. */ 00422 #define YYNTOKENS 30 00423 /* YYNNTS -- Number of nonterminals. */ 00424 #define YYNNTS 26 00425 /* YYNRULES -- Number of rules. */ 00426 #define YYNRULES 60 00427 /* YYNRULES -- Number of states. */ 00428 #define YYNSTATES 90 00429 00430 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00431 #define YYUNDEFTOK 2 00432 #define YYMAXUTOK 275 00433 00434 #define YYTRANSLATE(YYX) \ 00435 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00436 00437 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00438 static const yytype_uint8 yytranslate[] = 00439 { 00440 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00444 23, 24, 2, 2, 28, 2, 27, 21, 2, 2, 00445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00446 2, 2, 2, 2, 22, 2, 2, 2, 2, 2, 00447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00449 2, 25, 2, 26, 2, 2, 2, 2, 2, 2, 00450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00452 2, 2, 2, 2, 29, 2, 2, 2, 2, 2, 00453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00465 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00466 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00467 15, 16, 17, 18, 19, 20 00468 }; 00469 00470 #if YYDEBUG 00471 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00472 YYRHS. */ 00473 static const yytype_uint8 yyprhs[] = 00474 { 00475 0, 0, 3, 5, 7, 9, 11, 14, 17, 19, 00476 23, 27, 29, 32, 35, 39, 41, 43, 45, 47, 00477 51, 55, 60, 62, 65, 69, 71, 73, 75, 77, 00478 81, 83, 85, 87, 91, 96, 98, 102, 104, 106, 00479 110, 112, 114, 118, 122, 124, 127, 129, 133, 135, 00480 139, 141, 145, 147, 151, 153, 157, 161, 163, 167, 00481 169 00482 }; 00483 00484 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00485 static const yytype_int8 yyrhs[] = 00486 { 00487 31, 0, -1, 49, -1, 34, -1, 33, -1, 21, 00488 -1, 21, 34, -1, 40, 34, -1, 35, -1, 34, 00489 21, 35, -1, 34, 40, 35, -1, 37, -1, 37, 00490 38, -1, 36, 37, -1, 36, 37, 38, -1, 41, 00491 -1, 10, -1, 22, -1, 19, -1, 11, 23, 24, 00492 -1, 12, 23, 24, -1, 12, 23, 14, 24, -1, 00493 39, -1, 38, 39, -1, 25, 31, 26, -1, 18, 00494 -1, 27, -1, 17, -1, 15, -1, 23, 31, 24, 00495 -1, 14, -1, 16, -1, 43, -1, 13, 23, 24, 00496 -1, 13, 23, 44, 24, -1, 45, -1, 44, 28, 00497 45, -1, 31, -1, 47, -1, 46, 29, 47, -1, 00498 32, -1, 48, -1, 48, 21, 34, -1, 48, 40, 00499 34, -1, 42, -1, 42, 38, -1, 50, -1, 49, 00500 9, 50, -1, 51, -1, 50, 8, 51, -1, 52, 00501 -1, 51, 3, 52, -1, 53, -1, 52, 4, 53, 00502 -1, 54, -1, 53, 7, 54, -1, 53, 6, 54, 00503 -1, 55, -1, 54, 5, 55, -1, 46, -1, 6, 00504 55, -1 00505 }; 00506 00507 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00508 static const yytype_uint16 yyrline[] = 00509 { 00510 0, 93, 93, 100, 105, 112, 117, 122, 130, 136, 00511 141, 149, 155, 162, 168, 175, 179, 181, 188, 202, 00512 207, 209, 220, 226, 233, 240, 247, 252, 259, 265, 00513 270, 276, 282, 286, 298, 312, 318, 325, 330, 332, 00514 341, 346, 351, 356, 364, 369, 376, 378, 385, 387, 00515 394, 396, 403, 405, 412, 414, 419, 426, 428, 435, 00516 437 00517 }; 00518 #endif 00519 00520 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00521 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00522 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00523 static const char *const yytname[] = 00524 { 00525 "$end", "error", "$undefined", "EQOP", "RELOP", "MULOP", "MINUS", 00526 "PLUS", "AND", "OR", "AXISNAME", "NODETYPE", "PI", "FUNCTIONNAME", 00527 "LITERAL", "VARIABLEREFERENCE", "NUMBER", "DOTDOT", "SLASHSLASH", 00528 "NAMETEST", "ERROR", "'/'", "'@'", "'('", "')'", "'['", "']'", "'.'", 00529 "','", "'|'", "$accept", "Expr", "LocationPath", "AbsoluteLocationPath", 00530 "RelativeLocationPath", "Step", "AxisSpecifier", "NodeTest", 00531 "PredicateList", "Predicate", "DescendantOrSelf", "AbbreviatedStep", 00532 "PrimaryExpr", "FunctionCall", "ArgumentList", "Argument", "UnionExpr", 00533 "PathExpr", "FilterExpr", "OrExpr", "AndExpr", "EqualityExpr", 00534 "RelationalExpr", "AdditiveExpr", "MultiplicativeExpr", "UnaryExpr", 0 00535 }; 00536 #endif 00537 00538 # ifdef YYPRINT 00539 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00540 token YYLEX-NUM. */ 00541 static const yytype_uint16 yytoknum[] = 00542 { 00543 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00544 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00545 275, 47, 64, 40, 41, 91, 93, 46, 44, 124 00546 }; 00547 # endif 00548 00549 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00550 static const yytype_uint8 yyr1[] = 00551 { 00552 0, 30, 31, 32, 32, 33, 33, 33, 34, 34, 00553 34, 35, 35, 35, 35, 35, 36, 36, 37, 37, 00554 37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 00555 42, 42, 42, 43, 43, 44, 44, 45, 46, 46, 00556 47, 47, 47, 47, 48, 48, 49, 49, 50, 50, 00557 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 00558 55 00559 }; 00560 00561 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00562 static const yytype_uint8 yyr2[] = 00563 { 00564 0, 2, 1, 1, 1, 1, 2, 2, 1, 3, 00565 3, 1, 2, 2, 3, 1, 1, 1, 1, 3, 00566 3, 4, 1, 2, 3, 1, 1, 1, 1, 3, 00567 1, 1, 1, 3, 4, 1, 3, 1, 1, 3, 00568 1, 1, 3, 3, 1, 2, 1, 3, 1, 3, 00569 1, 3, 1, 3, 1, 3, 3, 1, 3, 1, 00570 2 00571 }; 00572 00573 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 00574 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 00575 means the default is an error. */ 00576 static const yytype_uint8 yydefact[] = 00577 { 00578 0, 0, 16, 0, 0, 0, 30, 28, 31, 27, 00579 25, 18, 5, 17, 0, 26, 0, 40, 4, 3, 00580 8, 0, 11, 0, 15, 44, 32, 59, 38, 41, 00581 2, 46, 48, 50, 52, 54, 57, 60, 0, 0, 00582 0, 6, 0, 1, 0, 0, 13, 0, 12, 22, 00583 7, 45, 0, 0, 0, 0, 0, 0, 0, 0, 00584 0, 0, 19, 0, 20, 33, 37, 0, 35, 29, 00585 9, 10, 14, 0, 23, 39, 42, 43, 47, 49, 00586 51, 53, 56, 55, 58, 21, 34, 0, 24, 36 00587 }; 00588 00589 /* YYDEFGOTO[NTERM-NUM]. */ 00590 static const yytype_int8 yydefgoto[] = 00591 { 00592 -1, 66, 17, 18, 19, 20, 21, 22, 48, 49, 00593 23, 24, 25, 26, 67, 68, 27, 28, 29, 30, 00594 31, 32, 33, 34, 35, 36 00595 }; 00596 00597 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00598 STATE-NUM. */ 00599 #define YYPACT_NINF -45 00600 static const yytype_int8 yypact[] = 00601 { 00602 70, 70, -45, -17, 4, 14, -45, -45, -45, -45, 00603 -45, -45, -2, -45, 70, -45, 39, -45, -45, 3, 00604 -45, 19, 17, -2, -45, 17, -45, 18, -45, 15, 00605 34, 38, 45, 46, 6, 47, -45, -45, 27, 5, 00606 51, 3, 29, -45, -2, -2, 17, 70, 17, -45, 00607 3, 17, 88, -2, -2, 70, 70, 70, 70, 70, 00608 70, 70, -45, 30, -45, -45, -45, -6, -45, -45, 00609 -45, -45, 17, 53, -45, -45, 3, 3, 38, 45, 00610 46, 6, 47, 47, -45, -45, -45, 70, -45, -45 00611 }; 00612 00613 /* YYPGOTO[NTERM-NUM]. */ 00614 static const yytype_int8 yypgoto[] = 00615 { 00616 -45, 2, -45, -45, -9, -10, -45, 35, -20, -44, 00617 -18, -45, -45, -45, -45, -32, -45, 25, -45, -45, 00618 16, 40, 33, 36, -19, -1 00619 }; 00620 00621 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00622 positive, shift that token. If negative, reduce the rule which 00623 number is the opposite. If zero, do what YYDEFACT says. 00624 If YYTABLE_NINF, syntax error. */ 00625 #define YYTABLE_NINF -1 00626 static const yytype_uint8 yytable[] = 00627 { 00628 37, 45, 16, 41, 74, 51, 38, 74, 2, 3, 00629 4, 54, 59, 60, 50, 9, 42, 11, 86, 63, 00630 13, 10, 87, 45, 44, 15, 72, 39, 74, 64, 00631 3, 4, 45, 10, 70, 71, 53, 40, 11, 43, 00632 82, 83, 47, 55, 76, 77, 56, 52, 57, 73, 00633 58, 62, 61, 69, 85, 89, 46, 1, 45, 45, 00634 84, 2, 3, 4, 5, 6, 7, 8, 9, 10, 00635 11, 78, 12, 13, 14, 65, 1, 75, 15, 88, 00636 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 00637 80, 12, 13, 14, 81, 0, 79, 15, 2, 3, 00638 4, 5, 6, 7, 8, 9, 10, 11, 0, 12, 00639 13, 14, 0, 0, 0, 15 00640 }; 00641 00642 static const yytype_int8 yycheck[] = 00643 { 00644 1, 19, 0, 12, 48, 25, 23, 51, 10, 11, 00645 12, 29, 6, 7, 23, 17, 14, 19, 24, 14, 00646 22, 18, 28, 41, 21, 27, 46, 23, 72, 24, 00647 11, 12, 50, 18, 44, 45, 21, 23, 19, 0, 00648 59, 60, 25, 9, 53, 54, 8, 29, 3, 47, 00649 4, 24, 5, 24, 24, 87, 21, 6, 76, 77, 00650 61, 10, 11, 12, 13, 14, 15, 16, 17, 18, 00651 19, 55, 21, 22, 23, 24, 6, 52, 27, 26, 00652 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 00653 57, 21, 22, 23, 58, -1, 56, 27, 10, 11, 00654 12, 13, 14, 15, 16, 17, 18, 19, -1, 21, 00655 22, 23, -1, -1, -1, 27 00656 }; 00657 00658 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00659 symbol of state STATE-NUM. */ 00660 static const yytype_uint8 yystos[] = 00661 { 00662 0, 6, 10, 11, 12, 13, 14, 15, 16, 17, 00663 18, 19, 21, 22, 23, 27, 31, 32, 33, 34, 00664 35, 36, 37, 40, 41, 42, 43, 46, 47, 48, 00665 49, 50, 51, 52, 53, 54, 55, 55, 23, 23, 00666 23, 34, 31, 0, 21, 40, 37, 25, 38, 39, 00667 34, 38, 29, 21, 40, 9, 8, 3, 4, 6, 00668 7, 5, 24, 14, 24, 24, 31, 44, 45, 24, 00669 35, 35, 38, 31, 39, 47, 34, 34, 50, 51, 00670 52, 53, 54, 54, 55, 24, 24, 28, 26, 45 00671 }; 00672 00673 #define yyerrok (yyerrstatus = 0) 00674 #define yyclearin (yychar = YYEMPTY) 00675 #define YYEMPTY (-2) 00676 #define YYEOF 0 00677 00678 #define YYACCEPT goto yyacceptlab 00679 #define YYABORT goto yyabortlab 00680 #define YYERROR goto yyerrorlab 00681 00682 00683 /* Like YYERROR except do call yyerror. This remains here temporarily 00684 to ease the transition to the new meaning of YYERROR, for GCC. 00685 Once GCC version 2 has supplanted version 1, this can go. However, 00686 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 00687 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 00688 discussed. */ 00689 00690 #define YYFAIL goto yyerrlab 00691 #if defined YYFAIL 00692 /* This is here to suppress warnings from the GCC cpp's 00693 -Wunused-macros. Normally we don't worry about that warning, but 00694 some users do, and we want to make it easy for users to remove 00695 YYFAIL uses, which will produce warnings from Bison 2.5. */ 00696 #endif 00697 00698 #define YYRECOVERING() (!!yyerrstatus) 00699 00700 #define YYBACKUP(Token, Value) \ 00701 do \ 00702 if (yychar == YYEMPTY && yylen == 1) \ 00703 { \ 00704 yychar = (Token); \ 00705 yylval = (Value); \ 00706 yytoken = YYTRANSLATE (yychar); \ 00707 YYPOPSTACK (1); \ 00708 goto yybackup; \ 00709 } \ 00710 else \ 00711 { \ 00712 yyerror (YY_("syntax error: cannot back up")); \ 00713 YYERROR; \ 00714 } \ 00715 while (YYID (0)) 00716 00717 00718 #define YYTERROR 1 00719 #define YYERRCODE 256 00720 00721 00722 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00723 If N is 0, then set CURRENT to the empty location which ends 00724 the previous symbol: RHS[0] (always defined). */ 00725 00726 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00727 #ifndef YYLLOC_DEFAULT 00728 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00729 do \ 00730 if (YYID (N)) \ 00731 { \ 00732 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00733 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00734 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00735 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00736 } \ 00737 else \ 00738 { \ 00739 (Current).first_line = (Current).last_line = \ 00740 YYRHSLOC (Rhs, 0).last_line; \ 00741 (Current).first_column = (Current).last_column = \ 00742 YYRHSLOC (Rhs, 0).last_column; \ 00743 } \ 00744 while (YYID (0)) 00745 #endif 00746 00747 00748 /* YY_LOCATION_PRINT -- Print the location on the stream. 00749 This macro was not mandated originally: define only if we know 00750 we won't break user code: when these are the locations we know. */ 00751 00752 #ifndef YY_LOCATION_PRINT 00753 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 00754 # define YY_LOCATION_PRINT(File, Loc) \ 00755 fprintf (File, "%d.%d-%d.%d", \ 00756 (Loc).first_line, (Loc).first_column, \ 00757 (Loc).last_line, (Loc).last_column) 00758 # else 00759 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00760 # endif 00761 #endif 00762 00763 00764 /* YYLEX -- calling `yylex' with the right arguments. */ 00765 00766 #ifdef YYLEX_PARAM 00767 # define YYLEX yylex (YYLEX_PARAM) 00768 #else 00769 # define YYLEX yylex () 00770 #endif 00771 00772 /* Enable debugging if requested. */ 00773 #if YYDEBUG 00774 00775 # ifndef YYFPRINTF 00776 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00777 # define YYFPRINTF fprintf 00778 # endif 00779 00780 # define YYDPRINTF(Args) \ 00781 do { \ 00782 if (yydebug) \ 00783 YYFPRINTF Args; \ 00784 } while (YYID (0)) 00785 00786 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00787 do { \ 00788 if (yydebug) \ 00789 { \ 00790 YYFPRINTF (stderr, "%s ", Title); \ 00791 yy_symbol_print (stderr, \ 00792 Type, Value); \ 00793 YYFPRINTF (stderr, "\n"); \ 00794 } \ 00795 } while (YYID (0)) 00796 00797 00798 /*--------------------------------. 00799 | Print this symbol on YYOUTPUT. | 00800 `--------------------------------*/ 00801 00802 /*ARGSUSED*/ 00803 #if (defined __STDC__ || defined __C99__FUNC__ \ 00804 || defined __cplusplus || defined _MSC_VER) 00805 static void 00806 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00807 #else 00808 static void 00809 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 00810 FILE *yyoutput; 00811 int yytype; 00812 YYSTYPE const * const yyvaluep; 00813 #endif 00814 { 00815 if (!yyvaluep) 00816 return; 00817 # ifdef YYPRINT 00818 if (yytype < YYNTOKENS) 00819 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 00820 # else 00821 YYUSE (yyoutput); 00822 # endif 00823 switch (yytype) 00824 { 00825 default: 00826 break; 00827 } 00828 } 00829 00830 00831 /*--------------------------------. 00832 | Print this symbol on YYOUTPUT. | 00833 `--------------------------------*/ 00834 00835 #if (defined __STDC__ || defined __C99__FUNC__ \ 00836 || defined __cplusplus || defined _MSC_VER) 00837 static void 00838 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00839 #else 00840 static void 00841 yy_symbol_print (yyoutput, yytype, yyvaluep) 00842 FILE *yyoutput; 00843 int yytype; 00844 YYSTYPE const * const yyvaluep; 00845 #endif 00846 { 00847 if (yytype < YYNTOKENS) 00848 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 00849 else 00850 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 00851 00852 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 00853 YYFPRINTF (yyoutput, ")"); 00854 } 00855 00856 /*------------------------------------------------------------------. 00857 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 00858 | TOP (included). | 00859 `------------------------------------------------------------------*/ 00860 00861 #if (defined __STDC__ || defined __C99__FUNC__ \ 00862 || defined __cplusplus || defined _MSC_VER) 00863 static void 00864 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 00865 #else 00866 static void 00867 yy_stack_print (yybottom, yytop) 00868 yytype_int16 *yybottom; 00869 yytype_int16 *yytop; 00870 #endif 00871 { 00872 YYFPRINTF (stderr, "Stack now"); 00873 for (; yybottom <= yytop; yybottom++) 00874 { 00875 int yybot = *yybottom; 00876 YYFPRINTF (stderr, " %d", yybot); 00877 } 00878 YYFPRINTF (stderr, "\n"); 00879 } 00880 00881 # define YY_STACK_PRINT(Bottom, Top) \ 00882 do { \ 00883 if (yydebug) \ 00884 yy_stack_print ((Bottom), (Top)); \ 00885 } while (YYID (0)) 00886 00887 00888 /*------------------------------------------------. 00889 | Report that the YYRULE is going to be reduced. | 00890 `------------------------------------------------*/ 00891 00892 #if (defined __STDC__ || defined __C99__FUNC__ \ 00893 || defined __cplusplus || defined _MSC_VER) 00894 static void 00895 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 00896 #else 00897 static void 00898 yy_reduce_print (yyvsp, yyrule) 00899 YYSTYPE *yyvsp; 00900 int yyrule; 00901 #endif 00902 { 00903 int yynrhs = yyr2[yyrule]; 00904 int yyi; 00905 unsigned long int yylno = yyrline[yyrule]; 00906 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 00907 yyrule - 1, yylno); 00908 /* The symbols being reduced. */ 00909 for (yyi = 0; yyi < yynrhs; yyi++) 00910 { 00911 YYFPRINTF (stderr, " $%d = ", yyi + 1); 00912 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 00913 &(yyvsp[(yyi + 1) - (yynrhs)]) 00914 ); 00915 YYFPRINTF (stderr, "\n"); 00916 } 00917 } 00918 00919 # define YY_REDUCE_PRINT(Rule) \ 00920 do { \ 00921 if (yydebug) \ 00922 yy_reduce_print (yyvsp, Rule); \ 00923 } while (YYID (0)) 00924 00925 /* Nonzero means print parse trace. It is left uninitialized so that 00926 multiple parsers can coexist. */ 00927 int yydebug; 00928 #else /* !YYDEBUG */ 00929 # define YYDPRINTF(Args) 00930 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 00931 # define YY_STACK_PRINT(Bottom, Top) 00932 # define YY_REDUCE_PRINT(Rule) 00933 #endif /* !YYDEBUG */ 00934 00935 00936 /* YYINITDEPTH -- initial size of the parser's stacks. */ 00937 #ifndef YYINITDEPTH 00938 # define YYINITDEPTH 200 00939 #endif 00940 00941 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 00942 if the built-in stack extension method is used). 00943 00944 Do not make this value too large; the results are undefined if 00945 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 00946 evaluated with infinite-precision integer arithmetic. */ 00947 00948 #ifndef YYMAXDEPTH 00949 # define YYMAXDEPTH 10000 00950 #endif 00951 00952 00953 00954 #if YYERROR_VERBOSE 00955 00956 # ifndef yystrlen 00957 # if defined __GLIBC__ && defined _STRING_H 00958 # define yystrlen strlen 00959 # else 00960 /* Return the length of YYSTR. */ 00961 #if (defined __STDC__ || defined __C99__FUNC__ \ 00962 || defined __cplusplus || defined _MSC_VER) 00963 static YYSIZE_T 00964 yystrlen (const char *yystr) 00965 #else 00966 static YYSIZE_T 00967 yystrlen (yystr) 00968 const char *yystr; 00969 #endif 00970 { 00971 YYSIZE_T yylen; 00972 for (yylen = 0; yystr[yylen]; yylen++) 00973 continue; 00974 return yylen; 00975 } 00976 # endif 00977 # endif 00978 00979 # ifndef yystpcpy 00980 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 00981 # define yystpcpy stpcpy 00982 # else 00983 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 00984 YYDEST. */ 00985 #if (defined __STDC__ || defined __C99__FUNC__ \ 00986 || defined __cplusplus || defined _MSC_VER) 00987 static char * 00988 yystpcpy (char *yydest, const char *yysrc) 00989 #else 00990 static char * 00991 yystpcpy (yydest, yysrc) 00992 char *yydest; 00993 const char *yysrc; 00994 #endif 00995 { 00996 char *yyd = yydest; 00997 const char *yys = yysrc; 00998 00999 while ((*yyd++ = *yys++) != '\0') 01000 continue; 01001 01002 return yyd - 1; 01003 } 01004 # endif 01005 # endif 01006 01007 # ifndef yytnamerr 01008 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01009 quotes and backslashes, so that it's suitable for yyerror. The 01010 heuristic is that double-quoting is unnecessary unless the string 01011 contains an apostrophe, a comma, or backslash (other than 01012 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01013 null, do not copy; instead, return the length of what the result 01014 would have been. */ 01015 static YYSIZE_T 01016 yytnamerr (char *yyres, const char *yystr) 01017 { 01018 if (*yystr == '"') 01019 { 01020 YYSIZE_T yyn = 0; 01021 char const *yyp = yystr; 01022 01023 for (;;) 01024 switch (*++yyp) 01025 { 01026 case '\'': 01027 case ',': 01028 goto do_not_strip_quotes; 01029 01030 case '\\': 01031 if (*++yyp != '\\') 01032 goto do_not_strip_quotes; 01033 /* Fall through. */ 01034 default: 01035 if (yyres) 01036 yyres[yyn] = *yyp; 01037 yyn++; 01038 break; 01039 01040 case '"': 01041 if (yyres) 01042 yyres[yyn] = '\0'; 01043 return yyn; 01044 } 01045 do_not_strip_quotes: ; 01046 } 01047 01048 if (! yyres) 01049 return yystrlen (yystr); 01050 01051 return yystpcpy (yyres, yystr) - yyres; 01052 } 01053 # endif 01054 01055 /* Copy into YYRESULT an error message about the unexpected token 01056 YYCHAR while in state YYSTATE. Return the number of bytes copied, 01057 including the terminating null byte. If YYRESULT is null, do not 01058 copy anything; just return the number of bytes that would be 01059 copied. As a special case, return 0 if an ordinary "syntax error" 01060 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 01061 size calculation. */ 01062 static YYSIZE_T 01063 yysyntax_error (char *yyresult, int yystate, int yychar) 01064 { 01065 int yyn = yypact[yystate]; 01066 01067 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 01068 return 0; 01069 else 01070 { 01071 int yytype = YYTRANSLATE (yychar); 01072 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 01073 YYSIZE_T yysize = yysize0; 01074 YYSIZE_T yysize1; 01075 int yysize_overflow = 0; 01076 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01077 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01078 int yyx; 01079 01080 # if 0 01081 /* This is so xgettext sees the translatable formats that are 01082 constructed on the fly. */ 01083 YY_("syntax error, unexpected %s"); 01084 YY_("syntax error, unexpected %s, expecting %s"); 01085 YY_("syntax error, unexpected %s, expecting %s or %s"); 01086 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 01087 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 01088 # endif 01089 char *yyfmt; 01090 char const *yyf; 01091 static char const yyunexpected[] = "syntax error, unexpected %s"; 01092 static char const yyexpecting[] = ", expecting %s"; 01093 static char const yyor[] = " or %s"; 01094 char yyformat[sizeof yyunexpected 01095 + sizeof yyexpecting - 1 01096 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 01097 * (sizeof yyor - 1))]; 01098 char const *yyprefix = yyexpecting; 01099 01100 /* Start YYX at -YYN if negative to avoid negative indexes in 01101 YYCHECK. */ 01102 int yyxbegin = yyn < 0 ? -yyn : 0; 01103 01104 /* Stay within bounds of both yycheck and yytname. */ 01105 int yychecklim = YYLAST - yyn + 1; 01106 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01107 int yycount = 1; 01108 01109 yyarg[0] = yytname[yytype]; 01110 yyfmt = yystpcpy (yyformat, yyunexpected); 01111 01112 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01113 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01114 { 01115 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01116 { 01117 yycount = 1; 01118 yysize = yysize0; 01119 yyformat[sizeof yyunexpected - 1] = '\0'; 01120 break; 01121 } 01122 yyarg[yycount++] = yytname[yyx]; 01123 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01124 yysize_overflow |= (yysize1 < yysize); 01125 yysize = yysize1; 01126 yyfmt = yystpcpy (yyfmt, yyprefix); 01127 yyprefix = yyor; 01128 } 01129 01130 yyf = YY_(yyformat); 01131 yysize1 = yysize + yystrlen (yyf); 01132 yysize_overflow |= (yysize1 < yysize); 01133 yysize = yysize1; 01134 01135 if (yysize_overflow) 01136 return YYSIZE_MAXIMUM; 01137 01138 if (yyresult) 01139 { 01140 /* Avoid sprintf, as that infringes on the user's name space. 01141 Don't have undefined behavior even if the translation 01142 produced a string with the wrong number of "%s"s. */ 01143 char *yyp = yyresult; 01144 int yyi = 0; 01145 while ((*yyp = *yyf) != '\0') 01146 { 01147 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 01148 { 01149 yyp += yytnamerr (yyp, yyarg[yyi++]); 01150 yyf += 2; 01151 } 01152 else 01153 { 01154 yyp++; 01155 yyf++; 01156 } 01157 } 01158 } 01159 return yysize; 01160 } 01161 } 01162 #endif /* YYERROR_VERBOSE */ 01163 01164 01165 /*-----------------------------------------------. 01166 | Release the memory associated to this symbol. | 01167 `-----------------------------------------------*/ 01168 01169 /*ARGSUSED*/ 01170 #if (defined __STDC__ || defined __C99__FUNC__ \ 01171 || defined __cplusplus || defined _MSC_VER) 01172 static void 01173 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01174 #else 01175 static void 01176 yydestruct (yymsg, yytype, yyvaluep) 01177 const char *yymsg; 01178 int yytype; 01179 YYSTYPE *yyvaluep; 01180 #endif 01181 { 01182 YYUSE (yyvaluep); 01183 01184 if (!yymsg) 01185 yymsg = "Deleting"; 01186 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01187 01188 switch (yytype) 01189 { 01190 01191 default: 01192 break; 01193 } 01194 } 01195 01196 /* Prevent warnings from -Wmissing-prototypes. */ 01197 #ifdef YYPARSE_PARAM 01198 #if defined __STDC__ || defined __cplusplus 01199 int yyparse (void *YYPARSE_PARAM); 01200 #else 01201 int yyparse (); 01202 #endif 01203 #else /* ! YYPARSE_PARAM */ 01204 #if defined __STDC__ || defined __cplusplus 01205 int yyparse (void); 01206 #else 01207 int yyparse (); 01208 #endif 01209 #endif /* ! YYPARSE_PARAM */ 01210 01211 01212 /* The lookahead symbol. */ 01213 int yychar; 01214 01215 /* The semantic value of the lookahead symbol. */ 01216 YYSTYPE yylval; 01217 01218 /* Number of syntax errors so far. */ 01219 int yynerrs; 01220 01221 01222 01223 /*-------------------------. 01224 | yyparse or yypush_parse. | 01225 `-------------------------*/ 01226 01227 #ifdef YYPARSE_PARAM 01228 #if (defined __STDC__ || defined __C99__FUNC__ \ 01229 || defined __cplusplus || defined _MSC_VER) 01230 int 01231 yyparse (void *YYPARSE_PARAM) 01232 #else 01233 int 01234 yyparse (YYPARSE_PARAM) 01235 void *YYPARSE_PARAM; 01236 #endif 01237 #else /* ! YYPARSE_PARAM */ 01238 #if (defined __STDC__ || defined __C99__FUNC__ \ 01239 || defined __cplusplus || defined _MSC_VER) 01240 int 01241 yyparse (void) 01242 #else 01243 int 01244 yyparse () 01245 01246 #endif 01247 #endif 01248 { 01249 01250 01251 int yystate; 01252 /* Number of tokens to shift before error messages enabled. */ 01253 int yyerrstatus; 01254 01255 /* The stacks and their tools: 01256 `yyss': related to states. 01257 `yyvs': related to semantic values. 01258 01259 Refer to the stacks thru separate pointers, to allow yyoverflow 01260 to reallocate them elsewhere. */ 01261 01262 /* The state stack. */ 01263 yytype_int16 yyssa[YYINITDEPTH]; 01264 yytype_int16 *yyss; 01265 yytype_int16 *yyssp; 01266 01267 /* The semantic value stack. */ 01268 YYSTYPE yyvsa[YYINITDEPTH]; 01269 YYSTYPE *yyvs; 01270 YYSTYPE *yyvsp; 01271 01272 YYSIZE_T yystacksize; 01273 01274 int yyn; 01275 int yyresult; 01276 /* Lookahead token as an internal (translated) token number. */ 01277 int yytoken; 01278 /* The variables used to return semantic value and location from the 01279 action routines. */ 01280 YYSTYPE yyval; 01281 01282 #if YYERROR_VERBOSE 01283 /* Buffer for error messages, and its allocated size. */ 01284 char yymsgbuf[128]; 01285 char *yymsg = yymsgbuf; 01286 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01287 #endif 01288 01289 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01290 01291 /* The number of symbols on the RHS of the reduced rule. 01292 Keep to zero when no symbol should be popped. */ 01293 int yylen = 0; 01294 01295 yytoken = 0; 01296 yyss = yyssa; 01297 yyvs = yyvsa; 01298 yystacksize = YYINITDEPTH; 01299 01300 YYDPRINTF ((stderr, "Starting parse\n")); 01301 01302 yystate = 0; 01303 yyerrstatus = 0; 01304 yynerrs = 0; 01305 yychar = YYEMPTY; /* Cause a token to be read. */ 01306 01307 /* Initialize stack pointers. 01308 Waste one element of value and location stack 01309 so that they stay on the same level as the state stack. 01310 The wasted elements are never initialized. */ 01311 yyssp = yyss; 01312 yyvsp = yyvs; 01313 01314 goto yysetstate; 01315 01316 /*------------------------------------------------------------. 01317 | yynewstate -- Push a new state, which is found in yystate. | 01318 `------------------------------------------------------------*/ 01319 yynewstate: 01320 /* In all cases, when you get here, the value and location stacks 01321 have just been pushed. So pushing a state here evens the stacks. */ 01322 yyssp++; 01323 01324 yysetstate: 01325 *yyssp = yystate; 01326 01327 if (yyss + yystacksize - 1 <= yyssp) 01328 { 01329 /* Get the current used size of the three stacks, in elements. */ 01330 YYSIZE_T yysize = yyssp - yyss + 1; 01331 01332 #ifdef yyoverflow 01333 { 01334 /* Give user a chance to reallocate the stack. Use copies of 01335 these so that the &'s don't force the real ones into 01336 memory. */ 01337 YYSTYPE *yyvs1 = yyvs; 01338 yytype_int16 *yyss1 = yyss; 01339 01340 /* Each stack pointer address is followed by the size of the 01341 data in use in that stack, in bytes. This used to be a 01342 conditional around just the two extra args, but that might 01343 be undefined if yyoverflow is a macro. */ 01344 yyoverflow (YY_("memory exhausted"), 01345 &yyss1, yysize * sizeof (*yyssp), 01346 &yyvs1, yysize * sizeof (*yyvsp), 01347 &yystacksize); 01348 01349 yyss = yyss1; 01350 yyvs = yyvs1; 01351 } 01352 #else /* no yyoverflow */ 01353 # ifndef YYSTACK_RELOCATE 01354 goto yyexhaustedlab; 01355 # else 01356 /* Extend the stack our own way. */ 01357 if (YYMAXDEPTH <= yystacksize) 01358 goto yyexhaustedlab; 01359 yystacksize *= 2; 01360 if (YYMAXDEPTH < yystacksize) 01361 yystacksize = YYMAXDEPTH; 01362 01363 { 01364 yytype_int16 *yyss1 = yyss; 01365 union yyalloc *yyptr = 01366 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01367 if (! yyptr) 01368 goto yyexhaustedlab; 01369 YYSTACK_RELOCATE (yyss_alloc, yyss); 01370 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01371 # undef YYSTACK_RELOCATE 01372 if (yyss1 != yyssa) 01373 YYSTACK_FREE (yyss1); 01374 } 01375 # endif 01376 #endif /* no yyoverflow */ 01377 01378 yyssp = yyss + yysize - 1; 01379 yyvsp = yyvs + yysize - 1; 01380 01381 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01382 (unsigned long int) yystacksize)); 01383 01384 if (yyss + yystacksize - 1 <= yyssp) 01385 YYABORT; 01386 } 01387 01388 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01389 01390 if (yystate == YYFINAL) 01391 YYACCEPT; 01392 01393 goto yybackup; 01394 01395 /*-----------. 01396 | yybackup. | 01397 `-----------*/ 01398 yybackup: 01399 01400 /* Do appropriate processing given the current state. Read a 01401 lookahead token if we need one and don't already have one. */ 01402 01403 /* First try to decide what to do without reference to lookahead token. */ 01404 yyn = yypact[yystate]; 01405 if (yyn == YYPACT_NINF) 01406 goto yydefault; 01407 01408 /* Not known => get a lookahead token if don't already have one. */ 01409 01410 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01411 if (yychar == YYEMPTY) 01412 { 01413 YYDPRINTF ((stderr, "Reading a token: ")); 01414 yychar = YYLEX; 01415 } 01416 01417 if (yychar <= YYEOF) 01418 { 01419 yychar = yytoken = YYEOF; 01420 YYDPRINTF ((stderr, "Now at end of input.\n")); 01421 } 01422 else 01423 { 01424 yytoken = YYTRANSLATE (yychar); 01425 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01426 } 01427 01428 /* If the proper action on seeing token YYTOKEN is to reduce or to 01429 detect an error, take that action. */ 01430 yyn += yytoken; 01431 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01432 goto yydefault; 01433 yyn = yytable[yyn]; 01434 if (yyn <= 0) 01435 { 01436 if (yyn == 0 || yyn == YYTABLE_NINF) 01437 goto yyerrlab; 01438 yyn = -yyn; 01439 goto yyreduce; 01440 } 01441 01442 /* Count tokens shifted since error; after three, turn off error 01443 status. */ 01444 if (yyerrstatus) 01445 yyerrstatus--; 01446 01447 /* Shift the lookahead token. */ 01448 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01449 01450 /* Discard the shifted token. */ 01451 yychar = YYEMPTY; 01452 01453 yystate = yyn; 01454 *++yyvsp = yylval; 01455 01456 goto yynewstate; 01457 01458 01459 /*-----------------------------------------------------------. 01460 | yydefault -- do the default action for the current state. | 01461 `-----------------------------------------------------------*/ 01462 yydefault: 01463 yyn = yydefact[yystate]; 01464 if (yyn == 0) 01465 goto yyerrlab; 01466 goto yyreduce; 01467 01468 01469 /*-----------------------------. 01470 | yyreduce -- Do a reduction. | 01471 `-----------------------------*/ 01472 yyreduce: 01473 /* yyn is the number of a rule to reduce with. */ 01474 yylen = yyr2[yyn]; 01475 01476 /* If YYLEN is nonzero, implement the default value of the action: 01477 `$$ = $1'. 01478 01479 Otherwise, the following line sets YYVAL to garbage. 01480 This behavior is undocumented and Bison 01481 users should not rely upon it. Assigning to YYVAL 01482 unconditionally makes the parser a bit smaller, and it avoids a 01483 GCC warning that YYVAL may be used uninitialized. */ 01484 yyval = yyvsp[1-yylen]; 01485 01486 01487 YY_REDUCE_PRINT (yyn); 01488 switch (yyn) 01489 { 01490 case 2: 01491 01492 /* Line 1464 of yacc.c */ 01493 #line 94 "parser.y" 01494 { 01495 _topExpr = (yyvsp[(1) - (1)].expr); 01496 ;} 01497 break; 01498 01499 case 3: 01500 01501 /* Line 1464 of yacc.c */ 01502 #line 101 "parser.y" 01503 { 01504 (yyval.locationPath)->m_absolute = false; 01505 ;} 01506 break; 01507 01508 case 4: 01509 01510 /* Line 1464 of yacc.c */ 01511 #line 106 "parser.y" 01512 { 01513 (yyval.locationPath)->m_absolute = true; 01514 ;} 01515 break; 01516 01517 case 5: 01518 01519 /* Line 1464 of yacc.c */ 01520 #line 113 "parser.y" 01521 { 01522 (yyval.locationPath) = new LocationPath; 01523 ;} 01524 break; 01525 01526 case 6: 01527 01528 /* Line 1464 of yacc.c */ 01529 #line 118 "parser.y" 01530 { 01531 (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); 01532 ;} 01533 break; 01534 01535 case 7: 01536 01537 /* Line 1464 of yacc.c */ 01538 #line 123 "parser.y" 01539 { 01540 (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); 01541 (yyval.locationPath)->m_steps.prepend( (yyvsp[(1) - (2)].step) ); 01542 ;} 01543 break; 01544 01545 case 8: 01546 01547 /* Line 1464 of yacc.c */ 01548 #line 131 "parser.y" 01549 { 01550 (yyval.locationPath) = new LocationPath; 01551 (yyval.locationPath)->m_steps.append( (yyvsp[(1) - (1)].step) ); 01552 ;} 01553 break; 01554 01555 case 9: 01556 01557 /* Line 1464 of yacc.c */ 01558 #line 137 "parser.y" 01559 { 01560 (yyval.locationPath)->m_steps.append( (yyvsp[(3) - (3)].step) ); 01561 ;} 01562 break; 01563 01564 case 10: 01565 01566 /* Line 1464 of yacc.c */ 01567 #line 142 "parser.y" 01568 { 01569 (yyval.locationPath)->m_steps.append( (yyvsp[(2) - (3)].step) ); 01570 (yyval.locationPath)->m_steps.append( (yyvsp[(3) - (3)].step) ); 01571 ;} 01572 break; 01573 01574 case 11: 01575 01576 /* Line 1464 of yacc.c */ 01577 #line 150 "parser.y" 01578 { 01579 (yyval.step) = new Step( Step::ChildAxis, *(yyvsp[(1) - (1)].str) ); 01580 delete (yyvsp[(1) - (1)].str); 01581 ;} 01582 break; 01583 01584 case 12: 01585 01586 /* Line 1464 of yacc.c */ 01587 #line 156 "parser.y" 01588 { 01589 (yyval.step) = new Step( Step::ChildAxis, *(yyvsp[(1) - (2)].str), *(yyvsp[(2) - (2)].predList) ); 01590 delete (yyvsp[(1) - (2)].str); 01591 delete (yyvsp[(2) - (2)].predList); 01592 ;} 01593 break; 01594 01595 case 13: 01596 01597 /* Line 1464 of yacc.c */ 01598 #line 163 "parser.y" 01599 { 01600 (yyval.step) = new Step( (yyvsp[(1) - (2)].axisType), *(yyvsp[(2) - (2)].str) ); 01601 delete (yyvsp[(2) - (2)].str); 01602 ;} 01603 break; 01604 01605 case 14: 01606 01607 /* Line 1464 of yacc.c */ 01608 #line 169 "parser.y" 01609 { 01610 (yyval.step) = new Step( (yyvsp[(1) - (3)].axisType), *(yyvsp[(2) - (3)].str), *(yyvsp[(3) - (3)].predList) ); 01611 delete (yyvsp[(2) - (3)].str); 01612 delete (yyvsp[(3) - (3)].predList); 01613 ;} 01614 break; 01615 01616 case 17: 01617 01618 /* Line 1464 of yacc.c */ 01619 #line 182 "parser.y" 01620 { 01621 (yyval.axisType) = Step::AttributeAxis; 01622 ;} 01623 break; 01624 01625 case 18: 01626 01627 /* Line 1464 of yacc.c */ 01628 #line 189 "parser.y" 01629 { 01630 const int colon = (yyvsp[(1) - (1)].str)->find( ':' ); 01631 if ( colon > -1 ) { 01632 DOMString prefix( (yyvsp[(1) - (1)].str)->substring( 0, colon ) ); 01633 XPathNSResolverImpl *resolver = Expression::evaluationContext().resolver; 01634 if ( !resolver || resolver->lookupNamespaceURI( prefix ).isNull() ) { 01635 kWarning(6011) << "Found unknown namespace prefix " << prefix.string(); 01636 xpathParseException = DOMException::NAMESPACE_ERR; 01637 YYABORT; 01638 } 01639 } 01640 ;} 01641 break; 01642 01643 case 19: 01644 01645 /* Line 1464 of yacc.c */ 01646 #line 203 "parser.y" 01647 { 01648 (yyval.str) = new DOMString( *(yyvsp[(1) - (3)].str) + "()" ); 01649 ;} 01650 break; 01651 01652 case 21: 01653 01654 /* Line 1464 of yacc.c */ 01655 #line 210 "parser.y" 01656 { 01657 QString s = (yyvsp[(1) - (4)].str)->string() + QLatin1Char(' ') + (yyvsp[(3) - (4)].str)->string(); 01658 s = s.trimmed(); 01659 (yyval.str) = new DOMString( s ); 01660 delete (yyvsp[(1) - (4)].str); 01661 delete (yyvsp[(3) - (4)].str); 01662 ;} 01663 break; 01664 01665 case 22: 01666 01667 /* Line 1464 of yacc.c */ 01668 #line 221 "parser.y" 01669 { 01670 (yyval.predList) = new QList<Predicate *>; 01671 (yyval.predList)->append( new Predicate( (yyvsp[(1) - (1)].expr) ) ); 01672 ;} 01673 break; 01674 01675 case 23: 01676 01677 /* Line 1464 of yacc.c */ 01678 #line 227 "parser.y" 01679 { 01680 (yyval.predList)->append( new Predicate( (yyvsp[(2) - (2)].expr) ) ); 01681 ;} 01682 break; 01683 01684 case 24: 01685 01686 /* Line 1464 of yacc.c */ 01687 #line 234 "parser.y" 01688 { 01689 (yyval.expr) = (yyvsp[(2) - (3)].expr); 01690 ;} 01691 break; 01692 01693 case 25: 01694 01695 /* Line 1464 of yacc.c */ 01696 #line 241 "parser.y" 01697 { 01698 (yyval.step) = new Step( Step::DescendantOrSelfAxis, "node()" ); 01699 ;} 01700 break; 01701 01702 case 26: 01703 01704 /* Line 1464 of yacc.c */ 01705 #line 248 "parser.y" 01706 { 01707 (yyval.step) = new Step( Step::SelfAxis, "node()" ); 01708 ;} 01709 break; 01710 01711 case 27: 01712 01713 /* Line 1464 of yacc.c */ 01714 #line 253 "parser.y" 01715 { 01716 (yyval.step) = new Step( Step::ParentAxis, "node()" ); 01717 ;} 01718 break; 01719 01720 case 28: 01721 01722 /* Line 1464 of yacc.c */ 01723 #line 260 "parser.y" 01724 { 01725 (yyval.expr) = new VariableReference( *(yyvsp[(1) - (1)].str) ); 01726 delete (yyvsp[(1) - (1)].str); 01727 ;} 01728 break; 01729 01730 case 29: 01731 01732 /* Line 1464 of yacc.c */ 01733 #line 266 "parser.y" 01734 { 01735 (yyval.expr) = (yyvsp[(2) - (3)].expr); 01736 ;} 01737 break; 01738 01739 case 30: 01740 01741 /* Line 1464 of yacc.c */ 01742 #line 271 "parser.y" 01743 { 01744 (yyval.expr) = new String( *(yyvsp[(1) - (1)].str) ); 01745 delete (yyvsp[(1) - (1)].str); 01746 ;} 01747 break; 01748 01749 case 31: 01750 01751 /* Line 1464 of yacc.c */ 01752 #line 277 "parser.y" 01753 { 01754 (yyval.expr) = new Number( (yyvsp[(1) - (1)].str)->toFloat() ); 01755 delete (yyvsp[(1) - (1)].str); 01756 ;} 01757 break; 01758 01759 case 33: 01760 01761 /* Line 1464 of yacc.c */ 01762 #line 287 "parser.y" 01763 { 01764 Function* f = FunctionLibrary::self().getFunction( *(yyvsp[(1) - (3)].str) ); 01765 delete (yyvsp[(1) - (3)].str); 01766 if (!f) { 01767 xpathParseException = XPathException::toCode(INVALID_EXPRESSION_ERR); 01768 YYABORT; 01769 } 01770 01771 (yyval.expr) = f; 01772 ;} 01773 break; 01774 01775 case 34: 01776 01777 /* Line 1464 of yacc.c */ 01778 #line 299 "parser.y" 01779 { 01780 Function* f = FunctionLibrary::self().getFunction( *(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].argList) ); 01781 delete (yyvsp[(1) - (4)].str); 01782 delete (yyvsp[(3) - (4)].argList); 01783 if (!f) { 01784 xpathParseException = XPathException::toCode(INVALID_EXPRESSION_ERR); 01785 YYABORT; 01786 } 01787 (yyval.expr) = f; 01788 ;} 01789 break; 01790 01791 case 35: 01792 01793 /* Line 1464 of yacc.c */ 01794 #line 313 "parser.y" 01795 { 01796 (yyval.argList) = new QList<Expression *>; 01797 (yyval.argList)->append( (yyvsp[(1) - (1)].expr) ); 01798 ;} 01799 break; 01800 01801 case 36: 01802 01803 /* Line 1464 of yacc.c */ 01804 #line 319 "parser.y" 01805 { 01806 (yyval.argList)->append( (yyvsp[(3) - (3)].expr) ); 01807 ;} 01808 break; 01809 01810 case 39: 01811 01812 /* Line 1464 of yacc.c */ 01813 #line 333 "parser.y" 01814 { 01815 (yyval.expr) = new Union; 01816 (yyval.expr)->addSubExpression( (yyvsp[(1) - (3)].expr) ); 01817 (yyval.expr)->addSubExpression( (yyvsp[(3) - (3)].expr) ); 01818 ;} 01819 break; 01820 01821 case 40: 01822 01823 /* Line 1464 of yacc.c */ 01824 #line 342 "parser.y" 01825 { 01826 (yyval.expr) = (yyvsp[(1) - (1)].locationPath); 01827 ;} 01828 break; 01829 01830 case 41: 01831 01832 /* Line 1464 of yacc.c */ 01833 #line 347 "parser.y" 01834 { 01835 (yyval.expr) = (yyvsp[(1) - (1)].expr); 01836 ;} 01837 break; 01838 01839 case 42: 01840 01841 /* Line 1464 of yacc.c */ 01842 #line 352 "parser.y" 01843 { 01844 (yyval.expr) = new Path( static_cast<Filter *>( (yyvsp[(1) - (3)].expr) ), (yyvsp[(3) - (3)].locationPath) ); 01845 ;} 01846 break; 01847 01848 case 43: 01849 01850 /* Line 1464 of yacc.c */ 01851 #line 357 "parser.y" 01852 { 01853 (yyvsp[(3) - (3)].locationPath)->m_steps.prepend( (yyvsp[(2) - (3)].step) ); 01854 (yyval.expr) = new Path( static_cast<Filter *>( (yyvsp[(1) - (3)].expr) ), (yyvsp[(3) - (3)].locationPath) ); 01855 ;} 01856 break; 01857 01858 case 44: 01859 01860 /* Line 1464 of yacc.c */ 01861 #line 365 "parser.y" 01862 { 01863 (yyval.expr) = (yyvsp[(1) - (1)].expr); 01864 ;} 01865 break; 01866 01867 case 45: 01868 01869 /* Line 1464 of yacc.c */ 01870 #line 370 "parser.y" 01871 { 01872 (yyval.expr) = new Filter( (yyvsp[(1) - (2)].expr), *(yyvsp[(2) - (2)].predList) ); 01873 ;} 01874 break; 01875 01876 case 47: 01877 01878 /* Line 1464 of yacc.c */ 01879 #line 379 "parser.y" 01880 { 01881 (yyval.expr) = new LogicalOp( LogicalOp::OP_Or, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01882 ;} 01883 break; 01884 01885 case 49: 01886 01887 /* Line 1464 of yacc.c */ 01888 #line 388 "parser.y" 01889 { 01890 (yyval.expr) = new LogicalOp( LogicalOp::OP_And, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01891 ;} 01892 break; 01893 01894 case 51: 01895 01896 /* Line 1464 of yacc.c */ 01897 #line 397 "parser.y" 01898 { 01899 (yyval.expr) = new RelationOp( (yyvsp[(2) - (3)].num), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01900 ;} 01901 break; 01902 01903 case 53: 01904 01905 /* Line 1464 of yacc.c */ 01906 #line 406 "parser.y" 01907 { 01908 (yyval.expr) = new RelationOp( (yyvsp[(2) - (3)].num), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01909 ;} 01910 break; 01911 01912 case 55: 01913 01914 /* Line 1464 of yacc.c */ 01915 #line 415 "parser.y" 01916 { 01917 (yyval.expr) = new NumericOp( NumericOp::OP_Add, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01918 ;} 01919 break; 01920 01921 case 56: 01922 01923 /* Line 1464 of yacc.c */ 01924 #line 420 "parser.y" 01925 { 01926 (yyval.expr) = new NumericOp( NumericOp::OP_Sub, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01927 ;} 01928 break; 01929 01930 case 58: 01931 01932 /* Line 1464 of yacc.c */ 01933 #line 429 "parser.y" 01934 { 01935 (yyval.expr) = new NumericOp( (yyvsp[(2) - (3)].num), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr) ); 01936 ;} 01937 break; 01938 01939 case 60: 01940 01941 /* Line 1464 of yacc.c */ 01942 #line 438 "parser.y" 01943 { 01944 (yyval.expr) = new Negative; 01945 (yyval.expr)->addSubExpression( (yyvsp[(2) - (2)].expr) ); 01946 ;} 01947 break; 01948 01949 01950 01951 /* Line 1464 of yacc.c */ 01952 #line 1953 "parser.tab.c" 01953 default: break; 01954 } 01955 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 01956 01957 YYPOPSTACK (yylen); 01958 yylen = 0; 01959 YY_STACK_PRINT (yyss, yyssp); 01960 01961 *++yyvsp = yyval; 01962 01963 /* Now `shift' the result of the reduction. Determine what state 01964 that goes to, based on the state we popped back to and the rule 01965 number reduced by. */ 01966 01967 yyn = yyr1[yyn]; 01968 01969 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 01970 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 01971 yystate = yytable[yystate]; 01972 else 01973 yystate = yydefgoto[yyn - YYNTOKENS]; 01974 01975 goto yynewstate; 01976 01977 01978 /*------------------------------------. 01979 | yyerrlab -- here on detecting error | 01980 `------------------------------------*/ 01981 yyerrlab: 01982 /* If not already recovering from an error, report this error. */ 01983 if (!yyerrstatus) 01984 { 01985 ++yynerrs; 01986 #if ! YYERROR_VERBOSE 01987 yyerror (YY_("syntax error")); 01988 #else 01989 { 01990 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 01991 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 01992 { 01993 YYSIZE_T yyalloc = 2 * yysize; 01994 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 01995 yyalloc = YYSTACK_ALLOC_MAXIMUM; 01996 if (yymsg != yymsgbuf) 01997 YYSTACK_FREE (yymsg); 01998 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 01999 if (yymsg) 02000 yymsg_alloc = yyalloc; 02001 else 02002 { 02003 yymsg = yymsgbuf; 02004 yymsg_alloc = sizeof yymsgbuf; 02005 } 02006 } 02007 02008 if (0 < yysize && yysize <= yymsg_alloc) 02009 { 02010 (void) yysyntax_error (yymsg, yystate, yychar); 02011 yyerror (yymsg); 02012 } 02013 else 02014 { 02015 yyerror (YY_("syntax error")); 02016 if (yysize != 0) 02017 goto yyexhaustedlab; 02018 } 02019 } 02020 #endif 02021 } 02022 02023 02024 02025 if (yyerrstatus == 3) 02026 { 02027 /* If just tried and failed to reuse lookahead token after an 02028 error, discard it. */ 02029 02030 if (yychar <= YYEOF) 02031 { 02032 /* Return failure if at end of input. */ 02033 if (yychar == YYEOF) 02034 YYABORT; 02035 } 02036 else 02037 { 02038 yydestruct ("Error: discarding", 02039 yytoken, &yylval); 02040 yychar = YYEMPTY; 02041 } 02042 } 02043 02044 /* Else will try to reuse lookahead token after shifting the error 02045 token. */ 02046 goto yyerrlab1; 02047 02048 02049 /*---------------------------------------------------. 02050 | yyerrorlab -- error raised explicitly by YYERROR. | 02051 `---------------------------------------------------*/ 02052 yyerrorlab: 02053 02054 /* Pacify compilers like GCC when the user code never invokes 02055 YYERROR and the label yyerrorlab therefore never appears in user 02056 code. */ 02057 if (/*CONSTCOND*/ 0) 02058 goto yyerrorlab; 02059 02060 /* Do not reclaim the symbols of the rule which action triggered 02061 this YYERROR. */ 02062 YYPOPSTACK (yylen); 02063 yylen = 0; 02064 YY_STACK_PRINT (yyss, yyssp); 02065 yystate = *yyssp; 02066 goto yyerrlab1; 02067 02068 02069 /*-------------------------------------------------------------. 02070 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02071 `-------------------------------------------------------------*/ 02072 yyerrlab1: 02073 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02074 02075 for (;;) 02076 { 02077 yyn = yypact[yystate]; 02078 if (yyn != YYPACT_NINF) 02079 { 02080 yyn += YYTERROR; 02081 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02082 { 02083 yyn = yytable[yyn]; 02084 if (0 < yyn) 02085 break; 02086 } 02087 } 02088 02089 /* Pop the current state because it cannot handle the error token. */ 02090 if (yyssp == yyss) 02091 YYABORT; 02092 02093 02094 yydestruct ("Error: popping", 02095 yystos[yystate], yyvsp); 02096 YYPOPSTACK (1); 02097 yystate = *yyssp; 02098 YY_STACK_PRINT (yyss, yyssp); 02099 } 02100 02101 *++yyvsp = yylval; 02102 02103 02104 /* Shift the error token. */ 02105 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02106 02107 yystate = yyn; 02108 goto yynewstate; 02109 02110 02111 /*-------------------------------------. 02112 | yyacceptlab -- YYACCEPT comes here. | 02113 `-------------------------------------*/ 02114 yyacceptlab: 02115 yyresult = 0; 02116 goto yyreturn; 02117 02118 /*-----------------------------------. 02119 | yyabortlab -- YYABORT comes here. | 02120 `-----------------------------------*/ 02121 yyabortlab: 02122 yyresult = 1; 02123 goto yyreturn; 02124 02125 #if !defined(yyoverflow) || YYERROR_VERBOSE 02126 /*-------------------------------------------------. 02127 | yyexhaustedlab -- memory exhaustion comes here. | 02128 `-------------------------------------------------*/ 02129 yyexhaustedlab: 02130 yyerror (YY_("memory exhausted")); 02131 yyresult = 2; 02132 /* Fall through. */ 02133 #endif 02134 02135 yyreturn: 02136 if (yychar != YYEMPTY) 02137 yydestruct ("Cleanup: discarding lookahead", 02138 yytoken, &yylval); 02139 /* Do not reclaim the symbols of the rule which action triggered 02140 this YYABORT or YYACCEPT. */ 02141 YYPOPSTACK (yylen); 02142 YY_STACK_PRINT (yyss, yyssp); 02143 while (yyssp != yyss) 02144 { 02145 yydestruct ("Cleanup: popping", 02146 yystos[*yyssp], yyvsp); 02147 YYPOPSTACK (1); 02148 } 02149 #ifndef yyoverflow 02150 if (yyss != yyssa) 02151 YYSTACK_FREE (yyss); 02152 #endif 02153 #if YYERROR_VERBOSE 02154 if (yymsg != yymsgbuf) 02155 YYSTACK_FREE (yymsg); 02156 #endif 02157 /* Make sure YYID is used. */ 02158 return YYID (yyresult); 02159 } 02160 02161 02162 02163 /* Line 1684 of yacc.c */ 02164 #line 444 "parser.y" 02165 02166 02167 namespace khtml { 02168 namespace XPath { 02169 02170 Expression *khtmlParseXPathStatement( const DOM::DOMString &statement, int& ec ) 02171 { 02172 // qDebug() << "Parsing " << statement; 02173 xpathParseException = 0; 02174 _topExpr = 0; 02175 initTokenizer( statement ); 02176 yyparse(); 02177 02178 if (xpathParseException) 02179 ec = xpathParseException; 02180 return _topExpr; 02181 } 02182 02183 void khtmlxpathyyerror(const char *str) 02184 { 02185 // XXX Clean xpathyylval.str up to avoid leaking it. 02186 fprintf(stderr, "error: %s\n", str); 02187 xpathParseException = XPathException::toCode(INVALID_EXPRESSION_ERR); 02188 } 02189 02190 } // namespace XPath 02191 } // namespace khtml 02192 02193 // kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; 02194
KDE 4.6 API Reference