mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Refactor Parser trait to pass min_indent
This removes the need to explicitly pass thru min_indent when using the parser combinators. My ultimate goal here is to evolve the current parser closer toward a purely combinator-based parser, at which point we can more easily transition smoothly to a formal(ish) grammar, or expand the meanings of combinators to include things like: * Incremental (re)parsing * Unified parsing and formatting code * Better error recovery * Using the main parser directly for syntax highlighting
This commit is contained in:
parent
ae1a9e4dd6
commit
07be8ec000
18 changed files with 704 additions and 844 deletions
|
@ -157,7 +157,9 @@ fn parse_all<'a>(arena: &'a Bump, src: &'a str) -> Result<Ast<'a>, SyntaxError<'
|
|||
let (module, state) = module::parse_header(arena, State::new(src.as_bytes()))
|
||||
.map_err(|e| SyntaxError::Header(e.problem))?;
|
||||
|
||||
let (_, defs, _) = module_defs().parse(arena, state).map_err(|(_, e, _)| e)?;
|
||||
let (_, defs, _) = module_defs()
|
||||
.parse(arena, state, 0)
|
||||
.map_err(|(_, e, _)| e)?;
|
||||
|
||||
Ok(Ast { module, defs })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue