diff options
-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 != '"') { |