pub struct SyntaxTree(/* private fields */);Expand description
Represents an untyped concrete syntax tree.
Implementations§
Source§impl SyntaxTree
impl SyntaxTree
Sourcepub fn parse(source: &str) -> (SyntaxTree, Vec<Diagnostic>)
pub fn parse(source: &str) -> (SyntaxTree, Vec<Diagnostic>)
Parses WDL source to produce a syntax tree.
A syntax tree is always returned, even for invalid WDL documents.
Additionally, the list of diagnostics encountered during the parse is returned; if the list is empty, the tree is syntactically correct.
However, additional validation is required to ensure the source is a valid WDL document.
§Example
let (tree, diagnostics) = SyntaxTree::parse("version 1.1");
assert!(diagnostics.is_empty());
println!("{tree:#?}");Sourcepub fn root(&self) -> &SyntaxNode<WorkflowDescriptionLanguage>
pub fn root(&self) -> &SyntaxNode<WorkflowDescriptionLanguage>
Gets the root syntax node of the tree.
Sourcepub fn green(&self) -> Cow<'_, GreenNodeData>
pub fn green(&self) -> Cow<'_, GreenNodeData>
Gets a copy of the underlying root green node for the tree.
Sourcepub fn into_syntax(self) -> SyntaxNode<WorkflowDescriptionLanguage>
pub fn into_syntax(self) -> SyntaxNode<WorkflowDescriptionLanguage>
Converts the tree into a syntax node.
Trait Implementations§
Source§impl Clone for SyntaxTree
impl Clone for SyntaxTree
Source§fn clone(&self) -> SyntaxTree
fn clone(&self) -> SyntaxTree
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyntaxTree
impl Debug for SyntaxTree
Source§impl Display for SyntaxTree
impl Display for SyntaxTree
Source§impl Hash for SyntaxTree
impl Hash for SyntaxTree
Source§impl PartialEq for SyntaxTree
impl PartialEq for SyntaxTree
impl Eq for SyntaxTree
impl StructuralPartialEq for SyntaxTree
Auto Trait Implementations§
impl Freeze for SyntaxTree
impl !RefUnwindSafe for SyntaxTree
impl !Send for SyntaxTree
impl !Sync for SyntaxTree
impl Unpin for SyntaxTree
impl !UnwindSafe for SyntaxTree
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