mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-15 21:23:57 +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
|
|
@ -37,7 +37,7 @@ mod test_parse {
|
|||
};
|
||||
(module => $arena:expr, $input:expr) => {
|
||||
module_defs()
|
||||
.parse($arena, State::new($input.as_bytes()))
|
||||
.parse($arena, State::new($input.as_bytes()), 0)
|
||||
.map(|tuple| tuple.1)
|
||||
};
|
||||
}
|
||||
|
|
@ -802,7 +802,7 @@ mod test_parse {
|
|||
"#
|
||||
);
|
||||
let actual = module_defs()
|
||||
.parse(&arena, State::new(src.as_bytes()))
|
||||
.parse(&arena, State::new(src.as_bytes()), 0)
|
||||
.map(|tuple| tuple.1);
|
||||
|
||||
// It should occur twice in the debug output - once for the pattern,
|
||||
|
|
@ -828,7 +828,7 @@ mod test_parse {
|
|||
|
||||
let state = State::new(src.as_bytes());
|
||||
let parser = module_defs();
|
||||
let parsed = parser.parse(arena, state);
|
||||
let parsed = parser.parse(arena, state, 0);
|
||||
match parsed {
|
||||
Ok((_, _, _state)) => {
|
||||
// dbg!(_state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue