feat(lex_parser): rename functions and update header guard prefix

- Change header guard from `__SMCC_LEX_PARSER_H__` to `__SCC_LEX_PARSER_H__`
- Prefix all lexer functions with `scc_` (e.g., `lex_parse_char` → `scc_lex_parse_char`)
- Add new helper function `scc_lex_parse_is_identifier_header`
- Update references in source and test files to use new function names
- Replace `core_stream_eof` with `scc_stream_eof` for consistency
This commit is contained in:
zzy
2025-12-13 14:06:13 +08:00
parent 94d3f46fac
commit 874a58281f
17 changed files with 98 additions and 92 deletions

View File

@@ -1,26 +1,31 @@
#ifndef __SMCC_LEX_PARSER_H__
#define __SMCC_LEX_PARSER_H__
#ifndef __SCC_LEX_PARSER_H__
#define __SCC_LEX_PARSER_H__
#include <libcore.h>
static inline cbool lex_parse_is_endline(int ch) {
static inline cbool scc_lex_parse_is_endline(int ch) {
return ch == '\n' || ch == '\r';
}
static inline cbool lex_parse_is_whitespace(int ch) {
static inline cbool scc_lex_parse_is_whitespace(int ch) {
return ch == ' ' || ch == '\t';
}
int lex_parse_char(scc_probe_stream_t *input, scc_pos_t *pos);
cbool lex_parse_string(scc_probe_stream_t *input, scc_pos_t *pos,
scc_cstring_t *output);
cbool lex_parse_number(scc_probe_stream_t *input, scc_pos_t *pos,
usize *output);
cbool lex_parse_identifier(scc_probe_stream_t *input, scc_pos_t *pos,
scc_cstring_t *output);
void lex_parse_skip_endline(scc_probe_stream_t *input, scc_pos_t *pos);
void lex_parse_skip_block_comment(scc_probe_stream_t *input, scc_pos_t *pos);
void lex_parse_skip_line(scc_probe_stream_t *input, scc_pos_t *pos);
void lex_parse_skip_whitespace(scc_probe_stream_t *input, scc_pos_t *pos);
static inline cbool scc_lex_parse_is_identifier_header(int ch) {
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
}
#endif /* __SMCC_LEX_PARSER_H__ */
int scc_lex_parse_char(scc_probe_stream_t *input, scc_pos_t *pos);
cbool scc_lex_parse_string(scc_probe_stream_t *input, scc_pos_t *pos,
scc_cstring_t *output);
cbool scc_lex_parse_number(scc_probe_stream_t *input, scc_pos_t *pos,
usize *output);
cbool scc_lex_parse_identifier(scc_probe_stream_t *input, scc_pos_t *pos,
scc_cstring_t *output);
void scc_lex_parse_skip_endline(scc_probe_stream_t *input, scc_pos_t *pos);
void scc_lex_parse_skip_block_comment(scc_probe_stream_t *input,
scc_pos_t *pos);
void scc_lex_parse_skip_line(scc_probe_stream_t *input, scc_pos_t *pos);
void scc_lex_parse_skip_whitespace(scc_probe_stream_t *input, scc_pos_t *pos);
#endif /* __SCC_LEX_PARSER_H__ */