Skip to main content

stray_value_tokens

Function stray_value_tokens 

Source
pub fn stray_value_tokens(source: &str) -> Vec<String>
Expand description

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. The source text of every token that appeared where a FIELD NAME was expected, and was therefore skipped.

The splitter drops such a token silently, which loses what the author wrote with no diagnostic anywhere:

record Out {
  title
  "hello"
}

title is a line-delimited shorthand field (documented, and correct), and "hello" is then a value with no field name. That compiled clean and the recorded fact took the shorthand’s value instead, so the author’s literal was silently replaced by a different one.

This shares ONE scan with split_field_assignments rather than mirroring it. A second copy would drift, and two scans of the same text disagreeing is the defect this exists to report.