Documentation
¶
Index ¶
- type ArrayExpr
- type BinaryExpr
- type CoalesceExpr
- type ComparisonPattern
- type ExprNode
- type ExprStmt
- type FieldAccessExpr
- type FnAST
- type FnCallExpr
- type ForExpr
- type IdentExpr
- type IfExpr
- type InExpr
- type IndexExpr
- type InterpolatedStringExpr
- type LambdaExpr
- type LetStmt
- type LiteralExpr
- type LiteralPattern
- type MatchArm
- type MatchExpr
- type ObjectExpr
- type ObjectField
- type ParamNode
- type PatternNode
- type PipeExpr
- type Position
- type QueryExpr
- type RaiseExpr
- type RangePattern
- type RecordField
- type ReturnStmt
- type StmtNode
- type TryExpr
- type TypeDefStmt
- type TypeNode
- type UnaryExpr
- type UseStmt
- type WildcardPattern
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryExpr ¶
type BinaryExpr struct {
Pos Position
Op string // "+", "-", "*", "/", "%", "==", "!=", ">", "<", ">=", "<=", "&&", "||", "++"
Left ExprNode
Right ExprNode
}
BinaryExpr represents a binary operation: a + b, x > 0, a && b, s ++ t
func (*BinaryExpr) ExprPos ¶
func (e *BinaryExpr) ExprPos() Position
type CoalesceExpr ¶
CoalesceExpr provides null coalescing: a ?? b
func (*CoalesceExpr) ExprPos ¶
func (e *CoalesceExpr) ExprPos() Position
type ComparisonPattern ¶
type ComparisonPattern struct {
Pos Position
Op string // "<", ">", "<=", ">=", "==", "!="
Value ExprNode // the operand to compare against
}
ComparisonPattern matches a comparison: when < 0, when >= 100
func (*ComparisonPattern) PatternPos ¶
func (p *ComparisonPattern) PatternPos() Position
type ExprNode ¶
type ExprNode interface {
ExprPos() Position
// contains filtered or unexported methods
}
ExprNode is the interface for all expression nodes.
type ExprStmt ¶
ExprStmt wraps an expression used as a statement (typically the last expression in a block acts as the implicit return value).
type FieldAccessExpr ¶
type FieldAccessExpr struct {
Pos Position
Object ExprNode
Field string
Optional bool // true for ?. (optional chaining)
}
FieldAccessExpr accesses a field on an object: obj.field
func (*FieldAccessExpr) ExprPos ¶
func (e *FieldAccessExpr) ExprPos() Position
type FnAST ¶
type FnAST struct {
Pos Position
Name string
Params []ParamNode
ReturnType TypeNode
Body []StmtNode // one or more statements
IsOneLiner bool // true for => syntax
TypeDefs []TypeDefStmt // local type aliases defined before fn
}
FnAST is the root AST node for a DTL function definition.
type FnCallExpr ¶
type FnCallExpr struct {
Pos Position
Name string // can be namespaced: "shared::analytics::anomaly"
Args []ExprNode
}
FnCallExpr represents a function call: func_name(args)
func (*FnCallExpr) ExprPos ¶
func (e *FnCallExpr) ExprPos() Position
type ForExpr ¶
type ForExpr struct {
Pos Position
Variable string // loop variable name
Index string // optional index variable (empty if not used)
Iterable ExprNode // expression yielding an array
Body ExprNode // body evaluated per iteration
}
ForExpr represents a for-in expression that maps over a collection: for item in items: item.price * item.quantity for item, idx in items: {index: idx, value: item} Returns an array. Desugars semantically to map().
type IfExpr ¶
type IfExpr struct {
Pos Position
Condition ExprNode
Then ExprNode
Else ExprNode // nil if no else branch
}
IfExpr represents a conditional expression: if cond then a else b Else can be another IfExpr for else-if chains.
type InExpr ¶
type InExpr struct {
Pos Position
Value ExprNode // left-hand value to test
Collection ExprNode // right-hand array/object to check membership in
}
InExpr represents a membership test: status in ["active", "pending"]
type InterpolatedStringExpr ¶
type InterpolatedStringExpr struct {
Pos Position
Parts []ExprNode // LiteralExpr (string parts) interspersed with expression nodes
}
InterpolatedStringExpr represents a string with embedded expressions: "hello {name}, temp is {temp | round(1)}" Parts alternate between string literals and evaluated expressions.
func (*InterpolatedStringExpr) ExprPos ¶
func (e *InterpolatedStringExpr) ExprPos() Position
type LambdaExpr ¶
LambdaExpr represents an anonymous function: (x, y) => x + y Also used for desugared pipe shorthand: > 0 becomes (x) => x > 0
func (*LambdaExpr) ExprPos ¶
func (e *LambdaExpr) ExprPos() Position
type LiteralExpr ¶
type LiteralExpr struct {
Pos Position
Value any // Go-native value: int64, float64, string, bool, nil
Type string // "int", "float", "string", "bool", "null"
}
LiteralExpr represents a literal value: 42, 3.14, "hello", true, null
func (*LiteralExpr) ExprPos ¶
func (e *LiteralExpr) ExprPos() Position
type LiteralPattern ¶
LiteralPattern matches a single literal value: when "OK", when 42
func (*LiteralPattern) PatternPos ¶
func (p *LiteralPattern) PatternPos() Position
type MatchArm ¶
type MatchArm struct {
Pos Position
Pattern PatternNode
Body ExprNode
}
MatchArm pairs a pattern with a result expression.
type ObjectExpr ¶
type ObjectExpr struct {
Pos Position
Fields []ObjectField
}
ObjectExpr constructs an object literal: { key: value, ... } Fields is an ordered slice to preserve insertion order.
func (*ObjectExpr) ExprPos ¶
func (e *ObjectExpr) ExprPos() Position
type ObjectField ¶
ObjectField is a single key-value pair in an object literal.
type ParamNode ¶
type ParamNode struct {
Pos Position
Name string
Type TypeNode
Default ExprNode // nil if no default
Variadic bool // true for ...name syntax
}
ParamNode describes a single function parameter.
type PatternNode ¶
type PatternNode interface {
PatternPos() Position
// contains filtered or unexported methods
}
PatternNode is the interface for match-arm patterns.
type PipeExpr ¶
type PipeExpr struct {
Pos Position
Input ExprNode
Function string // function name (may include namespace)
Args []ExprNode
}
PipeExpr represents a pipe chain: expr | func(args) The input is implicitly prepended to the function's argument list.
type QueryExpr ¶
type QueryExpr struct {
Pos Position
Dataset ExprNode // expression that evaluates to dataset name
Chain []PipeExpr // downstream pipe operations (where, select, etc.)
}
QueryExpr represents a dataset query. Two spellings parse to this same node:
- the `query` keyword form: query("dataset_name")
- the namespaced sugar: dataset::query("dataset_name")
The chain is populated when the query is piped into operators (where, select, etc.).
type RaiseExpr ¶
type RaiseExpr struct {
Pos Position
Message ExprNode // expression that evaluates to error message
}
RaiseExpr represents a user-defined error: raise "Temperature exceeds limit"
type RangePattern ¶
RangePattern matches an inclusive range: when 1..10
func (*RangePattern) PatternPos ¶
func (p *RangePattern) PatternPos() Position
type RecordField ¶
type RecordField struct {
Pos Position
Name string
Type TypeNode // recursive — supports nested records
Optional bool // true if the field is optional (name?: type)
}
RecordField describes a single field in a record type.
type ReturnStmt ¶
ReturnStmt represents an explicit return: return expr
func (*ReturnStmt) StmtPos ¶
func (s *ReturnStmt) StmtPos() Position
type StmtNode ¶
type StmtNode interface {
StmtPos() Position
// contains filtered or unexported methods
}
StmtNode is the interface for all statement nodes.
type TypeDefStmt ¶
type TypeDefStmt struct {
Pos Position
Name string // the alias name (e.g. "Person")
Type TypeNode // the record type definition
}
TypeDefStmt represents a local type alias: type Name = record { ... }
func (*TypeDefStmt) StmtPos ¶
func (s *TypeDefStmt) StmtPos() Position
type TypeNode ¶
type TypeNode struct {
Pos Position
Name string // "float", "string", "object", "record", named type, etc.
IsArray bool // true if declared as e.g. "float[]"
Fields []RecordField // non-nil only when Name == "record" (inline record definition)
}
TypeNode represents a type annotation: "float", "string[]", "record { ... }", etc.
type UseStmt ¶
type UseStmt struct {
Pos Position
Namespace string // the namespace to import (e.g., "maintenance")
}
UseStmt imports a namespace shortcut: use maintenance → makes app:maintenance:: functions callable without prefix
type WildcardPattern ¶
type WildcardPattern struct {
Pos Position
}
WildcardPattern matches anything: when _
func (*WildcardPattern) PatternPos ¶
func (p *WildcardPattern) PatternPos() Position