Tokenizing now strips the double quotes from strings, leaving only the intended value.
This commit is contained in:
+13
-2
@@ -46,12 +46,20 @@ List* TokenizeLine(char *line) {
|
||||
char* token = SplitOnWhiteSpace(line);
|
||||
|
||||
while (strlen(token) != 0) {
|
||||
printf("'%s' ", token);
|
||||
//printf("'%s' ", token);
|
||||
//if (token[0] == '"') printf("String token: '%s'\n", token);
|
||||
if (strcmp(token, ".db") == 0) {
|
||||
free(token);
|
||||
token = SplitOnWhiteSpace(NULL);
|
||||
printf("String named '%s' declared. ", token);
|
||||
free(token);
|
||||
token = SplitOnWhiteSpace(NULL);
|
||||
printf("Value: '%s'\n", token);
|
||||
}
|
||||
|
||||
free(token);
|
||||
token = SplitOnWhiteSpace(NULL);
|
||||
}
|
||||
printf("\n");
|
||||
//free(currentWord);
|
||||
free(token);
|
||||
|
||||
@@ -74,6 +82,7 @@ char* SplitOnWhiteSpace(char* line) {
|
||||
|
||||
if (parsing_string) {
|
||||
if (string[position] == '\n') break;
|
||||
if (string[position] == '"') break;
|
||||
|
||||
token[i] = string[position];
|
||||
|
||||
@@ -84,6 +93,8 @@ char* SplitOnWhiteSpace(char* line) {
|
||||
|
||||
if (string[position] == '"') {
|
||||
parsing_string = 1;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string[position] == ' ') {
|
||||
|
||||
Reference in New Issue
Block a user