fix: different attempt
This commit is contained in:
parent
74df7f8a7c
commit
474df4a3ae
|
@ -93,26 +93,16 @@ fn term() -> impl Parser<char, Term<Name>, Error = Simple<char>> {
|
||||||
});
|
});
|
||||||
|
|
||||||
let apply = recursive(|a| {
|
let apply = recursive(|a| {
|
||||||
let lambda = keyword("lam")
|
|
||||||
.ignore_then(name().padded())
|
|
||||||
.then(term.clone())
|
|
||||||
.delimited_by(just('(').padded(), just(')').padded())
|
|
||||||
.map(|(parameter_name, t)| Term::Lambda {
|
|
||||||
parameter_name,
|
|
||||||
body: Box::new(t),
|
|
||||||
});
|
|
||||||
|
|
||||||
var()
|
var()
|
||||||
.or(lambda)
|
.or(term.clone())
|
||||||
.or(a.delimited_by(just('[').padded(), just(']').padded()))
|
|
||||||
.padded()
|
.padded()
|
||||||
.then(term)
|
.then(a)
|
||||||
.delimited_by(just('[').padded(), just(']').padded())
|
|
||||||
.map(|(function, argument)| Term::Apply {
|
.map(|(function, argument)| Term::Apply {
|
||||||
function: Box::new(function),
|
function: Box::new(function),
|
||||||
argument: Box::new(argument),
|
argument: Box::new(argument),
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
|
.delimited_by(just('[').padded(), just(']').padded());
|
||||||
|
|
||||||
constant()
|
constant()
|
||||||
.or(builtin())
|
.or(builtin())
|
||||||
|
|
Loading…
Reference in New Issue