feat(lex_parser, pprocessor): rename identifier header check and add macro system
- 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
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
smcc_pp_t pp;
|
||||
core_mem_stream_t input;
|
||||
core_stream_t *output;
|
||||
scc_pproc_t pp;
|
||||
scc_mem_probe_stream_t input;
|
||||
scc_probe_stream_t *output;
|
||||
|
||||
const char buf[] = "#define A 123 \"asd\"\nA A A\n";
|
||||
output =
|
||||
pp_init(&pp, core_mem_stream_init(&input, buf, sizeof(buf) - 1, false));
|
||||
output = scc_pproc_init(
|
||||
&pp, scc_mem_probe_stream_init(&input, buf, sizeof(buf) - 1, false));
|
||||
|
||||
int ch = 0;
|
||||
|
||||
while (1) {
|
||||
ch = core_stream_next_char(output);
|
||||
if (ch == core_stream_eof) {
|
||||
ch = scc_probe_stream_consume(output);
|
||||
if (ch == scc_stream_eof) {
|
||||
break;
|
||||
}
|
||||
putc(ch, stdout);
|
||||
|
||||
Reference in New Issue
Block a user