mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Basic infile reading is working, untested
This commit is contained in:
@@ -236,6 +236,10 @@ void Toy_bindLexer(Toy_Lexer* lexer, const char* source) {
|
||||
}
|
||||
|
||||
Toy_Token Toy_private_scanLexer(Toy_Lexer* lexer) {
|
||||
if (lexer->source == NULL) {
|
||||
return makeErrorToken(lexer, "Missing source code in lexer");
|
||||
}
|
||||
|
||||
eatWhitespace(lexer);
|
||||
|
||||
lexer->start = lexer->current;
|
||||
|
||||
@@ -31,7 +31,7 @@ static void advance(Toy_Parser* parser) {
|
||||
parser->current = Toy_private_scanLexer(parser->lexer);
|
||||
|
||||
if (parser->current.type == TOY_TOKEN_ERROR) {
|
||||
printError(parser, parser->current, "Read error");
|
||||
printError(parser, parser->current, "Can't read the source code");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user