KDb

sqlscanner.cpp
1 #line 2 "generated/sqlscanner.cpp"
2 
3 #line 4 "generated/sqlscanner.cpp"
4 
5 #define YY_INT_ALIGNED short int
6 
7 /* A lexical scanner generated by flex */
8 
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 37
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16 
17 /* First, we deal with platform-specific or compiler-specific issues. */
18 
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
24 
25 /* end standard C headers. */
26 
27 /* flex integer type definitions */
28 
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
31 
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37  * if you want the limit (max/min) macros for int types.
38  */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
42 
43 #include <inttypes.h>
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
50 #else
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
57 
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX (4294967295U)
85 #endif
86 
87 #endif /* ! C99 */
88 
89 #endif /* ! FLEXINT_H */
90 
91 #ifdef __cplusplus
92 
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
95 
96 #else /* ! __cplusplus */
97 
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
100 
101 #define YY_USE_CONST
102 
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
105 
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
111 
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
114 
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116  * integer for use as an array index. If the signed char is negative,
117  * we want to instead treat it as an 8-bit unsigned char, hence the
118  * double cast.
119  */
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 
122 /* Enter a start condition. This macro really ought to take a parameter,
123  * but we do it the disgusting crufty way forced on us by the ()-less
124  * definition of BEGIN.
125  */
126 #define BEGIN (yy_start) = 1 + 2 *
127 
128 /* Translate the current start state into a value that can be later handed
129  * to BEGIN to return to the state. The YYSTATE alias is for lex
130  * compatibility.
131  */
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
134 
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
140 
141 #define YY_END_OF_BUFFER_CHAR 0
142 
143 /* Size of default input buffer. */
144 #ifndef YY_BUF_SIZE
145 #define YY_BUF_SIZE 16384
146 #endif
147 
148 /* The state buf must be large enough to hold one state per character in the main buffer.
149  */
150 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
151 
152 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
153 #define YY_TYPEDEF_YY_BUFFER_STATE
154 typedef struct yy_buffer_state *YY_BUFFER_STATE;
155 #endif
156 
157 #ifndef YY_TYPEDEF_YY_SIZE_T
158 #define YY_TYPEDEF_YY_SIZE_T
159 typedef size_t yy_size_t;
160 #endif
161 
162 extern yy_size_t yyleng;
163 
164 extern FILE *yyin, *yyout;
165 
166 #define EOB_ACT_CONTINUE_SCAN 0
167 #define EOB_ACT_END_OF_FILE 1
168 #define EOB_ACT_LAST_MATCH 2
169 
170  #define YY_LESS_LINENO(n)
171 
172 /* Return all but the first "n" matched characters back to the input stream. */
173 #define yyless(n) \
174  do \
175  { \
176  /* Undo effects of setting up yytext. */ \
177  int yyless_macro_arg = (n); \
178  YY_LESS_LINENO(yyless_macro_arg);\
179  *yy_cp = (yy_hold_char); \
180  YY_RESTORE_YY_MORE_OFFSET \
181  (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
182  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
183  } \
184  while ( 0 )
185 
186 #define unput(c) yyunput( c, (yytext_ptr) )
187 
188 #ifndef YY_STRUCT_YY_BUFFER_STATE
189 #define YY_STRUCT_YY_BUFFER_STATE
190 struct yy_buffer_state
191  {
192  FILE *yy_input_file;
193 
194  char *yy_ch_buf; /* input buffer */
195  char *yy_buf_pos; /* current position in input buffer */
196 
197  /* Size of input buffer in bytes, not including room for EOB
198  * characters.
199  */
200  int yy_buf_size;
201 
202  /* Number of characters read into yy_ch_buf, not including EOB
203  * characters.
204  */
205  int yy_n_chars;
206 
207  /* Whether we "own" the buffer - i.e., we know we created it,
208  * and can realloc() it to grow it, and should free() it to
209  * delete it.
210  */
211  int yy_is_our_buffer;
212 
213  /* Whether this is an "interactive" input source; if so, and
214  * if we're using stdio for input, then we want to use getc()
215  * instead of fread(), to make sure we stop fetching input after
216  * each newline.
217  */
218  int yy_is_interactive;
219 
220  /* Whether we're considered to be at the beginning of a line.
221  * If so, '^' rules will be active on the next match, otherwise
222  * not.
223  */
224  int yy_at_bol;
225 
226  int yy_bs_lineno; /**< The line count. */
227  int yy_bs_column; /**< The column count. */
228 
229  /* Whether to try to fill the input buffer when we reach the
230  * end of it.
231  */
232  int yy_fill_buffer;
233 
234  int yy_buffer_status;
235 
236 #define YY_BUFFER_NEW 0
237 #define YY_BUFFER_NORMAL 1
238  /* When an EOF's been seen but there's still some text to process
239  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
240  * shouldn't try reading from the input source any more. We might
241  * still have a bunch of tokens to match, though, because of
242  * possible backing-up.
243  *
244  * When we actually see the EOF, we change the status to "new"
245  * (via yyrestart()), so that the user can continue scanning by
246  * just pointing yyin at a new input file.
247  */
248 #define YY_BUFFER_EOF_PENDING 2
249 
250  };
251 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
252 
253 /* Stack of input buffers. */
254 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
255 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
256 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
257 
258 /* We provide macros for accessing buffer states in case in the
259  * future we want to put the buffer states in a more general
260  * "scanner state".
261  *
262  * Returns the top of the stack, or NULL.
263  */
264 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
265  ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
266  : NULL)
267 
268 /* Same as previous macro, but useful when we know that the buffer stack is not
269  * NULL or when we need an lvalue. For internal use only.
270  */
271 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
272 
273 /* yy_hold_char holds the character lost when yytext is formed. */
274 static char yy_hold_char;
275 static int yy_n_chars; /* number of characters read into yy_ch_buf */
276 yy_size_t yyleng;
277 
278 /* Points to current character in buffer. */
279 static char *yy_c_buf_p = (char *) 0;
280 static int yy_init = 0; /* whether we need to initialize */
281 static int yy_start = 0; /* start state number */
282 
283 /* Flag which is used to allow yywrap()'s to do buffer switches
284  * instead of setting up a fresh yyin. A bit of a hack ...
285  */
286 static int yy_did_buffer_switch_on_eof;
287 
288 void yyrestart (FILE *input_file );
289 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
290 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
291 void yy_delete_buffer (YY_BUFFER_STATE b );
292 void yy_flush_buffer (YY_BUFFER_STATE b );
293 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
294 void yypop_buffer_state (void );
295 
296 static void yyensure_buffer_stack (void );
297 static void yy_load_buffer_state (void );
298 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
299 
300 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
301 
302 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
303 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
304 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
305 
306 void *yyalloc (yy_size_t );
307 void *yyrealloc (void *,yy_size_t );
308 void yyfree (void * );
309 
310 #define yy_new_buffer yy_create_buffer
311 
312 #define yy_set_interactive(is_interactive) \
313  { \
314  if ( ! YY_CURRENT_BUFFER ){ \
315  yyensure_buffer_stack (); \
316  YY_CURRENT_BUFFER_LVALUE = \
317  yy_create_buffer(yyin,YY_BUF_SIZE ); \
318  } \
319  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
320  }
321 
322 #define yy_set_bol(at_bol) \
323  { \
324  if ( ! YY_CURRENT_BUFFER ){\
325  yyensure_buffer_stack (); \
326  YY_CURRENT_BUFFER_LVALUE = \
327  yy_create_buffer(yyin,YY_BUF_SIZE ); \
328  } \
329  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
330  }
331 
332 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
333 
334 /* Begin user sect3 */
335 
336 #define yywrap() 1
337 #define YY_SKIP_YYWRAP
338 
339 typedef unsigned char YY_CHAR;
340 
341 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
342 
343 typedef int yy_state_type;
344 
345 extern int yylineno;
346 
347 int yylineno = 1;
348 
349 extern char *yytext;
350 #define yytext_ptr yytext
351 
352 static yy_state_type yy_get_previous_state (void );
353 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
354 static int yy_get_next_buffer (void );
355 static void yy_fatal_error (yyconst char msg[] );
356 
357 /* Done after the current pattern has been matched and before the
358  * corresponding action - sets up yytext.
359  */
360 #define YY_DO_BEFORE_ACTION \
361  (yytext_ptr) = yy_bp; \
362  yyleng = (size_t) (yy_cp - yy_bp); \
363  (yy_hold_char) = *yy_cp; \
364  *yy_cp = '\0'; \
365  (yy_c_buf_p) = yy_cp;
366 
367 #define YY_NUM_RULES 57
368 #define YY_END_OF_BUFFER 58
369 /* This struct is not used in this scanner,
370  but its presence is necessary. */
371 struct yy_trans_info
372  {
373  flex_int32_t yy_verify;
374  flex_int32_t yy_nxt;
375  };
376 static yyconst flex_int16_t yy_accept[195] =
377  { 0,
378  0, 0, 0, 0, 58, 56, 54, 54, 55, 56,
379  9, 55, 55, 56, 55, 7, 55, 55, 55, 52,
380  52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
381  52, 52, 52, 52, 52, 55, 55, 16, 12, 57,
382  15, 10, 11, 16, 16, 54, 2, 0, 51, 0,
383  17, 0, 51, 0, 8, 8, 7, 52, 40, 4,
384  1, 3, 5, 41, 52, 18, 52, 48, 52, 52,
385  52, 52, 6, 33, 52, 52, 52, 52, 52, 37,
386  38, 52, 52, 52, 52, 52, 52, 52, 0, 39,
387  12, 0, 0, 11, 13, 14, 51, 51, 8, 17,
388 
389  49, 52, 52, 52, 52, 52, 52, 0, 52, 52,
390  52, 32, 52, 52, 52, 52, 52, 52, 52, 52,
391  42, 53, 52, 52, 50, 52, 20, 52, 0, 22,
392  23, 24, 0, 34, 52, 52, 52, 52, 52, 35,
393  52, 52, 52, 36, 52, 0, 0, 0, 0, 0,
394  47, 43, 52, 52, 45, 46, 52, 19, 52, 0,
395  0, 0, 0, 0, 44, 52, 26, 21, 0, 31,
396  0, 0, 0, 52, 0, 0, 25, 0, 0, 0,
397  0, 0, 0, 0, 0, 0, 29, 30, 27, 0,
398  0, 0, 28, 0
399 
400  } ;
401 
402 static yyconst flex_int32_t yy_ec[256] =
403  { 0,
404  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
405  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407  1, 2, 4, 5, 6, 1, 7, 8, 9, 7,
408  7, 7, 10, 7, 10, 11, 10, 12, 12, 12,
409  12, 12, 12, 12, 12, 12, 12, 10, 7, 13,
410  14, 15, 7, 7, 16, 17, 18, 19, 20, 21,
411  22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
412  32, 33, 34, 35, 36, 32, 37, 38, 39, 32,
413  40, 41, 42, 7, 32, 7, 43, 44, 45, 46,
414 
415  47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
416  57, 58, 32, 59, 60, 61, 62, 32, 63, 64,
417  65, 32, 1, 66, 1, 7, 1, 1, 1, 1,
418  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 
426  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431  1, 1, 1, 1, 1
432  } ;
433 
434 static yyconst flex_int32_t yy_meta[67] =
435  { 0,
436  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437  2, 2, 1, 1, 1, 2, 2, 2, 2, 2,
438  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439  2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
440  1, 3, 2, 2, 2, 2, 2, 2, 2, 2,
441  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442  2, 2, 2, 2, 2, 1
443  } ;
444 
445 static yyconst flex_int16_t yy_base[200] =
446  { 0,
447  0, 0, 65, 70, 488, 516, 67, 76, 473, 69,
448  516, 516, 478, 74, 473, 73, 74, 470, 76, 82,
449  83, 81, 84, 472, 86, 98, 87, 113, 123, 110,
450  96, 141, 130, 144, 138, 0, 416, 516, 155, 516,
451  516, 516, 469, 71, 107, 103, 516, 95, 475, 146,
452  516, 109, 470, 161, 464, 463, 163, 463, 516, 516,
453  516, 516, 516, 516, 165, 161, 166, 462, 170, 171,
454  172, 167, 180, 201, 185, 189, 182, 203, 196, 461,
455  209, 207, 205, 211, 208, 210, 222, 229, 429, 516,
456  232, 202, 215, 458, 516, 516, 239, 236, 457, 457,
457 
458  456, 236, 238, 240, 242, 250, 254, 265, 260, 249,
459  271, 284, 281, 286, 289, 287, 272, 282, 293, 292,
460  455, 516, 300, 303, 453, 306, 452, 308, 292, 451,
461  447, 445, 329, 443, 326, 313, 332, 318, 341, 442,
462  347, 349, 351, 437, 355, 280, 328, 345, 344, 346,
463  432, 424, 365, 368, 333, 331, 375, 316, 370, 388,
464  351, 345, 361, 365, 268, 388, 145, 114, 405, 516,
465  364, 389, 386, 413, 376, 393, 516, 390, 416, 395,
466  403, 409, 398, 403, 403, 406, 516, 516, 516, 439,
467  443, 403, 516, 516, 504, 507, 510, 110, 513
468 
469  } ;
470 
471 static yyconst flex_int16_t yy_def[200] =
472  { 0,
473  194, 1, 195, 195, 194, 194, 194, 194, 194, 196,
474  194, 194, 194, 197, 194, 198, 194, 194, 194, 198,
475  198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
476  198, 198, 198, 198, 198, 199, 194, 194, 194, 194,
477  194, 194, 194, 194, 194, 194, 194, 196, 194, 196,
478  194, 197, 194, 197, 194, 194, 198, 198, 194, 194,
479  194, 194, 194, 194, 198, 198, 198, 198, 198, 198,
480  198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
481  198, 198, 198, 198, 198, 198, 198, 198, 199, 194,
482  194, 194, 194, 194, 194, 194, 196, 197, 194, 198,
483 
484  198, 198, 198, 198, 198, 198, 198, 194, 198, 198,
485  198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
486  198, 194, 198, 198, 198, 198, 198, 198, 194, 198,
487  198, 198, 194, 198, 198, 198, 198, 198, 198, 198,
488  198, 198, 198, 198, 198, 194, 194, 194, 194, 194,
489  198, 198, 198, 198, 198, 198, 198, 198, 198, 194,
490  194, 194, 194, 194, 198, 198, 198, 198, 194, 194,
491  194, 194, 194, 198, 194, 194, 194, 194, 194, 194,
492  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
493  194, 194, 194, 0, 194, 194, 194, 194, 194
494 
495  } ;
496 
497 static yyconst flex_int16_t yy_nxt[583] =
498  { 0,
499  6, 7, 8, 9, 10, 11, 12, 13, 14, 12,
500  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
501  25, 24, 24, 26, 27, 24, 28, 24, 29, 30,
502  24, 24, 31, 32, 33, 24, 34, 35, 24, 36,
503  6, 12, 20, 21, 22, 23, 24, 25, 24, 24,
504  26, 27, 24, 28, 24, 29, 30, 24, 31, 32,
505  33, 24, 34, 35, 24, 37, 39, 40, 46, 46,
506  41, 39, 40, 49, 42, 41, 43, 46, 46, 42,
507  44, 43, 53, 56, 57, 44, 59, 60, 61, 63,
508  64, 194, 194, 194, 194, 45, 194, 194, 95, 49,
509 
510  45, 71, 67, 70, 46, 46, 194, 44, 194, 50,
511  65, 58, 44, 69, 54, 66, 75, 53, 72, 82,
512  194, 68, 45, 194, 194, 95, 73, 45, 71, 67,
513  70, 74, 76, 194, 96, 50, 77, 65, 80, 69,
514  194, 66, 81, 75, 72, 85, 82, 68, 194, 54,
515  97, 194, 78, 73, 194, 194, 91, 74, 79, 76,
516  83, 96, 86, 77, 84, 80, 87, 88, 81, 98,
517  92, 194, 85, 56, 57, 194, 194, 194, 101, 78,
518  194, 194, 194, 100, 79, 93, 50, 83, 86, 103,
519  194, 84, 194, 87, 88, 194, 106, 92, 105, 194,
520 
521  102, 54, 108, 108, 104, 101, 194, 111, 109, 110,
522  100, 194, 93, 194, 107, 194, 103, 194, 194, 194,
523  194, 194, 113, 106, 118, 105, 102, 114, 115, 95,
524  104, 116, 194, 91, 111, 109, 110, 112, 117, 194,
525  107, 120, 96, 97, 98, 119, 194, 92, 194, 113,
526  194, 118, 194, 124, 114, 115, 95, 125, 116, 194,
527  194, 121, 93, 112, 194, 117, 108, 108, 120, 96,
528  194, 119, 123, 128, 92, 126, 54, 127, 194, 50,
529  124, 194, 194, 131, 125, 133, 133, 121, 130, 93,
530  132, 194, 194, 129, 194, 138, 194, 194, 123, 194,
531 
532  128, 126, 194, 194, 127, 135, 137, 134, 139, 131,
533  194, 136, 140, 194, 160, 130, 194, 132, 194, 142,
534  129, 146, 138, 194, 141, 144, 194, 147, 194, 145,
535  133, 133, 135, 137, 134, 139, 194, 143, 136, 140,
536  160, 194, 194, 194, 154, 148, 142, 152, 146, 153,
537  141, 194, 144, 147, 161, 149, 145, 194, 151, 194,
538  155, 194, 150, 143, 162, 194, 156, 163, 157, 164,
539  158, 154, 148, 152, 159, 194, 153, 170, 194, 171,
540  194, 161, 149, 166, 151, 194, 172, 155, 150, 169,
541  169, 162, 173, 156, 163, 157, 164, 158, 194, 165,
542 
543  176, 159, 168, 167, 170, 171, 169, 169, 177, 178,
544  166, 180, 181, 172, 179, 179, 182, 179, 179, 173,
545  174, 184, 185, 194, 186, 165, 176, 187, 168, 188,
546  167, 189, 193, 175, 194, 177, 178, 180, 190, 181,
547  191, 191, 194, 182, 191, 191, 174, 194, 184, 185,
548  183, 186, 194, 194, 187, 194, 188, 194, 189, 193,
549  175, 194, 194, 194, 190, 194, 194, 194, 99, 94,
550  122, 194, 194, 194, 99, 55, 183, 192, 52, 48,
551  94, 90, 194, 62, 55, 51, 47, 194, 194, 194,
552  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
553 
554  194, 194, 194, 192, 38, 38, 38, 48, 48, 48,
555  52, 52, 52, 89, 89, 5, 194, 194, 194, 194,
556  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
557  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
558  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
559  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
560  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
561  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
562  194, 194
563  } ;
564 
565 static yyconst flex_int16_t yy_chk[583] =
566  { 0,
567  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
568  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
569  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
570  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
571  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
572  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
573  1, 1, 1, 1, 1, 1, 3, 3, 7, 7,
574  3, 4, 4, 10, 3, 4, 3, 8, 8, 4,
575  3, 4, 14, 16, 16, 4, 17, 17, 17, 19,
576  19, 22, 20, 21, 23, 3, 25, 27, 44, 48,
577 
578  4, 25, 21, 23, 46, 46, 31, 3, 26, 10,
579  20, 198, 4, 22, 14, 20, 27, 52, 25, 31,
580  30, 21, 3, 28, 168, 44, 26, 4, 25, 21,
581  23, 26, 28, 29, 45, 48, 28, 20, 30, 22,
582  33, 20, 30, 27, 25, 33, 31, 21, 35, 52,
583  50, 32, 29, 26, 34, 167, 39, 26, 29, 28,
584  32, 45, 33, 28, 32, 30, 34, 35, 30, 54,
585  39, 66, 33, 57, 57, 65, 67, 72, 66, 29,
586  69, 70, 71, 65, 29, 39, 50, 32, 33, 69,
587  73, 32, 77, 34, 35, 75, 72, 39, 71, 76,
588 
589  67, 54, 74, 74, 70, 66, 79, 77, 75, 76,
590  65, 74, 39, 78, 73, 83, 69, 82, 85, 81,
591  86, 84, 79, 72, 85, 71, 67, 81, 82, 92,
592  70, 83, 87, 91, 77, 75, 76, 78, 84, 88,
593  73, 87, 93, 97, 98, 86, 102, 91, 103, 79,
594  104, 85, 105, 103, 81, 82, 92, 104, 83, 110,
595  106, 88, 91, 78, 107, 84, 108, 108, 87, 93,
596  109, 86, 102, 107, 91, 105, 98, 106, 165, 97,
597  103, 111, 117, 110, 104, 112, 112, 88, 109, 91,
598  111, 113, 118, 108, 112, 117, 114, 116, 102, 115,
599 
600  107, 105, 120, 119, 106, 114, 116, 113, 118, 110,
601  123, 115, 119, 124, 146, 109, 126, 111, 128, 123,
602  108, 129, 117, 136, 120, 126, 158, 129, 138, 128,
603  133, 133, 114, 116, 113, 118, 135, 124, 115, 119,
604  146, 156, 137, 155, 138, 133, 123, 136, 129, 137,
605  120, 139, 126, 129, 147, 133, 128, 141, 135, 142,
606  139, 143, 133, 124, 148, 145, 141, 149, 142, 150,
607  143, 138, 133, 136, 145, 153, 137, 161, 154, 162,
608  159, 147, 133, 154, 135, 157, 163, 139, 133, 160,
609  160, 148, 164, 141, 149, 142, 150, 143, 166, 153,
610 
611  171, 145, 159, 157, 161, 162, 169, 169, 172, 173,
612  154, 175, 176, 163, 174, 174, 178, 179, 179, 164,
613  166, 180, 181, 174, 182, 153, 171, 183, 159, 184,
614  157, 185, 192, 169, 152, 172, 173, 175, 186, 176,
615  190, 190, 151, 178, 191, 191, 166, 144, 180, 181,
616  179, 182, 140, 134, 183, 132, 184, 131, 185, 192,
617  169, 130, 127, 125, 186, 121, 101, 100, 99, 94,
618  89, 80, 68, 58, 56, 55, 179, 191, 53, 49,
619  43, 37, 24, 18, 15, 13, 9, 5, 0, 0,
620  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
621 
622  0, 0, 0, 191, 195, 195, 195, 196, 196, 196,
623  197, 197, 197, 199, 199, 194, 194, 194, 194, 194,
624  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
625  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
626  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
627  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
628  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
629  194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
630  194, 194
631  } ;
632 
633 static yy_state_type yy_last_accepting_state;
634 static char *yy_last_accepting_cpos;
635 
636 extern int yy_flex_debug;
637 int yy_flex_debug = 0;
638 
639 /* The intent behind this definition is that it'll catch
640  * any uses of REJECT which flex missed.
641  */
642 #define REJECT reject_used_but_not_detected
643 #define yymore() yymore_used_but_not_detected
644 #define YY_MORE_ADJ 0
645 #define YY_RESTORE_YY_MORE_OFFSET
646 char *yytext;
647 #line 1 "KDbSqlScanner.l"
648 /* This file is part of the KDE project
649  Copyright (C) 2004 Lucijan Busch <[email protected]>
650  Copyright (C) 2004-2018 JarosÅ‚aw Staniek <stan[email protected]>
651 
652  This library is free software; you can redistribute it and/or
653  modify it under the terms of the GNU Library General Public
654  License as published by the Free Software Foundation; either
655  version 2 of the License, or (at your option) any later version.
656 
657  This library is distributed in the hope that it will be useful,
658  but WITHOUT ANY WARRANTY; without even the implied warranty of
659  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
660  Library General Public License for more details.
661 
662  You should have received a copy of the GNU Library General Public License
663  along with this library; see the file COPYING.LIB. If not, write to
664  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
665  Boston, MA 02110-1301, USA.
666 */
667 #line 22 "KDbSqlScanner.l"
668 #include "sqlparser.h"
669 #include "KDb.h"
670 #include "KDbExpression.h"
671 #include "KDbParser.h"
672 #include "KDbSqlTypes.h"
673 #include "kdb_debug.h"
674 
675 extern int globalCurrentPos;
676 extern QByteArray globalToken;
677 
678 #define YY_NO_UNPUT
679 #define ECOUNT globalCurrentPos += yyleng; globalToken = yytext
680 
681 extern void setError(const QString& errDesc);
682 extern void setError(const QString& errName, const QString& errDesc);
683 
684 /* Only quotes the input if it does not start with a quote character, otherwise
685  it would be too hard to read with some fonts. */
686 static QString maybeQuote(const QString& string)
687 {
688  QString first(string.left(1));
689  if (first == QLatin1Char('\'') || first == QLatin1Char('"') || first == QLatin1Char('`')) {
690  return string;
691  }
692  return QStringLiteral("\"%1\"").arg(string);
693 }
694 /* *** Please reflect changes to this file in ../driver_p.cpp *** */
695 
696 /*identifier [a-zA-Z_][a-zA-Z_0-9]* */
697 /* quoted_identifier (\"[a-zA-Z_0-9]+\") */
698 #line 699 "generated/sqlscanner.cpp"
699 
700 #define INITIAL 0
701 #define DATE_OR_TIME 1
702 
703 #ifndef YY_NO_UNISTD_H
704 /* Special case for "unistd.h", since it is non-ANSI. We include it way
705  * down here because we want the user's section 1 to have been scanned first.
706  * The user has a chance to override it with an option.
707  */
708 #include <unistd.h>
709 #endif
710 
711 #ifndef YY_EXTRA_TYPE
712 #define YY_EXTRA_TYPE void *
713 #endif
714 
715 static int yy_init_globals (void );
716 
717 /* Accessor methods to globals.
718  These are made visible to non-reentrant scanners for convenience. */
719 
720 int yylex_destroy (void );
721 
722 int yyget_debug (void );
723 
724 void yyset_debug (int debug_flag );
725 
726 YY_EXTRA_TYPE yyget_extra (void );
727 
728 void yyset_extra (YY_EXTRA_TYPE user_defined );
729 
730 FILE *yyget_in (void );
731 
732 void yyset_in (FILE * in_str );
733 
734 FILE *yyget_out (void );
735 
736 void yyset_out (FILE * out_str );
737 
738 yy_size_t yyget_leng (void );
739 
740 char *yyget_text (void );
741 
742 int yyget_lineno (void );
743 
744 void yyset_lineno (int line_number );
745 
746 /* Macros after this point can all be overridden by user definitions in
747  * section 1.
748  */
749 
750 #ifndef YY_SKIP_YYWRAP
751 #ifdef __cplusplus
752 extern "C" int yywrap (void );
753 #else
754 extern int yywrap (void );
755 #endif
756 #endif
757 
758  static void yyunput (int c,char *buf_ptr );
759 
760 #ifndef yytext_ptr
761 static void yy_flex_strncpy (char *,yyconst char *,int );
762 #endif
763 
764 #ifdef YY_NEED_STRLEN
765 static int yy_flex_strlen (yyconst char * );
766 #endif
767 
768 #ifndef YY_NO_INPUT
769 
770 #ifdef __cplusplus
771 static int yyinput (void );
772 #else
773 static int input (void );
774 #endif
775 
776 #endif
777 
778 /* Amount of stuff to slurp up with each read. */
779 #ifndef YY_READ_BUF_SIZE
780 #define YY_READ_BUF_SIZE 8192
781 #endif
782 
783 /* Copy whatever the last rule matched to the standard output. */
784 #ifndef ECHO
785 /* This used to be an fputs(), but since the string might contain NUL's,
786  * we now use fwrite().
787  */
788 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
789 #endif
790 
791 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
792  * is returned in "result".
793  */
794 #ifndef YY_INPUT
795 #define YY_INPUT(buf,result,max_size) \
796  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
797  { \
798  int c = '*'; \
799  size_t n; \
800  for ( n = 0; n < max_size && \
801  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
802  buf[n] = (char) c; \
803  if ( c == '\n' ) \
804  buf[n++] = (char) c; \
805  if ( c == EOF && ferror( yyin ) ) \
806  YY_FATAL_ERROR( "input in flex scanner failed" ); \
807  result = n; \
808  } \
809  else \
810  { \
811  errno=0; \
812  while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
813  { \
814  if( errno != EINTR) \
815  { \
816  YY_FATAL_ERROR( "input in flex scanner failed" ); \
817  break; \
818  } \
819  errno=0; \
820  clearerr(yyin); \
821  } \
822  }\
823 \
824 
825 #endif
826 
827 /* No semi-colon after return; correct usage is to write "yyterminate();" -
828  * we don't want an extra ';' after the "return" because that will cause
829  * some compilers to complain about unreachable statements.
830  */
831 #ifndef yyterminate
832 #define yyterminate() return YY_NULL
833 #endif
834 
835 /* Number of entries by which start-condition stack grows. */
836 #ifndef YY_START_STACK_INCR
837 #define YY_START_STACK_INCR 25
838 #endif
839 
840 /* Report a fatal error. */
841 #ifndef YY_FATAL_ERROR
842 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
843 #endif
844 
845 /* end tables serialization structures and prototypes */
846 
847 /* Default declaration of generated scanner - a define so the user can
848  * easily add parameters.
849  */
850 #ifndef YY_DECL
851 #define YY_DECL_IS_OURS 1
852 
853 extern int yylex (void);
854 
855 #define YY_DECL int yylex (void)
856 #endif /* !YY_DECL */
857 
858 /* Code executed at the beginning of each rule, after yytext and yyleng
859  * have been set up.
860  */
861 #ifndef YY_USER_ACTION
862 #define YY_USER_ACTION
863 #endif
864 
865 /* Code executed at the end of each rule. */
866 #ifndef YY_BREAK
867 #define YY_BREAK break;
868 #endif
869 
870 #define YY_RULE_SETUP \
871  YY_USER_ACTION
872 
873 /** The main scanner function which does all the work.
874  */
875 YY_DECL
876 {
877  register yy_state_type yy_current_state;
878  register char *yy_cp, *yy_bp;
879  register int yy_act;
880 
881 #line 73 "KDbSqlScanner.l"
882 
883 
884  int DATE_OR_TIME_caller = 0;
885 
886 #line 887 "generated/sqlscanner.cpp"
887 
888  if ( !(yy_init) )
889  {
890  (yy_init) = 1;
891 
892 #ifdef YY_USER_INIT
893  YY_USER_INIT;
894 #endif
895 
896  if ( ! (yy_start) )
897  (yy_start) = 1; /* first start state */
898 
899  if ( ! yyin )
900  yyin = stdin;
901 
902  if ( ! yyout )
903  yyout = stdout;
904 
905  if ( ! YY_CURRENT_BUFFER ) {
906  yyensure_buffer_stack ();
907  YY_CURRENT_BUFFER_LVALUE =
908  yy_create_buffer(yyin,YY_BUF_SIZE );
909  }
910 
911  yy_load_buffer_state( );
912  }
913 
914  while ( 1 ) /* loops until end-of-file is reached */
915  {
916  yy_cp = (yy_c_buf_p);
917 
918  /* Support of yytext. */
919  *yy_cp = (yy_hold_char);
920 
921  /* yy_bp points to the position in yy_ch_buf of the start of
922  * the current run.
923  */
924  yy_bp = yy_cp;
925 
926  yy_current_state = (yy_start);
927 yy_match:
928  do
929  {
930  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
931  if ( yy_accept[yy_current_state] )
932  {
933  (yy_last_accepting_state) = yy_current_state;
934  (yy_last_accepting_cpos) = yy_cp;
935  }
936  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
937  {
938  yy_current_state = (int) yy_def[yy_current_state];
939  if ( yy_current_state >= 195 )
940  yy_c = yy_meta[(unsigned int) yy_c];
941  }
942  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
943  ++yy_cp;
944  }
945  while ( yy_current_state != 194 );
946  yy_cp = (yy_last_accepting_cpos);
947  yy_current_state = (yy_last_accepting_state);
948 
949 yy_find_action:
950  yy_act = yy_accept[yy_current_state];
951 
952  YY_DO_BEFORE_ACTION;
953 
954 do_action: /* This label is used only to access EOF actions. */
955 
956  switch ( yy_act )
957  { /* beginning of action switch */
958  case 0: /* must back up */
959  /* undo the effects of YY_DO_BEFORE_ACTION */
960  *yy_cp = (yy_hold_char);
961  yy_cp = (yy_last_accepting_cpos);
962  yy_current_state = (yy_last_accepting_state);
963  goto yy_find_action;
964 
965 case 1:
966 YY_RULE_SETUP
967 #line 77 "KDbSqlScanner.l"
968 {
969  ECOUNT;
970  return NOT_EQUAL;
971 }
972  YY_BREAK
973 case 2:
974 YY_RULE_SETUP
975 #line 82 "KDbSqlScanner.l"
976 {
977  ECOUNT;
978  return NOT_EQUAL2;
979 }
980  YY_BREAK
981 case 3:
982 YY_RULE_SETUP
983 #line 87 "KDbSqlScanner.l"
984 {
985  ECOUNT;
986  return '=';
987 }
988  YY_BREAK
989 case 4:
990 YY_RULE_SETUP
991 #line 92 "KDbSqlScanner.l"
992 {
993  ECOUNT;
994  return LESS_OR_EQUAL;
995 }
996  YY_BREAK
997 case 5:
998 YY_RULE_SETUP
999 #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 
QString fromUtf8(const char *str, int size)
QTextStream & left(QTextStream &stream)
void clear()
qlonglong toLongLong(bool *ok, int base) const const
KDB_EXPORT QString unescapeString(const QString &string, char quote, int *errorPosition=nullptr)
Unescapes characters in string string for the KDBSQL dialect.
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:21:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.