Going to switch to using immutable fn instead of FnMut so I can easily make a context tree.

This commit is contained in:
Tom Alexander
2022-11-24 14:30:54 -05:00
parent 806070169a
commit 6f416f6997
3 changed files with 14 additions and 131 deletions

View File

@@ -138,8 +138,9 @@ pub fn paragraph_end(input: &str) -> Res<&str, &str> {
pub fn document(input: &str) -> Res<&str, Vec<(Vec<TextElement>, &str)>> {
let initial_context = TestContext::new();
let paragraph_context =
initial_context.with_additional_fail_matcher(Rc::new(RefCell::new(paragraph_end)));
let paragraph_context = initial_context;
// let paragraph_context =
// initial_context.with_additional_fail_matcher(Rc::new(RefCell::new(paragraph_end)));
// let initial_context = NomContext::new(Rc::new(RefCell::new(paragraph_end)));
let ret = many1(parser_with_context!(paragraph)(&paragraph_context))(input);
ret