mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Merge branch 'master' into odin-ast-changes
This commit is contained in:
@@ -428,9 +428,21 @@ expect_closing_brace_of_field_list :: proc(p: ^Parser) -> tokenizer.Token {
|
||||
str := tokenizer.token_to_string(token)
|
||||
error(p, end_of_line_pos(p, p.prev_tok), "expected a comma, got %s", str)
|
||||
}
|
||||
return expect_token(p, .Close_Brace)
|
||||
expect_brace := expect_token(p, .Close_Brace)
|
||||
|
||||
if expect_brace.kind != .Close_Brace {
|
||||
for p.curr_tok.kind != .Close_Brace && p.curr_tok.kind != .EOF && !is_non_inserted_semicolon(p.curr_tok) {
|
||||
advance_token(p)
|
||||
}
|
||||
return p.curr_tok
|
||||
}
|
||||
|
||||
return expect_brace
|
||||
}
|
||||
|
||||
is_non_inserted_semicolon :: proc(tok: tokenizer.Token) -> bool {
|
||||
return tok.kind == .Semicolon && tok.text != "\n"
|
||||
}
|
||||
|
||||
is_blank_ident :: proc{
|
||||
is_blank_ident_string,
|
||||
@@ -1312,7 +1324,7 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
|
||||
}
|
||||
|
||||
results: [dynamic]^ast.Expr
|
||||
for p.curr_tok.kind != .Semicolon {
|
||||
for p.curr_tok.kind != .Semicolon && p.curr_tok.kind != .Close_Brace {
|
||||
result := parse_expr(p, false)
|
||||
append(&results, result)
|
||||
if p.curr_tok.kind != .Comma ||
|
||||
|
||||
Reference in New Issue
Block a user