pub struct Tree { /* private fields */ }Expand description
A parse tree. See the module documentation for the layout.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn recoveries(&self) -> &[Recovery]
pub fn recoveries(&self) -> &[Recovery]
The labeled errors the parse recovered from, in the order of the text, each standing in
the tree as an <error> node or a <missing> token. Empty after a parse in normal mode.
Sourcepub fn node(&self, index: usize) -> Option<NodeRef<'_>>
pub fn node(&self, index: usize) -> Option<NodeRef<'_>>
The node or token at a position of the postorder, or None past the end.
Sourcepub fn to_text(&self, input: &str, spans: bool) -> String
pub fn to_text(&self, input: &str, spans: bool) -> String
The tree as one line of text, for tests and debugging.
A node is (kind child ...), a token is KIND"text", a hidden token gets a ~ in
front, and a field puts name= before the item. With spans, each item shows its
byte span as @start..end.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Tree
impl Freeze for Tree
impl Move for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more