/*************************************************************** * Run Time Access * Copyright (C) 2003 Robert W Smith (bsmith@linuxtoys.org) * * This program is distributed under the terms of the GNU LGPL. * See the file COPYING file. **************************************************************/ /*************************************************************** * token.l -- Lex tokenizer for SQL commands. **************************************************************/ %option noyywrap %option never-interactive %{ #define __USE_GNU #include #include "do_sql.h" #include "parse.tab.h" #include "config.h" #ifndef HAVE_STRNDUP #include "support.h" #endif void dosql_init(); extern int yylval; extern int yydebug; extern struct Sql_Cmd cmd; extern char *parsestr[]; #define YY_NO_UNPUT %} %% [Aa][Nn][Dd] { return(AND); } [Ff][Rr][Oo][Mm] { return(FROM); } [Ll][Ii][Mm][Ii][Tt] { return(LIMIT); } [Oo][Ff][Ff][Ss][Ee][Tt] { return(OFFSET); } [Ss][Ee][Ll][Ee][Cc][Tt] { return(SELECT); } [Ss][Ee][Tt] { return(SET); } [Uu][Pp][Dd][Aa][Tt][Ee] { return(UPDATE); } [Ww][Hh][Ee][Rr][Ee] { return(WHERE); } [Bb][Ee][Gg][Ii][Nn] { return(SQLBEGIN); } [Cc][Oo][Mm][Mm][Ii][Tt] { return(SQLCOMMIT); } \"[A-Za-z][_A-Za-z0-9 \t]*\" | \'[A-Za-z][_A-Za-z0-9 \t]*\' { int i; for (i=0; i { return(GT); } \< { return(LT); } \>= { return(GE); } \<= { return(LE); } \, { return((int)','); } \( { return((int)'('); } \) { return((int)')'); } \; { return((int)';'); } \. { return((int)'.'); } \"[A-Za-z0-9 \t!@#$%^&*()_+-={}|;:<>?~`\[\]'\\]*\" | \'[A-Za-z0-9 \t!@#$%^&*()_+-={}|;:<>?~`\[\]"\\]*\' { int i; for (i=0; i