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

@@ -11,15 +11,16 @@ static inline cbool lex_parse_is_whitespace(int ch) {
return ch == ' ' || ch == '\t';
}
int lex_parse_char(core_stream_t *input, core_pos_t *pos);
cbool lex_parse_string(core_stream_t *input, core_pos_t *pos,
int lex_parse_char(core_probe_stream_t *input, core_pos_t *pos);
cbool lex_parse_string(core_probe_stream_t *input, core_pos_t *pos,
cstring_t *output);
cbool lex_parse_number(core_stream_t *input, core_pos_t *pos, usize *output);
cbool lex_parse_identifier(core_stream_t *input, core_pos_t *pos,
cbool lex_parse_number(core_probe_stream_t *input, core_pos_t *pos,
usize *output);
cbool lex_parse_identifier(core_probe_stream_t *input, core_pos_t *pos,
cstring_t *output);
void lex_parse_skip_endline(core_stream_t *input, core_pos_t *pos);
void lex_parse_skip_block_comment(core_stream_t *input, core_pos_t *pos);
void lex_parse_skip_line(core_stream_t *input, core_pos_t *pos);
void lex_parse_skip_whitespace(core_stream_t *input, core_pos_t *pos);
void lex_parse_skip_endline(core_probe_stream_t *input, core_pos_t *pos);
void lex_parse_skip_block_comment(core_probe_stream_t *input, core_pos_t *pos);
void lex_parse_skip_line(core_probe_stream_t *input, core_pos_t *pos);
void lex_parse_skip_whitespace(core_probe_stream_t *input, core_pos_t *pos);
#endif /* __SMCC_LEX_PARSER_H__ */