mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Parser is reading variable declarations, read more
This is an incomplete process. It's supposed to be robust enough to support the types of arrays and dictionaries, but arrays and dictionaries aren't implemented in the literals yet, so that's my next task. I'll come back to variable declarations later.
This commit is contained in:
@@ -301,7 +301,6 @@ Token scanLexer(Lexer* lexer) {
|
||||
}
|
||||
|
||||
static void trim(char** s, int* l) { //all this to remove a newline?
|
||||
*l = strlen(*s);
|
||||
while( isspace(( (*((unsigned char**)(s)))[(*l) - 1] )) ) (*l)--;
|
||||
while(**s && isspace( **(unsigned char**)(s)) ) { (*s)++; (*l)--; }
|
||||
}
|
||||
@@ -323,9 +322,9 @@ void printToken(Token* token) {
|
||||
printf("%s", keyword);
|
||||
} else {
|
||||
char* str = token->lexeme;
|
||||
int length = 0;
|
||||
int length = token->length;
|
||||
trim(&str, &length);
|
||||
printf("%.*s", length, token->lexeme);
|
||||
printf("%.*s", length, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user