blob: 059b7c39812076088a7c0dd45b9c8daba9bd3b82 (
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
|
%{
#include <inttypes.h>
#include "as.tab.h"
%}
NONDIGIT [_a-zA-Z]
DIGIT [0-9]
IDENTIFIERS [_a-zA-Z0-9]
%x COMMENT
%%
{DIGIT}+ { yylval.n = strtoumax(yytext, NULL, 10); return NUMBER; }
{NONDIGIT}{IDENTIFIERS}* { yylval.s = yytext; return TOKEN; }
:|,|\. { return yytext[0]; }
\n { return NEWLINE; }
; { BEGIN COMMENT; }
<COMMENT>. ;
<COMMENT>\n { BEGIN INITIAL; return NEWLINE; }
. ;
|