Expand description
Lexer, parser, AST, and diagnostics for the Beamfile DSL.
Structs§
- Beam
Decl beam name(params) { ... }.- BeamRef
- A reference to a beam in a
needs [...]list, optionally namespaced by the import aliases it is reached through (api:build,api:db:migrate, or plaincodegen). - Diagnostic
- A renderable diagnostic: a message, an optional label on the offending
span, and optional help text. Built from a
ParseErrorviaParseError::into_diagnostic. - Executor
Decl executor <name> { option value, ... }.- File
- A fully parsed Beamfile.
- Hook
Decl hook <name> { beam <ref> }: a git hook bound to the beam it runs.- Import
import "path" as alias.- LetBinding
let name = value.- LexError
- An error produced while scanning source text into tokens.
- Lexer
- Scans Beamfile source text into a stream of
Tokens. - Parse
Error - An error produced while parsing a token stream (including lexing
errors, surfaced through the same type since callers only ever see
parse’s singleResult). - Span
- A byte-offset span into the original source text.
- Spanned
- A value together with the span of source text it was parsed from.
- String
Template - A string literal parsed into alternating literal text and interpolated
expressions, e.g.
"target/{profile}/app"becomes[Literal("target/"), Expr(Var(profile)), Literal("/app")]. - Token
- A single lexical token together with its span in the source text.
Enums§
- BinOp
- A binary operator usable in an
Expr::Binary. - Executor
Option Value - The value half of an
executor { ... }block’soption valueentry: a string (image "x"), a boolean (remote true), or a list of strings (volumes ["a:/b", "c:/d"]). Unlikeenv’s values, an executor option is never a bare identifier — seeparser.rs’sparse_executor_decl. - Expr
- An expression, as used in
letbindings and interpolated{expr}segments of aStringTemplate. - Template
Part - One piece of a
StringTemplate: either literal text or a{expr}interpolation. - Token
Kind - The kind of a lexical token in the Beamfile DSL.
Functions§
- parse
- Parses a whole Beamfile from source text into a typed
File. - parse_
template - Parses a single quoted string literal (e.g.
"target/{profile}/app", quotes included) into aStringTemplate, treatingsourceas though it were the whole world: spans in the result are 0-based byte offsets intosourceitself. Use [parse_template_at] when the literal is embedded in a larger file and spans must land in that original source. - render_
diagnostic - Renders
erragainstsource(identified aspathin the output) using miette’s graphical report handler, producing the source line, a caret under the exact span, and the help text if present.
Type Aliases§
- Named
String - A
NAME = valueentry in anenv { ... }block: a name paired with its templated string value. Named to keep clippy’stype_complexitylint quiet.