diff options
author | c+1 | 2023-05-05 12:14:31 -0400 |
---|---|---|
committer | c+1 | 2023-05-05 12:14:31 -0400 |
commit | 89b5586c1a12ac47c47e609dc31aac597473812f (patch) | |
tree | 88c25e532cfb641a7c05122bded78b54c04c50b7 | |
parent | a0f697a3059cc5173d60beaf9d3a513a0edfbda1 (diff) |
h
-rw-r--r-- | src/include/lexer.h | 6 | ||||
-rw-r--r-- | src/lexer.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/include/lexer.h b/src/include/lexer.h index e002893..e6bee55 100644 --- a/src/include/lexer.h +++ b/src/include/lexer.h @@ -9,12 +9,18 @@ typedef struct LEXER_STRUC { } lexer_t; lexer_t* lexer_init(char* content); + void lexer_next(lexer_t* lexer); void lexer_pass(lexer_t* lexer); + token_t* lexer_get_next_token(lexer_t* lexer); + token_t* lexer_get_string(lexer_t* lexer); + token_t* lexer_get_id(lexer_t* lexer); + token_t* lexer_next_token(lexer_t* lexer, token_t* token); + char* lexer_get_c_as_string(lexer_t* lexer); #endif diff --git a/src/lexer.c b/src/lexer.c index a44e24f..99ed54b 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -106,7 +106,7 @@ token_t* lexer_get_next_token(lexer_t* lexer) { token_t* lexer_get_string(lexer_t* lexer) { lexer_next(lexer); - char* str_so_far = calloc(2, sizeof(char)); + char* str_so_far = calloc(1, sizeof(char)); str_so_far[0] = '\0'; while (lexer->c != '"') { |