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
AltBranch
One guarded or unguarded branch of a case/try alternative.
Binding
ChoiceDecl
Equation
FieldDecl
FixityDecl
Top-level fixity declaration (infix[l|r]? n op [, op ...]).
FunctionDecl
ImportDecl
ImportPackageLabel
Source package label on a package-qualified import (import "pkg" Module).
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
FixityAssoc
Fixity associativity keyword (infix, infixl, infixr).
FixityTarget
Operator or backtick-quoted name in a fixity declaration.
GuardQualifier
Boolean or pattern guard qualifier in a guarded case alternative branch.
ImportStyle
Import syntax style.
InterfaceInstanceBodyItem
One item in an interface instance ... where body, in source order.
LitKind
MalformedSyntaxKind
Recoverable malformed syntax cases that are not just missing one token.
ParseDiagnosticKind
Machine-readable reason a ParseDiagnostic fired.
Pat
PatFieldAssign
RecordPatternSyntax
Record-pattern field syntax: explicit braces or layout with.
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.