Crate biome_rowan
source ·Expand description
A generic library for lossless syntax trees.
See examples/s_expressions.rs
for a tutorial.
Re-exports§
pub use crate::syntax::chain_trivia_pieces;
pub use crate::syntax::trim_leading_trivia_pieces;
pub use crate::syntax::trim_trailing_trivia_pieces;
pub use crate::syntax::ChainTriviaPiecesIterator;
pub use crate::syntax::Language;
pub use crate::syntax::SendNode;
pub use crate::syntax::SyntaxElement;
pub use crate::syntax::SyntaxElementChildren;
pub use crate::syntax::SyntaxKind;
pub use crate::syntax::SyntaxList;
pub use crate::syntax::SyntaxNode;
pub use crate::syntax::SyntaxNodeChildren;
pub use crate::syntax::SyntaxNodeOptionExt;
pub use crate::syntax::SyntaxRewriter;
pub use crate::syntax::SyntaxSlot;
pub use crate::syntax::SyntaxToken;
pub use crate::syntax::SyntaxTriviaPiece;
pub use crate::syntax::SyntaxTriviaPieceComments;
pub use crate::syntax::TriviaPiece;
pub use crate::syntax::TriviaPieceKind;
pub use crate::syntax::VisitNodeSignal;
Modules§
- Implementation of the cursors – API for convenient access to syntax trees.
- Provides a sample language implementation that is useful in API explanation or tests
Macros§
- Declares a custom union AstNode type with an ungram-like syntax
- Matches a
SyntaxNode
against anast
type.
Structs§
- A checkpoint for maybe wrapping a node. See
GreenNodeBuilder::checkpoint
for details. - Interner for GreenTokens and GreenNodes
- The parsed children of a node, not accounting for any missing children (required or optional)
- Description of the slots of a node in combination with ParsedChildren. It stores for each slot if the node is present in ParsedChildren or not, allowing to generate a node with the right number of empty slots.
- RawSyntaxKind is a type tag for each token or node.
- New-type wrapper around a
GreenNode
. - New-type wrapper to a reference of a
GreenNode
. - New-type wrapper around a
GreenToken
. Allows third-party crates to access limited information on not yet fully constructed nodes. - New-type wrapper to a reference of a
GreenToken
- Represents a set of SyntaxKind as a bitfield, with each bit representing whether the corresponding RawSyntaxKind value is contained in the set
- A range in text, represented as a pair of
TextSize
. - A measure of text length. Also, equivalently, an index into text.
- Reference to the text of a SyntaxToken without having to worry about the lifetime of
&str
. - A builder for a syntax tree.
Enums§
- Errors around the construct of the source type
- There might be zero, one or two leaves at a given offset.
WalkEvent
describes tree walking process.
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. - List of homogenous nodes
- An AstNode that supports dynamic ordering of the fields it contains uses a
slot_map
to map the declared order of fields to the concrete order as parsed from the source content. Implementing this trait lets consumers - List of nodes where every two nodes are separated by a token. For example, the elements of an array where every two elements are separated by a comma token. The list expects that the underlying syntax node has a slot for every node and separator even if they are missing from the source code. For example, a list for
a b
where the,
separator is missing contains the slotsNode(a), Empty, Node(b)
. This also applies for missing nodes: the list for, b,
must have the slotsEmpty, Token(,), Node(b), Token(,)
. - Factory for creating syntax nodes of a particular kind.
- Primitives with a textual length that can be passed to
TextSize::of
.
Functions§
Type Aliases§
- Specific result used when navigating nodes using AST APIs