-
Notifications
You must be signed in to change notification settings - Fork 0
/
language.l
31 lines (27 loc) · 1.15 KB
/
language.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
%{
#include "y.tab.h"
int yylex();
%}
%%
"\\n" { yylval.c = '\n'; return character; }
"\\t" { yylval.c = '\t'; return character; }
"\\". { yylval.c = yytext[1]; return character; }
"{"[0-9]+":"[1-9][0-9]*"}" { yylval.range[0] = atoi(yytext+1);
yylval.range[1] = atoi(index(yytext+1, ':')+1);
return rangetoken; }
"{"[1-9][0-9]*"}" { yylval.range[0] = atoi(yytext+1);
yylval.range[1] = yylval.range[0]; return rangetoken; }
"[" { return leftbox; }
"]" { return rightbox; }
"(" { return leftparanthesis; }
")" { return rightparanthesis; }
"*" { yylval.range[0] = 0;
yylval.range[1] = maxcharactercount; return rangetoken; }
"+" { yylval.range[0] = 1;
yylval.range[1] = maxcharactercount; return rangetoken; }
[.] { return dot; }
[-] { return yytext[0]; }
[\t\n] ;
. { yylval.c = yytext[0]; return character; }
%%
int yywrap(void) { return 1; }