> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.71 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jan  5 14:18:41 UTC 2024 x86_64 GNU/Linux
 23:40:16  up 2 days 12:35,  2 users,  load average: 0.91, 0.54, 0.42
This commit is contained in:
tracer-ysyx 2024-01-15 23:40:16 +08:00 committed by xinyangli
parent 70829c8d56
commit 4404802163
2 changed files with 6 additions and 1 deletions

View file

@ -11,7 +11,6 @@
0[xX][0-9a-fA-F]+ { yylval = strtoul(yytext, NULL, 16); return HEX_NUMBER; }
[0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; }
$[a-zA-Z]{2,3} {
puts(yytext);
yylval = isa_reg_str2val(yytext + 1, &success);
if(!success) {
yyerror(NULL, "Failed to convert reg to value");

View file

@ -175,6 +175,12 @@ START_TEST(test_expr_plain_register) {
ck_assert(strcpy(buf + 1, regs[i]));
gpr(i) = i;
}
yy_scan_string(buf);
uint32_t value;
ck_assert(!yyparse(&value));
yylex_destroy();
ck_assert(value == i);
for (i = 1; i < 5; i++) {
buf[i] = '\0';
}