Skip to main content

Module expression

Module expression 

Source
Expand description

Expression parsing for computed values in ceremony DSL.

This module provides types and functions for parsing pipeline expressions that compute values at runtime, such as ${artifact.ksr | sha256 | hex}.

§Syntax

Expressions use Unix-style pipes:

${artifact.ksr | sha256 | hex}
${artifact.keypair.public | fingerprint | hex | upper}
${concat(artifact.a | sha256, artifact.b | sha256) | hex}

§Design Principles

  • Bytes-first: Hash functions return raw bytes; encoding is explicit
  • Left-to-right: Data flows through transformations naturally
  • Safe: All functions are total and terminate (no user-defined functions)

§Grammar

The formal grammar is documented in docs/dsl/grammar.md (not yet published).

Structs§

InvalidExpression
A ${...} occurrence that does not parse as an expression.
LocatedExpression
An expression with its location in the source string.
PipeStage
A stage in a pipeline.
Reference
A reference to a ceremony value: ${type.name} or ${type.name.property}.

Enums§

ExprError
Why a ${...} occurrence is not a usable expression.
ExprValue
A value that may contain deferred expressions (parsed, not yet evaluated).
Expression
A parsed expression from ceremony YAML.
Literal
A literal value in an expression.
RefType
The type/namespace of a reference.
StringPart
A part of an interpolated string.
Value
A runtime value in the expression system.

Functions§

find_expressions
Find all expressions in a string.
find_invalid_expressions
Find every ${...} in s that does not parse as an expression.
parse_expr_value
Parse a JSON value into an ExprValue, extracting all ${...} expressions.
parse_expression
Parse an expression string.
parse_expression_detailed
Parse an expression string, reporting why it is not one.