Skip to main content

build_rule_shape

Function build_rule_shape 

pub fn build_rule_shape(
    origin: &str,
    alias: Option<&str>,
    expansion: &[Symbol],
    expand1: bool,
    keep_all_tokens: bool,
    empty_indices: &[bool],
    maybe_placeholders: bool,
    display_id: DisplayId,
) -> Result<RuleShape, ShapeError>
Expand description

Build a RuleShape. The single shared implementation — the bridge must call this, never re-derive.

maybe_placeholders gates empty_indices: Lark passes options.empty_indices if maybe_placeholders else None, so false drops every [...] placeholder. Validates Lark’s invariant empty_indices.count(false) == expansion.len() — a violation is a loader error, never a silent path.