Trying to add order indendent decls
This commit is contained in:
@@ -144,7 +144,7 @@ parse_expr_compound(){
|
||||
while(!token_is(TK_CloseBrace)){
|
||||
Token *token = token_get();
|
||||
Ast_Expr *index = 0;
|
||||
Ast_Expr *name = 0;
|
||||
Ast_Atom *name = 0;
|
||||
if(token_match(TK_OpenBracket)){
|
||||
index = parse_expr();
|
||||
token_expect(TK_CloseBracket);
|
||||
@@ -452,28 +452,4 @@ parse_named(B32 is_global){
|
||||
return result;
|
||||
}
|
||||
|
||||
function Ast_Package *
|
||||
parse_file(){
|
||||
Scratch scratch;
|
||||
|
||||
//
|
||||
// @note: pop the first token with token_next() / token_expect()
|
||||
// which always should be an indentation token,
|
||||
// it updates the indent info on the parser,
|
||||
// making sure that indentation on
|
||||
// the first line is properly updated
|
||||
//
|
||||
Token *token = token_get();
|
||||
Array<Ast_Named *>decls = {scratch};
|
||||
while(!token_is(TK_End)){
|
||||
token_expect(SAME_SCOPE);
|
||||
Ast_Named *decl = parse_named(true);
|
||||
if(!decl) break;
|
||||
|
||||
decls.add(decl);
|
||||
}
|
||||
Ast_Package *result = ast_package(token, token->file, decls);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user