txlyre 7 小時之前
父節點
當前提交
7e832c2e00
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      qic.c

+ 3 - 3
qic.c

@@ -2855,7 +2855,7 @@ node_t *_parse_stmt(list_t *tokens, size_t *pos, int allow_comma)
     if (AT(RCB))
       PARSE_ERROR("empty enum");
 
-    do
+    while (!AT(EOF))
     {
       if (AT(RCB))
         break;
@@ -2879,7 +2879,7 @@ node_t *_parse_stmt(list_t *tokens, size_t *pos, int allow_comma)
         v = parse_expr(tokens, pos);
 
       table_set(h, k, v);
-    } while (MATCH(COMMA));
+    }
 
     EXPECT(RCB, "}");
 
@@ -4231,7 +4231,7 @@ void compile_block(buffer_t *gbuf, buffer_t *buf, list_t *ctx, table_t *ltab,
           snprintf(buf, sizeof(buf), "%zu", k++);
 
           v = nodet(N_LITERAL, token(T_NUMBER, strdup(buf)));
-        }
+        } else k++;
 
         if (!const_set(name, v))
           COMPILE_ERROR("redeclaration of compile-time constant: '%s'", name);