aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-03 22:31:53 +0900
committernsfisis <nsfisis@gmail.com>2025-08-15 10:06:21 +0900
commit5630b305cbc8537dfdd92ac9e3118605e9464e83 (patch)
treeb861e9843922b022003c5049891dbd20b7c7ded7
parenta86aa7f2c086f408ddf09dcc7f963697e6d2c716 (diff)
downloadducc-5630b305cbc8537dfdd92ac9e3118605e9464e83.tar.gz
ducc-5630b305cbc8537dfdd92ac9e3118605e9464e83.tar.zst
ducc-5630b305cbc8537dfdd92ac9e3118605e9464e83.zip
refactor: fix wrong enum name
-rw-r--r--parse.c4
-rw-r--r--preprocess.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/parse.c b/parse.c
index 9c05519..1695c8f 100644
--- a/parse.c
+++ b/parse.c
@@ -1040,7 +1040,7 @@ AstNode* parse_enum_def(Parser* p) {
}
AstNode* parse_typedef_decl(Parser* p) {
- expect(p, TokenKind_keyword_typeof);
+ expect(p, TokenKind_keyword_typedef);
Type* ty = parse_type(p);
String* name = parse_ident(p);
expect(p, TokenKind_semicolon);
@@ -1078,7 +1078,7 @@ AstNode* parse_toplevel(Parser* p) {
return parse_struct_decl_or_def(p);
} else if (tk == TokenKind_keyword_enum) {
return parse_enum_def(p);
- } else if (tk == TokenKind_keyword_typeof) {
+ } else if (tk == TokenKind_keyword_typedef) {
return parse_typedef_decl(p);
} else if (tk == TokenKind_keyword_extern) {
return parse_extern_var_decl(p);
diff --git a/preprocess.c b/preprocess.c
index 881f09e..9a44394 100644
--- a/preprocess.c
+++ b/preprocess.c
@@ -41,7 +41,7 @@ enum TokenKind {
TokenKind_keyword_short,
TokenKind_keyword_sizeof,
TokenKind_keyword_struct,
- TokenKind_keyword_typeof,
+ TokenKind_keyword_typedef,
TokenKind_keyword_void,
TokenKind_keyword_while,
TokenKind_le,
@@ -147,8 +147,8 @@ const char* token_kind_stringify(TokenKind k) {
return "sizeof";
else if (k == TokenKind_keyword_struct)
return "struct";
- else if (k == TokenKind_keyword_typeof)
- return "typeof";
+ else if (k == TokenKind_keyword_typedef)
+ return "typedef";
else if (k == TokenKind_keyword_void)
return "void";
else if (k == TokenKind_keyword_while)
@@ -591,7 +591,7 @@ void pp_tokenize_all(Preprocessor* pp) {
} else if (string_equals_cstr(&tok->raw, "struct")) {
tok->kind = TokenKind_keyword_struct;
} else if (string_equals_cstr(&tok->raw, "typedef")) {
- tok->kind = TokenKind_keyword_typeof;
+ tok->kind = TokenKind_keyword_typedef;
} else if (string_equals_cstr(&tok->raw, "void")) {
tok->kind = TokenKind_keyword_void;
} else if (string_equals_cstr(&tok->raw, "while")) {