-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnalyseurFlex.l
53 lines (28 loc) · 947 Bytes
/
AnalyseurFlex.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
40
41
42
43
44
45
46
47
48
49
50
51
52
%option bison-bridge
%option noyywrap
%{
#define YYSTYPE char*
#include <string>
#include "parser.tab.hpp"
%}
DIGITS [0-9]
%%
"diametre" return yy::parser::token::DIAM;
"size" return yy::parser::token::SIZE;
"species" return yy::parser::token::SPECIES;
"speed" return yy::parser::token::SPEED;
"pop" return yy::parser::token::POP;
[a-zA-Z][a-zA-Z0-9]* *yylval = strdup(yytext); return yy::parser::token::IDENT;
{DIGITS}+"."*{DIGITS}* *yylval = strdup(yytext); return yy::parser::token::NUMBER;
"+" return yy::parser::token::PLUS;
"(" return yy::parser::token::LP;
")" return yy::parser::token::RP;
"," return yy::parser::token::COMMA;
"//".* { }
[ \n\t\r]+ { }
";" return yy::parser::token::SEMI;
"=" return yy::parser::token::EQUALS;
"->" return yy::parser::token::ARROW;
"[" return yy::parser::token::LB;
"]" return yy::parser::token::RB;
%%