/********************************************************************************
*
* File: sql.lex
* Title: The sql scanner; it recognizes sql keywords
* Programmer: Leonidas Fegaras, UTA
* Date: 2/21/97
*
********************************************************************************/
%{
%}
/* remove the following line if flex complains */
%option noyywrap
DIGIT    [0-9]
ID       [a-zA-Z][a-zA-Z0-9_]*
%%
{DIGIT}+		{ return NUM; }
{DIGIT}+"."{DIGIT}*	{ return REAL; }
create		{ return CREATE; }
table		{ return TABLE; }
alter		{ return ALTER; }
view		{ return VIEW; }
index		{ return INDEX; }
add		{ return ADD; }
drop		{ return DROP; }
int		{ return INTT; }
decimal		{ return DECIMAL; }
char		{ return CHAR; }
varchar		{ return VARCHAR; }
null		{ return SNULL; }
primary		{ return PRIMARY; }
key		{ return KEY; }
unique		{ return UNIQUE; }
references	{ return REFERENCES; }
foreign		{ return FOREIGN; }
update		{ return UPDATE; }
set		{ return SET; }
where		{ return WHERE; }
into		{ return INTO; }
values		{ return VALUES; }
delete		{ return DELETE; }
from		{ return FROM; }
select		{ return SELECT; }
union		{ return UNION; }
intersect	{ return INTERSECT; }
group		{ return GROUP; }
by		{ return BY; }
having		{ return HAVING; }
order		{ return ORDER; }
exists		{ return EXISTS; }
is		{ return IS; }
all		{ return ALL; }
some		{ return SOME; }
any		{ return ANY; }
in		{ return IN; }
on		{ return ON; }
column		{ return COLUMN; }
insert		{ return INSERT; }
count		{ return COUNT; }
min		{ return MIN; }
max		{ return MAX; }
avg		{ return AVG; }
sum		{ return SUM; }
as		{ return AS; }
or		{ return OR; }
and		{ return AND; }
not		{ return NOT; }
">="		{ return GE; }
"<="		{ return LE; }
"<>"		{ return NE; }

"="|">"|"<"|"-"|"+"|"*"|"/"|"."|";"|","|"("|")"	{ return yytext[0]; }

{ID}		{ return ID; }

"/*"[^"*/"]*"*/"	/* comment */

\-\-[^\n]*		/* one-line comment */

\'[^']*\'		{ return CSTRING; }

\"[^"]*\"		{ return CSTRING; }

\n			{ lineno++; }

\ 

\t

%%
