fix(while/until)
This commit is contained in:
parent
1f4742e17b
commit
c8d0285447
2 changed files with 4 additions and 4 deletions
|
|
@ -76,7 +76,7 @@ static void set_token_keyword(struct token *tok, char *begin, ssize_t size)
|
|||
tok->type = TOKEN_FOR;
|
||||
else if (strncmp(begin, "while", size) == 0 && size == 5)
|
||||
tok->type = TOKEN_WHILE;
|
||||
else if (strncmp(begin, "until", size) == 0 && size == 4)
|
||||
else if (strncmp(begin, "until", size) == 0 && size == 5)
|
||||
tok->type = TOKEN_UNTIL;
|
||||
else if (strncmp(begin, "do", size) == 0 && size == 2)
|
||||
tok->type = TOKEN_DO;
|
||||
|
|
|
|||
|
|
@ -220,18 +220,18 @@ struct ast *parse_while(struct lexer_context *ctx)
|
|||
}
|
||||
POP_TOKEN();
|
||||
|
||||
return parse_loop(ctx, true);
|
||||
return parse_loop(ctx, false);
|
||||
}
|
||||
|
||||
struct ast *parse_until(struct lexer_context *ctx)
|
||||
{
|
||||
struct token *token = PEEK_TOKEN();
|
||||
|
||||
// 'while'
|
||||
// 'until'
|
||||
if (token->type != TOKEN_UNTIL)
|
||||
{
|
||||
perror(
|
||||
"Internal error: expected a TOKEN_WHILE but got a different type");
|
||||
"Internal error: expected a TOKEN_UNTIL but got a different type");
|
||||
return NULL;
|
||||
}
|
||||
POP_TOKEN();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue