kexi

sqlscanner.cpp
1#line 2 "sqlscanner.cpp"
2/* A lexical scanner generated by flex */
3
4/* Scanner skeleton version:
5 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
6 */
7
8#define FLEX_SCANNER
9#define YY_FLEX_MAJOR_VERSION 2
10#define YY_FLEX_MINOR_VERSION 5
11
12#include <stdio.h>
13#include <errno.h>
14
15/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
16#ifdef c_plusplus
17#ifndef __cplusplus
18#define __cplusplus
19#endif
20#endif
21
22
23#ifdef __cplusplus
24
25#include <stdlib.h>
26#ifndef _WIN32
27#include <unistd.h>
28#endif
29
30/* Use prototypes in function declarations. */
31#define YY_USE_PROTOS
32
33/* The "const" storage-class-modifier is valid. */
34#define YY_USE_CONST
35
36#else /* ! __cplusplus */
37
38#if __STDC__
39
40#define YY_USE_PROTOS
41#define YY_USE_CONST
42
43#endif /* __STDC__ */
44#endif /* ! __cplusplus */
45
46#ifdef YY_USE_CONST
47#define yyconst const
48#else
49#define yyconst
50#endif
51
52
53#ifdef YY_USE_PROTOS
54#define YY_PROTO(proto) proto
55#else
56#define YY_PROTO(proto) ()
57#endif
58
59
60/* Returned upon end-of-file. */
61#define YY_NULL 0
62
63/* Promotes a possibly negative, possibly signed char to an unsigned
64 * integer for use as an array index. If the signed char is negative,
65 * we want to instead treat it as an 8-bit unsigned char, hence the
66 * double cast.
67 */
68#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
69
70/* Enter a start condition. This macro really ought to take a parameter,
71 * but we do it the disgusting crufty way forced on us by the ()-less
72 * definition of BEGIN.
73 */
74#define BEGIN yy_start = 1 + 2 *
75
76/* Translate the current start state into a value that can be later handed
77 * to BEGIN to return to the state. The YYSTATE alias is for lex
78 * compatibility.
79 */
80#define YY_START ((yy_start - 1) / 2)
81#define YYSTATE YY_START
82
83/* Action number for EOF rule of a given start state. */
84#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
85
86/* Special action meaning "start processing a new file". */
87#define YY_NEW_FILE yyrestart( yyin )
88
89#define YY_END_OF_BUFFER_CHAR 0
90
91/* Size of default input buffer. */
92#define YY_BUF_SIZE 16384
93
94typedef struct yy_buffer_state *YY_BUFFER_STATE;
95
96extern int yyleng;
97extern FILE *yyin, *yyout;
98
99#define EOB_ACT_CONTINUE_SCAN 0
100#define EOB_ACT_END_OF_FILE 1
101#define EOB_ACT_LAST_MATCH 2
102
103/* The funky do-while in the following #define is used to turn the definition
104 * int a single C statement (which needs a semi-colon terminator). This
105 * avoids problems with code like:
106 *
107 * if ( condition_holds )
108 * yyless( 5 );
109 * else
110 * do_something_else();
111 *
112 * Prior to using the do-while the compiler would get upset at the
113 * "else" because it interpreted the "if" statement as being all
114 * done when it reached the ';' after the yyless() call.
115 */
116
117/* Return all but the first 'n' matched characters back to the input stream. */
118
119#define yyless(n) \
120 do \
121 { \
122 /* Undo effects of setting up yytext. */ \
123 *yy_cp = yy_hold_char; \
124 YY_RESTORE_YY_MORE_OFFSET \
125 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
126 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
127 } \
128 while ( 0 )
129
130#define unput(c) yyunput( c, yytext_ptr )
131
132/* The following is because we cannot portably get our hands on size_t
133 * (without autoconf's help, which isn't available because we want
134 * flex-generated scanners to compile on their own).
135 */
136typedef unsigned int yy_size_t;
137
138
139struct yy_buffer_state
140 {
141 FILE *yy_input_file;
142
143 char *yy_ch_buf; /* input buffer */
144 char *yy_buf_pos; /* current position in input buffer */
145
146 /* Size of input buffer in bytes, not including room for EOB
147 * characters.
148 */
149 yy_size_t yy_buf_size;
150
151 /* Number of characters read into yy_ch_buf, not including EOB
152 * characters.
153 */
154 int yy_n_chars;
155
156 /* Whether we "own" the buffer - i.e., we know we created it,
157 * and can realloc() it to grow it, and should free() it to
158 * delete it.
159 */
160 int yy_is_our_buffer;
161
162 /* Whether this is an "interactive" input source; if so, and
163 * if we're using stdio for input, then we want to use getc()
164 * instead of fread(), to make sure we stop fetching input after
165 * each newline.
166 */
167 int yy_is_interactive;
168
169 /* Whether we're considered to be at the beginning of a line.
170 * If so, '^' rules will be active on the next match, otherwise
171 * not.
172 */
173 int yy_at_bol;
174
175 /* Whether to try to fill the input buffer when we reach the
176 * end of it.
177 */
178 int yy_fill_buffer;
179
180 int yy_buffer_status;
181#define YY_BUFFER_NEW 0
182#define YY_BUFFER_NORMAL 1
183 /* When an EOF's been seen but there's still some text to process
184 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
185 * shouldn't try reading from the input source any more. We might
186 * still have a bunch of tokens to match, though, because of
187 * possible backing-up.
188 *
189 * When we actually see the EOF, we change the status to "new"
190 * (via yyrestart()), so that the user can continue scanning by
191 * just pointing yyin at a new input file.
192 */
193#define YY_BUFFER_EOF_PENDING 2
194 };
195
196static YY_BUFFER_STATE yy_current_buffer = 0;
197
198/* We provide macros for accessing buffer states in case in the
199 * future we want to put the buffer states in a more general
200 * "scanner state".
201 */
202#define YY_CURRENT_BUFFER yy_current_buffer
203
204
205/* yy_hold_char holds the character lost when yytext is formed. */
206static char yy_hold_char;
207
208static int yy_n_chars; /* number of characters read into yy_ch_buf */
209
210
211int yyleng;
212
213/* Points to current character in buffer. */
214static char *yy_c_buf_p = (char *) 0;
215static int yy_init = 1; /* whether we need to initialize */
216static int yy_start = 0; /* start state number */
217
218/* Flag which is used to allow yywrap()'s to do buffer switches
219 * instead of setting up a fresh yyin. A bit of a hack ...
220 */
221static int yy_did_buffer_switch_on_eof;
222
223void yyrestart YY_PROTO(( FILE *input_file ));
224
225void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
226void yy_load_buffer_state YY_PROTO(( void ));
227YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
228void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
229void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
230void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
231#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
232
233YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
234YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
235YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
236
237static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
238static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
239static void yy_flex_free YY_PROTO(( void * ));
240
241#define yy_new_buffer yy_create_buffer
242
243#define yy_set_interactive(is_interactive) \
244 { \
245 if ( ! yy_current_buffer ) \
246 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
247 yy_current_buffer->yy_is_interactive = is_interactive; \
248 }
249
250#define yy_set_bol(at_bol) \
251 { \
252 if ( ! yy_current_buffer ) \
253 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
254 yy_current_buffer->yy_at_bol = at_bol; \
255 }
256
257#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
258
259
260#define yywrap() 1
261#define YY_SKIP_YYWRAP
262typedef unsigned char YY_CHAR;
263FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
264typedef int yy_state_type;
265extern char *yytext;
266#define yytext_ptr yytext
267
268static yy_state_type yy_get_previous_state YY_PROTO(( void ));
269static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
270static int yy_get_next_buffer YY_PROTO(( void ));
271static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
272
273/* Done after the current pattern has been matched and before the
274 * corresponding action - sets up yytext.
275 */
276#define YY_DO_BEFORE_ACTION \
277 yytext_ptr = yy_bp; \
278 yyleng = (int) (yy_cp - yy_bp); \
279 yy_hold_char = *yy_cp; \
280 *yy_cp = '\0'; \
281 yy_c_buf_p = yy_cp;
282
283#define YY_NUM_RULES 43
284#define YY_END_OF_BUFFER 44
285static yyconst short int yy_accept[148] =
286 { 0,
287 0, 0, 44, 43, 41, 42, 43, 42, 42, 43,
288 42, 7, 42, 42, 42, 42, 39, 39, 39, 39,
289 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
290 39, 39, 42, 41, 2, 0, 38, 9, 0, 8,
291 8, 7, 39, 27, 4, 1, 3, 5, 28, 0,
292 39, 10, 35, 39, 39, 39, 6, 22, 39, 39,
293 39, 39, 39, 24, 25, 39, 39, 39, 39, 39,
294 39, 26, 8, 40, 9, 36, 39, 39, 39, 39,
295 0, 39, 39, 39, 21, 39, 39, 39, 39, 39,
296 39, 39, 29, 39, 37, 12, 39, 0, 14, 15,
297
298 16, 0, 23, 39, 39, 39, 39, 39, 39, 39,
299 39, 0, 0, 0, 34, 30, 39, 39, 32, 33,
300 11, 39, 0, 0, 0, 31, 39, 13, 0, 20,
301 0, 39, 0, 0, 0, 0, 0, 0, 0, 0,
302 18, 19, 0, 0, 0, 17, 0
303 } ;
304
305static yyconst int yy_ec[256] =
306 { 0,
307 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
308 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
310 1, 2, 3, 4, 5, 1, 5, 6, 7, 5,
311 5, 5, 5, 5, 5, 8, 5, 9, 9, 9,
312 9, 9, 9, 9, 9, 9, 9, 5, 5, 10,
313 11, 12, 5, 5, 16, 17, 18, 19, 20, 21,
314 22, 23, 24, 25, 26, 27, 28, 29, 30, 15,
315 15, 31, 32, 33, 34, 15, 35, 36, 37, 15,
316 13, 1, 14, 5, 15, 5, 16, 17, 18, 19,
317
318 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
319 30, 15, 15, 31, 32, 33, 34, 15, 35, 36,
320 37, 15, 1, 38, 1, 5, 1, 1, 1, 1,
321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
323 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
325 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
328
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 1, 1
335 } ;
336
337static yyconst int yy_meta[39] =
338 { 0,
339 1, 1, 1, 1, 1, 1, 1, 2, 2, 1,
340 1, 1, 3, 3, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 1
343 } ;
344
345static yyconst short int yy_base[152] =
346 { 0,
347 0, 0, 254, 255, 251, 241, 247, 255, 244, 242,
348 239, 31, 31, 236, 33, 0, 238, 38, 39, 40,
349 41, 42, 43, 44, 45, 47, 49, 55, 74, 46,
350 60, 56, 207, 242, 255, 239, 255, 255, 235, 232,
351 231, 50, 231, 255, 255, 255, 255, 255, 255, 224,
352 76, 48, 229, 77, 79, 80, 81, 88, 83, 84,
353 91, 85, 92, 228, 93, 94, 95, 96, 98, 100,
354 101, 255, 226, 255, 226, 225, 105, 115, 117, 118,
355 125, 120, 122, 121, 129, 126, 127, 128, 132, 134,
356 135, 136, 224, 131, 223, 222, 138, 127, 221, 220,
357
358 219, 146, 218, 142, 148, 151, 155, 157, 160, 163,
359 164, 192, 188, 190, 205, 204, 158, 171, 203, 202,
360 201, 162, 206, 179, 177, 196, 166, 195, 173, 255,
361 177, 184, 166, 172, 174, 171, 180, 165, 167, 159,
362 255, 255, 187, 183, 158, 255, 255, 216, 219, 58,
363 222
364 } ;
365
366static yyconst short int yy_def[152] =
367 { 0,
368 147, 1, 147, 147, 147, 147, 148, 147, 147, 149,
369 147, 150, 147, 147, 147, 151, 150, 150, 150, 150,
370 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
371 150, 150, 147, 147, 147, 148, 147, 147, 149, 147,
372 147, 150, 150, 147, 147, 147, 147, 147, 147, 151,
373 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
374 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
375 150, 147, 147, 147, 150, 150, 150, 150, 150, 150,
376 147, 150, 150, 150, 150, 150, 150, 150, 150, 150,
377 150, 150, 150, 150, 150, 150, 150, 147, 150, 150,
378
379 150, 147, 150, 150, 150, 150, 150, 150, 150, 150,
380 150, 147, 147, 147, 150, 150, 150, 150, 150, 150,
381 150, 150, 147, 147, 147, 150, 150, 150, 147, 147,
382 147, 150, 147, 147, 147, 147, 147, 147, 147, 147,
383 147, 147, 147, 147, 147, 147, 0, 147, 147, 147,
384 147
385 } ;
386
387static yyconst short int yy_nxt[294] =
388 { 0,
389 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
390 14, 15, 16, 8, 17, 18, 19, 20, 21, 17,
391 22, 17, 17, 23, 24, 17, 25, 17, 26, 27,
392 28, 29, 30, 17, 31, 32, 17, 33, 41, 42,
393 44, 45, 46, 48, 49, 147, 147, 147, 147, 147,
394 147, 147, 147, 147, 147, 147, 147, 41, 42, 43,
395 55, 69, 147, 147, 60, 76, 51, 147, 61, 52,
396 54, 57, 56, 59, 58, 53, 62, 64, 66, 65,
397 63, 147, 70, 147, 147, 71, 147, 147, 147, 81,
398 147, 147, 147, 67, 75, 147, 77, 68, 147, 147,
399
400 147, 147, 147, 147, 83, 147, 82, 147, 147, 79,
401 78, 87, 147, 80, 91, 88, 84, 85, 86, 92,
402 94, 89, 147, 90, 147, 147, 81, 147, 147, 147,
403 102, 93, 95, 147, 147, 147, 147, 97, 147, 147,
404 101, 147, 147, 147, 96, 147, 104, 102, 99, 147,
405 105, 106, 103, 98, 100, 147, 112, 107, 147, 111,
406 113, 108, 147, 110, 147, 147, 109, 147, 117, 147,
407 147, 147, 115, 147, 129, 135, 119, 114, 147, 120,
408 116, 118, 121, 122, 144, 135, 127, 146, 144, 143,
409 126, 147, 128, 142, 141, 140, 132, 139, 137, 136,
410
411 134, 133, 147, 147, 131, 130, 138, 129, 147, 147,
412 147, 147, 147, 125, 124, 145, 36, 36, 36, 39,
413 39, 39, 50, 50, 123, 147, 147, 147, 147, 147,
414 147, 147, 147, 147, 73, 147, 147, 74, 147, 73,
415 40, 37, 37, 34, 72, 147, 47, 40, 37, 38,
416 37, 35, 34, 147, 3, 147, 147, 147, 147, 147,
417 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
418 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
419 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
420 147, 147, 147
421
422 } ;
423
424static yyconst short int yy_chk[294] =
425 { 0,
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, 12, 12,
430 13, 13, 13, 15, 15, 18, 19, 20, 21, 22,
431 23, 24, 25, 30, 26, 52, 27, 42, 42, 150,
432 21, 30, 28, 32, 25, 52, 18, 31, 25, 18,
433 20, 23, 22, 24, 23, 19, 26, 27, 28, 27,
434 26, 29, 31, 51, 54, 32, 55, 56, 57, 58,
435 59, 60, 62, 29, 51, 58, 54, 29, 61, 63,
436
437 65, 66, 67, 68, 60, 69, 59, 70, 71, 56,
438 55, 65, 77, 57, 69, 66, 61, 62, 63, 70,
439 77, 67, 78, 68, 79, 80, 81, 82, 84, 83,
440 85, 71, 78, 86, 87, 88, 85, 80, 94, 89,
441 84, 90, 91, 92, 79, 97, 87, 102, 82, 104,
442 88, 89, 86, 81, 83, 105, 98, 90, 106, 97,
443 98, 91, 107, 94, 108, 117, 92, 109, 106, 122,
444 110, 111, 104, 127, 129, 135, 108, 102, 118, 109,
445 105, 107, 110, 111, 144, 132, 118, 145, 143, 140,
446 117, 132, 122, 139, 138, 137, 127, 136, 134, 133,
447
448 131, 129, 128, 126, 125, 124, 135, 123, 121, 120,
449 119, 116, 115, 114, 113, 144, 148, 148, 148, 149,
450 149, 149, 151, 151, 112, 103, 101, 100, 99, 96,
451 95, 93, 76, 75, 73, 64, 53, 50, 43, 41,
452 40, 39, 36, 34, 33, 17, 14, 11, 10, 9,
453 7, 6, 5, 3, 147, 147, 147, 147, 147, 147,
454 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
455 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
456 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
457 147, 147, 147
458
459 } ;
460
461static yy_state_type yy_last_accepting_state;
462static char *yy_last_accepting_cpos;
463
464/* The intent behind this definition is that it'll catch
465 * any uses of REJECT which flex missed.
466 */
467#define REJECT reject_used_but_not_detected
468#define yymore() yymore_used_but_not_detected
469#define YY_MORE_ADJ 0
470#define YY_RESTORE_YY_MORE_OFFSET
471char *yytext;
472#line 1 "sqlscanner.l"
473#define INITIAL 0
474/* This file is part of the KDE project
475 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
476 Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
477
478 This library is free software; you can redistribute it and/or
479 modify it under the terms of the GNU Library General Public
480 License as published by the Free Software Foundation; either
481 version 2 of the License, or (at your option) any later version.
482
483 This library is distributed in the hope that it will be useful,
484 but WITHOUT ANY WARRANTY; without even the implied warranty of
485 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
486 Library General Public License for more details.
487
488 You should have received a copy of the GNU Library General Public License
489 along with this library; see the file COPYING.LIB. If not, write to
490 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
491 Boston, MA 02110-1301, USA.
492*/
493#line 22 "sqlscanner.l"
494#include <field.h>
495#include <expression.h>
496
497#include "sqlparser.h"
498#include "sqltypes.h"
499#include <iostream>
500#include <kdebug.h>
501#include <tdelocale.h>
502
503#define YY_NO_UNPUT
504#define ECOUNT current += yyleng; ctoken = yytext
505
506extern void setError(const TQString& errDesc);
507extern void setError(const TQString& errName, const TQString& errDesc);
508
509/* *** Please reflect changes to this file in ../driver_p.cpp *** */
510#define YY_NEVER_INTERACTIVE 1
511/*identifier [a-zA-Z_][a-zA-Z_0-9]* */
512/* quoted_identifier (\"[a-zA-Z_0-9]+\") */
513/* todo: support for real numbers */
514#line 524 "sqlscanner.cpp"
515
516/* Macros after this point can all be overridden by user definitions in
517 * section 1.
518 */
519
520#ifndef YY_SKIP_YYWRAP
521#ifdef __cplusplus
522extern "C" int yywrap YY_PROTO(( void ));
523#else
524extern int yywrap YY_PROTO(( void ));
525#endif
526#endif
527
528#ifndef YY_NO_UNPUT
529static void yyunput YY_PROTO(( int c, char *buf_ptr ));
530#endif
531
532#ifndef yytext_ptr
533static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
534#endif
535
536#ifdef YY_NEED_STRLEN
537static int yy_flex_strlen YY_PROTO(( yyconst char * ));
538#endif
539
540#ifndef YY_NO_INPUT
541#ifdef __cplusplus
542static int yyinput YY_PROTO(( void ));
543#else
544static int input YY_PROTO(( void ));
545#endif
546#endif
547
548#ifdef YY_STACK_USED
549static int yy_start_stack_ptr = 0;
550static int yy_start_stack_depth = 0;
551static int *yy_start_stack = 0;
552#ifndef YY_NO_PUSH_STATE
553static void yy_push_state YY_PROTO(( int new_state ));
554#endif
555#ifndef YY_NO_POP_STATE
556static void yy_pop_state YY_PROTO(( void ));
557#endif
558#ifndef YY_NO_TOP_STATE
559static int yy_top_state YY_PROTO(( void ));
560#endif
561
562#else
563#define YY_NO_PUSH_STATE 1
564#define YY_NO_POP_STATE 1
565#define YY_NO_TOP_STATE 1
566#endif
567
568#ifdef YY_MALLOC_DECL
569YY_MALLOC_DECL
570#else
571#if __STDC__
572#ifndef __cplusplus
573#include <stdlib.h>
574#endif
575#else
576/* Just try to get by without declaring the routines. This will fail
577 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
578 * or sizeof(void*) != sizeof(int).
579 */
580#endif
581#endif
582
583/* Amount of stuff to slurp up with each read. */
584#ifndef YY_READ_BUF_SIZE
585#define YY_READ_BUF_SIZE 8192
586#endif
587
588/* Copy whatever the last rule matched to the standard output. */
589
590#ifndef ECHO
591/* This used to be an fputs(), but since the string might contain NUL's,
592 * we now use fwrite().
593 */
594#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
595#endif
596
597/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
598 * is returned in "result".
599 */
600#ifndef YY_INPUT
601#define YY_INPUT(buf,result,max_size) \
602 if ( yy_current_buffer->yy_is_interactive ) \
603 { \
604 int c = '*', n; \
605 for ( n = 0; n < max_size && \
606 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
607 buf[n] = (char) c; \
608 if ( c == '\n' ) \
609 buf[n++] = (char) c; \
610 if ( c == EOF && ferror( yyin ) ) \
611 YY_FATAL_ERROR( "input in flex scanner failed" ); \
612 result = n; \
613 } \
614 else \
615 { \
616 errno=0; \
617 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
618 { \
619 if( errno != EINTR) \
620 { \
621 YY_FATAL_ERROR( "input in flex scanner failed" ); \
622 break; \
623 } \
624 errno=0; \
625 clearerr(yyin); \
626 } \
627 }
628#endif
629
630/* No semi-colon after return; correct usage is to write "yyterminate();" -
631 * we don't want an extra ';' after the "return" because that will cause
632 * some compilers to complain about unreachable statements.
633 */
634#ifndef yyterminate
635#define yyterminate() return YY_NULL
636#endif
637
638/* Number of entries by which start-condition stack grows. */
639#ifndef YY_START_STACK_INCR
640#define YY_START_STACK_INCR 25
641#endif
642
643/* Report a fatal error. */
644#ifndef YY_FATAL_ERROR
645#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
646#endif
647
648/* Default declaration of generated scanner - a define so the user can
649 * easily add parameters.
650 */
651#ifndef YY_DECL
652#define YY_DECL int yylex YY_PROTO(( void ))
653#endif
654
655/* Code executed at the beginning of each rule, after yytext and yyleng
656 * have been set up.
657 */
658#ifndef YY_USER_ACTION
659#define YY_USER_ACTION
660#endif
661
662/* Code executed at the end of each rule. */
663#ifndef YY_BREAK
664#define YY_BREAK break;
665#endif
666
667#define YY_RULE_SETUP \
668 YY_USER_ACTION
669
670YY_DECL
671 {
672 yy_state_type yy_current_state;
673 char *yy_cp, *yy_bp;
674 int yy_act;
675
676#line 58 "sqlscanner.l"
677
678
679
680#line 690 "sqlscanner.cpp"
681
682 if ( yy_init )
683 {
684 yy_init = 0;
685
686#ifdef YY_USER_INIT
687 YY_USER_INIT;
688#endif
689
690 if ( ! yy_start )
691 yy_start = 1; /* first start state */
692
693 if ( ! yyin )
694 yyin = stdin;
695
696 if ( ! yyout )
697 yyout = stdout;
698
699 if ( ! yy_current_buffer )
700 yy_current_buffer =
701 yy_create_buffer( yyin, YY_BUF_SIZE );
702
703 yy_load_buffer_state();
704 }
705
706 while ( 1 ) /* loops until end-of-file is reached */
707 {
708 yy_cp = yy_c_buf_p;
709
710 /* Support of yytext. */
711 *yy_cp = yy_hold_char;
712
713 /* yy_bp points to the position in yy_ch_buf of the start of
714 * the current run.
715 */
716 yy_bp = yy_cp;
717
718 yy_current_state = yy_start;
719yy_match:
720 do
721 {
722 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
723 if ( yy_accept[yy_current_state] )
724 {
725 yy_last_accepting_state = yy_current_state;
726 yy_last_accepting_cpos = yy_cp;
727 }
728 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
729 {
730 yy_current_state = (int) yy_def[yy_current_state];
731 if ( yy_current_state >= 148 )
732 yy_c = yy_meta[(unsigned int) yy_c];
733 }
734 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
735 ++yy_cp;
736 }
737 while ( yy_base[yy_current_state] != 255 );
738
739yy_find_action:
740 yy_act = yy_accept[yy_current_state];
741 if ( yy_act == 0 )
742 { /* have to back up */
743 yy_cp = yy_last_accepting_cpos;
744 yy_current_state = yy_last_accepting_state;
745 yy_act = yy_accept[yy_current_state];
746 }
747
748 YY_DO_BEFORE_ACTION;
749
750
751do_action: /* This label is used only to access EOF actions. */
752
753
754 switch ( yy_act )
755 { /* beginning of action switch */
756 case 0: /* must back up */
757 /* undo the effects of YY_DO_BEFORE_ACTION */
758 *yy_cp = yy_hold_char;
759 yy_cp = yy_last_accepting_cpos;
760 yy_current_state = yy_last_accepting_state;
761 goto yy_find_action;
762
763case 1:
764YY_RULE_SETUP
765#line 61 "sqlscanner.l"
766{
767 ECOUNT;
768 return NOT_EQUAL;
769}
770 YY_BREAK
771case 2:
772YY_RULE_SETUP
773#line 66 "sqlscanner.l"
774{
775 ECOUNT;
776 return NOT_EQUAL2;
777}
778 YY_BREAK
779case 3:
780YY_RULE_SETUP
781#line 71 "sqlscanner.l"
782{
783 ECOUNT;
784 return '=';
785}
786 YY_BREAK
787case 4:
788YY_RULE_SETUP
789#line 76 "sqlscanner.l"
790{
791 ECOUNT;
792 return LESS_OR_EQUAL;
793}
794 YY_BREAK
795case 5:
796YY_RULE_SETUP
797#line 81 "sqlscanner.l"
798{
799 ECOUNT;
800 return GREATER_OR_EQUAL;
801}
802 YY_BREAK
803case 6:
804YY_RULE_SETUP
805#line 86 "sqlscanner.l"
806{
807 ECOUNT;
808 return SQL_IN;
809}
810 YY_BREAK
811case 7:
812YY_RULE_SETUP
813#line 91 "sqlscanner.l"
814{
815//TODO: what about hex or octal values?
816 //we're using TQString:toLongLong() here because atoll() is not so portable:
817 ECOUNT;
818 bool ok;
819 yylval.integerValue = TQString(yytext).toLongLong( &ok );
820 if (!ok) {
821 setError(i18n("Invalid integer number"),i18n("This integer number may be too large."));
822 return SCAN_ERROR;
823 }
824// yylval.integerValue = atol(yytext);
825 return INTEGER_CONST;
826}
827 YY_BREAK
828case 8:
829YY_RULE_SETUP
830#line 105 "sqlscanner.l"
831{
832 char *p = yytext;
833 if (yytext[0]=='.') { /* no integer part */
834 yylval.realValue.integer = 0;
835 }
836 else {
837 yylval.realValue.integer = atoi(p);
838 int i=0;
839 while (p && i < yyleng && *p != '.') {
840 i++;
841 p++;
842 }
843 if (i==0 || !p || *p!='.') {
844 yylval.realValue.fractional = 0;
845 return REAL_CONST;
846 }
847 }
848 /* fractional part */
849 p++;
850 yylval.realValue.fractional = atoi(p);
851 return REAL_CONST;
852}
853 YY_BREAK
854case 9:
855YY_RULE_SETUP
856#line 128 "sqlscanner.l"
857{
858 ECOUNT;
859 return AND;
860}
861 YY_BREAK
862case 10:
863YY_RULE_SETUP
864#line 133 "sqlscanner.l"
865{
866 ECOUNT;
867 return AS;
868}
869 YY_BREAK
870case 11:
871YY_RULE_SETUP
872#line 138 "sqlscanner.l"
873{
874 ECOUNT;
875 return CREATE;
876}
877 YY_BREAK
878case 12:
879YY_RULE_SETUP
880#line 143 "sqlscanner.l"
881{
882 ECOUNT;
883 return FROM;
884}
885 YY_BREAK
886case 13:
887YY_RULE_SETUP
888#line 148 "sqlscanner.l"
889{
890 ECOUNT;
891 return SQL_TYPE;
892}
893 YY_BREAK
894case 14:
895YY_RULE_SETUP
896#line 153 "sqlscanner.l"
897{
898 ECOUNT;
899 return JOIN;
900}
901 YY_BREAK
902case 15:
903YY_RULE_SETUP
904#line 158 "sqlscanner.l"
905{
906 ECOUNT;
907 return LEFT;
908}
909 YY_BREAK
910case 16:
911YY_RULE_SETUP
912#line 163 "sqlscanner.l"
913{
914 ECOUNT;
915 return LIKE;
916}
917 YY_BREAK
918case 17:
919YY_RULE_SETUP
920#line 168 "sqlscanner.l"
921{
922 ECOUNT;
923 return NOT_SIMILAR_TO;
924}
925 YY_BREAK
926case 18:
927YY_RULE_SETUP
928#line 173 "sqlscanner.l"
929{
930 ECOUNT;
931 return SIMILAR_TO;
932}
933 YY_BREAK
934case 19:
935YY_RULE_SETUP
936#line 178 "sqlscanner.l"
937{
938 ECOUNT;
939 return SQL_IS_NOT_NULL;
940}
941 YY_BREAK
942case 20:
943YY_RULE_SETUP
944#line 183 "sqlscanner.l"
945{
946 ECOUNT;
947 return SQL_IS_NULL;
948}
949 YY_BREAK
950case 21:
951YY_RULE_SETUP
952#line 188 "sqlscanner.l"
953{
954 ECOUNT;
955 return NOT;
956}
957 YY_BREAK
958case 22:
959YY_RULE_SETUP
960#line 193 "sqlscanner.l"
961{
962 ECOUNT;
963 return SQL_IS;
964}
965 YY_BREAK
966case 23:
967YY_RULE_SETUP
968#line 198 "sqlscanner.l"
969{
970 ECOUNT;
971 return SQL_NULL;
972}
973 YY_BREAK
974case 24:
975YY_RULE_SETUP
976#line 203 "sqlscanner.l"
977{
978 ECOUNT;
979 return SQL_ON;
980}
981 YY_BREAK
982case 25:
983YY_RULE_SETUP
984#line 208 "sqlscanner.l"
985{
986 ECOUNT;
987 return OR;
988}
989 YY_BREAK
990case 26:
991YY_RULE_SETUP
992#line 213 "sqlscanner.l"
993{ /* also means OR for numbers (mysql) */
994 ECOUNT;
995 return CONCATENATION;
996}
997 YY_BREAK
998case 27:
999YY_RULE_SETUP
1000#line 218 "sqlscanner.l"
1001{
1002 ECOUNT;
1003 return BITWISE_SHIFT_LEFT;
1004}
1005 YY_BREAK
1006case 28:
1007YY_RULE_SETUP
1008#line 223 "sqlscanner.l"
1009{
1010 ECOUNT;
1011 return BITWISE_SHIFT_RIGHT;
1012}
1013 YY_BREAK
1014case 29:
1015YY_RULE_SETUP
1016#line 228 "sqlscanner.l"
1017{
1018 ECOUNT;
1019 return XOR;
1020}
1021 YY_BREAK
1022case 30:
1023YY_RULE_SETUP
1024#line 233 "sqlscanner.l"
1025{
1026 ECOUNT;
1027 return RIGHT;
1028}
1029 YY_BREAK
1030case 31:
1031YY_RULE_SETUP
1032#line 238 "sqlscanner.l"
1033{
1034 ECOUNT;
1035 return SELECT;
1036}
1037 YY_BREAK
1038case 32:
1039YY_RULE_SETUP
1040#line 243 "sqlscanner.l"
1041{
1042 ECOUNT;
1043 return TABLE;
1044}
1045 YY_BREAK
1046case 33:
1047YY_RULE_SETUP
1048#line 248 "sqlscanner.l"
1049{
1050 ECOUNT;
1051 return WHERE;
1052}
1053 YY_BREAK
1054case 34:
1055YY_RULE_SETUP
1056#line 253 "sqlscanner.l"
1057{
1058 ECOUNT;
1059 return ORDER;
1060}
1061 YY_BREAK
1062case 35:
1063YY_RULE_SETUP
1064#line 258 "sqlscanner.l"
1065{
1066 ECOUNT;
1067 return BY;
1068}
1069 YY_BREAK
1070case 36:
1071YY_RULE_SETUP
1072#line 263 "sqlscanner.l"
1073{
1074 ECOUNT;
1075 return ASC;
1076}
1077 YY_BREAK
1078case 37:
1079YY_RULE_SETUP
1080#line 268 "sqlscanner.l"
1081{
1082 ECOUNT;
1083 return DESC;
1084}
1085 YY_BREAK
1086case 38:
1087YY_RULE_SETUP
1088#line 273 "sqlscanner.l"
1089{
1090 ECOUNT;
1091 yylval.stringValue = new TQString(TQString::fromUtf8(yytext+1, yyleng-2));
1092 return CHARACTER_STRING_LITERAL;
1093
1094/* "ZZZ" sentinel for script */
1095}
1096 YY_BREAK
1097case 39:
1098YY_RULE_SETUP
1099#line 281 "sqlscanner.l"
1100{
1101 KexiDBDbg << "yytext: '" << yytext << "' (" << yyleng << ")" << endl;
1102 ECOUNT;
1103 yylval.stringValue = new TQString(TQString::fromUtf8(yytext, yyleng));
1104 if (yytext[0]>='0' && yytext[0]<='9') {
1105 setError(i18n("Invalid identifier"),
1106 i18n("Identifiers should start with a letter or '_' character"));
1107 return SCAN_ERROR;
1108 }
1109 return IDENTIFIER;
1110}
1111 YY_BREAK
1112case 40:
1113YY_RULE_SETUP
1114#line 293 "sqlscanner.l"
1115{
1116 KexiDBDbg << "yytext: '" << yytext << "' (" << yyleng << ")" << endl;
1117 ECOUNT;
1118 yylval.stringValue = new TQString(TQString::fromUtf8(yytext+1, yyleng-2));
1119 return QUERY_PARAMETER;
1120}
1121 YY_BREAK
1122case 41:
1123YY_RULE_SETUP
1124#line 300 "sqlscanner.l"
1125{
1126 ECOUNT;
1127}
1128 YY_BREAK
1129case 42:
1130YY_RULE_SETUP
1131#line 304 "sqlscanner.l"
1132{
1133 KexiDBDbg << "char: '" << yytext[0] << "'" << endl;
1134 ECOUNT;
1135 return yytext[0];
1136}
1137 YY_BREAK
1138case 43:
1139YY_RULE_SETUP
1140#line 310 "sqlscanner.l"
1141ECHO;
1142 YY_BREAK
1143#line 1153 "sqlscanner.cpp"
1144case YY_STATE_EOF(INITIAL):
1145 yyterminate();
1146
1147 case YY_END_OF_BUFFER:
1148 {
1149 /* Amount of text matched not including the EOB char. */
1150 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1151
1152 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1153 *yy_cp = yy_hold_char;
1154 YY_RESTORE_YY_MORE_OFFSET
1155
1156 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1157 {
1158 /* We're scanning a new file or input source. It's
1159 * possible that this happened because the user
1160 * just pointed yyin at a new source and called
1161 * yylex(). If so, then we have to assure
1162 * consistency between yy_current_buffer and our
1163 * globals. Here is the right place to do so, because
1164 * this is the first action (other than possibly a
1165 * back-up) that will match for the new input source.
1166 */
1167 yy_n_chars = yy_current_buffer->yy_n_chars;
1168 yy_current_buffer->yy_input_file = yyin;
1169 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1170 }
1171
1172 /* Note that here we test for yy_c_buf_p "<=" to the position
1173 * of the first EOB in the buffer, since yy_c_buf_p will
1174 * already have been incremented past the NUL character
1175 * (since all states make transitions on EOB to the
1176 * end-of-buffer state). Contrast this with the test
1177 * in input().
1178 */
1179 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1180 { /* This was really a NUL. */
1181 yy_state_type yy_next_state;
1182
1183 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1184
1185 yy_current_state = yy_get_previous_state();
1186
1187 /* Okay, we're now positioned to make the NUL
1188 * transition. We couldn't have
1189 * yy_get_previous_state() go ahead and do it
1190 * for us because it doesn't know how to deal
1191 * with the possibility of jamming (and we don't
1192 * want to build jamming into it because then it
1193 * will run more slowly).
1194 */
1195
1196 yy_next_state = yy_try_NUL_trans( yy_current_state );
1197
1198 yy_bp = yytext_ptr + YY_MORE_ADJ;
1199
1200 if ( yy_next_state )
1201 {
1202 /* Consume the NUL. */
1203 yy_cp = ++yy_c_buf_p;
1204 yy_current_state = yy_next_state;
1205 goto yy_match;
1206 }
1207
1208 else
1209 {
1210 yy_cp = yy_c_buf_p;
1211 goto yy_find_action;
1212 }
1213 }
1214
1215 else switch ( yy_get_next_buffer() )
1216 {
1217 case EOB_ACT_END_OF_FILE:
1218 {
1219 yy_did_buffer_switch_on_eof = 0;
1220
1221 if ( yywrap() )
1222 {
1223 /* Note: because we've taken care in
1224 * yy_get_next_buffer() to have set up
1225 * yytext, we can now set up
1226 * yy_c_buf_p so that if some total
1227 * hoser (like flex itself) wants to
1228 * call the scanner after we return the
1229 * YY_NULL, it'll still work - another
1230 * YY_NULL will get returned.
1231 */
1232 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1233
1234 yy_act = YY_STATE_EOF(YY_START);
1235 goto do_action;
1236 }
1237
1238 else
1239 {
1240 if ( ! yy_did_buffer_switch_on_eof )
1241 YY_NEW_FILE;
1242 }
1243 break;
1244 }
1245
1246 case EOB_ACT_CONTINUE_SCAN:
1247 yy_c_buf_p =
1248 yytext_ptr + yy_amount_of_matched_text;
1249
1250 yy_current_state = yy_get_previous_state();
1251
1252 yy_cp = yy_c_buf_p;
1253 yy_bp = yytext_ptr + YY_MORE_ADJ;
1254 goto yy_match;
1255
1256 case EOB_ACT_LAST_MATCH:
1257 yy_c_buf_p =
1258 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1259
1260 yy_current_state = yy_get_previous_state();
1261
1262 yy_cp = yy_c_buf_p;
1263 yy_bp = yytext_ptr + YY_MORE_ADJ;
1264 goto yy_find_action;
1265 }
1266 break;
1267 }
1268
1269 default:
1270 YY_FATAL_ERROR(
1271 "fatal flex scanner internal error--no action found" );
1272 } /* end of action switch */
1273 } /* end of scanning one token */
1274 } /* end of yylex */
1275
1276
1277/* yy_get_next_buffer - try to read in a new buffer
1278 *
1279 * Returns a code representing an action:
1280 * EOB_ACT_LAST_MATCH -
1281 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1282 * EOB_ACT_END_OF_FILE - end of file
1283 */
1284
1285static int yy_get_next_buffer()
1286 {
1287 char *dest = yy_current_buffer->yy_ch_buf;
1288 char *source = yytext_ptr;
1289 int number_to_move, i;
1290 int ret_val;
1291
1292 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1293 YY_FATAL_ERROR(
1294 "fatal flex scanner internal error--end of buffer missed" );
1295
1296 if ( yy_current_buffer->yy_fill_buffer == 0 )
1297 { /* Don't try to fill the buffer, so this is an EOF. */
1298 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1299 {
1300 /* We matched a single character, the EOB, so
1301 * treat this as a final EOF.
1302 */
1303 return EOB_ACT_END_OF_FILE;
1304 }
1305
1306 else
1307 {
1308 /* We matched some text prior to the EOB, first
1309 * process it.
1310 */
1311 return EOB_ACT_LAST_MATCH;
1312 }
1313 }
1314
1315 /* Try to read more data. */
1316
1317 /* First move last chars to start of buffer. */
1318 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1319
1320 for ( i = 0; i < number_to_move; ++i )
1321 *(dest++) = *(source++);
1322
1323 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1324 /* don't do the read, it's not guaranteed to return an EOF,
1325 * just force an EOF
1326 */
1327 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1328
1329 else
1330 {
1331 int num_to_read =
1332 yy_current_buffer->yy_buf_size - number_to_move - 1;
1333
1334 while ( num_to_read <= 0 )
1335 { /* Not enough room in the buffer - grow it. */
1336#ifdef YY_USES_REJECT
1337 YY_FATAL_ERROR(
1338"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1339#else
1340
1341 /* just a shorter name for the current buffer */
1342 YY_BUFFER_STATE b = yy_current_buffer;
1343
1344 int yy_c_buf_p_offset =
1345 (int) (yy_c_buf_p - b->yy_ch_buf);
1346
1347 if ( b->yy_is_our_buffer )
1348 {
1349 int new_size = b->yy_buf_size * 2;
1350
1351 if ( new_size <= 0 )
1352 b->yy_buf_size += b->yy_buf_size / 8;
1353 else
1354 b->yy_buf_size *= 2;
1355
1356 b->yy_ch_buf = (char *)
1357 /* Include room in for 2 EOB chars. */
1358 yy_flex_realloc( (void *) b->yy_ch_buf,
1359 b->yy_buf_size + 2 );
1360 }
1361 else
1362 /* Can't grow it, we don't own it. */
1363 b->yy_ch_buf = 0;
1364
1365 if ( ! b->yy_ch_buf )
1366 YY_FATAL_ERROR(
1367 "fatal error - scanner input buffer overflow" );
1368
1369 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1370
1371 num_to_read = yy_current_buffer->yy_buf_size -
1372 number_to_move - 1;
1373#endif
1374 }
1375
1376 if ( num_to_read > YY_READ_BUF_SIZE )
1377 num_to_read = YY_READ_BUF_SIZE;
1378
1379 /* Read in more data. */
1380 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1381 yy_n_chars, num_to_read );
1382
1383 yy_current_buffer->yy_n_chars = yy_n_chars;
1384 }
1385
1386 if ( yy_n_chars == 0 )
1387 {
1388 if ( number_to_move == YY_MORE_ADJ )
1389 {
1390 ret_val = EOB_ACT_END_OF_FILE;
1391 yyrestart( yyin );
1392 }
1393
1394 else
1395 {
1396 ret_val = EOB_ACT_LAST_MATCH;
1397 yy_current_buffer->yy_buffer_status =
1398 YY_BUFFER_EOF_PENDING;
1399 }
1400 }
1401
1402 else
1403 ret_val = EOB_ACT_CONTINUE_SCAN;
1404
1405 yy_n_chars += number_to_move;
1406 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1407 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1408
1409 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1410
1411 return ret_val;
1412 }
1413
1414
1415/* yy_get_previous_state - get the state just before the EOB char was reached */
1416
1417static yy_state_type yy_get_previous_state()
1418 {
1419 yy_state_type yy_current_state;
1420 char *yy_cp;
1421
1422 yy_current_state = yy_start;
1423
1424 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1425 {
1426 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1427 if ( yy_accept[yy_current_state] )
1428 {
1429 yy_last_accepting_state = yy_current_state;
1430 yy_last_accepting_cpos = yy_cp;
1431 }
1432 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1433 {
1434 yy_current_state = (int) yy_def[yy_current_state];
1435 if ( yy_current_state >= 148 )
1436 yy_c = yy_meta[(unsigned int) yy_c];
1437 }
1438 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1439 }
1440
1441 return yy_current_state;
1442 }
1443
1444
1445/* yy_try_NUL_trans - try to make a transition on the NUL character
1446 *
1447 * synopsis
1448 * next_state = yy_try_NUL_trans( current_state );
1449 */
1450
1451#ifdef YY_USE_PROTOS
1452static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1453#else
1454static yy_state_type yy_try_NUL_trans( yy_current_state )
1455yy_state_type yy_current_state;
1456#endif
1457 {
1458 int yy_is_jam;
1459 char *yy_cp = yy_c_buf_p;
1460
1461 YY_CHAR yy_c = 1;
1462 if ( yy_accept[yy_current_state] )
1463 {
1464 yy_last_accepting_state = yy_current_state;
1465 yy_last_accepting_cpos = yy_cp;
1466 }
1467 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1468 {
1469 yy_current_state = (int) yy_def[yy_current_state];
1470 if ( yy_current_state >= 148 )
1471 yy_c = yy_meta[(unsigned int) yy_c];
1472 }
1473 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1474 yy_is_jam = (yy_current_state == 147);
1475
1476 return yy_is_jam ? 0 : yy_current_state;
1477 }
1478
1479
1480#ifndef YY_NO_UNPUT
1481#ifdef YY_USE_PROTOS
1482static void yyunput( int c, char *yy_bp )
1483#else
1484static void yyunput( c, yy_bp )
1485int c;
1486char *yy_bp;
1487#endif
1488 {
1489 char *yy_cp = yy_c_buf_p;
1490
1491 /* undo effects of setting up yytext */
1492 *yy_cp = yy_hold_char;
1493
1494 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1495 { /* need to shift things up to make room */
1496 /* +2 for EOB chars. */
1497 int number_to_move = yy_n_chars + 2;
1498 char *dest = &yy_current_buffer->yy_ch_buf[
1499 yy_current_buffer->yy_buf_size + 2];
1500 char *source =
1501 &yy_current_buffer->yy_ch_buf[number_to_move];
1502
1503 while ( source > yy_current_buffer->yy_ch_buf )
1504 *--dest = *--source;
1505
1506 yy_cp += (int) (dest - source);
1507 yy_bp += (int) (dest - source);
1508 yy_current_buffer->yy_n_chars =
1509 yy_n_chars = yy_current_buffer->yy_buf_size;
1510
1511 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1512 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1513 }
1514
1515 *--yy_cp = (char) c;
1516
1517
1518 yytext_ptr = yy_bp;
1519 yy_hold_char = *yy_cp;
1520 yy_c_buf_p = yy_cp;
1521 }
1522#endif /* ifndef YY_NO_UNPUT */
1523
1524
1525#ifdef __cplusplus
1526static int yyinput()
1527#else
1528static int input()
1529#endif
1530 {
1531 int c;
1532
1533 *yy_c_buf_p = yy_hold_char;
1534
1535 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1536 {
1537 /* yy_c_buf_p now points to the character we want to return.
1538 * If this occurs *before* the EOB characters, then it's a
1539 * valid NUL; if not, then we've hit the end of the buffer.
1540 */
1541 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1542 /* This was really a NUL. */
1543 *yy_c_buf_p = '\0';
1544
1545 else
1546 { /* need more input */
1547 int offset = yy_c_buf_p - yytext_ptr;
1548 ++yy_c_buf_p;
1549
1550 switch ( yy_get_next_buffer() )
1551 {
1552 case EOB_ACT_LAST_MATCH:
1553 /* This happens because yy_g_n_b()
1554 * sees that we've accumulated a
1555 * token and flags that we need to
1556 * try matching the token before
1557 * proceeding. But for input(),
1558 * there's no matching to consider.
1559 * So convert the EOB_ACT_LAST_MATCH
1560 * to EOB_ACT_END_OF_FILE.
1561 */
1562
1563 /* Reset buffer status. */
1564 yyrestart( yyin );
1565
1566 /* fall through */
1567
1568 case EOB_ACT_END_OF_FILE:
1569 {
1570 if ( yywrap() )
1571 return EOF;
1572
1573 if ( ! yy_did_buffer_switch_on_eof )
1574 YY_NEW_FILE;
1575#ifdef __cplusplus
1576 return yyinput();
1577#else
1578 return input();
1579#endif
1580 }
1581
1582 case EOB_ACT_CONTINUE_SCAN:
1583 yy_c_buf_p = yytext_ptr + offset;
1584 break;
1585 }
1586 }
1587 }
1588
1589 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1590 *yy_c_buf_p = '\0'; /* preserve yytext */
1591 yy_hold_char = *++yy_c_buf_p;
1592
1593
1594 return c;
1595 }
1596
1597
1598#ifdef YY_USE_PROTOS
1599void yyrestart( FILE *input_file )
1600#else
1601void yyrestart( input_file )
1602FILE *input_file;
1603#endif
1604 {
1605 if ( ! yy_current_buffer )
1606 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1607
1608 yy_init_buffer( yy_current_buffer, input_file );
1609 yy_load_buffer_state();
1610 }
1611
1612
1613#ifdef YY_USE_PROTOS
1614void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1615#else
1616void yy_switch_to_buffer( new_buffer )
1617YY_BUFFER_STATE new_buffer;
1618#endif
1619 {
1620 if ( yy_current_buffer == new_buffer )
1621 return;
1622
1623 if ( yy_current_buffer )
1624 {
1625 /* Flush out information for old buffer. */
1626 *yy_c_buf_p = yy_hold_char;
1627 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1628 yy_current_buffer->yy_n_chars = yy_n_chars;
1629 }
1630
1631 yy_current_buffer = new_buffer;
1632 yy_load_buffer_state();
1633
1634 /* We don't actually know whether we did this switch during
1635 * EOF (yywrap()) processing, but the only time this flag
1636 * is looked at is after yywrap() is called, so it's safe
1637 * to go ahead and always set it.
1638 */
1639 yy_did_buffer_switch_on_eof = 1;
1640 }
1641
1642
1643#ifdef YY_USE_PROTOS
1644void yy_load_buffer_state( void )
1645#else
1646void yy_load_buffer_state()
1647#endif
1648 {
1649 yy_n_chars = yy_current_buffer->yy_n_chars;
1650 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1651 yyin = yy_current_buffer->yy_input_file;
1652 yy_hold_char = *yy_c_buf_p;
1653 }
1654
1655
1656#ifdef YY_USE_PROTOS
1657YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1658#else
1659YY_BUFFER_STATE yy_create_buffer( file, size )
1660FILE *file;
1661int size;
1662#endif
1663 {
1664 YY_BUFFER_STATE b;
1665
1666 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1667 if ( ! b )
1668 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1669
1670 b->yy_buf_size = size;
1671
1672 /* yy_ch_buf has to be 2 characters longer than the size given because
1673 * we need to put in 2 end-of-buffer characters.
1674 */
1675 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1676 if ( ! b->yy_ch_buf )
1677 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1678
1679 b->yy_is_our_buffer = 1;
1680
1681 yy_init_buffer( b, file );
1682
1683 return b;
1684 }
1685
1686
1687#ifdef YY_USE_PROTOS
1688void yy_delete_buffer( YY_BUFFER_STATE b )
1689#else
1690void yy_delete_buffer( b )
1691YY_BUFFER_STATE b;
1692#endif
1693 {
1694 if ( ! b )
1695 return;
1696
1697 if ( b == yy_current_buffer )
1698 yy_current_buffer = (YY_BUFFER_STATE) 0;
1699
1700 if ( b->yy_is_our_buffer )
1701 yy_flex_free( (void *) b->yy_ch_buf );
1702
1703 yy_flex_free( (void *) b );
1704 }
1705
1706
1707#ifndef _WIN32
1708#include <unistd.h>
1709#else
1710#ifndef YY_ALWAYS_INTERACTIVE
1711#ifndef YY_NEVER_INTERACTIVE
1712extern int isatty YY_PROTO(( int ));
1713#endif
1714#endif
1715#endif
1716
1717#ifdef YY_USE_PROTOS
1718void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1719#else
1720void yy_init_buffer( b, file )
1721YY_BUFFER_STATE b;
1722FILE *file;
1723#endif
1724
1725
1726 {
1727 yy_flush_buffer( b );
1728
1729 b->yy_input_file = file;
1730 b->yy_fill_buffer = 1;
1731
1732#ifdef YY_ALWAYS_INTERACTIVE
1733 b->yy_is_interactive = 1;
1734#else
1735#ifdef YY_NEVER_INTERACTIVE
1736 b->yy_is_interactive = 0;
1737#else
1738 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1739#endif
1740#endif
1741 }
1742
1743
1744#ifdef YY_USE_PROTOS
1745void yy_flush_buffer( YY_BUFFER_STATE b )
1746#else
1747void yy_flush_buffer( b )
1748YY_BUFFER_STATE b;
1749#endif
1750
1751 {
1752 if ( ! b )
1753 return;
1754
1755 b->yy_n_chars = 0;
1756
1757 /* We always need two end-of-buffer characters. The first causes
1758 * a transition to the end-of-buffer state. The second causes
1759 * a jam in that state.
1760 */
1761 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1762 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1763
1764 b->yy_buf_pos = &b->yy_ch_buf[0];
1765
1766 b->yy_at_bol = 1;
1767 b->yy_buffer_status = YY_BUFFER_NEW;
1768
1769 if ( b == yy_current_buffer )
1770 yy_load_buffer_state();
1771 }
1772
1773
1774#ifndef YY_NO_SCAN_BUFFER
1775#ifdef YY_USE_PROTOS
1776YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1777#else
1778YY_BUFFER_STATE yy_scan_buffer( base, size )
1779char *base;
1780yy_size_t size;
1781#endif
1782 {
1783 YY_BUFFER_STATE b;
1784
1785 if ( size < 2 ||
1786 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1787 base[size-1] != YY_END_OF_BUFFER_CHAR )
1788 /* They forgot to leave room for the EOB's. */
1789 return 0;
1790
1791 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1792 if ( ! b )
1793 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1794
1795 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1796 b->yy_buf_pos = b->yy_ch_buf = base;
1797 b->yy_is_our_buffer = 0;
1798 b->yy_input_file = 0;
1799 b->yy_n_chars = b->yy_buf_size;
1800 b->yy_is_interactive = 0;
1801 b->yy_at_bol = 1;
1802 b->yy_fill_buffer = 0;
1803 b->yy_buffer_status = YY_BUFFER_NEW;
1804
1805 yy_switch_to_buffer( b );
1806
1807 return b;
1808 }
1809#endif
1810
1811
1812#ifndef YY_NO_SCAN_STRING
1813#ifdef YY_USE_PROTOS
1814YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1815#else
1816YY_BUFFER_STATE yy_scan_string( yy_str )
1817yyconst char *yy_str;
1818#endif
1819 {
1820 int len;
1821 for ( len = 0; yy_str[len]; ++len )
1822 ;
1823
1824 return yy_scan_bytes( yy_str, len );
1825 }
1826#endif
1827
1828
1829#ifndef YY_NO_SCAN_BYTES
1830#ifdef YY_USE_PROTOS
1831YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1832#else
1833YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1834yyconst char *bytes;
1835int len;
1836#endif
1837 {
1838 YY_BUFFER_STATE b;
1839 char *buf;
1840 yy_size_t n;
1841 int i;
1842
1843 /* Get memory for full buffer, including space for trailing EOB's. */
1844 n = len + 2;
1845 buf = (char *) yy_flex_alloc( n );
1846 if ( ! buf )
1847 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1848
1849 for ( i = 0; i < len; ++i )
1850 buf[i] = bytes[i];
1851
1852 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1853
1854 b = yy_scan_buffer( buf, n );
1855 if ( ! b )
1856 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1857
1858 /* It's okay to grow etc. this buffer, and we should throw it
1859 * away when we're done.
1860 */
1861 b->yy_is_our_buffer = 1;
1862
1863 return b;
1864 }
1865#endif
1866
1867
1868#ifndef YY_NO_PUSH_STATE
1869#ifdef YY_USE_PROTOS
1870static void yy_push_state( int new_state )
1871#else
1872static void yy_push_state( new_state )
1873int new_state;
1874#endif
1875 {
1876 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1877 {
1878 yy_size_t new_size;
1879
1880 yy_start_stack_depth += YY_START_STACK_INCR;
1881 new_size = yy_start_stack_depth * sizeof( int );
1882
1883 if ( ! yy_start_stack )
1884 yy_start_stack = (int *) yy_flex_alloc( new_size );
1885
1886 else
1887 yy_start_stack = (int *) yy_flex_realloc(
1888 (void *) yy_start_stack, new_size );
1889
1890 if ( ! yy_start_stack )
1891 YY_FATAL_ERROR(
1892 "out of memory expanding start-condition stack" );
1893 }
1894
1895 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1896
1897 BEGIN(new_state);
1898 }
1899#endif
1900
1901
1902#ifndef YY_NO_POP_STATE
1903static void yy_pop_state()
1904 {
1905 if ( --yy_start_stack_ptr < 0 )
1906 YY_FATAL_ERROR( "start-condition stack underflow" );
1907
1908 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1909 }
1910#endif
1911
1912
1913#ifndef YY_NO_TOP_STATE
1914static int yy_top_state()
1915 {
1916 return yy_start_stack[yy_start_stack_ptr - 1];
1917 }
1918#endif
1919
1920#ifndef YY_EXIT_FAILURE
1921#define YY_EXIT_FAILURE 2
1922#endif
1923
1924#ifdef YY_USE_PROTOS
1925static void yy_fatal_error( yyconst char msg[] )
1926#else
1927static void yy_fatal_error( msg )
1928char msg[];
1929#endif
1930 {
1931 (void) fprintf( stderr, "%s\n", msg );
1932 exit( YY_EXIT_FAILURE );
1933 }
1934
1935
1936
1937/* Redefine yyless() so it works in section 3 code. */
1938
1939#undef yyless
1940#define yyless(n) \
1941 do \
1942 { \
1943 /* Undo effects of setting up yytext. */ \
1944 yytext[yyleng] = yy_hold_char; \
1945 yy_c_buf_p = yytext + n; \
1946 yy_hold_char = *yy_c_buf_p; \
1947 *yy_c_buf_p = '\0'; \
1948 yyleng = n; \
1949 } \
1950 while ( 0 )
1951
1952
1953/* Internal utility routines. */
1954
1955#ifndef yytext_ptr
1956#ifdef YY_USE_PROTOS
1957static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1958#else
1959static void yy_flex_strncpy( s1, s2, n )
1960char *s1;
1961yyconst char *s2;
1962int n;
1963#endif
1964 {
1965 int i;
1966 for ( i = 0; i < n; ++i )
1967 s1[i] = s2[i];
1968 }
1969#endif
1970
1971#ifdef YY_NEED_STRLEN
1972#ifdef YY_USE_PROTOS
1973static int yy_flex_strlen( yyconst char *s )
1974#else
1975static int yy_flex_strlen( s )
1976yyconst char *s;
1977#endif
1978 {
1979 int n;
1980 for ( n = 0; s[n]; ++n )
1981 ;
1982
1983 return n;
1984 }
1985#endif
1986
1987
1988#ifdef YY_USE_PROTOS
1989static void *yy_flex_alloc( yy_size_t size )
1990#else
1991static void *yy_flex_alloc( size )
1992yy_size_t size;
1993#endif
1994 {
1995 return (void *) malloc( size );
1996 }
1997
1998#ifdef YY_USE_PROTOS
1999static void *yy_flex_realloc( void *ptr, yy_size_t size )
2000#else
2001static void *yy_flex_realloc( ptr, size )
2002void *ptr;
2003yy_size_t size;
2004#endif
2005 {
2006 /* The cast to (char *) in the following accommodates both
2007 * implementations that use char* generic pointers, and those
2008 * that use void* generic pointers. It works with the latter
2009 * because both ANSI C and C++ allow castless assignment from
2010 * any pointer type to void*, and deal with argument conversions
2011 * as though doing an assignment.
2012 */
2013 return (void *) realloc( (char *) ptr, size );
2014 }
2015
2016#ifdef YY_USE_PROTOS
2017static void yy_flex_free( void *ptr )
2018#else
2019static void yy_flex_free( ptr )
2020void *ptr;
2021#endif
2022 {
2023 free( ptr );
2024 }
2025
2026#ifdef YY_MAIN
2027int main()
2028 {
2029 yylex();
2030 return 0;
2031 }
2032#endif
2033#line 310 "sqlscanner.l"
2034
2035
2036void tokenize(const char *data)
2037{
2038 yy_switch_to_buffer(yy_scan_string(data));
2039 ctoken = "";
2040 current = 0;
2041}
2042