Crate wdl_grammar

Crate wdl_grammar 

Source
Expand description

Lexing and parsing for Workflow Description Language (WDL) documents.

This crate implements an infallible WDL parser based on the logos crate for lexing and the rowan crate for concrete syntax tree (CST) representation.

The parser outputs a list of parser events that can be used to construct the CST; the parser also keeps a list of Diagnostics emitted during the parse that relate to spans from the original source.

See SyntaxTree::parse for parsing WDL source; users may inspect the resulting CST to determine the version of the document that was parsed.

§Examples

An example of parsing WDL source into a CST and printing the tree:

use wdl_grammar::SyntaxTree;

let (tree, diagnostics) = SyntaxTree::parse("version 1.1");
assert!(diagnostics.is_empty());
println!("{tree:#?}");

Re-exports§

pub use version::SupportedVersion;

Modules§

dive
Utilities for traversing a syntax tree while collecting elements of interest (i.e., “diving” for elements).
grammar
Module for the WDL grammar functions.
lexer
Module for the lexer implementation.
parser
Module for the parser implementation.
version
Representation for version definitions.

Structs§

Diagnostic
Represents a diagnostic to display to the user.
Label
Represents a label that annotates the source code.
Span
Represents a span of source.
SyntaxTree
Represents an untyped concrete syntax tree.
WorkflowDescriptionLanguage
Represents the Workflow Definition Language (WDL).

Enums§

Severity
Represents the severity of a diagnostic.
SyntaxKind
Represents the kind of syntax element (node or token) in a WDL concrete syntax tree (CST).

Statics§

ALL_SYNTAX_KIND
Every SyntaxKind variant.

Traits§

SyntaxTokenExt
An extension trait for SyntaxTokens.

Functions§

construct_tree
Constructs a concrete syntax tree from a list of parser events.

Type Aliases§

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