File indexing completed on 2024-05-05 16:47:22

0001 #line 2 "generated/sqlscanner.cpp"
0002 
0003 #line 4 "generated/sqlscanner.cpp"
0004 
0005 #define  YY_INT_ALIGNED short int
0006 
0007 /* A lexical scanner generated by flex */
0008 
0009 #define FLEX_SCANNER
0010 #define YY_FLEX_MAJOR_VERSION 2
0011 #define YY_FLEX_MINOR_VERSION 5
0012 #define YY_FLEX_SUBMINOR_VERSION 37
0013 #if YY_FLEX_SUBMINOR_VERSION > 0
0014 #define FLEX_BETA
0015 #endif
0016 
0017 /* First, we deal with  platform-specific or compiler-specific issues. */
0018 
0019 /* begin standard C headers. */
0020 #include <stdio.h>
0021 #include <string.h>
0022 #include <errno.h>
0023 #include <stdlib.h>
0024 
0025 /* end standard C headers. */
0026 
0027 /* flex integer type definitions */
0028 
0029 #ifndef FLEXINT_H
0030 #define FLEXINT_H
0031 
0032 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
0033 
0034 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
0035 
0036 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
0037  * if you want the limit (max/min) macros for int types.
0038  */
0039 #ifndef __STDC_LIMIT_MACROS
0040 #define __STDC_LIMIT_MACROS 1
0041 #endif
0042 
0043 #include <inttypes.h>
0044 typedef int8_t flex_int8_t;
0045 typedef uint8_t flex_uint8_t;
0046 typedef int16_t flex_int16_t;
0047 typedef uint16_t flex_uint16_t;
0048 typedef int32_t flex_int32_t;
0049 typedef uint32_t flex_uint32_t;
0050 #else
0051 typedef signed char flex_int8_t;
0052 typedef short int flex_int16_t;
0053 typedef int flex_int32_t;
0054 typedef unsigned char flex_uint8_t;
0055 typedef unsigned short int flex_uint16_t;
0056 typedef unsigned int flex_uint32_t;
0057 
0058 /* Limits of integral types. */
0059 #ifndef INT8_MIN
0060 #define INT8_MIN               (-128)
0061 #endif
0062 #ifndef INT16_MIN
0063 #define INT16_MIN              (-32767-1)
0064 #endif
0065 #ifndef INT32_MIN
0066 #define INT32_MIN              (-2147483647-1)
0067 #endif
0068 #ifndef INT8_MAX
0069 #define INT8_MAX               (127)
0070 #endif
0071 #ifndef INT16_MAX
0072 #define INT16_MAX              (32767)
0073 #endif
0074 #ifndef INT32_MAX
0075 #define INT32_MAX              (2147483647)
0076 #endif
0077 #ifndef UINT8_MAX
0078 #define UINT8_MAX              (255U)
0079 #endif
0080 #ifndef UINT16_MAX
0081 #define UINT16_MAX             (65535U)
0082 #endif
0083 #ifndef UINT32_MAX
0084 #define UINT32_MAX             (4294967295U)
0085 #endif
0086 
0087 #endif /* ! C99 */
0088 
0089 #endif /* ! FLEXINT_H */
0090 
0091 #ifdef __cplusplus
0092 
0093 /* The "const" storage-class-modifier is valid. */
0094 #define YY_USE_CONST
0095 
0096 #else   /* ! __cplusplus */
0097 
0098 /* C99 requires __STDC__ to be defined as 1. */
0099 #if defined (__STDC__)
0100 
0101 #define YY_USE_CONST
0102 
0103 #endif  /* defined (__STDC__) */
0104 #endif  /* ! __cplusplus */
0105 
0106 #ifdef YY_USE_CONST
0107 #define yyconst const
0108 #else
0109 #define yyconst
0110 #endif
0111 
0112 /* Returned upon end-of-file. */
0113 #define YY_NULL 0
0114 
0115 /* Promotes a possibly negative, possibly signed char to an unsigned
0116  * integer for use as an array index.  If the signed char is negative,
0117  * we want to instead treat it as an 8-bit unsigned char, hence the
0118  * double cast.
0119  */
0120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
0121 
0122 /* Enter a start condition.  This macro really ought to take a parameter,
0123  * but we do it the disgusting crufty way forced on us by the ()-less
0124  * definition of BEGIN.
0125  */
0126 #define BEGIN (yy_start) = 1 + 2 *
0127 
0128 /* Translate the current start state into a value that can be later handed
0129  * to BEGIN to return to the state.  The YYSTATE alias is for lex
0130  * compatibility.
0131  */
0132 #define YY_START (((yy_start) - 1) / 2)
0133 #define YYSTATE YY_START
0134 
0135 /* Action number for EOF rule of a given start state. */
0136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
0137 
0138 /* Special action meaning "start processing a new file". */
0139 #define YY_NEW_FILE yyrestart(yyin  )
0140 
0141 #define YY_END_OF_BUFFER_CHAR 0
0142 
0143 /* Size of default input buffer. */
0144 #ifndef YY_BUF_SIZE
0145 #define YY_BUF_SIZE 16384
0146 #endif
0147 
0148 /* The state buf must be large enough to hold one state per character in the main buffer.
0149  */
0150 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
0151 
0152 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
0153 #define YY_TYPEDEF_YY_BUFFER_STATE
0154 typedef struct yy_buffer_state *YY_BUFFER_STATE;
0155 #endif
0156 
0157 #ifndef YY_TYPEDEF_YY_SIZE_T
0158 #define YY_TYPEDEF_YY_SIZE_T
0159 typedef size_t yy_size_t;
0160 #endif
0161 
0162 extern yy_size_t yyleng;
0163 
0164 extern FILE *yyin, *yyout;
0165 
0166 #define EOB_ACT_CONTINUE_SCAN 0
0167 #define EOB_ACT_END_OF_FILE 1
0168 #define EOB_ACT_LAST_MATCH 2
0169 
0170     #define YY_LESS_LINENO(n)
0171 
0172 /* Return all but the first "n" matched characters back to the input stream. */
0173 #define yyless(n) \
0174     do \
0175         { \
0176         /* Undo effects of setting up yytext. */ \
0177         int yyless_macro_arg = (n); \
0178         YY_LESS_LINENO(yyless_macro_arg);\
0179         *yy_cp = (yy_hold_char); \
0180         YY_RESTORE_YY_MORE_OFFSET \
0181         (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
0182         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
0183         } \
0184     while ( 0 )
0185 
0186 #define unput(c) yyunput( c, (yytext_ptr)  )
0187 
0188 #ifndef YY_STRUCT_YY_BUFFER_STATE
0189 #define YY_STRUCT_YY_BUFFER_STATE
0190 struct yy_buffer_state
0191     {
0192     FILE *yy_input_file;
0193 
0194     char *yy_ch_buf;        /* input buffer */
0195     char *yy_buf_pos;       /* current position in input buffer */
0196 
0197     /* Size of input buffer in bytes, not including room for EOB
0198      * characters.
0199      */
0200     int yy_buf_size;
0201 
0202     /* Number of characters read into yy_ch_buf, not including EOB
0203      * characters.
0204      */
0205     int yy_n_chars;
0206 
0207     /* Whether we "own" the buffer - i.e., we know we created it,
0208      * and can realloc() it to grow it, and should free() it to
0209      * delete it.
0210      */
0211     int yy_is_our_buffer;
0212 
0213     /* Whether this is an "interactive" input source; if so, and
0214      * if we're using stdio for input, then we want to use getc()
0215      * instead of fread(), to make sure we stop fetching input after
0216      * each newline.
0217      */
0218     int yy_is_interactive;
0219 
0220     /* Whether we're considered to be at the beginning of a line.
0221      * If so, '^' rules will be active on the next match, otherwise
0222      * not.
0223      */
0224     int yy_at_bol;
0225 
0226     int yy_bs_lineno; /**< The line count. */
0227     int yy_bs_column; /**< The column count. */
0228 
0229     /* Whether to try to fill the input buffer when we reach the
0230      * end of it.
0231      */
0232     int yy_fill_buffer;
0233 
0234     int yy_buffer_status;
0235 
0236 #define YY_BUFFER_NEW 0
0237 #define YY_BUFFER_NORMAL 1
0238     /* When an EOF's been seen but there's still some text to process
0239      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
0240      * shouldn't try reading from the input source any more.  We might
0241      * still have a bunch of tokens to match, though, because of
0242      * possible backing-up.
0243      *
0244      * When we actually see the EOF, we change the status to "new"
0245      * (via yyrestart()), so that the user can continue scanning by
0246      * just pointing yyin at a new input file.
0247      */
0248 #define YY_BUFFER_EOF_PENDING 2
0249 
0250     };
0251 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
0252 
0253 /* Stack of input buffers. */
0254 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
0255 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
0256 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
0257 
0258 /* We provide macros for accessing buffer states in case in the
0259  * future we want to put the buffer states in a more general
0260  * "scanner state".
0261  *
0262  * Returns the top of the stack, or NULL.
0263  */
0264 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
0265                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
0266                           : NULL)
0267 
0268 /* Same as previous macro, but useful when we know that the buffer stack is not
0269  * NULL or when we need an lvalue. For internal use only.
0270  */
0271 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
0272 
0273 /* yy_hold_char holds the character lost when yytext is formed. */
0274 static char yy_hold_char;
0275 static int yy_n_chars;      /* number of characters read into yy_ch_buf */
0276 yy_size_t yyleng;
0277 
0278 /* Points to current character in buffer. */
0279 static char *yy_c_buf_p = (char *) 0;
0280 static int yy_init = 0;     /* whether we need to initialize */
0281 static int yy_start = 0;    /* start state number */
0282 
0283 /* Flag which is used to allow yywrap()'s to do buffer switches
0284  * instead of setting up a fresh yyin.  A bit of a hack ...
0285  */
0286 static int yy_did_buffer_switch_on_eof;
0287 
0288 void yyrestart (FILE *input_file  );
0289 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
0290 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
0291 void yy_delete_buffer (YY_BUFFER_STATE b  );
0292 void yy_flush_buffer (YY_BUFFER_STATE b  );
0293 void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
0294 void yypop_buffer_state (void );
0295 
0296 static void yyensure_buffer_stack (void );
0297 static void yy_load_buffer_state (void );
0298 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
0299 
0300 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
0301 
0302 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
0303 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
0304 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len  );
0305 
0306 void *yyalloc (yy_size_t  );
0307 void *yyrealloc (void *,yy_size_t  );
0308 void yyfree (void *  );
0309 
0310 #define yy_new_buffer yy_create_buffer
0311 
0312 #define yy_set_interactive(is_interactive) \
0313     { \
0314     if ( ! YY_CURRENT_BUFFER ){ \
0315         yyensure_buffer_stack (); \
0316         YY_CURRENT_BUFFER_LVALUE =    \
0317             yy_create_buffer(yyin,YY_BUF_SIZE ); \
0318     } \
0319     YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
0320     }
0321 
0322 #define yy_set_bol(at_bol) \
0323     { \
0324     if ( ! YY_CURRENT_BUFFER ){\
0325         yyensure_buffer_stack (); \
0326         YY_CURRENT_BUFFER_LVALUE =    \
0327             yy_create_buffer(yyin,YY_BUF_SIZE ); \
0328     } \
0329     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
0330     }
0331 
0332 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
0333 
0334 /* Begin user sect3 */
0335 
0336 #define yywrap() 1
0337 #define YY_SKIP_YYWRAP
0338 
0339 typedef unsigned char YY_CHAR;
0340 
0341 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
0342 
0343 typedef int yy_state_type;
0344 
0345 extern int yylineno;
0346 
0347 int yylineno = 1;
0348 
0349 extern char *yytext;
0350 #define yytext_ptr yytext
0351 
0352 static yy_state_type yy_get_previous_state (void );
0353 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
0354 static int yy_get_next_buffer (void );
0355 static void yy_fatal_error (yyconst char msg[]  );
0356 
0357 /* Done after the current pattern has been matched and before the
0358  * corresponding action - sets up yytext.
0359  */
0360 #define YY_DO_BEFORE_ACTION \
0361     (yytext_ptr) = yy_bp; \
0362     yyleng = (size_t) (yy_cp - yy_bp); \
0363     (yy_hold_char) = *yy_cp; \
0364     *yy_cp = '\0'; \
0365     (yy_c_buf_p) = yy_cp;
0366 
0367 #define YY_NUM_RULES 57
0368 #define YY_END_OF_BUFFER 58
0369 /* This struct is not used in this scanner,
0370    but its presence is necessary. */
0371 struct yy_trans_info
0372     {
0373     flex_int32_t yy_verify;
0374     flex_int32_t yy_nxt;
0375     };
0376 static yyconst flex_int16_t yy_accept[195] =
0377     {   0,
0378         0,    0,    0,    0,   58,   56,   54,   54,   55,   56,
0379         9,   55,   55,   56,   55,    7,   55,   55,   55,   52,
0380        52,   52,   52,   52,   52,   52,   52,   52,   52,   52,
0381        52,   52,   52,   52,   52,   55,   55,   16,   12,   57,
0382        15,   10,   11,   16,   16,   54,    2,    0,   51,    0,
0383        17,    0,   51,    0,    8,    8,    7,   52,   40,    4,
0384         1,    3,    5,   41,   52,   18,   52,   48,   52,   52,
0385        52,   52,    6,   33,   52,   52,   52,   52,   52,   37,
0386        38,   52,   52,   52,   52,   52,   52,   52,    0,   39,
0387        12,    0,    0,   11,   13,   14,   51,   51,    8,   17,
0388 
0389        49,   52,   52,   52,   52,   52,   52,    0,   52,   52,
0390        52,   32,   52,   52,   52,   52,   52,   52,   52,   52,
0391        42,   53,   52,   52,   50,   52,   20,   52,    0,   22,
0392        23,   24,    0,   34,   52,   52,   52,   52,   52,   35,
0393        52,   52,   52,   36,   52,    0,    0,    0,    0,    0,
0394        47,   43,   52,   52,   45,   46,   52,   19,   52,    0,
0395         0,    0,    0,    0,   44,   52,   26,   21,    0,   31,
0396         0,    0,    0,   52,    0,    0,   25,    0,    0,    0,
0397         0,    0,    0,    0,    0,    0,   29,   30,   27,    0,
0398         0,    0,   28,    0
0399 
0400     } ;
0401 
0402 static yyconst flex_int32_t yy_ec[256] =
0403     {   0,
0404         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
0405         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0406         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0407         1,    2,    4,    5,    6,    1,    7,    8,    9,    7,
0408         7,    7,   10,    7,   10,   11,   10,   12,   12,   12,
0409        12,   12,   12,   12,   12,   12,   12,   10,    7,   13,
0410        14,   15,    7,    7,   16,   17,   18,   19,   20,   21,
0411        22,   23,   24,   25,   26,   27,   28,   29,   30,   31,
0412        32,   33,   34,   35,   36,   32,   37,   38,   39,   32,
0413        40,   41,   42,    7,   32,    7,   43,   44,   45,   46,
0414 
0415        47,   48,   49,   50,   51,   52,   53,   54,   55,   56,
0416        57,   58,   32,   59,   60,   61,   62,   32,   63,   64,
0417        65,   32,    1,   66,    1,    7,    1,    1,    1,    1,
0418         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0419         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0420         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0421         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0422         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0423         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0424         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0425 
0426         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0427         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0428         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0429         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0430         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0431         1,    1,    1,    1,    1
0432     } ;
0433 
0434 static yyconst flex_int32_t yy_meta[67] =
0435     {   0,
0436         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0437         2,    2,    1,    1,    1,    2,    2,    2,    2,    2,
0438         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
0439         2,    2,    2,    2,    2,    2,    2,    2,    2,    3,
0440         1,    3,    2,    2,    2,    2,    2,    2,    2,    2,
0441         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
0442         2,    2,    2,    2,    2,    1
0443     } ;
0444 
0445 static yyconst flex_int16_t yy_base[200] =
0446     {   0,
0447         0,    0,   65,   70,  488,  516,   67,   76,  473,   69,
0448       516,  516,  478,   74,  473,   73,   74,  470,   76,   82,
0449        83,   81,   84,  472,   86,   98,   87,  113,  123,  110,
0450        96,  141,  130,  144,  138,    0,  416,  516,  155,  516,
0451       516,  516,  469,   71,  107,  103,  516,   95,  475,  146,
0452       516,  109,  470,  161,  464,  463,  163,  463,  516,  516,
0453       516,  516,  516,  516,  165,  161,  166,  462,  170,  171,
0454       172,  167,  180,  201,  185,  189,  182,  203,  196,  461,
0455       209,  207,  205,  211,  208,  210,  222,  229,  429,  516,
0456       232,  202,  215,  458,  516,  516,  239,  236,  457,  457,
0457 
0458       456,  236,  238,  240,  242,  250,  254,  265,  260,  249,
0459       271,  284,  281,  286,  289,  287,  272,  282,  293,  292,
0460       455,  516,  300,  303,  453,  306,  452,  308,  292,  451,
0461       447,  445,  329,  443,  326,  313,  332,  318,  341,  442,
0462       347,  349,  351,  437,  355,  280,  328,  345,  344,  346,
0463       432,  424,  365,  368,  333,  331,  375,  316,  370,  388,
0464       351,  345,  361,  365,  268,  388,  145,  114,  405,  516,
0465       364,  389,  386,  413,  376,  393,  516,  390,  416,  395,
0466       403,  409,  398,  403,  403,  406,  516,  516,  516,  439,
0467       443,  403,  516,  516,  504,  507,  510,  110,  513
0468 
0469     } ;
0470 
0471 static yyconst flex_int16_t yy_def[200] =
0472     {   0,
0473       194,    1,  195,  195,  194,  194,  194,  194,  194,  196,
0474       194,  194,  194,  197,  194,  198,  194,  194,  194,  198,
0475       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
0476       198,  198,  198,  198,  198,  199,  194,  194,  194,  194,
0477       194,  194,  194,  194,  194,  194,  194,  196,  194,  196,
0478       194,  197,  194,  197,  194,  194,  198,  198,  194,  194,
0479       194,  194,  194,  194,  198,  198,  198,  198,  198,  198,
0480       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
0481       198,  198,  198,  198,  198,  198,  198,  198,  199,  194,
0482       194,  194,  194,  194,  194,  194,  196,  197,  194,  198,
0483 
0484       198,  198,  198,  198,  198,  198,  198,  194,  198,  198,
0485       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
0486       198,  194,  198,  198,  198,  198,  198,  198,  194,  198,
0487       198,  198,  194,  198,  198,  198,  198,  198,  198,  198,
0488       198,  198,  198,  198,  198,  194,  194,  194,  194,  194,
0489       198,  198,  198,  198,  198,  198,  198,  198,  198,  194,
0490       194,  194,  194,  194,  198,  198,  198,  198,  194,  194,
0491       194,  194,  194,  198,  194,  194,  194,  194,  194,  194,
0492       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0493       194,  194,  194,    0,  194,  194,  194,  194,  194
0494 
0495     } ;
0496 
0497 static yyconst flex_int16_t yy_nxt[583] =
0498     {   0,
0499         6,    7,    8,    9,   10,   11,   12,   13,   14,   12,
0500        15,   16,   17,   18,   19,   20,   21,   22,   23,   24,
0501        25,   24,   24,   26,   27,   24,   28,   24,   29,   30,
0502        24,   24,   31,   32,   33,   24,   34,   35,   24,   36,
0503         6,   12,   20,   21,   22,   23,   24,   25,   24,   24,
0504        26,   27,   24,   28,   24,   29,   30,   24,   31,   32,
0505        33,   24,   34,   35,   24,   37,   39,   40,   46,   46,
0506        41,   39,   40,   49,   42,   41,   43,   46,   46,   42,
0507        44,   43,   53,   56,   57,   44,   59,   60,   61,   63,
0508        64,  194,  194,  194,  194,   45,  194,  194,   95,   49,
0509 
0510        45,   71,   67,   70,   46,   46,  194,   44,  194,   50,
0511        65,   58,   44,   69,   54,   66,   75,   53,   72,   82,
0512       194,   68,   45,  194,  194,   95,   73,   45,   71,   67,
0513        70,   74,   76,  194,   96,   50,   77,   65,   80,   69,
0514       194,   66,   81,   75,   72,   85,   82,   68,  194,   54,
0515        97,  194,   78,   73,  194,  194,   91,   74,   79,   76,
0516        83,   96,   86,   77,   84,   80,   87,   88,   81,   98,
0517        92,  194,   85,   56,   57,  194,  194,  194,  101,   78,
0518       194,  194,  194,  100,   79,   93,   50,   83,   86,  103,
0519       194,   84,  194,   87,   88,  194,  106,   92,  105,  194,
0520 
0521       102,   54,  108,  108,  104,  101,  194,  111,  109,  110,
0522       100,  194,   93,  194,  107,  194,  103,  194,  194,  194,
0523       194,  194,  113,  106,  118,  105,  102,  114,  115,   95,
0524       104,  116,  194,   91,  111,  109,  110,  112,  117,  194,
0525       107,  120,   96,   97,   98,  119,  194,   92,  194,  113,
0526       194,  118,  194,  124,  114,  115,   95,  125,  116,  194,
0527       194,  121,   93,  112,  194,  117,  108,  108,  120,   96,
0528       194,  119,  123,  128,   92,  126,   54,  127,  194,   50,
0529       124,  194,  194,  131,  125,  133,  133,  121,  130,   93,
0530       132,  194,  194,  129,  194,  138,  194,  194,  123,  194,
0531 
0532       128,  126,  194,  194,  127,  135,  137,  134,  139,  131,
0533       194,  136,  140,  194,  160,  130,  194,  132,  194,  142,
0534       129,  146,  138,  194,  141,  144,  194,  147,  194,  145,
0535       133,  133,  135,  137,  134,  139,  194,  143,  136,  140,
0536       160,  194,  194,  194,  154,  148,  142,  152,  146,  153,
0537       141,  194,  144,  147,  161,  149,  145,  194,  151,  194,
0538       155,  194,  150,  143,  162,  194,  156,  163,  157,  164,
0539       158,  154,  148,  152,  159,  194,  153,  170,  194,  171,
0540       194,  161,  149,  166,  151,  194,  172,  155,  150,  169,
0541       169,  162,  173,  156,  163,  157,  164,  158,  194,  165,
0542 
0543       176,  159,  168,  167,  170,  171,  169,  169,  177,  178,
0544       166,  180,  181,  172,  179,  179,  182,  179,  179,  173,
0545       174,  184,  185,  194,  186,  165,  176,  187,  168,  188,
0546       167,  189,  193,  175,  194,  177,  178,  180,  190,  181,
0547       191,  191,  194,  182,  191,  191,  174,  194,  184,  185,
0548       183,  186,  194,  194,  187,  194,  188,  194,  189,  193,
0549       175,  194,  194,  194,  190,  194,  194,  194,   99,   94,
0550       122,  194,  194,  194,   99,   55,  183,  192,   52,   48,
0551        94,   90,  194,   62,   55,   51,   47,  194,  194,  194,
0552       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0553 
0554       194,  194,  194,  192,   38,   38,   38,   48,   48,   48,
0555        52,   52,   52,   89,   89,    5,  194,  194,  194,  194,
0556       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0557       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0558       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0559       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0560       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0561       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0562       194,  194
0563     } ;
0564 
0565 static yyconst flex_int16_t yy_chk[583] =
0566     {   0,
0567         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0568         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0569         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0570         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0571         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0572         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
0573         1,    1,    1,    1,    1,    1,    3,    3,    7,    7,
0574         3,    4,    4,   10,    3,    4,    3,    8,    8,    4,
0575         3,    4,   14,   16,   16,    4,   17,   17,   17,   19,
0576        19,   22,   20,   21,   23,    3,   25,   27,   44,   48,
0577 
0578         4,   25,   21,   23,   46,   46,   31,    3,   26,   10,
0579        20,  198,    4,   22,   14,   20,   27,   52,   25,   31,
0580        30,   21,    3,   28,  168,   44,   26,    4,   25,   21,
0581        23,   26,   28,   29,   45,   48,   28,   20,   30,   22,
0582        33,   20,   30,   27,   25,   33,   31,   21,   35,   52,
0583        50,   32,   29,   26,   34,  167,   39,   26,   29,   28,
0584        32,   45,   33,   28,   32,   30,   34,   35,   30,   54,
0585        39,   66,   33,   57,   57,   65,   67,   72,   66,   29,
0586        69,   70,   71,   65,   29,   39,   50,   32,   33,   69,
0587        73,   32,   77,   34,   35,   75,   72,   39,   71,   76,
0588 
0589        67,   54,   74,   74,   70,   66,   79,   77,   75,   76,
0590        65,   74,   39,   78,   73,   83,   69,   82,   85,   81,
0591        86,   84,   79,   72,   85,   71,   67,   81,   82,   92,
0592        70,   83,   87,   91,   77,   75,   76,   78,   84,   88,
0593        73,   87,   93,   97,   98,   86,  102,   91,  103,   79,
0594       104,   85,  105,  103,   81,   82,   92,  104,   83,  110,
0595       106,   88,   91,   78,  107,   84,  108,  108,   87,   93,
0596       109,   86,  102,  107,   91,  105,   98,  106,  165,   97,
0597       103,  111,  117,  110,  104,  112,  112,   88,  109,   91,
0598       111,  113,  118,  108,  112,  117,  114,  116,  102,  115,
0599 
0600       107,  105,  120,  119,  106,  114,  116,  113,  118,  110,
0601       123,  115,  119,  124,  146,  109,  126,  111,  128,  123,
0602       108,  129,  117,  136,  120,  126,  158,  129,  138,  128,
0603       133,  133,  114,  116,  113,  118,  135,  124,  115,  119,
0604       146,  156,  137,  155,  138,  133,  123,  136,  129,  137,
0605       120,  139,  126,  129,  147,  133,  128,  141,  135,  142,
0606       139,  143,  133,  124,  148,  145,  141,  149,  142,  150,
0607       143,  138,  133,  136,  145,  153,  137,  161,  154,  162,
0608       159,  147,  133,  154,  135,  157,  163,  139,  133,  160,
0609       160,  148,  164,  141,  149,  142,  150,  143,  166,  153,
0610 
0611       171,  145,  159,  157,  161,  162,  169,  169,  172,  173,
0612       154,  175,  176,  163,  174,  174,  178,  179,  179,  164,
0613       166,  180,  181,  174,  182,  153,  171,  183,  159,  184,
0614       157,  185,  192,  169,  152,  172,  173,  175,  186,  176,
0615       190,  190,  151,  178,  191,  191,  166,  144,  180,  181,
0616       179,  182,  140,  134,  183,  132,  184,  131,  185,  192,
0617       169,  130,  127,  125,  186,  121,  101,  100,   99,   94,
0618        89,   80,   68,   58,   56,   55,  179,  191,   53,   49,
0619        43,   37,   24,   18,   15,   13,    9,    5,    0,    0,
0620         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
0621 
0622         0,    0,    0,  191,  195,  195,  195,  196,  196,  196,
0623       197,  197,  197,  199,  199,  194,  194,  194,  194,  194,
0624       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0625       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0626       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0627       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0628       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0629       194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
0630       194,  194
0631     } ;
0632 
0633 static yy_state_type yy_last_accepting_state;
0634 static char *yy_last_accepting_cpos;
0635 
0636 extern int yy_flex_debug;
0637 int yy_flex_debug = 0;
0638 
0639 /* The intent behind this definition is that it'll catch
0640  * any uses of REJECT which flex missed.
0641  */
0642 #define REJECT reject_used_but_not_detected
0643 #define yymore() yymore_used_but_not_detected
0644 #define YY_MORE_ADJ 0
0645 #define YY_RESTORE_YY_MORE_OFFSET
0646 char *yytext;
0647 #line 1 "KDbSqlScanner.l"
0648 /* This file is part of the KDE project
0649    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
0650    Copyright (C) 2004-2018 Jarosław Staniek <staniek@kde.org>
0651 
0652    This library is free software; you can redistribute it and/or
0653    modify it under the terms of the GNU Library General Public
0654    License as published by the Free Software Foundation; either
0655    version 2 of the License, or (at your option) any later version.
0656 
0657    This library is distributed in the hope that it will be useful,
0658    but WITHOUT ANY WARRANTY; without even the implied warranty of
0659    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0660    Library General Public License for more details.
0661 
0662    You should have received a copy of the GNU Library General Public License
0663    along with this library; see the file COPYING.LIB.  If not, write to
0664    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0665    Boston, MA 02110-1301, USA.
0666 */
0667 #line 22 "KDbSqlScanner.l"
0668 #include "sqlparser.h"
0669 #include "KDb.h"
0670 #include "KDbExpression.h"
0671 #include "KDbParser.h"
0672 #include "KDbSqlTypes.h"
0673 #include "kdb_debug.h"
0674 
0675 extern int globalCurrentPos;
0676 extern QByteArray globalToken;
0677 
0678 #define YY_NO_UNPUT
0679 #define ECOUNT globalCurrentPos += yyleng; globalToken = yytext
0680 
0681 extern void setError(const QString& errDesc);
0682 extern void setError(const QString& errName, const QString& errDesc);
0683 
0684 /* Only quotes the input if it does not start with a quote character, otherwise
0685  it would be too hard to read with some fonts. */
0686 static QString maybeQuote(const QString& string)
0687 {
0688     QString first(string.at(0));
0689     if (first == QLatin1Char('\'') || first == QLatin1Char('"') || first == QLatin1Char('`')) {
0690         return string;
0691     }
0692     return QStringLiteral("\"%1\"").arg(string);
0693 }
0694 /* *** Please reflect changes to this file in ../driver_p.cpp *** */
0695 
0696 /*identifier       [a-zA-Z_][a-zA-Z_0-9]* */
0697 /* quoted_identifier (\"[a-zA-Z_0-9]+\") */
0698 #line 699 "generated/sqlscanner.cpp"
0699 
0700 #define INITIAL 0
0701 #define DATE_OR_TIME 1
0702 
0703 #ifndef YY_NO_UNISTD_H
0704 /* Special case for "unistd.h", since it is non-ANSI. We include it way
0705  * down here because we want the user's section 1 to have been scanned first.
0706  * The user has a chance to override it with an option.
0707  */
0708 #include <unistd.h>
0709 #endif
0710 
0711 #ifndef YY_EXTRA_TYPE
0712 #define YY_EXTRA_TYPE void *
0713 #endif
0714 
0715 static int yy_init_globals (void );
0716 
0717 /* Accessor methods to globals.
0718    These are made visible to non-reentrant scanners for convenience. */
0719 
0720 int yylex_destroy (void );
0721 
0722 int yyget_debug (void );
0723 
0724 void yyset_debug (int debug_flag  );
0725 
0726 YY_EXTRA_TYPE yyget_extra (void );
0727 
0728 void yyset_extra (YY_EXTRA_TYPE user_defined  );
0729 
0730 FILE *yyget_in (void );
0731 
0732 void yyset_in  (FILE * in_str  );
0733 
0734 FILE *yyget_out (void );
0735 
0736 void yyset_out  (FILE * out_str  );
0737 
0738 yy_size_t yyget_leng (void );
0739 
0740 char *yyget_text (void );
0741 
0742 int yyget_lineno (void );
0743 
0744 void yyset_lineno (int line_number  );
0745 
0746 /* Macros after this point can all be overridden by user definitions in
0747  * section 1.
0748  */
0749 
0750 #ifndef YY_SKIP_YYWRAP
0751 #ifdef __cplusplus
0752 extern "C" int yywrap (void );
0753 #else
0754 extern int yywrap (void );
0755 #endif
0756 #endif
0757 
0758     static void yyunput (int c,char *buf_ptr  );
0759 
0760 #ifndef yytext_ptr
0761 static void yy_flex_strncpy (char *,yyconst char *,int );
0762 #endif
0763 
0764 #ifdef YY_NEED_STRLEN
0765 static int yy_flex_strlen (yyconst char * );
0766 #endif
0767 
0768 #ifndef YY_NO_INPUT
0769 
0770 #ifdef __cplusplus
0771 static int yyinput (void );
0772 #else
0773 static int input (void );
0774 #endif
0775 
0776 #endif
0777 
0778 /* Amount of stuff to slurp up with each read. */
0779 #ifndef YY_READ_BUF_SIZE
0780 #define YY_READ_BUF_SIZE 8192
0781 #endif
0782 
0783 /* Copy whatever the last rule matched to the standard output. */
0784 #ifndef ECHO
0785 /* This used to be an fputs(), but since the string might contain NUL's,
0786  * we now use fwrite().
0787  */
0788 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
0789 #endif
0790 
0791 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
0792  * is returned in "result".
0793  */
0794 #ifndef YY_INPUT
0795 #define YY_INPUT(buf,result,max_size) \
0796     if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
0797         { \
0798         int c = '*'; \
0799         size_t n; \
0800         for ( n = 0; n < max_size && \
0801                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
0802             buf[n] = (char) c; \
0803         if ( c == '\n' ) \
0804             buf[n++] = (char) c; \
0805         if ( c == EOF && ferror( yyin ) ) \
0806             YY_FATAL_ERROR( "input in flex scanner failed" ); \
0807         result = n; \
0808         } \
0809     else \
0810         { \
0811         errno=0; \
0812         while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
0813             { \
0814             if( errno != EINTR) \
0815                 { \
0816                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
0817                 break; \
0818                 } \
0819             errno=0; \
0820             clearerr(yyin); \
0821             } \
0822         }\
0823 \
0824 
0825 #endif
0826 
0827 /* No semi-colon after return; correct usage is to write "yyterminate();" -
0828  * we don't want an extra ';' after the "return" because that will cause
0829  * some compilers to complain about unreachable statements.
0830  */
0831 #ifndef yyterminate
0832 #define yyterminate() return YY_NULL
0833 #endif
0834 
0835 /* Number of entries by which start-condition stack grows. */
0836 #ifndef YY_START_STACK_INCR
0837 #define YY_START_STACK_INCR 25
0838 #endif
0839 
0840 /* Report a fatal error. */
0841 #ifndef YY_FATAL_ERROR
0842 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
0843 #endif
0844 
0845 /* end tables serialization structures and prototypes */
0846 
0847 /* Default declaration of generated scanner - a define so the user can
0848  * easily add parameters.
0849  */
0850 #ifndef YY_DECL
0851 #define YY_DECL_IS_OURS 1
0852 
0853 extern int yylex (void);
0854 
0855 #define YY_DECL int yylex (void)
0856 #endif /* !YY_DECL */
0857 
0858 /* Code executed at the beginning of each rule, after yytext and yyleng
0859  * have been set up.
0860  */
0861 #ifndef YY_USER_ACTION
0862 #define YY_USER_ACTION
0863 #endif
0864 
0865 /* Code executed at the end of each rule. */
0866 #ifndef YY_BREAK
0867 #define YY_BREAK break;
0868 #endif
0869 
0870 #define YY_RULE_SETUP \
0871     YY_USER_ACTION
0872 
0873 /** The main scanner function which does all the work.
0874  */
0875 YY_DECL
0876 {
0877     register yy_state_type yy_current_state;
0878     register char *yy_cp, *yy_bp;
0879     register int yy_act;
0880 
0881 #line 73 "KDbSqlScanner.l"
0882 
0883 
0884     int DATE_OR_TIME_caller = 0;
0885 
0886 #line 887 "generated/sqlscanner.cpp"
0887 
0888     if ( !(yy_init) )
0889         {
0890         (yy_init) = 1;
0891 
0892 #ifdef YY_USER_INIT
0893         YY_USER_INIT;
0894 #endif
0895 
0896         if ( ! (yy_start) )
0897             (yy_start) = 1; /* first start state */
0898 
0899         if ( ! yyin )
0900             yyin = stdin;
0901 
0902         if ( ! yyout )
0903             yyout = stdout;
0904 
0905         if ( ! YY_CURRENT_BUFFER ) {
0906             yyensure_buffer_stack ();
0907             YY_CURRENT_BUFFER_LVALUE =
0908                 yy_create_buffer(yyin,YY_BUF_SIZE );
0909         }
0910 
0911         yy_load_buffer_state( );
0912         }
0913 
0914     while ( 1 )     /* loops until end-of-file is reached */
0915         {
0916         yy_cp = (yy_c_buf_p);
0917 
0918         /* Support of yytext. */
0919         *yy_cp = (yy_hold_char);
0920 
0921         /* yy_bp points to the position in yy_ch_buf of the start of
0922          * the current run.
0923          */
0924         yy_bp = yy_cp;
0925 
0926         yy_current_state = (yy_start);
0927 yy_match:
0928         do
0929             {
0930             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
0931             if ( yy_accept[yy_current_state] )
0932                 {
0933                 (yy_last_accepting_state) = yy_current_state;
0934                 (yy_last_accepting_cpos) = yy_cp;
0935                 }
0936             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
0937                 {
0938                 yy_current_state = (int) yy_def[yy_current_state];
0939                 if ( yy_current_state >= 195 )
0940                     yy_c = yy_meta[(unsigned int) yy_c];
0941                 }
0942             yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
0943             ++yy_cp;
0944             }
0945         while ( yy_current_state != 194 );
0946         yy_cp = (yy_last_accepting_cpos);
0947         yy_current_state = (yy_last_accepting_state);
0948 
0949 yy_find_action:
0950         yy_act = yy_accept[yy_current_state];
0951 
0952         YY_DO_BEFORE_ACTION;
0953 
0954 do_action:  /* This label is used only to access EOF actions. */
0955 
0956         switch ( yy_act )
0957     { /* beginning of action switch */
0958             case 0: /* must back up */
0959             /* undo the effects of YY_DO_BEFORE_ACTION */
0960             *yy_cp = (yy_hold_char);
0961             yy_cp = (yy_last_accepting_cpos);
0962             yy_current_state = (yy_last_accepting_state);
0963             goto yy_find_action;
0964 
0965 case 1:
0966 YY_RULE_SETUP
0967 #line 77 "KDbSqlScanner.l"
0968 {
0969     ECOUNT;
0970     return NOT_EQUAL;
0971 }
0972     YY_BREAK
0973 case 2:
0974 YY_RULE_SETUP
0975 #line 82 "KDbSqlScanner.l"
0976 {
0977     ECOUNT;
0978     return NOT_EQUAL2;
0979 }
0980     YY_BREAK
0981 case 3:
0982 YY_RULE_SETUP
0983 #line 87 "KDbSqlScanner.l"
0984 {
0985     ECOUNT;
0986     return '=';
0987 }
0988     YY_BREAK
0989 case 4:
0990 YY_RULE_SETUP
0991 #line 92 "KDbSqlScanner.l"
0992 {
0993     ECOUNT;
0994     return LESS_OR_EQUAL;
0995 }
0996     YY_BREAK
0997 case 5:
0998 YY_RULE_SETUP
0999 #line 97 "KDbSqlScanner.l"
1000 {
1001     ECOUNT;
1002     return GREATER_OR_EQUAL;
1003 }
1004     YY_BREAK
1005 case 6:
1006 YY_RULE_SETUP
1007 #line 102 "KDbSqlScanner.l"
1008 {
1009     ECOUNT;
1010     return SQL_IN;
1011 }
1012     YY_BREAK
1013 case 7:
1014 YY_RULE_SETUP
1015 #line 107 "KDbSqlScanner.l"
1016 {
1017 //! @todo what about hex or octal values?
1018     //we're using QString:toLongLong() here because atoll() is not so portable:
1019     ECOUNT;
1020     bool ok;
1021     yylval.integerValue = QByteArray(yytext).toLongLong(&ok);
1022     if (!ok) {
1023         setError(KDbParser::tr("Invalid integer number"), KDbParser::tr("This integer number may be too large."));
1024         return SCAN_ERROR;
1025     }
1026     return INTEGER_CONST;
1027 }
1028     YY_BREAK
1029 case 8:
1030 YY_RULE_SETUP
1031 #line 120 "KDbSqlScanner.l"
1032 {
1033     ECOUNT;
1034     yylval.binaryValue = new QByteArray(yytext, yyleng);
1035     return REAL_CONST;
1036 }
1037     YY_BREAK
1038 /* --- DATE_OR_TIME --- */
1039 case 9:
1040 YY_RULE_SETUP
1041 #line 127 "KDbSqlScanner.l"
1042 {
1043     ECOUNT;
1044     sqlParserDebug() << "### begin DATE_OR_TIME" << yytext << "(" << yyleng << ")";
1045     DATE_OR_TIME_caller = YYSTATE;
1046     BEGIN(DATE_OR_TIME);
1047     return '#';
1048 }
1049     YY_BREAK
1050 
1051 case 10:
1052 YY_RULE_SETUP
1053 #line 137 "KDbSqlScanner.l"
1054 { // year prefix or / or - or : separator
1055     ECOUNT;
1056     return yytext[0];
1057 }
1058     YY_BREAK
1059 case 11:
1060 YY_RULE_SETUP
1061 #line 142 "KDbSqlScanner.l"
1062 { // year, month, day, hour, minute or second
1063     ECOUNT;
1064     yylval.binaryValue = new QByteArray(yytext, yyleng);
1065     return DATE_TIME_INTEGER;
1066 }
1067     YY_BREAK
1068 case 12:
1069 YY_RULE_SETUP
1070 #line 148 "KDbSqlScanner.l"
1071 {
1072     ECOUNT;
1073     return TABS_OR_SPACES;
1074 }
1075     YY_BREAK
1076 case 13:
1077 YY_RULE_SETUP
1078 #line 153 "KDbSqlScanner.l"
1079 {
1080     ECOUNT;
1081     return TIME_AM;
1082 }
1083     YY_BREAK
1084 case 14:
1085 YY_RULE_SETUP
1086 #line 158 "KDbSqlScanner.l"
1087 {
1088     ECOUNT;
1089     return TIME_PM;
1090 }
1091     YY_BREAK
1092 case 15:
1093 YY_RULE_SETUP
1094 #line 163 "KDbSqlScanner.l"
1095 {
1096     ECOUNT;
1097     sqlParserDebug() << "### end DATE_OR_TIME" << yytext << "(" << yyleng << ")";
1098     BEGIN(DATE_OR_TIME_caller);
1099     return '#';
1100 }
1101     YY_BREAK
1102 case 16:
1103 YY_RULE_SETUP
1104 #line 171 "KDbSqlScanner.l"
1105 { // fallback rule to avoid flex's default action that prints the character to stdout
1106     // without notifying the scanner.
1107     ECOUNT;
1108     const QString string(QString::fromUtf8(yytext, yyleng));
1109     setError(KDbParser::tr("Unexpected character %1 in date/time").arg(maybeQuote(string)));
1110     return SCAN_ERROR;
1111 }
1112     YY_BREAK
1113 
1114 /* -- end of DATE_OR_TIME --- */
1115 case 17:
1116 YY_RULE_SETUP
1117 #line 182 "KDbSqlScanner.l"
1118 {
1119     ECOUNT;
1120     return AND;
1121 }
1122     YY_BREAK
1123 case 18:
1124 YY_RULE_SETUP
1125 #line 187 "KDbSqlScanner.l"
1126 {
1127     ECOUNT;
1128     return AS;
1129 }
1130     YY_BREAK
1131 case 19:
1132 YY_RULE_SETUP
1133 #line 192 "KDbSqlScanner.l"
1134 {
1135     ECOUNT;
1136     return CREATE;
1137 }
1138     YY_BREAK
1139 case 20:
1140 YY_RULE_SETUP
1141 #line 197 "KDbSqlScanner.l"
1142 {
1143     ECOUNT;
1144     return FROM;
1145 }
1146     YY_BREAK
1147 case 21:
1148 YY_RULE_SETUP
1149 #line 202 "KDbSqlScanner.l"
1150 {
1151     ECOUNT;
1152     return SQL_TYPE;
1153 }
1154     YY_BREAK
1155 case 22:
1156 YY_RULE_SETUP
1157 #line 207 "KDbSqlScanner.l"
1158 {
1159     ECOUNT;
1160     return JOIN;
1161 }
1162     YY_BREAK
1163 case 23:
1164 YY_RULE_SETUP
1165 #line 212 "KDbSqlScanner.l"
1166 {
1167     ECOUNT;
1168     return LEFT;
1169 }
1170     YY_BREAK
1171 case 24:
1172 YY_RULE_SETUP
1173 #line 217 "KDbSqlScanner.l"
1174 {
1175     ECOUNT;
1176     return LIKE;
1177 }
1178     YY_BREAK
1179 case 25:
1180 /* rule 25 can match eol */
1181 YY_RULE_SETUP
1182 #line 222 "KDbSqlScanner.l"
1183 {
1184     ECOUNT;
1185     return NOT_LIKE;
1186 }
1187     YY_BREAK
1188 case 26:
1189 YY_RULE_SETUP
1190 #line 227 "KDbSqlScanner.l"
1191 {
1192     ECOUNT;
1193     return BETWEEN;
1194 }
1195     YY_BREAK
1196 case 27:
1197 /* rule 27 can match eol */
1198 YY_RULE_SETUP
1199 #line 232 "KDbSqlScanner.l"
1200 {
1201     ECOUNT;
1202     return NOT_BETWEEN;
1203 }
1204     YY_BREAK
1205 case 28:
1206 /* rule 28 can match eol */
1207 YY_RULE_SETUP
1208 #line 237 "KDbSqlScanner.l"
1209 {
1210     ECOUNT;
1211     return NOT_SIMILAR_TO;
1212 }
1213     YY_BREAK
1214 case 29:
1215 /* rule 29 can match eol */
1216 YY_RULE_SETUP
1217 #line 242 "KDbSqlScanner.l"
1218 {
1219     ECOUNT;
1220     return SIMILAR_TO;
1221 }
1222     YY_BREAK
1223 case 30:
1224 /* rule 30 can match eol */
1225 YY_RULE_SETUP
1226 #line 247 "KDbSqlScanner.l"
1227 {
1228     ECOUNT;
1229     return SQL_IS_NOT_NULL;
1230 }
1231     YY_BREAK
1232 case 31:
1233 /* rule 31 can match eol */
1234 YY_RULE_SETUP
1235 #line 252 "KDbSqlScanner.l"
1236 {
1237     ECOUNT;
1238     return SQL_IS_NULL;
1239 }
1240     YY_BREAK
1241 case 32:
1242 YY_RULE_SETUP
1243 #line 257 "KDbSqlScanner.l"
1244 {
1245     ECOUNT;
1246     return NOT;
1247 }
1248     YY_BREAK
1249 case 33:
1250 YY_RULE_SETUP
1251 #line 262 "KDbSqlScanner.l"
1252 {
1253     ECOUNT;
1254     return SQL_IS;
1255 }
1256     YY_BREAK
1257 case 34:
1258 YY_RULE_SETUP
1259 #line 267 "KDbSqlScanner.l"
1260 {
1261     ECOUNT;
1262     return SQL_NULL;
1263 }
1264     YY_BREAK
1265 case 35:
1266 YY_RULE_SETUP
1267 #line 272 "KDbSqlScanner.l"
1268 {
1269         ECOUNT;
1270         return SQL_TRUE;
1271 }
1272     YY_BREAK
1273 case 36:
1274 YY_RULE_SETUP
1275 #line 277 "KDbSqlScanner.l"
1276 {
1277         ECOUNT;
1278         return SQL_FALSE;
1279 }
1280     YY_BREAK
1281 case 37:
1282 YY_RULE_SETUP
1283 #line 282 "KDbSqlScanner.l"
1284 {
1285     ECOUNT;
1286     return SQL_ON;
1287 }
1288     YY_BREAK
1289 case 38:
1290 YY_RULE_SETUP
1291 #line 287 "KDbSqlScanner.l"
1292 {
1293     ECOUNT;
1294     return OR;
1295 }
1296     YY_BREAK
1297 case 39:
1298 YY_RULE_SETUP
1299 #line 292 "KDbSqlScanner.l"
1300 { /* also means OR for numbers (mysql) */
1301     ECOUNT;
1302     return CONCATENATION;
1303 }
1304     YY_BREAK
1305 case 40:
1306 YY_RULE_SETUP
1307 #line 297 "KDbSqlScanner.l"
1308 {
1309     ECOUNT;
1310     return BITWISE_SHIFT_LEFT;
1311 }
1312     YY_BREAK
1313 case 41:
1314 YY_RULE_SETUP
1315 #line 302 "KDbSqlScanner.l"
1316 {
1317     ECOUNT;
1318     return BITWISE_SHIFT_RIGHT;
1319 }
1320     YY_BREAK
1321 case 42:
1322 YY_RULE_SETUP
1323 #line 307 "KDbSqlScanner.l"
1324 {
1325     ECOUNT;
1326     return XOR;
1327 }
1328     YY_BREAK
1329 case 43:
1330 YY_RULE_SETUP
1331 #line 312 "KDbSqlScanner.l"
1332 {
1333     ECOUNT;
1334     return RIGHT;
1335 }
1336     YY_BREAK
1337 case 44:
1338 YY_RULE_SETUP
1339 #line 317 "KDbSqlScanner.l"
1340 {
1341     ECOUNT;
1342     return SELECT;
1343 }
1344     YY_BREAK
1345 case 45:
1346 YY_RULE_SETUP
1347 #line 322 "KDbSqlScanner.l"
1348 {
1349     ECOUNT;
1350     return TABLE;
1351 }
1352     YY_BREAK
1353 case 46:
1354 YY_RULE_SETUP
1355 #line 327 "KDbSqlScanner.l"
1356 {
1357     ECOUNT;
1358     return WHERE;
1359 }
1360     YY_BREAK
1361 case 47:
1362 YY_RULE_SETUP
1363 #line 332 "KDbSqlScanner.l"
1364 {
1365     ECOUNT;
1366     return ORDER;
1367 }
1368     YY_BREAK
1369 case 48:
1370 YY_RULE_SETUP
1371 #line 337 "KDbSqlScanner.l"
1372 {
1373     ECOUNT;
1374     return BY;
1375 }
1376     YY_BREAK
1377 case 49:
1378 YY_RULE_SETUP
1379 #line 342 "KDbSqlScanner.l"
1380 {
1381     ECOUNT;
1382     return ASC;
1383 }
1384     YY_BREAK
1385 case 50:
1386 YY_RULE_SETUP
1387 #line 347 "KDbSqlScanner.l"
1388 {
1389     ECOUNT;
1390     return DESC;
1391 }
1392     YY_BREAK
1393 case 51:
1394 /* rule 51 can match eol */
1395 YY_RULE_SETUP
1396 #line 352 "KDbSqlScanner.l"
1397 {
1398     ECOUNT;
1399     sqlParserDebug() << "{string} yytext: '" << yytext << "' (" << yyleng << ")";
1400     int errorPosition;
1401     const QString unescaped(
1402         KDb::unescapeString(QString::fromUtf8(yytext+1, yyleng-2), yytext[0], &errorPosition));
1403     if (errorPosition >= 0) { // sanity check
1404         setError(KDbParser::tr("Invalid string"),
1405                  KDbParser::tr("Invalid character in string"));
1406         return SCAN_ERROR;
1407     }
1408     yylval.stringValue = new QString(unescaped);
1409     return CHARACTER_STRING_LITERAL;
1410 
1411 /* "ZZZ" sentinel for script */
1412 }
1413     YY_BREAK
1414 case 52:
1415 YY_RULE_SETUP
1416 #line 369 "KDbSqlScanner.l"
1417 {
1418     sqlParserDebug() << "{identifier} yytext: '" << yytext << "' (" << yyleng << ")";
1419     ECOUNT;
1420     if (yytext[0]>='0' && yytext[0]<='9') {
1421         setError(KDbParser::tr("Invalid identifier"),
1422                  KDbParser::tr("Identifiers should start with a letter or '_' character"));
1423         return SCAN_ERROR;
1424     }
1425     yylval.stringValue = new QString(QString::fromUtf8(yytext, yyleng));
1426     return IDENTIFIER;
1427 }
1428     YY_BREAK
1429 case 53:
1430 /* rule 53 can match eol */
1431 YY_RULE_SETUP
1432 #line 381 "KDbSqlScanner.l"
1433 {
1434     sqlParserDebug() << "{query_parameter} yytext: '" << yytext << "' (" << yyleng << ")";
1435     ECOUNT;
1436     yylval.stringValue = new QString(QString::fromUtf8(yytext+1, yyleng-2));
1437     return QUERY_PARAMETER;
1438 }
1439     YY_BREAK
1440 case 54:
1441 /* rule 54 can match eol */
1442 YY_RULE_SETUP
1443 #line 388 "KDbSqlScanner.l"
1444 {
1445     ECOUNT;
1446 }
1447     YY_BREAK
1448 case 55:
1449 YY_RULE_SETUP
1450 #line 392 "KDbSqlScanner.l"
1451 {
1452     sqlParserDebug() << "char: '" << yytext[0] << "'";
1453     ECOUNT;
1454     return yytext[0];
1455 }
1456     YY_BREAK
1457 case 56:
1458 YY_RULE_SETUP
1459 #line 398 "KDbSqlScanner.l"
1460 { // fallback rule to avoid flex's default action that prints the character to stdout
1461     // without notifying the scanner.
1462     ECOUNT;
1463     const QString string(QString::fromUtf8(yytext, yyleng));
1464     setError(KDbParser::tr("Unexpected character %1").arg(maybeQuote(string)));
1465     return SCAN_ERROR;
1466 }
1467     YY_BREAK
1468 case 57:
1469 YY_RULE_SETUP
1470 #line 406 "KDbSqlScanner.l"
1471 ECHO;
1472     YY_BREAK
1473 #line 1474 "generated/sqlscanner.cpp"
1474 case YY_STATE_EOF(INITIAL):
1475 case YY_STATE_EOF(DATE_OR_TIME):
1476     yyterminate();
1477 
1478     case YY_END_OF_BUFFER:
1479         {
1480         /* Amount of text matched not including the EOB char. */
1481         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1482 
1483         /* Undo the effects of YY_DO_BEFORE_ACTION. */
1484         *yy_cp = (yy_hold_char);
1485         YY_RESTORE_YY_MORE_OFFSET
1486 
1487         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1488             {
1489             /* We're scanning a new file or input source.  It's
1490              * possible that this happened because the user
1491              * just pointed yyin at a new source and called
1492              * yylex().  If so, then we have to assure
1493              * consistency between YY_CURRENT_BUFFER and our
1494              * globals.  Here is the right place to do so, because
1495              * this is the first action (other than possibly a
1496              * back-up) that will match for the new input source.
1497              */
1498             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1499             YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1500             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1501             }
1502 
1503         /* Note that here we test for yy_c_buf_p "<=" to the position
1504          * of the first EOB in the buffer, since yy_c_buf_p will
1505          * already have been incremented past the NUL character
1506          * (since all states make transitions on EOB to the
1507          * end-of-buffer state).  Contrast this with the test
1508          * in input().
1509          */
1510         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1511             { /* This was really a NUL. */
1512             yy_state_type yy_next_state;
1513 
1514             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1515 
1516             yy_current_state = yy_get_previous_state(  );
1517 
1518             /* Okay, we're now positioned to make the NUL
1519              * transition.  We couldn't have
1520              * yy_get_previous_state() go ahead and do it
1521              * for us because it doesn't know how to deal
1522              * with the possibility of jamming (and we don't
1523              * want to build jamming into it because then it
1524              * will run more slowly).
1525              */
1526 
1527             yy_next_state = yy_try_NUL_trans( yy_current_state );
1528 
1529             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1530 
1531             if ( yy_next_state )
1532                 {
1533                 /* Consume the NUL. */
1534                 yy_cp = ++(yy_c_buf_p);
1535                 yy_current_state = yy_next_state;
1536                 goto yy_match;
1537                 }
1538 
1539             else
1540                 {
1541                 yy_cp = (yy_last_accepting_cpos);
1542                 yy_current_state = (yy_last_accepting_state);
1543                 goto yy_find_action;
1544                 }
1545             }
1546 
1547         else switch ( yy_get_next_buffer(  ) )
1548             {
1549             case EOB_ACT_END_OF_FILE:
1550                 {
1551                 (yy_did_buffer_switch_on_eof) = 0;
1552 
1553                 if ( yywrap( ) )
1554                     {
1555                     /* Note: because we've taken care in
1556                      * yy_get_next_buffer() to have set up
1557                      * yytext, we can now set up
1558                      * yy_c_buf_p so that if some total
1559                      * hoser (like flex itself) wants to
1560                      * call the scanner after we return the
1561                      * YY_NULL, it'll still work - another
1562                      * YY_NULL will get returned.
1563                      */
1564                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1565 
1566                     yy_act = YY_STATE_EOF(YY_START);
1567                     goto do_action;
1568                     }
1569 
1570                 else
1571                     {
1572                     if ( ! (yy_did_buffer_switch_on_eof) )
1573                         YY_NEW_FILE;
1574                     }
1575                 break;
1576                 }
1577 
1578             case EOB_ACT_CONTINUE_SCAN:
1579                 (yy_c_buf_p) =
1580                     (yytext_ptr) + yy_amount_of_matched_text;
1581 
1582                 yy_current_state = yy_get_previous_state(  );
1583 
1584                 yy_cp = (yy_c_buf_p);
1585                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1586                 goto yy_match;
1587 
1588             case EOB_ACT_LAST_MATCH:
1589                 (yy_c_buf_p) =
1590                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1591 
1592                 yy_current_state = yy_get_previous_state(  );
1593 
1594                 yy_cp = (yy_c_buf_p);
1595                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1596                 goto yy_find_action;
1597             }
1598         break;
1599         }
1600 
1601     default:
1602         YY_FATAL_ERROR(
1603             "fatal flex scanner internal error--no action found" );
1604     } /* end of action switch */
1605         } /* end of scanning one token */
1606 } /* end of yylex */
1607 
1608 /* yy_get_next_buffer - try to read in a new buffer
1609  *
1610  * Returns a code representing an action:
1611  *  EOB_ACT_LAST_MATCH -
1612  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1613  *  EOB_ACT_END_OF_FILE - end of file
1614  */
1615 static int yy_get_next_buffer (void)
1616 {
1617         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1618     register char *source = (yytext_ptr);
1619     register int number_to_move, i;
1620     int ret_val;
1621 
1622     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1623         YY_FATAL_ERROR(
1624         "fatal flex scanner internal error--end of buffer missed" );
1625 
1626     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1627         { /* Don't try to fill the buffer, so this is an EOF. */
1628         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1629             {
1630             /* We matched a single character, the EOB, so
1631              * treat this as a final EOF.
1632              */
1633             return EOB_ACT_END_OF_FILE;
1634             }
1635 
1636         else
1637             {
1638             /* We matched some text prior to the EOB, first
1639              * process it.
1640              */
1641             return EOB_ACT_LAST_MATCH;
1642             }
1643         }
1644 
1645     /* Try to read more data. */
1646 
1647     /* First move last chars to start of buffer. */
1648     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1649 
1650     for ( i = 0; i < number_to_move; ++i )
1651         *(dest++) = *(source++);
1652 
1653     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1654         /* don't do the read, it's not guaranteed to return an EOF,
1655          * just force an EOF
1656          */
1657         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1658 
1659     else
1660         {
1661             int num_to_read =
1662             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1663 
1664         while ( num_to_read <= 0 )
1665             { /* Not enough room in the buffer - grow it. */
1666 
1667             /* just a shorter name for the current buffer */
1668             YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1669 
1670             int yy_c_buf_p_offset =
1671                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1672 
1673             if ( b->yy_is_our_buffer )
1674                 {
1675                 yy_size_t new_size = b->yy_buf_size * 2;
1676 
1677                 if ( new_size <= 0 )
1678                     b->yy_buf_size += b->yy_buf_size / 8;
1679                 else
1680                     b->yy_buf_size *= 2;
1681 
1682                 b->yy_ch_buf = (char *)
1683                     /* Include room in for 2 EOB chars. */
1684                     yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1685                 }
1686             else
1687                 /* Can't grow it, we don't own it. */
1688                 b->yy_ch_buf = 0;
1689 
1690             if ( ! b->yy_ch_buf )
1691                 YY_FATAL_ERROR(
1692                 "fatal error - scanner input buffer overflow" );
1693 
1694             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1695 
1696             num_to_read = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1697                         number_to_move - 1;
1698 
1699             }
1700 
1701         if ( num_to_read > YY_READ_BUF_SIZE )
1702             num_to_read = YY_READ_BUF_SIZE;
1703 
1704         /* Read in more data. */
1705         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1706             (yy_n_chars), num_to_read );
1707 
1708         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1709         }
1710 
1711     if ( (yy_n_chars) == 0 )
1712         {
1713         if ( number_to_move == YY_MORE_ADJ )
1714             {
1715             ret_val = EOB_ACT_END_OF_FILE;
1716             yyrestart(yyin  );
1717             }
1718 
1719         else
1720             {
1721             ret_val = EOB_ACT_LAST_MATCH;
1722             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1723                 YY_BUFFER_EOF_PENDING;
1724             }
1725         }
1726 
1727     else
1728         ret_val = EOB_ACT_CONTINUE_SCAN;
1729 
1730     if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1731         /* Extend the array by 50%, plus the number we really need. */
1732         int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1733         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1734         if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1735             YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1736     }
1737 
1738     (yy_n_chars) += number_to_move;
1739     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1740     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1741 
1742     (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1743 
1744     return ret_val;
1745 }
1746 
1747 /* yy_get_previous_state - get the state just before the EOB char was reached */
1748 
1749     static yy_state_type yy_get_previous_state (void)
1750 {
1751     register yy_state_type yy_current_state;
1752     register char *yy_cp;
1753 
1754     yy_current_state = (yy_start);
1755 
1756     for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1757         {
1758         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1759         if ( yy_accept[yy_current_state] )
1760             {
1761             (yy_last_accepting_state) = yy_current_state;
1762             (yy_last_accepting_cpos) = yy_cp;
1763             }
1764         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1765             {
1766             yy_current_state = (int) yy_def[yy_current_state];
1767             if ( yy_current_state >= 195 )
1768                 yy_c = yy_meta[(unsigned int) yy_c];
1769             }
1770         yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1771         }
1772 
1773     return yy_current_state;
1774 }
1775 
1776 /* yy_try_NUL_trans - try to make a transition on the NUL character
1777  *
1778  * synopsis
1779  *  next_state = yy_try_NUL_trans( current_state );
1780  */
1781     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1782 {
1783     register int yy_is_jam;
1784         register char *yy_cp = (yy_c_buf_p);
1785 
1786     register YY_CHAR yy_c = 1;
1787     if ( yy_accept[yy_current_state] )
1788         {
1789         (yy_last_accepting_state) = yy_current_state;
1790         (yy_last_accepting_cpos) = yy_cp;
1791         }
1792     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1793         {
1794         yy_current_state = (int) yy_def[yy_current_state];
1795         if ( yy_current_state >= 195 )
1796             yy_c = yy_meta[(unsigned int) yy_c];
1797         }
1798     yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1799     yy_is_jam = (yy_current_state == 194);
1800 
1801         return yy_is_jam ? 0 : yy_current_state;
1802 }
1803 
1804     static void yyunput (int c, register char * yy_bp )
1805 {
1806     register char *yy_cp;
1807 
1808     yy_cp = (yy_c_buf_p);
1809 
1810     /* undo effects of setting up yytext */
1811     *yy_cp = (yy_hold_char);
1812 
1813     if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1814         { /* need to shift things up to make room */
1815         /* +2 for EOB chars. */
1816         register int number_to_move = (yy_n_chars) + 2;
1817         register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1818                     YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1819         register char *source =
1820                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1821 
1822         while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1823             *--dest = *--source;
1824 
1825         yy_cp += (int) (dest - source);
1826         yy_bp += (int) (dest - source);
1827         YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1828             (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1829 
1830         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1831             YY_FATAL_ERROR( "flex scanner push-back overflow" );
1832         }
1833 
1834     *--yy_cp = (char) c;
1835 
1836     (yytext_ptr) = yy_bp;
1837     (yy_hold_char) = *yy_cp;
1838     (yy_c_buf_p) = yy_cp;
1839 }
1840 
1841 #ifndef YY_NO_INPUT
1842 #ifdef __cplusplus
1843     static int yyinput (void)
1844 #else
1845     static int input  (void)
1846 #endif
1847 
1848 {
1849     int c;
1850 
1851     *(yy_c_buf_p) = (yy_hold_char);
1852 
1853     if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1854         {
1855         /* yy_c_buf_p now points to the character we want to return.
1856          * If this occurs *before* the EOB characters, then it's a
1857          * valid NUL; if not, then we've hit the end of the buffer.
1858          */
1859         if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1860             /* This was really a NUL. */
1861             *(yy_c_buf_p) = '\0';
1862 
1863         else
1864             { /* need more input */
1865             yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1866             ++(yy_c_buf_p);
1867 
1868             switch ( yy_get_next_buffer(  ) )
1869                 {
1870                 case EOB_ACT_LAST_MATCH:
1871                     /* This happens because yy_g_n_b()
1872                      * sees that we've accumulated a
1873                      * token and flags that we need to
1874                      * try matching the token before
1875                      * proceeding.  But for input(),
1876                      * there's no matching to consider.
1877                      * So convert the EOB_ACT_LAST_MATCH
1878                      * to EOB_ACT_END_OF_FILE.
1879                      */
1880 
1881                     /* Reset buffer status. */
1882                     yyrestart(yyin );
1883 
1884                     /*FALLTHROUGH*/
1885 
1886                 case EOB_ACT_END_OF_FILE:
1887                     {
1888                     if ( yywrap( ) )
1889                         return EOF;
1890 
1891                     if ( ! (yy_did_buffer_switch_on_eof) )
1892                         YY_NEW_FILE;
1893 #ifdef __cplusplus
1894                     return yyinput();
1895 #else
1896                     return input();
1897 #endif
1898                     }
1899 
1900                 case EOB_ACT_CONTINUE_SCAN:
1901                     (yy_c_buf_p) = (yytext_ptr) + offset;
1902                     break;
1903                 }
1904             }
1905         }
1906 
1907     c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
1908     *(yy_c_buf_p) = '\0';   /* preserve yytext */
1909     (yy_hold_char) = *++(yy_c_buf_p);
1910 
1911     return c;
1912 }
1913 #endif  /* ifndef YY_NO_INPUT */
1914 
1915 /** Immediately switch to a different input stream.
1916  * @param input_file A readable stream.
1917  *
1918  * @note This function does not reset the start condition to @c INITIAL .
1919  */
1920     void yyrestart  (FILE * input_file )
1921 {
1922 
1923     if ( ! YY_CURRENT_BUFFER ){
1924         yyensure_buffer_stack ();
1925         YY_CURRENT_BUFFER_LVALUE =
1926             yy_create_buffer(yyin,YY_BUF_SIZE );
1927     }
1928 
1929     yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1930     yy_load_buffer_state( );
1931 }
1932 
1933 /** Switch to a different input buffer.
1934  * @param new_buffer The new input buffer.
1935  *
1936  */
1937     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1938 {
1939 
1940     /* TODO. We should be able to replace this entire function body
1941      * with
1942      *      yypop_buffer_state();
1943      *      yypush_buffer_state(new_buffer);
1944      */
1945     yyensure_buffer_stack ();
1946     if ( YY_CURRENT_BUFFER == new_buffer )
1947         return;
1948 
1949     if ( YY_CURRENT_BUFFER )
1950         {
1951         /* Flush out information for old buffer. */
1952         *(yy_c_buf_p) = (yy_hold_char);
1953         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1954         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1955         }
1956 
1957     YY_CURRENT_BUFFER_LVALUE = new_buffer;
1958     yy_load_buffer_state( );
1959 
1960     /* We don't actually know whether we did this switch during
1961      * EOF (yywrap()) processing, but the only time this flag
1962      * is looked at is after yywrap() is called, so it's safe
1963      * to go ahead and always set it.
1964      */
1965     (yy_did_buffer_switch_on_eof) = 1;
1966 }
1967 
1968 static void yy_load_buffer_state  (void)
1969 {
1970         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1971     (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1972     yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1973     (yy_hold_char) = *(yy_c_buf_p);
1974 }
1975 
1976 /** Allocate and initialize an input buffer state.
1977  * @param file A readable stream.
1978  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1979  *
1980  * @return the allocated buffer state.
1981  */
1982     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1983 {
1984     YY_BUFFER_STATE b;
1985 
1986     b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1987     if ( ! b )
1988         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1989 
1990     b->yy_buf_size = size;
1991 
1992     /* yy_ch_buf has to be 2 characters longer than the size given because
1993      * we need to put in 2 end-of-buffer characters.
1994      */
1995     b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
1996     if ( ! b->yy_ch_buf )
1997         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1998 
1999     b->yy_is_our_buffer = 1;
2000 
2001     yy_init_buffer(b,file );
2002 
2003     return b;
2004 }
2005 
2006 /** Destroy the buffer.
2007  * @param b a buffer created with yy_create_buffer()
2008  *
2009  */
2010     void yy_delete_buffer (YY_BUFFER_STATE  b )
2011 {
2012 
2013     if ( ! b )
2014         return;
2015 
2016     if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2017         YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2018 
2019     if ( b->yy_is_our_buffer )
2020         yyfree((void *) b->yy_ch_buf  );
2021 
2022     yyfree((void *) b  );
2023 }
2024 
2025 /* Initializes or reinitializes a buffer.
2026  * This function is sometimes called more than once on the same buffer,
2027  * such as during a yyrestart() or at EOF.
2028  */
2029     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
2030 
2031 {
2032     int oerrno = errno;
2033 
2034     yy_flush_buffer(b );
2035 
2036     b->yy_input_file = file;
2037     b->yy_fill_buffer = 1;
2038 
2039     /* If b is the current buffer, then yy_init_buffer was _probably_
2040      * called from yyrestart() or through yy_get_next_buffer.
2041      * In that case, we don't want to reset the lineno or column.
2042      */
2043     if (b != YY_CURRENT_BUFFER){
2044         b->yy_bs_lineno = 1;
2045         b->yy_bs_column = 0;
2046     }
2047 
2048         b->yy_is_interactive = 0;
2049 
2050     errno = oerrno;
2051 }
2052 
2053 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2054  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2055  *
2056  */
2057     void yy_flush_buffer (YY_BUFFER_STATE  b )
2058 {
2059         if ( ! b )
2060         return;
2061 
2062     b->yy_n_chars = 0;
2063 
2064     /* We always need two end-of-buffer characters.  The first causes
2065      * a transition to the end-of-buffer state.  The second causes
2066      * a jam in that state.
2067      */
2068     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2069     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2070 
2071     b->yy_buf_pos = &b->yy_ch_buf[0];
2072 
2073     b->yy_at_bol = 1;
2074     b->yy_buffer_status = YY_BUFFER_NEW;
2075 
2076     if ( b == YY_CURRENT_BUFFER )
2077         yy_load_buffer_state( );
2078 }
2079 
2080 /** Pushes the new state onto the stack. The new state becomes
2081  *  the current state. This function will allocate the stack
2082  *  if necessary.
2083  *  @param new_buffer The new state.
2084  *
2085  */
2086 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
2087 {
2088         if (new_buffer == NULL)
2089         return;
2090 
2091     yyensure_buffer_stack();
2092 
2093     /* This block is copied from yy_switch_to_buffer. */
2094     if ( YY_CURRENT_BUFFER )
2095         {
2096         /* Flush out information for old buffer. */
2097         *(yy_c_buf_p) = (yy_hold_char);
2098         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2099         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2100         }
2101 
2102     /* Only push if top exists. Otherwise, replace top. */
2103     if (YY_CURRENT_BUFFER)
2104         (yy_buffer_stack_top)++;
2105     YY_CURRENT_BUFFER_LVALUE = new_buffer;
2106 
2107     /* copied from yy_switch_to_buffer. */
2108     yy_load_buffer_state( );
2109     (yy_did_buffer_switch_on_eof) = 1;
2110 }
2111 
2112 /** Removes and deletes the top of the stack, if present.
2113  *  The next element becomes the new top.
2114  *
2115  */
2116 void yypop_buffer_state (void)
2117 {
2118         if (!YY_CURRENT_BUFFER)
2119         return;
2120 
2121     yy_delete_buffer(YY_CURRENT_BUFFER );
2122     YY_CURRENT_BUFFER_LVALUE = NULL;
2123     if ((yy_buffer_stack_top) > 0)
2124         --(yy_buffer_stack_top);
2125 
2126     if (YY_CURRENT_BUFFER) {
2127         yy_load_buffer_state( );
2128         (yy_did_buffer_switch_on_eof) = 1;
2129     }
2130 }
2131 
2132 /* Allocates the stack if it does not exist.
2133  *  Guarantees space for at least one push.
2134  */
2135 static void yyensure_buffer_stack (void)
2136 {
2137     yy_size_t num_to_alloc;
2138 
2139     if (!(yy_buffer_stack)) {
2140 
2141         /* First allocation is just for 2 elements, since we don't know if this
2142          * scanner will even need a stack. We use 2 instead of 1 to avoid an
2143          * immediate realloc on the next call.
2144          */
2145         num_to_alloc = 1;
2146         (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2147                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
2148                                 );
2149         if ( ! (yy_buffer_stack) )
2150             YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2151 
2152         memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2153 
2154         (yy_buffer_stack_max) = num_to_alloc;
2155         (yy_buffer_stack_top) = 0;
2156         return;
2157     }
2158 
2159     if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2160 
2161         /* Increase the buffer to prepare for a possible push. */
2162         int grow_size = 8 /* arbitrary grow size */;
2163 
2164         num_to_alloc = (yy_buffer_stack_max) + grow_size;
2165         (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2166                                 ((yy_buffer_stack),
2167                                 num_to_alloc * sizeof(struct yy_buffer_state*)
2168                                 );
2169         if ( ! (yy_buffer_stack) )
2170             YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2171 
2172         /* zero only the new slots.*/
2173         memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2174         (yy_buffer_stack_max) = num_to_alloc;
2175     }
2176 }
2177 
2178 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2179  * @param base the character buffer
2180  * @param size the size in bytes of the character buffer
2181  *
2182  * @return the newly allocated buffer state object.
2183  */
2184 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
2185 {
2186     YY_BUFFER_STATE b;
2187 
2188     if ( size < 2 ||
2189          base[size-2] != YY_END_OF_BUFFER_CHAR ||
2190          base[size-1] != YY_END_OF_BUFFER_CHAR )
2191         /* They forgot to leave room for the EOB's. */
2192         return 0;
2193 
2194     b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
2195     if ( ! b )
2196         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2197 
2198     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
2199     b->yy_buf_pos = b->yy_ch_buf = base;
2200     b->yy_is_our_buffer = 0;
2201     b->yy_input_file = 0;
2202     b->yy_n_chars = b->yy_buf_size;
2203     b->yy_is_interactive = 0;
2204     b->yy_at_bol = 1;
2205     b->yy_fill_buffer = 0;
2206     b->yy_buffer_status = YY_BUFFER_NEW;
2207 
2208     yy_switch_to_buffer(b  );
2209 
2210     return b;
2211 }
2212 
2213 /** Setup the input buffer state to scan a string. The next call to yylex() will
2214  * scan from a @e copy of @a str.
2215  * @param yystr a NUL-terminated string to scan
2216  *
2217  * @return the newly allocated buffer state object.
2218  * @note If you want to scan bytes that may contain NUL values, then use
2219  *       yy_scan_bytes() instead.
2220  */
2221 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
2222 {
2223 
2224     return yy_scan_bytes(yystr,(int) strlen(yystr) );
2225 }
2226 
2227 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2228  * scan from a @e copy of @a bytes.
2229  * @param yybytes the byte buffer to scan
2230  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2231  *
2232  * @return the newly allocated buffer state object.
2233  */
2234 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
2235 {
2236     YY_BUFFER_STATE b;
2237     char *buf;
2238     yy_size_t n;
2239     int i;
2240 
2241     /* Get memory for full buffer, including space for trailing EOB's. */
2242     n = (yy_size_t) _yybytes_len + 2;
2243     buf = (char *) yyalloc(n  );
2244     if ( ! buf )
2245         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2246 
2247     for ( i = 0; i < _yybytes_len; ++i )
2248         buf[i] = yybytes[i];
2249 
2250     buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2251 
2252     b = yy_scan_buffer(buf,n );
2253     if ( ! b )
2254         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2255 
2256     /* It's okay to grow etc. this buffer, and we should throw it
2257      * away when we're done.
2258      */
2259     b->yy_is_our_buffer = 1;
2260 
2261     return b;
2262 }
2263 
2264 #ifndef YY_EXIT_FAILURE
2265 #define YY_EXIT_FAILURE 2
2266 #endif
2267 
2268 static void yy_fatal_error (yyconst char* msg )
2269 {
2270         (void) fprintf( stderr, "%s\n", msg );
2271     exit( YY_EXIT_FAILURE );
2272 }
2273 
2274 /* Redefine yyless() so it works in section 3 code. */
2275 
2276 #undef yyless
2277 #define yyless(n) \
2278     do \
2279         { \
2280         /* Undo effects of setting up yytext. */ \
2281         int yyless_macro_arg = (n); \
2282         YY_LESS_LINENO(yyless_macro_arg);\
2283         yytext[yyleng] = (yy_hold_char); \
2284         (yy_c_buf_p) = yytext + yyless_macro_arg; \
2285         (yy_hold_char) = *(yy_c_buf_p); \
2286         *(yy_c_buf_p) = '\0'; \
2287         yyleng = yyless_macro_arg; \
2288         } \
2289     while ( 0 )
2290 
2291 /* Accessor  methods (get/set functions) to struct members. */
2292 
2293 /** Get the current line number.
2294  *
2295  */
2296 int yyget_lineno  (void)
2297 {
2298 
2299     return yylineno;
2300 }
2301 
2302 /** Get the input stream.
2303  *
2304  */
2305 FILE *yyget_in  (void)
2306 {
2307         return yyin;
2308 }
2309 
2310 /** Get the output stream.
2311  *
2312  */
2313 FILE *yyget_out  (void)
2314 {
2315         return yyout;
2316 }
2317 
2318 /** Get the length of the current token.
2319  *
2320  */
2321 yy_size_t yyget_leng  (void)
2322 {
2323         return yyleng;
2324 }
2325 
2326 /** Get the current token.
2327  *
2328  */
2329 
2330 char *yyget_text  (void)
2331 {
2332         return yytext;
2333 }
2334 
2335 /** Set the current line number.
2336  * @param line_number
2337  *
2338  */
2339 void yyset_lineno (int  line_number )
2340 {
2341 
2342     yylineno = line_number;
2343 }
2344 
2345 /** Set the input stream. This does not discard the current
2346  * input buffer.
2347  * @param in_str A readable stream.
2348  *
2349  * @see yy_switch_to_buffer
2350  */
2351 void yyset_in (FILE *  in_str )
2352 {
2353         yyin = in_str ;
2354 }
2355 
2356 void yyset_out (FILE *  out_str )
2357 {
2358         yyout = out_str ;
2359 }
2360 
2361 int yyget_debug  (void)
2362 {
2363         return yy_flex_debug;
2364 }
2365 
2366 void yyset_debug (int  bdebug )
2367 {
2368         yy_flex_debug = bdebug ;
2369 }
2370 
2371 static int yy_init_globals (void)
2372 {
2373         /* Initialization is the same as for the non-reentrant scanner.
2374      * This function is called from yylex_destroy(), so don't allocate here.
2375      */
2376 
2377     (yy_buffer_stack) = 0;
2378     (yy_buffer_stack_top) = 0;
2379     (yy_buffer_stack_max) = 0;
2380     (yy_c_buf_p) = (char *) 0;
2381     (yy_init) = 0;
2382     (yy_start) = 0;
2383 
2384 /* Defined in main.c */
2385 #ifdef YY_STDINIT
2386     yyin = stdin;
2387     yyout = stdout;
2388 #else
2389     yyin = (FILE *) 0;
2390     yyout = (FILE *) 0;
2391 #endif
2392 
2393     /* For future reference: Set errno on error, since we are called by
2394      * yylex_init()
2395      */
2396     return 0;
2397 }
2398 
2399 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2400 int yylex_destroy  (void)
2401 {
2402 
2403     /* Pop the buffer stack, destroying each element. */
2404     while(YY_CURRENT_BUFFER){
2405         yy_delete_buffer(YY_CURRENT_BUFFER  );
2406         YY_CURRENT_BUFFER_LVALUE = NULL;
2407         yypop_buffer_state();
2408     }
2409 
2410     /* Destroy the stack itself. */
2411     yyfree((yy_buffer_stack) );
2412     (yy_buffer_stack) = NULL;
2413 
2414     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2415      * yylex() is called, initialization will occur. */
2416     yy_init_globals( );
2417 
2418     return 0;
2419 }
2420 
2421 /*
2422  * Internal utility routines.
2423  */
2424 
2425 #ifndef yytext_ptr
2426 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2427 {
2428     register int i;
2429     for ( i = 0; i < n; ++i )
2430         s1[i] = s2[i];
2431 }
2432 #endif
2433 
2434 #ifdef YY_NEED_STRLEN
2435 static int yy_flex_strlen (yyconst char * s )
2436 {
2437     register int n;
2438     for ( n = 0; s[n]; ++n )
2439         ;
2440 
2441     return n;
2442 }
2443 #endif
2444 
2445 void *yyalloc (yy_size_t  size )
2446 {
2447     return (void *) malloc( size );
2448 }
2449 
2450 void *yyrealloc  (void * ptr, yy_size_t  size )
2451 {
2452     /* The cast to (char *) in the following accommodates both
2453      * implementations that use char* generic pointers, and those
2454      * that use void* generic pointers.  It works with the latter
2455      * because both ANSI C and C++ allow castless assignment from
2456      * any pointer type to void*, and deal with argument conversions
2457      * as though doing an assignment.
2458      */
2459     return (void *) realloc( (char *) ptr, size );
2460 }
2461 
2462 void yyfree (void * ptr )
2463 {
2464     free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
2465 }
2466 
2467 #define YYTABLES_NAME "yytables"
2468 
2469 #line 406 "KDbSqlScanner.l"
2470 
2471 
2472 
2473 void tokenize(const char *data)
2474 {
2475     yy_switch_to_buffer(yy_scan_string(data));
2476     globalToken.clear();
2477     globalCurrentPos = 0;
2478 }
2479 
2480