blob: 8b824c02068ea6f2bdfe5bbff6f6cceb6fe72a5a (
plain)
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
|
%{
/**
* UPEM / Compilation / Projet
* Pacien TRAN-GIRARD, Adam NAILI
*/
#include "tpc.tab.h"
int lineno = 1;
%}
%option noinput nounput noyywrap
%x COMMENT
%%
[ \t\r]+ ;
\n { lineno++; }
"/*" { BEGIN COMMENT; }
"&&" { return AND; }
"||" { return OR; }
"*"|"/"|% { return DIVSTAR; }
"+"|- { return ADDSUB; }
"<"|"<="|">"|">=" { return ORDER; }
==|!= { return EQ; }
int { return TYPE; }
char { return TYPE; }
void { return VOID; }
const { return CONST; }
if { return IF; }
else { return ELSE; }
while { return WHILE; }
return { return RETURN; }
print { return PRINT; }
readc { return READC; }
reade { return READE; }
[a-zA-Z_][a-zA-Z0-9_]* { return IDENT; }
[0-9]+ { return NUM; }
'\\?.' { return CARACTERE; }
. { return yytext[0]; }
<COMMENT>"*/" { BEGIN INITIAL; }
<COMMENT>\n { lineno++; }
<COMMENT>. ;
%%
|