Skip to main content

Module syntax

Module syntax 

Source
Expand description

Concrete syntax tree (CST) foundation built on rowan.

The v2 parser produces a lossless SyntaxNode tree: every byte of input source — including whitespace and comments — is reachable from the root via tokens, and walking the tree back to a string yields the original bytes (verbatim).

This module defines:

  • SyntaxKind — the unified token + node taxonomy. Every leaf in a SyntaxNode has a leaf SyntaxKind; every composite branch has a node SyntaxKind.
  • RelonLanguage — the rowan-side phantom that fixes the SyntaxNode / SyntaxToken / SyntaxElement type aliases to our SyntaxKind.

The kinds are organised into ranges so callers can ask “is this a trivia leaf?”, “is this a punctuation leaf?”, “is this a composite node?” without an exhaustive match.

Enums§

RelonLanguage
rowan-side phantom that ties SyntaxKind to rowan’s tree generics. Don’t construct an instance — it’s used only at the type level.
SyntaxKind
All token and node kinds the v2 parser produces. The discriminant is kept stable and small (u16) so rowan’s green tree can stash it efficiently — and so adding a new kind in the middle would shift values, change the boundary checks below. Append-only is the rule: new kinds go before SyntaxKind::__LAST.

Type Aliases§

SyntaxElement
SyntaxNode
Convenience aliases. The vast majority of consumers should reach for these instead of touching rowan generics directly.
SyntaxToken