Skip to main content

Module body

Module body 

Source
Expand description

Rule and flow body parsing: a real AST over body text.

Bodies were historically re-scanned line-by-line at lowering time, which made whitespace load-bearing and let unknown statement forms slip through silently. This module is the statement-form gate: every body must parse into BodyAst, unknown tokens are spanned errors, and lowering consumes structure instead of strings.

Structs§

AccessGrant
Access grant metadata (with access to <resource> { <grant clauses> }) on an effect. On tell, it narrows the turn’s effective authority per Proposal A (spec/agent-harness.md). On invoke, it is the explicit start-grant surface for narrowing the child workflow’s authority.
AccessGrantOp
One operation clause inside a turn-access grant block — an operation name with its optional for <target> reference and/or ["glob", …] path patterns (e.g. recall for issue, read ["docs/**"]).
AfterBlock
BodyAst
CaseBlock
CaseBranch
ConstructUseField
EffectStmt
ExecParse
The -> ingestion contract on an exec: stdout must parse as schema (one object) or, with each, as a JSONL/array stream of schema.
FieldAssign
Prompt
RecordStmt
RegionBlock
DR-0043 Decision 5: a during <cond> { … } on lapse [as x] { … } region (until <cond> is the negated polarity). The region’s steps commit only while the condition holds — checked atomically inside each advancing commit — and the first advancing commit under a broken condition commits the lapse arm instead, exactly once. Statements after the region are the point of no return.
SplitFieldAssignment
A field assignment extracted from a record/payload body without braces. value is None for shorthand-copy fields; otherwise it is the exact source text of the value expression.
TerminalStmt

Enums§

AfterPredicate
BodyEffectKind
BodyStmt
ExecTarget
FieldValue
TerminalKind

Functions§

blank_full_line_comments
Blanks full-line # comments in rule-body TEXT, byte-preservingly: every byte of a comment line except its newline becomes a space, so all spans and offsets downstream still point at the original source. Raw-string (""") interiors are untouched – a markdown heading inside a prompt is content, not a comment. The compile path runs this once per rule body before action/then expansion, so the kernel and every line-based analysis see comment-free text, while whip fmt (which re-emits the raw body text) preserves the comments.
is_iso8601_instant
Structural ISO-8601 instant check (YYYY-MM-DDTHH:MM:SS[.fff](Z|±HH:MM)) for time literals, with calendar-field range validation. Kept dependency-free: the runtime compares instants via SQLite strftime.
parse_first_statement
Parses exactly ONE statement from the front of source (used by then expansion to consume the chained effect statement without parsing — and spuriously diagnosing — the remainder of the enclosing block). Returns the statement and only the diagnostics that single parse produced.
parse_rule_body
parse_short_duration_seconds
Parses short durations: <integer><unit> with unit s, m, h, or d.
split_field_assignments
Token-level field splitting for record/terminal/table-row bodies. The structure comes from tokens, never from line breaks, so single-line and multi-line blocks behave identically. Shorthand (bare name, from blocks only at the call site) is line-delimited: a name with no same-line value is shorthand.