mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
PNC for Patterns, stabilize formatting
This commit is contained in:
parent
bac165fd99
commit
3b0db07fa1
78 changed files with 789 additions and 332 deletions
|
@ -1,6 +1,7 @@
|
|||
use crate::ast;
|
||||
use crate::ast::Defs;
|
||||
use crate::ast::Header;
|
||||
use crate::ast::Pattern;
|
||||
use crate::ast::SpacesBefore;
|
||||
use crate::header::parse_module_defs;
|
||||
use crate::parser::SourceError;
|
||||
|
@ -32,6 +33,18 @@ pub fn parse_loc_with<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_pattern_with<'a>(
|
||||
arena: &'a Bump,
|
||||
input: &'a str,
|
||||
) -> Result<Loc<Pattern<'a>>, SourceError<'a, SyntaxError<'a>>> {
|
||||
let state = State::new(input.as_bytes());
|
||||
|
||||
match crate::pattern::test_parse_pattern(0, arena, state.clone()) {
|
||||
Ok(loc_patt) => Ok(loc_patt),
|
||||
Err(fail) => Err(SyntaxError::Pattern(fail).into_source_error(&state)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_defs_with<'a>(arena: &'a Bump, input: &'a str) -> Result<Defs<'a>, SyntaxError<'a>> {
|
||||
let state = State::new(input.as_bytes());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue