> 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
 10:23:33 up 1 day,  3:39,  1 user,  load average: 0.44, 0.15, 0.05
This commit is contained in:
tracer-ics2023
2024-08-23 10:23:34 +08:00
committed by zzy
parent 73ce0c334e
commit 3dc2a5691b

View File

@ -143,20 +143,19 @@ static bool make_token(char *e) {
int check_parentheses(const Token* arr, size_t p, size_t q) {
int cnt = 0;
bool is_surrounded = false;
bool is_surrounded = arr[0].type == '(';
for (size_t i = p; i <= q; i ++) {
if (arr[i].type == '(') {
if (i == p) {
is_surrounded = true;
}
cnt ++;
}
else if (arr[i].type == ')') {
if (is_surrounded && i != q) {
is_surrounded = false;
}
cnt --;
}
if (cnt < 0) {
return -1;
} else if (cnt == 0) {
is_surrounded &= i == q;
}
}
if (cnt != 0) {
return -1;