Update parse tests to incorporate module headers

This commit is contained in:
Richard Feldman 2020-11-18 22:33:30 -05:00
parent f5a480f799
commit 3e01df2bcf
8 changed files with 63 additions and 26 deletions

View file

@ -174,7 +174,7 @@ pub fn module_name<'a>() -> impl Parser<'a, ModuleName<'a>> {
}
#[inline(always)]
fn app_header<'a>() -> impl Parser<'a, AppHeader<'a>> {
pub fn app_header<'a>() -> impl Parser<'a, AppHeader<'a>> {
parser::map(
and!(
skip_first!(

View file

@ -12,10 +12,10 @@ pub fn parse_expr_with<'a>(arena: &'a Bump, input: &'a str) -> Result<ast::Expr<
parse_loc_with(arena, input).map(|loc_expr| loc_expr.value)
}
#[allow(dead_code)]
pub fn parse_header_with<'a>(arena: &'a Bump, input: &'a str) -> Result<ast::Module<'a>, Fail> {
let state = State::new(input.trim().as_bytes(), Attempting::Module);
let answer = header().parse(arena, state);
answer
.map(|(loc_expr, _)| loc_expr)
.map_err(|(fail, _)| fail)