Added a peek function to the tokenizer.

This commit is contained in:
2022-01-31 22:06:52 +00:00
parent f88cfda90a
commit ebc1d30c1c
3 changed files with 48 additions and 20 deletions
+10 -1
View File
@@ -66,7 +66,7 @@ List* GenerateTokensFromFile(const char* file_path) {
}
Token* GetNextToken(char *string) {
char* string_token = SplitOnBasicGrammar(string);
char* string_token = GetToken(string);
int base = 0;
while (strlen(string_token) != 0) {
@@ -90,6 +90,15 @@ Token* GetNextToken(char *string) {
// if (next) free(next);
if (strcmp(".db", string_token) == 0) {
char* next = PeekNextToken();
if (next) {
printf("String variable name: '%s'\n", next);
free(next);
}
}
return CreateToken(TK_String, string_token);
}