06d81b80bd
ysyx_22040000 李心杨 Linux calcite 6.1.71 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jan 5 14:18:41 UTC 2024 x86_64 GNU/Linux 22:40:44 up 2 days 11:35, 2 users, load average: 0.59, 0.57, 0.52
16 lines
523 B
Text
16 lines
523 B
Text
%{
|
|
#include <isa.h>
|
|
#include <addrexp.h>
|
|
static bool success = false;
|
|
%}
|
|
%option noyywrap
|
|
|
|
%%
|
|
|
|
${0,1}[a-zA-Z0-9]{2,3} { yylval = isa_reg_str2val(yytext + 1, &success); if(!success) { return YYerror; } }
|
|
0[xX][0-9a-fA-F]+ { yylval = strtoul(yytext, NULL, 16); return HEX_NUMBER; }
|
|
[0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; }
|
|
[+\-*/()] { return *yytext; }
|
|
[ \t] { }
|
|
. { fprintf(stderr, "Unexpected character: %s\n", yytext); return YYerror; }
|
|
%%
|