wdl/
lib.rs

1//! Workflow Description Language (WDL) document parsing and linting.
2//!
3//! The CST is based on the `rowan` crate and represents an immutable red-green
4//! tree. Mutations to the tree require creating a new tree where unaffected
5//! nodes are shared between the old and new trees; the cost of editing a node
6//! of the tree depends solely on the depth of the node, as it must update the
7//! parent chain to produce a new tree root.
8//!
9//! Note that in this implementation, the AST is a facade over the CST; each AST
10//! representation internally holds a CST node or token. As a result, the AST is
11//! very cheaply constructed and may be cheaply cloned at any level.
12//!
13//! # Examples
14//!
15//! An example of parsing WDL source into a CST and printing the tree:
16//!
17//! ```rust
18//! use wdl::grammar::SyntaxTree;
19//!
20//! let (tree, diagnostics) = SyntaxTree::parse("version 1.1");
21//! assert!(diagnostics.is_empty());
22//! println!("{tree:#?}");
23//! ```
24//!
25//! An example of parsing a WDL document into an AST:
26//!
27//! ```rust
28//! # let source = "version 1.1\nworkflow test {}";
29//! use wdl::ast::Document;
30//!
31//! let (document, diagnostics) = Document::parse(source);
32//! if !diagnostics.is_empty() {
33//!     // Handle the failure to parse
34//! }
35//! ```
36
37#![warn(missing_docs)]
38
39#[cfg(feature = "analysis")]
40#[doc(inline)]
41pub use wdl_analysis as analysis;
42#[cfg(feature = "ast")]
43#[doc(inline)]
44pub use wdl_ast as ast;
45#[cfg(feature = "doc")]
46#[doc(inline)]
47pub use wdl_doc as doc;
48#[cfg(feature = "engine")]
49#[doc(inline)]
50pub use wdl_engine as engine;
51#[cfg(feature = "format")]
52#[doc(inline)]
53pub use wdl_format as format;
54#[cfg(feature = "grammar")]
55#[doc(inline)]
56pub use wdl_grammar as grammar;
57#[cfg(feature = "lint")]
58#[doc(inline)]
59pub use wdl_lint as lint;
60#[cfg(feature = "lsp")]
61#[doc(inline)]
62pub use wdl_lsp as lsp;