mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Matching C++ parser changes from commit 67ca9166d3.
Without these changes the core library parser fails to parse:
- core/fmt/fmt.odin:
Line 126 (and others):
sbprint(&str, ..args, sep=sep)
- core/fmt/fmt_os.odin:
Line 17 (and others):
return wprint(w, ..args, sep=sep)
- core/log/log.odin:
Line 79 (and others):
logf(.Debug, fmt_str, ..args, location=location)
- core/runtime/core_builtin.odin:
Line 475 (and others):
return append_elems(array, ..args, loc=loc)
This commit is contained in:
@@ -2941,9 +2941,9 @@ parse_call_expr :: proc(p: ^Parser, operand: ^ast.Expr) -> ^ast.Expr {
|
|||||||
p.expr_level += 1
|
p.expr_level += 1
|
||||||
open := expect_token(p, .Open_Paren)
|
open := expect_token(p, .Open_Paren)
|
||||||
|
|
||||||
|
seen_ellipsis := false
|
||||||
for p.curr_tok.kind != .Close_Paren &&
|
for p.curr_tok.kind != .Close_Paren &&
|
||||||
p.curr_tok.kind != .EOF &&
|
p.curr_tok.kind != .EOF {
|
||||||
ellipsis.pos.line == 0 {
|
|
||||||
|
|
||||||
if p.curr_tok.kind == .Comma {
|
if p.curr_tok.kind == .Comma {
|
||||||
error(p, p.curr_tok.pos, "expected an expression not ,")
|
error(p, p.curr_tok.pos, "expected an expression not ,")
|
||||||
@@ -2972,10 +2972,16 @@ parse_call_expr :: proc(p: ^Parser, operand: ^ast.Expr) -> ^ast.Expr {
|
|||||||
fv.value = value
|
fv.value = value
|
||||||
|
|
||||||
arg = fv
|
arg = fv
|
||||||
|
} else if seen_ellipsis {
|
||||||
|
error(p, arg.pos, "Positional arguments are not allowed after '..'")
|
||||||
}
|
}
|
||||||
|
|
||||||
append(&args, arg)
|
append(&args, arg)
|
||||||
|
|
||||||
|
if ellipsis.pos.line != 0 {
|
||||||
|
seen_ellipsis = true
|
||||||
|
}
|
||||||
|
|
||||||
if !allow_token(p, .Comma) {
|
if !allow_token(p, .Comma) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user