Add string accessors, working towards first program

This commit is contained in:
Krzosa Karol
2022-06-03 21:59:51 +02:00
parent 827cad0127
commit 5e798bd179
8 changed files with 191 additions and 115 deletions

View File

@@ -193,16 +193,21 @@ parse_block(){
}
else if(token_match_keyword(keyword_for)){
Ast_Expr *expr_first = parse_expr();
Ast_Expr *init = parse_init_stmt(expr_first);
Ast_Expr *init = 0;
Ast_Expr *cond = 0;
Ast_Expr *iter = 0;
if(token_match(TK_Comma)){
cond = parse_expr();
if(!token_is(OPEN_SCOPE)){
Ast_Expr *expr_first = parse_expr();
init = parse_init_stmt(expr_first);
if(token_match(TK_Comma)){
iter = parse_expr();
iter = parse_init_stmt(iter);
cond = parse_expr();
if(token_match(TK_Comma)){
iter = parse_expr();
iter = parse_init_stmt(iter);
}
}
}
@@ -345,7 +350,7 @@ binding_power(Binding binding, Token_Kind kind){
case TK_Mod:
return {17,18};
case TK_Dot:
return {20,19};
return {24,23};
default: return {};
}
Postfix: switch(kind){