Answer architecture round 2: refuse by default where a builtin's operand can be a reference, test the flag against each operand grammar, drop a duplicate test, rename allNeverNumeric, rewrap Computation, and order item 91 after item 4

This commit is contained in:
2026-10-05 01:10:47 +02:00
committed by Lillem4n
parent 94cf741706
commit 0743a049d7
8 changed files with 30 additions and 20 deletions
+4 -4
View File
@@ -133,9 +133,9 @@ type builtin struct {
// operands names the fields the call reads, which expand renders for it; nil
// for a builtin that reads none.
operands func(args []string) []string
// refOperands says an operand may be a reference, so a name read once there has the bare
// reference as a second spelling.
refOperands bool
// noRefOperands says no operand can be a reference, so a name read once there has no
// second spelling.
noRefOperands bool
// proveNumber bounds the number a call's text reads as, token its body, and says which
// datatypes that text is not; set it where every render reads as a finite number, which
// makes the call a calc operand, and leave it nil otherwise.
@@ -281,7 +281,7 @@ func checkReads(t formatToken, fields map[string]node, operands bool) ([]unbound
return nil, err
}
a := splitArm(name, nil)
unbound = append(unbound, unboundRead{head: a.head, tail: joinSegments(a.tail), body: t.body, operand: operands, noRef: operands && !builtins[t.fn].refOperands, err: err})
unbound = append(unbound, unboundRead{head: a.head, tail: joinSegments(a.tail), body: t.body, operand: operands, noRef: operands && builtins[t.fn].noRefOperands, err: err})
}
return unbound, nil
}