sqlparser.cpp
1/* A Bison parser, made by GNU Bison 2.2. */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.2"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61
62
63/* Tokens. */
64#ifndef YYTOKENTYPE
65# define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 UMINUS = 258,
70 SQL_TYPE = 259,
71 SQL_ABS = 260,
72 ACOS = 261,
73 AMPERSAND = 262,
74 SQL_ABSOLUTE = 263,
75 ADA = 264,
76 ADD = 265,
77 ADD_DAYS = 266,
78 ADD_HOURS = 267,
79 ADD_MINUTES = 268,
80 ADD_MONTHS = 269,
81 ADD_SECONDS = 270,
82 ADD_YEARS = 271,
83 ALL = 272,
84 ALLOCATE = 273,
85 ALTER = 274,
86 AND = 275,
87 ANY = 276,
88 ARE = 277,
89 AS = 278,
90 ASIN = 279,
91 ASC = 280,
92 ASCII = 281,
93 ASSERTION = 282,
94 ATAN = 283,
95 ATAN2 = 284,
96 AUTHORIZATION = 285,
97 AUTO_INCREMENT = 286,
98 AVG = 287,
99 BEFORE = 288,
100 SQL_BEGIN = 289,
101 BETWEEN = 290,
102 BIGINT = 291,
103 BINARY = 292,
104 BIT = 293,
105 BIT_LENGTH = 294,
106 BITWISE_SHIFT_LEFT = 295,
107 BITWISE_SHIFT_RIGHT = 296,
108 BREAK = 297,
109 BY = 298,
110 CASCADE = 299,
111 CASCADED = 300,
112 CASE = 301,
113 CAST = 302,
114 CATALOG = 303,
115 CEILING = 304,
116 CENTER = 305,
117 SQL_CHAR = 306,
118 CHAR_LENGTH = 307,
119 CHARACTER_STRING_LITERAL = 308,
120 CHECK = 309,
121 CLOSE = 310,
122 COALESCE = 311,
123 COBOL = 312,
124 COLLATE = 313,
125 COLLATION = 314,
126 COLUMN = 315,
127 COMMIT = 316,
128 COMPUTE = 317,
129 CONCAT = 318,
130 CONCATENATION = 319,
131 CONNECT = 320,
132 CONNECTION = 321,
133 CONSTRAINT = 322,
134 CONSTRAINTS = 323,
135 CONTINUE = 324,
136 CONVERT = 325,
137 CORRESPONDING = 326,
138 COS = 327,
139 COT = 328,
140 COUNT = 329,
141 CREATE = 330,
142 CURDATE = 331,
143 CURRENT = 332,
144 CURRENT_DATE = 333,
145 CURRENT_TIME = 334,
146 CURRENT_TIMESTAMP = 335,
147 CURTIME = 336,
148 CURSOR = 337,
149 DATABASE = 338,
150 SQL_DATE = 339,
151 DATE_FORMAT = 340,
152 DATE_REMAINDER = 341,
153 DATE_VALUE = 342,
154 DAY = 343,
155 DAYOFMONTH = 344,
156 DAYOFWEEK = 345,
157 DAYOFYEAR = 346,
158 DAYS_BETWEEN = 347,
159 DEALLOCATE = 348,
160 DEC = 349,
161 DECLARE = 350,
162 DEFAULT = 351,
163 DEFERRABLE = 352,
164 DEFERRED = 353,
165 SQL_DELETE = 354,
166 DESC = 355,
167 DESCRIBE = 356,
168 DESCRIPTOR = 357,
169 DIAGNOSTICS = 358,
170 DICTIONARY = 359,
171 DIRECTORY = 360,
172 DISCONNECT = 361,
173 DISPLACEMENT = 362,
174 DISTINCT = 363,
175 DOMAIN_TOKEN = 364,
176 SQL_DOUBLE = 365,
177 DOUBLE_QUOTED_STRING = 366,
178 DROP = 367,
179 ELSE = 368,
180 END = 369,
181 END_EXEC = 370,
182 EQUAL = 371,
183 ESCAPE = 372,
184 EXCEPT = 373,
185 SQL_EXCEPTION = 374,
186 EXEC = 375,
187 EXECUTE = 376,
188 EXISTS = 377,
189 EXP = 378,
190 EXPONENT = 379,
191 EXTERNAL = 380,
192 EXTRACT = 381,
193 SQL_FALSE = 382,
194 FETCH = 383,
195 FIRST = 384,
196 SQL_FLOAT = 385,
197 FLOOR = 386,
198 FN = 387,
199 FOR = 388,
200 FOREIGN = 389,
201 FORTRAN = 390,
202 FOUND = 391,
203 FOUR_DIGITS = 392,
204 FROM = 393,
205 FULL = 394,
206 GET = 395,
207 GLOBAL = 396,
208 GO = 397,
209 GOTO = 398,
210 GRANT = 399,
211 GREATER_OR_EQUAL = 400,
212 HAVING = 401,
213 HOUR = 402,
214 HOURS_BETWEEN = 403,
215 IDENTITY = 404,
216 IFNULL = 405,
217 SQL_IGNORE = 406,
218 IMMEDIATE = 407,
219 SQL_IN = 408,
220 INCLUDE = 409,
221 INDEX = 410,
222 INDICATOR = 411,
223 INITIALLY = 412,
224 INNER = 413,
225 INPUT = 414,
226 INSENSITIVE = 415,
227 INSERT = 416,
228 INTEGER = 417,
229 INTERSECT = 418,
230 INTERVAL = 419,
231 INTO = 420,
232 IS = 421,
233 ISOLATION = 422,
234 JOIN = 423,
235 JUSTIFY = 424,
236 KEY = 425,
237 LANGUAGE = 426,
238 LAST = 427,
239 LCASE = 428,
240 LEFT = 429,
241 LENGTH = 430,
242 LESS_OR_EQUAL = 431,
243 LEVEL = 432,
244 LIKE = 433,
245 LINE_WIDTH = 434,
246 LOCAL = 435,
247 LOCATE = 436,
248 LOG = 437,
249 SQL_LONG = 438,
250 LOWER = 439,
251 LTRIM = 440,
252 LTRIP = 441,
253 MATCH = 442,
254 SQL_MAX = 443,
255 MICROSOFT = 444,
256 SQL_MIN = 445,
257 MINUS = 446,
258 MINUTE = 447,
259 MINUTES_BETWEEN = 448,
260 MOD = 449,
261 MODIFY = 450,
262 MODULE = 451,
263 MONTH = 452,
264 MONTHS_BETWEEN = 453,
265 MUMPS = 454,
266 NAMES = 455,
267 NATIONAL = 456,
268 NCHAR = 457,
269 NEXT = 458,
270 NODUP = 459,
271 NONE = 460,
272 NOT = 461,
273 NOT_EQUAL = 462,
274 NOT_EQUAL2 = 463,
275 NOW = 464,
276 SQL_NULL = 465,
277 SQL_IS = 466,
278 SQL_IS_NULL = 467,
279 SQL_IS_NOT_NULL = 468,
280 NULLIF = 469,
281 NUMERIC = 470,
282 OCTET_LENGTH = 471,
283 ODBC = 472,
284 OF = 473,
285 SQL_OFF = 474,
286 SQL_ON = 475,
287 ONLY = 476,
288 OPEN = 477,
289 OPTION = 478,
290 OR = 479,
291 ORDER = 480,
292 OUTER = 481,
293 OUTPUT = 482,
294 OVERLAPS = 483,
295 PAGE = 484,
296 PARTIAL = 485,
297 SQL_PASCAL = 486,
298 PERSISTENT = 487,
299 CQL_PI = 488,
300 PLI = 489,
301 POSITION = 490,
302 PRECISION = 491,
303 PREPARE = 492,
304 PRESERVE = 493,
305 PRIMARY = 494,
306 PRIOR = 495,
307 PRIVILEGES = 496,
308 PROCEDURE = 497,
309 PRODUCT = 498,
310 PUBLIC = 499,
311 QUARTER = 500,
312 QUIT = 501,
313 RAND = 502,
314 READ_ONLY = 503,
315 REAL = 504,
316 REFERENCES = 505,
317 REPEAT = 506,
318 REPLACE = 507,
319 RESTRICT = 508,
320 REVOKE = 509,
321 RIGHT = 510,
322 ROLLBACK = 511,
323 ROWS = 512,
324 RPAD = 513,
325 RTRIM = 514,
326 SCHEMA = 515,
327 SCREEN_WIDTH = 516,
328 SCROLL = 517,
329 SECOND = 518,
330 SECONDS_BETWEEN = 519,
331 SELECT = 520,
332 SEQUENCE = 521,
333 SETOPT = 522,
334 SET = 523,
335 SHOWOPT = 524,
336 SIGN = 525,
337 SIMILAR_TO = 526,
338 NOT_SIMILAR_TO = 527,
339 INTEGER_CONST = 528,
340 REAL_CONST = 529,
341 DATE_CONST = 530,
342 DATETIME_CONST = 531,
343 TIME_CONST = 532,
344 SIN = 533,
345 SQL_SIZE = 534,
346 SMALLINT = 535,
347 SOME = 536,
348 SPACE = 537,
349 SQL = 538,
350 SQL_TRUE = 539,
351 SQLCA = 540,
352 SQLCODE = 541,
353 SQLERROR = 542,
354 SQLSTATE = 543,
355 SQLWARNING = 544,
356 SQRT = 545,
357 STDEV = 546,
358 SUBSTRING = 547,
359 SUM = 548,
360 SYSDATE = 549,
361 SYSDATE_FORMAT = 550,
362 SYSTEM = 551,
363 TABLE = 552,
364 TAN = 553,
365 TEMPORARY = 554,
366 THEN = 555,
367 THREE_DIGITS = 556,
368 TIME = 557,
369 TIMESTAMP = 558,
370 TIMEZONE_HOUR = 559,
371 TIMEZONE_MINUTE = 560,
372 TINYINT = 561,
373 TO = 562,
374 TO_CHAR = 563,
375 TO_DATE = 564,
376 TRANSACTION = 565,
377 TRANSLATE = 566,
378 TRANSLATION = 567,
379 TRUNCATE = 568,
380 GENERAL_TITLE = 569,
381 TWO_DIGITS = 570,
382 UCASE = 571,
383 UNION = 572,
384 UNIQUE = 573,
385 SQL_UNKNOWN = 574,
386 UPDATE = 575,
387 UPPER = 576,
388 USAGE = 577,
389 USER = 578,
390 IDENTIFIER = 579,
391 IDENTIFIER_DOT_ASTERISK = 580,
392 QUERY_PARAMETER = 581,
393 USING = 582,
394 VALUE = 583,
395 VALUES = 584,
396 VARBINARY = 585,
397 VARCHAR = 586,
398 VARYING = 587,
399 VENDOR = 588,
400 VIEW = 589,
401 WEEK = 590,
402 WHEN = 591,
403 WHENEVER = 592,
404 WHERE = 593,
405 WHERE_CURRENT_OF = 594,
406 WITH = 595,
407 WORD_WRAPPED = 596,
408 WORK = 597,
409 WRAPPED = 598,
410 XOR = 599,
411 YEAR = 600,
412 YEARS_BETWEEN = 601,
413 SCAN_ERROR = 602,
414 __LAST_TOKEN = 603,
415 ILIKE = 604
416 };
417#endif
418/* Tokens. */
419#define UMINUS 258
420#define SQL_TYPE 259
421#define SQL_ABS 260
422#define ACOS 261
423#define AMPERSAND 262
424#define SQL_ABSOLUTE 263
425#define ADA 264
426#define ADD 265
427#define ADD_DAYS 266
428#define ADD_HOURS 267
429#define ADD_MINUTES 268
430#define ADD_MONTHS 269
431#define ADD_SECONDS 270
432#define ADD_YEARS 271
433#define ALL 272
434#define ALLOCATE 273
435#define ALTER 274
436#define AND 275
437#define ANY 276
438#define ARE 277
439#define AS 278
440#define ASIN 279
441#define ASC 280
442#define ASCII 281
443#define ASSERTION 282
444#define ATAN 283
445#define ATAN2 284
446#define AUTHORIZATION 285
447#define AUTO_INCREMENT 286
448#define AVG 287
449#define BEFORE 288
450#define SQL_BEGIN 289
451#define BETWEEN 290
452#define BIGINT 291
453#define BINARY 292
454#define BIT 293
455#define BIT_LENGTH 294
456#define BITWISE_SHIFT_LEFT 295
457#define BITWISE_SHIFT_RIGHT 296
458#define BREAK 297
459#define BY 298
460#define CASCADE 299
461#define CASCADED 300
462#define CASE 301
463#define CAST 302
464#define CATALOG 303
465#define CEILING 304
466#define CENTER 305
467#define SQL_CHAR 306
468#define CHAR_LENGTH 307
469#define CHARACTER_STRING_LITERAL 308
470#define CHECK 309
471#define CLOSE 310
472#define COALESCE 311
473#define COBOL 312
474#define COLLATE 313
475#define COLLATION 314
476#define COLUMN 315
477#define COMMIT 316
478#define COMPUTE 317
479#define CONCAT 318
480#define CONCATENATION 319
481#define CONNECT 320
482#define CONNECTION 321
483#define CONSTRAINT 322
484#define CONSTRAINTS 323
485#define CONTINUE 324
486#define CONVERT 325
487#define CORRESPONDING 326
488#define COS 327
489#define COT 328
490#define COUNT 329
491#define CREATE 330
492#define CURDATE 331
493#define CURRENT 332
494#define CURRENT_DATE 333
495#define CURRENT_TIME 334
496#define CURRENT_TIMESTAMP 335
497#define CURTIME 336
498#define CURSOR 337
499#define DATABASE 338
500#define SQL_DATE 339
501#define DATE_FORMAT 340
502#define DATE_REMAINDER 341
503#define DATE_VALUE 342
504#define DAY 343
505#define DAYOFMONTH 344
506#define DAYOFWEEK 345
507#define DAYOFYEAR 346
508#define DAYS_BETWEEN 347
509#define DEALLOCATE 348
510#define DEC 349
511#define DECLARE 350
512#define DEFAULT 351
513#define DEFERRABLE 352
514#define DEFERRED 353
515#define SQL_DELETE 354
516#define DESC 355
517#define DESCRIBE 356
518#define DESCRIPTOR 357
519#define DIAGNOSTICS 358
520#define DICTIONARY 359
521#define DIRECTORY 360
522#define DISCONNECT 361
523#define DISPLACEMENT 362
524#define DISTINCT 363
525#define DOMAIN_TOKEN 364
526#define SQL_DOUBLE 365
527#define DOUBLE_QUOTED_STRING 366
528#define DROP 367
529#define ELSE 368
530#define END 369
531#define END_EXEC 370
532#define EQUAL 371
533#define ESCAPE 372
534#define EXCEPT 373
535#define SQL_EXCEPTION 374
536#define EXEC 375
537#define EXECUTE 376
538#define EXISTS 377
539#define EXP 378
540#define EXPONENT 379
541#define EXTERNAL 380
542#define EXTRACT 381
543#define SQL_FALSE 382
544#define FETCH 383
545#define FIRST 384
546#define SQL_FLOAT 385
547#define FLOOR 386
548#define FN 387
549#define FOR 388
550#define FOREIGN 389
551#define FORTRAN 390
552#define FOUND 391
553#define FOUR_DIGITS 392
554#define FROM 393
555#define FULL 394
556#define GET 395
557#define GLOBAL 396
558#define GO 397
559#define GOTO 398
560#define GRANT 399
561#define GREATER_OR_EQUAL 400
562#define HAVING 401
563#define HOUR 402
564#define HOURS_BETWEEN 403
565#define IDENTITY 404
566#define IFNULL 405
567#define SQL_IGNORE 406
568#define IMMEDIATE 407
569#define SQL_IN 408
570#define INCLUDE 409
571#define INDEX 410
572#define INDICATOR 411
573#define INITIALLY 412
574#define INNER 413
575#define INPUT 414
576#define INSENSITIVE 415
577#define INSERT 416
578#define INTEGER 417
579#define INTERSECT 418
580#define INTERVAL 419
581#define INTO 420
582#define IS 421
583#define ISOLATION 422
584#define JOIN 423
585#define JUSTIFY 424
586#define KEY 425
587#define LANGUAGE 426
588#define LAST 427
589#define LCASE 428
590#define LEFT 429
591#define LENGTH 430
592#define LESS_OR_EQUAL 431
593#define LEVEL 432
594#define LIKE 433
595#define LINE_WIDTH 434
596#define LOCAL 435
597#define LOCATE 436
598#define LOG 437
599#define SQL_LONG 438
600#define LOWER 439
601#define LTRIM 440
602#define LTRIP 441
603#define MATCH 442
604#define SQL_MAX 443
605#define MICROSOFT 444
606#define SQL_MIN 445
607#define MINUS 446
608#define MINUTE 447
609#define MINUTES_BETWEEN 448
610#define MOD 449
611#define MODIFY 450
612#define MODULE 451
613#define MONTH 452
614#define MONTHS_BETWEEN 453
615#define MUMPS 454
616#define NAMES 455
617#define NATIONAL 456
618#define NCHAR 457
619#define NEXT 458
620#define NODUP 459
621#define NONE 460
622#define NOT 461
623#define NOT_EQUAL 462
624#define NOT_EQUAL2 463
625#define NOW 464
626#define SQL_NULL 465
627#define SQL_IS 466
628#define SQL_IS_NULL 467
629#define SQL_IS_NOT_NULL 468
630#define NULLIF 469
631#define NUMERIC 470
632#define OCTET_LENGTH 471
633#define ODBC 472
634#define OF 473
635#define SQL_OFF 474
636#define SQL_ON 475
637#define ONLY 476
638#define OPEN 477
639#define OPTION 478
640#define OR 479
641#define ORDER 480
642#define OUTER 481
643#define OUTPUT 482
644#define OVERLAPS 483
645#define PAGE 484
646#define PARTIAL 485
647#define SQL_PASCAL 486
648#define PERSISTENT 487
649#define CQL_PI 488
650#define PLI 489
651#define POSITION 490
652#define PRECISION 491
653#define PREPARE 492
654#define PRESERVE 493
655#define PRIMARY 494
656#define PRIOR 495
657#define PRIVILEGES 496
658#define PROCEDURE 497
659#define PRODUCT 498
660#define PUBLIC 499
661#define QUARTER 500
662#define QUIT 501
663#define RAND 502
664#define READ_ONLY 503
665#define REAL 504
666#define REFERENCES 505
667#define REPEAT 506
668#define REPLACE 507
669#define RESTRICT 508
670#define REVOKE 509
671#define RIGHT 510
672#define ROLLBACK 511
673#define ROWS 512
674#define RPAD 513
675#define RTRIM 514
676#define SCHEMA 515
677#define SCREEN_WIDTH 516
678#define SCROLL 517
679#define SECOND 518
680#define SECONDS_BETWEEN 519
681#define SELECT 520
682#define SEQUENCE 521
683#define SETOPT 522
684#define SET 523
685#define SHOWOPT 524
686#define SIGN 525
687#define SIMILAR_TO 526
688#define NOT_SIMILAR_TO 527
689#define INTEGER_CONST 528
690#define REAL_CONST 529
691#define DATE_CONST 530
692#define DATETIME_CONST 531
693#define TIME_CONST 532
694#define SIN 533
695#define SQL_SIZE 534
696#define SMALLINT 535
697#define SOME 536
698#define SPACE 537
699#define SQL 538
700#define SQL_TRUE 539
701#define SQLCA 540
702#define SQLCODE 541
703#define SQLERROR 542
704#define SQLSTATE 543
705#define SQLWARNING 544
706#define SQRT 545
707#define STDEV 546
708#define SUBSTRING 547
709#define SUM 548
710#define SYSDATE 549
711#define SYSDATE_FORMAT 550
712#define SYSTEM 551
713#define TABLE 552
714#define TAN 553
715#define TEMPORARY 554
716#define THEN 555
717#define THREE_DIGITS 556
718#define TIME 557
719#define TIMESTAMP 558
720#define TIMEZONE_HOUR 559
721#define TIMEZONE_MINUTE 560
722#define TINYINT 561
723#define TO 562
724#define TO_CHAR 563
725#define TO_DATE 564
726#define TRANSACTION 565
727#define TRANSLATE 566
728#define TRANSLATION 567
729#define TRUNCATE 568
730#define GENERAL_TITLE 569
731#define TWO_DIGITS 570
732#define UCASE 571
733#define UNION 572
734#define UNIQUE 573
735#define SQL_UNKNOWN 574
736#define UPDATE 575
737#define UPPER 576
738#define USAGE 577
739#define USER 578
740#define IDENTIFIER 579
741#define IDENTIFIER_DOT_ASTERISK 580
742#define QUERY_PARAMETER 581
743#define USING 582
744#define VALUE 583
745#define VALUES 584
746#define VARBINARY 585
747#define VARCHAR 586
748#define VARYING 587
749#define VENDOR 588
750#define VIEW 589
751#define WEEK 590
752#define WHEN 591
753#define WHENEVER 592
754#define WHERE 593
755#define WHERE_CURRENT_OF 594
756#define WITH 595
757#define WORD_WRAPPED 596
758#define WORK 597
759#define WRAPPED 598
760#define XOR 599
761#define YEAR 600
762#define YEARS_BETWEEN 601
763#define SCAN_ERROR 602
764#define __LAST_TOKEN 603
765#define ILIKE 604
766
767
768
769
770/* Copy the first part of user declarations. */
771#line 438 "sqlparser.y"
772
773#ifndef YYDEBUG /* compat. */
774# define YYDEBUG 0
775#endif
776#include <stdio.h>
777#include <string.h>
778#include <string>
779#include <iostream>
780#include <assert.h>
781#include <limits.h>
782//TODO OK?
783#ifdef TQ_WS_WIN
784//workaround for bug on msvc
785# undef LLONG_MIN
786#endif
787#ifndef LLONG_MAX
788# define LLONG_MAX 0x7fffffffffffffffLL
789#endif
790#ifndef LLONG_MIN
791# define LLONG_MIN 0x8000000000000000LL
792#endif
793#ifndef LLONG_MAX
794# define ULLONG_MAX 0xffffffffffffffffLL
795#endif
796
797#ifdef _WIN32
798# include <malloc.h>
799#endif
800
801#include <tqobject.h>
802#include <kdebug.h>
803#include <tdelocale.h>
804#include <tqptrlist.h>
805#include <tqcstring.h>
806#include <tqvariant.h>
807
808#include <connection.h>
809#include <queryschema.h>
810#include <field.h>
811#include <tableschema.h>
812
813#include "parser.h"
814#include "parser_p.h"
815#include "sqltypes.h"
816
817int yylex();
818
819// using namespace std;
820using namespace KexiDB;
821
822#define YY_NO_UNPUT
823#define YYSTACK_USE_ALLOCA 1
824#define YYMAXDEPTH 255
825
826 extern "C"
827 {
828 int yywrap()
829 {
830 return 1;
831 }
832 }
833
834#if 0
835 struct yyval
836 {
837 TQString parserUserName;
838 int integerValue;
839 KexiDBField::ColumnType coltype;
840 }
841#endif
842
843
844
845/* Enabling traces. */
846#ifndef YYDEBUG
847# define YYDEBUG 0
848#endif
849
850/* Enabling verbose error messages. */
851#ifdef YYERROR_VERBOSE
852# undef YYERROR_VERBOSE
853# define YYERROR_VERBOSE 1
854#else
855# define YYERROR_VERBOSE 0
856#endif
857
858/* Enabling the token table. */
859#ifndef YYTOKEN_TABLE
860# define YYTOKEN_TABLE 0
861#endif
862
863#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
864typedef union YYSTYPE
865#line 511 "sqlparser.y"
866{
867 TQString* stringValue;
868 TQ_LLONG integerValue;
869 bool booleanValue;
870 struct realType realValue;
871 KexiDB::Field::Type colType;
872 KexiDB::Field *field;
873 KexiDB::BaseExpr *expr;
874 KexiDB::NArgExpr *exprList;
875 KexiDB::ConstExpr *constExpr;
876 KexiDB::QuerySchema *querySchema;
877 SelectOptionsInternal *selectOptions;
878 OrderByColumnInternal::List *orderByColumns;
879 TQVariant *variantValue;
880}
881/* Line 193 of yacc.c. */
882#line 883 "sqlparser.tab.c"
883 YYSTYPE;
884# define yystype YYSTYPE /* obsolescent; will be withdrawn */
885# define YYSTYPE_IS_DECLARED 1
886# define YYSTYPE_IS_TRIVIAL 1
887#endif
888
889
890
891/* Copy the second part of user declarations. */
892
893
894/* Line 216 of yacc.c. */
895#line 896 "sqlparser.tab.c"
896
897#ifdef short
898# undef short
899#endif
900
901#ifdef YYTYPE_UINT8
902typedef YYTYPE_UINT8 yytype_uint8;
903#else
904typedef unsigned char yytype_uint8;
905#endif
906
907#ifdef YYTYPE_INT8
908typedef YYTYPE_INT8 yytype_int8;
909#elif (defined __STDC__ || defined __C99__FUNC__ \
910 || defined __cplusplus || defined _MSC_VER)
911typedef signed char yytype_int8;
912#else
913typedef short int yytype_int8;
914#endif
915
916#ifdef YYTYPE_UINT16
917typedef YYTYPE_UINT16 yytype_uint16;
918#else
919typedef unsigned short int yytype_uint16;
920#endif
921
922#ifdef YYTYPE_INT16
923typedef YYTYPE_INT16 yytype_int16;
924#else
925typedef short int yytype_int16;
926#endif
927
928#ifndef YYSIZE_T
929# ifdef __SIZE_TYPE__
930# define YYSIZE_T __SIZE_TYPE__
931# elif defined size_t
932# define YYSIZE_T size_t
933# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
934 || defined __cplusplus || defined _MSC_VER)
935# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
936# define YYSIZE_T size_t
937# else
938# define YYSIZE_T unsigned int
939# endif
940#endif
941
942#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
943
944#ifndef YY_
945# ifdef YYENABLE_NLS
946# if ENABLE_NLS
947# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
948# define YY_(msgid) dgettext ("bison-runtime", msgid)
949# endif
950# endif
951# ifndef YY_
952# define YY_(msgid) msgid
953# endif
954#endif
955
956/* Suppress unused-variable warnings by "using" E. */
957#if ! defined lint || defined __GNUC__
958# define YYUSE(e) ((void) (e))
959#else
960# define YYUSE(e) /* empty */
961#endif
962
963/* Identity function, used to suppress warnings about constant conditions. */
964#ifndef lint
965# define YYID(n) (n)
966#else
967#if (defined __STDC__ || defined __C99__FUNC__ \
968 || defined __cplusplus || defined _MSC_VER)
969static int
970YYID (int i)
971#else
972static int
973YYID (i)
974 int i;
975#endif
976{
977 return i;
978}
979#endif
980
981#if ! defined yyoverflow || YYERROR_VERBOSE
982
983/* The parser invokes alloca or malloc; define the necessary symbols. */
984
985# ifdef YYSTACK_USE_ALLOCA
986# if YYSTACK_USE_ALLOCA
987# ifdef __GNUC__
988# define YYSTACK_ALLOC __builtin_alloca
989# elif defined __BUILTIN_VA_ARG_INCR
990# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
991# elif defined _AIX
992# define YYSTACK_ALLOC __alloca
993# elif defined _MSC_VER
994# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
995# define alloca _alloca
996# else
997# define YYSTACK_ALLOC alloca
998# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
999 || defined __cplusplus || defined _MSC_VER)
1000# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1001# ifndef _STDLIB_H
1002# define _STDLIB_H 1
1003# endif
1004# endif
1005# endif
1006# endif
1007# endif
1008
1009# ifdef YYSTACK_ALLOC
1010 /* Pacify GCC's `empty if-body' warning. */
1011# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1012# ifndef YYSTACK_ALLOC_MAXIMUM
1013 /* The OS might guarantee only one guard page at the bottom of the stack,
1014 and a page size can be as small as 4096 bytes. So we cannot safely
1015 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1016 to allow for a few compiler-allocated temporary stack slots. */
1017# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1018# endif
1019# else
1020# define YYSTACK_ALLOC YYMALLOC
1021# define YYSTACK_FREE YYFREE
1022# ifndef YYSTACK_ALLOC_MAXIMUM
1023# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1024# endif
1025# if (defined __cplusplus && ! defined _STDLIB_H \
1026 && ! ((defined YYMALLOC || defined malloc) \
1027 && (defined YYFREE || defined free)))
1028# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1029# ifndef _STDLIB_H
1030# define _STDLIB_H 1
1031# endif
1032# endif
1033# ifndef YYMALLOC
1034# define YYMALLOC malloc
1035# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1036 || defined __cplusplus || defined _MSC_VER)
1037void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1038# endif
1039# endif
1040# ifndef YYFREE
1041# define YYFREE free
1042# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1043 || defined __cplusplus || defined _MSC_VER)
1044void free (void *); /* INFRINGES ON USER NAME SPACE */
1045# endif
1046# endif
1047# endif
1048#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1049
1050
1051#if (! defined yyoverflow \
1052 && (! defined __cplusplus \
1053 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1054
1055/* A type that is properly aligned for any stack member. */
1056union yyalloc
1057{
1058 yytype_int16 yyss;
1059 YYSTYPE yyvs;
1060 };
1061
1062/* The size of the maximum gap between one aligned stack and the next. */
1063# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1064
1065/* The size of an array large to enough to hold all stacks, each with
1066 N elements. */
1067# define YYSTACK_BYTES(N) \
1068 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1069 + YYSTACK_GAP_MAXIMUM)
1070
1071/* Copy COUNT objects from FROM to TO. The source and destination do
1072 not overlap. */
1073# ifndef YYCOPY
1074# if defined __GNUC__ && 1 < __GNUC__
1075# define YYCOPY(To, From, Count) \
1076 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1077# else
1078# define YYCOPY(To, From, Count) \
1079 do \
1080 { \
1081 YYSIZE_T yyi; \
1082 for (yyi = 0; yyi < (Count); yyi++) \
1083 (To)[yyi] = (From)[yyi]; \
1084 } \
1085 while (YYID (0))
1086# endif
1087# endif
1088
1089/* Relocate STACK from its old location to the new one. The
1090 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1091 elements in the stack, and YYPTR gives the new location of the
1092 stack. Advance YYPTR to a properly aligned location for the next
1093 stack. */
1094# define YYSTACK_RELOCATE(Stack) \
1095 do \
1096 { \
1097 YYSIZE_T yynewbytes; \
1098 YYCOPY (&yyptr->Stack, Stack, yysize); \
1099 Stack = &yyptr->Stack; \
1100 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1101 yyptr += yynewbytes / sizeof (*yyptr); \
1102 } \
1103 while (YYID (0))
1104
1105#endif
1106
1107/* YYFINAL -- State number of the termination state. */
1108#define YYFINAL 10
1109/* YYLAST -- Last index in YYTABLE. */
1110#define YYLAST 335
1111
1112/* YYNTOKENS -- Number of terminals. */
1113#define YYNTOKENS 373
1114/* YYNNTS -- Number of nonterminals. */
1115#define YYNNTS 37
1116/* YYNRULES -- Number of rules. */
1117#define YYNRULES 108
1118/* YYNRULES -- Number of states. */
1119#define YYNSTATES 176
1120
1121/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1122#define YYUNDEFTOK 2
1123#define YYMAXUTOK 604
1124
1125#define YYTRANSLATE(YYX) \
1126 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1127
1128/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1129static const yytype_uint16 yytranslate[] =
1130{
1131 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1134 2, 2, 2, 2, 2, 2, 357, 352, 370, 361,
1135 358, 359, 351, 350, 355, 349, 356, 362, 2, 2,
1136 2, 2, 2, 2, 2, 2, 2, 2, 2, 354,
1137 364, 363, 365, 360, 353, 2, 2, 2, 2, 2,
1138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1140 2, 368, 2, 369, 367, 2, 2, 2, 2, 2,
1141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1143 2, 2, 2, 2, 371, 2, 372, 2, 2, 2,
1144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1146 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1147 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1148 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1149 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1150 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1151 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1152 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1153 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1154 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1155 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1156 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1157 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1158 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1159 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1160 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1161 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1162 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1163 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1164 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1165 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1166 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1167 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1168 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1169 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1170 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1171 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1172 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
1173 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
1174 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
1175 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
1176 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1177 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
1178 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
1179 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
1180 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
1181 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
1182 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1183 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1184 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1185 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1186 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1187 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1188 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1189 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1190 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1191 345, 346, 347, 348, 366
1192};
1193
1194#if YYDEBUG
1195/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1196 YYRHS. */
1197static const yytype_uint16 yyprhs[] =
1198{
1199 0, 0, 3, 5, 9, 11, 14, 16, 18, 19,
1200 27, 31, 33, 36, 40, 43, 45, 48, 51, 53,
1201 55, 60, 65, 66, 69, 73, 76, 80, 85, 87,
1202 89, 93, 98, 103, 106, 108, 111, 115, 120, 122,
1203 126, 128, 130, 132, 134, 138, 142, 146, 148, 152,
1204 156, 160, 164, 168, 170, 174, 178, 182, 186, 190,
1205 194, 196, 199, 202, 204, 208, 212, 214, 218, 222,
1206 226, 230, 232, 236, 240, 244, 246, 249, 252, 255,
1207 258, 260, 262, 265, 269, 271, 273, 275, 277, 279,
1208 283, 287, 291, 295, 298, 302, 304, 306, 309, 313,
1209 317, 319, 321, 323, 327, 330, 332, 337, 339
1210};
1211
1212/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1213static const yytype_int16 yyrhs[] =
1214{
1215 374, 0, -1, 375, -1, 376, 354, 375, -1, 376,
1216 -1, 376, 354, -1, 377, -1, 384, -1, -1, 75,
1217 297, 324, 378, 358, 379, 359, -1, 379, 355, 380,
1218 -1, 380, -1, 324, 383, -1, 324, 383, 381, -1,
1219 381, 382, -1, 382, -1, 239, 170, -1, 206, 210,
1220 -1, 31, -1, 4, -1, 4, 358, 273, 359, -1,
1221 331, 358, 273, 359, -1, -1, 385, 406, -1, 385,
1222 406, 403, -1, 385, 403, -1, 385, 406, 386, -1,
1223 385, 406, 403, 386, -1, 265, -1, 387, -1, 225,
1224 43, 388, -1, 387, 225, 43, 388, -1, 225, 43,
1225 388, 387, -1, 338, 391, -1, 389, -1, 389, 390,
1226 -1, 389, 355, 388, -1, 389, 390, 355, 388, -1,
1227 324, -1, 324, 356, 324, -1, 273, -1, 25, -1,
1228 100, -1, 392, -1, 393, 20, 392, -1, 393, 224,
1229 392, -1, 393, 344, 392, -1, 393, -1, 394, 365,
1230 393, -1, 394, 145, 393, -1, 394, 364, 393, -1,
1231 394, 176, 393, -1, 394, 363, 393, -1, 394, -1,
1232 395, 207, 394, -1, 395, 208, 394, -1, 395, 178,
1233 394, -1, 395, 153, 394, -1, 395, 271, 394, -1,
1234 395, 272, 394, -1, 395, -1, 395, 212, -1, 395,
1235 213, -1, 396, -1, 397, 40, 396, -1, 397, 41,
1236 396, -1, 397, -1, 398, 350, 397, -1, 398, 349,
1237 397, -1, 398, 370, 397, -1, 398, 371, 397, -1,
1238 398, -1, 399, 362, 398, -1, 399, 351, 398, -1,
1239 399, 352, 398, -1, 399, -1, 349, 399, -1, 350,
1240 399, -1, 372, 399, -1, 206, 399, -1, 324, -1,
1241 326, -1, 324, 401, -1, 324, 356, 324, -1, 210,
1242 -1, 53, -1, 273, -1, 274, -1, 400, -1, 358,
1243 391, 359, -1, 358, 402, 359, -1, 391, 355, 402,
1244 -1, 391, 355, 391, -1, 138, 404, -1, 404, 355,
1245 405, -1, 405, -1, 324, -1, 324, 324, -1, 324,
1246 23, 324, -1, 406, 355, 407, -1, 407, -1, 408,
1247 -1, 409, -1, 408, 23, 324, -1, 408, 324, -1,
1248 391, -1, 108, 358, 408, 359, -1, 351, -1, 324,
1249 356, 351, -1
1250};
1251
1252/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1253static const yytype_uint16 yyrline[] =
1254{
1255 0, 580, 580, 590, 594, 595, 605, 609, 617, 616,
1256 626, 626, 632, 640, 656, 656, 662, 667, 672, 680,
1257 685, 692, 699, 707, 714, 719, 725, 731, 740, 750,
1258 756, 762, 769, 779, 788, 797, 807, 815, 827, 833,
1259 840, 847, 851, 858, 863, 868, 872, 877, 882, 886,
1260 890, 894, 898, 903, 908, 913, 917, 921, 925, 929,
1261 934, 939, 943, 948, 953, 957, 962, 967, 972, 976,
1262 980, 985, 990, 994, 998, 1003, 1009, 1013, 1017, 1021,
1263 1025, 1033, 1039, 1046, 1053, 1060, 1066, 1083, 1089, 1094,
1264 1102, 1112, 1117, 1126, 1171, 1176, 1184, 1212, 1223, 1239,
1265 1245, 1254, 1263, 1268, 1277, 1289, 1333, 1342, 1351
1266};
1267#endif
1268
1269#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1270/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1271 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1272static const char *const yytname[] =
1273{
1274 "$end", "error", "$undefined", "UMINUS", "SQL_TYPE", "SQL_ABS", "ACOS",
1275 "AMPERSAND", "SQL_ABSOLUTE", "ADA", "ADD", "ADD_DAYS", "ADD_HOURS",
1276 "ADD_MINUTES", "ADD_MONTHS", "ADD_SECONDS", "ADD_YEARS", "ALL",
1277 "ALLOCATE", "ALTER", "AND", "ANY", "ARE", "AS", "ASIN", "ASC", "ASCII",
1278 "ASSERTION", "ATAN", "ATAN2", "AUTHORIZATION", "AUTO_INCREMENT", "AVG",
1279 "BEFORE", "SQL_BEGIN", "BETWEEN", "BIGINT", "BINARY", "BIT",
1280 "BIT_LENGTH", "BITWISE_SHIFT_LEFT", "BITWISE_SHIFT_RIGHT", "BREAK", "BY",
1281 "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CEILING", "CENTER",
1282 "SQL_CHAR", "CHAR_LENGTH", "CHARACTER_STRING_LITERAL", "CHECK", "CLOSE",
1283 "COALESCE", "COBOL", "COLLATE", "COLLATION", "COLUMN", "COMMIT",
1284 "COMPUTE", "CONCAT", "CONCATENATION", "CONNECT", "CONNECTION",
1285 "CONSTRAINT", "CONSTRAINTS", "CONTINUE", "CONVERT", "CORRESPONDING",
1286 "COS", "COT", "COUNT", "CREATE", "CURDATE", "CURRENT", "CURRENT_DATE",
1287 "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURTIME", "CURSOR", "DATABASE",
1288 "SQL_DATE", "DATE_FORMAT", "DATE_REMAINDER", "DATE_VALUE", "DAY",
1289 "DAYOFMONTH", "DAYOFWEEK", "DAYOFYEAR", "DAYS_BETWEEN", "DEALLOCATE",
1290 "DEC", "DECLARE", "DEFAULT", "DEFERRABLE", "DEFERRED", "SQL_DELETE",
1291 "DESC", "DESCRIBE", "DESCRIPTOR", "DIAGNOSTICS", "DICTIONARY",
1292 "DIRECTORY", "DISCONNECT", "DISPLACEMENT", "DISTINCT", "DOMAIN_TOKEN",
1293 "SQL_DOUBLE", "DOUBLE_QUOTED_STRING", "DROP", "ELSE", "END", "END_EXEC",
1294 "EQUAL", "ESCAPE", "EXCEPT", "SQL_EXCEPTION", "EXEC", "EXECUTE",
1295 "EXISTS", "EXP", "EXPONENT", "EXTERNAL", "EXTRACT", "SQL_FALSE", "FETCH",
1296 "FIRST", "SQL_FLOAT", "FLOOR", "FN", "FOR", "FOREIGN", "FORTRAN",
1297 "FOUND", "FOUR_DIGITS", "FROM", "FULL", "GET", "GLOBAL", "GO", "GOTO",
1298 "GRANT", "GREATER_OR_EQUAL", "HAVING", "HOUR", "HOURS_BETWEEN",
1299 "IDENTITY", "IFNULL", "SQL_IGNORE", "IMMEDIATE", "SQL_IN", "INCLUDE",
1300 "INDEX", "INDICATOR", "INITIALLY", "INNER", "INPUT", "INSENSITIVE",
1301 "INSERT", "INTEGER", "INTERSECT", "INTERVAL", "INTO", "IS", "ISOLATION",
1302 "JOIN", "JUSTIFY", "KEY", "LANGUAGE", "LAST", "LCASE", "LEFT", "LENGTH",
1303 "LESS_OR_EQUAL", "LEVEL", "LIKE", "LINE_WIDTH", "LOCAL", "LOCATE", "LOG",
1304 "SQL_LONG", "LOWER", "LTRIM", "LTRIP", "MATCH", "SQL_MAX", "MICROSOFT",
1305 "SQL_MIN", "MINUS", "MINUTE", "MINUTES_BETWEEN", "MOD", "MODIFY",
1306 "MODULE", "MONTH", "MONTHS_BETWEEN", "MUMPS", "NAMES", "NATIONAL",
1307 "NCHAR", "NEXT", "NODUP", "NONE", "NOT", "NOT_EQUAL", "NOT_EQUAL2",
1308 "NOW", "SQL_NULL", "SQL_IS", "SQL_IS_NULL", "SQL_IS_NOT_NULL", "NULLIF",
1309 "NUMERIC", "OCTET_LENGTH", "ODBC", "OF", "SQL_OFF", "SQL_ON", "ONLY",
1310 "OPEN", "OPTION", "OR", "ORDER", "OUTER", "OUTPUT", "OVERLAPS", "PAGE",
1311 "PARTIAL", "SQL_PASCAL", "PERSISTENT", "CQL_PI", "PLI", "POSITION",
1312 "PRECISION", "PREPARE", "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES",
1313 "PROCEDURE", "PRODUCT", "PUBLIC", "QUARTER", "QUIT", "RAND", "READ_ONLY",
1314 "REAL", "REFERENCES", "REPEAT", "REPLACE", "RESTRICT", "REVOKE", "RIGHT",
1315 "ROLLBACK", "ROWS", "RPAD", "RTRIM", "SCHEMA", "SCREEN_WIDTH", "SCROLL",
1316 "SECOND", "SECONDS_BETWEEN", "SELECT", "SEQUENCE", "SETOPT", "SET",
1317 "SHOWOPT", "SIGN", "SIMILAR_TO", "NOT_SIMILAR_TO", "INTEGER_CONST",
1318 "REAL_CONST", "DATE_CONST", "DATETIME_CONST", "TIME_CONST", "SIN",
1319 "SQL_SIZE", "SMALLINT", "SOME", "SPACE", "SQL", "SQL_TRUE", "SQLCA",
1320 "SQLCODE", "SQLERROR", "SQLSTATE", "SQLWARNING", "SQRT", "STDEV",
1321 "SUBSTRING", "SUM", "SYSDATE", "SYSDATE_FORMAT", "SYSTEM", "TABLE",
1322 "TAN", "TEMPORARY", "THEN", "THREE_DIGITS", "TIME", "TIMESTAMP",
1323 "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TINYINT", "TO", "TO_CHAR",
1324 "TO_DATE", "TRANSACTION", "TRANSLATE", "TRANSLATION", "TRUNCATE",
1325 "GENERAL_TITLE", "TWO_DIGITS", "UCASE", "UNION", "UNIQUE", "SQL_UNKNOWN",
1326 "UPDATE", "UPPER", "USAGE", "USER", "IDENTIFIER",
1327 "IDENTIFIER_DOT_ASTERISK", "QUERY_PARAMETER", "USING", "VALUE", "VALUES",
1328 "VARBINARY", "VARCHAR", "VARYING", "VENDOR", "VIEW", "WEEK", "WHEN",
1329 "WHENEVER", "WHERE", "WHERE_CURRENT_OF", "WITH", "WORD_WRAPPED", "WORK",
1330 "WRAPPED", "XOR", "YEAR", "YEARS_BETWEEN", "SCAN_ERROR", "__LAST_TOKEN",
1331 "'-'", "'+'", "'*'", "'%'", "'@'", "';'", "','", "'.'", "'$'", "'('",
1332 "')'", "'?'", "'''", "'/'", "'='", "'<'", "'>'", "ILIKE", "'^'", "'['",
1333 "']'", "'&'", "'|'", "'~'", "$accept", "TopLevelStatement",
1334 "StatementList", "Statement", "CreateTableStatement", "@1", "ColDefs",
1335 "ColDef", "ColKeys", "ColKey", "ColType", "SelectStatement", "Select",
1336 "SelectOptions", "WhereClause", "OrderByClause", "OrderByColumnId",
1337 "OrderByOption", "aExpr", "aExpr2", "aExpr3", "aExpr4", "aExpr5",
1338 "aExpr6", "aExpr7", "aExpr8", "aExpr9", "aExpr10", "aExprList",
1339 "aExprList2", "Tables", "FlatTableList", "FlatTable", "ColViews",
1340 "ColItem", "ColExpression", "ColWildCard", 0
1341};
1342#endif
1343
1344# ifdef YYPRINT
1345/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1346 token YYLEX-NUM. */
1347static const yytype_uint16 yytoknum[] =
1348{
1349 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1350 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1351 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1352 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1353 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1354 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1355 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1356 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1357 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1358 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1359 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1360 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1361 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1362 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1363 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1364 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
1365 415, 416, 417, 418, 419, 420, 421, 422, 423, 424,
1366 425, 426, 427, 428, 429, 430, 431, 432, 433, 434,
1367 435, 436, 437, 438, 439, 440, 441, 442, 443, 444,
1368 445, 446, 447, 448, 449, 450, 451, 452, 453, 454,
1369 455, 456, 457, 458, 459, 460, 461, 462, 463, 464,
1370 465, 466, 467, 468, 469, 470, 471, 472, 473, 474,
1371 475, 476, 477, 478, 479, 480, 481, 482, 483, 484,
1372 485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
1373 495, 496, 497, 498, 499, 500, 501, 502, 503, 504,
1374 505, 506, 507, 508, 509, 510, 511, 512, 513, 514,
1375 515, 516, 517, 518, 519, 520, 521, 522, 523, 524,
1376 525, 526, 527, 528, 529, 530, 531, 532, 533, 534,
1377 535, 536, 537, 538, 539, 540, 541, 542, 543, 544,
1378 545, 546, 547, 548, 549, 550, 551, 552, 553, 554,
1379 555, 556, 557, 558, 559, 560, 561, 562, 563, 564,
1380 565, 566, 567, 568, 569, 570, 571, 572, 573, 574,
1381 575, 576, 577, 578, 579, 580, 581, 582, 583, 584,
1382 585, 586, 587, 588, 589, 590, 591, 592, 593, 594,
1383 595, 596, 597, 598, 599, 600, 601, 602, 603, 45,
1384 43, 42, 37, 64, 59, 44, 46, 36, 40, 41,
1385 63, 39, 47, 61, 60, 62, 604, 94, 91, 93,
1386 38, 124, 126
1387};
1388# endif
1389
1390/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1391static const yytype_uint16 yyr1[] =
1392{
1393 0, 373, 374, 375, 375, 375, 376, 376, 378, 377,
1394 379, 379, 380, 380, 381, 381, 382, 382, 382, 383,
1395 383, 383, 383, 384, 384, 384, 384, 384, 385, 386,
1396 386, 386, 386, 387, 388, 388, 388, 388, 389, 389,
1397 389, 390, 390, 391, 392, 392, 392, 392, 393, 393,
1398 393, 393, 393, 393, 394, 394, 394, 394, 394, 394,
1399 394, 395, 395, 395, 396, 396, 396, 397, 397, 397,
1400 397, 397, 398, 398, 398, 398, 399, 399, 399, 399,
1401 399, 399, 399, 399, 399, 399, 399, 399, 399, 400,
1402 401, 402, 402, 403, 404, 404, 405, 405, 405, 406,
1403 406, 407, 407, 407, 407, 408, 408, 409, 409
1404};
1405
1406/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1407static const yytype_uint8 yyr2[] =
1408{
1409 0, 2, 1, 3, 1, 2, 1, 1, 0, 7,
1410 3, 1, 2, 3, 2, 1, 2, 2, 1, 1,
1411 4, 4, 0, 2, 3, 2, 3, 4, 1, 1,
1412 3, 4, 4, 2, 1, 2, 3, 4, 1, 3,
1413 1, 1, 1, 1, 3, 3, 3, 1, 3, 3,
1414 3, 3, 3, 1, 3, 3, 3, 3, 3, 3,
1415 1, 2, 2, 1, 3, 3, 1, 3, 3, 3,
1416 3, 1, 3, 3, 3, 1, 2, 2, 2, 2,
1417 1, 1, 2, 3, 1, 1, 1, 1, 1, 3,
1418 3, 3, 3, 2, 3, 1, 1, 2, 3, 3,
1419 1, 1, 1, 3, 2, 1, 4, 1, 3
1420};
1421
1422/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1423 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1424 means the default is an error. */
1425static const yytype_uint8 yydefact[] =
1426{
1427 0, 0, 28, 0, 2, 4, 6, 7, 0, 0,
1428 1, 5, 85, 0, 0, 0, 84, 86, 87, 80,
1429 81, 0, 0, 107, 0, 0, 105, 43, 47, 53,
1430 60, 63, 66, 71, 75, 88, 25, 23, 100, 101,
1431 102, 8, 3, 0, 96, 93, 95, 80, 79, 0,
1432 0, 82, 76, 77, 0, 78, 0, 0, 0, 0,
1433 0, 0, 0, 0, 0, 0, 0, 0, 61, 62,
1434 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1435 0, 0, 0, 0, 26, 29, 24, 0, 104, 0,
1436 0, 0, 97, 0, 0, 83, 108, 0, 0, 89,
1437 44, 45, 46, 49, 51, 52, 50, 48, 57, 56,
1438 54, 55, 58, 59, 64, 65, 68, 67, 69, 70,
1439 73, 74, 72, 0, 33, 99, 0, 27, 103, 0,
1440 106, 98, 94, 0, 90, 40, 38, 30, 34, 0,
1441 22, 0, 11, 92, 91, 0, 32, 41, 42, 0,
1442 35, 31, 19, 0, 12, 0, 9, 39, 36, 0,
1443 0, 0, 18, 0, 0, 13, 15, 10, 37, 0,
1444 0, 17, 16, 14, 20, 21
1445};
1446
1447/* YYDEFGOTO[NTERM-NUM]. */
1448static const yytype_int16 yydefgoto[] =
1449{
1450 -1, 3, 4, 5, 6, 89, 141, 142, 165, 166,
1451 154, 7, 8, 84, 85, 137, 138, 150, 26, 27,
1452 28, 29, 30, 31, 32, 33, 34, 35, 51, 98,
1453 36, 45, 46, 37, 38, 39, 40
1454};
1455
1456/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1457 STATE-NUM. */
1458#define YYPACT_NINF -336
1459static const yytype_int16 yypact[] =
1460{
1461 -67, -271, -336, 39, -336, -311, -336, -336, -50, -265,
1462 -336, -67, -336, -298, -262, -37, -336, -336, -336, -335,
1463 -336, -37, -37, -336, -37, -37, -336, -336, -18, -135,
1464 -142, -336, -7, -325, -332, -336, -336, -133, -336, -19,
1465 -336, -336, -336, -40, -9, -291, -336, -318, -336, -309,
1466 -37, -336, -336, -336, -292, -336, -37, -37, -37, -37,
1467 -37, -37, -37, -37, -37, -37, -37, -37, -336, -336,
1468 -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
1469 -37, 26, -37, -47, -336, -153, -216, -251, -336, -284,
1470 -273, -237, -336, -262, -231, -336, -336, -260, -263, -336,
1471 -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,
1472 -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,
1473 -336, -336, -336, -261, -336, -336, 51, -336, -336, -227,
1474 -336, -336, -336, -37, -336, -336, -258, -239, -25, -261,
1475 -3, -324, -336, -260, -336, -224, -336, -336, -336, -261,
1476 -254, -336, -256, -255, -24, -227, -336, -336, -336, -261,
1477 -169, -168, -336, -104, -63, -24, -336, -336, -336, -250,
1478 -249, -336, -336, -336, -336, -336
1479};
1480
1481/* YYPGOTO[NTERM-NUM]. */
1482static const yytype_int16 yypgoto[] =
1483{
1484 -336, -336, 97, -336, -336, -336, -336, -44, -336, -53,
1485 -336, -336, -336, 27, -23, -122, -336, -336, -6, -1,
1486 18, -17, -336, -21, 8, 11, 7, -336, -336, -16,
1487 78, -336, 23, -336, 35, 76, -336
1488};
1489
1490/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1491 positive, shift that token. If negative, reduce the rule which
1492 number is the opposite. If zero, do what YYDEFACT says.
1493 If YYTABLE_NINF, syntax error. */
1494#define YYTABLE_NINF -1
1495static const yytype_uint8 yytable[] =
1496{
1497 147, 152, 56, 12, 87, 14, 12, 162, 1, 81,
1498 59, 64, 135, 12, 91, 95, 12, 151, 54, 78,
1499 79, 49, 48, 50, 74, 75, 9, 158, 52, 53,
1500 80, 155, 55, 72, 73, 156, 65, 168, 94, 10,
1501 50, 60, 96, 11, 97, 76, 77, 108, 109, 110,
1502 111, 114, 115, 112, 113, 100, 101, 102, 13, 41,
1503 43, 13, 44, 136, 93, 66, 67, 99, 13, 123,
1504 68, 69, 126, 128, 129, 148, 124, 103, 104, 105,
1505 106, 107, 116, 117, 118, 119, 130, 131, 14, 120,
1506 121, 122, 81, 95, 139, 133, 134, 140, 145, 82,
1507 157, 159, 160, 161, 169, 170, 171, 172, 42, 174,
1508 175, 167, 173, 127, 146, 86, 132, 144, 125, 90,
1509 0, 0, 82, 0, 0, 0, 0, 143, 0, 70,
1510 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1511 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1512 0, 0, 0, 0, 0, 0, 15, 0, 0, 15,
1513 16, 0, 0, 16, 0, 0, 15, 0, 0, 15,
1514 16, 0, 0, 16, 0, 0, 0, 0, 0, 0,
1515 0, 0, 163, 0, 0, 0, 0, 0, 0, 0,
1516 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
1517 0, 0, 0, 0, 0, 82, 57, 0, 0, 0,
1518 0, 0, 0, 0, 0, 164, 0, 0, 0, 0,
1519 0, 0, 83, 17, 18, 0, 17, 18, 61, 62,
1520 63, 0, 0, 17, 18, 0, 17, 18, 0, 0,
1521 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1522 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1523 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1524 0, 0, 0, 0, 19, 0, 20, 19, 0, 20,
1525 0, 0, 0, 0, 47, 0, 20, 47, 0, 20,
1526 0, 0, 0, 0, 0, 0, 0, 0, 0, 21,
1527 22, 23, 21, 22, 23, 88, 0, 0, 24, 21,
1528 22, 24, 21, 22, 0, 92, 0, 0, 24, 0,
1529 0, 24, 25, 0, 0, 25, 58, 0, 153, 0,
1530 149, 0, 25, 0, 0, 25
1531};
1532
1533static const yytype_int16 yycheck[] =
1534{
1535 25, 4, 20, 53, 23, 138, 53, 31, 75, 225,
1536 145, 153, 273, 53, 23, 324, 53, 139, 24, 351,
1537 352, 356, 15, 358, 349, 350, 297, 149, 21, 22,
1538 362, 355, 25, 40, 41, 359, 178, 159, 356, 0,
1539 358, 176, 351, 354, 50, 370, 371, 64, 65, 66,
1540 67, 72, 73, 70, 71, 56, 57, 58, 108, 324,
1541 358, 108, 324, 324, 355, 207, 208, 359, 108, 43,
1542 212, 213, 225, 324, 358, 100, 82, 59, 60, 61,
1543 62, 63, 74, 75, 76, 77, 359, 324, 138, 78,
1544 79, 80, 225, 324, 43, 355, 359, 324, 356, 338,
1545 324, 355, 358, 358, 273, 273, 210, 170, 11, 359,
1546 359, 155, 165, 86, 137, 37, 93, 133, 83, 43,
1547 -1, -1, 338, -1, -1, -1, -1, 133, -1, 271,
1548 272, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1549 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1550 -1, -1, -1, -1, -1, -1, 206, -1, -1, 206,
1551 210, -1, -1, 210, -1, -1, 206, -1, -1, 206,
1552 210, -1, -1, 210, -1, -1, -1, -1, -1, -1,
1553 -1, -1, 206, -1, -1, -1, -1, -1, -1, -1,
1554 -1, -1, -1, -1, -1, -1, -1, -1, 265, -1,
1555 -1, -1, -1, -1, -1, 338, 224, -1, -1, -1,
1556 -1, -1, -1, -1, -1, 239, -1, -1, -1, -1,
1557 -1, -1, 355, 273, 274, -1, 273, 274, 363, 364,
1558 365, -1, -1, 273, 274, -1, 273, 274, -1, -1,
1559 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1560 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1561 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1562 -1, -1, -1, -1, 324, -1, 326, 324, -1, 326,
1563 -1, -1, -1, -1, 324, -1, 326, 324, -1, 326,
1564 -1, -1, -1, -1, -1, -1, -1, -1, -1, 349,
1565 350, 351, 349, 350, 351, 324, -1, -1, 358, 349,
1566 350, 358, 349, 350, -1, 324, -1, -1, 358, -1,
1567 -1, 358, 372, -1, -1, 372, 344, -1, 331, -1,
1568 355, -1, 372, -1, -1, 372
1569};
1570
1571/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1572 symbol of state STATE-NUM. */
1573static const yytype_uint16 yystos[] =
1574{
1575 0, 75, 265, 374, 375, 376, 377, 384, 385, 297,
1576 0, 354, 53, 108, 138, 206, 210, 273, 274, 324,
1577 326, 349, 350, 351, 358, 372, 391, 392, 393, 394,
1578 395, 396, 397, 398, 399, 400, 403, 406, 407, 408,
1579 409, 324, 375, 358, 324, 404, 405, 324, 399, 356,
1580 358, 401, 399, 399, 391, 399, 20, 224, 344, 145,
1581 176, 363, 364, 365, 153, 178, 207, 208, 212, 213,
1582 271, 272, 40, 41, 349, 350, 370, 371, 351, 352,
1583 362, 225, 338, 355, 386, 387, 403, 23, 324, 378,
1584 408, 23, 324, 355, 356, 324, 351, 391, 402, 359,
1585 392, 392, 392, 393, 393, 393, 393, 393, 394, 394,
1586 394, 394, 394, 394, 396, 396, 397, 397, 397, 397,
1587 398, 398, 398, 43, 391, 407, 225, 386, 324, 358,
1588 359, 324, 405, 355, 359, 273, 324, 388, 389, 43,
1589 324, 379, 380, 391, 402, 356, 387, 25, 100, 355,
1590 390, 388, 4, 331, 383, 355, 359, 324, 388, 355,
1591 358, 358, 31, 206, 239, 381, 382, 380, 388, 273,
1592 273, 210, 170, 382, 359, 359
1593};
1594
1595#define yyerrok (yyerrstatus = 0)
1596#define yyclearin (yychar = YYEMPTY)
1597#define YYEMPTY (-2)
1598#define YYEOF 0
1599
1600#define YYACCEPT goto yyacceptlab
1601#define YYABORT goto yyabortlab
1602#define YYERROR goto yyerrorlab
1603
1604
1605/* Like YYERROR except do call yyerror. This remains here temporarily
1606 to ease the transition to the new meaning of YYERROR, for GCC.
1607 Once GCC version 2 has supplanted version 1, this can go. */
1608
1609#define YYFAIL goto yyerrlab
1610
1611#define YYRECOVERING() (!!yyerrstatus)
1612
1613#define YYBACKUP(Token, Value) \
1614do \
1615 if (yychar == YYEMPTY && yylen == 1) \
1616 { \
1617 yychar = (Token); \
1618 yylval = (Value); \
1619 yytoken = YYTRANSLATE (yychar); \
1620 YYPOPSTACK (1); \
1621 goto yybackup; \
1622 } \
1623 else \
1624 { \
1625 yyerror (YY_("syntax error: cannot back up")); \
1626 YYERROR; \
1627 } \
1628while (YYID (0))
1629
1630
1631#define YYTERROR 1
1632#define YYERRCODE 256
1633
1634
1635/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1636 If N is 0, then set CURRENT to the empty location which ends
1637 the previous symbol: RHS[0] (always defined). */
1638
1639#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1640#ifndef YYLLOC_DEFAULT
1641# define YYLLOC_DEFAULT(Current, Rhs, N) \
1642 do \
1643 if (YYID (N)) \
1644 { \
1645 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1646 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1647 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1648 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1649 } \
1650 else \
1651 { \
1652 (Current).first_line = (Current).last_line = \
1653 YYRHSLOC (Rhs, 0).last_line; \
1654 (Current).first_column = (Current).last_column = \
1655 YYRHSLOC (Rhs, 0).last_column; \
1656 } \
1657 while (YYID (0))
1658#endif
1659
1660
1661/* YY_LOCATION_PRINT -- Print the location on the stream.
1662 This macro was not mandated originally: define only if we know
1663 we won't break user code: when these are the locations we know. */
1664
1665#ifndef YY_LOCATION_PRINT
1666# ifdef YYLTYPE_IS_TRIVIAL
1667# define YY_LOCATION_PRINT(File, Loc) \
1668 fprintf (File, "%d.%d-%d.%d", \
1669 (Loc).first_line, (Loc).first_column, \
1670 (Loc).last_line, (Loc).last_column)
1671# else
1672# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1673# endif
1674#endif
1675
1676
1677/* YYLEX -- calling `yylex' with the right arguments. */
1678
1679#ifdef YYLEX_PARAM
1680# define YYLEX yylex (YYLEX_PARAM)
1681#else
1682# define YYLEX yylex ()
1683#endif
1684
1685/* Enable debugging if requested. */
1686#if YYDEBUG
1687
1688# ifndef YYFPRINTF
1689# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1690# define YYFPRINTF fprintf
1691# endif
1692
1693# define YYDPRINTF(Args) \
1694do { \
1695 if (yydebug) \
1696 YYFPRINTF Args; \
1697} while (YYID (0))
1698
1699# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1700do { \
1701 if (yydebug) \
1702 { \
1703 YYFPRINTF (stderr, "%s ", Title); \
1704 yy_symbol_print (stderr, \
1705 Type, Value); \
1706 YYFPRINTF (stderr, "\n"); \
1707 } \
1708} while (YYID (0))
1709
1710
1711/*--------------------------------.
1712| Print this symbol on YYOUTPUT. |
1713`--------------------------------*/
1714
1715/*ARGSUSED*/
1716#if (defined __STDC__ || defined __C99__FUNC__ \
1717 || defined __cplusplus || defined _MSC_VER)
1718static void
1719yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep)
1720#else
1721static void
1722yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1723 FILE *yyoutput;
1724 int yytype;
1725 const YYSTYPE * const yyvaluep;
1726#endif
1727{
1728 if (!yyvaluep)
1729 return;
1730# ifdef YYPRINT
1731 if (yytype < YYNTOKENS)
1732 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1733# else
1734 YYUSE (yyoutput);
1735# endif
1736 switch (yytype)
1737 {
1738 default:
1739 break;
1740 }
1741}
1742
1743
1744/*--------------------------------.
1745| Print this symbol on YYOUTPUT. |
1746`--------------------------------*/
1747
1748#if (defined __STDC__ || defined __C99__FUNC__ \
1749 || defined __cplusplus || defined _MSC_VER)
1750static void
1751yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep)
1752#else
1753static void
1754yy_symbol_print (yyoutput, yytype, yyvaluep)
1755 FILE *yyoutput;
1756 int yytype;
1757 const YYSTYPE * const yyvaluep;
1758#endif
1759{
1760 if (yytype < YYNTOKENS)
1761 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1762 else
1763 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1764
1765 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1766 YYFPRINTF (yyoutput, ")");
1767}
1768
1769/*------------------------------------------------------------------.
1770| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1771| TOP (included). |
1772`------------------------------------------------------------------*/
1773
1774#if (defined __STDC__ || defined __C99__FUNC__ \
1775 || defined __cplusplus || defined _MSC_VER)
1776static void
1777yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1778#else
1779static void
1780yy_stack_print (bottom, top)
1781 yytype_int16 *bottom;
1782 yytype_int16 *top;
1783#endif
1784{
1785 YYFPRINTF (stderr, "Stack now");
1786 for (; bottom <= top; ++bottom)
1787 YYFPRINTF (stderr, " %d", *bottom);
1788 YYFPRINTF (stderr, "\n");
1789}
1790
1791# define YY_STACK_PRINT(Bottom, Top) \
1792do { \
1793 if (yydebug) \
1794 yy_stack_print ((Bottom), (Top)); \
1795} while (YYID (0))
1796
1797
1798/*------------------------------------------------.
1799| Report that the YYRULE is going to be reduced. |
1800`------------------------------------------------*/
1801
1802#if (defined __STDC__ || defined __C99__FUNC__ \
1803 || defined __cplusplus || defined _MSC_VER)
1804static void
1805yy_reduce_print (YYSTYPE *yyvsp,
1806 int yyrule)
1807#else
1808static void
1809yy_reduce_print (yyvsp, yyrule
1810 )
1811 YYSTYPE *yyvsp;
1812
1813 int yyrule;
1814#endif
1815{
1816 int yynrhs = yyr2[yyrule];
1817 int yyi;
1818 unsigned long int yylno = yyrline[yyrule];
1819 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1820 yyrule - 1, yylno);
1821 /* The symbols being reduced. */
1822 for (yyi = 0; yyi < yynrhs; yyi++)
1823 {
1824 fprintf (stderr, " $%d = ", yyi + 1);
1825 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1826 &(yyvsp[(yyi + 1) - (yynrhs)])
1827 );
1828 fprintf (stderr, "\n");
1829 }
1830}
1831
1832# define YY_REDUCE_PRINT(Rule) \
1833do { \
1834 if (yydebug) \
1835 yy_reduce_print (yyvsp, Rule); \
1836} while (YYID (0))
1837
1838/* Nonzero means print parse trace. It is left uninitialized so that
1839 multiple parsers can coexist. */
1840int yydebug;
1841#else /* !YYDEBUG */
1842# define YYDPRINTF(Args)
1843# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1844# define YY_STACK_PRINT(Bottom, Top)
1845# define YY_REDUCE_PRINT(Rule)
1846#endif /* !YYDEBUG */
1847
1848
1849/* YYINITDEPTH -- initial size of the parser's stacks. */
1850#ifndef YYINITDEPTH
1851# define YYINITDEPTH 200
1852#endif
1853
1854/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1855 if the built-in stack extension method is used).
1856
1857 Do not make this value too large; the results are undefined if
1858 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1859 evaluated with infinite-precision integer arithmetic. */
1860
1861#ifndef YYMAXDEPTH
1862# define YYMAXDEPTH 10000
1863#endif
1864
1865␌
1866
1867#if YYERROR_VERBOSE
1868
1869# ifndef yystrlen
1870# if defined __GLIBC__ && defined _STRING_H
1871# define yystrlen strlen
1872# else
1873/* Return the length of YYSTR. */
1874#if (defined __STDC__ || defined __C99__FUNC__ \
1875 || defined __cplusplus || defined _MSC_VER)
1876static YYSIZE_T
1877yystrlen (const char *yystr)
1878#else
1879static YYSIZE_T
1880yystrlen (yystr)
1881 const char *yystr;
1882#endif
1883{
1884 YYSIZE_T yylen;
1885 for (yylen = 0; yystr[yylen]; yylen++)
1886 continue;
1887 return yylen;
1888}
1889# endif
1890# endif
1891
1892# ifndef yystpcpy
1893# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1894# define yystpcpy stpcpy
1895# else
1896/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1897 YYDEST. */
1898#if (defined __STDC__ || defined __C99__FUNC__ \
1899 || defined __cplusplus || defined _MSC_VER)
1900static char *
1901yystpcpy (char *yydest, const char *yysrc)
1902#else
1903static char *
1904yystpcpy (yydest, yysrc)
1905 char *yydest;
1906 const char *yysrc;
1907#endif
1908{
1909 char *yyd = yydest;
1910 const char *yys = yysrc;
1911
1912 while ((*yyd++ = *yys++) != '\0')
1913 continue;
1914
1915 return yyd - 1;
1916}
1917# endif
1918# endif
1919
1920# ifndef yytnamerr
1921/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1922 quotes and backslashes, so that it's suitable for yyerror. The
1923 heuristic is that double-quoting is unnecessary unless the string
1924 contains an apostrophe, a comma, or backslash (other than
1925 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1926 null, do not copy; instead, return the length of what the result
1927 would have been. */
1928static YYSIZE_T
1929yytnamerr (char *yyres, const char *yystr)
1930{
1931 if (*yystr == '"')
1932 {
1933 YYSIZE_T yyn = 0;
1934 char const *yyp = yystr;
1935
1936 for (;;)
1937 switch (*++yyp)
1938 {
1939 case '\'':
1940 case ',':
1941 goto do_not_strip_quotes;
1942
1943 case '\\':
1944 if (*++yyp != '\\')
1945 goto do_not_strip_quotes;
1946 /* Fall through. */
1947 default:
1948 if (yyres)
1949 yyres[yyn] = *yyp;
1950 yyn++;
1951 break;
1952
1953 case '"':
1954 if (yyres)
1955 yyres[yyn] = '\0';
1956 return yyn;
1957 }
1958 do_not_strip_quotes: ;
1959 }
1960
1961 if (! yyres)
1962 return yystrlen (yystr);
1963
1964 return yystpcpy (yyres, yystr) - yyres;
1965}
1966# endif
1967
1968/* Copy into YYRESULT an error message about the unexpected token
1969 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1970 including the terminating null byte. If YYRESULT is null, do not
1971 copy anything; just return the number of bytes that would be
1972 copied. As a special case, return 0 if an ordinary "syntax error"
1973 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1974 size calculation. */
1975static YYSIZE_T
1976yysyntax_error (char *yyresult, int yystate, int yychar)
1977{
1978 int yyn = yypact[yystate];
1979
1980 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1981 return 0;
1982 else
1983 {
1984 int yytype = YYTRANSLATE (yychar);
1985 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1986 YYSIZE_T yysize = yysize0;
1987 YYSIZE_T yysize1;
1988 int yysize_overflow = 0;
1989 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1990 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1991 int yyx;
1992
1993# if 0
1994 /* This is so xgettext sees the translatable formats that are
1995 constructed on the fly. */
1996 YY_("syntax error, unexpected %s");
1997 YY_("syntax error, unexpected %s, expecting %s");
1998 YY_("syntax error, unexpected %s, expecting %s or %s");
1999 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2000 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2001# endif
2002 char *yyfmt;
2003 char const *yyf;
2004 static char const yyunexpected[] = "syntax error, unexpected %s";
2005 static char const yyexpecting[] = ", expecting %s";
2006 static char const yyor[] = " or %s";
2007 char yyformat[sizeof yyunexpected
2008 + sizeof yyexpecting - 1
2009 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2010 * (sizeof yyor - 1))];
2011 char const *yyprefix = yyexpecting;
2012
2013 /* Start YYX at -YYN if negative to avoid negative indexes in
2014 YYCHECK. */
2015 int yyxbegin = yyn < 0 ? -yyn : 0;
2016
2017 /* Stay within bounds of both yycheck and yytname. */
2018 int yychecklim = YYLAST - yyn + 1;
2019 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2020 int yycount = 1;
2021
2022 yyarg[0] = yytname[yytype];
2023 yyfmt = yystpcpy (yyformat, yyunexpected);
2024
2025 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2026 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2027 {
2028 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2029 {
2030 yycount = 1;
2031 yysize = yysize0;
2032 yyformat[sizeof yyunexpected - 1] = '\0';
2033 break;
2034 }
2035 yyarg[yycount++] = yytname[yyx];
2036 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2037 yysize_overflow |= (yysize1 < yysize);
2038 yysize = yysize1;
2039 yyfmt = yystpcpy (yyfmt, yyprefix);
2040 yyprefix = yyor;
2041 }
2042
2043 yyf = YY_(yyformat);
2044 yysize1 = yysize + yystrlen (yyf);
2045 yysize_overflow |= (yysize1 < yysize);
2046 yysize = yysize1;
2047
2048 if (yysize_overflow)
2049 return YYSIZE_MAXIMUM;
2050
2051 if (yyresult)
2052 {
2053 /* Avoid sprintf, as that infringes on the user's name space.
2054 Don't have undefined behavior even if the translation
2055 produced a string with the wrong number of "%s"s. */
2056 char *yyp = yyresult;
2057 int yyi = 0;
2058 while ((*yyp = *yyf) != '\0')
2059 {
2060 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2061 {
2062 yyp += yytnamerr (yyp, yyarg[yyi++]);
2063 yyf += 2;
2064 }
2065 else
2066 {
2067 yyp++;
2068 yyf++;
2069 }
2070 }
2071 }
2072 return yysize;
2073 }
2074}
2075#endif /* YYERROR_VERBOSE */
2076␌
2077
2078/*-----------------------------------------------.
2079| Release the memory associated to this symbol. |
2080`-----------------------------------------------*/
2081
2082/*ARGSUSED*/
2083#if (defined __STDC__ || defined __C99__FUNC__ \
2084 || defined __cplusplus || defined _MSC_VER)
2085static void
2086yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2087#else
2088static void
2089yydestruct (yymsg, yytype, yyvaluep)
2090 const char *yymsg;
2091 int yytype;
2092 YYSTYPE *yyvaluep;
2093#endif
2094{
2095 YYUSE (yyvaluep);
2096
2097 if (!yymsg)
2098 yymsg = "Deleting";
2099 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2100
2101 switch (yytype)
2102 {
2103
2104 default:
2105 break;
2106 }
2107}
2108␌
2109
2110/* Prevent warnings from -Wmissing-prototypes. */
2111
2112#ifdef YYPARSE_PARAM
2113#if defined __STDC__ || defined __cplusplus
2114int yyparse (void *YYPARSE_PARAM);
2115#else
2116int yyparse ();
2117#endif
2118#else /* ! YYPARSE_PARAM */
2119#if defined __STDC__ || defined __cplusplus
2120int yyparse (void);
2121#else
2122int yyparse ();
2123#endif
2124#endif /* ! YYPARSE_PARAM */
2125
2126
2127
2128/* The look-ahead symbol. */
2129int yychar;
2130
2131/* The semantic value of the look-ahead symbol. */
2132YYSTYPE yylval;
2133
2134/* Number of syntax errors so far. */
2135int yynerrs;
2136
2137
2138
2139/*----------.
2140| yyparse. |
2141`----------*/
2142
2143#ifdef YYPARSE_PARAM
2144#if (defined __STDC__ || defined __C99__FUNC__ \
2145 || defined __cplusplus || defined _MSC_VER)
2146int
2147yyparse (void *YYPARSE_PARAM)
2148#else
2149int
2150yyparse (YYPARSE_PARAM)
2151 void *YYPARSE_PARAM;
2152#endif
2153#else /* ! YYPARSE_PARAM */
2154#if (defined __STDC__ || defined __C99__FUNC__ \
2155 || defined __cplusplus || defined _MSC_VER)
2156int
2157yyparse (void)
2158#else
2159int
2160yyparse ()
2161
2162#endif
2163#endif
2164{
2165
2166 int yystate;
2167 int yyn;
2168 int yyresult;
2169 /* Number of tokens to shift before error messages enabled. */
2170 int yyerrstatus;
2171 /* Look-ahead token as an internal (translated) token number. */
2172 int yytoken = 0;
2173#if YYERROR_VERBOSE
2174 /* Buffer for error messages, and its allocated size. */
2175 char yymsgbuf[128];
2176 char *yymsg = yymsgbuf;
2177 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2178#endif
2179
2180 /* Three stacks and their tools:
2181 `yyss': related to states,
2182 `yyvs': related to semantic values,
2183 `yyls': related to locations.
2184
2185 Refer to the stacks thru separate pointers, to allow yyoverflow
2186 to reallocate them elsewhere. */
2187
2188 /* The state stack. */
2189 yytype_int16 yyssa[YYINITDEPTH];
2190 yytype_int16 *yyss = yyssa;
2191 yytype_int16 *yyssp;
2192
2193 /* The semantic value stack. */
2194 YYSTYPE yyvsa[YYINITDEPTH];
2195 YYSTYPE *yyvs = yyvsa;
2196 YYSTYPE *yyvsp;
2197
2198
2199
2200#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2201
2202 YYSIZE_T yystacksize = YYINITDEPTH;
2203
2204 /* The variables used to return semantic value and location from the
2205 action routines. */
2206 YYSTYPE yyval;
2207
2208
2209 /* The number of symbols on the RHS of the reduced rule.
2210 Keep to zero when no symbol should be popped. */
2211 int yylen = 0;
2212
2213 YYDPRINTF ((stderr, "Starting parse\n"));
2214
2215 yystate = 0;
2216 yyerrstatus = 0;
2217 yynerrs = 0;
2218 yychar = YYEMPTY; /* Cause a token to be read. */
2219
2220 /* Initialize stack pointers.
2221 Waste one element of value and location stack
2222 so that they stay on the same level as the state stack.
2223 The wasted elements are never initialized. */
2224
2225 yyssp = yyss;
2226 yyvsp = yyvs;
2227
2228 goto yysetstate;
2229
2230/*------------------------------------------------------------.
2231| yynewstate -- Push a new state, which is found in yystate. |
2232`------------------------------------------------------------*/
2233 yynewstate:
2234 /* In all cases, when you get here, the value and location stacks
2235 have just been pushed. So pushing a state here evens the stacks. */
2236 yyssp++;
2237
2238 yysetstate:
2239 *yyssp = yystate;
2240
2241 if (yyss + yystacksize - 1 <= yyssp)
2242 {
2243 /* Get the current used size of the three stacks, in elements. */
2244 YYSIZE_T yysize = yyssp - yyss + 1;
2245
2246#ifdef yyoverflow
2247 {
2248 /* Give user a chance to reallocate the stack. Use copies of
2249 these so that the &'s don't force the real ones into
2250 memory. */
2251 YYSTYPE *yyvs1 = yyvs;
2252 yytype_int16 *yyss1 = yyss;
2253
2254
2255 /* Each stack pointer address is followed by the size of the
2256 data in use in that stack, in bytes. This used to be a
2257 conditional around just the two extra args, but that might
2258 be undefined if yyoverflow is a macro. */
2259 yyoverflow (YY_("memory exhausted"),
2260 &yyss1, yysize * sizeof (*yyssp),
2261 &yyvs1, yysize * sizeof (*yyvsp),
2262
2263 &yystacksize);
2264
2265 yyss = yyss1;
2266 yyvs = yyvs1;
2267 }
2268#else /* no yyoverflow */
2269# ifndef YYSTACK_RELOCATE
2270 goto yyexhaustedlab;
2271# else
2272 /* Extend the stack our own way. */
2273 if (YYMAXDEPTH <= yystacksize)
2274 goto yyexhaustedlab;
2275 yystacksize *= 2;
2276 if (YYMAXDEPTH < yystacksize)
2277 yystacksize = YYMAXDEPTH;
2278
2279 {
2280 yytype_int16 *yyss1 = yyss;
2281 union yyalloc *yyptr =
2282 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2283 if (! yyptr)
2284 goto yyexhaustedlab;
2285 YYSTACK_RELOCATE (yyss);
2286 YYSTACK_RELOCATE (yyvs);
2287
2288# undef YYSTACK_RELOCATE
2289 if (yyss1 != yyssa)
2290 YYSTACK_FREE (yyss1);
2291 }
2292# endif
2293#endif /* no yyoverflow */
2294
2295 yyssp = yyss + yysize - 1;
2296 yyvsp = yyvs + yysize - 1;
2297
2298
2299 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2300 (unsigned long int) yystacksize));
2301
2302 if (yyss + yystacksize - 1 <= yyssp)
2303 YYABORT;
2304 }
2305
2306 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2307
2308 goto yybackup;
2309
2310/*-----------.
2311| yybackup. |
2312`-----------*/
2313yybackup:
2314
2315 /* Do appropriate processing given the current state. Read a
2316 look-ahead token if we need one and don't already have one. */
2317
2318 /* First try to decide what to do without reference to look-ahead token. */
2319 yyn = yypact[yystate];
2320 if (yyn == YYPACT_NINF)
2321 goto yydefault;
2322
2323 /* Not known => get a look-ahead token if don't already have one. */
2324
2325 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2326 if (yychar == YYEMPTY)
2327 {
2328 YYDPRINTF ((stderr, "Reading a token: "));
2329 yychar = YYLEX;
2330 }
2331
2332 if (yychar <= YYEOF)
2333 {
2334 yychar = yytoken = YYEOF;
2335 YYDPRINTF ((stderr, "Now at end of input.\n"));
2336 }
2337 else
2338 {
2339 yytoken = YYTRANSLATE (yychar);
2340 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2341 }
2342
2343 /* If the proper action on seeing token YYTOKEN is to reduce or to
2344 detect an error, take that action. */
2345 yyn += yytoken;
2346 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2347 goto yydefault;
2348 yyn = yytable[yyn];
2349 if (yyn <= 0)
2350 {
2351 if (yyn == 0 || yyn == YYTABLE_NINF)
2352 goto yyerrlab;
2353 yyn = -yyn;
2354 goto yyreduce;
2355 }
2356
2357 if (yyn == YYFINAL)
2358 YYACCEPT;
2359
2360 /* Count tokens shifted since error; after three, turn off error
2361 status. */
2362 if (yyerrstatus)
2363 yyerrstatus--;
2364
2365 /* Shift the look-ahead token. */
2366 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2367
2368 /* Discard the shifted token unless it is eof. */
2369 if (yychar != YYEOF)
2370 yychar = YYEMPTY;
2371
2372 yystate = yyn;
2373 *++yyvsp = yylval;
2374
2375 goto yynewstate;
2376
2377
2378/*-----------------------------------------------------------.
2379| yydefault -- do the default action for the current state. |
2380`-----------------------------------------------------------*/
2381yydefault:
2382 yyn = yydefact[yystate];
2383 if (yyn == 0)
2384 goto yyerrlab;
2385 goto yyreduce;
2386
2387
2388/*-----------------------------.
2389| yyreduce -- Do a reduction. |
2390`-----------------------------*/
2391yyreduce:
2392 /* yyn is the number of a rule to reduce with. */
2393 yylen = yyr2[yyn];
2394
2395 /* If YYLEN is nonzero, implement the default value of the action:
2396 `$$ = $1'.
2397
2398 Otherwise, the following line sets YYVAL to garbage.
2399 This behavior is undocumented and Bison
2400 users should not rely upon it. Assigning to YYVAL
2401 unconditionally makes the parser a bit smaller, and it avoids a
2402 GCC warning that YYVAL may be used uninitialized. */
2403 yyval = yyvsp[1-yylen];
2404
2405
2406 YY_REDUCE_PRINT (yyn);
2407 switch (yyn)
2408 {
2409 case 2:
2410#line 581 "sqlparser.y"
2411 {
2412//todo: multiple statements
2413//todo: not only "select" statements
2414 parser->setOperation(Parser::OP_Select);
2415 parser->setQuerySchema((yyvsp[(1) - (1)].querySchema));
2416;}
2417 break;
2418
2419 case 3:
2420#line 591 "sqlparser.y"
2421 {
2422//todo: multiple statements
2423;}
2424 break;
2425
2426 case 5:
2427#line 596 "sqlparser.y"
2428 {
2429 (yyval.querySchema) = (yyvsp[(1) - (2)].querySchema);
2430;}
2431 break;
2432
2433 case 6:
2434#line 606 "sqlparser.y"
2435 {
2436YYACCEPT;
2437;}
2438 break;
2439
2440 case 7:
2441#line 610 "sqlparser.y"
2442 {
2443 (yyval.querySchema) = (yyvsp[(1) - (1)].querySchema);
2444;}
2445 break;
2446
2447 case 8:
2448#line 617 "sqlparser.y"
2449 {
2450 parser->setOperation(Parser::OP_CreateTable);
2451 parser->createTable((yyvsp[(3) - (3)].stringValue)->latin1());
2452 delete (yyvsp[(3) - (3)].stringValue);
2453;}
2454 break;
2455
2456 case 11:
2457#line 627 "sqlparser.y"
2458 {
2459;}
2460 break;
2461
2462 case 12:
2463#line 633 "sqlparser.y"
2464 {
2465 KexiDBDbg << "adding field " << *(yyvsp[(1) - (2)].stringValue) << endl;
2466 field->setName((yyvsp[(1) - (2)].stringValue)->latin1());
2467 parser->table()->addField(field);
2468 field = 0;
2469 delete (yyvsp[(1) - (2)].stringValue);
2470;}
2471 break;
2472
2473 case 13:
2474#line 641 "sqlparser.y"
2475 {
2476 KexiDBDbg << "adding field " << *(yyvsp[(1) - (3)].stringValue) << endl;
2477 field->setName(*(yyvsp[(1) - (3)].stringValue));
2478 delete (yyvsp[(1) - (3)].stringValue);
2479 parser->table()->addField(field);
2480
2481// if(field->isPrimaryKey())
2482// parser->table()->addPrimaryKey(field->name());
2483
2484// delete field;
2485// field = 0;
2486;}
2487 break;
2488
2489 case 15:
2490#line 657 "sqlparser.y"
2491 {
2492;}
2493 break;
2494
2495 case 16:
2496#line 663 "sqlparser.y"
2497 {
2498 field->setPrimaryKey(true);
2499 KexiDBDbg << "primary" << endl;
2500;}
2501 break;
2502
2503 case 17:
2504#line 668 "sqlparser.y"
2505 {
2506 field->setNotNull(true);
2507 KexiDBDbg << "not_null" << endl;
2508;}
2509 break;
2510
2511 case 18:
2512#line 673 "sqlparser.y"
2513 {
2514 field->setAutoIncrement(true);
2515 KexiDBDbg << "ainc" << endl;
2516;}
2517 break;
2518
2519 case 19:
2520#line 681 "sqlparser.y"
2521 {
2522 field = new Field();
2523 field->setType((yyvsp[(1) - (1)].colType));
2524;}
2525 break;
2526
2527 case 20:
2528#line 686 "sqlparser.y"
2529 {
2530 KexiDBDbg << "sql + length" << endl;
2531 field = new Field();
2532 field->setPrecision((yyvsp[(3) - (4)].integerValue));
2533 field->setType((yyvsp[(1) - (4)].colType));
2534;}
2535 break;
2536
2537 case 21:
2538#line 693 "sqlparser.y"
2539 {
2540 field = new Field();
2541 field->setPrecision((yyvsp[(3) - (4)].integerValue));
2542 field->setType(Field::Text);
2543;}
2544 break;
2545
2546 case 22:
2547#line 699 "sqlparser.y"
2548 {
2549 // SQLITE compatibillity
2550 field = new Field();
2552;}
2553 break;
2554
2555 case 23:
2556#line 708 "sqlparser.y"
2557 {
2558 KexiDBDbg << "Select ColViews=" << (yyvsp[(2) - (2)].exprList)->debugString() << endl;
2559
2560 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[(1) - (2)].querySchema), (yyvsp[(2) - (2)].exprList) )))
2561 return 0;
2562;}
2563 break;
2564
2565 case 24:
2566#line 715 "sqlparser.y"
2567 {
2568 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[(1) - (3)].querySchema), (yyvsp[(2) - (3)].exprList), (yyvsp[(3) - (3)].exprList) )))
2569 return 0;
2570;}
2571 break;
2572
2573 case 25:
2574#line 720 "sqlparser.y"
2575 {
2576 KexiDBDbg << "Select ColViews Tables" << endl;
2577 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[(1) - (2)].querySchema), 0, (yyvsp[(2) - (2)].exprList) )))
2578 return 0;
2579;}
2580 break;
2581
2582 case 26:
2583#line 726 "sqlparser.y"
2584 {
2585 KexiDBDbg << "Select ColViews Conditions" << endl;
2586 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[(1) - (3)].querySchema), (yyvsp[(2) - (3)].exprList), 0, (yyvsp[(3) - (3)].selectOptions) )))
2587 return 0;
2588;}
2589 break;
2590
2591 case 27:
2592#line 732 "sqlparser.y"
2593 {
2594 KexiDBDbg << "Select ColViews Tables SelectOptions" << endl;
2595 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[(1) - (4)].querySchema), (yyvsp[(2) - (4)].exprList), (yyvsp[(3) - (4)].exprList), (yyvsp[(4) - (4)].selectOptions) )))
2596 return 0;
2597;}
2598 break;
2599
2600 case 28:
2601#line 741 "sqlparser.y"
2602 {
2603 KexiDBDbg << "SELECT" << endl;
2604// parser->createSelect();
2605// parser->setOperation(Parser::OP_Select);
2606 (yyval.querySchema) = new QuerySchema();
2607;}
2608 break;
2609
2610 case 29:
2611#line 751 "sqlparser.y"
2612 {
2613 KexiDBDbg << "WhereClause" << endl;
2614 (yyval.selectOptions) = new SelectOptionsInternal;
2615 (yyval.selectOptions)->whereExpr = (yyvsp[(1) - (1)].expr);
2616;}
2617 break;
2618
2619 case 30:
2620#line 757 "sqlparser.y"
2621 {
2622 KexiDBDbg << "OrderByClause" << endl;
2623 (yyval.selectOptions) = new SelectOptionsInternal;
2624 (yyval.selectOptions)->orderByColumns = (yyvsp[(3) - (3)].orderByColumns);
2625;}
2626 break;
2627
2628 case 31:
2629#line 763 "sqlparser.y"
2630 {
2631 KexiDBDbg << "WhereClause ORDER BY OrderByClause" << endl;
2632 (yyval.selectOptions) = new SelectOptionsInternal;
2633 (yyval.selectOptions)->whereExpr = (yyvsp[(1) - (4)].expr);
2634 (yyval.selectOptions)->orderByColumns = (yyvsp[(4) - (4)].orderByColumns);
2635;}
2636 break;
2637
2638 case 32:
2639#line 770 "sqlparser.y"
2640 {
2641 KexiDBDbg << "OrderByClause WhereClause" << endl;
2642 (yyval.selectOptions) = new SelectOptionsInternal;
2643 (yyval.selectOptions)->whereExpr = (yyvsp[(4) - (4)].expr);
2644 (yyval.selectOptions)->orderByColumns = (yyvsp[(3) - (4)].orderByColumns);
2645;}
2646 break;
2647
2648 case 33:
2649#line 780 "sqlparser.y"
2650 {
2651 (yyval.expr) = (yyvsp[(2) - (2)].expr);
2652;}
2653 break;
2654
2655 case 34:
2656#line 789 "sqlparser.y"
2657 {
2658 KexiDBDbg << "ORDER BY IDENTIFIER" << endl;
2659 (yyval.orderByColumns) = new OrderByColumnInternal::List;
2660 OrderByColumnInternal orderByColumn;
2661 orderByColumn.setColumnByNameOrNumber( *(yyvsp[(1) - (1)].variantValue) );
2662 (yyval.orderByColumns)->append( orderByColumn );
2663 delete (yyvsp[(1) - (1)].variantValue);
2664;}
2665 break;
2666
2667 case 35:
2668#line 798 "sqlparser.y"
2669 {
2670 KexiDBDbg << "ORDER BY IDENTIFIER OrderByOption" << endl;
2671 (yyval.orderByColumns) = new OrderByColumnInternal::List;
2672 OrderByColumnInternal orderByColumn;
2673 orderByColumn.setColumnByNameOrNumber( *(yyvsp[(1) - (2)].variantValue) );
2674 orderByColumn.ascending = (yyvsp[(2) - (2)].booleanValue);
2675 (yyval.orderByColumns)->append( orderByColumn );
2676 delete (yyvsp[(1) - (2)].variantValue);
2677;}
2678 break;
2679
2680 case 36:
2681#line 808 "sqlparser.y"
2682 {
2683 (yyval.orderByColumns) = (yyvsp[(3) - (3)].orderByColumns);
2684 OrderByColumnInternal orderByColumn;
2685 orderByColumn.setColumnByNameOrNumber( *(yyvsp[(1) - (3)].variantValue) );
2686 (yyval.orderByColumns)->append( orderByColumn );
2687 delete (yyvsp[(1) - (3)].variantValue);
2688;}
2689 break;
2690
2691 case 37:
2692#line 816 "sqlparser.y"
2693 {
2694 (yyval.orderByColumns) = (yyvsp[(4) - (4)].orderByColumns);
2695 OrderByColumnInternal orderByColumn;
2696 orderByColumn.setColumnByNameOrNumber( *(yyvsp[(1) - (4)].variantValue) );
2697 orderByColumn.ascending = (yyvsp[(2) - (4)].booleanValue);
2698 (yyval.orderByColumns)->append( orderByColumn );
2699 delete (yyvsp[(1) - (4)].variantValue);
2700;}
2701 break;
2702
2703 case 38:
2704#line 828 "sqlparser.y"
2705 {
2706 (yyval.variantValue) = new TQVariant( *(yyvsp[(1) - (1)].stringValue) );
2707 KexiDBDbg << "OrderByColumnId: " << *(yyval.variantValue) << endl;
2708 delete (yyvsp[(1) - (1)].stringValue);
2709;}
2710 break;
2711
2712 case 39:
2713#line 834 "sqlparser.y"
2714 {
2715 (yyval.variantValue) = new TQVariant( *(yyvsp[(1) - (3)].stringValue) + "." + *(yyvsp[(3) - (3)].stringValue) );
2716 KexiDBDbg << "OrderByColumnId: " << *(yyval.variantValue) << endl;
2717 delete (yyvsp[(1) - (3)].stringValue);
2718 delete (yyvsp[(3) - (3)].stringValue);
2719;}
2720 break;
2721
2722 case 40:
2723#line 841 "sqlparser.y"
2724 {
2725 (yyval.variantValue) = new TQVariant((yyvsp[(1) - (1)].integerValue));
2726 KexiDBDbg << "OrderByColumnId: " << *(yyval.variantValue) << endl;
2727;}
2728 break;
2729
2730 case 41:
2731#line 848 "sqlparser.y"
2732 {
2733 (yyval.booleanValue) = true;
2734;}
2735 break;
2736
2737 case 42:
2738#line 852 "sqlparser.y"
2739 {
2740 (yyval.booleanValue) = false;
2741;}
2742 break;
2743
2744 case 44:
2745#line 864 "sqlparser.y"
2746 {
2747// KexiDBDbg << "AND " << $3.debugString() << endl;
2748 (yyval.expr) = new BinaryExpr( KexiDBExpr_Logical, (yyvsp[(1) - (3)].expr), AND, (yyvsp[(3) - (3)].expr) );
2749;}
2750 break;
2751
2752 case 45:
2753#line 869 "sqlparser.y"
2754 {
2755 (yyval.expr) = new BinaryExpr( KexiDBExpr_Logical, (yyvsp[(1) - (3)].expr), OR, (yyvsp[(3) - (3)].expr) );
2756;}
2757 break;
2758
2759 case 46:
2760#line 873 "sqlparser.y"
2761 {
2762 (yyval.expr) = new BinaryExpr( KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), XOR, (yyvsp[(3) - (3)].expr) );
2763;}
2764 break;
2765
2766 case 48:
2767#line 883 "sqlparser.y"
2768 {
2769 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), '>', (yyvsp[(3) - (3)].expr));
2770;}
2771 break;
2772
2773 case 49:
2774#line 887 "sqlparser.y"
2775 {
2776 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), GREATER_OR_EQUAL, (yyvsp[(3) - (3)].expr));
2777;}
2778 break;
2779
2780 case 50:
2781#line 891 "sqlparser.y"
2782 {
2783 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), '<', (yyvsp[(3) - (3)].expr));
2784;}
2785 break;
2786
2787 case 51:
2788#line 895 "sqlparser.y"
2789 {
2790 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), LESS_OR_EQUAL, (yyvsp[(3) - (3)].expr));
2791;}
2792 break;
2793
2794 case 52:
2795#line 899 "sqlparser.y"
2796 {
2797 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), '=', (yyvsp[(3) - (3)].expr));
2798;}
2799 break;
2800
2801 case 54:
2802#line 909 "sqlparser.y"
2803 {
2804 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), NOT_EQUAL, (yyvsp[(3) - (3)].expr));
2805;}
2806 break;
2807
2808 case 55:
2809#line 914 "sqlparser.y"
2810 {
2811 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), NOT_EQUAL2, (yyvsp[(3) - (3)].expr));
2812;}
2813 break;
2814
2815 case 56:
2816#line 918 "sqlparser.y"
2817 {
2818 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), LIKE, (yyvsp[(3) - (3)].expr));
2819;}
2820 break;
2821
2822 case 57:
2823#line 922 "sqlparser.y"
2824 {
2825 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), SQL_IN, (yyvsp[(3) - (3)].expr));
2826;}
2827 break;
2828
2829 case 58:
2830#line 926 "sqlparser.y"
2831 {
2832 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), SIMILAR_TO, (yyvsp[(3) - (3)].expr));
2833;}
2834 break;
2835
2836 case 59:
2837#line 930 "sqlparser.y"
2838 {
2839 (yyval.expr) = new BinaryExpr(KexiDBExpr_Relational, (yyvsp[(1) - (3)].expr), NOT_SIMILAR_TO, (yyvsp[(3) - (3)].expr));
2840;}
2841 break;
2842
2843 case 61:
2844#line 940 "sqlparser.y"
2845 {
2846 (yyval.expr) = new UnaryExpr( SQL_IS_NULL, (yyvsp[(1) - (2)].expr) );
2847;}
2848 break;
2849
2850 case 62:
2851#line 944 "sqlparser.y"
2852 {
2853 (yyval.expr) = new UnaryExpr( SQL_IS_NOT_NULL, (yyvsp[(1) - (2)].expr) );
2854;}
2855 break;
2856
2857 case 64:
2858#line 954 "sqlparser.y"
2859 {
2860 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), BITWISE_SHIFT_LEFT, (yyvsp[(3) - (3)].expr));
2861;}
2862 break;
2863
2864 case 65:
2865#line 958 "sqlparser.y"
2866 {
2867 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), BITWISE_SHIFT_RIGHT, (yyvsp[(3) - (3)].expr));
2868;}
2869 break;
2870
2871 case 67:
2872#line 968 "sqlparser.y"
2873 {
2874 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '+', (yyvsp[(3) - (3)].expr));
2875 (yyval.expr)->debug();
2876;}
2877 break;
2878
2879 case 68:
2880#line 973 "sqlparser.y"
2881 {
2882 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '-', (yyvsp[(3) - (3)].expr));
2883;}
2884 break;
2885
2886 case 69:
2887#line 977 "sqlparser.y"
2888 {
2889 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '&', (yyvsp[(3) - (3)].expr));
2890;}
2891 break;
2892
2893 case 70:
2894#line 981 "sqlparser.y"
2895 {
2896 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '|', (yyvsp[(3) - (3)].expr));
2897;}
2898 break;
2899
2900 case 72:
2901#line 991 "sqlparser.y"
2902 {
2903 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '/', (yyvsp[(3) - (3)].expr));
2904;}
2905 break;
2906
2907 case 73:
2908#line 995 "sqlparser.y"
2909 {
2910 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '*', (yyvsp[(3) - (3)].expr));
2911;}
2912 break;
2913
2914 case 74:
2915#line 999 "sqlparser.y"
2916 {
2917 (yyval.expr) = new BinaryExpr(KexiDBExpr_Arithm, (yyvsp[(1) - (3)].expr), '%', (yyvsp[(3) - (3)].expr));
2918;}
2919 break;
2920
2921 case 76:
2922#line 1010 "sqlparser.y"
2923 {
2924 (yyval.expr) = new UnaryExpr( '-', (yyvsp[(2) - (2)].expr) );
2925;}
2926 break;
2927
2928 case 77:
2929#line 1014 "sqlparser.y"
2930 {
2931 (yyval.expr) = new UnaryExpr( '+', (yyvsp[(2) - (2)].expr) );
2932;}
2933 break;
2934
2935 case 78:
2936#line 1018 "sqlparser.y"
2937 {
2938 (yyval.expr) = new UnaryExpr( '~', (yyvsp[(2) - (2)].expr) );
2939;}
2940 break;
2941
2942 case 79:
2943#line 1022 "sqlparser.y"
2944 {
2945 (yyval.expr) = new UnaryExpr( NOT, (yyvsp[(2) - (2)].expr) );
2946;}
2947 break;
2948
2949 case 80:
2950#line 1026 "sqlparser.y"
2951 {
2952 (yyval.expr) = new VariableExpr( *(yyvsp[(1) - (1)].stringValue) );
2953
2954//TODO: simplify this later if that's 'only one field name' expression
2955 KexiDBDbg << " + identifier: " << *(yyvsp[(1) - (1)].stringValue) << endl;
2956 delete (yyvsp[(1) - (1)].stringValue);
2957;}
2958 break;
2959
2960 case 81:
2961#line 1034 "sqlparser.y"
2962 {
2963 (yyval.expr) = new QueryParameterExpr( *(yyvsp[(1) - (1)].stringValue) );
2964 KexiDBDbg << " + query parameter: " << (yyval.expr)->debugString() << endl;
2965 delete (yyvsp[(1) - (1)].stringValue);
2966;}
2967 break;
2968
2969 case 82:
2970#line 1040 "sqlparser.y"
2971 {
2972 KexiDBDbg << " + function: " << *(yyvsp[(1) - (2)].stringValue) << "(" << (yyvsp[(2) - (2)].exprList)->debugString() << ")" << endl;
2973 (yyval.expr) = new FunctionExpr(*(yyvsp[(1) - (2)].stringValue), (yyvsp[(2) - (2)].exprList));
2974 delete (yyvsp[(1) - (2)].stringValue);
2975;}
2976 break;
2977
2978 case 83:
2979#line 1047 "sqlparser.y"
2980 {
2981 (yyval.expr) = new VariableExpr( *(yyvsp[(1) - (3)].stringValue) + "." + *(yyvsp[(3) - (3)].stringValue) );
2982 KexiDBDbg << " + identifier.identifier: " << *(yyvsp[(1) - (3)].stringValue) << "." << *(yyvsp[(3) - (3)].stringValue) << endl;
2983 delete (yyvsp[(1) - (3)].stringValue);
2984 delete (yyvsp[(3) - (3)].stringValue);
2985;}
2986 break;
2987
2988 case 84:
2989#line 1054 "sqlparser.y"
2990 {
2991 (yyval.expr) = new ConstExpr( SQL_NULL, TQVariant() );
2992 KexiDBDbg << " + NULL" << endl;
2993// $$ = new Field();
2994 //$$->setName(TQString());
2995;}
2996 break;
2997
2998 case 85:
2999#line 1061 "sqlparser.y"
3000 {
3001 (yyval.expr) = new ConstExpr( CHARACTER_STRING_LITERAL, *(yyvsp[(1) - (1)].stringValue) );
3002 KexiDBDbg << " + constant " << (yyvsp[(1) - (1)].stringValue) << endl;
3003 delete (yyvsp[(1) - (1)].stringValue);
3004;}
3005 break;
3006
3007 case 86:
3008#line 1067 "sqlparser.y"
3009 {
3010 TQVariant val;
3011 if ((yyvsp[(1) - (1)].integerValue) <= INT_MAX && (yyvsp[(1) - (1)].integerValue) >= INT_MIN)
3012 val = (int)(yyvsp[(1) - (1)].integerValue);
3013 else if ((yyvsp[(1) - (1)].integerValue) <= UINT_MAX && (yyvsp[(1) - (1)].integerValue) >= 0)
3014 val = (uint)(yyvsp[(1) - (1)].integerValue);
3015 else if ((yyvsp[(1) - (1)].integerValue) <= (TQ_LLONG)LLONG_MAX && (yyvsp[(1) - (1)].integerValue) >= (TQ_LLONG)LLONG_MIN)
3016 val = (TQ_LLONG)(yyvsp[(1) - (1)].integerValue);
3017
3018// if ($1 < ULLONG_MAX)
3019// val = (TQ_ULLONG)$1;
3020//TODO ok?
3021
3022 (yyval.expr) = new ConstExpr( INTEGER_CONST, val );
3023 KexiDBDbg << " + int constant: " << val.toString() << endl;
3024;}
3025 break;
3026
3027 case 87:
3028#line 1084 "sqlparser.y"
3029 {
3030 (yyval.expr) = new ConstExpr( REAL_CONST, TQPoint( (yyvsp[(1) - (1)].realValue).integer, (yyvsp[(1) - (1)].realValue).fractional ) );
3031 KexiDBDbg << " + real constant: " << (yyvsp[(1) - (1)].realValue).integer << "." << (yyvsp[(1) - (1)].realValue).fractional << endl;
3032;}
3033 break;
3034
3035 case 89:
3036#line 1095 "sqlparser.y"
3037 {
3038 KexiDBDbg << "(expr)" << endl;
3039 (yyval.expr) = new UnaryExpr('(', (yyvsp[(2) - (3)].expr));
3040;}
3041 break;
3042
3043 case 90:
3044#line 1103 "sqlparser.y"
3045 {
3046// $$ = new NArgExpr(0, 0);
3047// $$->add( $1 );
3048// $$->add( $3 );
3049 (yyval.exprList) = (yyvsp[(2) - (3)].exprList);
3050;}
3051 break;
3052
3053 case 91:
3054#line 1113 "sqlparser.y"
3055 {
3056 (yyval.exprList) = (yyvsp[(3) - (3)].exprList);
3057 (yyval.exprList)->prepend( (yyvsp[(1) - (3)].expr) );
3058;}
3059 break;
3060
3061 case 92:
3062#line 1118 "sqlparser.y"
3063 {
3064 (yyval.exprList) = new NArgExpr(0, 0);
3065 (yyval.exprList)->add( (yyvsp[(1) - (3)].expr) );
3066 (yyval.exprList)->add( (yyvsp[(3) - (3)].expr) );
3067;}
3068 break;
3069
3070 case 93:
3071#line 1127 "sqlparser.y"
3072 {
3073 (yyval.exprList) = (yyvsp[(2) - (2)].exprList);
3074;}
3075 break;
3076
3077 case 94:
3078#line 1172 "sqlparser.y"
3079 {
3080 (yyval.exprList) = (yyvsp[(1) - (3)].exprList);
3081 (yyval.exprList)->add((yyvsp[(3) - (3)].expr));
3082;}
3083 break;
3084
3085 case 95:
3086#line 1177 "sqlparser.y"
3087 {
3088 (yyval.exprList) = new NArgExpr(KexiDBExpr_TableList, IDENTIFIER); //ok?
3089 (yyval.exprList)->add((yyvsp[(1) - (1)].expr));
3090;}
3091 break;
3092
3093 case 96:
3094#line 1185 "sqlparser.y"
3095 {
3096 KexiDBDbg << "FROM: '" << *(yyvsp[(1) - (1)].stringValue) << "'" << endl;
3097 (yyval.expr) = new VariableExpr(*(yyvsp[(1) - (1)].stringValue));
3098
3099 /*
3100//TODO: this isn't ok for more tables:
3101 Field::ListIterator it = parser->select()->fieldsIterator();
3102 for(Field *item; (item = it.current()); ++it)
3103 {
3104 if(item->table() == dummy)
3105 {
3106 item->setTable(schema);
3107 }
3108
3109 if(item->table() && !item->isQueryAsterisk())
3110 {
3111 Field *f = item->table()->field(item->name());
3112 if(!f)
3113 {
3114 ParserError err(i18n("Field List Error"), i18n("Unknown column '%1' in table '%2'").arg(item->name()).arg(schema->name()), ctoken, current);
3115 parser->setError(err);
3116 yyerror("fieldlisterror");
3117 }
3118 }
3119 }*/
3120 delete (yyvsp[(1) - (1)].stringValue);
3121;}
3122 break;
3123
3124 case 97:
3125#line 1213 "sqlparser.y"
3126 {
3127 //table + alias
3128 (yyval.expr) = new BinaryExpr(
3129 KexiDBExpr_SpecialBinary,
3130 new VariableExpr(*(yyvsp[(1) - (2)].stringValue)), 0,
3131 new VariableExpr(*(yyvsp[(2) - (2)].stringValue))
3132 );
3133 delete (yyvsp[(1) - (2)].stringValue);
3134 delete (yyvsp[(2) - (2)].stringValue);
3135;}
3136 break;
3137
3138 case 98:
3139#line 1224 "sqlparser.y"
3140 {
3141 //table + alias
3142 (yyval.expr) = new BinaryExpr(
3143 KexiDBExpr_SpecialBinary,
3144 new VariableExpr(*(yyvsp[(1) - (3)].stringValue)), AS,
3145 new VariableExpr(*(yyvsp[(3) - (3)].stringValue))
3146 );
3147 delete (yyvsp[(1) - (3)].stringValue);
3148 delete (yyvsp[(3) - (3)].stringValue);
3149;}
3150 break;
3151
3152 case 99:
3153#line 1240 "sqlparser.y"
3154 {
3155 (yyval.exprList) = (yyvsp[(1) - (3)].exprList);
3156 (yyval.exprList)->add( (yyvsp[(3) - (3)].expr) );
3157 KexiDBDbg << "ColViews: ColViews , ColItem" << endl;
3158;}
3159 break;
3160
3161 case 100:
3162#line 1246 "sqlparser.y"
3163 {
3164 (yyval.exprList) = new NArgExpr(0,0);
3165 (yyval.exprList)->add( (yyvsp[(1) - (1)].expr) );
3166 KexiDBDbg << "ColViews: ColItem" << endl;
3167;}
3168 break;
3169
3170 case 101:
3171#line 1255 "sqlparser.y"
3172 {
3173// $$ = new Field();
3174// dummy->addField($$);
3175// $$->setExpression( $1 );
3176// parser->select()->addField($$);
3177 (yyval.expr) = (yyvsp[(1) - (1)].expr);
3178 KexiDBDbg << " added column expr: '" << (yyvsp[(1) - (1)].expr)->debugString() << "'" << endl;
3179;}
3180 break;
3181
3182 case 102:
3183#line 1264 "sqlparser.y"
3184 {
3185 (yyval.expr) = (yyvsp[(1) - (1)].expr);
3186 KexiDBDbg << " added column wildcard: '" << (yyvsp[(1) - (1)].expr)->debugString() << "'" << endl;
3187;}
3188 break;
3189
3190 case 103:
3191#line 1269 "sqlparser.y"
3192 {
3193 (yyval.expr) = new BinaryExpr(
3194 KexiDBExpr_SpecialBinary, (yyvsp[(1) - (3)].expr), AS,
3195 new VariableExpr(*(yyvsp[(3) - (3)].stringValue))
3196 );
3197 KexiDBDbg << " added column expr: " << (yyval.expr)->debugString() << endl;
3198 delete (yyvsp[(3) - (3)].stringValue);
3199;}
3200 break;
3201
3202 case 104:
3203#line 1278 "sqlparser.y"
3204 {
3205 (yyval.expr) = new BinaryExpr(
3206 KexiDBExpr_SpecialBinary, (yyvsp[(1) - (2)].expr), 0,
3207 new VariableExpr(*(yyvsp[(2) - (2)].stringValue))
3208 );
3209 KexiDBDbg << " added column expr: " << (yyval.expr)->debugString() << endl;
3210 delete (yyvsp[(2) - (2)].stringValue);
3211;}
3212 break;
3213
3214 case 105:
3215#line 1290 "sqlparser.y"
3216 {
3217 (yyval.expr) = (yyvsp[(1) - (1)].expr);
3218;}
3219 break;
3220
3221 case 106:
3222#line 1334 "sqlparser.y"
3223 {
3224 (yyval.expr) = (yyvsp[(3) - (4)].expr);
3225//TODO
3226// $$->setName("DISTINCT(" + $3->name() + ")");
3227;}
3228 break;
3229
3230 case 107:
3231#line 1343 "sqlparser.y"
3232 {
3233 (yyval.expr) = new VariableExpr("*");
3234 KexiDBDbg << "all columns" << endl;
3235
3236// QueryAsterisk *ast = new QueryAsterisk(parser->select(), dummy);
3237// parser->select()->addAsterisk(ast);
3238// requiresTable = true;
3239;}
3240 break;
3241
3242 case 108:
3243#line 1352 "sqlparser.y"
3244 {
3245 TQString s( *(yyvsp[(1) - (3)].stringValue) );
3246 s += ".*";
3247 (yyval.expr) = new VariableExpr(s);
3248 KexiDBDbg << " + all columns from " << s << endl;
3249 delete (yyvsp[(1) - (3)].stringValue);
3250;}
3251 break;
3252
3253
3254/* Line 1267 of yacc.c. */
3255#line 3256 "sqlparser.tab.c"
3256 default: break;
3257 }
3258 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
3259
3260 YYPOPSTACK (yylen);
3261 yylen = 0;
3262 YY_STACK_PRINT (yyss, yyssp);
3263
3264 *++yyvsp = yyval;
3265
3266
3267 /* Now `shift' the result of the reduction. Determine what state
3268 that goes to, based on the state we popped back to and the rule
3269 number reduced by. */
3270
3271 yyn = yyr1[yyn];
3272
3273 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
3274 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3275 yystate = yytable[yystate];
3276 else
3277 yystate = yydefgoto[yyn - YYNTOKENS];
3278
3279 goto yynewstate;
3280
3281
3282/*------------------------------------.
3283| yyerrlab -- here on detecting error |
3284`------------------------------------*/
3285yyerrlab:
3286 /* If not already recovering from an error, report this error. */
3287 if (!yyerrstatus)
3288 {
3289 ++yynerrs;
3290#if ! YYERROR_VERBOSE
3291 yyerror (YY_("syntax error"));
3292#else
3293 {
3294 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
3295 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
3296 {
3297 YYSIZE_T yyalloc = 2 * yysize;
3298 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
3299 yyalloc = YYSTACK_ALLOC_MAXIMUM;
3300 if (yymsg != yymsgbuf)
3301 YYSTACK_FREE (yymsg);
3302 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
3303 if (yymsg)
3304 yymsg_alloc = yyalloc;
3305 else
3306 {
3307 yymsg = yymsgbuf;
3308 yymsg_alloc = sizeof yymsgbuf;
3309 }
3310 }
3311
3312 if (0 < yysize && yysize <= yymsg_alloc)
3313 {
3314 (void) yysyntax_error (yymsg, yystate, yychar);
3315 yyerror (yymsg);
3316 }
3317 else
3318 {
3319 yyerror (YY_("syntax error"));
3320 if (yysize != 0)
3321 goto yyexhaustedlab;
3322 }
3323 }
3324#endif
3325 }
3326
3327
3328
3329 if (yyerrstatus == 3)
3330 {
3331 /* If just tried and failed to reuse look-ahead token after an
3332 error, discard it. */
3333
3334 if (yychar <= YYEOF)
3335 {
3336 /* Return failure if at end of input. */
3337 if (yychar == YYEOF)
3338 YYABORT;
3339 }
3340 else
3341 {
3342 yydestruct ("Error: discarding",
3343 yytoken, &yylval);
3344 yychar = YYEMPTY;
3345 }
3346 }
3347
3348 /* Else will try to reuse look-ahead token after shifting the error
3349 token. */
3350 goto yyerrlab1;
3351
3352
3353/*---------------------------------------------------.
3354| yyerrorlab -- error raised explicitly by YYERROR. |
3355`---------------------------------------------------*/
3356yyerrorlab:
3357
3358 /* Pacify compilers like GCC when the user code never invokes
3359 YYERROR and the label yyerrorlab therefore never appears in user
3360 code. */
3361 if (/*CONSTCOND*/ 0)
3362 goto yyerrorlab;
3363
3364 /* Do not reclaim the symbols of the rule which action triggered
3365 this YYERROR. */
3366 YYPOPSTACK (yylen);
3367 yylen = 0;
3368 YY_STACK_PRINT (yyss, yyssp);
3369 yystate = *yyssp;
3370 goto yyerrlab1;
3371
3372
3373/*-------------------------------------------------------------.
3374| yyerrlab1 -- common code for both syntax error and YYERROR. |
3375`-------------------------------------------------------------*/
3376yyerrlab1:
3377 yyerrstatus = 3; /* Each real token shifted decrements this. */
3378
3379 for (;;)
3380 {
3381 yyn = yypact[yystate];
3382 if (yyn != YYPACT_NINF)
3383 {
3384 yyn += YYTERROR;
3385 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3386 {
3387 yyn = yytable[yyn];
3388 if (0 < yyn)
3389 break;
3390 }
3391 }
3392
3393 /* Pop the current state because it cannot handle the error token. */
3394 if (yyssp == yyss)
3395 YYABORT;
3396
3397
3398 yydestruct ("Error: popping",
3399 yystos[yystate], yyvsp);
3400 YYPOPSTACK (1);
3401 yystate = *yyssp;
3402 YY_STACK_PRINT (yyss, yyssp);
3403 }
3404
3405 if (yyn == YYFINAL)
3406 YYACCEPT;
3407
3408 *++yyvsp = yylval;
3409
3410
3411 /* Shift the error token. */
3412 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3413
3414 yystate = yyn;
3415 goto yynewstate;
3416
3417
3418/*-------------------------------------.
3419| yyacceptlab -- YYACCEPT comes here. |
3420`-------------------------------------*/
3421yyacceptlab:
3422 yyresult = 0;
3423 goto yyreturn;
3424
3425/*-----------------------------------.
3426| yyabortlab -- YYABORT comes here. |
3427`-----------------------------------*/
3428yyabortlab:
3429 yyresult = 1;
3430 goto yyreturn;
3431
3432#ifndef yyoverflow
3433/*-------------------------------------------------.
3434| yyexhaustedlab -- memory exhaustion comes here. |
3435`-------------------------------------------------*/
3436yyexhaustedlab:
3437 yyerror (YY_("memory exhausted"));
3438 yyresult = 2;
3439 /* Fall through. */
3440#endif
3441
3442yyreturn:
3443 if (yychar != YYEOF && yychar != YYEMPTY)
3444 yydestruct ("Cleanup: discarding lookahead",
3445 yytoken, &yylval);
3446 /* Do not reclaim the symbols of the rule which action triggered
3447 this YYABORT or YYACCEPT. */
3448 YYPOPSTACK (yylen);
3449 YY_STACK_PRINT (yyss, yyssp);
3450 while (yyssp != yyss)
3451 {
3452 yydestruct ("Cleanup: popping",
3453 yystos[*yyssp], yyvsp);
3454 YYPOPSTACK (1);
3455 }
3456#ifndef yyoverflow
3457 if (yyss != yyssa)
3458 YYSTACK_FREE (yyss);
3459#endif
3460#if YYERROR_VERBOSE
3461 if (yymsg != yymsgbuf)
3462 YYSTACK_FREE (yymsg);
3463#endif
3464 return yyresult;
3465}
3466
3467
3468#line 1367 "sqlparser.y"
3469
3470
3471
3472const char * const tname(int offset) { return yytname[offset]; }
A base class for all expressions.
Definition expression.h:67
FieldList & addField(Field *field)
Meta-data for a field.
Definition field.h:73
void setName(const TQString &name)
Definition field.cpp:324
@ InvalidType
Definition field.h:84
void setPrecision(uint p)
Definition field.cpp:365
void setPrimaryKey(bool p)
Definition field.cpp:524
void setAutoIncrement(bool a)
Definition field.cpp:515
void setType(Type t)
Definition field.cpp:330
void setNotNull(bool n)
Definition field.cpp:558
A base class N-argument operation.
Definition expression.h:130
TableSchema * table()
Definition parser.cpp:67
@ OP_Select
Alter an existing table.
Definition parser.h:125
@ OP_CreateTable
Error while parsing.
Definition parser.h:123
Query parameter used to getting user input of constant values.
Definition expression.h:218
KexiDB::QuerySchema provides information about database query.
An unary argument operation: + - NOT (or !) ~ "IS NULL" "IS NOT NULL".
Definition expression.h:150
Variables like fieldname or tablename.fieldname
Definition expression.h:245
High-level database connectivity library with database backend drivers.
KEXI_DB_EXPORT void debug(const QuerySchemaParameterList &list)
Shows debug information for list.