kexi

sqlscanner.cpp

00001 #line 2 "sqlscanner.cpp"
00002 /* A lexical scanner generated by flex */
00003 
00004 /* Scanner skeleton version:
00005  * $Header$
00006  */
00007 
00008 #define FLEX_SCANNER
00009 #define YY_FLEX_MAJOR_VERSION 2
00010 #define YY_FLEX_MINOR_VERSION 5
00011 
00012 #include <stdio.h>
00013 
00014 
00015 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
00016 #ifdef c_plusplus
00017 #ifndef __cplusplus
00018 #define __cplusplus
00019 #endif
00020 #endif
00021 
00022 
00023 #ifdef __cplusplus
00024 
00025 #include <stdlib.h>
00026 #include <unistd.h>
00027 
00028 /* Use prototypes in function declarations. */
00029 #define YY_USE_PROTOS
00030 
00031 /* The "const" storage-class-modifier is valid. */
00032 #define YY_USE_CONST
00033 
00034 #else   /* ! __cplusplus */
00035 
00036 #if __STDC__
00037 
00038 #define YY_USE_PROTOS
00039 #define YY_USE_CONST
00040 
00041 #endif  /* __STDC__ */
00042 #endif  /* ! __cplusplus */
00043 
00044 #ifdef __TURBOC__
00045  #pragma warn -rch
00046  #pragma warn -use
00047 #include <io.h>
00048 #include <stdlib.h>
00049 #define YY_USE_CONST
00050 #define YY_USE_PROTOS
00051 #endif
00052 
00053 #ifdef YY_USE_CONST
00054 #define yyconst const
00055 #else
00056 #define yyconst
00057 #endif
00058 
00059 
00060 #ifdef YY_USE_PROTOS
00061 #define YY_PROTO(proto) proto
00062 #else
00063 #define YY_PROTO(proto) ()
00064 #endif
00065 
00066 /* Returned upon end-of-file. */
00067 #define YY_NULL 0
00068 
00069 /* Promotes a possibly negative, possibly signed char to an unsigned
00070  * integer for use as an array index.  If the signed char is negative,
00071  * we want to instead treat it as an 8-bit unsigned char, hence the
00072  * double cast.
00073  */
00074 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00075 
00076 /* Enter a start condition.  This macro really ought to take a parameter,
00077  * but we do it the disgusting crufty way forced on us by the ()-less
00078  * definition of BEGIN.
00079  */
00080 #define BEGIN yy_start = 1 + 2 *
00081 
00082 /* Translate the current start state into a value that can be later handed
00083  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00084  * compatibility.
00085  */
00086 #define YY_START ((yy_start - 1) / 2)
00087 #define YYSTATE YY_START
00088 
00089 /* Action number for EOF rule of a given start state. */
00090 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00091 
00092 /* Special action meaning "start processing a new file". */
00093 #define YY_NEW_FILE yyrestart( yyin )
00094 
00095 #define YY_END_OF_BUFFER_CHAR 0
00096 
00097 /* Size of default input buffer. */
00098 #define YY_BUF_SIZE 16384
00099 
00100 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00101 
00102 extern int yyleng;
00103 extern FILE *yyin, *yyout;
00104 
00105 #define EOB_ACT_CONTINUE_SCAN 0
00106 #define EOB_ACT_END_OF_FILE 1
00107 #define EOB_ACT_LAST_MATCH 2
00108 
00109 /* The funky do-while in the following #define is used to turn the definition
00110  * int a single C statement (which needs a semi-colon terminator).  This
00111  * avoids problems with code like:
00112  *
00113  *  if ( condition_holds )
00114  *      yyless( 5 );
00115  *  else
00116  *      do_something_else();
00117  *
00118  * Prior to using the do-while the compiler would get upset at the
00119  * "else" because it interpreted the "if" statement as being all
00120  * done when it reached the ';' after the yyless() call.
00121  */
00122 
00123 /* Return all but the first 'n' matched characters back to the input stream. */
00124 
00125 #define yyless(n) \
00126     do \
00127         { \
00128         /* Undo effects of setting up yytext. */ \
00129         *yy_cp = yy_hold_char; \
00130         YY_RESTORE_YY_MORE_OFFSET \
00131         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
00132         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00133         } \
00134     while ( 0 )
00135 
00136 #define unput(c) yyunput( c, yytext_ptr )
00137 
00138 /* The following is because we cannot portably get our hands on size_t
00139  * (without autoconf's help, which isn't available because we want
00140  * flex-generated scanners to compile on their own).
00141  */
00142 typedef unsigned int yy_size_t;
00143 
00144 
00145 struct yy_buffer_state
00146     {
00147     FILE *yy_input_file;
00148 
00149     char *yy_ch_buf;        /* input buffer */
00150     char *yy_buf_pos;       /* current position in input buffer */
00151 
00152     /* Size of input buffer in bytes, not including room for EOB
00153      * characters.
00154      */
00155     yy_size_t yy_buf_size;
00156 
00157     /* Number of characters read into yy_ch_buf, not including EOB
00158      * characters.
00159      */
00160     int yy_n_chars;
00161 
00162     /* Whether we "own" the buffer - i.e., we know we created it,
00163      * and can realloc() it to grow it, and should free() it to
00164      * delete it.
00165      */
00166     int yy_is_our_buffer;
00167 
00168     /* Whether this is an "interactive" input source; if so, and
00169      * if we're using stdio for input, then we want to use getc()
00170      * instead of fread(), to make sure we stop fetching input after
00171      * each newline.
00172      */
00173     int yy_is_interactive;
00174 
00175     /* Whether we're considered to be at the beginning of a line.
00176      * If so, '^' rules will be active on the next match, otherwise
00177      * not.
00178      */
00179     int yy_at_bol;
00180 
00181     /* Whether to try to fill the input buffer when we reach the
00182      * end of it.
00183      */
00184     int yy_fill_buffer;
00185 
00186     int yy_buffer_status;
00187 #define YY_BUFFER_NEW 0
00188 #define YY_BUFFER_NORMAL 1
00189     /* When an EOF's been seen but there's still some text to process
00190      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00191      * shouldn't try reading from the input source any more.  We might
00192      * still have a bunch of tokens to match, though, because of
00193      * possible backing-up.
00194      *
00195      * When we actually see the EOF, we change the status to "new"
00196      * (via yyrestart()), so that the user can continue scanning by
00197      * just pointing yyin at a new input file.
00198      */
00199 #define YY_BUFFER_EOF_PENDING 2
00200     };
00201 
00202 static YY_BUFFER_STATE yy_current_buffer = 0;
00203 
00204 /* We provide macros for accessing buffer states in case in the
00205  * future we want to put the buffer states in a more general
00206  * "scanner state".
00207  */
00208 #define YY_CURRENT_BUFFER yy_current_buffer
00209 
00210 
00211 /* yy_hold_char holds the character lost when yytext is formed. */
00212 static char yy_hold_char;
00213 
00214 static int yy_n_chars;      /* number of characters read into yy_ch_buf */
00215 
00216 
00217 int yyleng;
00218 
00219 /* Points to current character in buffer. */
00220 static char *yy_c_buf_p = (char *) 0;
00221 static int yy_init = 1;     /* whether we need to initialize */
00222 static int yy_start = 0;    /* start state number */
00223 
00224 /* Flag which is used to allow yywrap()'s to do buffer switches
00225  * instead of setting up a fresh yyin.  A bit of a hack ...
00226  */
00227 static int yy_did_buffer_switch_on_eof;
00228 
00229 void yyrestart YY_PROTO(( FILE *input_file ));
00230 
00231 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
00232 void yy_load_buffer_state YY_PROTO(( void ));
00233 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
00234 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
00235 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
00236 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
00237 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
00238 
00239 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
00240 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
00241 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
00242 
00243 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
00244 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
00245 static void yy_flex_free YY_PROTO(( void * ));
00246 
00247 #define yy_new_buffer yy_create_buffer
00248 
00249 #define yy_set_interactive(is_interactive) \
00250     { \
00251     if ( ! yy_current_buffer ) \
00252         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
00253     yy_current_buffer->yy_is_interactive = is_interactive; \
00254     }
00255 
00256 #define yy_set_bol(at_bol) \
00257     { \
00258     if ( ! yy_current_buffer ) \
00259         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
00260     yy_current_buffer->yy_at_bol = at_bol; \
00261     }
00262 
00263 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
00264 
00265 
00266 #define yywrap() 1
00267 #define YY_SKIP_YYWRAP
00268 typedef unsigned char YY_CHAR;
00269 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
00270 typedef int yy_state_type;
00271 extern char *yytext;
00272 #define yytext_ptr yytext
00273 
00274 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
00275 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
00276 static int yy_get_next_buffer YY_PROTO(( void ));
00277 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
00278 
00279 /* Done after the current pattern has been matched and before the
00280  * corresponding action - sets up yytext.
00281  */
00282 #define YY_DO_BEFORE_ACTION \
00283     yytext_ptr = yy_bp; \
00284     yyleng = (int) (yy_cp - yy_bp); \
00285     yy_hold_char = *yy_cp; \
00286     *yy_cp = '\0'; \
00287     yy_c_buf_p = yy_cp;
00288 
00289 #define YY_NUM_RULES 39
00290 #define YY_END_OF_BUFFER 40
00291 static yyconst short int yy_accept[136] =
00292     {   0,
00293         0,    0,   40,   39,   37,   38,   39,   38,   38,   39,
00294        38,    7,   38,   38,   38,   35,   35,   35,   35,   35,
00295        35,   35,   35,   35,   35,   35,   35,   35,   35,   38,
00296        37,    2,    0,    9,    0,   34,    8,    8,    7,   35,
00297        27,    4,    1,    3,    5,   28,   35,   10,   35,   35,
00298         6,   22,   35,   35,   35,   35,   35,   24,   25,   35,
00299        35,   35,   35,   35,   35,   26,   36,    8,    9,   35,
00300        35,   35,    0,   35,   35,   35,   21,   35,   35,   35,
00301        35,   35,   35,   29,   35,   12,   35,    0,   14,   15,
00302        16,    0,   23,   35,   35,   35,   35,   35,   35,   35,
00303 
00304         0,    0,    0,   30,   35,   35,   32,   33,   11,   35,
00305         0,    0,    0,   31,   35,   13,    0,   20,    0,   35,
00306         0,    0,    0,    0,    0,    0,    0,    0,   18,   19,
00307         0,    0,    0,   17,    0
00308     } ;
00309 
00310 static yyconst int yy_ec[256] =
00311     {   0,
00312         1,    1,    1,    1,    1,    1,    1,    1,    2,    2,
00313         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00314         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00315         1,    2,    3,    4,    5,    1,    5,    6,    7,    5,
00316         5,    5,    5,    5,    5,    8,    5,    9,    9,    9,
00317         9,    9,    9,    9,    9,    9,    9,    5,    5,   10,
00318        11,   12,    5,    5,   14,   15,   16,   17,   18,   19,
00319        20,   21,   22,   23,   24,   25,   26,   27,   28,   13,
00320        13,   29,   30,   31,   32,   13,   33,   34,   13,   13,
00321         5,    1,    5,    5,   13,    5,   14,   15,   16,   17,
00322 
00323        18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
00324        28,   13,   13,   29,   30,   31,   32,   13,   33,   34,
00325        13,   13,    1,   35,    1,    5,    1,    1,    1,    1,
00326         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00327         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00328         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00329         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00330         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00331         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00332         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00333 
00334         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00335         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00336         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00337         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00338         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00339         1,    1,    1,    1,    1
00340     } ;
00341 
00342 static yyconst int yy_meta[36] =
00343     {   0,
00344         1,    1,    1,    1,    1,    1,    1,    2,    3,    1,
00345         1,    1,    3,    3,    3,    3,    3,    3,    3,    3,
00346         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
00347         3,    3,    3,    3,    1
00348     } ;
00349 
00350 static yyconst short int yy_base[139] =
00351     {   0,
00352         0,    0,  228,  229,  225,  215,    0,  229,  219,  217,
00353       214,   28,   28,  211,   30,  213,   35,   37,   38,   41,
00354        36,   39,   42,   46,   47,   64,   44,   55,   51,  185,
00355       217,  229,  214,  229,  210,  229,  207,  206,   69,  206,
00356       229,  229,  229,  229,  229,  229,   43,  205,   72,   73,
00357        75,   83,   76,   80,   79,   81,   84,  204,  203,   85,
00358        86,   87,   89,   92,   88,  229,  229,  201,  201,   94,
00359        99,  106,  113,  108,  110,  111,  118,  113,  115,  114,
00360       120,  119,  122,  200,  123,  199,  125,  111,  198,  197,
00361       196,  132,  195,  129,   40,  138,  139,  140,  141,  147,
00362 
00363       165,  170,  172,  185,  142,  153,  184,  183,  182,  145,
00364       186,  162,  160,  177,  148,  176,  162,  229,  161,  164,
00365       150,  155,  150,  154,  164,  148,  150,  142,  229,  229,
00366       168,  166,  141,  229,  229,   50,  197,  199
00367     } ;
00368 
00369 static yyconst short int yy_def[139] =
00370     {   0,
00371       135,    1,  135,  135,  135,  135,  136,  135,  135,  137,
00372       135,  138,  135,  135,  135,  138,  138,  138,  138,  138,
00373       138,  138,  138,  138,  138,  138,  138,  138,  138,  135,
00374       135,  135,  136,  135,  137,  135,  135,  135,  138,  138,
00375       135,  135,  135,  135,  135,  135,  138,  138,  138,  138,
00376       138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
00377       138,  138,  138,  138,  138,  135,  135,  135,  138,  138,
00378       138,  138,  135,  138,  138,  138,  138,  138,  138,  138,
00379       138,  138,  138,  138,  138,  138,  138,  135,  138,  138,
00380       138,  135,  138,  138,  138,  138,  138,  138,  138,  138,
00381 
00382       135,  135,  135,  138,  138,  138,  138,  138,  138,  138,
00383       135,  135,  135,  138,  138,  138,  135,  135,  135,  138,
00384       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00385       135,  135,  135,  135,    0,  135,  135,  135
00386     } ;
00387 
00388 static yyconst short int yy_nxt[265] =
00389     {   0,
00390         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
00391        14,   15,   16,   17,   16,   18,   16,   16,   19,   16,
00392        16,   20,   21,   16,   22,   16,   23,   24,   25,   26,
00393        27,   16,   28,   29,   30,   38,   39,   41,   42,   43,
00394        45,   46,  135,  135,  135,  135,  135,  135,  135,  135,
00395       135,  135,   33,  135,  135,  105,   54,   63,  135,   69,
00396        55,   47,  135,   53,   48,   49,   50,   51,   60,   56,
00397        52,  135,   58,   57,   59,   64,   38,   39,   65,  135,
00398       135,   61,  135,  135,   73,   62,  135,  135,  135,   70,
00399       135,  135,  135,  135,  135,  135,  135,   74,   75,  135,
00400 
00401        71,  135,   76,   82,   79,   72,  135,   85,   78,   83,
00402        80,   77,   81,  135,   73,  135,   84,  135,  135,   92,
00403       135,  135,  135,   87,   86,  135,  135,  135,   91,  135,
00404       135,   95,  135,   92,   89,   94,  135,   93,  101,   88,
00405        90,   96,  102,   97,  100,  135,  135,  135,  135,  135,
00406        98,  123,  135,   99,  135,  135,  107,  108,  109,  104,
00407       135,  103,  106,  117,  110,  123,  115,  132,  134,  132,
00408       131,  135,  114,  116,  130,  129,  120,  128,  127,  125,
00409       126,  124,  122,  135,  135,  119,  118,  117,  121,  135,
00410       135,  135,  135,  113,  112,  111,  133,   35,   35,   35,
00411 
00412        40,   40,  135,  135,  135,  135,  135,  135,  135,   68,
00413       135,  135,  135,  135,   68,   37,   36,   67,   31,   66,
00414       135,   44,   37,   36,   34,   32,   31,  135,    3,  135,
00415       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00416       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00417       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00418       135,  135,  135,  135
00419     } ;
00420 
00421 static yyconst short int yy_chk[265] =
00422     {   0,
00423         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00424         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00425         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00426         1,    1,    1,    1,    1,   12,   12,   13,   13,   13,
00427        15,   15,   17,   21,   18,   19,   22,   95,   20,   23,
00428        47,   27,  136,   24,   25,   95,   22,   27,   29,   47,
00429        22,   17,   28,   21,   17,   18,   19,   20,   25,   23,
00430        20,   26,   24,   23,   24,   28,   39,   39,   29,   49,
00431        50,   26,   51,   53,   52,   26,   55,   54,   56,   49,
00432        52,   57,   60,   61,   62,   65,   63,   53,   54,   64,
00433 
00434        50,   70,   55,   63,   60,   51,   71,   70,   57,   64,
00435        61,   56,   62,   72,   73,   74,   65,   75,   76,   77,
00436        78,   80,   79,   72,   71,   77,   82,   81,   76,   83,
00437        85,   80,   87,   92,   74,   79,   94,   78,   88,   73,
00438        75,   81,   88,   82,   87,   96,   97,   98,   99,  105,
00439        83,  123,  110,   85,  100,  115,   97,   98,   99,   94,
00440       106,   92,   96,  117,  100,  120,  106,  132,  133,  131,
00441       128,  120,  105,  110,  127,  126,  115,  125,  124,  122,
00442       123,  121,  119,  116,  114,  113,  112,  111,  117,  109,
00443       108,  107,  104,  103,  102,  101,  132,  137,  137,  137,
00444 
00445       138,  138,   93,   91,   90,   89,   86,   84,   69,   68,
00446        59,   58,   48,   40,   38,   37,   35,   33,   31,   30,
00447        16,   14,   11,   10,    9,    6,    5,    3,  135,  135,
00448       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00449       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00450       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
00451       135,  135,  135,  135
00452     } ;
00453 
00454 static yy_state_type yy_last_accepting_state;
00455 static char *yy_last_accepting_cpos;
00456 
00457 /* The intent behind this definition is that it'll catch
00458  * any uses of REJECT which flex missed.
00459  */
00460 #define REJECT reject_used_but_not_detected
00461 #define yymore() yymore_used_but_not_detected
00462 #define YY_MORE_ADJ 0
00463 #define YY_RESTORE_YY_MORE_OFFSET
00464 char *yytext;
00465 #line 1 "sqlscanner.l"
00466 #define INITIAL 0
00467 /* This file is part of the KDE project
00468    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00469    Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
00470 
00471    This library is free software; you can redistribute it and/or
00472    modify it under the terms of the GNU Library General Public
00473    License as published by the Free Software Foundation; either
00474    version 2 of the License, or (at your option) any later version.
00475 
00476    This library is distributed in the hope that it will be useful,
00477    but WITHOUT ANY WARRANTY; without even the implied warranty of
00478    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00479    Library General Public License for more details.
00480 
00481    You should have received a copy of the GNU Library General Public License
00482    along with this library; see the file COPYING.LIB.  If not, write to
00483    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00484  * Boston, MA 02110-1301, USA.
00485 */
00486 #line 22 "sqlscanner.l"
00487 #include <field.h>
00488 #include <expression.h>
00489 
00490 #include "sqlparser.h"
00491 #include "sqltypes.h"
00492 #include <iostream>
00493 #include <kdebug.h>
00494 #include <klocale.h>
00495 
00496 #define YY_NO_UNPUT
00497 #define ECOUNT current += yyleng; ctoken = yytext
00498 
00499 extern void setError(const QString& errDesc);
00500 extern void setError(const QString& errName, const QString& errDesc);
00501 
00502 /* *** Please reflect changes to this file in ../driver_p.cpp *** */
00503 #define YY_NEVER_INTERACTIVE 1
00504 /*identifier    [a-zA-Z_][a-zA-Z_0-9]* */
00505 /* todo: support for real numbers */
00506 #line 507 "sqlscanner.cpp"
00507 
00508 /* Macros after this point can all be overridden by user definitions in
00509  * section 1.
00510  */
00511 
00512 #ifndef YY_SKIP_YYWRAP
00513 #ifdef __cplusplus
00514 extern "C" int yywrap YY_PROTO(( void ));
00515 #else
00516 extern int yywrap YY_PROTO(( void ));
00517 #endif
00518 #endif
00519 
00520 #ifndef YY_NO_UNPUT
00521 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
00522 #endif
00523 
00524 #ifndef yytext_ptr
00525 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
00526 #endif
00527 
00528 #ifdef YY_NEED_STRLEN
00529 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
00530 #endif
00531 
00532 #ifndef YY_NO_INPUT
00533 #ifdef __cplusplus
00534 static int yyinput YY_PROTO(( void ));
00535 #else
00536 static int input YY_PROTO(( void ));
00537 #endif
00538 #endif
00539 
00540 #if YY_STACK_USED
00541 static int yy_start_stack_ptr = 0;
00542 static int yy_start_stack_depth = 0;
00543 static int *yy_start_stack = 0;
00544 #ifndef YY_NO_PUSH_STATE
00545 static void yy_push_state YY_PROTO(( int new_state ));
00546 #endif
00547 #ifndef YY_NO_POP_STATE
00548 static void yy_pop_state YY_PROTO(( void ));
00549 #endif
00550 #ifndef YY_NO_TOP_STATE
00551 static int yy_top_state YY_PROTO(( void ));
00552 #endif
00553 
00554 #else
00555 #define YY_NO_PUSH_STATE 1
00556 #define YY_NO_POP_STATE 1
00557 #define YY_NO_TOP_STATE 1
00558 #endif
00559 
00560 #ifdef YY_MALLOC_DECL
00561 YY_MALLOC_DECL
00562 #else
00563 #if __STDC__
00564 #ifndef __cplusplus
00565 #include <stdlib.h>
00566 #endif
00567 #else
00568 /* Just try to get by without declaring the routines.  This will fail
00569  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
00570  * or sizeof(void*) != sizeof(int).
00571  */
00572 #endif
00573 #endif
00574 
00575 /* Amount of stuff to slurp up with each read. */
00576 #ifndef YY_READ_BUF_SIZE
00577 #define YY_READ_BUF_SIZE 8192
00578 #endif
00579 
00580 /* Copy whatever the last rule matched to the standard output. */
00581 
00582 #ifndef ECHO
00583 /* This used to be an fputs(), but since the string might contain NUL's,
00584  * we now use fwrite().
00585  */
00586 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
00587 #endif
00588 
00589 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00590  * is returned in "result".
00591  */
00592 #ifndef YY_INPUT
00593 #define YY_INPUT(buf,result,max_size) \
00594     if ( yy_current_buffer->yy_is_interactive ) \
00595         { \
00596         int c = '*', n; \
00597         for ( n = 0; n < max_size && \
00598                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00599             buf[n] = (char) c; \
00600         if ( c == '\n' ) \
00601             buf[n++] = (char) c; \
00602         if ( c == EOF && ferror( yyin ) ) \
00603             YY_FATAL_ERROR( "input in flex scanner failed" ); \
00604         result = n; \
00605         } \
00606     else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
00607           && ferror( yyin ) ) \
00608         YY_FATAL_ERROR( "input in flex scanner failed" );
00609 #endif
00610 
00611 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00612  * we don't want an extra ';' after the "return" because that will cause
00613  * some compilers to complain about unreachable statements.
00614  */
00615 #ifndef yyterminate
00616 #define yyterminate() return YY_NULL
00617 #endif
00618 
00619 /* Number of entries by which start-condition stack grows. */
00620 #ifndef YY_START_STACK_INCR
00621 #define YY_START_STACK_INCR 25
00622 #endif
00623 
00624 /* Report a fatal error. */
00625 #ifndef YY_FATAL_ERROR
00626 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
00627 #endif
00628 
00629 /* Default declaration of generated scanner - a define so the user can
00630  * easily add parameters.
00631  */
00632 #ifndef YY_DECL
00633 #define YY_DECL int yylex YY_PROTO(( void ))
00634 #endif
00635 
00636 /* Code executed at the beginning of each rule, after yytext and yyleng
00637  * have been set up.
00638  */
00639 #ifndef YY_USER_ACTION
00640 #define YY_USER_ACTION
00641 #endif
00642 
00643 /* Code executed at the end of each rule. */
00644 #ifndef YY_BREAK
00645 #define YY_BREAK break;
00646 #endif
00647 
00648 #define YY_RULE_SETUP \
00649     YY_USER_ACTION
00650 
00651 YY_DECL
00652     {
00653     register yy_state_type yy_current_state;
00654     register char *yy_cp, *yy_bp;
00655     register int yy_act;
00656 
00657 #line 57 "sqlscanner.l"
00658 
00659 
00660 
00661 #line 662 "sqlscanner.cpp"
00662 
00663     if ( yy_init )
00664         {
00665         yy_init = 0;
00666 
00667 #ifdef YY_USER_INIT
00668         YY_USER_INIT;
00669 #endif
00670 
00671         if ( ! yy_start )
00672             yy_start = 1;   /* first start state */
00673 
00674         if ( ! yyin )
00675             yyin = stdin;
00676 
00677         if ( ! yyout )
00678             yyout = stdout;
00679 
00680         if ( ! yy_current_buffer )
00681             yy_current_buffer =
00682                 yy_create_buffer( yyin, YY_BUF_SIZE );
00683 
00684         yy_load_buffer_state();
00685         }
00686 
00687     while ( 1 )     /* loops until end-of-file is reached */
00688         {
00689         yy_cp = yy_c_buf_p;
00690 
00691         /* Support of yytext. */
00692         *yy_cp = yy_hold_char;
00693 
00694         /* yy_bp points to the position in yy_ch_buf of the start of
00695          * the current run.
00696          */
00697         yy_bp = yy_cp;
00698 
00699         yy_current_state = yy_start;
00700 yy_match:
00701         do
00702             {
00703             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00704             if ( yy_accept[yy_current_state] )
00705                 {
00706                 yy_last_accepting_state = yy_current_state;
00707                 yy_last_accepting_cpos = yy_cp;
00708                 }
00709             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00710                 {
00711                 yy_current_state = (int) yy_def[yy_current_state];
00712                 if ( yy_current_state >= 136 )
00713                     yy_c = yy_meta[(unsigned int) yy_c];
00714                 }
00715             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00716             ++yy_cp;
00717             }
00718         while ( yy_base[yy_current_state] != 229 );
00719 
00720 yy_find_action:
00721         yy_act = yy_accept[yy_current_state];
00722         if ( yy_act == 0 )
00723             { /* have to back up */
00724             yy_cp = yy_last_accepting_cpos;
00725             yy_current_state = yy_last_accepting_state;
00726             yy_act = yy_accept[yy_current_state];
00727             }
00728 
00729         YY_DO_BEFORE_ACTION;
00730 
00731 
00732 do_action:  /* This label is used only to access EOF actions. */
00733 
00734 
00735         switch ( yy_act )
00736     { /* beginning of action switch */
00737             case 0: /* must back up */
00738             /* undo the effects of YY_DO_BEFORE_ACTION */
00739             *yy_cp = yy_hold_char;
00740             yy_cp = yy_last_accepting_cpos;
00741             yy_current_state = yy_last_accepting_state;
00742             goto yy_find_action;
00743 
00744 case 1:
00745 YY_RULE_SETUP
00746 #line 60 "sqlscanner.l"
00747 {
00748     ECOUNT;
00749     return NOT_EQUAL;
00750 }
00751     YY_BREAK
00752 case 2:
00753 YY_RULE_SETUP
00754 #line 65 "sqlscanner.l"
00755 {
00756     ECOUNT;
00757     return NOT_EQUAL2;
00758 }
00759     YY_BREAK
00760 case 3:
00761 YY_RULE_SETUP
00762 #line 70 "sqlscanner.l"
00763 {
00764     ECOUNT;
00765     return '=';
00766 }
00767     YY_BREAK
00768 case 4:
00769 YY_RULE_SETUP
00770 #line 75 "sqlscanner.l"
00771 {
00772     ECOUNT;
00773     return LESS_OR_EQUAL;
00774 }
00775     YY_BREAK
00776 case 5:
00777 YY_RULE_SETUP
00778 #line 80 "sqlscanner.l"
00779 {
00780     ECOUNT;
00781     return GREATER_OR_EQUAL;
00782 }
00783     YY_BREAK
00784 case 6:
00785 YY_RULE_SETUP
00786 #line 85 "sqlscanner.l"
00787 {
00788     ECOUNT;
00789     return SQL_IN;
00790 }
00791     YY_BREAK
00792 case 7:
00793 YY_RULE_SETUP
00794 #line 90 "sqlscanner.l"
00795 {
00796 //TODO: what about hex or octal values?
00797     //we're using QString:toLongLong() here because atoll() is not so portable:
00798     ECOUNT;
00799     bool ok;
00800     yylval.integerValue = QString(yytext).toLongLong( &ok );
00801     if (!ok) {
00802         setError(i18n("Invalid integer number"),i18n("This integer number may be too large."));
00803         return SCAN_ERROR;
00804     }
00805 //  yylval.integerValue = atol(yytext);
00806     return INTEGER_CONST;
00807 }
00808     YY_BREAK
00809 case 8:
00810 YY_RULE_SETUP
00811 #line 104 "sqlscanner.l"
00812 {
00813     char *p = yytext;
00814     if (yytext[0]=='.') { /* no integer part */
00815         yylval.realValue.integer = 0;
00816     }
00817     else {
00818         yylval.realValue.integer = atoi(p);
00819         int i=0;
00820         while (p && i < yyleng && *p != '.') {
00821             i++;
00822             p++;
00823         }
00824         if (i==0 || !p || *p!='.') {
00825             yylval.realValue.fractional = 0;
00826             return REAL_CONST;
00827         }
00828     }
00829     /* fractional part */
00830     p++;
00831     yylval.realValue.fractional = atoi(p);
00832     return REAL_CONST;
00833 }
00834     YY_BREAK
00835 case 9:
00836 YY_RULE_SETUP
00837 #line 127 "sqlscanner.l"
00838 {
00839     ECOUNT;
00840     return AND;
00841 }
00842     YY_BREAK
00843 case 10:
00844 YY_RULE_SETUP
00845 #line 132 "sqlscanner.l"
00846 {
00847     ECOUNT;
00848     return AS;
00849 }
00850     YY_BREAK
00851 case 11:
00852 YY_RULE_SETUP
00853 #line 137 "sqlscanner.l"
00854 {
00855     ECOUNT;
00856     return CREATE;
00857 }
00858     YY_BREAK
00859 case 12:
00860 YY_RULE_SETUP
00861 #line 142 "sqlscanner.l"
00862 {
00863     ECOUNT;
00864     return FROM;
00865 }
00866     YY_BREAK
00867 case 13:
00868 YY_RULE_SETUP
00869 #line 147 "sqlscanner.l"
00870 {
00871     ECOUNT;
00872     return SQL_TYPE;
00873 }
00874     YY_BREAK
00875 case 14:
00876 YY_RULE_SETUP
00877 #line 152 "sqlscanner.l"
00878 {
00879     ECOUNT;
00880     return JOIN;
00881 }
00882     YY_BREAK
00883 case 15:
00884 YY_RULE_SETUP
00885 #line 157 "sqlscanner.l"
00886 {
00887     ECOUNT;
00888     return LEFT;
00889 }
00890     YY_BREAK
00891 case 16:
00892 YY_RULE_SETUP
00893 #line 162 "sqlscanner.l"
00894 {
00895     ECOUNT;
00896     return LIKE;
00897 }
00898     YY_BREAK
00899 case 17:
00900 YY_RULE_SETUP
00901 #line 167 "sqlscanner.l"
00902 {
00903     ECOUNT;
00904     return NOT_SIMILAR_TO;
00905 }
00906     YY_BREAK
00907 case 18:
00908 YY_RULE_SETUP
00909 #line 172 "sqlscanner.l"
00910 {
00911     ECOUNT;
00912     return SIMILAR_TO;
00913 }
00914     YY_BREAK
00915 case 19:
00916 YY_RULE_SETUP
00917 #line 177 "sqlscanner.l"
00918 {
00919     ECOUNT;
00920     return SQL_IS_NOT_NULL;
00921 }
00922     YY_BREAK
00923 case 20:
00924 YY_RULE_SETUP
00925 #line 182 "sqlscanner.l"
00926 {
00927     ECOUNT;
00928     return SQL_IS_NULL;
00929 }
00930     YY_BREAK
00931 case 21:
00932 YY_RULE_SETUP
00933 #line 187 "sqlscanner.l"
00934 {
00935     ECOUNT;
00936     return NOT;
00937 }
00938     YY_BREAK
00939 case 22:
00940 YY_RULE_SETUP
00941 #line 192 "sqlscanner.l"
00942 {
00943     ECOUNT;
00944     return SQL_IS;
00945 }
00946     YY_BREAK
00947 case 23:
00948 YY_RULE_SETUP
00949 #line 197 "sqlscanner.l"
00950 {
00951     ECOUNT;
00952     return SQL_NULL;
00953 }
00954     YY_BREAK
00955 case 24:
00956 YY_RULE_SETUP
00957 #line 202 "sqlscanner.l"
00958 {
00959     ECOUNT;
00960     return SQL_ON;
00961 }
00962     YY_BREAK
00963 case 25:
00964 YY_RULE_SETUP
00965 #line 207 "sqlscanner.l"
00966 {
00967     ECOUNT;
00968     return OR;
00969 }
00970     YY_BREAK
00971 case 26:
00972 YY_RULE_SETUP
00973 #line 212 "sqlscanner.l"
00974 { /* also means OR for numbers (mysql) */
00975     ECOUNT;
00976     return CONCATENATION;
00977 }
00978     YY_BREAK
00979 case 27:
00980 YY_RULE_SETUP
00981 #line 217 "sqlscanner.l"
00982 {
00983     ECOUNT;
00984     return BITWISE_SHIFT_LEFT;
00985 }
00986     YY_BREAK
00987 case 28:
00988 YY_RULE_SETUP
00989 #line 222 "sqlscanner.l"
00990 {
00991     ECOUNT;
00992     return BITWISE_SHIFT_RIGHT;
00993 }
00994     YY_BREAK
00995 case 29:
00996 YY_RULE_SETUP
00997 #line 227 "sqlscanner.l"
00998 {
00999     ECOUNT;
01000     return XOR;
01001 }
01002     YY_BREAK
01003 case 30:
01004 YY_RULE_SETUP
01005 #line 232 "sqlscanner.l"
01006 {
01007     ECOUNT;
01008     return RIGHT;
01009 }
01010     YY_BREAK
01011 case 31:
01012 YY_RULE_SETUP
01013 #line 237 "sqlscanner.l"
01014 {
01015     ECOUNT;
01016     return SELECT;
01017 }
01018     YY_BREAK
01019 case 32:
01020 YY_RULE_SETUP
01021 #line 242 "sqlscanner.l"
01022 {
01023     ECOUNT;
01024     return TABLE;
01025 }
01026     YY_BREAK
01027 case 33:
01028 YY_RULE_SETUP
01029 #line 247 "sqlscanner.l"
01030 {
01031     ECOUNT;
01032     return WHERE;
01033 }
01034     YY_BREAK
01035 case 34:
01036 YY_RULE_SETUP
01037 #line 253 "sqlscanner.l"
01038 {
01039     ECOUNT;
01040     strncpy(yylval.stringValue, yytext, yyleng + 1);
01041     return CHARACTER_STRING_LITERAL;
01042 
01043 /* "ZZZ" sentinel for script */
01044 }
01045     YY_BREAK
01046 case 35:
01047 YY_RULE_SETUP
01048 #line 261 "sqlscanner.l"
01049 {
01050     kdDebug() << "yytext: '" << yytext << "' (" << yyleng << ")" << endl;
01051     ECOUNT;
01052     strncpy(yylval.stringValue, yytext, yyleng + 1);
01053     if (yytext[0]>='0' && yytext[0]<='9') {
01054         setError(i18n("Invalid identifier"),
01055           i18n("Identifiers should start with a letter or '_' character"));
01056         return SCAN_ERROR;
01057 //      return ERROR_DIGIT_BEFORE_IDENTIFIER;
01058     }
01059     return IDENTIFIER;
01060 }
01061     YY_BREAK
01062 case 36:
01063 YY_RULE_SETUP
01064 #line 274 "sqlscanner.l"
01065 {
01066     kdDebug() << "yytext: '" << yytext << "' (" << yyleng << ")" << endl;
01067     ECOUNT;
01068     strncpy(yylval.stringValue, yytext + 1, yyleng - 1);
01069     yylval.stringValue[yyleng - 2] = 0x00;
01070     if (yytext[1]>='0' && yytext[1]<='9') {
01071         setError(i18n("Invalid identifier"),
01072           i18n("Identifiers should start with a letter or '_' character"));
01073         return SCAN_ERROR;
01074 //      return ERROR_DIGIT_BEFORE_IDENTIFIER;
01075     }
01076     return IDENTIFIER;
01077 }
01078     YY_BREAK
01079 case 37:
01080 YY_RULE_SETUP
01081 #line 288 "sqlscanner.l"
01082 {
01083     ECOUNT;
01084 }
01085     YY_BREAK
01086 case 38:
01087 YY_RULE_SETUP
01088 #line 292 "sqlscanner.l"
01089 {
01090     kdDebug() << "char: '" << yytext[0] << "'" << endl;
01091     ECOUNT;
01092     return yytext[0];
01093 }
01094     YY_BREAK
01095 case 39:
01096 YY_RULE_SETUP
01097 #line 298 "sqlscanner.l"
01098 ECHO;
01099     YY_BREAK
01100 #line 1101 "sqlscanner.cpp"
01101 case YY_STATE_EOF(INITIAL):
01102     yyterminate();
01103 
01104     case YY_END_OF_BUFFER:
01105         {
01106         /* Amount of text matched not including the EOB char. */
01107         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
01108 
01109         /* Undo the effects of YY_DO_BEFORE_ACTION. */
01110         *yy_cp = yy_hold_char;
01111         YY_RESTORE_YY_MORE_OFFSET
01112 
01113         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
01114             {
01115             /* We're scanning a new file or input source.  It's
01116              * possible that this happened because the user
01117              * just pointed yyin at a new source and called
01118              * yylex().  If so, then we have to assure
01119              * consistency between yy_current_buffer and our
01120              * globals.  Here is the right place to do so, because
01121              * this is the first action (other than possibly a
01122              * back-up) that will match for the new input source.
01123              */
01124             yy_n_chars = yy_current_buffer->yy_n_chars;
01125             yy_current_buffer->yy_input_file = yyin;
01126             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
01127             }
01128 
01129         /* Note that here we test for yy_c_buf_p "<=" to the position
01130          * of the first EOB in the buffer, since yy_c_buf_p will
01131          * already have been incremented past the NUL character
01132          * (since all states make transitions on EOB to the
01133          * end-of-buffer state).  Contrast this with the test
01134          * in input().
01135          */
01136         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01137             { /* This was really a NUL. */
01138             yy_state_type yy_next_state;
01139 
01140             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
01141 
01142             yy_current_state = yy_get_previous_state();
01143 
01144             /* Okay, we're now positioned to make the NUL
01145              * transition.  We couldn't have
01146              * yy_get_previous_state() go ahead and do it
01147              * for us because it doesn't know how to deal
01148              * with the possibility of jamming (and we don't
01149              * want to build jamming into it because then it
01150              * will run more slowly).
01151              */
01152 
01153             yy_next_state = yy_try_NUL_trans( yy_current_state );
01154 
01155             yy_bp = yytext_ptr + YY_MORE_ADJ;
01156 
01157             if ( yy_next_state )
01158                 {
01159                 /* Consume the NUL. */
01160                 yy_cp = ++yy_c_buf_p;
01161                 yy_current_state = yy_next_state;
01162                 goto yy_match;
01163                 }
01164 
01165             else
01166                 {
01167                 yy_cp = yy_c_buf_p;
01168                 goto yy_find_action;
01169                 }
01170             }
01171 
01172         else switch ( yy_get_next_buffer() )
01173             {
01174             case EOB_ACT_END_OF_FILE:
01175                 {
01176                 yy_did_buffer_switch_on_eof = 0;
01177 
01178                 if ( yywrap() )
01179                     {
01180                     /* Note: because we've taken care in
01181                      * yy_get_next_buffer() to have set up
01182                      * yytext, we can now set up
01183                      * yy_c_buf_p so that if some total
01184                      * hoser (like flex itself) wants to
01185                      * call the scanner after we return the
01186                      * YY_NULL, it'll still work - another
01187                      * YY_NULL will get returned.
01188                      */
01189                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
01190 
01191                     yy_act = YY_STATE_EOF(YY_START);
01192                     goto do_action;
01193                     }
01194 
01195                 else
01196                     {
01197                     if ( ! yy_did_buffer_switch_on_eof )
01198                         YY_NEW_FILE;
01199                     }
01200                 break;
01201                 }
01202 
01203             case EOB_ACT_CONTINUE_SCAN:
01204                 yy_c_buf_p =
01205                     yytext_ptr + yy_amount_of_matched_text;
01206 
01207                 yy_current_state = yy_get_previous_state();
01208 
01209                 yy_cp = yy_c_buf_p;
01210                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01211                 goto yy_match;
01212 
01213             case EOB_ACT_LAST_MATCH:
01214                 yy_c_buf_p =
01215                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
01216 
01217                 yy_current_state = yy_get_previous_state();
01218 
01219                 yy_cp = yy_c_buf_p;
01220                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01221                 goto yy_find_action;
01222             }
01223         break;
01224         }
01225 
01226     default:
01227         YY_FATAL_ERROR(
01228             "fatal flex scanner internal error--no action found" );
01229     } /* end of action switch */
01230         } /* end of scanning one token */
01231     } /* end of yylex */
01232 
01233 
01234 /* yy_get_next_buffer - try to read in a new buffer
01235  *
01236  * Returns a code representing an action:
01237  *  EOB_ACT_LAST_MATCH -
01238  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01239  *  EOB_ACT_END_OF_FILE - end of file
01240  */
01241 
01242 static int yy_get_next_buffer()
01243     {
01244     register char *dest = yy_current_buffer->yy_ch_buf;
01245     register char *source = yytext_ptr;
01246     register int number_to_move, i;
01247     int ret_val;
01248 
01249     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
01250         YY_FATAL_ERROR(
01251         "fatal flex scanner internal error--end of buffer missed" );
01252 
01253     if ( yy_current_buffer->yy_fill_buffer == 0 )
01254         { /* Don't try to fill the buffer, so this is an EOF. */
01255         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
01256             {
01257             /* We matched a single character, the EOB, so
01258              * treat this as a final EOF.
01259              */
01260             return EOB_ACT_END_OF_FILE;
01261             }
01262 
01263         else
01264             {
01265             /* We matched some text prior to the EOB, first
01266              * process it.
01267              */
01268             return EOB_ACT_LAST_MATCH;
01269             }
01270         }
01271 
01272     /* Try to read more data. */
01273 
01274     /* First move last chars to start of buffer. */
01275     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
01276 
01277     for ( i = 0; i < number_to_move; ++i )
01278         *(dest++) = *(source++);
01279 
01280     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01281         /* don't do the read, it's not guaranteed to return an EOF,
01282          * just force an EOF
01283          */
01284         yy_current_buffer->yy_n_chars = yy_n_chars = 0;
01285 
01286     else
01287         {
01288         int num_to_read =
01289             yy_current_buffer->yy_buf_size - number_to_move - 1;
01290 
01291         while ( num_to_read <= 0 )
01292             { /* Not enough room in the buffer - grow it. */
01293 #ifdef YY_USES_REJECT
01294             YY_FATAL_ERROR(
01295 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
01296 #else
01297 
01298             /* just a shorter name for the current buffer */
01299             YY_BUFFER_STATE b = yy_current_buffer;
01300 
01301             int yy_c_buf_p_offset =
01302                 (int) (yy_c_buf_p - b->yy_ch_buf);
01303 
01304             if ( b->yy_is_our_buffer )
01305                 {
01306                 int new_size = b->yy_buf_size * 2;
01307 
01308                 if ( new_size <= 0 )
01309                     b->yy_buf_size += b->yy_buf_size / 8;
01310                 else
01311                     b->yy_buf_size *= 2;
01312 
01313                 b->yy_ch_buf = (char *)
01314                     /* Include room in for 2 EOB chars. */
01315                     yy_flex_realloc( (void *) b->yy_ch_buf,
01316                              b->yy_buf_size + 2 );
01317                 }
01318             else
01319                 /* Can't grow it, we don't own it. */
01320                 b->yy_ch_buf = 0;
01321 
01322             if ( ! b->yy_ch_buf )
01323                 YY_FATAL_ERROR(
01324                 "fatal error - scanner input buffer overflow" );
01325 
01326             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01327 
01328             num_to_read = yy_current_buffer->yy_buf_size -
01329                         number_to_move - 1;
01330 #endif
01331             }
01332 
01333         if ( num_to_read > YY_READ_BUF_SIZE )
01334             num_to_read = YY_READ_BUF_SIZE;
01335 
01336         /* Read in more data. */
01337         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
01338             yy_n_chars, num_to_read );
01339 
01340         yy_current_buffer->yy_n_chars = yy_n_chars;
01341         }
01342 
01343     if ( yy_n_chars == 0 )
01344         {
01345         if ( number_to_move == YY_MORE_ADJ )
01346             {
01347             ret_val = EOB_ACT_END_OF_FILE;
01348             yyrestart( yyin );
01349             }
01350 
01351         else
01352             {
01353             ret_val = EOB_ACT_LAST_MATCH;
01354             yy_current_buffer->yy_buffer_status =
01355                 YY_BUFFER_EOF_PENDING;
01356             }
01357         }
01358 
01359     else
01360         ret_val = EOB_ACT_CONTINUE_SCAN;
01361 
01362     yy_n_chars += number_to_move;
01363     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01364     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01365 
01366     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
01367 
01368     return ret_val;
01369     }
01370 
01371 
01372 /* yy_get_previous_state - get the state just before the EOB char was reached */
01373 
01374 static yy_state_type yy_get_previous_state()
01375     {
01376     register yy_state_type yy_current_state;
01377     register char *yy_cp;
01378 
01379     yy_current_state = yy_start;
01380 
01381     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
01382         {
01383         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01384         if ( yy_accept[yy_current_state] )
01385             {
01386             yy_last_accepting_state = yy_current_state;
01387             yy_last_accepting_cpos = yy_cp;
01388             }
01389         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01390             {
01391             yy_current_state = (int) yy_def[yy_current_state];
01392             if ( yy_current_state >= 136 )
01393                 yy_c = yy_meta[(unsigned int) yy_c];
01394             }
01395         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01396         }
01397 
01398     return yy_current_state;
01399     }
01400 
01401 
01402 /* yy_try_NUL_trans - try to make a transition on the NUL character
01403  *
01404  * synopsis
01405  *  next_state = yy_try_NUL_trans( current_state );
01406  */
01407 
01408 #ifdef YY_USE_PROTOS
01409 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
01410 #else
01411 static yy_state_type yy_try_NUL_trans( yy_current_state )
01412 yy_state_type yy_current_state;
01413 #endif
01414     {
01415     register int yy_is_jam;
01416     register char *yy_cp = yy_c_buf_p;
01417 
01418     register YY_CHAR yy_c = 1;
01419     if ( yy_accept[yy_current_state] )
01420         {
01421         yy_last_accepting_state = yy_current_state;
01422         yy_last_accepting_cpos = yy_cp;
01423         }
01424     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01425         {
01426         yy_current_state = (int) yy_def[yy_current_state];
01427         if ( yy_current_state >= 136 )
01428             yy_c = yy_meta[(unsigned int) yy_c];
01429         }
01430     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01431     yy_is_jam = (yy_current_state == 135);
01432 
01433     return yy_is_jam ? 0 : yy_current_state;
01434     }
01435 
01436 
01437 #ifndef YY_NO_UNPUT
01438 #ifdef YY_USE_PROTOS
01439 static void yyunput( int c, register char *yy_bp )
01440 #else
01441 static void yyunput( c, yy_bp )
01442 int c;
01443 register char *yy_bp;
01444 #endif
01445     {
01446     register char *yy_cp = yy_c_buf_p;
01447 
01448     /* undo effects of setting up yytext */
01449     *yy_cp = yy_hold_char;
01450 
01451     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
01452         { /* need to shift things up to make room */
01453         /* +2 for EOB chars. */
01454         register int number_to_move = yy_n_chars + 2;
01455         register char *dest = &yy_current_buffer->yy_ch_buf[
01456                     yy_current_buffer->yy_buf_size + 2];
01457         register char *source =
01458                 &yy_current_buffer->yy_ch_buf[number_to_move];
01459 
01460         while ( source > yy_current_buffer->yy_ch_buf )
01461             *--dest = *--source;
01462 
01463         yy_cp += (int) (dest - source);
01464         yy_bp += (int) (dest - source);
01465         yy_current_buffer->yy_n_chars =
01466             yy_n_chars = yy_current_buffer->yy_buf_size;
01467 
01468         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
01469             YY_FATAL_ERROR( "flex scanner push-back overflow" );
01470         }
01471 
01472     *--yy_cp = (char) c;
01473 
01474 
01475     yytext_ptr = yy_bp;
01476     yy_hold_char = *yy_cp;
01477     yy_c_buf_p = yy_cp;
01478     }
01479 #endif  /* ifndef YY_NO_UNPUT */
01480 
01481 
01482 #ifdef __cplusplus
01483 static int yyinput()
01484 #else
01485 static int input()
01486 #endif
01487     {
01488     int c;
01489 
01490     *yy_c_buf_p = yy_hold_char;
01491 
01492     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01493         {
01494         /* yy_c_buf_p now points to the character we want to return.
01495          * If this occurs *before* the EOB characters, then it's a
01496          * valid NUL; if not, then we've hit the end of the buffer.
01497          */
01498         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01499             /* This was really a NUL. */
01500             *yy_c_buf_p = '\0';
01501 
01502         else
01503             { /* need more input */
01504             int offset = yy_c_buf_p - yytext_ptr;
01505             ++yy_c_buf_p;
01506 
01507             switch ( yy_get_next_buffer() )
01508                 {
01509                 case EOB_ACT_LAST_MATCH:
01510                     /* This happens because yy_g_n_b()
01511                      * sees that we've accumulated a
01512                      * token and flags that we need to
01513                      * try matching the token before
01514                      * proceeding.  But for input(),
01515                      * there's no matching to consider.
01516                      * So convert the EOB_ACT_LAST_MATCH
01517                      * to EOB_ACT_END_OF_FILE.
01518                      */
01519 
01520                     /* Reset buffer status. */
01521                     yyrestart( yyin );
01522 
01523                     /* fall through */
01524 
01525                 case EOB_ACT_END_OF_FILE:
01526                     {
01527                     if ( yywrap() )
01528                         return EOF;
01529 
01530                     if ( ! yy_did_buffer_switch_on_eof )
01531                         YY_NEW_FILE;
01532 #ifdef __cplusplus
01533                     return yyinput();
01534 #else
01535                     return input();
01536 #endif
01537                     }
01538 
01539                 case EOB_ACT_CONTINUE_SCAN:
01540                     yy_c_buf_p = yytext_ptr + offset;
01541                     break;
01542                 }
01543             }
01544         }
01545 
01546     c = *(unsigned char *) yy_c_buf_p;  /* cast for 8-bit char's */
01547     *yy_c_buf_p = '\0'; /* preserve yytext */
01548     yy_hold_char = *++yy_c_buf_p;
01549 
01550 
01551     return c;
01552     }
01553 
01554 
01555 #ifdef YY_USE_PROTOS
01556 void yyrestart( FILE *input_file )
01557 #else
01558 void yyrestart( input_file )
01559 FILE *input_file;
01560 #endif
01561     {
01562     if ( ! yy_current_buffer )
01563         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
01564 
01565     yy_init_buffer( yy_current_buffer, input_file );
01566     yy_load_buffer_state();
01567     }
01568 
01569 
01570 #ifdef YY_USE_PROTOS
01571 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
01572 #else
01573 void yy_switch_to_buffer( new_buffer )
01574 YY_BUFFER_STATE new_buffer;
01575 #endif
01576     {
01577     if ( yy_current_buffer == new_buffer )
01578         return;
01579 
01580     if ( yy_current_buffer )
01581         {
01582         /* Flush out information for old buffer. */
01583         *yy_c_buf_p = yy_hold_char;
01584         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
01585         yy_current_buffer->yy_n_chars = yy_n_chars;
01586         }
01587 
01588     yy_current_buffer = new_buffer;
01589     yy_load_buffer_state();
01590 
01591     /* We don't actually know whether we did this switch during
01592      * EOF (yywrap()) processing, but the only time this flag
01593      * is looked at is after yywrap() is called, so it's safe
01594      * to go ahead and always set it.
01595      */
01596     yy_did_buffer_switch_on_eof = 1;
01597     }
01598 
01599 
01600 #ifdef YY_USE_PROTOS
01601 void yy_load_buffer_state( void )
01602 #else
01603 void yy_load_buffer_state()
01604 #endif
01605     {
01606     yy_n_chars = yy_current_buffer->yy_n_chars;
01607     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
01608     yyin = yy_current_buffer->yy_input_file;
01609     yy_hold_char = *yy_c_buf_p;
01610     }
01611 
01612 
01613 #ifdef YY_USE_PROTOS
01614 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
01615 #else
01616 YY_BUFFER_STATE yy_create_buffer( file, size )
01617 FILE *file;
01618 int size;
01619 #endif
01620     {
01621     YY_BUFFER_STATE b;
01622 
01623     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
01624     if ( ! b )
01625         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01626 
01627     b->yy_buf_size = size;
01628 
01629     /* yy_ch_buf has to be 2 characters longer than the size given because
01630      * we need to put in 2 end-of-buffer characters.
01631      */
01632     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
01633     if ( ! b->yy_ch_buf )
01634         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01635 
01636     b->yy_is_our_buffer = 1;
01637 
01638     yy_init_buffer( b, file );
01639 
01640     return b;
01641     }
01642 
01643 
01644 #ifdef YY_USE_PROTOS
01645 void yy_delete_buffer( YY_BUFFER_STATE b )
01646 #else
01647 void yy_delete_buffer( b )
01648 YY_BUFFER_STATE b;
01649 #endif
01650     {
01651     if ( ! b )
01652         return;
01653 
01654     if ( b == yy_current_buffer )
01655         yy_current_buffer = (YY_BUFFER_STATE) 0;
01656 
01657     if ( b->yy_is_our_buffer )
01658         yy_flex_free( (void *) b->yy_ch_buf );
01659 
01660     yy_flex_free( (void *) b );
01661     }
01662 
01663 
01664 #ifndef YY_ALWAYS_INTERACTIVE
01665 #ifndef YY_NEVER_INTERACTIVE
01666 extern int isatty YY_PROTO(( int ));
01667 #endif
01668 #endif
01669 
01670 #ifdef YY_USE_PROTOS
01671 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
01672 #else
01673 void yy_init_buffer( b, file )
01674 YY_BUFFER_STATE b;
01675 FILE *file;
01676 #endif
01677 
01678 
01679     {
01680     yy_flush_buffer( b );
01681 
01682     b->yy_input_file = file;
01683     b->yy_fill_buffer = 1;
01684 
01685 #if YY_ALWAYS_INTERACTIVE
01686     b->yy_is_interactive = 1;
01687 #else
01688 #if YY_NEVER_INTERACTIVE
01689     b->yy_is_interactive = 0;
01690 #else
01691     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01692 #endif
01693 #endif
01694     }
01695 
01696 
01697 #ifdef YY_USE_PROTOS
01698 void yy_flush_buffer( YY_BUFFER_STATE b )
01699 #else
01700 void yy_flush_buffer( b )
01701 YY_BUFFER_STATE b;
01702 #endif
01703 
01704     {
01705     if ( ! b )
01706         return;
01707 
01708     b->yy_n_chars = 0;
01709 
01710     /* We always need two end-of-buffer characters.  The first causes
01711      * a transition to the end-of-buffer state.  The second causes
01712      * a jam in that state.
01713      */
01714     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01715     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01716 
01717     b->yy_buf_pos = &b->yy_ch_buf[0];
01718 
01719     b->yy_at_bol = 1;
01720     b->yy_buffer_status = YY_BUFFER_NEW;
01721 
01722     if ( b == yy_current_buffer )
01723         yy_load_buffer_state();
01724     }
01725 
01726 
01727 #ifndef YY_NO_SCAN_BUFFER
01728 #ifdef YY_USE_PROTOS
01729 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
01730 #else
01731 YY_BUFFER_STATE yy_scan_buffer( base, size )
01732 char *base;
01733 yy_size_t size;
01734 #endif
01735     {
01736     YY_BUFFER_STATE b;
01737 
01738     if ( size < 2 ||
01739          base[size-2] != YY_END_OF_BUFFER_CHAR ||
01740          base[size-1] != YY_END_OF_BUFFER_CHAR )
01741         /* They forgot to leave room for the EOB's. */
01742         return 0;
01743 
01744     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
01745     if ( ! b )
01746         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
01747 
01748     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
01749     b->yy_buf_pos = b->yy_ch_buf = base;
01750     b->yy_is_our_buffer = 0;
01751     b->yy_input_file = 0;
01752     b->yy_n_chars = b->yy_buf_size;
01753     b->yy_is_interactive = 0;
01754     b->yy_at_bol = 1;
01755     b->yy_fill_buffer = 0;
01756     b->yy_buffer_status = YY_BUFFER_NEW;
01757 
01758     yy_switch_to_buffer( b );
01759 
01760     return b;
01761     }
01762 #endif
01763 
01764 
01765 #ifndef YY_NO_SCAN_STRING
01766 #ifdef YY_USE_PROTOS
01767 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
01768 #else
01769 YY_BUFFER_STATE yy_scan_string( yy_str )
01770 yyconst char *yy_str;
01771 #endif
01772     {
01773     int len;
01774     for ( len = 0; yy_str[len]; ++len )
01775         ;
01776 
01777     return yy_scan_bytes( yy_str, len );
01778     }
01779 #endif
01780 
01781 
01782 #ifndef YY_NO_SCAN_BYTES
01783 #ifdef YY_USE_PROTOS
01784 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
01785 #else
01786 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
01787 yyconst char *bytes;
01788 int len;
01789 #endif
01790     {
01791     YY_BUFFER_STATE b;
01792     char *buf;
01793     yy_size_t n;
01794     int i;
01795 
01796     /* Get memory for full buffer, including space for trailing EOB's. */
01797     n = len + 2;
01798     buf = (char *) yy_flex_alloc( n );
01799     if ( ! buf )
01800         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
01801 
01802     for ( i = 0; i < len; ++i )
01803         buf[i] = bytes[i];
01804 
01805     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
01806 
01807     b = yy_scan_buffer( buf, n );
01808     if ( ! b )
01809         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
01810 
01811     /* It's okay to grow etc. this buffer, and we should throw it
01812      * away when we're done.
01813      */
01814     b->yy_is_our_buffer = 1;
01815 
01816     return b;
01817     }
01818 #endif
01819 
01820 
01821 #ifndef YY_NO_PUSH_STATE
01822 #ifdef YY_USE_PROTOS
01823 static void yy_push_state( int new_state )
01824 #else
01825 static void yy_push_state( new_state )
01826 int new_state;
01827 #endif
01828     {
01829     if ( yy_start_stack_ptr >= yy_start_stack_depth )
01830         {
01831         yy_size_t new_size;
01832 
01833         yy_start_stack_depth += YY_START_STACK_INCR;
01834         new_size = yy_start_stack_depth * sizeof( int );
01835 
01836         if ( ! yy_start_stack )
01837             yy_start_stack = (int *) yy_flex_alloc( new_size );
01838 
01839         else
01840             yy_start_stack = (int *) yy_flex_realloc(
01841                     (void *) yy_start_stack, new_size );
01842 
01843         if ( ! yy_start_stack )
01844             YY_FATAL_ERROR(
01845             "out of memory expanding start-condition stack" );
01846         }
01847 
01848     yy_start_stack[yy_start_stack_ptr++] = YY_START;
01849 
01850     BEGIN(new_state);
01851     }
01852 #endif
01853 
01854 
01855 #ifndef YY_NO_POP_STATE
01856 static void yy_pop_state()
01857     {
01858     if ( --yy_start_stack_ptr < 0 )
01859         YY_FATAL_ERROR( "start-condition stack underflow" );
01860 
01861     BEGIN(yy_start_stack[yy_start_stack_ptr]);
01862     }
01863 #endif
01864 
01865 
01866 #ifndef YY_NO_TOP_STATE
01867 static int yy_top_state()
01868     {
01869     return yy_start_stack[yy_start_stack_ptr - 1];
01870     }
01871 #endif
01872 
01873 #ifndef YY_EXIT_FAILURE
01874 #define YY_EXIT_FAILURE 2
01875 #endif
01876 
01877 #ifdef YY_USE_PROTOS
01878 static void yy_fatal_error( yyconst char msg[] )
01879 #else
01880 static void yy_fatal_error( msg )
01881 char msg[];
01882 #endif
01883     {
01884     (void) fprintf( stderr, "%s\n", msg );
01885     exit( YY_EXIT_FAILURE );
01886     }
01887 
01888 
01889 
01890 /* Redefine yyless() so it works in section 3 code. */
01891 
01892 #undef yyless
01893 #define yyless(n) \
01894     do \
01895         { \
01896         /* Undo effects of setting up yytext. */ \
01897         yytext[yyleng] = yy_hold_char; \
01898         yy_c_buf_p = yytext + n; \
01899         yy_hold_char = *yy_c_buf_p; \
01900         *yy_c_buf_p = '\0'; \
01901         yyleng = n; \
01902         } \
01903     while ( 0 )
01904 
01905 
01906 /* Internal utility routines. */
01907 
01908 #ifndef yytext_ptr
01909 #ifdef YY_USE_PROTOS
01910 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
01911 #else
01912 static void yy_flex_strncpy( s1, s2, n )
01913 char *s1;
01914 yyconst char *s2;
01915 int n;
01916 #endif
01917     {
01918     register int i;
01919     for ( i = 0; i < n; ++i )
01920         s1[i] = s2[i];
01921     }
01922 #endif
01923 
01924 #ifdef YY_NEED_STRLEN
01925 #ifdef YY_USE_PROTOS
01926 static int yy_flex_strlen( yyconst char *s )
01927 #else
01928 static int yy_flex_strlen( s )
01929 yyconst char *s;
01930 #endif
01931     {
01932     register int n;
01933     for ( n = 0; s[n]; ++n )
01934         ;
01935 
01936     return n;
01937     }
01938 #endif
01939 
01940 
01941 #ifdef YY_USE_PROTOS
01942 static void *yy_flex_alloc( yy_size_t size )
01943 #else
01944 static void *yy_flex_alloc( size )
01945 yy_size_t size;
01946 #endif
01947     {
01948     return (void *) malloc( size );
01949     }
01950 
01951 #ifdef YY_USE_PROTOS
01952 static void *yy_flex_realloc( void *ptr, yy_size_t size )
01953 #else
01954 static void *yy_flex_realloc( ptr, size )
01955 void *ptr;
01956 yy_size_t size;
01957 #endif
01958     {
01959     /* The cast to (char *) in the following accommodates both
01960      * implementations that use char* generic pointers, and those
01961      * that use void* generic pointers.  It works with the latter
01962      * because both ANSI C and C++ allow castless assignment from
01963      * any pointer type to void*, and deal with argument conversions
01964      * as though doing an assignment.
01965      */
01966     return (void *) realloc( (char *) ptr, size );
01967     }
01968 
01969 #ifdef YY_USE_PROTOS
01970 static void yy_flex_free( void *ptr )
01971 #else
01972 static void yy_flex_free( ptr )
01973 void *ptr;
01974 #endif
01975     {
01976     free( ptr );
01977     }
01978 
01979 #if YY_MAIN
01980 int main()
01981     {
01982     yylex();
01983     return 0;
01984     }
01985 #endif
01986 #line 298 "sqlscanner.l"
01987 
01988 
01989 void tokenize(const char *data)
01990 {
01991     yy_switch_to_buffer(yy_scan_string(data));
01992     ctoken = "";
01993     current = 0;
01994 }
01995 
KDE Home | KDE Accessibility Home | Description of Access Keys