-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.l
More file actions
24 lines (21 loc) · 715 Bytes
/
sql.l
File metadata and controls
24 lines (21 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* scanner for SQL Insert Statement */
%{
// declarations
#include <stdio.h>
#include "y.tab.h"
%}
alpha [A-Za-z]
digit [0-9]+(.[0-9]+)?
symbols ['\-_@#\.\/\?]
/* rules section */
%%
[ \t\n]
[iI][nN][sS][eE][rR][tT] return INSERT;
[iI][nN][tT][oO] return INTO;
[vV][aA][lL][uU][eE][sS] return VALUES;
{digit}+ return NUM;
'({alpha}|{digit}|{symbols}|,)+' return ID;
\"({alpha}|{digit}|{symbols}|,)+\" return ID;
({alpha}|{digit}|{symbols})+ return ID;
. return yytext[0];
%%