mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Disallow empty bodies in control flow statements, added 'pass' keyword
Fixed #170
This commit is contained in:
@@ -44,6 +44,7 @@ const Toy_KeywordTypeTuple keywordTuples[] = {
|
||||
{TOY_TOKEN_KEYWORD_IMPORT, "import"},
|
||||
{TOY_TOKEN_KEYWORD_IN, "in"},
|
||||
{TOY_TOKEN_KEYWORD_OF, "of"},
|
||||
{TOY_TOKEN_KEYWORD_PASS, "pass"},
|
||||
{TOY_TOKEN_KEYWORD_PRINT, "print"},
|
||||
{TOY_TOKEN_KEYWORD_RETURN, "return"},
|
||||
{TOY_TOKEN_KEYWORD_TYPEAS, "typeas"},
|
||||
@@ -404,12 +405,6 @@ void Toy_private_printToken(Toy_Token* token) {
|
||||
return;
|
||||
}
|
||||
|
||||
//read pass token, even though it isn't generated
|
||||
if (token->type == TOY_TOKEN_PASS) {
|
||||
printf(TOY_CC_NOTICE "PASS: \t%d\t%.*s\n" TOY_CC_RESET, (int)token->line, (int)token->length, token->lexeme);
|
||||
return;
|
||||
}
|
||||
|
||||
//print the line number
|
||||
printf("\t%d\t%d\t", token->type, (int)token->line);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user