More for loop variations working
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -179,9 +179,9 @@ int main(){
|
||||
printf("%s", result.str);
|
||||
result = compile_file("lambdas.kl"_s);
|
||||
printf("%s", result.str);
|
||||
#endif
|
||||
result = compile_file("new_types.kl"_s);
|
||||
printf("%s", result.str);
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
@@ -203,12 +203,14 @@ parse_block(){
|
||||
Ast_Expr *iter = 0;
|
||||
|
||||
if(!token_is(OPEN_SCOPE)){
|
||||
Ast_Expr *expr_first = parse_expr();
|
||||
init = parse_init_stmt(expr_first);
|
||||
if(!token_is(TK_Comma)){
|
||||
Ast_Expr *expr_first = parse_expr();
|
||||
init = parse_init_stmt(expr_first);
|
||||
}
|
||||
|
||||
|
||||
if(token_match(TK_Comma)){
|
||||
cond = parse_expr();
|
||||
if(!token_is(TK_Comma)) cond = parse_expr();
|
||||
if(token_match(TK_Comma)){
|
||||
iter = parse_expr();
|
||||
iter = parse_init_stmt(iter);
|
||||
@@ -480,12 +482,15 @@ parse_struct(Token *pos){
|
||||
token_match(OPEN_SCOPE);
|
||||
do{
|
||||
Token *token = token_get();
|
||||
|
||||
Ast_Named *named = parse_named(false);
|
||||
named->flags = set_flag(named->flags, AST_AGGREGATE_CHILD);
|
||||
if(!named) parsing_error(token, "Failed to parse struct member");
|
||||
named->flags = set_flag(named->flags, AST_AGGREGATE_CHILD);
|
||||
|
||||
if(named->kind == AST_CONST){
|
||||
members_const.add((Ast_Const *)named);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
assert(named->kind == AST_VAR);
|
||||
members.add((Ast_Var *)named);
|
||||
}
|
||||
|
||||
16
new_types.kl
16
new_types.kl
@@ -70,8 +70,24 @@ basic_type_assignment :: ()
|
||||
compounds :: ()
|
||||
custom_data := Custom_Data(thing = 23)
|
||||
|
||||
for thing2 := 10
|
||||
pass
|
||||
|
||||
for thing1 := 10,,thing1+=1
|
||||
pass
|
||||
|
||||
for
|
||||
pass
|
||||
|
||||
for i := 0, i, i+=1
|
||||
pass
|
||||
|
||||
for j:=0, j < 10
|
||||
pass
|
||||
|
||||
|
||||
Custom_Data :: struct
|
||||
thing: S32
|
||||
|
||||
// constant_proc :: ()
|
||||
// constant_proc()
|
||||
|
||||
Reference in New Issue
Block a user