Expand description
Parser types - AST node definitions for TypeScript.
This module defines the AST node types that match TypeScript’s parser output. The goal is to produce an identical AST structure that can be serialized and consumed by the TypeScript type checker.
DESIGN NOTES:
- We use arena allocation (indices) rather than Box/Rc for node references
- All nodes have common fields: kind, flags, pos, end
- Node-specific data is stored in enum variants
- This design allows efficient serialization to/from JavaScript
PERFORMANCE NOTES:
- The
nodemodule provides a cache-optimized 16-byte node representation - Current
Nodeenum is 208 bytes (0.31 nodes/cache-line) - Node is 16 bytes (4 nodes/cache-line) - 13x better cache locality
Re-exports§
pub use flags::modifier_flags;pub use flags::node_flags;pub use flags::transform_flags;pub use base::NodeIndex;pub use base::NodeList;pub use base::TextRange;pub use node::NodeArena;pub use state::ParseDiagnostic;pub use state::ParserState;
Modules§
- base
- Shared parser base types used by both Node and (legacy) AST.
- flags
- Node flags and modifier flags for AST nodes.
- node
- Thin
NodeArchitecture for Cache-Efficient AST - parse_
rules - Parsing rule modules
- state
- Parser - Cache-optimized parser using
NodeArena - syntax_
kind_ ext - Extended
SyntaxKindvalues for AST nodes that are not tokens. These match TypeScript’sSyntaxKindenum values exactly.