caffeine_lang/frontend/ast
Types
A comment attached to an AST node.
pub type Comment {
LineComment(text: String)
SectionComment(text: String)
DocComment(text: String)
}
Constructors
-
LineComment(text: String) -
SectionComment(text: String) -
DocComment(text: String)A
###-prefixed doc comment. When attached to anExpectItem’sleading_comments, the text becomes the SLO description in the Datadog Terraform output.
A block of expectations for a measurement.
pub type ExpectsBlock {
ExpectsBlock(
measurement: option.Option(String),
items: List(ExpectItem),
leading_comments: List(Comment),
)
}
Constructors
-
ExpectsBlock( measurement: option.Option(String), items: List(ExpectItem), leading_comments: List(Comment), )
An expects file containing extendables and expects blocks.
The phantom phase parameter tracks whether the file has been validated.
pub type ExpectsFile(phase) {
ExpectsFile(
extendables: List(Extendable),
blocks: List(ExpectsBlock),
trailing_comments: List(Comment),
)
}
Constructors
-
ExpectsFile( extendables: List(Extendable), blocks: List(ExpectsBlock), trailing_comments: List(Comment), )
An extendable block that can be inherited by measurements or expectations.
pub type Extendable {
Extendable(
name: String,
kind: ExtendableKind,
body: Struct,
leading_comments: List(Comment),
)
}
Constructors
-
Extendable( name: String, kind: ExtendableKind, body: Struct, leading_comments: List(Comment), )
The kind of extendable (Requires for types, Provides for values).
pub type ExtendableKind {
ExtendableRequires
ExtendableProvides
}
Constructors
-
ExtendableRequires -
ExtendableProvides
Literal values.
pub type Literal {
LiteralString(value: String)
LiteralInteger(value: Int)
LiteralFloat(value: Float)
LiteralPercentage(value: Float)
LiteralTrue
LiteralFalse
LiteralList(elements: List(Literal))
LiteralStruct(
fields: List(Field),
trailing_comments: List(Comment),
)
}
Constructors
-
LiteralString(value: String) -
LiteralInteger(value: Int) -
LiteralFloat(value: Float) -
LiteralPercentage(value: Float) -
LiteralTrue -
LiteralFalse -
LiteralList(elements: List(Literal)) -
A measurements file containing type aliases, extendables, and measurement items.
Type aliases must come before extendables, which must come before items.
The phantom phase parameter tracks whether the file has been validated.
pub type MeasurementsFile(phase) {
MeasurementsFile(
type_aliases: List(TypeAlias),
extendables: List(Extendable),
items: List(MeasurementItem),
trailing_comments: List(Comment),
)
}
Constructors
-
MeasurementsFile( type_aliases: List(TypeAlias), extendables: List(Extendable), items: List(MeasurementItem), trailing_comments: List(Comment), )
A type alias that defines a named, reusable refined type. Example: _env (Type): String { x | x in { prod, staging, dev } }
pub type TypeAlias {
TypeAlias(
name: String,
type_: types.ParsedType,
leading_comments: List(Comment),
)
}
Constructors
-
TypeAlias( name: String, type_: types.ParsedType, leading_comments: List(Comment), )
A value in a field - either a type (in Requires) or a literal (in Provides).
pub type Value {
TypeValue(type_: types.ParsedType)
LiteralValue(literal: Literal)
}
Constructors
-
TypeValue(type_: types.ParsedType) -
LiteralValue(literal: Literal)