Add bool values to parser, and bool nodes to ast

This commit is contained in:
Krzosa Karol
2022-06-02 23:48:03 +02:00
parent 2909214ee0
commit e2e684294e
5 changed files with 38 additions and 46 deletions

View File

@@ -374,7 +374,9 @@ parse_expr(S64 min_bp){
}break;
case TK_Keyword: {
if(token->intern_val == keyword_cast){
if(token->intern_val == keyword_true) left = ast_bool(token, 1);
else if(token->intern_val == keyword_false) left = ast_bool(token, 0);
else if(token->intern_val == keyword_cast){
token_expect(TK_OpenParen);
Ast_Expr *expr = parse_expr(0);
token_expect(TK_Colon);