Crate wdl_ast

Source
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;

let (document, diagnostics) = Document::parse(source);
if !diagnostics.is_empty() {
    // Handle the failure to parse
}

Modules§

lexer
Module for the lexer implementation.
v1
AST representation for a 1.x WDL document.
version
Representation for version definitions.

Structs§

Comment
Represents a comment token in the AST.
Diagnostic
Represents a diagnostic to display to the user.
Document
Represents a single WDL document.
Ident
Represents an identifier token.
Label
Represents a label that annotates the source code.
Span
Represents a span of source.
SyntaxTree
Represents an untyped concrete syntax tree.
TokenText
Helper for hashing tokens by their text.
Version
Represents a version in the AST.
VersionStatement
Represents a version statement in a WDL AST.
Whitespace
Represents a whitespace token in the AST.
WorkflowDescriptionLanguage
Represents the Workflow Definition Language (WDL).

Enums§

Ast
Represents the AST of a Document.
Direction
Element
An abstract syntax tree element.
Node
An abstract syntax tree node.
Severity
Represents the severity of a diagnostic.
SupportedVersion
Represents a supported WDL version.
SyntaxKind
Represents the kind of syntax element (node or token) in a WDL concrete syntax tree (CST).
Token
An abstract syntax tree token.

Traits§

AstNode
A trait implemented by AST nodes.
AstToken
A trait implemented by AST tokens.
NewRoot
Implemented by nodes that can create a new root from a different tree node type.
SyntaxExt
An extension trait for SyntaxNodes, SyntaxTokens, and SyntaxElements.
SyntaxTokenExt
An extension trait for SyntaxTokens.
TreeNode
A trait that abstracts the underlying representation of a syntax tree node.
TreeToken
A trait that abstracts the underlying representation of a syntax token.

Type Aliases§

SyntaxElement
Represents an element (node or token) in the concrete syntax tree.
SyntaxNode
Represents a node in the concrete syntax tree.
SyntaxToken
Represents a token in the concrete syntax tree.