kexi

sqlparser.cpp

00001 
00002 /*  A Bison parser, made from sqlparser.y
00003     by GNU Bison version 1.28  */
00004 
00005 #define YYBISON 1  /* Identify Bison output.  */
00006 
00007 #define UMINUS  257
00008 #define SQL_TYPE    258
00009 #define SQL_ABS 259
00010 #define ACOS    260
00011 #define AMPERSAND   261
00012 #define SQL_ABSOLUTE    262
00013 #define ADA 263
00014 #define ADD 264
00015 #define ADD_DAYS    265
00016 #define ADD_HOURS   266
00017 #define ADD_MINUTES 267
00018 #define ADD_MONTHS  268
00019 #define ADD_SECONDS 269
00020 #define ADD_YEARS   270
00021 #define ALL 271
00022 #define ALLOCATE    272
00023 #define ALTER   273
00024 #define AND 274
00025 #define ANY 275
00026 #define ARE 276
00027 #define AS  277
00028 #define ASIN    278
00029 #define ASC 279
00030 #define ASCII   280
00031 #define ASSERTION   281
00032 #define ATAN    282
00033 #define ATAN2   283
00034 #define AUTHORIZATION   284
00035 #define AUTO_INCREMENT  285
00036 #define AVG 286
00037 #define BEFORE  287
00038 #define SQL_BEGIN   288
00039 #define BETWEEN 289
00040 #define BIGINT  290
00041 #define BINARY  291
00042 #define BIT 292
00043 #define BIT_LENGTH  293
00044 #define BITWISE_SHIFT_LEFT  294
00045 #define BITWISE_SHIFT_RIGHT 295
00046 #define BREAK   296
00047 #define BY  297
00048 #define CASCADE 298
00049 #define CASCADED    299
00050 #define CASE    300
00051 #define CAST    301
00052 #define CATALOG 302
00053 #define CEILING 303
00054 #define CENTER  304
00055 #define SQL_CHAR    305
00056 #define CHAR_LENGTH 306
00057 #define CHARACTER_STRING_LITERAL    307
00058 #define CHECK   308
00059 #define CLOSE   309
00060 #define COALESCE    310
00061 #define COBOL   311
00062 #define COLLATE 312
00063 #define COLLATION   313
00064 #define COLUMN  314
00065 #define COMMIT  315
00066 #define COMPUTE 316
00067 #define CONCAT  317
00068 #define CONCATENATION   318
00069 #define CONNECT 319
00070 #define CONNECTION  320
00071 #define CONSTRAINT  321
00072 #define CONSTRAINTS 322
00073 #define CONTINUE    323
00074 #define CONVERT 324
00075 #define CORRESPONDING   325
00076 #define COS 326
00077 #define COT 327
00078 #define COUNT   328
00079 #define CREATE  329
00080 #define CURDATE 330
00081 #define CURRENT 331
00082 #define CURRENT_DATE    332
00083 #define CURRENT_TIME    333
00084 #define CURRENT_TIMESTAMP   334
00085 #define CURTIME 335
00086 #define CURSOR  336
00087 #define DATABASE    337
00088 #define SQL_DATE    338
00089 #define DATE_FORMAT 339
00090 #define DATE_REMAINDER  340
00091 #define DATE_VALUE  341
00092 #define DAY 342
00093 #define DAYOFMONTH  343
00094 #define DAYOFWEEK   344
00095 #define DAYOFYEAR   345
00096 #define DAYS_BETWEEN    346
00097 #define DEALLOCATE  347
00098 #define DEC 348
00099 #define DECLARE 349
00100 #define DEFAULT 350
00101 #define DEFERRABLE  351
00102 #define DEFERRED    352
00103 #define SQL_DELETE  353
00104 #define DESC    354
00105 #define DESCRIBE    355
00106 #define DESCRIPTOR  356
00107 #define DIAGNOSTICS 357
00108 #define DICTIONARY  358
00109 #define DIRECTORY   359
00110 #define DISCONNECT  360
00111 #define DISPLACEMENT    361
00112 #define DISTINCT    362
00113 #define DOMAIN_TOKEN    363
00114 #define SQL_DOUBLE  364
00115 #define DOUBLE_QUOTED_STRING    365
00116 #define DROP    366
00117 #define ELSE    367
00118 #define END 368
00119 #define END_EXEC    369
00120 #define EQUAL   370
00121 #define ESCAPE  371
00122 #define EXCEPT  372
00123 #define SQL_EXCEPTION   373
00124 #define EXEC    374
00125 #define EXECUTE 375
00126 #define EXISTS  376
00127 #define EXP 377
00128 #define EXPONENT    378
00129 #define EXTERNAL    379
00130 #define EXTRACT 380
00131 #define SQL_FALSE   381
00132 #define FETCH   382
00133 #define FIRST   383
00134 #define SQL_FLOAT   384
00135 #define FLOOR   385
00136 #define FN  386
00137 #define FOR 387
00138 #define FOREIGN 388
00139 #define FORTRAN 389
00140 #define FOUND   390
00141 #define FOUR_DIGITS 391
00142 #define FROM    392
00143 #define FULL    393
00144 #define GET 394
00145 #define GLOBAL  395
00146 #define GO  396
00147 #define GOTO    397
00148 #define GRANT   398
00149 #define GREATER_OR_EQUAL    399
00150 #define HAVING  400
00151 #define HOUR    401
00152 #define HOURS_BETWEEN   402
00153 #define IDENTITY    403
00154 #define IFNULL  404
00155 #define SQL_IGNORE  405
00156 #define IMMEDIATE   406
00157 #define SQL_IN  407
00158 #define INCLUDE 408
00159 #define INDEX   409
00160 #define INDICATOR   410
00161 #define INITIALLY   411
00162 #define INNER   412
00163 #define INPUT   413
00164 #define INSENSITIVE 414
00165 #define INSERT  415
00166 #define INTEGER 416
00167 #define INTERSECT   417
00168 #define INTERVAL    418
00169 #define INTO    419
00170 #define IS  420
00171 #define ISOLATION   421
00172 #define JOIN    422
00173 #define JUSTIFY 423
00174 #define KEY 424
00175 #define LANGUAGE    425
00176 #define LAST    426
00177 #define LCASE   427
00178 #define LEFT    428
00179 #define LENGTH  429
00180 #define LESS_OR_EQUAL   430
00181 #define LEVEL   431
00182 #define LIKE    432
00183 #define LINE_WIDTH  433
00184 #define LOCAL   434
00185 #define LOCATE  435
00186 #define LOG 436
00187 #define SQL_LONG    437
00188 #define LOWER   438
00189 #define LTRIM   439
00190 #define LTRIP   440
00191 #define MATCH   441
00192 #define SQL_MAX 442
00193 #define MICROSOFT   443
00194 #define SQL_MIN 444
00195 #define MINUS   445
00196 #define MINUTE  446
00197 #define MINUTES_BETWEEN 447
00198 #define MOD 448
00199 #define MODIFY  449
00200 #define MODULE  450
00201 #define MONTH   451
00202 #define MONTHS_BETWEEN  452
00203 #define MUMPS   453
00204 #define NAMES   454
00205 #define NATIONAL    455
00206 #define NCHAR   456
00207 #define NEXT    457
00208 #define NODUP   458
00209 #define NONE    459
00210 #define NOT 460
00211 #define NOT_EQUAL   461
00212 #define NOT_EQUAL2  462
00213 #define NOW 463
00214 #define SQL_NULL    464
00215 #define SQL_IS  465
00216 #define SQL_IS_NULL 466
00217 #define SQL_IS_NOT_NULL 467
00218 #define NULLIF  468
00219 #define NUMERIC 469
00220 #define OCTET_LENGTH    470
00221 #define ODBC    471
00222 #define OF  472
00223 #define SQL_OFF 473
00224 #define SQL_ON  474
00225 #define ONLY    475
00226 #define OPEN    476
00227 #define OPTION  477
00228 #define OR  478
00229 #define ORDER   479
00230 #define OUTER   480
00231 #define OUTPUT  481
00232 #define OVERLAPS    482
00233 #define PAGE    483
00234 #define PARTIAL 484
00235 #define SQL_PASCAL  485
00236 #define PERSISTENT  486
00237 #define CQL_PI  487
00238 #define PLI 488
00239 #define POSITION    489
00240 #define PRECISION   490
00241 #define PREPARE 491
00242 #define PRESERVE    492
00243 #define PRIMARY 493
00244 #define PRIOR   494
00245 #define PRIVILEGES  495
00246 #define PROCEDURE   496
00247 #define PRODUCT 497
00248 #define PUBLIC  498
00249 #define QUARTER 499
00250 #define QUIT    500
00251 #define RAND    501
00252 #define READ_ONLY   502
00253 #define REAL    503
00254 #define REFERENCES  504
00255 #define REPEAT  505
00256 #define REPLACE 506
00257 #define RESTRICT    507
00258 #define REVOKE  508
00259 #define RIGHT   509
00260 #define ROLLBACK    510
00261 #define ROWS    511
00262 #define RPAD    512
00263 #define RTRIM   513
00264 #define SCHEMA  514
00265 #define SCREEN_WIDTH    515
00266 #define SCROLL  516
00267 #define SECOND  517
00268 #define SECONDS_BETWEEN 518
00269 #define SELECT  519
00270 #define SEQUENCE    520
00271 #define SETOPT  521
00272 #define SET 522
00273 #define SHOWOPT 523
00274 #define SIGN    524
00275 #define SIMILAR_TO  525
00276 #define NOT_SIMILAR_TO  526
00277 #define INTEGER_CONST   527
00278 #define REAL_CONST  528
00279 #define DATE_CONST  529
00280 #define DATETIME_CONST  530
00281 #define TIME_CONST  531
00282 #define SIN 532
00283 #define SQL_SIZE    533
00284 #define SMALLINT    534
00285 #define SOME    535
00286 #define SPACE   536
00287 #define SQL 537
00288 #define SQL_TRUE    538
00289 #define SQLCA   539
00290 #define SQLCODE 540
00291 #define SQLERROR    541
00292 #define SQLSTATE    542
00293 #define SQLWARNING  543
00294 #define SQRT    544
00295 #define STDEV   545
00296 #define SUBSTRING   546
00297 #define SUM 547
00298 #define SYSDATE 548
00299 #define SYSDATE_FORMAT  549
00300 #define SYSTEM  550
00301 #define TABLE   551
00302 #define TAN 552
00303 #define TEMPORARY   553
00304 #define THEN    554
00305 #define THREE_DIGITS    555
00306 #define TIME    556
00307 #define TIMESTAMP   557
00308 #define TIMEZONE_HOUR   558
00309 #define TIMEZONE_MINUTE 559
00310 #define TINYINT 560
00311 #define TO  561
00312 #define TO_CHAR 562
00313 #define TO_DATE 563
00314 #define TRANSACTION 564
00315 #define TRANSLATE   565
00316 #define TRANSLATION 566
00317 #define TRUNCATE    567
00318 #define GENERAL_TITLE   568
00319 #define TWO_DIGITS  569
00320 #define UCASE   570
00321 #define UNION   571
00322 #define UNIQUE  572
00323 #define SQL_UNKNOWN 573
00324 #define UPDATE  574
00325 #define UPPER   575
00326 #define USAGE   576
00327 #define USER    577
00328 #define IDENTIFIER  578
00329 #define IDENTIFIER_DOT_ASTERISK 579
00330 #define USING   580
00331 #define VALUE   581
00332 #define VALUES  582
00333 #define VARBINARY   583
00334 #define VARCHAR 584
00335 #define VARYING 585
00336 #define VENDOR  586
00337 #define VIEW    587
00338 #define WEEK    588
00339 #define WHEN    589
00340 #define WHENEVER    590
00341 #define WHERE   591
00342 #define WHERE_CURRENT_OF    592
00343 #define WITH    593
00344 #define WORD_WRAPPED    594
00345 #define WORK    595
00346 #define WRAPPED 596
00347 #define XOR 597
00348 #define YEAR    598
00349 #define YEARS_BETWEEN   599
00350 #define SCAN_ERROR  600
00351 #define __LAST_TOKEN    601
00352 #define ILIKE   602
00353 
00354 #line 433 "sqlparser.y"
00355 
00356 #include <stdio.h>
00357 #include <string.h>
00358 #include <string>
00359 #include <iostream>
00360 #include <assert.h>
00361 #include <limits.h>
00362 //TODO OK?
00363 #ifdef Q_WS_WIN
00364 //workaround for bug on msvc
00365 # undef LLONG_MIN
00366 #endif
00367 #ifndef LLONG_MAX
00368 # define LLONG_MAX     0x7fffffffffffffffLL
00369 #endif
00370 #ifndef LLONG_MIN
00371 # define LLONG_MIN     0x8000000000000000LL
00372 #endif
00373 #ifndef LLONG_MAX
00374 # define ULLONG_MAX    0xffffffffffffffffLL
00375 #endif
00376 
00377 #ifdef _WIN32
00378 # include <malloc.h>
00379 #endif
00380 
00381 #include <qobject.h>
00382 #include <kdebug.h>
00383 #include <klocale.h>
00384 #include <qptrlist.h>
00385 #include <qcstring.h>
00386 
00387 #include <connection.h>
00388 #include <queryschema.h>
00389 #include <field.h>
00390 #include <tableschema.h>
00391 
00392 #include "parser.h"
00393 #include "parser_p.h"
00394 #include "sqltypes.h"
00395 
00396 int yylex();
00397 
00398 //  using namespace std;
00399 using namespace KexiDB;
00400 
00401 #define YY_NO_UNPUT
00402 #define YYSTACK_USE_ALLOCA 1
00403 #define YYMAXDEPTH 255
00404 
00405     extern "C"
00406     {
00407         int yywrap()
00408         {
00409             return 1;
00410         }
00411     }
00412 
00413 #if 0
00414     struct yyval
00415     {
00416         QString parserUserName;
00417         int integerValue;
00418         KexiDBField::ColumnType coltype;
00419     }
00420 #endif
00421 
00422 #line 501 "sqlparser.y"
00423 typedef union {
00424     char stringValue[255];
00425     Q_LLONG integerValue;
00426     struct realType realValue;
00427     KexiDB::Field::Type colType;
00428     KexiDB::Field *field;
00429     KexiDB::BaseExpr *expr;
00430     KexiDB::NArgExpr *exprList;
00431     KexiDB::ConstExpr *constExpr;
00432     KexiDB::QuerySchema *querySchema;
00433 } YYSTYPE;
00434 #include <stdio.h>
00435 
00436 #ifndef __cplusplus
00437 #ifndef __STDC__
00438 #define const
00439 #endif
00440 #endif
00441 
00442 
00443 
00444 #define YYFINAL     156
00445 #define YYFLAG      -32768
00446 #define YYNTBASE    372
00447 
00448 #define YYTRANSLATE(x) ((unsigned)(x) <= 602 ? yytranslate[x] : 404)
00449 
00450 static const short yytranslate[] = {     0,
00451      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00452      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00453      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00454      2,     2,     2,     2,     2,   356,   351,   369,   360,   357,
00455    358,   350,   349,   354,   348,   355,   361,     2,     2,     2,
00456      2,     2,     2,     2,     2,     2,     2,     2,   353,   363,
00457    362,   364,   359,   352,     2,     2,     2,     2,     2,     2,
00458      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00459      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00460    367,     2,   368,   366,     2,     2,     2,     2,     2,     2,
00461      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00462      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00463      2,     2,     2,   370,     2,   371,     2,     2,     2,     2,
00464      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00465      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00466      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00467      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00468      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00469      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00470      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00471      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00472      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00473      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00474      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00475      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00476      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
00477      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
00478     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
00479     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
00480     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
00481     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
00482     57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
00483     67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
00484     77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
00485     87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
00486     97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
00487    107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
00488    117,   118,   119,   120,   121,   122,   123,   124,   125,   126,
00489    127,   128,   129,   130,   131,   132,   133,   134,   135,   136,
00490    137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
00491    147,   148,   149,   150,   151,   152,   153,   154,   155,   156,
00492    157,   158,   159,   160,   161,   162,   163,   164,   165,   166,
00493    167,   168,   169,   170,   171,   172,   173,   174,   175,   176,
00494    177,   178,   179,   180,   181,   182,   183,   184,   185,   186,
00495    187,   188,   189,   190,   191,   192,   193,   194,   195,   196,
00496    197,   198,   199,   200,   201,   202,   203,   204,   205,   206,
00497    207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
00498    217,   218,   219,   220,   221,   222,   223,   224,   225,   226,
00499    227,   228,   229,   230,   231,   232,   233,   234,   235,   236,
00500    237,   238,   239,   240,   241,   242,   243,   244,   245,   246,
00501    247,   248,   249,   250,   251,   252,   253,   254,   255,   256,
00502    257,   258,   259,   260,   261,   262,   263,   264,   265,   266,
00503    267,   268,   269,   270,   271,   272,   273,   274,   275,   276,
00504    277,   278,   279,   280,   281,   282,   283,   284,   285,   286,
00505    287,   288,   289,   290,   291,   292,   293,   294,   295,   296,
00506    297,   298,   299,   300,   301,   302,   303,   304,   305,   306,
00507    307,   308,   309,   310,   311,   312,   313,   314,   315,   316,
00508    317,   318,   319,   320,   321,   322,   323,   324,   325,   326,
00509    327,   328,   329,   330,   331,   332,   333,   334,   335,   336,
00510    337,   338,   339,   340,   341,   342,   343,   344,   345,   346,
00511    347,   365
00512 };
00513 
00514 #if YYDEBUG != 0
00515 static const short yyprhs[] = {     0,
00516      0,     2,     6,     8,    11,    13,    15,    16,    24,    28,
00517     30,    33,    37,    40,    42,    45,    48,    50,    52,    57,
00518     62,    63,    66,    70,    73,    77,    82,    86,    88,    91,
00519     93,    97,   101,   105,   107,   111,   115,   119,   123,   127,
00520    129,   133,   137,   141,   145,   149,   153,   155,   158,   161,
00521    163,   167,   171,   173,   177,   181,   185,   189,   191,   195,
00522    199,   203,   205,   208,   211,   214,   217,   219,   222,   226,
00523    228,   230,   232,   234,   236,   240,   244,   248,   252,   255,
00524    259,   261,   263,   266,   270,   274,   276,   278,   280,   284,
00525    287,   289,   294,   296
00526 };
00527 
00528 static const short yyrhs[] = {   373,
00529      0,   374,   353,   373,     0,   374,     0,   374,   353,     0,
00530    375,     0,   382,     0,     0,    75,   297,   324,   376,   357,
00531    377,   358,     0,   377,   354,   378,     0,   378,     0,   324,
00532    381,     0,   324,   381,   379,     0,   379,   380,     0,   380,
00533      0,   239,   170,     0,   206,   210,     0,    31,     0,     4,
00534      0,     4,   357,   273,   358,     0,   330,   357,   273,   358,
00535      0,     0,   383,   400,     0,   383,   400,   397,     0,   383,
00536    397,     0,   383,   400,   384,     0,   383,   400,   397,   384,
00537      0,   383,   397,   384,     0,   265,     0,   337,   385,     0,
00538    386,     0,   387,    20,   386,     0,   387,   224,   386,     0,
00539    387,   343,   386,     0,   387,     0,   388,   364,   387,     0,
00540    388,   145,   387,     0,   388,   363,   387,     0,   388,   176,
00541    387,     0,   388,   362,   387,     0,   388,     0,   389,   207,
00542    388,     0,   389,   208,   388,     0,   389,   178,   388,     0,
00543    389,   153,   388,     0,   389,   271,   388,     0,   389,   272,
00544    388,     0,   389,     0,   389,   212,     0,   389,   213,     0,
00545    390,     0,   391,    40,   390,     0,   391,    41,   390,     0,
00546    391,     0,   392,   349,   391,     0,   392,   348,   391,     0,
00547    392,   369,   391,     0,   392,   370,   391,     0,   392,     0,
00548    393,   361,   392,     0,   393,   350,   392,     0,   393,   351,
00549    392,     0,   393,     0,   348,   393,     0,   349,   393,     0,
00550    371,   393,     0,   206,   393,     0,   324,     0,   324,   395,
00551      0,   324,   355,   324,     0,   210,     0,    53,     0,   273,
00552      0,   274,     0,   394,     0,   357,   385,   358,     0,   357,
00553    396,   358,     0,   385,   354,   396,     0,   385,   354,   385,
00554      0,   138,   398,     0,   398,   354,   399,     0,   399,     0,
00555    324,     0,   324,   324,     0,   324,    23,   324,     0,   400,
00556    354,   401,     0,   401,     0,   402,     0,   403,     0,   402,
00557     23,   324,     0,   402,   324,     0,   385,     0,   108,   357,
00558    402,   358,     0,   350,     0,   324,   355,   350,     0
00559 };
00560 
00561 #endif
00562 
00563 #if YYDEBUG != 0
00564 static const short yyrline[] = { 0,
00565    565,   575,   580,   581,   590,   595,   601,   607,   610,   611,
00566    616,   626,   640,   641,   646,   652,   657,   664,   670,   677,
00567    683,   691,   699,   704,   710,   716,   722,   730,   740,   747,
00568    752,   758,   762,   766,   771,   776,   780,   784,   788,   792,
00569    797,   802,   807,   811,   815,   819,   823,   828,   833,   837,
00570    842,   847,   851,   856,   862,   866,   870,   874,   879,   884,
00571    888,   892,   897,   903,   907,   911,   915,   928,   934,   945,
00572    952,   958,   975,   980,   985,   993,  1003,  1009,  1017,  1058,
00573   1064,  1071,  1107,  1116,  1129,  1136,  1144,  1154,  1159,  1171,
00574   1185,  1230,  1238,  1248
00575 };
00576 #endif
00577 
00578 
00579 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
00580 
00581 static const char * const yytname[] = {   "$","error","$undefined.","UMINUS",
00582 "SQL_TYPE","SQL_ABS","ACOS","AMPERSAND","SQL_ABSOLUTE","ADA","ADD","ADD_DAYS",
00583 "ADD_HOURS","ADD_MINUTES","ADD_MONTHS","ADD_SECONDS","ADD_YEARS","ALL","ALLOCATE",
00584 "ALTER","AND","ANY","ARE","AS","ASIN","ASC","ASCII","ASSERTION","ATAN","ATAN2",
00585 "AUTHORIZATION","AUTO_INCREMENT","AVG","BEFORE","SQL_BEGIN","BETWEEN","BIGINT",
00586 "BINARY","BIT","BIT_LENGTH","BITWISE_SHIFT_LEFT","BITWISE_SHIFT_RIGHT","BREAK",
00587 "BY","CASCADE","CASCADED","CASE","CAST","CATALOG","CEILING","CENTER","SQL_CHAR",
00588 "CHAR_LENGTH","CHARACTER_STRING_LITERAL","CHECK","CLOSE","COALESCE","COBOL",
00589 "COLLATE","COLLATION","COLUMN","COMMIT","COMPUTE","CONCAT","CONCATENATION","CONNECT",
00590 "CONNECTION","CONSTRAINT","CONSTRAINTS","CONTINUE","CONVERT","CORRESPONDING",
00591 "COS","COT","COUNT","CREATE","CURDATE","CURRENT","CURRENT_DATE","CURRENT_TIME",
00592 "CURRENT_TIMESTAMP","CURTIME","CURSOR","DATABASE","SQL_DATE","DATE_FORMAT","DATE_REMAINDER",
00593 "DATE_VALUE","DAY","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DAYS_BETWEEN","DEALLOCATE",
00594 "DEC","DECLARE","DEFAULT","DEFERRABLE","DEFERRED","SQL_DELETE","DESC","DESCRIBE",
00595 "DESCRIPTOR","DIAGNOSTICS","DICTIONARY","DIRECTORY","DISCONNECT","DISPLACEMENT",
00596 "DISTINCT","DOMAIN_TOKEN","SQL_DOUBLE","DOUBLE_QUOTED_STRING","DROP","ELSE",
00597 "END","END_EXEC","EQUAL","ESCAPE","EXCEPT","SQL_EXCEPTION","EXEC","EXECUTE",
00598 "EXISTS","EXP","EXPONENT","EXTERNAL","EXTRACT","SQL_FALSE","FETCH","FIRST","SQL_FLOAT",
00599 "FLOOR","FN","FOR","FOREIGN","FORTRAN","FOUND","FOUR_DIGITS","FROM","FULL","GET",
00600 "GLOBAL","GO","GOTO","GRANT","GREATER_OR_EQUAL","HAVING","HOUR","HOURS_BETWEEN",
00601 "IDENTITY","IFNULL","SQL_IGNORE","IMMEDIATE","SQL_IN","INCLUDE","INDEX","INDICATOR",
00602 "INITIALLY","INNER","INPUT","INSENSITIVE","INSERT","INTEGER","INTERSECT","INTERVAL",
00603 "INTO","IS","ISOLATION","JOIN","JUSTIFY","KEY","LANGUAGE","LAST","LCASE","LEFT",
00604 "LENGTH","LESS_OR_EQUAL","LEVEL","LIKE","LINE_WIDTH","LOCAL","LOCATE","LOG",
00605 "SQL_LONG","LOWER","LTRIM","LTRIP","MATCH","SQL_MAX","MICROSOFT","SQL_MIN","MINUS",
00606 "MINUTE","MINUTES_BETWEEN","MOD","MODIFY","MODULE","MONTH","MONTHS_BETWEEN",
00607 "MUMPS","NAMES","NATIONAL","NCHAR","NEXT","NODUP","NONE","NOT","NOT_EQUAL","NOT_EQUAL2",
00608 "NOW","SQL_NULL","SQL_IS","SQL_IS_NULL","SQL_IS_NOT_NULL","NULLIF","NUMERIC",
00609 "OCTET_LENGTH","ODBC","OF","SQL_OFF","SQL_ON","ONLY","OPEN","OPTION","OR","ORDER",
00610 "OUTER","OUTPUT","OVERLAPS","PAGE","PARTIAL","SQL_PASCAL","PERSISTENT","CQL_PI",
00611 "PLI","POSITION","PRECISION","PREPARE","PRESERVE","PRIMARY","PRIOR","PRIVILEGES",
00612 "PROCEDURE","PRODUCT","PUBLIC","QUARTER","QUIT","RAND","READ_ONLY","REAL","REFERENCES",
00613 "REPEAT","REPLACE","RESTRICT","REVOKE","RIGHT","ROLLBACK","ROWS","RPAD","RTRIM",
00614 "SCHEMA","SCREEN_WIDTH","SCROLL","SECOND","SECONDS_BETWEEN","SELECT","SEQUENCE",
00615 "SETOPT","SET","SHOWOPT","SIGN","SIMILAR_TO","NOT_SIMILAR_TO","INTEGER_CONST",
00616 "REAL_CONST","DATE_CONST","DATETIME_CONST","TIME_CONST","SIN","SQL_SIZE","SMALLINT",
00617 "SOME","SPACE","SQL","SQL_TRUE","SQLCA","SQLCODE","SQLERROR","SQLSTATE","SQLWARNING",
00618 "SQRT","STDEV","SUBSTRING","SUM","SYSDATE","SYSDATE_FORMAT","SYSTEM","TABLE",
00619 "TAN","TEMPORARY","THEN","THREE_DIGITS","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE",
00620 "TINYINT","TO","TO_CHAR","TO_DATE","TRANSACTION","TRANSLATE","TRANSLATION","TRUNCATE",
00621 "GENERAL_TITLE","TWO_DIGITS","UCASE","UNION","UNIQUE","SQL_UNKNOWN","UPDATE",
00622 "UPPER","USAGE","USER","IDENTIFIER","IDENTIFIER_DOT_ASTERISK","USING","VALUE",
00623 "VALUES","VARBINARY","VARCHAR","VARYING","VENDOR","VIEW","WEEK","WHEN","WHENEVER",
00624 "WHERE","WHERE_CURRENT_OF","WITH","WORD_WRAPPED","WORK","WRAPPED","XOR","YEAR",
00625 "YEARS_BETWEEN","SCAN_ERROR","__LAST_TOKEN","'-'","'+'","'*'","'%'","'@'","';'",
00626 "','","'.'","'$'","'('","')'","'?'","'\\''","'/'","'='","'<'","'>'","ILIKE",
00627 "'^'","'['","']'","'&'","'|'","'~'","TopLevelStatement","StatementList","Statement",
00628 "CreateTableStatement","@1","ColDefs","ColDef","ColKeys","ColKey","ColType",
00629 "SelectStatement","Select","WhereClause","aExpr","aExpr2","aExpr3","aExpr4",
00630 "aExpr5","aExpr6","aExpr7","aExpr8","aExpr9","aExpr10","aExprList","aExprList2",
00631 "Tables","FlatTableList","FlatTable","ColViews","ColItem","ColExpression","ColWildCard", NULL
00632 };
00633 #endif
00634 
00635 static const short yyr1[] = {     0,
00636    372,   373,   373,   373,   374,   374,   376,   375,   377,   377,
00637    378,   378,   379,   379,   380,   380,   380,   381,   381,   381,
00638    381,   382,   382,   382,   382,   382,   382,   383,   384,   385,
00639    386,   386,   386,   386,   387,   387,   387,   387,   387,   387,
00640    388,   388,   388,   388,   388,   388,   388,   389,   389,   389,
00641    390,   390,   390,   391,   391,   391,   391,   391,   392,   392,
00642    392,   392,   393,   393,   393,   393,   393,   393,   393,   393,
00643    393,   393,   393,   393,   394,   395,   396,   396,   397,   398,
00644    398,   399,   399,   399,   400,   400,   401,   401,   401,   401,
00645    402,   402,   403,   403
00646 };
00647 
00648 static const short yyr2[] = {     0,
00649      1,     3,     1,     2,     1,     1,     0,     7,     3,     1,
00650      2,     3,     2,     1,     2,     2,     1,     1,     4,     4,
00651      0,     2,     3,     2,     3,     4,     3,     1,     2,     1,
00652      3,     3,     3,     1,     3,     3,     3,     3,     3,     1,
00653      3,     3,     3,     3,     3,     3,     1,     2,     2,     1,
00654      3,     3,     1,     3,     3,     3,     3,     1,     3,     3,
00655      3,     1,     2,     2,     2,     2,     1,     2,     3,     1,
00656      1,     1,     1,     1,     3,     3,     3,     3,     2,     3,
00657      1,     1,     2,     3,     3,     1,     1,     1,     3,     2,
00658      1,     4,     1,     3
00659 };
00660 
00661 static const short yydefact[] = {     0,
00662      0,    28,     1,     3,     5,     6,     0,     0,     4,    71,
00663      0,     0,     0,    70,    72,    73,    67,     0,     0,    93,
00664      0,     0,    91,    30,    34,    40,    47,    50,    53,    58,
00665     62,    74,    24,    22,    86,    87,    88,     7,     2,     0,
00666     82,    79,    81,    67,    66,     0,     0,    68,    63,    64,
00667      0,    65,     0,     0,     0,     0,     0,     0,     0,     0,
00668      0,     0,     0,     0,    48,    49,     0,     0,     0,     0,
00669      0,     0,     0,     0,     0,     0,     0,     0,    27,     0,
00670     25,    23,     0,    90,     0,     0,     0,    83,     0,     0,
00671     69,    94,     0,     0,    75,    31,    32,    33,    36,    38,
00672     39,    37,    35,    44,    43,    41,    42,    45,    46,    51,
00673     52,    55,    54,    56,    57,    60,    61,    59,    29,    85,
00674     26,    89,     0,    92,    84,    80,     0,    76,    21,     0,
00675     10,    78,    77,    18,     0,    11,     0,     8,     0,     0,
00676     17,     0,     0,    12,    14,     9,     0,     0,    16,    15,
00677     13,    19,    20,     0,     0,     0
00678 };
00679 
00680 static const short yydefgoto[] = {   154,
00681      3,     4,     5,    85,   130,   131,   144,   145,   136,     6,
00682      7,    79,    23,    24,    25,    26,    27,    28,    29,    30,
00683     31,    32,    48,    94,    33,    42,    43,    34,    35,    36,
00684     37
00685 };
00686 
00687 static const short yypact[] = {   -68,
00688   -275,-32768,-32768,  -324,-32768,-32768,   -51,  -282,   -68,-32768,
00689   -299,  -262,   -38,-32768,-32768,-32768,  -329,   -38,   -38,-32768,
00690    -38,   -38,-32768,-32768,   -19,  -135,  -144,-32768,     7,  -332,
00691   -331,-32768,  -272,  -134,-32768,   -20,-32768,-32768,-32768,   -41,
00692    -12,  -288,-32768,  -296,-32768,  -310,   -38,-32768,-32768,-32768,
00693   -283,-32768,   -38,   -38,   -38,   -38,   -38,   -38,   -38,   -38,
00694    -38,   -38,   -38,   -38,-32768,-32768,   -38,   -38,   -38,   -38,
00695    -38,   -38,   -38,   -38,   -38,   -38,   -38,   -38,-32768,   -48,
00696 -32768,  -272,  -245,-32768,  -277,  -276,  -243,-32768,  -262,  -241,
00697 -32768,-32768,  -270,  -273,-32768,-32768,-32768,-32768,-32768,-32768,
00698 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00699 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00700 -32768,-32768,  -238,-32768,-32768,-32768,   -38,-32768,    -4,  -333,
00701 -32768,  -270,-32768,  -269,  -268,   -25,  -238,-32768,  -183,  -182,
00702 -32768,  -118,   -77,   -25,-32768,-32768,  -264,  -263,-32768,-32768,
00703 -32768,-32768,-32768,    96,    97,-32768
00704 };
00705 
00706 static const short yypgoto[] = {-32768,
00707     89,-32768,-32768,-32768,-32768,   -37,-32768,   -45,-32768,-32768,
00708 -32768,   -26,    -8,   -22,    -5,   -18,-32768,   -34,     0,     1,
00709      5,-32768,-32768,   -24,    67,-32768,    13,-32768,    24,    65,
00710 -32768
00711 };
00712 
00713 
00714 #define YYLAST      333
00715 
00716 
00717 static const short yytable[] = {   134,
00718     53,    10,    83,    12,    10,   141,     1,    81,    61,    56,
00719     87,    10,    51,    91,    10,    71,    72,    45,    75,    76,
00720    137,     8,    49,    50,   138,    46,    52,    47,     9,    77,
00721     96,    97,    98,    62,   110,   111,    73,    74,    93,    92,
00722     57,    38,   104,   105,   106,   107,    69,    70,   108,   109,
00723     99,   100,   101,   102,   103,   121,    11,    40,    90,    11,
00724     47,    41,    63,    64,    78,    89,    11,    65,    66,   119,
00725    112,   113,   114,   115,    95,   116,   117,   118,   122,   123,
00726    125,   124,    91,   127,   128,   129,    12,   139,   140,   147,
00727    148,   149,   150,   152,   153,   155,   156,    39,   151,   146,
00728     82,   126,   133,   120,    86,     0,     0,     0,     0,     0,
00729      0,     0,     0,     0,     0,     0,     0,     0,   132,     0,
00730      0,     0,     0,     0,     0,     0,    67,    68,     0,     0,
00731      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00732      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00733      0,     0,     0,     0,    13,     0,     0,    13,    14,     0,
00734      0,    14,     0,     0,    13,     0,     0,    13,    14,     0,
00735      0,    14,     0,     0,     0,     0,     0,     0,     0,     0,
00736    142,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00737      0,     0,     0,     0,     0,     0,     2,     0,     0,     0,
00738      0,     0,    78,     0,    54,     0,     0,     0,     0,     0,
00739      0,     0,     0,   143,     0,     0,     0,     0,     0,    80,
00740      0,    15,    16,     0,    15,    16,    58,    59,    60,     0,
00741      0,    15,    16,     0,    15,    16,     0,     0,     0,     0,
00742      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00743      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00744      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00745      0,     0,    17,     0,     0,    17,     0,     0,     0,     0,
00746      0,     0,    44,     0,     0,    44,     0,     0,     0,     0,
00747      0,     0,     0,     0,     0,     0,    18,    19,    20,    18,
00748     19,    20,     0,    84,     0,    21,    18,    19,    21,    18,
00749     19,    88,     0,     0,     0,    21,     0,     0,    21,    22,
00750      0,     0,    22,    55,     0,   135,     0,     0,     0,    22,
00751      0,     0,    22
00752 };
00753 
00754 static const short yycheck[] = {     4,
00755     20,    53,    23,   138,    53,    31,    75,    34,   153,   145,
00756     23,    53,    21,   324,    53,   348,   349,    13,   350,   351,
00757    354,   297,    18,    19,   358,   355,    22,   357,   353,   361,
00758     53,    54,    55,   178,    69,    70,   369,   370,    47,   350,
00759    176,   324,    61,    62,    63,    64,    40,    41,    67,    68,
00760     56,    57,    58,    59,    60,    82,   108,   357,   355,   108,
00761    357,   324,   207,   208,   337,   354,   108,   212,   213,    78,
00762     71,    72,    73,    74,   358,    75,    76,    77,   324,   357,
00763    324,   358,   324,   354,   358,   324,   138,   357,   357,   273,
00764    273,   210,   170,   358,   358,     0,     0,     9,   144,   137,
00765     34,    89,   127,    80,    40,    -1,    -1,    -1,    -1,    -1,
00766     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   127,    -1,
00767     -1,    -1,    -1,    -1,    -1,    -1,   271,   272,    -1,    -1,
00768     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00769     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00770     -1,    -1,    -1,    -1,   206,    -1,    -1,   206,   210,    -1,
00771     -1,   210,    -1,    -1,   206,    -1,    -1,   206,   210,    -1,
00772     -1,   210,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00773    206,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00774     -1,    -1,    -1,    -1,    -1,    -1,   265,    -1,    -1,    -1,
00775     -1,    -1,   337,    -1,   224,    -1,    -1,    -1,    -1,    -1,
00776     -1,    -1,    -1,   239,    -1,    -1,    -1,    -1,    -1,   354,
00777     -1,   273,   274,    -1,   273,   274,   362,   363,   364,    -1,
00778     -1,   273,   274,    -1,   273,   274,    -1,    -1,    -1,    -1,
00779     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00780     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00781     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00782     -1,    -1,   324,    -1,    -1,   324,    -1,    -1,    -1,    -1,
00783     -1,    -1,   324,    -1,    -1,   324,    -1,    -1,    -1,    -1,
00784     -1,    -1,    -1,    -1,    -1,    -1,   348,   349,   350,   348,
00785    349,   350,    -1,   324,    -1,   357,   348,   349,   357,   348,
00786    349,   324,    -1,    -1,    -1,   357,    -1,    -1,   357,   371,
00787     -1,    -1,   371,   343,    -1,   330,    -1,    -1,    -1,   371,
00788     -1,    -1,   371
00789 };
00790 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
00791 #line 3 "/usr/local/share/bison.simple"
00792 /* This file comes from bison-1.28.  */
00793 
00794 /* Skeleton output parser for bison,
00795    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
00796 
00797    This program is free software; you can redistribute it and/or modify
00798    it under the terms of the GNU General Public License as published by
00799    the Free Software Foundation; either version 2, or (at your option)
00800    any later version.
00801 
00802    This program is distributed in the hope that it will be useful,
00803    but WITHOUT ANY WARRANTY; without even the implied warranty of
00804    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00805    GNU General Public License for more details.
00806 
00807    You should have received a copy of the GNU General Public License
00808    along with this program; if not, write to the Free Software
00809    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00810  * Boston, MA 02110-1301, USA.  */
00811 
00812 /* As a special exception, when this file is copied by Bison into a
00813    Bison output file, you may use that output file without restriction.
00814    This special exception was added by the Free Software Foundation
00815    in version 1.24 of Bison.  */
00816 
00817 /* This is the parser code that is written into each bison parser
00818   when the %semantic_parser declaration is not specified in the grammar.
00819   It was written by Richard Stallman by simplifying the hairy parser
00820   used when %semantic_parser is specified.  */
00821 
00822 #ifndef YYSTACK_USE_ALLOCA
00823 #ifdef alloca
00824 #define YYSTACK_USE_ALLOCA
00825 #else /* alloca not defined */
00826 #ifdef __GNUC__
00827 #define YYSTACK_USE_ALLOCA
00828 #define alloca __builtin_alloca
00829 #else /* not GNU C.  */
00830 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
00831 #define YYSTACK_USE_ALLOCA
00832 #include <alloca.h>
00833 #else /* not sparc */
00834 /* We think this test detects Watcom and Microsoft C.  */
00835 /* This used to test MSDOS, but that is a bad idea
00836    since that symbol is in the user namespace.  */
00837 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
00838 #if 0 /* No need for malloc.h, which pollutes the namespace;
00839      instead, just don't use alloca.  */
00840 #include <malloc.h>
00841 #endif
00842 #else /* not MSDOS, or __TURBOC__ */
00843 #if defined(_AIX)
00844 /* I don't know what this was needed for, but it pollutes the namespace.
00845    So I turned it off.   rms, 2 May 1997.  */
00846 /* #include <malloc.h>  */
00847  #pragma alloca
00848 #define YYSTACK_USE_ALLOCA
00849 #else /* not MSDOS, or __TURBOC__, or _AIX */
00850 #if 0
00851 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
00852          and on HPUX 10.  Eventually we can turn this on.  */
00853 #define YYSTACK_USE_ALLOCA
00854 #define alloca __builtin_alloca
00855 #endif /* __hpux */
00856 #endif
00857 #endif /* not _AIX */
00858 #endif /* not MSDOS, or __TURBOC__ */
00859 #endif /* not sparc */
00860 #endif /* not GNU C */
00861 #endif /* alloca not defined */
00862 #endif /* YYSTACK_USE_ALLOCA not defined */
00863 
00864 #ifdef YYSTACK_USE_ALLOCA
00865 #define YYSTACK_ALLOC alloca
00866 #else
00867 #define YYSTACK_ALLOC malloc
00868 #endif
00869 
00870 /* Note: there must be only one dollar sign in this file.
00871    It is replaced by the list of actions, each action
00872    as one case of the switch.  */
00873 
00874 #define yyerrok     (yyerrstatus = 0)
00875 #define yyclearin   (yychar = YYEMPTY)
00876 #define YYEMPTY     -2
00877 #define YYEOF       0
00878 #define YYACCEPT    goto yyacceptlab
00879 #define YYABORT     goto yyabortlab
00880 #define YYERROR     goto yyerrlab1
00881 /* Like YYERROR except do call yyerror.
00882    This remains here temporarily to ease the
00883    transition to the new meaning of YYERROR, for GCC.
00884    Once GCC version 2 has supplanted version 1, this can go.  */
00885 #define YYFAIL      goto yyerrlab
00886 #define YYRECOVERING()  (!!yyerrstatus)
00887 #define YYBACKUP(token, value) \
00888 do                              \
00889   if (yychar == YYEMPTY && yylen == 1)              \
00890     { yychar = (token), yylval = (value);           \
00891       yychar1 = YYTRANSLATE (yychar);               \
00892       YYPOPSTACK;                       \
00893       goto yybackup;                        \
00894     }                               \
00895   else                              \
00896     { yyerror ("syntax error: cannot back up"); YYERROR; }  \
00897 while (0)
00898 
00899 #define YYTERROR    1
00900 #define YYERRCODE   256
00901 
00902 #ifndef YYPURE
00903 #define YYLEX       yylex()
00904 #endif
00905 
00906 #ifdef YYPURE
00907 #ifdef YYLSP_NEEDED
00908 #ifdef YYLEX_PARAM
00909 #define YYLEX       yylex(&yylval, &yylloc, YYLEX_PARAM)
00910 #else
00911 #define YYLEX       yylex(&yylval, &yylloc)
00912 #endif
00913 #else /* not YYLSP_NEEDED */
00914 #ifdef YYLEX_PARAM
00915 #define YYLEX       yylex(&yylval, YYLEX_PARAM)
00916 #else
00917 #define YYLEX       yylex(&yylval)
00918 #endif
00919 #endif /* not YYLSP_NEEDED */
00920 #endif
00921 
00922 /* If nonreentrant, generate the variables here */
00923 
00924 #ifndef YYPURE
00925 
00926 int yychar;         /*  the lookahead symbol        */
00927 YYSTYPE yylval;         /*  the semantic value of the       */
00928                 /*  lookahead symbol            */
00929 
00930 #ifdef YYLSP_NEEDED
00931 YYLTYPE yylloc;         /*  location data for the lookahead */
00932                 /*  symbol              */
00933 #endif
00934 
00935 int yynerrs;            /*  number of parse errors so far       */
00936 #endif  /* not YYPURE */
00937 
00938 #if YYDEBUG != 0
00939 int yydebug;            /*  nonzero means print parse trace */
00940 /* Since this is uninitialized, it does not stop multiple parsers
00941    from coexisting.  */
00942 #endif
00943 
00944 /*  YYINITDEPTH indicates the initial size of the parser's stacks   */
00945 
00946 #ifndef YYINITDEPTH
00947 #define YYINITDEPTH 200
00948 #endif
00949 
00950 /*  YYMAXDEPTH is the maximum size the stacks can grow to
00951     (effective only if the built-in stack extension method is used).  */
00952 
00953 #if YYMAXDEPTH == 0
00954 #undef YYMAXDEPTH
00955 #endif
00956 
00957 #ifndef YYMAXDEPTH
00958 #define YYMAXDEPTH 10000
00959 #endif
00960 
00961 /* Define __yy_memcpy.  Note that the size argument
00962    should be passed with type unsigned int, because that is what the non-GCC
00963    definitions require.  With GCC, __builtin_memcpy takes an arg
00964    of type size_t, but it can handle unsigned int.  */
00965 
00966 #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
00967 #define __yy_memcpy(TO,FROM,COUNT)  __builtin_memcpy(TO,FROM,COUNT)
00968 #else               /* not GNU C or C++ */
00969 #ifndef __cplusplus
00970 
00971 /* This is the most reliable way to avoid incompatibilities
00972    in available built-in functions on various systems.  */
00973 static void
00974 __yy_memcpy (to, from, count)
00975      char *to;
00976      char *from;
00977      unsigned int count;
00978 {
00979   register char *f = from;
00980   register char *t = to;
00981   register int i = count;
00982 
00983   while (i-- > 0)
00984     *t++ = *f++;
00985 }
00986 
00987 #else /* __cplusplus */
00988 
00989 /* This is the most reliable way to avoid incompatibilities
00990    in available built-in functions on various systems.  */
00991 static void
00992 __yy_memcpy (char *to, char *from, unsigned int count)
00993 {
00994   register char *t = to;
00995   register char *f = from;
00996   register int i = count;
00997 
00998   while (i-- > 0)
00999     *t++ = *f++;
01000 }
01001 
01002 #endif
01003 #endif
01004 
01005 #line 217 "/usr/local/share/bison.simple"
01006 
01007 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
01008    into yyparse.  The argument should have type void *.
01009    It should actually point to an object.
01010    Grammar actions can access the variable by casting it
01011    to the proper pointer type.  */
01012 
01013 #ifdef YYPARSE_PARAM
01014 #ifdef __cplusplus
01015 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
01016 #define YYPARSE_PARAM_DECL
01017 #else /* not __cplusplus */
01018 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
01019 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
01020 #endif /* not __cplusplus */
01021 #else /* not YYPARSE_PARAM */
01022 #define YYPARSE_PARAM_ARG
01023 #define YYPARSE_PARAM_DECL
01024 #endif /* not YYPARSE_PARAM */
01025 
01026 /* Prevent warning if -Wstrict-prototypes.  */
01027 #ifdef __GNUC__
01028 #ifdef YYPARSE_PARAM
01029 int yyparse (void *);
01030 #else
01031 int yyparse (void);
01032 #endif
01033 #endif
01034 
01035 int
01036 yyparse(YYPARSE_PARAM_ARG)
01037      YYPARSE_PARAM_DECL
01038 {
01039   register int yystate;
01040   register int yyn;
01041   register short *yyssp;
01042   register YYSTYPE *yyvsp;
01043   int yyerrstatus;  /*  number of tokens to shift before error messages enabled */
01044   int yychar1 = 0;      /*  lookahead token as an internal (translated) token number */
01045 
01046   short yyssa[YYINITDEPTH]; /*  the state stack         */
01047   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack        */
01048 
01049   short *yyss = yyssa;      /*  refer to the stacks thru separate pointers */
01050   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
01051 
01052 #ifdef YYLSP_NEEDED
01053   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack          */
01054   YYLTYPE *yyls = yylsa;
01055   YYLTYPE *yylsp;
01056 
01057 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
01058 #else
01059 #define YYPOPSTACK   (yyvsp--, yyssp--)
01060 #endif
01061 
01062   int yystacksize = YYINITDEPTH;
01063   int yyfree_stacks = 0;
01064 
01065 #ifdef YYPURE
01066   int yychar;
01067   YYSTYPE yylval;
01068   int yynerrs;
01069 #ifdef YYLSP_NEEDED
01070   YYLTYPE yylloc;
01071 #endif
01072 #endif
01073 
01074   YYSTYPE yyval;        /*  the variable used to return     */
01075                 /*  semantic values from the action */
01076                 /*  routines                */
01077 
01078   int yylen;
01079 
01080 #if YYDEBUG != 0
01081   if (yydebug)
01082     fprintf(stderr, "Starting parse\n");
01083 #endif
01084 
01085   yystate = 0;
01086   yyerrstatus = 0;
01087   yynerrs = 0;
01088   yychar = YYEMPTY;     /* Cause a token to be read.  */
01089 
01090   /* Initialize stack pointers.
01091      Waste one element of value and location stack
01092      so that they stay on the same level as the state stack.
01093      The wasted elements are never initialized.  */
01094 
01095   yyssp = yyss - 1;
01096   yyvsp = yyvs;
01097 #ifdef YYLSP_NEEDED
01098   yylsp = yyls;
01099 #endif
01100 
01101 /* Push a new state, which is found in  yystate  .  */
01102 /* In all cases, when you get here, the value and location stacks
01103    have just been pushed. so pushing a state here evens the stacks.  */
01104 yynewstate:
01105 
01106   *++yyssp = yystate;
01107 
01108   if (yyssp >= yyss + yystacksize - 1)
01109     {
01110       /* Give user a chance to reallocate the stack */
01111       /* Use copies of these so that the &'s don't force the real ones into memory. */
01112       YYSTYPE *yyvs1 = yyvs;
01113       short *yyss1 = yyss;
01114 #ifdef YYLSP_NEEDED
01115       YYLTYPE *yyls1 = yyls;
01116 #endif
01117 
01118       /* Get the current used size of the three stacks, in elements.  */
01119       int size = yyssp - yyss + 1;
01120 
01121 #ifdef yyoverflow
01122       /* Each stack pointer address is followed by the size of
01123      the data in use in that stack, in bytes.  */
01124 #ifdef YYLSP_NEEDED
01125       /* This used to be a conditional around just the two extra args,
01126      but that might be undefined if yyoverflow is a macro.  */
01127       yyoverflow("parser stack overflow",
01128          &yyss1, size * sizeof (*yyssp),
01129          &yyvs1, size * sizeof (*yyvsp),
01130          &yyls1, size * sizeof (*yylsp),
01131          &yystacksize);
01132 #else
01133       yyoverflow("parser stack overflow",
01134          &yyss1, size * sizeof (*yyssp),
01135          &yyvs1, size * sizeof (*yyvsp),
01136          &yystacksize);
01137 #endif
01138 
01139       yyss = yyss1; yyvs = yyvs1;
01140 #ifdef YYLSP_NEEDED
01141       yyls = yyls1;
01142 #endif
01143 #else /* no yyoverflow */
01144       /* Extend the stack our own way.  */
01145       if (yystacksize >= YYMAXDEPTH)
01146     {
01147       yyerror("parser stack overflow");
01148       if (yyfree_stacks)
01149         {
01150           free (yyss);
01151           free (yyvs);
01152 #ifdef YYLSP_NEEDED
01153           free (yyls);
01154 #endif
01155         }
01156       return 2;
01157     }
01158       yystacksize *= 2;
01159       if (yystacksize > YYMAXDEPTH)
01160     yystacksize = YYMAXDEPTH;
01161 #ifndef YYSTACK_USE_ALLOCA
01162       yyfree_stacks = 1;
01163 #endif
01164       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
01165       __yy_memcpy ((char *)yyss, (char *)yyss1,
01166            size * (unsigned int) sizeof (*yyssp));
01167       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
01168       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
01169            size * (unsigned int) sizeof (*yyvsp));
01170 #ifdef YYLSP_NEEDED
01171       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
01172       __yy_memcpy ((char *)yyls, (char *)yyls1,
01173            size * (unsigned int) sizeof (*yylsp));
01174 #endif
01175 #endif /* no yyoverflow */
01176 
01177       yyssp = yyss + size - 1;
01178       yyvsp = yyvs + size - 1;
01179 #ifdef YYLSP_NEEDED
01180       yylsp = yyls + size - 1;
01181 #endif
01182 
01183 #if YYDEBUG != 0
01184       if (yydebug)
01185     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
01186 #endif
01187 
01188       if (yyssp >= yyss + yystacksize - 1)
01189     YYABORT;
01190     }
01191 
01192 #if YYDEBUG != 0
01193   if (yydebug)
01194     fprintf(stderr, "Entering state %d\n", yystate);
01195 #endif
01196 
01197   goto yybackup;
01198  yybackup:
01199 
01200 /* Do appropriate processing given the current state.  */
01201 /* Read a lookahead token if we need one and don't already have one.  */
01202 /* yyresume: */
01203 
01204   /* First try to decide what to do without reference to lookahead token.  */
01205 
01206   yyn = yypact[yystate];
01207   if (yyn == YYFLAG)
01208     goto yydefault;
01209 
01210   /* Not known => get a lookahead token if don't already have one.  */
01211 
01212   /* yychar is either YYEMPTY or YYEOF
01213      or a valid token in external form.  */
01214 
01215   if (yychar == YYEMPTY)
01216     {
01217 #if YYDEBUG != 0
01218       if (yydebug)
01219     fprintf(stderr, "Reading a token: ");
01220 #endif
01221       yychar = YYLEX;
01222     }
01223 
01224   /* Convert token to internal form (in yychar1) for indexing tables with */
01225 
01226   if (yychar <= 0)      /* This means end of input. */
01227     {
01228       yychar1 = 0;
01229       yychar = YYEOF;       /* Don't call YYLEX any more */
01230 
01231 #if YYDEBUG != 0
01232       if (yydebug)
01233     fprintf(stderr, "Now at end of input.\n");
01234 #endif
01235     }
01236   else
01237     {
01238       yychar1 = YYTRANSLATE(yychar);
01239 
01240 #if YYDEBUG != 0
01241       if (yydebug)
01242     {
01243       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
01244       /* Give the individual parser a way to print the precise meaning
01245          of a token, for further debugging info.  */
01246 #ifdef YYPRINT
01247       YYPRINT (stderr, yychar, yylval);
01248 #endif
01249       fprintf (stderr, ")\n");
01250     }
01251 #endif
01252     }
01253 
01254   yyn += yychar1;
01255   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
01256     goto yydefault;
01257 
01258   yyn = yytable[yyn];
01259 
01260   /* yyn is what to do for this token type in this state.
01261      Negative => reduce, -yyn is rule number.
01262      Positive => shift, yyn is new state.
01263        New state is final state => don't bother to shift,
01264        just return success.
01265      0, or most negative number => error.  */
01266 
01267   if (yyn < 0)
01268     {
01269       if (yyn == YYFLAG)
01270     goto yyerrlab;
01271       yyn = -yyn;
01272       goto yyreduce;
01273     }
01274   else if (yyn == 0)
01275     goto yyerrlab;
01276 
01277   if (yyn == YYFINAL)
01278     YYACCEPT;
01279 
01280   /* Shift the lookahead token.  */
01281 
01282 #if YYDEBUG != 0
01283   if (yydebug)
01284     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
01285 #endif
01286 
01287   /* Discard the token being shifted unless it is eof.  */
01288   if (yychar != YYEOF)
01289     yychar = YYEMPTY;
01290 
01291   *++yyvsp = yylval;
01292 #ifdef YYLSP_NEEDED
01293   *++yylsp = yylloc;
01294 #endif
01295 
01296   /* count tokens shifted since error; after three, turn off error status.  */
01297   if (yyerrstatus) yyerrstatus--;
01298 
01299   yystate = yyn;
01300   goto yynewstate;
01301 
01302 /* Do the default action for the current state.  */
01303 yydefault:
01304 
01305   yyn = yydefact[yystate];
01306   if (yyn == 0)
01307     goto yyerrlab;
01308 
01309 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
01310 yyreduce:
01311   yylen = yyr2[yyn];
01312   if (yylen > 0)
01313     yyval = yyvsp[1-yylen]; /* implement default value of the action */
01314 
01315 #if YYDEBUG != 0
01316   if (yydebug)
01317     {
01318       int i;
01319 
01320       fprintf (stderr, "Reducing via rule %d (line %d), ",
01321            yyn, yyrline[yyn]);
01322 
01323       /* Print the symbols being reduced, and their result.  */
01324       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
01325     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
01326       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
01327     }
01328 #endif
01329 
01330 
01331   switch (yyn) {
01332 
01333 case 1:
01334 #line 567 "sqlparser.y"
01335 {
01336 //todo: multiple statements
01337 //todo: not only "select" statements
01338     parser->setOperation(Parser::OP_Select);
01339     parser->setQuerySchema(yyvsp[0].querySchema);
01340 ;
01341     break;}
01342 case 2:
01343 #line 577 "sqlparser.y"
01344 {
01345 //todo: multiple statements
01346 ;
01347     break;}
01348 case 4:
01349 #line 582 "sqlparser.y"
01350 {
01351     yyval.querySchema = yyvsp[-1].querySchema;
01352 ;
01353     break;}
01354 case 5:
01355 #line 592 "sqlparser.y"
01356 {
01357 YYACCEPT;
01358 ;
01359     break;}
01360 case 6:
01361 #line 596 "sqlparser.y"
01362 {
01363     yyval.querySchema = yyvsp[0].querySchema;
01364 ;
01365     break;}
01366 case 7:
01367 #line 603 "sqlparser.y"
01368 {
01369     parser->setOperation(Parser::OP_CreateTable);
01370     parser->createTable(yyvsp[0].stringValue);
01371 ;
01372     break;}
01373 case 10:
01374 #line 612 "sqlparser.y"
01375 {
01376 ;
01377     break;}
01378 case 11:
01379 #line 618 "sqlparser.y"
01380 {
01381     kdDebug() << "adding field " << yyvsp[-1].stringValue << endl;
01382     field->setName(yyvsp[-1].stringValue);
01383     parser->table()->addField(field);
01384 
01385 //  delete field;
01386     field = 0;
01387 ;
01388     break;}
01389 case 12:
01390 #line 627 "sqlparser.y"
01391 {
01392     kdDebug() << "adding field " << yyvsp[-2].stringValue << endl;
01393     field->setName(yyvsp[-2].stringValue);
01394     parser->table()->addField(field);
01395 
01396 //  if(field->isPrimaryKey())
01397 //      parser->table()->addPrimaryKey(field->name());
01398 
01399 //  delete field;
01400 //  field = 0;
01401 ;
01402     break;}
01403 case 14:
01404 #line 642 "sqlparser.y"
01405 {
01406 ;
01407     break;}
01408 case 15:
01409 #line 648 "sqlparser.y"
01410 {
01411     field->setPrimaryKey(true);
01412     kdDebug() << "primary" << endl;
01413 ;
01414     break;}
01415 case 16:
01416 #line 653 "sqlparser.y"
01417 {
01418     field->setNotNull(true);
01419     kdDebug() << "not_null" << endl;
01420 ;
01421     break;}
01422 case 17:
01423 #line 658 "sqlparser.y"
01424 {
01425     field->setAutoIncrement(true);
01426     kdDebug() << "ainc" << endl;
01427 ;
01428     break;}
01429 case 18:
01430 #line 666 "sqlparser.y"
01431 {
01432     field = new Field();
01433     field->setType(yyvsp[0].colType);
01434 ;
01435     break;}
01436 case 19:
01437 #line 671 "sqlparser.y"
01438 {
01439     kdDebug() << "sql + length" << endl;
01440     field = new Field();
01441     field->setPrecision(yyvsp[-1].integerValue);
01442     field->setType(yyvsp[-3].colType);
01443 ;
01444     break;}
01445 case 20:
01446 #line 678 "sqlparser.y"
01447 {
01448     field = new Field();
01449     field->setPrecision(yyvsp[-1].integerValue);
01450     field->setType(Field::Text);
01451 ;
01452     break;}
01453 case 21:
01454 #line 684 "sqlparser.y"
01455 {
01456     // SQLITE compatibillity
01457     field = new Field();
01458     field->setType(Field::InvalidType);
01459 ;
01460     break;}
01461 case 22:
01462 #line 693 "sqlparser.y"
01463 {
01464     kdDebug() << "Select ColViews=" << yyvsp[0].exprList->debugString() << endl;
01465 
01466     if (!(yyval.querySchema = parseSelect( yyvsp[-1].querySchema, yyvsp[0].exprList )))
01467         return 0;
01468 ;
01469     break;}
01470 case 23:
01471 #line 700 "sqlparser.y"
01472 {
01473     if (!(yyval.querySchema = parseSelect( yyvsp[-2].querySchema, yyvsp[-1].exprList, yyvsp[0].exprList )))
01474         return 0;
01475 ;
01476     break;}
01477 case 24:
01478 #line 705 "sqlparser.y"
01479 {
01480     kdDebug() << "Select ColViews Tables" << endl;
01481     if (!(yyval.querySchema = parseSelect( yyvsp[-1].querySchema, 0, yyvsp[0].exprList )))
01482         return 0;
01483 ;
01484     break;}
01485 case 25:
01486 #line 711 "sqlparser.y"
01487 {
01488     kdDebug() << "Select ColViews Conditions" << endl;
01489     if (!(yyval.querySchema = parseSelect( yyvsp[-2].querySchema, yyvsp[-1].exprList, 0, yyvsp[0].expr )))
01490         return 0;
01491 ;
01492     break;}
01493 case 26:
01494 #line 717 "sqlparser.y"
01495 {
01496     kdDebug() << "Select ColViews Tables Conditions" << endl;
01497     if (!(yyval.querySchema = parseSelect( yyvsp[-3].querySchema, yyvsp[-2].exprList, yyvsp[-1].exprList, yyvsp[0].expr )))
01498         return 0;
01499 ;
01500     break;}
01501 case 27:
01502 #line 723 "sqlparser.y"
01503 {
01504     kdDebug() << "Select Tables Conditions" << endl;
01505     if (!(yyval.querySchema = parseSelect( yyvsp[-2].querySchema, 0, yyvsp[-1].exprList, yyvsp[0].expr )))
01506         return 0;
01507 ;
01508     break;}
01509 case 28:
01510 #line 732 "sqlparser.y"
01511 {
01512     kdDebug() << "SELECT" << endl;
01513 //  parser->createSelect();
01514 //  parser->setOperation(Parser::OP_Select);
01515     yyval.querySchema = new QuerySchema();
01516 ;
01517     break;}
01518 case 29:
01519 #line 742 "sqlparser.y"
01520 {
01521     yyval.expr = yyvsp[0].expr;
01522 ;
01523     break;}
01524 case 31:
01525 #line 754 "sqlparser.y"
01526 {
01527 //  kdDebug() << "AND " << $3.debugString() << endl;
01528     yyval.expr = new BinaryExpr( KexiDBExpr_Logical, yyvsp[-2].expr, AND, yyvsp[0].expr );
01529 ;
01530     break;}
01531 case 32:
01532 #line 759 "sqlparser.y"
01533 {
01534     yyval.expr = new BinaryExpr( KexiDBExpr_Logical, yyvsp[-2].expr, OR, yyvsp[0].expr );
01535 ;
01536     break;}
01537 case 33:
01538 #line 763 "sqlparser.y"
01539 {
01540     yyval.expr = new BinaryExpr( KexiDBExpr_Arithm, yyvsp[-2].expr, XOR, yyvsp[0].expr );
01541 ;
01542     break;}
01543 case 35:
01544 #line 773 "sqlparser.y"
01545 {
01546     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, '>', yyvsp[0].expr);
01547 ;
01548     break;}
01549 case 36:
01550 #line 777 "sqlparser.y"
01551 {
01552     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, GREATER_OR_EQUAL, yyvsp[0].expr);
01553 ;
01554     break;}
01555 case 37:
01556 #line 781 "sqlparser.y"
01557 {
01558     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, '<', yyvsp[0].expr);
01559 ;
01560     break;}
01561 case 38:
01562 #line 785 "sqlparser.y"
01563 {
01564     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, LESS_OR_EQUAL, yyvsp[0].expr);
01565 ;
01566     break;}
01567 case 39:
01568 #line 789 "sqlparser.y"
01569 {
01570     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, '=', yyvsp[0].expr);
01571 ;
01572     break;}
01573 case 41:
01574 #line 799 "sqlparser.y"
01575 {
01576     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, NOT_EQUAL, yyvsp[0].expr);
01577 ;
01578     break;}
01579 case 42:
01580 #line 804 "sqlparser.y"
01581 {
01582     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, NOT_EQUAL2, yyvsp[0].expr);
01583 ;
01584     break;}
01585 case 43:
01586 #line 808 "sqlparser.y"
01587 {
01588     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, LIKE, yyvsp[0].expr);
01589 ;
01590     break;}
01591 case 44:
01592 #line 812 "sqlparser.y"
01593 {
01594     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, SQL_IN, yyvsp[0].expr);
01595 ;
01596     break;}
01597 case 45:
01598 #line 816 "sqlparser.y"
01599 {
01600     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, SIMILAR_TO, yyvsp[0].expr);
01601 ;
01602     break;}
01603 case 46:
01604 #line 820 "sqlparser.y"
01605 {
01606     yyval.expr = new BinaryExpr(KexiDBExpr_Relational, yyvsp[-2].expr, NOT_SIMILAR_TO, yyvsp[0].expr);
01607 ;
01608     break;}
01609 case 48:
01610 #line 830 "sqlparser.y"
01611 {
01612     yyval.expr = new UnaryExpr( SQL_IS_NULL, yyvsp[-1].expr );
01613 ;
01614     break;}
01615 case 49:
01616 #line 834 "sqlparser.y"
01617 {
01618     yyval.expr = new UnaryExpr( SQL_IS_NOT_NULL, yyvsp[-1].expr );
01619 ;
01620     break;}
01621 case 51:
01622 #line 844 "sqlparser.y"
01623 {
01624     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, BITWISE_SHIFT_LEFT, yyvsp[0].expr);
01625 ;
01626     break;}
01627 case 52:
01628 #line 848 "sqlparser.y"
01629 {
01630     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, BITWISE_SHIFT_RIGHT, yyvsp[0].expr);
01631 ;
01632     break;}
01633 case 54:
01634 #line 858 "sqlparser.y"
01635 {
01636     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '+', yyvsp[0].expr);
01637     yyval.expr->debug();
01638 ;
01639     break;}
01640 case 55:
01641 #line 863 "sqlparser.y"
01642 {
01643     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '-', yyvsp[0].expr);
01644 ;
01645     break;}
01646 case 56:
01647 #line 867 "sqlparser.y"
01648 {
01649     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '&', yyvsp[0].expr);
01650 ;
01651     break;}
01652 case 57:
01653 #line 871 "sqlparser.y"
01654 {
01655     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '|', yyvsp[0].expr);
01656 ;
01657     break;}
01658 case 59:
01659 #line 881 "sqlparser.y"
01660 {
01661     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '/', yyvsp[0].expr);
01662 ;
01663     break;}
01664 case 60:
01665 #line 885 "sqlparser.y"
01666 {
01667     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '*', yyvsp[0].expr);
01668 ;
01669     break;}
01670 case 61:
01671 #line 889 "sqlparser.y"
01672 {
01673     yyval.expr = new BinaryExpr(KexiDBExpr_Arithm, yyvsp[-2].expr, '%', yyvsp[0].expr);
01674 ;
01675     break;}
01676 case 63:
01677 #line 900 "sqlparser.y"
01678 {
01679     yyval.expr = new UnaryExpr( '-', yyvsp[0].expr );
01680 ;
01681     break;}
01682 case 64:
01683 #line 904 "sqlparser.y"
01684 {
01685     yyval.expr = new UnaryExpr( '+', yyvsp[0].expr );
01686 ;
01687     break;}
01688 case 65:
01689 #line 908 "sqlparser.y"
01690 {
01691     yyval.expr = new UnaryExpr( '~', yyvsp[0].expr );
01692 ;
01693     break;}
01694 case 66:
01695 #line 912 "sqlparser.y"
01696 {
01697     yyval.expr = new UnaryExpr( NOT, yyvsp[0].expr );
01698 ;
01699     break;}
01700 case 67:
01701 #line 916 "sqlparser.y"
01702 {
01703     yyval.expr = new VariableExpr( QString::fromUtf8(yyvsp[0].stringValue) );
01704     
01705 //TODO: simplify this later if that's 'only one field name' expression
01706     kdDebug() << "  + identifier: " << yyvsp[0].stringValue << endl;
01707 //  $$ = new Field();
01708 //  $$->setName($1);
01709 //  $$->setTable(dummy);
01710 
01711 //  parser->select()->addField(field);
01712 //  requiresTable = true;
01713 ;
01714     break;}
01715 case 68:
01716 #line 929 "sqlparser.y"
01717 {
01718     kdDebug() << "  + function: " << yyvsp[-1].stringValue << "(" << yyvsp[0].exprList->debugString() << ")" << endl;
01719     yyval.expr = new FunctionExpr(yyvsp[-1].stringValue, yyvsp[0].exprList);
01720 ;
01721     break;}
01722 case 69:
01723 #line 935 "sqlparser.y"
01724 {
01725     yyval.expr = new VariableExpr( QString::fromUtf8(yyvsp[-2].stringValue) + "." + QString::fromUtf8(yyvsp[0].stringValue) );
01726     kdDebug() << "  + identifier.identifier: " << yyvsp[0].stringValue << "." << yyvsp[-2].stringValue << endl;
01727 //  $$ = new Field();
01728 //  s->setTable($1);
01729 //  $$->setName($3);
01730     //$$->setTable(parser->db()->tableSchema($1));
01731 //  parser->select()->addField(field);
01732 //??    requiresTable = true;
01733 ;
01734     break;}
01735 case 70:
01736 #line 946 "sqlparser.y"
01737 {
01738     yyval.expr = new ConstExpr( SQL_NULL, QVariant() );
01739     kdDebug() << "  + NULL" << endl;
01740 //  $$ = new Field();
01741     //$$->setName(QString::null);
01742 ;
01743     break;}
01744 case 71:
01745 #line 953 "sqlparser.y"
01746 {
01747     QString s( QString::fromUtf8(yyvsp[0].stringValue) );
01748     yyval.expr = new ConstExpr( CHARACTER_STRING_LITERAL, s.mid(1,s.length()-2) );
01749     kdDebug() << "  + constant " << s << endl;
01750 ;
01751     break;}
01752 case 72:
01753 #line 959 "sqlparser.y"
01754 {
01755     QVariant val;
01756     if (yyvsp[0].integerValue <= INT_MAX && yyvsp[0].integerValue >= INT_MIN)
01757         val = (int)yyvsp[0].integerValue;
01758     else if (yyvsp[0].integerValue <= UINT_MAX && yyvsp[0].integerValue >= 0)
01759         val = (uint)yyvsp[0].integerValue;
01760     else if (yyvsp[0].integerValue <= LLONG_MAX && yyvsp[0].integerValue >= LLONG_MIN)
01761         val = (Q_LLONG)yyvsp[0].integerValue;
01762 
01763 //  if ($1 < ULLONG_MAX)
01764 //      val = (Q_ULLONG)$1;
01765 //TODO ok?
01766 
01767     yyval.expr = new ConstExpr( INTEGER_CONST, val );
01768     kdDebug() << "  + int constant: " << val.toString() << endl;
01769 ;
01770     break;}
01771 case 73:
01772 #line 976 "sqlparser.y"
01773 {
01774     yyval.expr = new ConstExpr( REAL_CONST, QPoint( yyvsp[0].realValue.integer, yyvsp[0].realValue.fractional ) );
01775     kdDebug() << "  + real constant: " << yyvsp[0].realValue.integer << "." << yyvsp[0].realValue.fractional << endl;
01776 ;
01777     break;}
01778 case 75:
01779 #line 987 "sqlparser.y"
01780 {
01781     kdDebug() << "(expr)" << endl;
01782     yyval.expr = new UnaryExpr('(', yyvsp[-1].expr);
01783 ;
01784     break;}
01785 case 76:
01786 #line 995 "sqlparser.y"
01787 {
01788 //  $$ = new NArgExpr(0, 0);
01789 //  $$->add( $1 );
01790 //  $$->add( $3 );
01791     yyval.exprList = yyvsp[-1].exprList;
01792 ;
01793     break;}
01794 case 77:
01795 #line 1005 "sqlparser.y"
01796 {
01797     yyval.exprList = yyvsp[0].exprList;
01798     yyval.exprList->prepend( yyvsp[-2].expr );
01799 ;
01800     break;}
01801 case 78:
01802 #line 1010 "sqlparser.y"
01803 {
01804     yyval.exprList = new NArgExpr(0, 0);
01805     yyval.exprList->add( yyvsp[-2].expr );
01806     yyval.exprList->add( yyvsp[0].expr );
01807 ;
01808     break;}
01809 case 79:
01810 #line 1019 "sqlparser.y"
01811 {
01812     yyval.exprList = yyvsp[0].exprList;
01813 ;
01814     break;}
01815 case 80:
01816 #line 1060 "sqlparser.y"
01817 {
01818     yyval.exprList = yyvsp[-2].exprList;
01819     yyval.exprList->add(yyvsp[0].expr);
01820 ;
01821     break;}
01822 case 81:
01823 #line 1065 "sqlparser.y"
01824 {
01825     yyval.exprList = new NArgExpr(KexiDBExpr_TableList, IDENTIFIER); //ok?
01826     yyval.exprList->add(yyvsp[0].expr);
01827 ;
01828     break;}
01829 case 82:
01830 #line 1073 "sqlparser.y"
01831 {
01832     kdDebug() << "FROM: '" << yyvsp[0].stringValue << "'" << endl;
01833 
01834 //  TableSchema *schema = parser->db()->tableSchema($1);
01835 //  parser->select()->setParentTable(schema);
01836 //  parser->select()->addTable(schema);
01837 //  requiresTable = false;
01838     
01839 //addTable($1);
01840 
01841     yyval.expr = new VariableExpr(QString::fromUtf8(yyvsp[0].stringValue));
01842 
01843     /*
01844 //TODO: this isn't ok for more tables:
01845     Field::ListIterator it = parser->select()->fieldsIterator();
01846     for(Field *item; (item = it.current()); ++it)
01847     {
01848         if(item->table() == dummy)
01849         {
01850             item->setTable(schema);
01851         }
01852 
01853         if(item->table() && !item->isQueryAsterisk())
01854         {
01855             Field *f = item->table()->field(item->name());
01856             if(!f)
01857             {
01858                 ParserError err(i18n("Field List Error"), i18n("Unknown column '%1' in table '%2'").arg(item->name()).arg(schema->name()), ctoken, current);
01859                 parser->setError(err);
01860                 yyerror("fieldlisterror");
01861             }   
01862         }
01863     }*/
01864 ;
01865     break;}
01866 case 83:
01867 #line 1108 "sqlparser.y"
01868 {
01869     //table + alias
01870     yyval.expr = new BinaryExpr(
01871         KexiDBExpr_SpecialBinary, 
01872         new VariableExpr(QString::fromUtf8(yyvsp[-1].stringValue)), 0,
01873         new VariableExpr(QString::fromUtf8(yyvsp[0].stringValue))
01874     );
01875 ;
01876     break;}
01877 case 84:
01878 #line 1117 "sqlparser.y"
01879 {
01880     //table + alias
01881     yyval.expr = new BinaryExpr(
01882         KexiDBExpr_SpecialBinary,
01883         new VariableExpr(QString::fromUtf8(yyvsp[-2].stringValue)), AS,
01884         new VariableExpr(QString::fromUtf8(yyvsp[0].stringValue))
01885     );
01886 ;
01887     break;}
01888 case 85:
01889 #line 1131 "sqlparser.y"
01890 {
01891     yyval.exprList = yyvsp[-2].exprList;
01892     yyval.exprList->add( yyvsp[0].expr );
01893     kdDebug() << "ColViews: ColViews , ColItem" << endl;
01894 ;
01895     break;}
01896 case 86:
01897 #line 1137 "sqlparser.y"
01898 {
01899     yyval.exprList = new NArgExpr(0,0);
01900     yyval.exprList->add( yyvsp[0].expr );
01901     kdDebug() << "ColViews: ColItem" << endl;
01902 ;
01903     break;}
01904 case 87:
01905 #line 1146 "sqlparser.y"
01906 {
01907 //  $$ = new Field();
01908 //  dummy->addField($$);
01909 //  $$->setExpression( $1 );
01910 //  parser->select()->addField($$);
01911     yyval.expr = yyvsp[0].expr;
01912     kdDebug() << " added column expr: '" << yyvsp[0].expr->debugString() << "'" << endl;
01913 ;
01914     break;}
01915 case 88:
01916 #line 1155 "sqlparser.y"
01917 {
01918     yyval.expr = yyvsp[0].expr;
01919     kdDebug() << " added column wildcard: '" << yyvsp[0].expr->debugString() << "'" << endl;
01920 ;
01921     break;}
01922 case 89:
01923 #line 1160 "sqlparser.y"
01924 {
01925 //  $$ = new Field();
01926 //  $$->setExpression( $1 );
01927 //  parser->select()->addField($$);
01928     yyval.expr = new BinaryExpr(
01929         KexiDBExpr_SpecialBinary, yyvsp[-2].expr, AS,
01930         new VariableExpr(QString::fromUtf8(yyvsp[0].stringValue))
01931 //      new ConstExpr(IDENTIFIER, QString::fromLocal8Bit($3))
01932     );
01933     kdDebug() << " added column expr: " << yyval.expr->debugString() << endl;
01934 ;
01935     break;}
01936 case 90:
01937 #line 1172 "sqlparser.y"
01938 {
01939 //  $$ = new Field();
01940 //  $$->setExpression( $1 );
01941 //  parser->select()->addField($$);
01942     yyval.expr = new BinaryExpr(
01943         KexiDBExpr_SpecialBinary, yyvsp[-1].expr, 0, 
01944         new VariableExpr(QString::fromUtf8(yyvsp[0].stringValue))
01945 //      new ConstExpr(IDENTIFIER, QString::fromLocal8Bit($2))
01946     );
01947     kdDebug() << " added column expr: " << yyval.expr->debugString() << endl;
01948 ;
01949     break;}
01950 case 91:
01951 #line 1187 "sqlparser.y"
01952 {
01953     yyval.expr = yyvsp[0].expr;
01954 ;
01955     break;}
01956 case 92:
01957 #line 1231 "sqlparser.y"
01958 {
01959     yyval.expr = yyvsp[-1].expr;
01960 //TODO
01961 //  $$->setName("DISTINCT(" + $3->name() + ")");
01962 ;
01963     break;}
01964 case 93:
01965 #line 1240 "sqlparser.y"
01966 {
01967     yyval.expr = new VariableExpr("*");
01968     kdDebug() << "all columns" << endl;
01969 
01970 //  QueryAsterisk *ast = new QueryAsterisk(parser->select(), dummy);
01971 //  parser->select()->addAsterisk(ast);
01972 //  requiresTable = true;
01973 ;
01974     break;}
01975 case 94:
01976 #line 1249 "sqlparser.y"
01977 {
01978     QString s = QString::fromUtf8(yyvsp[-2].stringValue);
01979     s+=".*";
01980     yyval.expr = new VariableExpr(s);
01981     kdDebug() << "  + all columns from " << s << endl;
01982 ;
01983     break;}
01984 }
01985    /* the action file gets copied in in place of this dollarsign */
01986 #line 543 "/usr/local/share/bison.simple"
01987 
01988   yyvsp -= yylen;
01989   yyssp -= yylen;
01990 #ifdef YYLSP_NEEDED
01991   yylsp -= yylen;
01992 #endif
01993 
01994 #if YYDEBUG != 0
01995   if (yydebug)
01996     {
01997       short *ssp1 = yyss - 1;
01998       fprintf (stderr, "state stack now");
01999       while (ssp1 != yyssp)
02000     fprintf (stderr, " %d", *++ssp1);
02001       fprintf (stderr, "\n");
02002     }
02003 #endif
02004 
02005   *++yyvsp = yyval;
02006 
02007 #ifdef YYLSP_NEEDED
02008   yylsp++;
02009   if (yylen == 0)
02010     {
02011       yylsp->first_line = yylloc.first_line;
02012       yylsp->first_column = yylloc.first_column;
02013       yylsp->last_line = (yylsp-1)->last_line;
02014       yylsp->last_column = (yylsp-1)->last_column;
02015       yylsp->text = 0;
02016     }
02017   else
02018     {
02019       yylsp->last_line = (yylsp+yylen-1)->last_line;
02020       yylsp->last_column = (yylsp+yylen-1)->last_column;
02021     }
02022 #endif
02023 
02024   /* Now "shift" the result of the reduction.
02025      Determine what state that goes to,
02026      based on the state we popped back to
02027      and the rule number reduced by.  */
02028 
02029   yyn = yyr1[yyn];
02030 
02031   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
02032   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02033     yystate = yytable[yystate];
02034   else
02035     yystate = yydefgoto[yyn - YYNTBASE];
02036 
02037   goto yynewstate;
02038 
02039 yyerrlab:   /* here on detecting error */
02040 
02041   if (! yyerrstatus)
02042     /* If not already recovering from an error, report this error.  */
02043     {
02044       ++yynerrs;
02045 
02046 #ifdef YYERROR_VERBOSE
02047       yyn = yypact[yystate];
02048 
02049       if (yyn > YYFLAG && yyn < YYLAST)
02050     {
02051       int size = 0;
02052       char *msg;
02053       int x, count;
02054 
02055       count = 0;
02056       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
02057       for (x = (yyn < 0 ? -yyn : 0);
02058            x < (sizeof(yytname) / sizeof(char *)); x++)
02059         if (yycheck[x + yyn] == x)
02060           size += strlen(yytname[x]) + 15, count++;
02061       msg = (char *) malloc(size + 15);
02062       if (msg != 0)
02063         {
02064           strcpy(msg, "parse error");
02065 
02066           if (count < 5)
02067         {
02068           count = 0;
02069           for (x = (yyn < 0 ? -yyn : 0);
02070                x < (sizeof(yytname) / sizeof(char *)); x++)
02071             if (yycheck[x + yyn] == x)
02072               {
02073             strcat(msg, count == 0 ? ", expecting `" : " or `");
02074             strcat(msg, yytname[x]);
02075             strcat(msg, "'");
02076             count++;
02077               }
02078         }
02079           yyerror(msg);
02080           free(msg);
02081         }
02082       else
02083         yyerror ("parse error; also virtual memory exceeded");
02084     }
02085       else
02086 #endif /* YYERROR_VERBOSE */
02087     yyerror("parse error");
02088     }
02089 
02090   goto yyerrlab1;
02091 yyerrlab1:   /* here on error raised explicitly by an action */
02092 
02093   if (yyerrstatus == 3)
02094     {
02095       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
02096 
02097       /* return failure if at end of input */
02098       if (yychar == YYEOF)
02099     YYABORT;
02100 
02101 #if YYDEBUG != 0
02102       if (yydebug)
02103     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
02104 #endif
02105 
02106       yychar = YYEMPTY;
02107     }
02108 
02109   /* Else will try to reuse lookahead token
02110      after shifting the error token.  */
02111 
02112   yyerrstatus = 3;      /* Each real token shifted decrements this */
02113 
02114   goto yyerrhandle;
02115 
02116 yyerrdefault:  /* current state does not do anything special for the error token. */
02117 
02118 #if 0
02119   /* This is wrong; only states that explicitly want error tokens
02120      should shift them.  */
02121   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
02122   if (yyn) goto yydefault;
02123 #endif
02124 
02125 yyerrpop:   /* pop the current state because it cannot handle the error token */
02126 
02127   if (yyssp == yyss) YYABORT;
02128   yyvsp--;
02129   yystate = *--yyssp;
02130 #ifdef YYLSP_NEEDED
02131   yylsp--;
02132 #endif
02133 
02134 #if YYDEBUG != 0
02135   if (yydebug)
02136     {
02137       short *ssp1 = yyss - 1;
02138       fprintf (stderr, "Error: state stack now");
02139       while (ssp1 != yyssp)
02140     fprintf (stderr, " %d", *++ssp1);
02141       fprintf (stderr, "\n");
02142     }
02143 #endif
02144 
02145 yyerrhandle:
02146 
02147   yyn = yypact[yystate];
02148   if (yyn == YYFLAG)
02149     goto yyerrdefault;
02150 
02151   yyn += YYTERROR;
02152   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
02153     goto yyerrdefault;
02154 
02155   yyn = yytable[yyn];
02156   if (yyn < 0)
02157     {
02158       if (yyn == YYFLAG)
02159     goto yyerrpop;
02160       yyn = -yyn;
02161       goto yyreduce;
02162     }
02163   else if (yyn == 0)
02164     goto yyerrpop;
02165 
02166   if (yyn == YYFINAL)
02167     YYACCEPT;
02168 
02169 #if YYDEBUG != 0
02170   if (yydebug)
02171     fprintf(stderr, "Shifting error token, ");
02172 #endif
02173 
02174   *++yyvsp = yylval;
02175 #ifdef YYLSP_NEEDED
02176   *++yylsp = yylloc;
02177 #endif
02178 
02179   yystate = yyn;
02180   goto yynewstate;
02181 
02182  yyacceptlab:
02183   /* YYACCEPT comes here.  */
02184   if (yyfree_stacks)
02185     {
02186       free (yyss);
02187       free (yyvs);
02188 #ifdef YYLSP_NEEDED
02189       free (yyls);
02190 #endif
02191     }
02192   return 0;
02193 
02194  yyabortlab:
02195   /* YYABORT comes here.  */
02196   if (yyfree_stacks)
02197     {
02198       free (yyss);
02199       free (yyvs);
02200 #ifdef YYLSP_NEEDED
02201       free (yyls);
02202 #endif
02203     }
02204   return 1;
02205 }
02206 #line 1263 "sqlparser.y"
02207 
02208 
02209 const char * const tname(int offset) { return yytname[offset]; }
KDE Home | KDE Accessibility Home | Description of Access Keys