~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to kexi/kexidb/parser/sqlscanner.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

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