2024-01-12 15:23:43 +00:00
|
|
|
%{
|
2024-01-15 09:03:16 +00:00
|
|
|
#include <isa.h>
|
2024-01-12 15:23:43 +00:00
|
|
|
#include <addrexp.h>
|
2024-01-15 09:03:16 +00:00
|
|
|
static bool success = false;
|
2024-01-12 15:23:43 +00:00
|
|
|
%}
|
|
|
|
%option noyywrap
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
2024-01-15 15:00:31 +00:00
|
|
|
\$[a-zA-Z]{2,3} { yylval = isa_reg_str2val(yytext + 1, &success); if(!success) { return YYerror; } }
|
2024-01-13 02:25:01 +00:00
|
|
|
0[xX][0-9a-fA-F]+ { yylval = strtoul(yytext, NULL, 16); return HEX_NUMBER; }
|
|
|
|
[0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; }
|
2024-01-12 15:23:43 +00:00
|
|
|
[+\-*/()] { return *yytext; }
|
|
|
|
[ \t] { }
|
2024-01-15 14:50:16 +00:00
|
|
|
. { printf("Unexpected character: %s\n", yytext); return YYerror; }
|
2024-01-12 15:23:43 +00:00
|
|
|
%%
|