> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 09:21:25 up 13:20,  2 users,  load average: 0.16, 0.17, 0.17
This commit is contained in:
tracer-ics2023
2024-08-18 09:21:26 +08:00
committed by zzy
parent c8b9877616
commit c138672ac7

View File

@ -191,15 +191,18 @@ word_t eval(const Token* arr, size_t p, size_t q, bool* success) {
size_t op = 0;
int in_parentheses = 0;
for (size_t i = p; i <= q; i ++) {
if (arr[i].type == '(' || in_parentheses) {
if (arr[i].type == '(') {
in_parentheses ++;
continue;
}
if (arr[i].type == ')') {
in_parentheses --;
}
if (in_parentheses != 0) {
continue;
}
if (arr[i].type == '+' || arr[i].type == '-') {
op = i;
} else if (arr[i].type == '*' || arr[i].type == '/') {