use new def parser for module defs

This commit is contained in:
Folkert 2021-03-17 17:28:27 +01:00
parent cf905a13fa
commit 38d925fea6
4 changed files with 51 additions and 24 deletions

View file

@ -1,7 +1,6 @@
use crate::ast;
use crate::module::module_defs;
use crate::parser::{Parser, State, SyntaxError};
use bumpalo::collections::Vec;
// use crate::module::module_defs;
use crate::parser::{State, SyntaxError};
use bumpalo::Bump;
use roc_region::all::Located;
@ -12,18 +11,6 @@ pub fn parse_expr_with<'a>(
parse_loc_with(arena, input).map(|loc_expr| loc_expr.value)
}
#[allow(dead_code)]
pub fn parse_defs_with<'a>(
arena: &'a Bump,
input: &'a str,
) -> Result<Vec<'a, Located<ast::Def<'a>>>, SyntaxError<'a>> {
let state = State::new(input.trim().as_bytes());
let answer = module_defs().parse(arena, state);
answer
.map(|(_, loc_expr, _)| loc_expr)
.map_err(|(_, fail, _)| fail)
}
#[allow(dead_code)]
pub fn parse_loc_with<'a>(
arena: &'a Bump,