fix: different attempt

This commit is contained in:
rvcas 2022-06-08 23:22:34 -04:00
parent 74df7f8a7c
commit 474df4a3ae
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
1 changed files with 4 additions and 14 deletions

View File

@ -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())