Skip to main content

parse_clause

Function parse_clause 

Source
pub fn parse_clause(s: &str) -> Result<Clause, String>
Expand description

Parse a single clause.

Two shapes are recognised:

  • Single-var (Layers 1–6): var in expr. The lone variable on the LHS binds successive values from the single source on the RHS. This is the historical shape and remains the common case.
  • Parallel-iter (SRD-18c Layer 7a): (a, b, …) in (e1, e2, …). Each variable on the LHS binds the corresponding source on the RHS; the sources advance in lockstep (“zip”). Length-mismatch across the group is a strict-mode error at scope-init.

Returns Err for malformed input — the caller decides whether to keep going with whatever did parse cleanly. The error message names the clause text so it’s surfaceable as a diagnostic.