-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscanner.l
More file actions
49 lines (47 loc) · 979 Bytes
/
Copy pathscanner.l
File metadata and controls
49 lines (47 loc) · 979 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%{
#include "parser.tab.h"
char* toString(char* temp);
%}
%%
"const" return(tconst);
"else" return(telse);
"if" return(tif);
"int" return(tint);
"return" return(treturn);
"void" return(tvoid);
"while" return(twhile);
"==" return(tequal);
"!=" return(tnotequ);
"<=" return(tlesse);
">=" return(tgreate);
"&&" return(tand);
"||" return(tor);
"++" return(tinc);
"--" return(tdec);
"+=" return(taddAssign);
"-=" return(tsubAssign);
"*=" return(tmulAssign);
"/=" return(tdivAssign);
"%=" return(tmodAssign);
"for" return(tfor);
"switch" return(tswitch);
"case" return(tcase);
"default" return(tdefault);
"break" return(tbreak);
"continue" return(tcontinue);
[A-Za-z_][A-Za-z0-9_]* {
yylval.string = toString(yytext);
return(tident);
}
[1-9][0-9]*|0([0-7]+|(x|X)[0-9A-Fa-f]*)? {
yylval.string = toString(yytext);
return(tnumber);
}
"/*"([^*]|\*+[^*/])*\**"*/" ;
"//".* ;
[ \t\n] ;
. return(yytext[0]);
%%
int yywrap() {
return 1;
}