Skip to main content

Module syntax

Module syntax 

Source
Expand description

Unified syntax tree types.

This module defines the core tree data structures shared by all docstring styles. Every parsed docstring is represented as a tree of SyntaxNodes (branches) and SyntaxTokens (leaves), each tagged with a SyntaxKind.

The Parsed struct owns the source text and the root node, and provides a convenience pretty_print method for debugging.

Structs§

Parsed
The result of parsing a docstring.
SyntaxNode
A branch node in the syntax tree.
SyntaxToken
A leaf token in the syntax tree.

Enums§

SyntaxElement
A child element of a SyntaxNode — either a node or a token.
SyntaxKind
Node and token kinds for all docstring styles.

Traits§

Visitor
Trait for visiting syntax tree nodes and tokens.

Functions§

walk
Walk the syntax tree depth-first, calling the visitor methods.