Expand description
An abstract syntax tree for Workflow Description Language (WDL) documents.
The AST implementation is effectively a facade over the concrete syntax tree
(CST) implemented by SyntaxTree from wdl-grammar
.
An AST is cheap to construct and may be cheaply cloned at any level.
However, an AST (and the underlying CST) are immutable; updating the tree requires replacing a node in the tree to produce a new tree. The unaffected nodes of the replacement are reused from the old tree to the new tree.
§Examples
An example of parsing a WDL document into an AST and validating it:
use wdl_ast::Document;
use wdl_ast::Validator;
let (document, diagnostics) = Document::parse(source);
if !diagnostics.is_empty() {
// Handle the failure to parse
}
let mut validator = Validator::default();
if let Err(diagnostics) = validator.validate(&document) {
// Handle the failure to validate
}
Modules§
- AST representation for a 1.x WDL document.
- Representation for version definitions.
Structs§
- Represents a comment token in the AST.
- Represents a diagnostic to display to the user.
- Represents a collection of validation diagnostics.
- Represents a single WDL document.
- Represents an identifier token.
- Represents a label that annotates the source code.
- Represents a span of source.
- Represents an untyped concrete syntax tree.
- Helper for hashing any AST token on string representation alone.
- Implements an AST validator.
- Represents a version in the AST.
- Represents a version statement in a WDL AST.
- Represents a whitespace token in the AST.
- Represents the Workflow Definition Language (WDL).
Enums§
- Represents the AST of a Document.
- Represents the severity of a diagnostic.
- Represents a supported WDL version.
- Represents the kind of syntax element (node or token) in a WDL concrete syntax tree (CST).
- Represents the reason an AST node has been visited.
Constants§
- The prefix of
except
comments.
Traits§
- The main trait to go from untyped
SyntaxNode
to a typed AST. The conversion itself has zero runtime cost: AST and syntax nodes have exactly the same representation: a pointer to the tree root and a pointer to the node itself. - An extension trait for AST nodes.
- The trait implemented on AST tokens to go from untyped
SyntaxToken
to a typed representation. - A trait implemented on types that convert to spans.
- A trait used to implement an AST visitor.
Type Aliases§
- Represents an element (node or token) in the concrete syntax tree.
- Represents a node in the concrete syntax tree.
- Represents a token in the concrete syntax tree.