Skip to main content

Module ast

Module ast 

Source
Expand description

Lossless AST node types produced by the parser. Typed, lossless parse tree produced by the recursive-descent parser (src/parse.rs).

Declarations, expressions, patterns, and most parser DTOs carry both a 1-based source Pos for their first token and a byte Span for their full source extent. Type nodes carry spans only because downstream consumers slice type source text but do not currently need line/column anchors per type fragment. Downstream crates consume this tree directly: daml-fmt re-prints layout from the spans, and daml-lint lowers it onto its own rule-facing IR.

Parser-created trees are the supported construction path. Public fields are exposed so tools can match the tree directly; vectors preserve source order, pos is the first token’s position, and span is the half-open byte range covering the node’s real source tokens.

Re-exports§

pub use crate::lexer::ByteOffset;
pub use crate::lexer::Identifier;
pub use crate::lexer::ModuleName;
pub use crate::lexer::Operator;
pub use crate::lexer::Pos;

Structs§

Alt
Binding
ChoiceDecl
Equation
FieldDecl
FunctionDecl
ImportDecl
InterfaceDecl
InterfaceInstanceDecl
Module
ParseDiagnostic
Parse diagnostic — never fatal under tolerant parsing.
Span
Byte span of an AST node.
TemplateDecl

Enums§

Consuming
Decl
DiagnosticCategory
Why a ParseDiagnostic fired.
DoStmt
ExpectedToken
Expected token or token class for a recoverable parser diagnostic.
Expr
FieldAssign
ImportStyle
Import syntax style.
LitKind
MalformedSyntaxKind
Recoverable malformed syntax cases that are not just missing one token.
ParseDiagnosticKind
Machine-readable reason a ParseDiagnostic fired.
Pat
SkippedDeclarationReason
Why a whole declaration was skipped.
TemplateBodyDecl
Type
Structured Daml type, parsed from the real token stream.
TypeAnnotation
TypeAnnotationContext
The declaration context whose type annotation was malformed.
UnsupportedSyntaxKind
Unsupported syntax families surfaced by the parser.