pub struct BashTree<'a> { /* private fields */ }Expand description
A parsed bash script together with the source text it was parsed from.
Owning the source alongside the tree keeps every BashNode::text result
a borrow of the same buffer, so AST consumers cannot accidentally read
text from a different script.
Implementations§
Source§impl<'a> BashTree<'a>
impl<'a> BashTree<'a>
Sourcepub fn parse(script: &'a str) -> Result<Self, String>
pub fn parse(script: &'a str) -> Result<Self, String>
Parses script into a bash AST.
Returns Err when the grammar cannot be loaded or the script cannot be
parsed at all. A script that parses with syntax errors still yields a
tree; callers that must reject malformed input check
BashTree::has_error.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for BashTree<'a>
impl<'a> Freeze for BashTree<'a>
impl<'a> Move for BashTree<'a>
impl<'a> RefUnwindSafe for BashTree<'a>
impl<'a> Send for BashTree<'a>
impl<'a> Sync for BashTree<'a>
impl<'a> Unpin for BashTree<'a>
impl<'a> UnsafeUnpin for BashTree<'a>
impl<'a> UnwindSafe for BashTree<'a>
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