- 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
24 lines
506 B
C
24 lines
506 B
C
#include <pprocessor.h>
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
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 = scc_pproc_init(
|
|
&pp, scc_mem_probe_stream_init(&input, buf, sizeof(buf) - 1, false));
|
|
|
|
int ch = 0;
|
|
|
|
while (1) {
|
|
ch = scc_probe_stream_consume(output);
|
|
if (ch == scc_stream_eof) {
|
|
break;
|
|
}
|
|
putc(ch, stdout);
|
|
}
|
|
|
|
return 0;
|
|
} |