- Rename `scc_lex_parse_is_identifier_header` to `scc_lex_parse_is_identifier_prefix` for clarity and add a TODO comment - Update lexer to use the renamed function for consistency - Fix package and dependency names in `cbuild.toml` (`smcc_pprocesser` → `scc_pprocesser`, `smcc_lex_parser` → `lex_parser`) - Introduce new macro system with header file `pp_macro.h` defining macro types, structures, and management functions - Refactor preprocessor initialization and cleanup in `pprocessor.c` to use new macro table and stream handling - Replace legacy `hashmap` with `scc_pp_macro_table_t` for macro storage - Improve error handling and resource management in preprocessor lifecycle
33 lines
1.2 KiB
C
33 lines
1.2 KiB
C
#ifndef __SCC_LEX_PARSER_H__
|
|
#define __SCC_LEX_PARSER_H__
|
|
|
|
#include <libcore.h>
|
|
|
|
static inline cbool scc_lex_parse_is_endline(int ch) {
|
|
return ch == '\n' || ch == '\r';
|
|
}
|
|
|
|
static inline cbool scc_lex_parse_is_whitespace(int ch) {
|
|
return ch == ' ' || ch == '\t';
|
|
}
|
|
|
|
// TODO identifier check is right?
|
|
static inline cbool scc_lex_parse_is_identifier_prefix(int ch) {
|
|
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
|
|
}
|
|
|
|
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__ */
|