diff options
author | s-over-4 | 2023-09-28 10:36:12 -0400 |
---|---|---|
committer | s-over-4 | 2023-09-28 10:36:12 -0400 |
commit | f675656431075450714f2a1054ea8db3a2897e26 (patch) | |
tree | 948d28c95dfc19eface1be5b2cb0330f0fe68353 /src | |
parent | 3e793a7b079da1208a3baebd1ea66abe54b7ed49 (diff) |
preprocessor now preforms basic whitespace removal
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -3,17 +3,24 @@ #include "include/util.h" #include "include/token.h" +#include "include/pp.h" #include "include/lexer.h" #include "include/source.h" #include "include/hlkt.h" int main(int argc, char* argv[]) { char* source; - lexer_t* lexer; - int in_file; + /*lexer_t* lexer;*/ + /*int in_file;*/ + pp_t* pp; source = source_get(argv[1]); + pp = pp_init(source); + HLKT_ASS(pp); + log_inf("preprocessor created"); + + /* lexer = lexer_init(source); HLKT_ASS(lexer); log_inf("lexer created"); @@ -23,22 +30,16 @@ int main(int argc, char* argv[]) { log_inf("END INPUT"); in_file = 1; + */ - while (in_file) { - token_t* token; - char* type; - - token = lexer_get_next_token(lexer); - type = token_get_type(token->type); - - log_inf("token type: [%s]\t\ttoken value: [%s]", type, token->value); - (token->type == TOKEN_EOF) && (in_file = 0); + pp_run(pp); - token_destroy(token); - } + log_raw("%s\n%s", source, pp->psrc); // clean up - lexer_destroy(lexer); + /*lexer_destroy(lexer);*/ + pp_destroy(pp); + free(source); HLKT_LOG(); |