Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
+1
-1
@@ -120,8 +120,8 @@ type builtin struct {
|
|||||||
operands func(args []string) []string
|
operands func(args []string) []string
|
||||||
// number proves what a call prints, token its body: the bounds of its number and the
|
// number proves what a call prints, token its body: the bounds of its number and the
|
||||||
// datatype of its text, prints or one inside it; nil for a builtin whose text is no number.
|
// datatype of its text, prints or one inside it; nil for a builtin whose text is no number.
|
||||||
prints DataType
|
|
||||||
number func(token string, prints DataType, args []string) proven
|
number func(token string, prints DataType, args []string) proven
|
||||||
|
prints DataType
|
||||||
}
|
}
|
||||||
|
|
||||||
// funcCall splits a "{token}" body shaped name(args) into its parts; ok is false
|
// funcCall splits a "{token}" body shaped name(args) into its parts; ok is false
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ Self-sufficiency 5.6), every seat capped by Locality or Self-sufficiency.
|
|||||||
|
|
||||||
This round, in order:
|
This round, in order:
|
||||||
|
|
||||||
- Register a transform once: `transforms` restates the `lowercase`, `uppercase` and
|
|
||||||
`ascii` entries in `builtins`, and `valueProof.template` classifies by the first while
|
|
||||||
render calls the second. Derive the numeric builtins `valueProof.template` lists in
|
|
||||||
its error text from `builtin.number` while there.
|
|
||||||
- Split `drawCheck.reads`'s six-term condition into named predicates.
|
- Split `drawCheck.reads`'s six-term condition into named predicates.
|
||||||
- Rename what names two things: `template.go` holds the token grammar while `template`
|
- Rename what names two things: `template.go` holds the token grammar while `template`
|
||||||
is `node.go`'s type and `Template` `inline.go`'s; `kind` `'b'` is a brace body in
|
is `node.go`'s type and `Template` `inline.go`'s; `kind` `'b'` is a brace body in
|
||||||
|
|||||||
+6
-3
@@ -14,11 +14,14 @@ var transforms = map[string]func(string) string{
|
|||||||
"uppercase": strings.ToUpper,
|
"uppercase": strings.ToUpper,
|
||||||
}
|
}
|
||||||
|
|
||||||
func withTransforms(builtins map[string]builtin) map[string]builtin {
|
func withTransforms(calls map[string]builtin) map[string]builtin {
|
||||||
for name, fn := range transforms {
|
for name, fn := range transforms {
|
||||||
builtins[name] = builtin{arity: 1, check: transformArg, prep: transformPrep(fn), operands: transformOperand}
|
if _, clash := calls[name]; clash {
|
||||||
|
panic("fejkdata: " + name + " is registered as a builtin and a transform")
|
||||||
|
}
|
||||||
|
calls[name] = builtin{arity: 1, check: transformArg, prep: transformPrep(fn), operands: transformOperand}
|
||||||
}
|
}
|
||||||
return builtins
|
return calls
|
||||||
}
|
}
|
||||||
|
|
||||||
// unwrapTransform peels nested transform calls off an operand arg, returning the
|
// unwrapTransform peels nested transform calls off an operand arg, returning the
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ func (p *valueProof) template(t *template) proven {
|
|||||||
case t.fixed:
|
case t.fixed:
|
||||||
return literalValue(t.lit)
|
return literalValue(t.lit)
|
||||||
case len(t.ops) != 1:
|
case len(t.ops) != 1:
|
||||||
v := unproven(notOneValue(t.format, numberCalls(false)))
|
v := unproven(notOneValue(t.format, typedCalls))
|
||||||
v.notOperand = notOneValue(t.format, numberCalls(true))
|
v.notOperand = notOneValue(t.format, operandCalls)
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
o := t.ops[0]
|
o := t.ops[0]
|
||||||
@@ -288,6 +288,8 @@ func printing(token string, prints DataType, v proven) proven {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var typedCalls, operandCalls = numberCalls(false), numberCalls(true)
|
||||||
|
|
||||||
// numberCalls lists the builtins printing a number, or with text also those whose text
|
// numberCalls lists the builtins printing a number, or with text also those whose text
|
||||||
// is one.
|
// is one.
|
||||||
func numberCalls(text bool) string {
|
func numberCalls(text bool) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user