~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to libs/db/parser/sqlparser.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

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