remove the pipe operator

This commit is contained in:
2026-06-06 19:41:54 +02:00
parent c41c22e936
commit 3a53cd4f32
9 changed files with 19 additions and 79 deletions

View File

@@ -439,37 +439,7 @@ impl Parser {
}
fn expression(&mut self) -> Result<Expr, ZernError> {
self.pipe()
}
fn pipe(&mut self) -> Result<Expr, ZernError> {
let mut expr = self.or_and()?;
while self.match_token(&[TokenType::Pipe]) {
let pipe = self.previous().clone();
let right = self.equality()?;
match right.kind {
ExprKind::Call {
callee,
paren,
args,
} => {
let mut new_args = args;
new_args.insert(0, expr);
expr = Expr::new(ExprKind::Call {
callee,
paren,
args: new_args,
})
}
_ => {
return error!(pipe.loc, "tried to pipe into a non-call expression");
}
};
}
Ok(expr)
self.or_and()
}
fn or_and(&mut self) -> Result<Expr, ZernError> {