File indexing completed on 2024-12-08 12:44:48
0001 /* A Bison parser, made by GNU Bison 3.0.4. */ 0002 0003 /* Bison implementation for Yacc-like parsers in C 0004 0005 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 0006 0007 This program is free software: you can redistribute it and/or modify 0008 it under the terms of the GNU General Public License as published by 0009 the Free Software Foundation, either version 3 of the License, or 0010 (at your option) any later version. 0011 0012 This program is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 GNU General Public License for more details. 0016 0017 You should have received a copy of the GNU General Public License 0018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 0019 0020 /* As a special exception, you may create a larger work that contains 0021 part or all of the Bison parser skeleton and distribute that work 0022 under terms of your choice, so long as that work isn't itself a 0023 parser generator using the skeleton or a modified version thereof 0024 as a parser skeleton. Alternatively, if you modify or redistribute 0025 the parser skeleton itself, you may (at your option) remove this 0026 special exception, which will cause the skeleton and the resulting 0027 Bison output files to be licensed under the GNU General Public 0028 License without this special exception. 0029 0030 This special exception was added by the Free Software Foundation in 0031 version 2.2 of Bison. */ 0032 0033 /* C LALR(1) parser skeleton written by Richard Stallman, by 0034 simplifying the original so-called "semantic" parser. */ 0035 0036 /* All symbols defined below should begin with yy or YY, to avoid 0037 infringing on user name space. This should be done even for local 0038 variables, as they might otherwise be expanded by user macros. 0039 There are some unavoidable exceptions within include files to 0040 define necessary library symbols; they are noted "INFRINGES ON 0041 USER NAME SPACE" below. */ 0042 0043 /* Identify Bison output. */ 0044 #define YYBISON 1 0045 0046 /* Bison version. */ 0047 #define YYBISON_VERSION "3.0.4" 0048 0049 /* Skeleton name. */ 0050 #define YYSKELETON_NAME "yacc.c" 0051 0052 /* Pure parsers. */ 0053 #define YYPURE 0 0054 0055 /* Push parsers. */ 0056 #define YYPUSH 0 0057 0058 /* Pull parsers. */ 0059 #define YYPULL 1 0060 0061 0062 0063 0064 /* Copy the first part of user declarations. */ 0065 #line 435 "KDbSqlParser.y" /* yacc.c:339 */ 0066 0067 #include <stdio.h> 0068 #include <string.h> 0069 #include <string> 0070 #include <iostream> 0071 #include <limits.h> 0072 //! @todo OK? 0073 #ifdef Q_OS_WIN 0074 //workaround for bug on msvc 0075 # undef LLONG_MIN 0076 #endif 0077 #ifndef LLONG_MAX 0078 # define LLONG_MAX 0x7fffffffffffffffLL 0079 #endif 0080 #ifndef LLONG_MIN 0081 # define LLONG_MIN 0x8000000000000000LL 0082 #endif 0083 #ifndef LLONG_MAX 0084 # define ULLONG_MAX 0xffffffffffffffffLL 0085 #endif 0086 0087 #ifdef _WIN32 0088 # include <malloc.h> 0089 #endif 0090 0091 #include <QObject> 0092 #include <QVariant> 0093 #include <QPoint> 0094 0095 #include "KDbConnection.h" 0096 #include "KDbDateTime.h" 0097 #include "KDbExpression.h" 0098 #include "KDbField.h" 0099 #include "KDbOrderByColumn.h" 0100 #include "KDbParser.h" 0101 #include "KDbParser_p.h" 0102 #include "KDbQuerySchema.h" 0103 #include "KDbQuerySchema_p.h" 0104 #include "KDbSqlTypes.h" 0105 #include "KDbTableSchema.h" 0106 #include "kdb_debug.h" 0107 0108 struct OrderByColumnInternal; 0109 0110 #ifdef Q_OS_SOLARIS 0111 #include <alloca.h> 0112 #endif 0113 0114 QDebug operator<<(QDebug dbg, const KDbExpressionPtr& expr) 0115 { 0116 dbg.nospace() << expr.e; 0117 return dbg.space(); 0118 } 0119 0120 int yylex(); 0121 0122 #define YY_NO_UNPUT 0123 #define YYSTACK_USE_ALLOCA 1 0124 #define YYMAXDEPTH 255 0125 0126 extern "C" 0127 { 0128 int yywrap() 0129 { 0130 return 1; 0131 } 0132 } 0133 0134 0135 #line 136 "sqlparser.cpp" /* yacc.c:339 */ 0136 0137 # ifndef YY_NULLPTR 0138 # if defined __cplusplus && 201103L <= __cplusplus 0139 # define YY_NULLPTR nullptr 0140 # else 0141 # define YY_NULLPTR 0 0142 # endif 0143 # endif 0144 0145 /* Enabling verbose error messages. */ 0146 #ifdef YYERROR_VERBOSE 0147 # undef YYERROR_VERBOSE 0148 # define YYERROR_VERBOSE 1 0149 #else 0150 # define YYERROR_VERBOSE 0 0151 #endif 0152 0153 /* In a future release of Bison, this section will be replaced 0154 by #include "KDbSqlParser.tab.h". */ 0155 #ifndef YY_YY_KDBSQLPARSER_TAB_H_INCLUDED 0156 # define YY_YY_KDBSQLPARSER_TAB_H_INCLUDED 0157 /* Debug traces. */ 0158 #ifndef YYDEBUG 0159 # define YYDEBUG 0 0160 #endif 0161 #if YYDEBUG 0162 extern int yydebug; 0163 #endif 0164 0165 /* Token type. */ 0166 #ifndef YYTOKENTYPE 0167 # define YYTOKENTYPE 0168 enum yytokentype 0169 { 0170 SQL_TYPE = 258, 0171 AS = 259, 0172 AS_EMPTY = 260, 0173 ASC = 261, 0174 AUTO_INCREMENT = 262, 0175 BIT = 263, 0176 BITWISE_SHIFT_LEFT = 264, 0177 BITWISE_SHIFT_RIGHT = 265, 0178 BY = 266, 0179 CHARACTER_STRING_LITERAL = 267, 0180 CONCATENATION = 268, 0181 CREATE = 269, 0182 DESC = 270, 0183 DISTINCT = 271, 0184 DOUBLE_QUOTED_STRING = 272, 0185 FROM = 273, 0186 JOIN = 274, 0187 KEY = 275, 0188 LEFT = 276, 0189 LESS_OR_EQUAL = 277, 0190 GREATER_OR_EQUAL = 278, 0191 SQL_NULL = 279, 0192 SQL_IS = 280, 0193 SQL_IS_NULL = 281, 0194 SQL_IS_NOT_NULL = 282, 0195 ORDER = 283, 0196 PRIMARY = 284, 0197 SELECT = 285, 0198 INTEGER_CONST = 286, 0199 REAL_CONST = 287, 0200 RIGHT = 288, 0201 SQL_ON = 289, 0202 DATE_CONST = 290, 0203 DATETIME_CONST = 291, 0204 TIME_CONST = 292, 0205 TABLE = 293, 0206 IDENTIFIER = 294, 0207 IDENTIFIER_DOT_ASTERISK = 295, 0208 QUERY_PARAMETER = 296, 0209 VARCHAR = 297, 0210 WHERE = 298, 0211 SQL = 299, 0212 SQL_TRUE = 300, 0213 SQL_FALSE = 301, 0214 UNION = 302, 0215 SCAN_ERROR = 303, 0216 AND = 304, 0217 BETWEEN = 305, 0218 NOT_BETWEEN = 306, 0219 EXCEPT = 307, 0220 SQL_IN = 308, 0221 INTERSECT = 309, 0222 LIKE = 310, 0223 ILIKE = 311, 0224 NOT_LIKE = 312, 0225 NOT = 313, 0226 NOT_EQUAL = 314, 0227 NOT_EQUAL2 = 315, 0228 OR = 316, 0229 SIMILAR_TO = 317, 0230 NOT_SIMILAR_TO = 318, 0231 XOR = 319, 0232 UMINUS = 320, 0233 TABS_OR_SPACES = 321, 0234 DATE_TIME_INTEGER = 322, 0235 TIME_AM = 323, 0236 TIME_PM = 324 0237 }; 0238 #endif 0239 0240 /* Value type. */ 0241 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 0242 0243 union YYSTYPE 0244 { 0245 #line 505 "KDbSqlParser.y" /* yacc.c:355 */ 0246 0247 QString* stringValue; 0248 QByteArray* binaryValue; 0249 qint64 integerValue; 0250 bool booleanValue; 0251 KDbDate* dateValue; 0252 KDbYear* yearValue; 0253 KDbTime* timeValue; 0254 KDbTime::Period timePeriodValue; 0255 KDbDateTime* dateTimeValue; 0256 KDbOrderByColumn::SortOrder sortOrderValue; 0257 KDbField::Type colType; 0258 KDbField *field; 0259 KDbExpression *expr; 0260 KDbNArgExpression *exprList; 0261 KDbConstExpression *constExpression; 0262 KDbQuerySchema *querySchema; 0263 SelectOptionsInternal *selectOptions; 0264 QList<OrderByColumnInternal> *orderByColumns; 0265 QVariant *variantValue; 0266 0267 #line 268 "sqlparser.cpp" /* yacc.c:355 */ 0268 }; 0269 0270 typedef union YYSTYPE YYSTYPE; 0271 # define YYSTYPE_IS_TRIVIAL 1 0272 # define YYSTYPE_IS_DECLARED 1 0273 #endif 0274 0275 0276 extern YYSTYPE yylval; 0277 0278 int yyparse (void); 0279 0280 #endif /* !YY_YY_KDBSQLPARSER_TAB_H_INCLUDED */ 0281 0282 /* Copy the second part of user declarations. */ 0283 0284 #line 285 "sqlparser.cpp" /* yacc.c:358 */ 0285 0286 #ifdef short 0287 # undef short 0288 #endif 0289 0290 #ifdef YYTYPE_UINT8 0291 typedef YYTYPE_UINT8 yytype_uint8; 0292 #else 0293 typedef unsigned char yytype_uint8; 0294 #endif 0295 0296 #ifdef YYTYPE_INT8 0297 typedef YYTYPE_INT8 yytype_int8; 0298 #else 0299 typedef signed char yytype_int8; 0300 #endif 0301 0302 #ifdef YYTYPE_UINT16 0303 typedef YYTYPE_UINT16 yytype_uint16; 0304 #else 0305 typedef unsigned short int yytype_uint16; 0306 #endif 0307 0308 #ifdef YYTYPE_INT16 0309 typedef YYTYPE_INT16 yytype_int16; 0310 #else 0311 typedef short int yytype_int16; 0312 #endif 0313 0314 #ifndef YYSIZE_T 0315 # ifdef __SIZE_TYPE__ 0316 # define YYSIZE_T __SIZE_TYPE__ 0317 # elif defined size_t 0318 # define YYSIZE_T size_t 0319 # elif ! defined YYSIZE_T 0320 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 0321 # define YYSIZE_T size_t 0322 # else 0323 # define YYSIZE_T unsigned int 0324 # endif 0325 #endif 0326 0327 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 0328 0329 #ifndef YY_ 0330 # if defined YYENABLE_NLS && YYENABLE_NLS 0331 # if ENABLE_NLS 0332 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 0333 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 0334 # endif 0335 # endif 0336 # ifndef YY_ 0337 # define YY_(Msgid) Msgid 0338 # endif 0339 #endif 0340 0341 #ifndef YY_ATTRIBUTE 0342 # if (defined __GNUC__ \ 0343 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 0344 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 0345 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 0346 # else 0347 # define YY_ATTRIBUTE(Spec) /* empty */ 0348 # endif 0349 #endif 0350 0351 #ifndef YY_ATTRIBUTE_PURE 0352 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 0353 #endif 0354 0355 #ifndef YY_ATTRIBUTE_UNUSED 0356 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 0357 #endif 0358 0359 #if !defined _Noreturn \ 0360 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 0361 # if defined _MSC_VER && 1200 <= _MSC_VER 0362 # define _Noreturn __declspec (noreturn) 0363 # else 0364 # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 0365 # endif 0366 #endif 0367 0368 /* Suppress unused-variable warnings by "using" E. */ 0369 #if ! defined lint || defined __GNUC__ 0370 # define YYUSE(E) ((void) (E)) 0371 #else 0372 # define YYUSE(E) /* empty */ 0373 #endif 0374 0375 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 0376 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 0377 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 0378 _Pragma ("GCC diagnostic push") \ 0379 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 0380 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 0381 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 0382 _Pragma ("GCC diagnostic pop") 0383 #else 0384 # define YY_INITIAL_VALUE(Value) Value 0385 #endif 0386 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 0387 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 0388 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 0389 #endif 0390 #ifndef YY_INITIAL_VALUE 0391 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 0392 #endif 0393 0394 0395 #if ! defined yyoverflow || YYERROR_VERBOSE 0396 0397 /* The parser invokes alloca or malloc; define the necessary symbols. */ 0398 0399 # ifdef YYSTACK_USE_ALLOCA 0400 # if YYSTACK_USE_ALLOCA 0401 # ifdef __GNUC__ 0402 # define YYSTACK_ALLOC __builtin_alloca 0403 # elif defined __BUILTIN_VA_ARG_INCR 0404 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 0405 # elif defined _AIX 0406 # define YYSTACK_ALLOC __alloca 0407 # elif defined _MSC_VER 0408 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 0409 # define alloca _alloca 0410 # else 0411 # define YYSTACK_ALLOC alloca 0412 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 0413 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 0414 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 0415 # ifndef EXIT_SUCCESS 0416 # define EXIT_SUCCESS 0 0417 # endif 0418 # endif 0419 # endif 0420 # endif 0421 # endif 0422 0423 # ifdef YYSTACK_ALLOC 0424 /* Pacify GCC's 'empty if-body' warning. */ 0425 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 0426 # ifndef YYSTACK_ALLOC_MAXIMUM 0427 /* The OS might guarantee only one guard page at the bottom of the stack, 0428 and a page size can be as small as 4096 bytes. So we cannot safely 0429 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 0430 to allow for a few compiler-allocated temporary stack slots. */ 0431 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 0432 # endif 0433 # else 0434 # define YYSTACK_ALLOC YYMALLOC 0435 # define YYSTACK_FREE YYFREE 0436 # ifndef YYSTACK_ALLOC_MAXIMUM 0437 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 0438 # endif 0439 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 0440 && ! ((defined YYMALLOC || defined malloc) \ 0441 && (defined YYFREE || defined free))) 0442 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 0443 # ifndef EXIT_SUCCESS 0444 # define EXIT_SUCCESS 0 0445 # endif 0446 # endif 0447 # ifndef YYMALLOC 0448 # define YYMALLOC malloc 0449 # if ! defined malloc && ! defined EXIT_SUCCESS 0450 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 0451 # endif 0452 # endif 0453 # ifndef YYFREE 0454 # define YYFREE free 0455 # if ! defined free && ! defined EXIT_SUCCESS 0456 void free (void *); /* INFRINGES ON USER NAME SPACE */ 0457 # endif 0458 # endif 0459 # endif 0460 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 0461 0462 0463 #if (! defined yyoverflow \ 0464 && (! defined __cplusplus \ 0465 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 0466 0467 /* A type that is properly aligned for any stack member. */ 0468 union yyalloc 0469 { 0470 yytype_int16 yyss_alloc; 0471 YYSTYPE yyvs_alloc; 0472 }; 0473 0474 /* The size of the maximum gap between one aligned stack and the next. */ 0475 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 0476 0477 /* The size of an array large to enough to hold all stacks, each with 0478 N elements. */ 0479 # define YYSTACK_BYTES(N) \ 0480 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 0481 + YYSTACK_GAP_MAXIMUM) 0482 0483 # define YYCOPY_NEEDED 1 0484 0485 /* Relocate STACK from its old location to the new one. The 0486 local variables YYSIZE and YYSTACKSIZE give the old and new number of 0487 elements in the stack, and YYPTR gives the new location of the 0488 stack. Advance YYPTR to a properly aligned location for the next 0489 stack. */ 0490 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 0491 do \ 0492 { \ 0493 YYSIZE_T yynewbytes; \ 0494 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 0495 Stack = &yyptr->Stack_alloc; \ 0496 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 0497 yyptr += yynewbytes / sizeof (*yyptr); \ 0498 } \ 0499 while (0) 0500 0501 #endif 0502 0503 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 0504 /* Copy COUNT objects from SRC to DST. The source and destination do 0505 not overlap. */ 0506 # ifndef YYCOPY 0507 # if defined __GNUC__ && 1 < __GNUC__ 0508 # define YYCOPY(Dst, Src, Count) \ 0509 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 0510 # else 0511 # define YYCOPY(Dst, Src, Count) \ 0512 do \ 0513 { \ 0514 YYSIZE_T yyi; \ 0515 for (yyi = 0; yyi < (Count); yyi++) \ 0516 (Dst)[yyi] = (Src)[yyi]; \ 0517 } \ 0518 while (0) 0519 # endif 0520 # endif 0521 #endif /* !YYCOPY_NEEDED */ 0522 0523 /* YYFINAL -- State number of the termination state. */ 0524 #define YYFINAL 7 0525 /* YYLAST -- Last index in YYTABLE. */ 0526 #define YYLAST 231 0527 0528 /* YYNTOKENS -- Number of terminals. */ 0529 #define YYNTOKENS 88 0530 /* YYNNTS -- Number of nonterminals. */ 0531 #define YYNNTS 38 0532 /* YYNRULES -- Number of rules. */ 0533 #define YYNRULES 119 0534 /* YYNSTATES -- Number of states. */ 0535 #define YYNSTATES 201 0536 0537 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 0538 by yylex, with out-of-bounds checking. */ 0539 #define YYUNDEFTOK 2 0540 #define YYMAXUTOK 324 0541 0542 #define YYTRANSLATE(YYX) \ 0543 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 0544 0545 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 0546 as returned by yylex, without out-of-bounds checking. */ 0547 static const yytype_uint8 yytranslate[] = 0548 { 0549 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0552 2, 2, 2, 2, 2, 84, 2, 82, 78, 2, 0553 86, 87, 81, 76, 71, 77, 72, 80, 2, 2, 0554 2, 2, 2, 2, 2, 2, 2, 2, 85, 70, 0555 74, 75, 73, 2, 2, 2, 2, 2, 2, 2, 0556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0561 2, 2, 2, 2, 79, 2, 83, 2, 2, 2, 0562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0574 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 0575 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0576 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0577 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 0578 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 0579 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0580 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 0581 65, 66, 67, 68, 69 0582 }; 0583 0584 #if YYDEBUG 0585 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 0586 static const yytype_uint16 yyrline[] = 0587 { 0588 0, 564, 564, 574, 578, 579, 594, 693, 699, 706, 0589 711, 717, 723, 729, 738, 746, 753, 759, 767, 778, 0590 787, 796, 806, 814, 826, 832, 839, 846, 850, 857, 0591 862, 869, 875, 882, 887, 893, 899, 905, 911, 918, 0592 923, 929, 935, 941, 947, 953, 959, 965, 975, 986, 0593 991, 996, 1002, 1007, 1013, 1020, 1025, 1031, 1037, 1043, 0594 1049, 1056, 1061, 1067, 1073, 1080, 1086, 1091, 1096, 1101, 0595 1106, 1114, 1120, 1128, 1135, 1142, 1146, 1150, 1156, 1173, 0596 1179, 1185, 1191, 1198, 1202, 1210, 1218, 1229, 1235, 1241, 0597 1250, 1258, 1266, 1278, 1282, 1289, 1293, 1297, 1304, 1314, 0598 1323, 1327, 1334, 1340, 1349, 1394, 1400, 1409, 1437, 1447, 0599 1462, 1469, 1479, 1488, 1493, 1503, 1516, 1562, 1571, 1580 0600 }; 0601 #endif 0602 0603 #if YYDEBUG || YYERROR_VERBOSE || 0 0604 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 0605 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 0606 static const char *const yytname[] = 0607 { 0608 "$end", "error", "$undefined", "SQL_TYPE", "AS", "AS_EMPTY", "ASC", 0609 "AUTO_INCREMENT", "BIT", "BITWISE_SHIFT_LEFT", "BITWISE_SHIFT_RIGHT", 0610 "BY", "CHARACTER_STRING_LITERAL", "CONCATENATION", "CREATE", "DESC", 0611 "DISTINCT", "DOUBLE_QUOTED_STRING", "FROM", "JOIN", "KEY", "LEFT", 0612 "LESS_OR_EQUAL", "GREATER_OR_EQUAL", "SQL_NULL", "SQL_IS", "SQL_IS_NULL", 0613 "SQL_IS_NOT_NULL", "ORDER", "PRIMARY", "SELECT", "INTEGER_CONST", 0614 "REAL_CONST", "RIGHT", "SQL_ON", "DATE_CONST", "DATETIME_CONST", 0615 "TIME_CONST", "TABLE", "IDENTIFIER", "IDENTIFIER_DOT_ASTERISK", 0616 "QUERY_PARAMETER", "VARCHAR", "WHERE", "SQL", "SQL_TRUE", "SQL_FALSE", 0617 "UNION", "SCAN_ERROR", "AND", "BETWEEN", "NOT_BETWEEN", "EXCEPT", 0618 "SQL_IN", "INTERSECT", "LIKE", "ILIKE", "NOT_LIKE", "NOT", "NOT_EQUAL", 0619 "NOT_EQUAL2", "OR", "SIMILAR_TO", "NOT_SIMILAR_TO", "XOR", "UMINUS", 0620 "TABS_OR_SPACES", "DATE_TIME_INTEGER", "TIME_AM", "TIME_PM", "';'", 0621 "','", "'.'", "'>'", "'<'", "'='", "'+'", "'-'", "'&'", "'|'", "'/'", 0622 "'*'", "'%'", "'~'", "'#'", "':'", "'('", "')'", "$accept", 0623 "TopLevelStatement", "StatementList", "Statement", "SelectStatement", 0624 "Select", "SelectOptions", "WhereClause", "OrderByClause", 0625 "OrderByColumnId", "OrderByOption", "aExpr", "aExpr2", "aExpr3", 0626 "aExpr4", "aExpr5", "aExpr6", "aExpr7", "aExpr8", "aExpr9", "DateConst", 0627 "DateValue", "YearConst", "TimeConst", "TimeValue", "TimeMs", 0628 "TimePeriod", "DateTimeConst", "aExpr10", "aExprList", "aExprList2", 0629 "Tables", "FlatTableList", "FlatTable", "ColViews", "ColItem", 0630 "ColExpression", "ColWildCard", YY_NULLPTR 0631 }; 0632 #endif 0633 0634 # ifdef YYPRINT 0635 /* YYTOKNUM[NUM] -- (External) token number corresponding to the 0636 (internal) symbol number NUM (which must be that of a token). */ 0637 static const yytype_uint16 yytoknum[] = 0638 { 0639 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0640 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 0641 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 0642 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 0643 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 0644 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 0645 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 0646 59, 44, 46, 62, 60, 61, 43, 45, 38, 124, 0647 47, 42, 37, 126, 35, 58, 40, 41 0648 }; 0649 # endif 0650 0651 #define YYPACT_NINF -143 0652 0653 #define yypact_value_is_default(Yystate) \ 0654 (!!((Yystate) == (-143))) 0655 0656 #define YYTABLE_NINF -1 0657 0658 #define yytable_value_is_error(Yytable_value) \ 0659 0 0660 0661 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 0662 STATE-NUM. */ 0663 static const yytype_int16 yypact[] = 0664 { 0665 1, -143, 52, -143, -8, -143, 22, -143, 1, -143, 0666 -27, 25, -143, -143, -143, -60, -143, -143, -143, 126, 0667 126, 126, -143, 126, 44, 126, -143, -143, -16, 13, 0668 163, -143, 86, 0, 64, -143, -143, -143, -143, -11, 0669 29, -143, 10, -143, -143, 102, 11, -5, -143, -23, 0670 -2, -143, -21, -143, -143, -143, -143, -61, 4, 26, 0671 -43, 24, 20, 35, 126, 126, 126, 126, 126, 126, 0672 126, 126, -143, -143, 126, 126, 126, 126, 126, 126, 0673 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 0674 126, 126, 126, 96, 126, -143, 84, 78, -143, -11, 0675 74, -143, 38, 98, -143, 25, -143, -143, -143, 71, 0676 48, 110, 89, 99, -143, -143, 101, -143, 103, -143, 0677 -143, -143, -143, -143, -143, -143, -143, -143, -143, 114, 0678 120, -143, -143, -143, -143, -143, -143, -143, -143, -143, 0679 -143, -143, -143, -143, -143, -143, -143, -143, 58, -143, 0680 172, -143, -143, -143, -143, -143, -143, 126, -143, 111, 0681 -12, 112, 115, 121, 126, 126, -143, 128, 144, 12, 0682 58, -143, 63, 134, 137, -48, -143, 138, -143, -143, 0683 167, -143, -143, -143, 58, 136, -143, -143, -143, -143, 0684 139, -143, -143, -143, -143, -143, -143, 58, -48, -143, 0685 -143 0686 }; 0687 0688 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 0689 Performed when YYTABLE does not specify something else to do. Zero 0690 means the default is an error. */ 0691 static const yytype_uint8 yydefact[] = 0692 { 0693 0, 14, 0, 2, 4, 6, 7, 1, 5, 77, 0694 0, 0, 74, 78, 79, 70, 71, 75, 76, 0, 0695 0, 0, 118, 0, 0, 0, 116, 29, 33, 39, 0696 49, 52, 55, 61, 65, 80, 81, 82, 83, 10, 0697 8, 111, 112, 113, 3, 0, 107, 104, 106, 0, 0698 0, 72, 70, 69, 67, 66, 68, 87, 0, 0, 0699 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0700 0, 0, 50, 51, 0, 0, 0, 0, 0, 0, 0701 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0702 0, 0, 0, 0, 0, 12, 15, 0, 11, 9, 0703 0, 115, 0, 0, 108, 0, 73, 119, 101, 103, 0704 0, 0, 0, 0, 88, 89, 0, 84, 0, 90, 0705 99, 30, 31, 32, 37, 35, 34, 36, 38, 0, 0706 0, 44, 42, 43, 40, 41, 45, 46, 53, 54, 0707 57, 56, 58, 59, 60, 62, 63, 64, 0, 19, 0708 0, 110, 13, 114, 117, 109, 105, 0, 100, 0, 0709 94, 0, 0, 0, 0, 0, 26, 24, 16, 20, 0710 0, 102, 0, 0, 0, 97, 98, 0, 47, 48, 0711 0, 18, 27, 28, 0, 21, 17, 87, 86, 93, 0712 94, 95, 96, 91, 85, 25, 22, 0, 97, 23, 0713 92 0714 }; 0715 0716 /* YYPGOTO[NTERM-NUM]. */ 0717 static const yytype_int16 yypgoto[] = 0718 { 0719 -143, -143, 200, -143, -143, -143, -29, 47, -142, -143, 0720 -143, -25, 87, 106, -73, -143, 32, 107, 90, 108, 0721 -143, -143, 45, -143, 105, 34, 21, -143, -143, -143, 0722 70, 188, -143, 124, -143, 133, 186, -143 0723 }; 0724 0725 /* YYDEFGOTO[NTERM-NUM]. */ 0726 static const yytype_int16 yydefgoto[] = 0727 { 0728 -1, 2, 3, 4, 5, 6, 95, 96, 168, 169, 0729 185, 26, 27, 28, 29, 30, 31, 32, 33, 34, 0730 35, 60, 61, 36, 62, 175, 193, 37, 38, 51, 0731 110, 39, 47, 48, 40, 41, 42, 43 0732 }; 0733 0734 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 0735 positive, shift that token. If negative, reduce the rule whose 0736 number is the opposite. If YYTABLE_NINF, syntax error. */ 0737 static const yytype_uint8 yytable[] = 0738 { 0739 63, 129, 130, 131, 132, 133, 134, 135, 136, 137, 0740 9, 98, 49, 85, 100, 103, 106, 93, 182, 112, 0741 191, 192, 12, 116, 113, 109, 50, 183, 186, 13, 0742 14, 1, 94, 64, 9, 67, 68, 52, 10, 16, 0743 11, 117, 196, 17, 18, 65, 12, 11, 66, 101, 0744 104, 111, 7, 13, 14, 199, 19, 93, 107, 45, 0745 173, 15, 8, 16, 46, 50, 105, 17, 18, 149, 0746 152, 114, 94, 174, 20, 21, 86, 87, 88, 89, 0747 19, 23, 24, 184, 25, 108, 69, 70, 71, 166, 0748 9, 178, 179, 115, 10, 83, 84, 167, 20, 21, 0749 97, 118, 12, 22, 119, 23, 24, 148, 25, 13, 0750 14, 57, 150, 153, 9, 138, 139, 15, 10, 16, 0751 58, 59, 120, 17, 18, 154, 12, 53, 54, 55, 0752 187, 56, 109, 13, 14, 158, 19, 155, 9, 58, 0753 59, 52, 157, 16, 90, 91, 92, 17, 18, 106, 0754 12, 121, 122, 123, 20, 21, 159, 13, 14, 22, 0755 19, 23, 24, 164, 25, 52, 160, 16, 161, 165, 0756 163, 17, 18, 124, 125, 126, 127, 128, 20, 21, 0757 145, 146, 147, 170, 19, 23, 24, 94, 25, 72, 0758 73, 172, 140, 141, 142, 143, 144, 113, 177, 176, 0759 180, 189, 20, 21, 190, 194, 195, 197, 44, 23, 0760 24, 173, 25, 74, 75, 181, 76, 188, 77, 200, 0761 78, 162, 79, 80, 198, 81, 82, 171, 99, 156, 0762 151, 102 0763 }; 0764 0765 static const yytype_uint8 yycheck[] = 0766 { 0767 25, 74, 75, 76, 77, 78, 79, 80, 81, 82, 0768 12, 40, 72, 13, 4, 4, 39, 28, 6, 80, 0769 68, 69, 24, 66, 85, 50, 86, 15, 170, 31, 0770 32, 30, 43, 49, 12, 22, 23, 39, 16, 41, 0771 18, 84, 184, 45, 46, 61, 24, 18, 64, 39, 0772 39, 72, 0, 31, 32, 197, 58, 28, 81, 86, 0773 72, 39, 70, 41, 39, 86, 71, 45, 46, 94, 0774 99, 67, 43, 85, 76, 77, 76, 77, 78, 79, 0775 58, 83, 84, 71, 86, 87, 73, 74, 75, 31, 0776 12, 164, 165, 67, 16, 9, 10, 39, 76, 77, 0777 71, 77, 24, 81, 84, 83, 84, 11, 86, 31, 0778 32, 67, 28, 39, 12, 83, 84, 39, 16, 41, 0779 76, 77, 87, 45, 46, 87, 24, 19, 20, 21, 0780 67, 23, 157, 31, 32, 87, 58, 39, 12, 76, 0781 77, 39, 71, 41, 80, 81, 82, 45, 46, 39, 0782 24, 64, 65, 66, 76, 77, 67, 31, 32, 81, 0783 58, 83, 84, 49, 86, 39, 67, 41, 67, 49, 0784 67, 45, 46, 67, 68, 69, 70, 71, 76, 77, 0785 90, 91, 92, 11, 58, 83, 84, 43, 86, 26, 0786 27, 80, 85, 86, 87, 88, 89, 85, 77, 84, 0787 72, 67, 76, 77, 67, 67, 39, 71, 8, 83, 0788 84, 72, 86, 50, 51, 168, 53, 172, 55, 198, 0789 57, 116, 59, 60, 190, 62, 63, 157, 40, 105, 0790 97, 45 0791 }; 0792 0793 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 0794 symbol of state STATE-NUM. */ 0795 static const yytype_uint8 yystos[] = 0796 { 0797 0, 30, 89, 90, 91, 92, 93, 0, 70, 12, 0798 16, 18, 24, 31, 32, 39, 41, 45, 46, 58, 0799 76, 77, 81, 83, 84, 86, 99, 100, 101, 102, 0800 103, 104, 105, 106, 107, 108, 111, 115, 116, 119, 0801 122, 123, 124, 125, 90, 86, 39, 120, 121, 72, 0802 86, 117, 39, 107, 107, 107, 107, 67, 76, 77, 0803 109, 110, 112, 99, 49, 61, 64, 22, 23, 73, 0804 74, 75, 26, 27, 50, 51, 53, 55, 57, 59, 0805 60, 62, 63, 9, 10, 13, 76, 77, 78, 79, 0806 80, 81, 82, 28, 43, 94, 95, 71, 94, 119, 0807 4, 39, 124, 4, 39, 71, 39, 81, 87, 99, 0808 118, 72, 80, 85, 67, 67, 66, 84, 77, 84, 0809 87, 100, 100, 100, 101, 101, 101, 101, 101, 102, 0810 102, 102, 102, 102, 102, 102, 102, 102, 104, 104, 0811 105, 105, 105, 105, 105, 106, 106, 106, 11, 99, 0812 28, 123, 94, 39, 87, 39, 121, 71, 87, 67, 0813 67, 67, 112, 67, 49, 49, 31, 39, 96, 97, 0814 11, 118, 80, 72, 85, 113, 84, 77, 102, 102, 0815 72, 95, 6, 15, 71, 98, 96, 67, 110, 67, 0816 67, 68, 69, 114, 67, 39, 96, 71, 113, 96, 0817 114 0818 }; 0819 0820 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 0821 static const yytype_uint8 yyr1[] = 0822 { 0823 0, 88, 89, 90, 90, 90, 91, 92, 92, 92, 0824 92, 92, 92, 92, 93, 94, 94, 94, 94, 95, 0825 96, 96, 96, 96, 97, 97, 97, 98, 98, 99, 0826 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 0827 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0828 103, 103, 103, 104, 104, 104, 105, 105, 105, 105, 0829 105, 105, 106, 106, 106, 106, 107, 107, 107, 107, 0830 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 0831 107, 107, 107, 107, 108, 109, 109, 110, 110, 110, 0832 111, 112, 112, 113, 113, 114, 114, 114, 115, 116, 0833 117, 117, 118, 118, 119, 120, 120, 121, 121, 121, 0834 122, 122, 123, 123, 123, 123, 124, 124, 125, 125 0835 }; 0836 0837 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 0838 static const yytype_uint8 yyr2[] = 0839 { 0840 0, 2, 1, 3, 1, 2, 1, 1, 2, 3, 0841 2, 3, 3, 4, 1, 1, 3, 4, 4, 2, 0842 1, 2, 3, 4, 1, 3, 1, 1, 1, 1, 0843 3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 0844 3, 3, 3, 3, 3, 3, 3, 5, 5, 1, 0845 2, 2, 1, 3, 3, 1, 3, 3, 3, 3, 0846 3, 1, 3, 3, 3, 1, 2, 2, 2, 2, 0847 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 0848 1, 1, 1, 1, 3, 5, 5, 1, 2, 2, 0849 3, 5, 7, 2, 0, 1, 1, 0, 5, 3, 0850 3, 2, 3, 1, 2, 3, 1, 1, 2, 3, 0851 3, 1, 1, 1, 3, 2, 1, 4, 1, 3 0852 }; 0853 0854 0855 #define yyerrok (yyerrstatus = 0) 0856 #define yyclearin (yychar = YYEMPTY) 0857 #define YYEMPTY (-2) 0858 #define YYEOF 0 0859 0860 #define YYACCEPT goto yyacceptlab 0861 #define YYABORT goto yyabortlab 0862 #define YYERROR goto yyerrorlab 0863 0864 0865 #define YYRECOVERING() (!!yyerrstatus) 0866 0867 #define YYBACKUP(Token, Value) \ 0868 do \ 0869 if (yychar == YYEMPTY) \ 0870 { \ 0871 yychar = (Token); \ 0872 yylval = (Value); \ 0873 YYPOPSTACK (yylen); \ 0874 yystate = *yyssp; \ 0875 goto yybackup; \ 0876 } \ 0877 else \ 0878 { \ 0879 yyerror (YY_("syntax error: cannot back up")); \ 0880 YYERROR; \ 0881 } \ 0882 while (0) 0883 0884 /* Error token number */ 0885 #define YYTERROR 1 0886 #define YYERRCODE 256 0887 0888 0889 0890 /* Enable debugging if requested. */ 0891 #if YYDEBUG 0892 0893 # ifndef YYFPRINTF 0894 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 0895 # define YYFPRINTF fprintf 0896 # endif 0897 0898 # define YYDPRINTF(Args) \ 0899 do { \ 0900 if (yydebug) \ 0901 YYFPRINTF Args; \ 0902 } while (0) 0903 0904 /* This macro is provided for backward compatibility. */ 0905 #ifndef YY_LOCATION_PRINT 0906 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 0907 #endif 0908 0909 0910 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 0911 do { \ 0912 if (yydebug) \ 0913 { \ 0914 YYFPRINTF (stderr, "%s ", Title); \ 0915 yy_symbol_print (stderr, \ 0916 Type, Value); \ 0917 YYFPRINTF (stderr, "\n"); \ 0918 } \ 0919 } while (0) 0920 0921 0922 /*----------------------------------------. 0923 | Print this symbol's value on YYOUTPUT. | 0924 `----------------------------------------*/ 0925 0926 static void 0927 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 0928 { 0929 FILE *yyo = yyoutput; 0930 YYUSE (yyo); 0931 if (!yyvaluep) 0932 return; 0933 # ifdef YYPRINT 0934 if (yytype < YYNTOKENS) 0935 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 0936 # endif 0937 YYUSE (yytype); 0938 } 0939 0940 0941 /*--------------------------------. 0942 | Print this symbol on YYOUTPUT. | 0943 `--------------------------------*/ 0944 0945 static void 0946 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 0947 { 0948 YYFPRINTF (yyoutput, "%s %s (", 0949 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 0950 0951 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 0952 YYFPRINTF (yyoutput, ")"); 0953 } 0954 0955 /*------------------------------------------------------------------. 0956 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 0957 | TOP (included). | 0958 `------------------------------------------------------------------*/ 0959 0960 static void 0961 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 0962 { 0963 YYFPRINTF (stderr, "Stack now"); 0964 for (; yybottom <= yytop; yybottom++) 0965 { 0966 int yybot = *yybottom; 0967 YYFPRINTF (stderr, " %d", yybot); 0968 } 0969 YYFPRINTF (stderr, "\n"); 0970 } 0971 0972 # define YY_STACK_PRINT(Bottom, Top) \ 0973 do { \ 0974 if (yydebug) \ 0975 yy_stack_print ((Bottom), (Top)); \ 0976 } while (0) 0977 0978 0979 /*------------------------------------------------. 0980 | Report that the YYRULE is going to be reduced. | 0981 `------------------------------------------------*/ 0982 0983 static void 0984 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) 0985 { 0986 unsigned long int yylno = yyrline[yyrule]; 0987 int yynrhs = yyr2[yyrule]; 0988 int yyi; 0989 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 0990 yyrule - 1, yylno); 0991 /* The symbols being reduced. */ 0992 for (yyi = 0; yyi < yynrhs; yyi++) 0993 { 0994 YYFPRINTF (stderr, " $%d = ", yyi + 1); 0995 yy_symbol_print (stderr, 0996 yystos[yyssp[yyi + 1 - yynrhs]], 0997 &(yyvsp[(yyi + 1) - (yynrhs)]) 0998 ); 0999 YYFPRINTF (stderr, "\n"); 1000 } 1001 } 1002 1003 # define YY_REDUCE_PRINT(Rule) \ 1004 do { \ 1005 if (yydebug) \ 1006 yy_reduce_print (yyssp, yyvsp, Rule); \ 1007 } while (0) 1008 1009 /* Nonzero means print parse trace. It is left uninitialized so that 1010 multiple parsers can coexist. */ 1011 int yydebug; 1012 #else /* !YYDEBUG */ 1013 # define YYDPRINTF(Args) 1014 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1015 # define YY_STACK_PRINT(Bottom, Top) 1016 # define YY_REDUCE_PRINT(Rule) 1017 #endif /* !YYDEBUG */ 1018 1019 1020 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1021 #ifndef YYINITDEPTH 1022 # define YYINITDEPTH 200 1023 #endif 1024 1025 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1026 if the built-in stack extension method is used). 1027 1028 Do not make this value too large; the results are undefined if 1029 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1030 evaluated with infinite-precision integer arithmetic. */ 1031 1032 #ifndef YYMAXDEPTH 1033 # define YYMAXDEPTH 10000 1034 #endif 1035 1036 1037 #if YYERROR_VERBOSE 1038 1039 # ifndef yystrlen 1040 # if defined __GLIBC__ && defined _STRING_H 1041 # define yystrlen strlen 1042 # else 1043 /* Return the length of YYSTR. */ 1044 static YYSIZE_T 1045 yystrlen (const char *yystr) 1046 { 1047 YYSIZE_T yylen; 1048 for (yylen = 0; yystr[yylen]; yylen++) 1049 continue; 1050 return yylen; 1051 } 1052 # endif 1053 # endif 1054 1055 # ifndef yystpcpy 1056 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1057 # define yystpcpy stpcpy 1058 # else 1059 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1060 YYDEST. */ 1061 static char * 1062 yystpcpy (char *yydest, const char *yysrc) 1063 { 1064 char *yyd = yydest; 1065 const char *yys = yysrc; 1066 1067 while ((*yyd++ = *yys++) != '\0') 1068 continue; 1069 1070 return yyd - 1; 1071 } 1072 # endif 1073 # endif 1074 1075 # ifndef yytnamerr 1076 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1077 quotes and backslashes, so that it's suitable for yyerror. The 1078 heuristic is that double-quoting is unnecessary unless the string 1079 contains an apostrophe, a comma, or backslash (other than 1080 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1081 null, do not copy; instead, return the length of what the result 1082 would have been. */ 1083 static YYSIZE_T 1084 yytnamerr (char *yyres, const char *yystr) 1085 { 1086 if (*yystr == '"') 1087 { 1088 YYSIZE_T yyn = 0; 1089 char const *yyp = yystr; 1090 1091 for (;;) 1092 switch (*++yyp) 1093 { 1094 case '\'': 1095 case ',': 1096 goto do_not_strip_quotes; 1097 1098 case '\\': 1099 if (*++yyp != '\\') 1100 goto do_not_strip_quotes; 1101 /* Fall through. */ 1102 default: 1103 if (yyres) 1104 yyres[yyn] = *yyp; 1105 yyn++; 1106 break; 1107 1108 case '"': 1109 if (yyres) 1110 yyres[yyn] = '\0'; 1111 return yyn; 1112 } 1113 do_not_strip_quotes: ; 1114 } 1115 1116 if (! yyres) 1117 return yystrlen (yystr); 1118 1119 return yystpcpy (yyres, yystr) - yyres; 1120 } 1121 # endif 1122 1123 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 1124 about the unexpected token YYTOKEN for the state stack whose top is 1125 YYSSP. 1126 1127 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 1128 not large enough to hold the message. In that case, also set 1129 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 1130 required number of bytes is too large to store. */ 1131 static int 1132 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1133 yytype_int16 *yyssp, int yytoken) 1134 { 1135 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 1136 YYSIZE_T yysize = yysize0; 1137 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1138 /* Internationalized format string. */ 1139 const char *yyformat = YY_NULLPTR; 1140 /* Arguments of yyformat. */ 1141 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1142 /* Number of reported tokens (one for the "unexpected", one per 1143 "expected"). */ 1144 int yycount = 0; 1145 1146 /* There are many possibilities here to consider: 1147 - If this state is a consistent state with a default action, then 1148 the only way this function was invoked is if the default action 1149 is an error action. In that case, don't check for expected 1150 tokens because there are none. 1151 - The only way there can be no lookahead present (in yychar) is if 1152 this state is a consistent state with a default action. Thus, 1153 detecting the absence of a lookahead is sufficient to determine 1154 that there is no unexpected or expected token to report. In that 1155 case, just report a simple "syntax error". 1156 - Don't assume there isn't a lookahead just because this state is a 1157 consistent state with a default action. There might have been a 1158 previous inconsistent state, consistent state with a non-default 1159 action, or user semantic action that manipulated yychar. 1160 - Of course, the expected token list depends on states to have 1161 correct lookahead information, and it depends on the parser not 1162 to perform extra reductions after fetching a lookahead from the 1163 scanner and before detecting a syntax error. Thus, state merging 1164 (from LALR or IELR) and default reductions corrupt the expected 1165 token list. However, the list is correct for canonical LR with 1166 one exception: it will still contain any token that will not be 1167 accepted due to an error action in a later state. 1168 */ 1169 if (yytoken != YYEMPTY) 1170 { 1171 int yyn = yypact[*yyssp]; 1172 yyarg[yycount++] = yytname[yytoken]; 1173 if (!yypact_value_is_default (yyn)) 1174 { 1175 /* Start YYX at -YYN if negative to avoid negative indexes in 1176 YYCHECK. In other words, skip the first -YYN actions for 1177 this state because they are default actions. */ 1178 int yyxbegin = yyn < 0 ? -yyn : 0; 1179 /* Stay within bounds of both yycheck and yytname. */ 1180 int yychecklim = YYLAST - yyn + 1; 1181 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1182 int yyx; 1183 1184 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1185 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1186 && !yytable_value_is_error (yytable[yyx + yyn])) 1187 { 1188 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1189 { 1190 yycount = 1; 1191 yysize = yysize0; 1192 break; 1193 } 1194 yyarg[yycount++] = yytname[yyx]; 1195 { 1196 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 1197 if (! (yysize <= yysize1 1198 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1199 return 2; 1200 yysize = yysize1; 1201 } 1202 } 1203 } 1204 } 1205 1206 switch (yycount) 1207 { 1208 # define YYCASE_(N, S) \ 1209 case N: \ 1210 yyformat = S; \ 1211 break 1212 YYCASE_(0, YY_("syntax error")); 1213 YYCASE_(1, YY_("syntax error, unexpected %s")); 1214 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1215 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1216 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1217 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1218 # undef YYCASE_ 1219 } 1220 1221 { 1222 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1223 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1224 return 2; 1225 yysize = yysize1; 1226 } 1227 1228 if (*yymsg_alloc < yysize) 1229 { 1230 *yymsg_alloc = 2 * yysize; 1231 if (! (yysize <= *yymsg_alloc 1232 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1233 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1234 return 1; 1235 } 1236 1237 /* Avoid sprintf, as that infringes on the user's name space. 1238 Don't have undefined behavior even if the translation 1239 produced a string with the wrong number of "%s"s. */ 1240 { 1241 char *yyp = *yymsg; 1242 int yyi = 0; 1243 while ((*yyp = *yyformat) != '\0') 1244 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1245 { 1246 yyp += yytnamerr (yyp, yyarg[yyi++]); 1247 yyformat += 2; 1248 } 1249 else 1250 { 1251 yyp++; 1252 yyformat++; 1253 } 1254 } 1255 return 0; 1256 } 1257 #endif /* YYERROR_VERBOSE */ 1258 1259 /*-----------------------------------------------. 1260 | Release the memory associated to this symbol. | 1261 `-----------------------------------------------*/ 1262 1263 static void 1264 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1265 { 1266 YYUSE (yyvaluep); 1267 if (!yymsg) 1268 yymsg = "Deleting"; 1269 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1270 1271 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1272 YYUSE (yytype); 1273 YY_IGNORE_MAYBE_UNINITIALIZED_END 1274 } 1275 1276 1277 1278 1279 /* The lookahead symbol. */ 1280 int yychar; 1281 1282 /* The semantic value of the lookahead symbol. */ 1283 YYSTYPE yylval; 1284 /* Number of syntax errors so far. */ 1285 int yynerrs; 1286 1287 1288 /*----------. 1289 | yyparse. | 1290 `----------*/ 1291 1292 int 1293 yyparse (void) 1294 { 1295 int yystate; 1296 /* Number of tokens to shift before error messages enabled. */ 1297 int yyerrstatus; 1298 1299 /* The stacks and their tools: 1300 'yyss': related to states. 1301 'yyvs': related to semantic values. 1302 1303 Refer to the stacks through separate pointers, to allow yyoverflow 1304 to reallocate them elsewhere. */ 1305 1306 /* The state stack. */ 1307 yytype_int16 yyssa[YYINITDEPTH]; 1308 yytype_int16 *yyss; 1309 yytype_int16 *yyssp; 1310 1311 /* The semantic value stack. */ 1312 YYSTYPE yyvsa[YYINITDEPTH]; 1313 YYSTYPE *yyvs; 1314 YYSTYPE *yyvsp; 1315 1316 YYSIZE_T yystacksize; 1317 1318 int yyn; 1319 int yyresult; 1320 /* Lookahead token as an internal (translated) token number. */ 1321 int yytoken = 0; 1322 /* The variables used to return semantic value and location from the 1323 action routines. */ 1324 YYSTYPE yyval; 1325 1326 #if YYERROR_VERBOSE 1327 /* Buffer for error messages, and its allocated size. */ 1328 char yymsgbuf[128]; 1329 char *yymsg = yymsgbuf; 1330 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1331 #endif 1332 1333 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1334 1335 /* The number of symbols on the RHS of the reduced rule. 1336 Keep to zero when no symbol should be popped. */ 1337 int yylen = 0; 1338 1339 yyssp = yyss = yyssa; 1340 yyvsp = yyvs = yyvsa; 1341 yystacksize = YYINITDEPTH; 1342 1343 YYDPRINTF ((stderr, "Starting parse\n")); 1344 1345 yystate = 0; 1346 yyerrstatus = 0; 1347 yynerrs = 0; 1348 yychar = YYEMPTY; /* Cause a token to be read. */ 1349 goto yysetstate; 1350 1351 /*------------------------------------------------------------. 1352 | yynewstate -- Push a new state, which is found in yystate. | 1353 `------------------------------------------------------------*/ 1354 yynewstate: 1355 /* In all cases, when you get here, the value and location stacks 1356 have just been pushed. So pushing a state here evens the stacks. */ 1357 yyssp++; 1358 1359 yysetstate: 1360 *yyssp = yystate; 1361 1362 if (yyss + yystacksize - 1 <= yyssp) 1363 { 1364 /* Get the current used size of the three stacks, in elements. */ 1365 YYSIZE_T yysize = yyssp - yyss + 1; 1366 1367 #ifdef yyoverflow 1368 { 1369 /* Give user a chance to reallocate the stack. Use copies of 1370 these so that the &'s don't force the real ones into 1371 memory. */ 1372 YYSTYPE *yyvs1 = yyvs; 1373 yytype_int16 *yyss1 = yyss; 1374 1375 /* Each stack pointer address is followed by the size of the 1376 data in use in that stack, in bytes. This used to be a 1377 conditional around just the two extra args, but that might 1378 be undefined if yyoverflow is a macro. */ 1379 yyoverflow (YY_("memory exhausted"), 1380 &yyss1, yysize * sizeof (*yyssp), 1381 &yyvs1, yysize * sizeof (*yyvsp), 1382 &yystacksize); 1383 1384 yyss = yyss1; 1385 yyvs = yyvs1; 1386 } 1387 #else /* no yyoverflow */ 1388 # ifndef YYSTACK_RELOCATE 1389 goto yyexhaustedlab; 1390 # else 1391 /* Extend the stack our own way. */ 1392 if (YYMAXDEPTH <= yystacksize) 1393 goto yyexhaustedlab; 1394 yystacksize *= 2; 1395 if (YYMAXDEPTH < yystacksize) 1396 yystacksize = YYMAXDEPTH; 1397 1398 { 1399 yytype_int16 *yyss1 = yyss; 1400 union yyalloc *yyptr = 1401 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1402 if (! yyptr) 1403 goto yyexhaustedlab; 1404 YYSTACK_RELOCATE (yyss_alloc, yyss); 1405 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1406 # undef YYSTACK_RELOCATE 1407 if (yyss1 != yyssa) 1408 YYSTACK_FREE (yyss1); 1409 } 1410 # endif 1411 #endif /* no yyoverflow */ 1412 1413 yyssp = yyss + yysize - 1; 1414 yyvsp = yyvs + yysize - 1; 1415 1416 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1417 (unsigned long int) yystacksize)); 1418 1419 if (yyss + yystacksize - 1 <= yyssp) 1420 YYABORT; 1421 } 1422 1423 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1424 1425 if (yystate == YYFINAL) 1426 YYACCEPT; 1427 1428 goto yybackup; 1429 1430 /*-----------. 1431 | yybackup. | 1432 `-----------*/ 1433 yybackup: 1434 1435 /* Do appropriate processing given the current state. Read a 1436 lookahead token if we need one and don't already have one. */ 1437 1438 /* First try to decide what to do without reference to lookahead token. */ 1439 yyn = yypact[yystate]; 1440 if (yypact_value_is_default (yyn)) 1441 goto yydefault; 1442 1443 /* Not known => get a lookahead token if don't already have one. */ 1444 1445 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1446 if (yychar == YYEMPTY) 1447 { 1448 YYDPRINTF ((stderr, "Reading a token: ")); 1449 yychar = yylex (); 1450 } 1451 1452 if (yychar <= YYEOF) 1453 { 1454 yychar = yytoken = YYEOF; 1455 YYDPRINTF ((stderr, "Now at end of input.\n")); 1456 } 1457 else 1458 { 1459 yytoken = YYTRANSLATE (yychar); 1460 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1461 } 1462 1463 /* If the proper action on seeing token YYTOKEN is to reduce or to 1464 detect an error, take that action. */ 1465 yyn += yytoken; 1466 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1467 goto yydefault; 1468 yyn = yytable[yyn]; 1469 if (yyn <= 0) 1470 { 1471 if (yytable_value_is_error (yyn)) 1472 goto yyerrlab; 1473 yyn = -yyn; 1474 goto yyreduce; 1475 } 1476 1477 /* Count tokens shifted since error; after three, turn off error 1478 status. */ 1479 if (yyerrstatus) 1480 yyerrstatus--; 1481 1482 /* Shift the lookahead token. */ 1483 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1484 1485 /* Discard the shifted token. */ 1486 yychar = YYEMPTY; 1487 1488 yystate = yyn; 1489 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1490 *++yyvsp = yylval; 1491 YY_IGNORE_MAYBE_UNINITIALIZED_END 1492 1493 goto yynewstate; 1494 1495 1496 /*-----------------------------------------------------------. 1497 | yydefault -- do the default action for the current state. | 1498 `-----------------------------------------------------------*/ 1499 yydefault: 1500 yyn = yydefact[yystate]; 1501 if (yyn == 0) 1502 goto yyerrlab; 1503 goto yyreduce; 1504 1505 1506 /*-----------------------------. 1507 | yyreduce -- Do a reduction. | 1508 `-----------------------------*/ 1509 yyreduce: 1510 /* yyn is the number of a rule to reduce with. */ 1511 yylen = yyr2[yyn]; 1512 1513 /* If YYLEN is nonzero, implement the default value of the action: 1514 '$$ = $1'. 1515 1516 Otherwise, the following line sets YYVAL to garbage. 1517 This behavior is undocumented and Bison 1518 users should not rely upon it. Assigning to YYVAL 1519 unconditionally makes the parser a bit smaller, and it avoids a 1520 GCC warning that YYVAL may be used uninitialized. */ 1521 yyval = yyvsp[1-yylen]; 1522 1523 1524 YY_REDUCE_PRINT (yyn); 1525 switch (yyn) 1526 { 1527 case 2: 1528 #line 565 "KDbSqlParser.y" /* yacc.c:1646 */ 1529 { 1530 //todo: multiple statements 1531 //todo: not only "select" statements 1532 KDbParserPrivate::get(globalParser)->setStatementType(KDbParser::Select); 1533 KDbParserPrivate::get(globalParser)->setQuerySchema((yyvsp[0].querySchema)); 1534 } 1535 #line 1536 "sqlparser.cpp" /* yacc.c:1646 */ 1536 break; 1537 1538 case 3: 1539 #line 575 "KDbSqlParser.y" /* yacc.c:1646 */ 1540 { 1541 //todo: multiple statements 1542 } 1543 #line 1544 "sqlparser.cpp" /* yacc.c:1646 */ 1544 break; 1545 1546 case 5: 1547 #line 580 "KDbSqlParser.y" /* yacc.c:1646 */ 1548 { 1549 (yyval.querySchema) = (yyvsp[-1].querySchema); 1550 } 1551 #line 1552 "sqlparser.cpp" /* yacc.c:1646 */ 1552 break; 1553 1554 case 6: 1555 #line 595 "KDbSqlParser.y" /* yacc.c:1646 */ 1556 { 1557 (yyval.querySchema) = (yyvsp[0].querySchema); 1558 } 1559 #line 1560 "sqlparser.cpp" /* yacc.c:1646 */ 1560 break; 1561 1562 case 7: 1563 #line 694 "KDbSqlParser.y" /* yacc.c:1646 */ 1564 { 1565 sqlParserDebug() << "Select"; 1566 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[0].querySchema), nullptr ))) 1567 YYABORT; 1568 } 1569 #line 1570 "sqlparser.cpp" /* yacc.c:1646 */ 1570 break; 1571 1572 case 8: 1573 #line 700 "KDbSqlParser.y" /* yacc.c:1646 */ 1574 { 1575 sqlParserDebug() << "Select ColViews=" << *(yyvsp[0].exprList); 1576 1577 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-1].querySchema), (yyvsp[0].exprList) ))) 1578 YYABORT; 1579 } 1580 #line 1581 "sqlparser.cpp" /* yacc.c:1646 */ 1581 break; 1582 1583 case 9: 1584 #line 707 "KDbSqlParser.y" /* yacc.c:1646 */ 1585 { 1586 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), (yyvsp[-1].exprList), (yyvsp[0].exprList) ))) 1587 YYABORT; 1588 } 1589 #line 1590 "sqlparser.cpp" /* yacc.c:1646 */ 1590 break; 1591 1592 case 10: 1593 #line 712 "KDbSqlParser.y" /* yacc.c:1646 */ 1594 { 1595 sqlParserDebug() << "Select ColViews Tables"; 1596 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-1].querySchema), nullptr, (yyvsp[0].exprList) ))) 1597 YYABORT; 1598 } 1599 #line 1600 "sqlparser.cpp" /* yacc.c:1646 */ 1600 break; 1601 1602 case 11: 1603 #line 718 "KDbSqlParser.y" /* yacc.c:1646 */ 1604 { 1605 sqlParserDebug() << "Select ColViews Conditions"; 1606 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), (yyvsp[-1].exprList), nullptr, (yyvsp[0].selectOptions) ))) 1607 YYABORT; 1608 } 1609 #line 1610 "sqlparser.cpp" /* yacc.c:1646 */ 1610 break; 1611 1612 case 12: 1613 #line 724 "KDbSqlParser.y" /* yacc.c:1646 */ 1614 { 1615 sqlParserDebug() << "Select Tables SelectOptions"; 1616 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), nullptr, (yyvsp[-1].exprList), (yyvsp[0].selectOptions) ))) 1617 YYABORT; 1618 } 1619 #line 1620 "sqlparser.cpp" /* yacc.c:1646 */ 1620 break; 1621 1622 case 13: 1623 #line 730 "KDbSqlParser.y" /* yacc.c:1646 */ 1624 { 1625 sqlParserDebug() << "Select ColViews Tables SelectOptions"; 1626 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-3].querySchema), (yyvsp[-2].exprList), (yyvsp[-1].exprList), (yyvsp[0].selectOptions) ))) 1627 YYABORT; 1628 } 1629 #line 1630 "sqlparser.cpp" /* yacc.c:1646 */ 1630 break; 1631 1632 case 14: 1633 #line 739 "KDbSqlParser.y" /* yacc.c:1646 */ 1634 { 1635 sqlParserDebug() << "SELECT"; 1636 (yyval.querySchema) = KDbParserPrivate::get(globalParser)->createQuery(); 1637 } 1638 #line 1639 "sqlparser.cpp" /* yacc.c:1646 */ 1639 break; 1640 1641 case 15: 1642 #line 747 "KDbSqlParser.y" /* yacc.c:1646 */ 1643 { 1644 sqlParserDebug() << "WhereClause"; 1645 (yyval.selectOptions) = new SelectOptionsInternal; 1646 (yyval.selectOptions)->whereExpr = *(yyvsp[0].expr); 1647 delete (yyvsp[0].expr); 1648 } 1649 #line 1650 "sqlparser.cpp" /* yacc.c:1646 */ 1650 break; 1651 1652 case 16: 1653 #line 754 "KDbSqlParser.y" /* yacc.c:1646 */ 1654 { 1655 sqlParserDebug() << "OrderByClause"; 1656 (yyval.selectOptions) = new SelectOptionsInternal; 1657 (yyval.selectOptions)->orderByColumns = (yyvsp[0].orderByColumns); 1658 } 1659 #line 1660 "sqlparser.cpp" /* yacc.c:1646 */ 1660 break; 1661 1662 case 17: 1663 #line 760 "KDbSqlParser.y" /* yacc.c:1646 */ 1664 { 1665 sqlParserDebug() << "WhereClause ORDER BY OrderByClause"; 1666 (yyval.selectOptions) = new SelectOptionsInternal; 1667 (yyval.selectOptions)->whereExpr = *(yyvsp[-3].expr); 1668 delete (yyvsp[-3].expr); 1669 (yyval.selectOptions)->orderByColumns = (yyvsp[0].orderByColumns); 1670 } 1671 #line 1672 "sqlparser.cpp" /* yacc.c:1646 */ 1672 break; 1673 1674 case 18: 1675 #line 768 "KDbSqlParser.y" /* yacc.c:1646 */ 1676 { 1677 sqlParserDebug() << "OrderByClause WhereClause"; 1678 (yyval.selectOptions) = new SelectOptionsInternal; 1679 (yyval.selectOptions)->whereExpr = *(yyvsp[0].expr); 1680 delete (yyvsp[0].expr); 1681 (yyval.selectOptions)->orderByColumns = (yyvsp[-1].orderByColumns); 1682 } 1683 #line 1684 "sqlparser.cpp" /* yacc.c:1646 */ 1684 break; 1685 1686 case 19: 1687 #line 779 "KDbSqlParser.y" /* yacc.c:1646 */ 1688 { 1689 (yyval.expr) = (yyvsp[0].expr); 1690 } 1691 #line 1692 "sqlparser.cpp" /* yacc.c:1646 */ 1692 break; 1693 1694 case 20: 1695 #line 788 "KDbSqlParser.y" /* yacc.c:1646 */ 1696 { 1697 sqlParserDebug() << "ORDER BY IDENTIFIER"; 1698 (yyval.orderByColumns) = new QList<OrderByColumnInternal>; 1699 OrderByColumnInternal orderByColumn; 1700 orderByColumn.setColumnByNameOrNumber( *(yyvsp[0].variantValue) ); 1701 (yyval.orderByColumns)->append( orderByColumn ); 1702 delete (yyvsp[0].variantValue); 1703 } 1704 #line 1705 "sqlparser.cpp" /* yacc.c:1646 */ 1705 break; 1706 1707 case 21: 1708 #line 797 "KDbSqlParser.y" /* yacc.c:1646 */ 1709 { 1710 sqlParserDebug() << "ORDER BY IDENTIFIER OrderByOption"; 1711 (yyval.orderByColumns) = new QList<OrderByColumnInternal>; 1712 OrderByColumnInternal orderByColumn; 1713 orderByColumn.setColumnByNameOrNumber( *(yyvsp[-1].variantValue) ); 1714 orderByColumn.order = (yyvsp[0].sortOrderValue); 1715 (yyval.orderByColumns)->append( orderByColumn ); 1716 delete (yyvsp[-1].variantValue); 1717 } 1718 #line 1719 "sqlparser.cpp" /* yacc.c:1646 */ 1719 break; 1720 1721 case 22: 1722 #line 807 "KDbSqlParser.y" /* yacc.c:1646 */ 1723 { 1724 (yyval.orderByColumns) = (yyvsp[0].orderByColumns); 1725 OrderByColumnInternal orderByColumn; 1726 orderByColumn.setColumnByNameOrNumber( *(yyvsp[-2].variantValue) ); 1727 (yyval.orderByColumns)->append( orderByColumn ); 1728 delete (yyvsp[-2].variantValue); 1729 } 1730 #line 1731 "sqlparser.cpp" /* yacc.c:1646 */ 1731 break; 1732 1733 case 23: 1734 #line 815 "KDbSqlParser.y" /* yacc.c:1646 */ 1735 { 1736 (yyval.orderByColumns) = (yyvsp[0].orderByColumns); 1737 OrderByColumnInternal orderByColumn; 1738 orderByColumn.setColumnByNameOrNumber( *(yyvsp[-3].variantValue) ); 1739 orderByColumn.order = (yyvsp[-2].sortOrderValue); 1740 (yyval.orderByColumns)->append( orderByColumn ); 1741 delete (yyvsp[-3].variantValue); 1742 } 1743 #line 1744 "sqlparser.cpp" /* yacc.c:1646 */ 1744 break; 1745 1746 case 24: 1747 #line 827 "KDbSqlParser.y" /* yacc.c:1646 */ 1748 { 1749 (yyval.variantValue) = new QVariant( *(yyvsp[0].stringValue) ); 1750 sqlParserDebug() << "OrderByColumnId: " << *(yyval.variantValue); 1751 delete (yyvsp[0].stringValue); 1752 } 1753 #line 1754 "sqlparser.cpp" /* yacc.c:1646 */ 1754 break; 1755 1756 case 25: 1757 #line 833 "KDbSqlParser.y" /* yacc.c:1646 */ 1758 { 1759 (yyval.variantValue) = new QVariant( *(yyvsp[-2].stringValue) + QLatin1Char('.') + *(yyvsp[0].stringValue) ); 1760 sqlParserDebug() << "OrderByColumnId: " << *(yyval.variantValue); 1761 delete (yyvsp[-2].stringValue); 1762 delete (yyvsp[0].stringValue); 1763 } 1764 #line 1765 "sqlparser.cpp" /* yacc.c:1646 */ 1765 break; 1766 1767 case 26: 1768 #line 840 "KDbSqlParser.y" /* yacc.c:1646 */ 1769 { 1770 (yyval.variantValue) = new QVariant((yyvsp[0].integerValue)); 1771 sqlParserDebug() << "OrderByColumnId: " << *(yyval.variantValue); 1772 } 1773 #line 1774 "sqlparser.cpp" /* yacc.c:1646 */ 1774 break; 1775 1776 case 27: 1777 #line 847 "KDbSqlParser.y" /* yacc.c:1646 */ 1778 { 1779 (yyval.sortOrderValue) = KDbOrderByColumn::SortOrder::Ascending; 1780 } 1781 #line 1782 "sqlparser.cpp" /* yacc.c:1646 */ 1782 break; 1783 1784 case 28: 1785 #line 851 "KDbSqlParser.y" /* yacc.c:1646 */ 1786 { 1787 (yyval.sortOrderValue) = KDbOrderByColumn::SortOrder::Descending; 1788 } 1789 #line 1790 "sqlparser.cpp" /* yacc.c:1646 */ 1790 break; 1791 1792 case 30: 1793 #line 863 "KDbSqlParser.y" /* yacc.c:1646 */ 1794 { 1795 // sqlParserDebug() << "AND " << $3.debugString(); 1796 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::AND, *(yyvsp[0].expr)); 1797 delete (yyvsp[-2].expr); 1798 delete (yyvsp[0].expr); 1799 } 1800 #line 1801 "sqlparser.cpp" /* yacc.c:1646 */ 1801 break; 1802 1803 case 31: 1804 #line 870 "KDbSqlParser.y" /* yacc.c:1646 */ 1805 { 1806 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::OR, *(yyvsp[0].expr)); 1807 delete (yyvsp[-2].expr); 1808 delete (yyvsp[0].expr); 1809 } 1810 #line 1811 "sqlparser.cpp" /* yacc.c:1646 */ 1811 break; 1812 1813 case 32: 1814 #line 876 "KDbSqlParser.y" /* yacc.c:1646 */ 1815 { 1816 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::XOR, *(yyvsp[0].expr)); 1817 delete (yyvsp[-2].expr); 1818 delete (yyvsp[0].expr); 1819 } 1820 #line 1821 "sqlparser.cpp" /* yacc.c:1646 */ 1821 break; 1822 1823 case 34: 1824 #line 888 "KDbSqlParser.y" /* yacc.c:1646 */ 1825 { 1826 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '>', *(yyvsp[0].expr)); 1827 delete (yyvsp[-2].expr); 1828 delete (yyvsp[0].expr); 1829 } 1830 #line 1831 "sqlparser.cpp" /* yacc.c:1646 */ 1831 break; 1832 1833 case 35: 1834 #line 894 "KDbSqlParser.y" /* yacc.c:1646 */ 1835 { 1836 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::GREATER_OR_EQUAL, *(yyvsp[0].expr)); 1837 delete (yyvsp[-2].expr); 1838 delete (yyvsp[0].expr); 1839 } 1840 #line 1841 "sqlparser.cpp" /* yacc.c:1646 */ 1841 break; 1842 1843 case 36: 1844 #line 900 "KDbSqlParser.y" /* yacc.c:1646 */ 1845 { 1846 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '<', *(yyvsp[0].expr)); 1847 delete (yyvsp[-2].expr); 1848 delete (yyvsp[0].expr); 1849 } 1850 #line 1851 "sqlparser.cpp" /* yacc.c:1646 */ 1851 break; 1852 1853 case 37: 1854 #line 906 "KDbSqlParser.y" /* yacc.c:1646 */ 1855 { 1856 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::LESS_OR_EQUAL, *(yyvsp[0].expr)); 1857 delete (yyvsp[-2].expr); 1858 delete (yyvsp[0].expr); 1859 } 1860 #line 1861 "sqlparser.cpp" /* yacc.c:1646 */ 1861 break; 1862 1863 case 38: 1864 #line 912 "KDbSqlParser.y" /* yacc.c:1646 */ 1865 { 1866 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '=', *(yyvsp[0].expr)); 1867 delete (yyvsp[-2].expr); 1868 delete (yyvsp[0].expr); 1869 } 1870 #line 1871 "sqlparser.cpp" /* yacc.c:1646 */ 1871 break; 1872 1873 case 40: 1874 #line 924 "KDbSqlParser.y" /* yacc.c:1646 */ 1875 { 1876 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_EQUAL, *(yyvsp[0].expr)); 1877 delete (yyvsp[-2].expr); 1878 delete (yyvsp[0].expr); 1879 } 1880 #line 1881 "sqlparser.cpp" /* yacc.c:1646 */ 1881 break; 1882 1883 case 41: 1884 #line 930 "KDbSqlParser.y" /* yacc.c:1646 */ 1885 { 1886 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_EQUAL2, *(yyvsp[0].expr)); 1887 delete (yyvsp[-2].expr); 1888 delete (yyvsp[0].expr); 1889 } 1890 #line 1891 "sqlparser.cpp" /* yacc.c:1646 */ 1891 break; 1892 1893 case 42: 1894 #line 936 "KDbSqlParser.y" /* yacc.c:1646 */ 1895 { 1896 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::LIKE, *(yyvsp[0].expr)); 1897 delete (yyvsp[-2].expr); 1898 delete (yyvsp[0].expr); 1899 } 1900 #line 1901 "sqlparser.cpp" /* yacc.c:1646 */ 1901 break; 1902 1903 case 43: 1904 #line 942 "KDbSqlParser.y" /* yacc.c:1646 */ 1905 { 1906 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_LIKE, *(yyvsp[0].expr)); 1907 delete (yyvsp[-2].expr); 1908 delete (yyvsp[0].expr); 1909 } 1910 #line 1911 "sqlparser.cpp" /* yacc.c:1646 */ 1911 break; 1912 1913 case 44: 1914 #line 948 "KDbSqlParser.y" /* yacc.c:1646 */ 1915 { 1916 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::SQL_IN, *(yyvsp[0].expr)); 1917 delete (yyvsp[-2].expr); 1918 delete (yyvsp[0].expr); 1919 } 1920 #line 1921 "sqlparser.cpp" /* yacc.c:1646 */ 1921 break; 1922 1923 case 45: 1924 #line 954 "KDbSqlParser.y" /* yacc.c:1646 */ 1925 { 1926 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::SIMILAR_TO, *(yyvsp[0].expr)); 1927 delete (yyvsp[-2].expr); 1928 delete (yyvsp[0].expr); 1929 } 1930 #line 1931 "sqlparser.cpp" /* yacc.c:1646 */ 1931 break; 1932 1933 case 46: 1934 #line 960 "KDbSqlParser.y" /* yacc.c:1646 */ 1935 { 1936 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_SIMILAR_TO, *(yyvsp[0].expr)); 1937 delete (yyvsp[-2].expr); 1938 delete (yyvsp[0].expr); 1939 } 1940 #line 1941 "sqlparser.cpp" /* yacc.c:1646 */ 1941 break; 1942 1943 case 47: 1944 #line 966 "KDbSqlParser.y" /* yacc.c:1646 */ 1945 { 1946 (yyval.expr) = new KDbNArgExpression(KDb::RelationalExpression, KDbToken::BETWEEN_AND); 1947 (yyval.expr)->toNArg().append( *(yyvsp[-4].expr) ); 1948 (yyval.expr)->toNArg().append( *(yyvsp[-2].expr) ); 1949 (yyval.expr)->toNArg().append( *(yyvsp[0].expr) ); 1950 delete (yyvsp[-4].expr); 1951 delete (yyvsp[-2].expr); 1952 delete (yyvsp[0].expr); 1953 } 1954 #line 1955 "sqlparser.cpp" /* yacc.c:1646 */ 1955 break; 1956 1957 case 48: 1958 #line 976 "KDbSqlParser.y" /* yacc.c:1646 */ 1959 { 1960 (yyval.expr) = new KDbNArgExpression(KDb::RelationalExpression, KDbToken::NOT_BETWEEN_AND); 1961 (yyval.expr)->toNArg().append( *(yyvsp[-4].expr) ); 1962 (yyval.expr)->toNArg().append( *(yyvsp[-2].expr) ); 1963 (yyval.expr)->toNArg().append( *(yyvsp[0].expr) ); 1964 delete (yyvsp[-4].expr); 1965 delete (yyvsp[-2].expr); 1966 delete (yyvsp[0].expr); 1967 } 1968 #line 1969 "sqlparser.cpp" /* yacc.c:1646 */ 1969 break; 1970 1971 case 50: 1972 #line 992 "KDbSqlParser.y" /* yacc.c:1646 */ 1973 { 1974 (yyval.expr) = new KDbUnaryExpression( KDbToken::SQL_IS_NULL, *(yyvsp[-1].expr) ); 1975 delete (yyvsp[-1].expr); 1976 } 1977 #line 1978 "sqlparser.cpp" /* yacc.c:1646 */ 1978 break; 1979 1980 case 51: 1981 #line 997 "KDbSqlParser.y" /* yacc.c:1646 */ 1982 { 1983 (yyval.expr) = new KDbUnaryExpression( KDbToken::SQL_IS_NOT_NULL, *(yyvsp[-1].expr) ); 1984 delete (yyvsp[-1].expr); 1985 } 1986 #line 1987 "sqlparser.cpp" /* yacc.c:1646 */ 1987 break; 1988 1989 case 53: 1990 #line 1008 "KDbSqlParser.y" /* yacc.c:1646 */ 1991 { 1992 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::BITWISE_SHIFT_LEFT, *(yyvsp[0].expr)); 1993 delete (yyvsp[-2].expr); 1994 delete (yyvsp[0].expr); 1995 } 1996 #line 1997 "sqlparser.cpp" /* yacc.c:1646 */ 1997 break; 1998 1999 case 54: 2000 #line 1014 "KDbSqlParser.y" /* yacc.c:1646 */ 2001 { 2002 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::BITWISE_SHIFT_RIGHT, *(yyvsp[0].expr)); 2003 delete (yyvsp[-2].expr); 2004 delete (yyvsp[0].expr); 2005 } 2006 #line 2007 "sqlparser.cpp" /* yacc.c:1646 */ 2007 break; 2008 2009 case 56: 2010 #line 1026 "KDbSqlParser.y" /* yacc.c:1646 */ 2011 { 2012 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '+', *(yyvsp[0].expr)); 2013 delete (yyvsp[-2].expr); 2014 delete (yyvsp[0].expr); 2015 } 2016 #line 2017 "sqlparser.cpp" /* yacc.c:1646 */ 2017 break; 2018 2019 case 57: 2020 #line 1032 "KDbSqlParser.y" /* yacc.c:1646 */ 2021 { 2022 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::CONCATENATION, *(yyvsp[0].expr)); 2023 delete (yyvsp[-2].expr); 2024 delete (yyvsp[0].expr); 2025 } 2026 #line 2027 "sqlparser.cpp" /* yacc.c:1646 */ 2027 break; 2028 2029 case 58: 2030 #line 1038 "KDbSqlParser.y" /* yacc.c:1646 */ 2031 { 2032 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '-', *(yyvsp[0].expr)); 2033 delete (yyvsp[-2].expr); 2034 delete (yyvsp[0].expr); 2035 } 2036 #line 2037 "sqlparser.cpp" /* yacc.c:1646 */ 2037 break; 2038 2039 case 59: 2040 #line 1044 "KDbSqlParser.y" /* yacc.c:1646 */ 2041 { 2042 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '&', *(yyvsp[0].expr)); 2043 delete (yyvsp[-2].expr); 2044 delete (yyvsp[0].expr); 2045 } 2046 #line 2047 "sqlparser.cpp" /* yacc.c:1646 */ 2047 break; 2048 2049 case 60: 2050 #line 1050 "KDbSqlParser.y" /* yacc.c:1646 */ 2051 { 2052 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '|', *(yyvsp[0].expr)); 2053 delete (yyvsp[-2].expr); 2054 delete (yyvsp[0].expr); 2055 } 2056 #line 2057 "sqlparser.cpp" /* yacc.c:1646 */ 2057 break; 2058 2059 case 62: 2060 #line 1062 "KDbSqlParser.y" /* yacc.c:1646 */ 2061 { 2062 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '/', *(yyvsp[0].expr)); 2063 delete (yyvsp[-2].expr); 2064 delete (yyvsp[0].expr); 2065 } 2066 #line 2067 "sqlparser.cpp" /* yacc.c:1646 */ 2067 break; 2068 2069 case 63: 2070 #line 1068 "KDbSqlParser.y" /* yacc.c:1646 */ 2071 { 2072 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '*', *(yyvsp[0].expr)); 2073 delete (yyvsp[-2].expr); 2074 delete (yyvsp[0].expr); 2075 } 2076 #line 2077 "sqlparser.cpp" /* yacc.c:1646 */ 2077 break; 2078 2079 case 64: 2080 #line 1074 "KDbSqlParser.y" /* yacc.c:1646 */ 2081 { 2082 (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '%', *(yyvsp[0].expr)); 2083 delete (yyvsp[-2].expr); 2084 delete (yyvsp[0].expr); 2085 } 2086 #line 2087 "sqlparser.cpp" /* yacc.c:1646 */ 2087 break; 2088 2089 case 66: 2090 #line 1087 "KDbSqlParser.y" /* yacc.c:1646 */ 2091 { 2092 (yyval.expr) = new KDbUnaryExpression( '-', *(yyvsp[0].expr) ); 2093 delete (yyvsp[0].expr); 2094 } 2095 #line 2096 "sqlparser.cpp" /* yacc.c:1646 */ 2096 break; 2097 2098 case 67: 2099 #line 1092 "KDbSqlParser.y" /* yacc.c:1646 */ 2100 { 2101 (yyval.expr) = new KDbUnaryExpression( '+', *(yyvsp[0].expr) ); 2102 delete (yyvsp[0].expr); 2103 } 2104 #line 2105 "sqlparser.cpp" /* yacc.c:1646 */ 2105 break; 2106 2107 case 68: 2108 #line 1097 "KDbSqlParser.y" /* yacc.c:1646 */ 2109 { 2110 (yyval.expr) = new KDbUnaryExpression( '~', *(yyvsp[0].expr) ); 2111 delete (yyvsp[0].expr); 2112 } 2113 #line 2114 "sqlparser.cpp" /* yacc.c:1646 */ 2114 break; 2115 2116 case 69: 2117 #line 1102 "KDbSqlParser.y" /* yacc.c:1646 */ 2118 { 2119 (yyval.expr) = new KDbUnaryExpression( KDbToken::NOT, *(yyvsp[0].expr) ); 2120 delete (yyvsp[0].expr); 2121 } 2122 #line 2123 "sqlparser.cpp" /* yacc.c:1646 */ 2123 break; 2124 2125 case 70: 2126 #line 1107 "KDbSqlParser.y" /* yacc.c:1646 */ 2127 { 2128 (yyval.expr) = new KDbVariableExpression( *(yyvsp[0].stringValue) ); 2129 2130 //! @todo simplify this later if that's 'only one field name' expression 2131 sqlParserDebug() << " + identifier: " << *(yyvsp[0].stringValue); 2132 delete (yyvsp[0].stringValue); 2133 } 2134 #line 2135 "sqlparser.cpp" /* yacc.c:1646 */ 2135 break; 2136 2137 case 71: 2138 #line 1115 "KDbSqlParser.y" /* yacc.c:1646 */ 2139 { 2140 (yyval.expr) = new KDbQueryParameterExpression( *(yyvsp[0].stringValue) ); 2141 sqlParserDebug() << " + query parameter:" << *(yyval.expr); 2142 delete (yyvsp[0].stringValue); 2143 } 2144 #line 2145 "sqlparser.cpp" /* yacc.c:1646 */ 2145 break; 2146 2147 case 72: 2148 #line 1121 "KDbSqlParser.y" /* yacc.c:1646 */ 2149 { 2150 sqlParserDebug() << " + function:" << *(yyvsp[-1].stringValue) << "(" << *(yyvsp[0].exprList) << ")"; 2151 (yyval.expr) = new KDbFunctionExpression(*(yyvsp[-1].stringValue), *(yyvsp[0].exprList)); 2152 delete (yyvsp[-1].stringValue); 2153 delete (yyvsp[0].exprList); 2154 } 2155 #line 2156 "sqlparser.cpp" /* yacc.c:1646 */ 2156 break; 2157 2158 case 73: 2159 #line 1129 "KDbSqlParser.y" /* yacc.c:1646 */ 2160 { 2161 (yyval.expr) = new KDbVariableExpression( *(yyvsp[-2].stringValue) + QLatin1Char('.') + *(yyvsp[0].stringValue) ); 2162 sqlParserDebug() << " + identifier.identifier:" << *(yyvsp[-2].stringValue) << "." << *(yyvsp[0].stringValue); 2163 delete (yyvsp[-2].stringValue); 2164 delete (yyvsp[0].stringValue); 2165 } 2166 #line 2167 "sqlparser.cpp" /* yacc.c:1646 */ 2167 break; 2168 2169 case 74: 2170 #line 1136 "KDbSqlParser.y" /* yacc.c:1646 */ 2171 { 2172 (yyval.expr) = new KDbConstExpression( KDbToken::SQL_NULL, QVariant() ); 2173 sqlParserDebug() << " + NULL"; 2174 // $$ = new KDbField(); 2175 //$$->setName(QString::null); 2176 } 2177 #line 2178 "sqlparser.cpp" /* yacc.c:1646 */ 2178 break; 2179 2180 case 75: 2181 #line 1143 "KDbSqlParser.y" /* yacc.c:1646 */ 2182 { 2183 (yyval.expr) = new KDbConstExpression( KDbToken::SQL_TRUE, true ); 2184 } 2185 #line 2186 "sqlparser.cpp" /* yacc.c:1646 */ 2186 break; 2187 2188 case 76: 2189 #line 1147 "KDbSqlParser.y" /* yacc.c:1646 */ 2190 { 2191 (yyval.expr) = new KDbConstExpression( KDbToken::SQL_FALSE, false ); 2192 } 2193 #line 2194 "sqlparser.cpp" /* yacc.c:1646 */ 2194 break; 2195 2196 case 77: 2197 #line 1151 "KDbSqlParser.y" /* yacc.c:1646 */ 2198 { 2199 (yyval.expr) = new KDbConstExpression( KDbToken::CHARACTER_STRING_LITERAL, *(yyvsp[0].stringValue) ); 2200 sqlParserDebug() << " + constant " << (yyvsp[0].stringValue); 2201 delete (yyvsp[0].stringValue); 2202 } 2203 #line 2204 "sqlparser.cpp" /* yacc.c:1646 */ 2204 break; 2205 2206 case 78: 2207 #line 1157 "KDbSqlParser.y" /* yacc.c:1646 */ 2208 { 2209 QVariant val; 2210 if ((yyvsp[0].integerValue) <= INT_MAX && (yyvsp[0].integerValue) >= INT_MIN) 2211 val = (int)(yyvsp[0].integerValue); 2212 else if ((yyvsp[0].integerValue) <= UINT_MAX && (yyvsp[0].integerValue) >= 0) 2213 val = (uint)(yyvsp[0].integerValue); 2214 else if ((yyvsp[0].integerValue) <= LLONG_MAX && (yyvsp[0].integerValue) >= LLONG_MIN) 2215 val = (qint64)(yyvsp[0].integerValue); 2216 2217 // if ($1 < ULLONG_MAX) 2218 // val = (quint64)$1; 2219 //! @todo ok? 2220 2221 (yyval.expr) = new KDbConstExpression( KDbToken::INTEGER_CONST, val ); 2222 sqlParserDebug() << " + int constant: " << val.toString(); 2223 } 2224 #line 2225 "sqlparser.cpp" /* yacc.c:1646 */ 2225 break; 2226 2227 case 79: 2228 #line 1174 "KDbSqlParser.y" /* yacc.c:1646 */ 2229 { 2230 (yyval.expr) = new KDbConstExpression( KDbToken::REAL_CONST, *(yyvsp[0].binaryValue) ); 2231 sqlParserDebug() << " + real constant: " << *(yyvsp[0].binaryValue); 2232 delete (yyvsp[0].binaryValue); 2233 } 2234 #line 2235 "sqlparser.cpp" /* yacc.c:1646 */ 2235 break; 2236 2237 case 80: 2238 #line 1180 "KDbSqlParser.y" /* yacc.c:1646 */ 2239 { 2240 (yyval.expr) = new KDbConstExpression(KDbToken::DATE_CONST, QVariant::fromValue(*(yyvsp[0].dateValue))); 2241 sqlParserDebug() << " + date constant:" << *(yyvsp[0].dateValue); 2242 delete (yyvsp[0].dateValue); 2243 } 2244 #line 2245 "sqlparser.cpp" /* yacc.c:1646 */ 2245 break; 2246 2247 case 81: 2248 #line 1186 "KDbSqlParser.y" /* yacc.c:1646 */ 2249 { 2250 (yyval.expr) = new KDbConstExpression(KDbToken::TIME_CONST, QVariant::fromValue(*(yyvsp[0].timeValue))); 2251 sqlParserDebug() << " + time constant:" << *(yyvsp[0].timeValue); 2252 delete (yyvsp[0].timeValue); 2253 } 2254 #line 2255 "sqlparser.cpp" /* yacc.c:1646 */ 2255 break; 2256 2257 case 82: 2258 #line 1192 "KDbSqlParser.y" /* yacc.c:1646 */ 2259 { 2260 (yyval.expr) = new KDbConstExpression(KDbToken::DATETIME_CONST, QVariant::fromValue(*(yyvsp[0].dateTimeValue))); 2261 sqlParserDebug() << " + datetime constant:" << *(yyvsp[0].dateTimeValue); 2262 delete (yyvsp[0].dateTimeValue); 2263 } 2264 #line 2265 "sqlparser.cpp" /* yacc.c:1646 */ 2265 break; 2266 2267 case 84: 2268 #line 1203 "KDbSqlParser.y" /* yacc.c:1646 */ 2269 { 2270 (yyval.dateValue) = (yyvsp[-1].dateValue); 2271 sqlParserDebug() << "DateConst:" << *(yyval.dateValue); 2272 } 2273 #line 2274 "sqlparser.cpp" /* yacc.c:1646 */ 2274 break; 2275 2276 case 85: 2277 #line 1211 "KDbSqlParser.y" /* yacc.c:1646 */ 2278 { 2279 (yyval.dateValue) = new KDbDate(*(yyvsp[-4].yearValue), *(yyvsp[-2].binaryValue), *(yyvsp[0].binaryValue)); 2280 sqlParserDebug() << "DateValue:" << *(yyval.dateValue); 2281 delete (yyvsp[-4].yearValue); 2282 delete (yyvsp[-2].binaryValue); 2283 delete (yyvsp[0].binaryValue); 2284 } 2285 #line 2286 "sqlparser.cpp" /* yacc.c:1646 */ 2286 break; 2287 2288 case 86: 2289 #line 1219 "KDbSqlParser.y" /* yacc.c:1646 */ 2290 { 2291 (yyval.dateValue) = new KDbDate(*(yyvsp[0].yearValue), *(yyvsp[-4].binaryValue), *(yyvsp[-2].binaryValue)); 2292 sqlParserDebug() << "DateValue:" << *(yyval.dateValue); 2293 delete (yyvsp[-4].binaryValue); 2294 delete (yyvsp[-2].binaryValue); 2295 delete (yyvsp[0].yearValue); 2296 } 2297 #line 2298 "sqlparser.cpp" /* yacc.c:1646 */ 2298 break; 2299 2300 case 87: 2301 #line 1230 "KDbSqlParser.y" /* yacc.c:1646 */ 2302 { 2303 (yyval.yearValue) = new KDbYear(KDbYear::Sign::None, *(yyvsp[0].binaryValue)); 2304 sqlParserDebug() << "YearConst:" << *(yyval.yearValue); 2305 delete (yyvsp[0].binaryValue); 2306 } 2307 #line 2308 "sqlparser.cpp" /* yacc.c:1646 */ 2308 break; 2309 2310 case 88: 2311 #line 1236 "KDbSqlParser.y" /* yacc.c:1646 */ 2312 { 2313 (yyval.yearValue) = new KDbYear(KDbYear::Sign::Plus, *(yyvsp[0].binaryValue)); 2314 sqlParserDebug() << "YearConst:" << *(yyval.yearValue); 2315 delete (yyvsp[0].binaryValue); 2316 } 2317 #line 2318 "sqlparser.cpp" /* yacc.c:1646 */ 2318 break; 2319 2320 case 89: 2321 #line 1242 "KDbSqlParser.y" /* yacc.c:1646 */ 2322 { 2323 (yyval.yearValue) = new KDbYear(KDbYear::Sign::Minus, *(yyvsp[0].binaryValue)); 2324 sqlParserDebug() << "YearConst:" << *(yyval.yearValue); 2325 delete (yyvsp[0].binaryValue); 2326 } 2327 #line 2328 "sqlparser.cpp" /* yacc.c:1646 */ 2328 break; 2329 2330 case 90: 2331 #line 1251 "KDbSqlParser.y" /* yacc.c:1646 */ 2332 { 2333 (yyval.timeValue) = (yyvsp[-1].timeValue); 2334 sqlParserDebug() << "TimeConst:" << *(yyval.timeValue); 2335 } 2336 #line 2337 "sqlparser.cpp" /* yacc.c:1646 */ 2337 break; 2338 2339 case 91: 2340 #line 1259 "KDbSqlParser.y" /* yacc.c:1646 */ 2341 { 2342 (yyval.timeValue) = new KDbTime(*(yyvsp[-4].binaryValue), *(yyvsp[-2].binaryValue), {}, *(yyvsp[-1].binaryValue), (yyvsp[0].timePeriodValue)); 2343 sqlParserDebug() << "TimeValue:" << *(yyval.timeValue); 2344 delete (yyvsp[-4].binaryValue); 2345 delete (yyvsp[-2].binaryValue); 2346 delete (yyvsp[-1].binaryValue); 2347 } 2348 #line 2349 "sqlparser.cpp" /* yacc.c:1646 */ 2349 break; 2350 2351 case 92: 2352 #line 1267 "KDbSqlParser.y" /* yacc.c:1646 */ 2353 { 2354 (yyval.timeValue) = new KDbTime(*(yyvsp[-6].binaryValue), *(yyvsp[-4].binaryValue), *(yyvsp[-2].binaryValue), *(yyvsp[-1].binaryValue), (yyvsp[0].timePeriodValue)); 2355 sqlParserDebug() << "TimeValue:" << *(yyval.timeValue); 2356 delete (yyvsp[-6].binaryValue); 2357 delete (yyvsp[-4].binaryValue); 2358 delete (yyvsp[-2].binaryValue); 2359 delete (yyvsp[-1].binaryValue); 2360 } 2361 #line 2362 "sqlparser.cpp" /* yacc.c:1646 */ 2362 break; 2363 2364 case 93: 2365 #line 1279 "KDbSqlParser.y" /* yacc.c:1646 */ 2366 { 2367 (yyval.binaryValue) = (yyvsp[0].binaryValue); 2368 } 2369 #line 2370 "sqlparser.cpp" /* yacc.c:1646 */ 2370 break; 2371 2372 case 94: 2373 #line 1283 "KDbSqlParser.y" /* yacc.c:1646 */ 2374 { 2375 (yyval.binaryValue) = new QByteArray; 2376 } 2377 #line 2378 "sqlparser.cpp" /* yacc.c:1646 */ 2378 break; 2379 2380 case 95: 2381 #line 1290 "KDbSqlParser.y" /* yacc.c:1646 */ 2382 { 2383 (yyval.timePeriodValue) = KDbTime::Period::Am; 2384 } 2385 #line 2386 "sqlparser.cpp" /* yacc.c:1646 */ 2386 break; 2387 2388 case 96: 2389 #line 1294 "KDbSqlParser.y" /* yacc.c:1646 */ 2390 { 2391 (yyval.timePeriodValue) = KDbTime::Period::Pm; 2392 } 2393 #line 2394 "sqlparser.cpp" /* yacc.c:1646 */ 2394 break; 2395 2396 case 97: 2397 #line 1298 "KDbSqlParser.y" /* yacc.c:1646 */ 2398 { 2399 (yyval.timePeriodValue) = KDbTime::Period::None; 2400 } 2401 #line 2402 "sqlparser.cpp" /* yacc.c:1646 */ 2402 break; 2403 2404 case 98: 2405 #line 1305 "KDbSqlParser.y" /* yacc.c:1646 */ 2406 { 2407 (yyval.dateTimeValue) = new KDbDateTime(*(yyvsp[-3].dateValue), *(yyvsp[-1].timeValue)); 2408 sqlParserDebug() << "DateTimeConst:" << *(yyval.dateTimeValue); 2409 delete (yyvsp[-3].dateValue); 2410 delete (yyvsp[-1].timeValue); 2411 } 2412 #line 2413 "sqlparser.cpp" /* yacc.c:1646 */ 2413 break; 2414 2415 case 99: 2416 #line 1315 "KDbSqlParser.y" /* yacc.c:1646 */ 2417 { 2418 sqlParserDebug() << "(expr)"; 2419 (yyval.expr) = new KDbUnaryExpression('(', *(yyvsp[-1].expr)); 2420 delete (yyvsp[-1].expr); 2421 } 2422 #line 2423 "sqlparser.cpp" /* yacc.c:1646 */ 2423 break; 2424 2425 case 100: 2426 #line 1324 "KDbSqlParser.y" /* yacc.c:1646 */ 2427 { 2428 (yyval.exprList) = (yyvsp[-1].exprList); 2429 } 2430 #line 2431 "sqlparser.cpp" /* yacc.c:1646 */ 2431 break; 2432 2433 case 101: 2434 #line 1328 "KDbSqlParser.y" /* yacc.c:1646 */ 2435 { 2436 (yyval.exprList) = new KDbNArgExpression(KDb::ArgumentListExpression, ','); 2437 } 2438 #line 2439 "sqlparser.cpp" /* yacc.c:1646 */ 2439 break; 2440 2441 case 102: 2442 #line 1335 "KDbSqlParser.y" /* yacc.c:1646 */ 2443 { 2444 (yyval.exprList) = (yyvsp[0].exprList); 2445 (yyval.exprList)->prepend( *(yyvsp[-2].expr) ); 2446 delete (yyvsp[-2].expr); 2447 } 2448 #line 2449 "sqlparser.cpp" /* yacc.c:1646 */ 2449 break; 2450 2451 case 103: 2452 #line 1341 "KDbSqlParser.y" /* yacc.c:1646 */ 2453 { 2454 (yyval.exprList) = new KDbNArgExpression(KDb::ArgumentListExpression, ','); 2455 (yyval.exprList)->append( *(yyvsp[0].expr) ); 2456 delete (yyvsp[0].expr); 2457 } 2458 #line 2459 "sqlparser.cpp" /* yacc.c:1646 */ 2459 break; 2460 2461 case 104: 2462 #line 1350 "KDbSqlParser.y" /* yacc.c:1646 */ 2463 { 2464 (yyval.exprList) = (yyvsp[0].exprList); 2465 } 2466 #line 2467 "sqlparser.cpp" /* yacc.c:1646 */ 2467 break; 2468 2469 case 105: 2470 #line 1395 "KDbSqlParser.y" /* yacc.c:1646 */ 2471 { 2472 (yyval.exprList) = (yyvsp[-2].exprList); 2473 (yyval.exprList)->append(*(yyvsp[0].expr)); 2474 delete (yyvsp[0].expr); 2475 } 2476 #line 2477 "sqlparser.cpp" /* yacc.c:1646 */ 2477 break; 2478 2479 case 106: 2480 #line 1401 "KDbSqlParser.y" /* yacc.c:1646 */ 2481 { 2482 (yyval.exprList) = new KDbNArgExpression(KDb::TableListExpression, KDbToken::IDENTIFIER); //ok? 2483 (yyval.exprList)->append(*(yyvsp[0].expr)); 2484 delete (yyvsp[0].expr); 2485 } 2486 #line 2487 "sqlparser.cpp" /* yacc.c:1646 */ 2487 break; 2488 2489 case 107: 2490 #line 1410 "KDbSqlParser.y" /* yacc.c:1646 */ 2491 { 2492 sqlParserDebug() << "FROM: '" << *(yyvsp[0].stringValue) << "'"; 2493 (yyval.expr) = new KDbVariableExpression(*(yyvsp[0].stringValue)); 2494 2495 //! @todo this isn't ok for more tables: 2496 /* 2497 KDbField::ListIterator it = globalParser->query()->fieldsIterator(); 2498 for(KDbField *item; (item = it.current()); ++it) 2499 { 2500 if(item->table() == dummy) 2501 { 2502 item->setTable(schema); 2503 } 2504 2505 if(item->table() && !item->isQueryAsterisk()) 2506 { 2507 KDbField *f = item->table()->field(item->name()); 2508 if(!f) 2509 { 2510 KDbParserError err(KDbParser::tr("Field List Error"), KDbParser::tr("Unknown column '%1' in table '%2'",item->name(),schema->name()), ctoken, current); 2511 globalParser->setError(err); 2512 yyerror("fieldlisterror"); 2513 } 2514 } 2515 }*/ 2516 delete (yyvsp[0].stringValue); 2517 } 2518 #line 2519 "sqlparser.cpp" /* yacc.c:1646 */ 2519 break; 2520 2521 case 108: 2522 #line 1438 "KDbSqlParser.y" /* yacc.c:1646 */ 2523 { 2524 //table + alias 2525 (yyval.expr) = new KDbBinaryExpression( 2526 KDbVariableExpression(*(yyvsp[-1].stringValue)), KDbToken::AS_EMPTY, 2527 KDbVariableExpression(*(yyvsp[0].stringValue)) 2528 ); 2529 delete (yyvsp[-1].stringValue); 2530 delete (yyvsp[0].stringValue); 2531 } 2532 #line 2533 "sqlparser.cpp" /* yacc.c:1646 */ 2533 break; 2534 2535 case 109: 2536 #line 1448 "KDbSqlParser.y" /* yacc.c:1646 */ 2537 { 2538 //table + alias 2539 (yyval.expr) = new KDbBinaryExpression( 2540 KDbVariableExpression(*(yyvsp[-2].stringValue)), KDbToken::AS, 2541 KDbVariableExpression(*(yyvsp[0].stringValue)) 2542 ); 2543 delete (yyvsp[-2].stringValue); 2544 delete (yyvsp[0].stringValue); 2545 } 2546 #line 2547 "sqlparser.cpp" /* yacc.c:1646 */ 2547 break; 2548 2549 case 110: 2550 #line 1463 "KDbSqlParser.y" /* yacc.c:1646 */ 2551 { 2552 (yyval.exprList) = (yyvsp[-2].exprList); 2553 (yyval.exprList)->append(*(yyvsp[0].expr)); 2554 delete (yyvsp[0].expr); 2555 sqlParserDebug() << "ColViews: ColViews , ColItem"; 2556 } 2557 #line 2558 "sqlparser.cpp" /* yacc.c:1646 */ 2558 break; 2559 2560 case 111: 2561 #line 1470 "KDbSqlParser.y" /* yacc.c:1646 */ 2562 { 2563 (yyval.exprList) = new KDbNArgExpression(KDb::FieldListExpression, KDbToken()); 2564 (yyval.exprList)->append(*(yyvsp[0].expr)); 2565 delete (yyvsp[0].expr); 2566 sqlParserDebug() << "ColViews: ColItem"; 2567 } 2568 #line 2569 "sqlparser.cpp" /* yacc.c:1646 */ 2569 break; 2570 2571 case 112: 2572 #line 1480 "KDbSqlParser.y" /* yacc.c:1646 */ 2573 { 2574 // $$ = new KDbField(); 2575 // dummy->addField($$); 2576 // $$->setExpression( $1 ); 2577 // globalParser->query()->addField($$); 2578 (yyval.expr) = (yyvsp[0].expr); 2579 sqlParserDebug() << " added column expr:" << *(yyvsp[0].expr); 2580 } 2581 #line 2582 "sqlparser.cpp" /* yacc.c:1646 */ 2582 break; 2583 2584 case 113: 2585 #line 1489 "KDbSqlParser.y" /* yacc.c:1646 */ 2586 { 2587 (yyval.expr) = (yyvsp[0].expr); 2588 sqlParserDebug() << " added column wildcard:" << *(yyvsp[0].expr); 2589 } 2590 #line 2591 "sqlparser.cpp" /* yacc.c:1646 */ 2591 break; 2592 2593 case 114: 2594 #line 1494 "KDbSqlParser.y" /* yacc.c:1646 */ 2595 { 2596 (yyval.expr) = new KDbBinaryExpression( 2597 *(yyvsp[-2].expr), KDbToken::AS, 2598 KDbVariableExpression(*(yyvsp[0].stringValue)) 2599 ); 2600 sqlParserDebug() << " added column expr:" << *(yyval.expr); 2601 delete (yyvsp[-2].expr); 2602 delete (yyvsp[0].stringValue); 2603 } 2604 #line 2605 "sqlparser.cpp" /* yacc.c:1646 */ 2605 break; 2606 2607 case 115: 2608 #line 1504 "KDbSqlParser.y" /* yacc.c:1646 */ 2609 { 2610 (yyval.expr) = new KDbBinaryExpression( 2611 *(yyvsp[-1].expr), KDbToken::AS_EMPTY, 2612 KDbVariableExpression(*(yyvsp[0].stringValue)) 2613 ); 2614 sqlParserDebug() << " added column expr:" << *(yyval.expr); 2615 delete (yyvsp[-1].expr); 2616 delete (yyvsp[0].stringValue); 2617 } 2618 #line 2619 "sqlparser.cpp" /* yacc.c:1646 */ 2619 break; 2620 2621 case 116: 2622 #line 1517 "KDbSqlParser.y" /* yacc.c:1646 */ 2623 { 2624 (yyval.expr) = (yyvsp[0].expr); 2625 } 2626 #line 2627 "sqlparser.cpp" /* yacc.c:1646 */ 2627 break; 2628 2629 case 117: 2630 #line 1563 "KDbSqlParser.y" /* yacc.c:1646 */ 2631 { 2632 (yyval.expr) = (yyvsp[-1].expr); 2633 //! @todo DISTINCT '(' ColExpression ')' 2634 // $$->setName("DISTINCT(" + $3->name() + ")"); 2635 } 2636 #line 2637 "sqlparser.cpp" /* yacc.c:1646 */ 2637 break; 2638 2639 case 118: 2640 #line 1572 "KDbSqlParser.y" /* yacc.c:1646 */ 2641 { 2642 (yyval.expr) = new KDbVariableExpression(QLatin1String("*")); 2643 sqlParserDebug() << "all columns"; 2644 2645 // KDbQueryAsterisk *ast = new KDbQueryAsterisk(globalParser->query(), dummy); 2646 // globalParser->query()->addAsterisk(ast); 2647 // requiresTable = true; 2648 } 2649 #line 2650 "sqlparser.cpp" /* yacc.c:1646 */ 2650 break; 2651 2652 case 119: 2653 #line 1581 "KDbSqlParser.y" /* yacc.c:1646 */ 2654 { 2655 QString s( *(yyvsp[-2].stringValue) ); 2656 s += QLatin1String(".*"); 2657 (yyval.expr) = new KDbVariableExpression(s); 2658 sqlParserDebug() << " + all columns from " << s; 2659 delete (yyvsp[-2].stringValue); 2660 } 2661 #line 2662 "sqlparser.cpp" /* yacc.c:1646 */ 2662 break; 2663 2664 2665 #line 2666 "sqlparser.cpp" /* yacc.c:1646 */ 2666 default: break; 2667 } 2668 /* User semantic actions sometimes alter yychar, and that requires 2669 that yytoken be updated with the new translation. We take the 2670 approach of translating immediately before every use of yytoken. 2671 One alternative is translating here after every semantic action, 2672 but that translation would be missed if the semantic action invokes 2673 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 2674 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 2675 incorrect destructor might then be invoked immediately. In the 2676 case of YYERROR or YYBACKUP, subsequent parser actions might lead 2677 to an incorrect destructor call or verbose syntax error message 2678 before the lookahead is translated. */ 2679 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2680 2681 YYPOPSTACK (yylen); 2682 yylen = 0; 2683 YY_STACK_PRINT (yyss, yyssp); 2684 2685 *++yyvsp = yyval; 2686 2687 /* Now 'shift' the result of the reduction. Determine what state 2688 that goes to, based on the state we popped back to and the rule 2689 number reduced by. */ 2690 2691 yyn = yyr1[yyn]; 2692 2693 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2694 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2695 yystate = yytable[yystate]; 2696 else 2697 yystate = yydefgoto[yyn - YYNTOKENS]; 2698 2699 goto yynewstate; 2700 2701 2702 /*--------------------------------------. 2703 | yyerrlab -- here on detecting error. | 2704 `--------------------------------------*/ 2705 yyerrlab: 2706 /* Make sure we have latest lookahead translation. See comments at 2707 user semantic actions for why this is necessary. */ 2708 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 2709 2710 /* If not already recovering from an error, report this error. */ 2711 if (!yyerrstatus) 2712 { 2713 ++yynerrs; 2714 #if ! YYERROR_VERBOSE 2715 yyerror (YY_("syntax error")); 2716 #else 2717 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 2718 yyssp, yytoken) 2719 { 2720 char const *yymsgp = YY_("syntax error"); 2721 int yysyntax_error_status; 2722 yysyntax_error_status = YYSYNTAX_ERROR; 2723 if (yysyntax_error_status == 0) 2724 yymsgp = yymsg; 2725 else if (yysyntax_error_status == 1) 2726 { 2727 if (yymsg != yymsgbuf) 2728 YYSTACK_FREE (yymsg); 2729 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 2730 if (!yymsg) 2731 { 2732 yymsg = yymsgbuf; 2733 yymsg_alloc = sizeof yymsgbuf; 2734 yysyntax_error_status = 2; 2735 } 2736 else 2737 { 2738 yysyntax_error_status = YYSYNTAX_ERROR; 2739 yymsgp = yymsg; 2740 } 2741 } 2742 yyerror (yymsgp); 2743 if (yysyntax_error_status == 2) 2744 goto yyexhaustedlab; 2745 } 2746 # undef YYSYNTAX_ERROR 2747 #endif 2748 } 2749 2750 2751 2752 if (yyerrstatus == 3) 2753 { 2754 /* If just tried and failed to reuse lookahead token after an 2755 error, discard it. */ 2756 2757 if (yychar <= YYEOF) 2758 { 2759 /* Return failure if at end of input. */ 2760 if (yychar == YYEOF) 2761 YYABORT; 2762 } 2763 else 2764 { 2765 yydestruct ("Error: discarding", 2766 yytoken, &yylval); 2767 yychar = YYEMPTY; 2768 } 2769 } 2770 2771 /* Else will try to reuse lookahead token after shifting the error 2772 token. */ 2773 goto yyerrlab1; 2774 2775 2776 /*---------------------------------------------------. 2777 | yyerrorlab -- error raised explicitly by YYERROR. | 2778 `---------------------------------------------------*/ 2779 yyerrorlab: 2780 2781 /* Pacify compilers like GCC when the user code never invokes 2782 YYERROR and the label yyerrorlab therefore never appears in user 2783 code. */ 2784 if (/*CONSTCOND*/ 0) 2785 goto yyerrorlab; 2786 2787 /* Do not reclaim the symbols of the rule whose action triggered 2788 this YYERROR. */ 2789 YYPOPSTACK (yylen); 2790 yylen = 0; 2791 YY_STACK_PRINT (yyss, yyssp); 2792 yystate = *yyssp; 2793 goto yyerrlab1; 2794 2795 2796 /*-------------------------------------------------------------. 2797 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2798 `-------------------------------------------------------------*/ 2799 yyerrlab1: 2800 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2801 2802 for (;;) 2803 { 2804 yyn = yypact[yystate]; 2805 if (!yypact_value_is_default (yyn)) 2806 { 2807 yyn += YYTERROR; 2808 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2809 { 2810 yyn = yytable[yyn]; 2811 if (0 < yyn) 2812 break; 2813 } 2814 } 2815 2816 /* Pop the current state because it cannot handle the error token. */ 2817 if (yyssp == yyss) 2818 YYABORT; 2819 2820 2821 yydestruct ("Error: popping", 2822 yystos[yystate], yyvsp); 2823 YYPOPSTACK (1); 2824 yystate = *yyssp; 2825 YY_STACK_PRINT (yyss, yyssp); 2826 } 2827 2828 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 2829 *++yyvsp = yylval; 2830 YY_IGNORE_MAYBE_UNINITIALIZED_END 2831 2832 2833 /* Shift the error token. */ 2834 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2835 2836 yystate = yyn; 2837 goto yynewstate; 2838 2839 2840 /*-------------------------------------. 2841 | yyacceptlab -- YYACCEPT comes here. | 2842 `-------------------------------------*/ 2843 yyacceptlab: 2844 yyresult = 0; 2845 goto yyreturn; 2846 2847 /*-----------------------------------. 2848 | yyabortlab -- YYABORT comes here. | 2849 `-----------------------------------*/ 2850 yyabortlab: 2851 yyresult = 1; 2852 goto yyreturn; 2853 2854 #if !defined yyoverflow || YYERROR_VERBOSE 2855 /*-------------------------------------------------. 2856 | yyexhaustedlab -- memory exhaustion comes here. | 2857 `-------------------------------------------------*/ 2858 yyexhaustedlab: 2859 yyerror (YY_("memory exhausted")); 2860 yyresult = 2; 2861 /* Fall through. */ 2862 #endif 2863 2864 yyreturn: 2865 if (yychar != YYEMPTY) 2866 { 2867 /* Make sure we have latest lookahead translation. See comments at 2868 user semantic actions for why this is necessary. */ 2869 yytoken = YYTRANSLATE (yychar); 2870 yydestruct ("Cleanup: discarding lookahead", 2871 yytoken, &yylval); 2872 } 2873 /* Do not reclaim the symbols of the rule whose action triggered 2874 this YYABORT or YYACCEPT. */ 2875 YYPOPSTACK (yylen); 2876 YY_STACK_PRINT (yyss, yyssp); 2877 while (yyssp != yyss) 2878 { 2879 yydestruct ("Cleanup: popping", 2880 yystos[*yyssp], yyvsp); 2881 YYPOPSTACK (1); 2882 } 2883 #ifndef yyoverflow 2884 if (yyss != yyssa) 2885 YYSTACK_FREE (yyss); 2886 #endif 2887 #if YYERROR_VERBOSE 2888 if (yymsg != yymsgbuf) 2889 YYSTACK_FREE (yymsg); 2890 #endif 2891 return yyresult; 2892 } 2893 #line 1596 "KDbSqlParser.y" /* yacc.c:1906 */ 2894 2895 2896 KDB_TESTING_EXPORT const char* g_tokenName(unsigned int offset) { 2897 const int t = YYTRANSLATE(offset); 2898 if (t >= YYTRANSLATE(::SQL_TYPE)) { 2899 return yytname[t]; 2900 } 2901 return nullptr; 2902 } 2903 2904 //static 2905 const int KDbToken::maxCharTokenValue = 253; 2906 2907 //static 2908 const int KDbToken::maxTokenValue = YYMAXUTOK;