Available on crate feature
ast-models only.Expand description
Abstract syntax tree modeling.
These models are produced by the parser, which lowers the lossless concrete syntax tree into these more convenient structures. Every node keeps track of the Fragment of source code it was parsed from, so later stages (type checking, code generation, etc.) can produce diagnostics pointing at the right code.
The AST is designed to be produced even from source code with syntax errors. Pieces that are missing or could not be parsed show up as ExprKind::Error, Type::Error, or missing identifiers. In those cases the parser will always have emitted at least one error diagnostic.
Modules§
- decl
- Abstract syntax trees related to declarations (items) in source code.
- expr
- AST models for expressions in wright source code.
- identifier
- Identifiers are used throughout wright as variable names, type names, function names, etc. Their modeling is pretty simple, and is defined here.
- literal
- AST node models representing literal values in source code.
- path
- Paths are used in import statements, and can take the place of an Identifier in many places.
- stmt
- AST models for statements and blocks.
- ty
- AST models for type signatures in wright source.
Structs§
- DocComment
- A doc comment (
///,//!,/** */, or/*! */) attached to an item or source file. - Source
File - An entire parsed source file – the root of the AST.
Traits§
- AstNode
- Common functionality for nodes in the AST.