mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
add lifetime to SyntaxError
This commit is contained in:
parent
148fffe969
commit
38b21c3474
15 changed files with 208 additions and 158 deletions
|
@ -11,14 +11,14 @@ use roc_region::all::Located;
|
|||
pub fn parse_expr_with<'a>(
|
||||
arena: &'a Bump,
|
||||
input: &'a str,
|
||||
) -> Result<ast::Expr<'a>, Bag<'a, SyntaxError>> {
|
||||
) -> Result<ast::Expr<'a>, Bag<'a, SyntaxError<'a>>> {
|
||||
parse_loc_with(arena, input).map(|loc_expr| loc_expr.value)
|
||||
}
|
||||
|
||||
pub fn parse_header_with<'a>(
|
||||
arena: &'a Bump,
|
||||
input: &'a str,
|
||||
) -> Result<ast::Module<'a>, Bag<'a, SyntaxError>> {
|
||||
) -> Result<ast::Module<'a>, Bag<'a, SyntaxError<'a>>> {
|
||||
let state = State::new_in(arena, input.trim().as_bytes(), Attempting::Module);
|
||||
let answer = header().parse(arena, state);
|
||||
|
||||
|
@ -31,7 +31,7 @@ pub fn parse_header_with<'a>(
|
|||
pub fn parse_defs_with<'a>(
|
||||
arena: &'a Bump,
|
||||
input: &'a str,
|
||||
) -> Result<Vec<'a, Located<ast::Def<'a>>>, Bag<'a, SyntaxError>> {
|
||||
) -> Result<Vec<'a, Located<ast::Def<'a>>>, Bag<'a, SyntaxError<'a>>> {
|
||||
let state = State::new_in(arena, input.trim().as_bytes(), Attempting::Module);
|
||||
let answer = module_defs().parse(arena, state);
|
||||
answer
|
||||
|
@ -43,7 +43,7 @@ pub fn parse_defs_with<'a>(
|
|||
pub fn parse_loc_with<'a>(
|
||||
arena: &'a Bump,
|
||||
input: &'a str,
|
||||
) -> Result<Located<ast::Expr<'a>>, Bag<'a, SyntaxError>> {
|
||||
) -> Result<Located<ast::Expr<'a>>, Bag<'a, SyntaxError<'a>>> {
|
||||
let state = State::new_in(arena, input.trim().as_bytes(), Attempting::Module);
|
||||
let parser = space0_before(loc(expr(0)), 0);
|
||||
let answer = parser.parse(&arena, state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue