From f675656431075450714f2a1054ea8db3a2897e26 Mon Sep 17 00:00:00 2001 From: s-over-4 Date: Thu, 28 Sep 2023 10:36:12 -0400 Subject: preprocessor now preforms basic whitespace removal --- src/main.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 75ee98f..7366932 100644 --- a/src/main.c +++ b/src/main.c @@ -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(); -- cgit v1.2.3