Documentation
¶
Overview ¶
Package ast defines the lossless syntax tree. It intentionally contains a NativeStatement node: Ruby/Rails DSLs are open ended, so Ruby-only constructs can survive parsing without weakening the typed, portable subset.
Index ¶
- type ArrayLiteral
- type AssignmentStatement
- type Attribute
- type Base
- type BinaryExpression
- type BlankStatement
- type BlockExpression
- type BreakStatement
- type CallArgument
- type CallExpression
- type CaseBranch
- type CaseStatement
- type ClassStatement
- type CommentStatement
- type EnumMemberStatement
- type EnumStatement
- type Expression
- type ExpressionStatement
- type FieldStatement
- type GenericExpression
- type HashEntry
- type HashLiteral
- type Identifier
- type IfBranch
- type IfStatement
- type ImportStatement
- type IndexExpression
- type InterfaceStatement
- type InterpolatedString
- type IterationExpression
- type Literal
- type LiteralKind
- type MemberExpression
- type MethodStatement
- type ModuleStatement
- type NativeBlock
- type NativeExpression
- type NativeStatement
- type NextStatement
- type Node
- type Parameter
- type PatternBinding
- type Program
- type RangeExpression
- type RecordFieldStatement
- type RecordStatement
- type ReturnStatement
- type Statement
- type StringPart
- type SymbolLiteral
- type TypeParameter
- type TypeRef
- type UnaryExpression
- type VariableStatement
- type WhileStatement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayLiteral ¶
type ArrayLiteral struct {
Base
Elements []Expression
}
type AssignmentStatement ¶
type AssignmentStatement struct {
Base
Target Expression
Operator string
Value Expression
}
type Attribute ¶
type Attribute struct {
Base
Name string
Arguments []CallArgument
}
type BinaryExpression ¶
type BinaryExpression struct {
Base
Left Expression
Operator string
Right Expression
}
type BlankStatement ¶
type BlankStatement struct{ Base }
type BlockExpression ¶
type BreakStatement ¶
type BreakStatement struct{ Base }
type CallArgument ¶
type CallArgument struct {
Name string
Value Expression
Splat string
}
type CallExpression ¶
type CallExpression struct {
Base
Callee Expression
Arguments []CallArgument
Block *BlockExpression
}
type CaseBranch ¶
type CaseBranch struct {
Base
Value Expression
Bindings []PatternBinding
Body []Statement
}
type CaseStatement ¶
type CaseStatement struct {
Base
Value Expression
Leading []Statement
Branches []CaseBranch
Else []Statement
HasElse bool
}
type ClassStatement ¶
type ClassStatement struct {
Base
Name string
Superclass Expression
Implements []string
Body []Statement
}
type CommentStatement ¶
type EnumMemberStatement ¶
type EnumStatement ¶
type EnumStatement struct {
Base
Name string
TypeParameters []TypeParameter
Body []Statement
}
EnumStatement is a closed nominal set of values. Members remain statements so their source spans and comments survive the syntax and formatting passes.
type Expression ¶
type Expression interface {
Node
// contains filtered or unexported methods
}
type ExpressionStatement ¶
type ExpressionStatement struct {
Base
Expression Expression
}
type FieldStatement ¶
type FieldStatement struct {
Base
Name string
Type TypeRef
Value Expression
ReadOnly bool
}
type GenericExpression ¶
type GenericExpression struct {
Base
Receiver Expression
Arguments []TypeRef
}
type HashEntry ¶
type HashEntry struct {
Key Expression
Value Expression
}
type HashLiteral ¶
type Identifier ¶
type IfBranch ¶
type IfBranch struct {
Condition Expression
Body []Statement
}
type IfStatement ¶
type IfStatement struct {
Base
Condition Expression
Then []Statement
ElseIf []IfBranch
Else []Statement
}
type ImportStatement ¶
type IndexExpression ¶
type IndexExpression struct {
Base
Receiver Expression
Index Expression
}
type InterfaceStatement ¶
type InterfaceStatement struct {
Base
Name string
Methods []*MethodStatement
}
type InterpolatedString ¶
type InterpolatedString struct {
Base
Raw string
Parts []StringPart
}
type IterationExpression ¶
type IterationExpression struct {
Base
Source Expression
Operation string
SliceSize Expression
Initial Expression
WithIndex bool
Block *BlockExpression
}
IterationExpression is the portable, Ruby-shaped collection iteration syntax. It remains an expression in the syntax tree so the original block delimiters can be retained, then lowers to structured iteration IR instead of a target-language callback.
type Literal ¶
type Literal struct {
Base
Kind LiteralKind
Raw string
}
type LiteralKind ¶
type LiteralKind string
const ( StringLiteral LiteralKind = "string" IntegerLiteral LiteralKind = "integer" FloatLiteral LiteralKind = "float" BooleanLiteral LiteralKind = "boolean" NilLiteral LiteralKind = "nil" )
type MemberExpression ¶
type MemberExpression struct {
Base
Receiver Expression
Name string
Safe bool
Namespace bool
}
type MethodStatement ¶
type ModuleStatement ¶
type NativeExpression ¶
type NativeStatement ¶
NativeStatement and NativeBlock are explicit Ruby interoperability nodes. They are rejected by portable backends with a precise diagnostic.
type NextStatement ¶
type NextStatement struct{ Base }
type PatternBinding ¶
PatternBinding is a name introduced by a payload enum pattern. The payload type comes from the matched enum member and is attached in typed IR.
type RangeExpression ¶
type RangeExpression struct {
Base
Start Expression
End Expression
Exclusive bool
}
type RecordFieldStatement ¶
type RecordStatement ¶
RecordStatement is a closed product type. Unlike ClassStatement it has keyword-only construction, public data fields, value semantics, and no inheritance. Backends lower it to their native data representation.
type ReturnStatement ¶
type ReturnStatement struct {
Base
Value Expression
}
type StringPart ¶
type StringPart struct {
Text string
Expression Expression
}
type SymbolLiteral ¶
type TypeParameter ¶
type UnaryExpression ¶
type UnaryExpression struct {
Base
Operator string
Operand Expression
}
type VariableStatement ¶
type WhileStatement ¶
type WhileStatement struct {
Base
Condition Expression
Body []Statement
}