diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-05 04:12:13 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-05 04:12:13 +0900 |
| commit | a93fcf03efbe2ce56bfd649447247bb8daf2e463 (patch) | |
| tree | 0b2241b3780e43d5ba2f59928b28d425d8c8105d | |
| parent | df2921b9011c9d5db0849d3095a7c600e1b498a6 (diff) | |
| download | ducc-a93fcf03efbe2ce56bfd649447247bb8daf2e463.tar.gz ducc-a93fcf03efbe2ce56bfd649447247bb8daf2e463.tar.zst ducc-a93fcf03efbe2ce56bfd649447247bb8daf2e463.zip | |
feat: improve pp-number tokenization
| -rw-r--r-- | src/preprocess.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/preprocess.c b/src/preprocess.c index 1d5a42a..385a43e 100644 --- a/src/preprocess.c +++ b/src/preprocess.c @@ -498,16 +498,13 @@ static void pplexer_tokenize_all(PpLexer* ppl) { tok->kind = TokenKind_literal_str; tok->value.string = builder.buf; } else if (isdigit(c)) { + // TODO: implement tokenization of pp-number. StrBuilder builder; strbuilder_init(&builder); - while (isdigit(infile_peek_char(ppl->src))) { + while (isalnum(infile_peek_char(ppl->src))) { strbuilder_append_char(&builder, infile_peek_char(ppl->src)); infile_next_char(ppl->src); } - // Skip integer suffix. - while (isalpha(infile_peek_char(ppl->src))) { - infile_next_char(ppl->src); - } tok->kind = TokenKind_literal_int; tok->value.integer = atoi(builder.buf); } else if (isalpha(c) || c == '_') { |
