Answer architecture round 3 and principles audits round 2: a weight drawn against nothing names the drop, null alone on stdin names jq, the CLI-copy decision names hasEmptySegment, the padding and layout decisions quote what they catch, and the padded binding is filed

This commit is contained in:
2026-10-07 23:25:14 +02:00
committed by Lillem4n
parent c8193da3d0
commit 57bd06c16f
4 changed files with 21 additions and 12 deletions
+6 -5
View File
@@ -118,12 +118,13 @@ const (
// compileAt compiles a node drawn against no other: no choice's item, or a one-item choice's.
// A weight there does nothing, bar the default 1 written out.
func compileAt(v any, pos position) (node, error) {
w, err := weightOf(v)
if err != nil {
return nil, err
if o, isObject := v.(map[string]any); isObject {
if w, isNumber := o["weight"].(float64); isNumber && w != 1 {
return nil, fmt.Errorf(`weight %v skews a draw between items, and nothing here is drawn against this one; drop "weight"`, w)
}
}
if w != 1 {
return nil, fmt.Errorf(`weight %v skews a draw between items, and nothing here is drawn against this one; drop "weight"`, w)
if _, err := weightOf(v); err != nil {
return nil, err
}
return compileItem(v, pos)
}