tree: add tree branch reference
allow multiple independent iterators for the same underlying tree safety: not very good, but should work because original tree is kept in Parser and branches are only used during its lifetime
This commit is contained in:
parent
4a7967812e
commit
c7b3aa560b
3 changed files with 39 additions and 31 deletions
|
@ -418,7 +418,7 @@ mod test {
|
|||
macro_rules! test_parse {
|
||||
($src:expr $(,$($event:expr),* $(,)?)?) => {
|
||||
let t = super::TreeParser::new($src).parse();
|
||||
let actual = t.map(|ev| (ev.kind, ev.span.of($src))).collect::<Vec<_>>();
|
||||
let actual = t.root().map(|ev| (ev.kind, ev.span.of($src))).collect::<Vec<_>>();
|
||||
let expected = &[$($($event),*,)?];
|
||||
assert_eq!(actual, expected, "\n\n{}\n\n", $src);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue