Expand description
The typed AST over the rowan tree (docs/ROADMAP.md epic E1.2a, ADR-0007 decision 1).
The node structs and their mechanical accessors live in the generated
module,
written by cargo xtask codegen from family.ungram and committed; an
xtask drift test keeps the two in sync. This module adds the hand-written
layer the generator does not cover:
- the
AstNodetrait and theAstChildreniterator; - the enums over pure node alternations (
Definition,Backing,StructMember,FieldType); - the
HasName/HasModifiers/HasDocCommentstrait trio shared by the definition kinds of every profile; - the position-sensitive accessors whose roles are told apart by anchor
tokens (
Constraint::minand friends,ConstDef::regex).
Every accessor walks child kinds and returns Option/empty iterators on
a malformed tree — it never panics.
Structs§
- Array
Type - A
ArrayTypenode (family.ungramruleArrayType). - AstChildren
- An iterator over the children of a node that cast to
N, in source order. - Attr
Block - A
AttrBlocknode (family.ungramruleAttrBlock). - Attr
Value - A
AttrValuenode (family.ungramruleAttrValue). - Attribute
- A
Attributenode (family.ungramruleAttribute). - Binary
Expr - A
BinaryExprnode (family.ungramruleBinaryExpr). - Bound
- A
Boundnode (family.ungramruleBound). - Command
Def - A
CommandDefnode (family.ungramruleCommandDef). - Component
Def - A
ComponentDefnode (family.ungramruleComponentDef). - Component
Line - A
ComponentLinenode (family.ungramruleComponentLine). - Const
Def - A
ConstDefnode (family.ungramruleConstDef). - Constraint
- A
Constraintnode (family.ungramruleConstraint). - Deployment
Def - A
DeploymentDefnode (family.ungramruleDeploymentDef). - Distribution
Def - A
DistributionDefnode (family.ungramruleDistributionDef). - Dotted
Name - A
DottedNamenode (family.ungramruleDottedName). - EnumDef
- A
EnumDefnode (family.ungramruleEnumDef). - Enum
SetBit - A
EnumSetBitnode (family.ungramruleEnumSetBit). - Enum
SetDef - A
EnumSetDefnode (family.ungramruleEnumSetDef). - Enum
Value - A
EnumValuenode (family.ungramruleEnumValue). - Error
Node - An error-recovery node wrapping the tokens the parser skipped
(task E1.2c). The one node kind with no rule in
family.ungram. - Event
Def - A
EventDefnode (family.ungramruleEventDef). - Fallible
Type - A
FallibleTypenode (family.ungramruleFallibleType). - Field
Def - A
FieldDefnode (family.ungramruleFieldDef). - Fixed
Def - A
FixedDefnode (family.ungramruleFixedDef). - Import
- A
Importnode (family.ungramruleImport). - Init
Value - A
InitValuenode (family.ungramruleInitValue). - Interface
Def - A
InterfaceDefnode (family.ungramruleInterfaceDef). - Literal
- A
Literalnode (family.ungramruleLiteral). - Literal
Expr - A
LiteralExprnode (family.ungramruleLiteralExpr). - Machine
Def - A
MachineDefnode (family.ungramruleMachineDef). - MapType
- A
MapTypenode (family.ungramruleMapType). - Member
Expr - A
MemberExprnode (family.ungramruleMemberExpr). - Member
Line - A
MemberLinenode (family.ungramruleMemberLine). - Name
- A
Namenode (family.ungramruleName). - Optional
Type - A
OptionalTypenode (family.ungramruleOptionalType). - Package
Decl - A
PackageDeclnode (family.ungramrulePackageDecl). - Param
- A
Paramnode (family.ungramruleParam). - Param
List - A
ParamListnode (family.ungramruleParamList). - Paren
Expr - A
ParenExprnode (family.ungramruleParenExpr). - Path
Expr - A
PathExprnode (family.ungramrulePathExpr). - Path
Type - A
PathTypenode (family.ungramrulePathType). - Prefix
Expr - A
PrefixExprnode (family.ungramrulePrefixExpr). - Primitive
Type - A
PrimitiveTypenode (family.ungramrulePrimitiveType). - Qualified
Name - A
QualifiedNamenode (family.ungramruleQualifiedName). - Query
Def - A
QueryDefnode (family.ungramruleQueryDef). - Reference
- A
Referencenode (family.ungramruleReference). - Reserved
Entry - A
ReservedEntrynode (family.ungramruleReservedEntry). - Return
Type - A
ReturnTypenode (family.ungramruleReturnType). - Service
Def - A
ServiceDefnode (family.ungramruleServiceDef). - Signal
Def - A
SignalDefnode (family.ungramruleSignalDef). - Source
File - A
SourceFilenode (family.ungramruleSourceFile). - Stream
Type - A
StreamTypenode (family.ungramruleStreamType). - Struct
Def - A
StructDefnode (family.ungramruleStructDef). - System
Def - A
SystemDefnode (family.ungramruleSystemDef). - Timing
- A
Timingnode (family.ungramruleTiming). - Timing
Range - A
TimingRangenode (family.ungramruleTimingRange). - Tuple
Field - A
TupleFieldnode (family.ungramruleTupleField). - Tuple
Type - A
TupleTypenode (family.ungramruleTupleType). - TypeDef
- A
TypeDefnode (family.ungramruleTypeDef). - Union
Arm - A
UnionArmnode (family.ungramruleUnionArm). - Union
Def - A
UnionDefnode (family.ungramruleUnionDef). - Unit
Expr - A
UnitExprnode (family.ungramruleUnitExpr).
Enums§
- Backing
- The backing of a
typedefinition — theBackingalternation (typl reference §4–§5). - Component
Line Kind - Which keyword a
ComponentLinecarries (rsdl reference §3.2). - Definition
- One top-level definition — the
Definitionalternation. - Expr
- One expression of the guaranteed subset — the
Expralternation (expr-core specification §3.1, ridl reference §13, epic E2.4). - Field
Type - The type of a field, tuple field, or collection element — the
FieldTypealternation (typl reference §7, §11–§12). - Interface
Member - One member of an
interfacebody — theInterfaceMemberalternation (ridl reference §14.0–§14.1, epic E2.1a). - Interface
Shape - One interface shape declared in a file (ridl §14.0): an
interfacedeclaration, or the inline shape of aservice(§14.5). - Param
Type - The type of a command or query parameter — the
ParamTypealternation (ridl reference §6.1, §7.1, §12): a field type or a stream<T>. - Predicate
Kind - Which predicate keyword an
Attributecarries (general form §4.2, ridl reference §13). - Struct
Member - One member of a
structbody — theStructMemberalternation (typl reference §7).
Traits§
- AstNode
- A typed view over a
SyntaxNodeof a known kind. - HasDoc
Comments - A node that doc comments attach to (typl reference §14). Doc comments are trivia tokens, so they sit before the node rather than inside it.
- HasModifiers
- A node that accepts the
internal/errorprefix modifiers (general form §2; typl reference §3.3, §10.1). - HasName
- A node that declares a
Name.