-
Notifications
You must be signed in to change notification settings - Fork 0
/
sq.l
39 lines (35 loc) · 738 Bytes
/
sq.l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
%{
# include "y.tab.h"
extern yylval;
%}
alpha [A-Za-z]
digit [0-9]
%%
\n { return 0; }
[ \t] { ; }
create { return CREATE; }
table { return TABLE; }
insert { return INSERT; }
delete { return DELETE; }
into { return INTO; }
select { return SELECT; }
values { return VALUES; }
distinct { return DISTINCT; }
from { return FROM; }
where { return WHERE; }
like { return LIKE; }
desc { return DESC; }
asc { return ASC; }
"group by" { return GROUP; }
having { return HAVING; }
"order by" { return ORDER; }
or { return OR; }
and { return AND; }
{digit}+ { return NUM; }
{alpha}({alpha}|{digit})* { return ID; }
"<=" { return LE; }
">=" { return GE; }
"==" { return EQ; }
"!=" { return NE; }
. { return yytext[0]; }
%%