Syntax Tree library used throughout the rust analyzer.
- easy and fast incremental re-parsing
- graceful handling of errors
- full-fidelity representation (any text can be precisely represented as a syntax tree)
The most interesting modules here are
syntax_node (which defines concrete
syntax tree) and
ast (which defines abstract syntax tree on top of the
CST). The actual parser live in a separate
parser crate, though the
lexer lives in this crate.
api_walkthrough test in this file for a quick API tour!
Collection of assorted algorithms for syntax trees.
Abstract Syntax Tree, layered on top of untyped
This module contains utilities for rendering syntax nodes into a string representing their signature.
Things which exist to solve practial issues, but which shouldn’t exist.
Primitive tree editor, ed for trees.
A set of utils methods to reuse on other abstraction levels
SyntaxNodePtr, but remembers the type of node.
Internal node in the immutable tree. It has other nodes and tokens as children.
Parse is the result of the parsing: a syntax tree and a collection of
SmolStr is a string type that has the following properties:
Represents the result of unsuccessful tokenization, parsing or tree validation.
A measure of text length. Also, equivalently, an index into text.
The kind of syntax node, e.g.
There might be zero, one or two leaves at a given offset.
WalkEvent describes tree walking process.