caffeine_lang/frontend/ast

Types

A single blueprint item with name, extends, requires, and provides.

pub type BlueprintItem {
  BlueprintItem(
    name: String,
    extends: List(String),
    requires: Struct,
    provides: Struct,
    leading_comments: List(Comment),
  )
}

Constructors

  • BlueprintItem(
      name: String,
      extends: List(String),
      requires: Struct,
      provides: Struct,
      leading_comments: List(Comment),
    )

A block of blueprints for one or more artifacts.

pub type BlueprintsBlock {
  BlueprintsBlock(
    artifacts: List(ParsedArtifactRef),
    items: List(BlueprintItem),
    leading_comments: List(Comment),
  )
}

Constructors

A blueprints file containing type aliases, extendables, and blueprint blocks. Type aliases must come before extendables, which must come before blocks. The phantom phase parameter tracks whether the file has been validated.

pub type BlueprintsFile(phase) {
  BlueprintsFile(
    type_aliases: List(TypeAlias),
    extendables: List(Extendable),
    blocks: List(BlueprintsBlock),
    trailing_comments: List(Comment),
  )
}

Constructors

A comment attached to an AST node.

pub type Comment {
  LineComment(text: String)
  SectionComment(text: String)
}

Constructors

  • LineComment(text: String)
  • SectionComment(text: String)

A single expectation item with name, extends, and provides.

pub type ExpectItem {
  ExpectItem(
    name: String,
    extends: List(String),
    provides: Struct,
    leading_comments: List(Comment),
  )
}

Constructors

  • ExpectItem(
      name: String,
      extends: List(String),
      provides: Struct,
      leading_comments: List(Comment),
    )

A block of expectations for a blueprint.

pub type ExpectsBlock {
  ExpectsBlock(
    blueprint: String,
    items: List(ExpectItem),
    leading_comments: List(Comment),
  )
}

Constructors

  • ExpectsBlock(
      blueprint: 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

An extendable block that can be inherited by blueprints or expectations.

pub type Extendable {
  Extendable(
    name: String,
    kind: ExtendableKind,
    body: Struct,
    leading_comments: List(Comment),
  )
}

Constructors

The kind of extendable (Requires for types, Provides for values).

pub type ExtendableKind {
  ExtendableRequires
  ExtendableProvides
}

Constructors

  • ExtendableRequires
  • ExtendableProvides

A field with a name and value (either a type or a literal).

pub type Field {
  Field(
    name: String,
    value: Value,
    leading_comments: List(Comment),
  )
}

Constructors

  • Field(
      name: String,
      value: Value,
      leading_comments: List(Comment),
    )

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))
  • LiteralStruct(
      fields: List(Field),
      trailing_comments: List(Comment),
    )

Marker type for parsed (not yet validated) AST.

pub type Parsed

A parsed artifact reference — the closed set of valid artifact types.

pub type ParsedArtifactRef {
  ParsedSLO
  ParsedDependencyRelations
}

Constructors

  • ParsedSLO
  • ParsedDependencyRelations

A struct containing a list of fields.

pub type Struct {
  Struct(fields: List(Field), trailing_comments: List(Comment))
}

Constructors

  • Struct(fields: List(Field), 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

Marker type for validated AST.

pub type Validated

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

Search Document