feat 重构stream流API并适配lex_parse和lexer

This commit is contained in:
zzy
2025-12-08 23:04:11 +08:00
parent 1ab07a5815
commit 36bff64a91
17 changed files with 402 additions and 244 deletions

View File

@@ -5,9 +5,9 @@
void check_skip_block_comment(const char *str, const char *expect_remaining) {
log_set_level(&__default_logger_root, 0);
core_pos_t pos = core_pos_init();
core_mem_stream_t mem_stream;
core_stream_t *stream =
core_mem_stream_init(&mem_stream, str, smcc_strlen(str), false);
core_mem_probe_stream_t mem_stream;
core_probe_stream_t *stream =
core_mem_probe_stream_init(&mem_stream, str, smcc_strlen(str), false);
lex_parse_skip_block_comment(stream, &pos);
@@ -15,7 +15,8 @@ void check_skip_block_comment(const char *str, const char *expect_remaining) {
char buffer[256] = {0};
int i = 0;
int ch;
while ((ch = core_stream_next_char(stream)) != core_stream_eof && i < 255) {
while ((ch = core_probe_stream_consume(stream)) != core_stream_eof &&
i < 255) {
buffer[i++] = (char)ch;
}