diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-08-17 07:20:51 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-08-17 07:20:51 +0900 |
| commit | 48d5ca9bcf08a0995008759bf5bb9fec5a1631bc (patch) | |
| tree | dc3e9ce6099e950e97f7674afd04d96263b42a35 /preprocess.c | |
| parent | b1307971d1b42556e79607fba0ca4617e25e7c54 (diff) | |
| download | ducc-48d5ca9bcf08a0995008759bf5bb9fec5a1631bc.tar.gz ducc-48d5ca9bcf08a0995008759bf5bb9fec5a1631bc.tar.zst ducc-48d5ca9bcf08a0995008759bf5bb9fec5a1631bc.zip | |
feat: defer keyword check after preprocessing
Diffstat (limited to 'preprocess.c')
| -rw-r--r-- | preprocess.c | 80 |
1 files changed, 1 insertions, 79 deletions
diff --git a/preprocess.c b/preprocess.c index 9c22886..fde107e 100644 --- a/preprocess.c +++ b/preprocess.c @@ -868,85 +868,7 @@ void pplexer_tokenize_all(PpLexer* ppl) { } tok->raw.data = ppl->src + start; tok->raw.len = ppl->pos - start; - if (string_equals_cstr(&tok->raw, "auto")) { - tok->kind = TokenKind_keyword_auto; - } else if (string_equals_cstr(&tok->raw, "break")) { - tok->kind = TokenKind_keyword_break; - } else if (string_equals_cstr(&tok->raw, "case")) { - tok->kind = TokenKind_keyword_case; - } else if (string_equals_cstr(&tok->raw, "char")) { - tok->kind = TokenKind_keyword_char; - } else if (string_equals_cstr(&tok->raw, "const")) { - tok->kind = TokenKind_keyword_const; - } else if (string_equals_cstr(&tok->raw, "continue")) { - tok->kind = TokenKind_keyword_continue; - } else if (string_equals_cstr(&tok->raw, "default")) { - tok->kind = TokenKind_keyword_default; - } else if (string_equals_cstr(&tok->raw, "do")) { - tok->kind = TokenKind_keyword_do; - } else if (string_equals_cstr(&tok->raw, "double")) { - tok->kind = TokenKind_keyword_double; - } else if (string_equals_cstr(&tok->raw, "else")) { - tok->kind = TokenKind_keyword_else; - } else if (string_equals_cstr(&tok->raw, "enum")) { - tok->kind = TokenKind_keyword_enum; - } else if (string_equals_cstr(&tok->raw, "extern")) { - tok->kind = TokenKind_keyword_extern; - } else if (string_equals_cstr(&tok->raw, "float")) { - tok->kind = TokenKind_keyword_float; - } else if (string_equals_cstr(&tok->raw, "for")) { - tok->kind = TokenKind_keyword_for; - } else if (string_equals_cstr(&tok->raw, "goto")) { - tok->kind = TokenKind_keyword_goto; - } else if (string_equals_cstr(&tok->raw, "if")) { - tok->kind = TokenKind_keyword_if; - } else if (string_equals_cstr(&tok->raw, "inline")) { - tok->kind = TokenKind_keyword_inline; - } else if (string_equals_cstr(&tok->raw, "int")) { - tok->kind = TokenKind_keyword_int; - } else if (string_equals_cstr(&tok->raw, "long")) { - tok->kind = TokenKind_keyword_long; - } else if (string_equals_cstr(&tok->raw, "register")) { - tok->kind = TokenKind_keyword_register; - } else if (string_equals_cstr(&tok->raw, "restrict")) { - tok->kind = TokenKind_keyword_restrict; - } else if (string_equals_cstr(&tok->raw, "return")) { - tok->kind = TokenKind_keyword_return; - } else if (string_equals_cstr(&tok->raw, "short")) { - tok->kind = TokenKind_keyword_short; - } else if (string_equals_cstr(&tok->raw, "signed")) { - tok->kind = TokenKind_keyword_signed; - } else if (string_equals_cstr(&tok->raw, "sizeof")) { - tok->kind = TokenKind_keyword_sizeof; - } else if (string_equals_cstr(&tok->raw, "static")) { - tok->kind = TokenKind_keyword_static; - } else if (string_equals_cstr(&tok->raw, "struct")) { - tok->kind = TokenKind_keyword_struct; - } else if (string_equals_cstr(&tok->raw, "switch")) { - tok->kind = TokenKind_keyword_switch; - } else if (string_equals_cstr(&tok->raw, "typedef")) { - tok->kind = TokenKind_keyword_typedef; - } else if (string_equals_cstr(&tok->raw, "union")) { - tok->kind = TokenKind_keyword_union; - } else if (string_equals_cstr(&tok->raw, "unsigned")) { - tok->kind = TokenKind_keyword_unsigned; - } else if (string_equals_cstr(&tok->raw, "void")) { - tok->kind = TokenKind_keyword_void; - } else if (string_equals_cstr(&tok->raw, "volatile")) { - tok->kind = TokenKind_keyword_volatile; - } else if (string_equals_cstr(&tok->raw, "while")) { - tok->kind = TokenKind_keyword_while; - } else if (string_equals_cstr(&tok->raw, "_Bool")) { - tok->kind = TokenKind_keyword__Bool; - } else if (string_equals_cstr(&tok->raw, "_Complex")) { - tok->kind = TokenKind_keyword__Complex; - } else if (string_equals_cstr(&tok->raw, "_Imaginary")) { - tok->kind = TokenKind_keyword__Imaginary; - } else if (string_equals_cstr(&tok->raw, "va_start")) { - tok->kind = TokenKind_va_start; - } else { - tok->kind = TokenKind_ident; - } + tok->kind = TokenKind_ident; } else if (c == '\n' || c == '\r') { ++ppl->line; tok->kind = TokenKind_newline; |
