mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
Update parse.rs
This commit is contained in:
parent
3c90d9b8ed
commit
fe7ce9d1b3
1 changed files with 12 additions and 1 deletions
|
@ -3071,7 +3071,18 @@ impl Parser {
|
||||||
"???",
|
"???",
|
||||||
)),
|
)),
|
||||||
},
|
},
|
||||||
// TODO: App, Record, BinOp, UnaryOp,
|
Expr::BinOp(bin) => {
|
||||||
|
let mut args = bin.args.into_iter();
|
||||||
|
let lhs = Self::validate_const_expr(*args.next().unwrap())?;
|
||||||
|
let rhs = Self::validate_const_expr(*args.next().unwrap())?;
|
||||||
|
Ok(ConstExpr::BinOp(ConstBinOp::new(bin.op, lhs, rhs)))
|
||||||
|
}
|
||||||
|
Expr::UnaryOp(unary) => {
|
||||||
|
let mut args = unary.args.into_iter();
|
||||||
|
let arg = Self::validate_const_expr(*args.next().unwrap())?;
|
||||||
|
Ok(ConstExpr::UnaryOp(ConstUnaryOp::new(unary.op, arg)))
|
||||||
|
}
|
||||||
|
// TODO: App, Record,
|
||||||
other => Err(ParseError::syntax_error(
|
other => Err(ParseError::syntax_error(
|
||||||
line!() as usize,
|
line!() as usize,
|
||||||
other.loc(),
|
other.loc(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue