mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
fix: add newline error by colon
This commit is contained in:
parent
436be4f0ff
commit
d828801484
1 changed files with 14 additions and 0 deletions
|
@ -1654,6 +1654,11 @@ impl Parser {
|
|||
};
|
||||
if self.cur_is(Colon) {
|
||||
self.lpop();
|
||||
if self.cur_is(EOF) {
|
||||
let err = ParseError::expect_next_line_error(line!() as usize, op.loc(), "Lambda");
|
||||
self.errs.push(err);
|
||||
return Err(());
|
||||
}
|
||||
let body = self
|
||||
.try_reduce_block()
|
||||
.map_err(|_| self.stack_dec(fn_name!()))?;
|
||||
|
@ -2096,6 +2101,15 @@ impl Parser {
|
|||
break;
|
||||
}
|
||||
let op = self.lpop();
|
||||
if self.cur_is(EOF) {
|
||||
let err = ParseError::expect_next_line_error(
|
||||
line!() as usize,
|
||||
op.loc(),
|
||||
"Lambda",
|
||||
);
|
||||
self.errs.push(err);
|
||||
return Err(());
|
||||
}
|
||||
let lhs = enum_unwrap!(stack.pop(), Some:(ExprOrOp::Expr:(_)));
|
||||
let t_spec_as_expr = self
|
||||
.try_reduce_expr(false, in_type_args, in_brace, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue