Added a peek function to the tokenizer.
This commit is contained in:
+10
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user