Keep the transform's arity inside its operand func, skip calls in compileWhole's column check, and file the two tokens for renaming
This commit is contained in:
@@ -329,9 +329,12 @@ func (t *table) compileWhole(format string) error {
|
||||
return err
|
||||
}
|
||||
for _, tok := range toks {
|
||||
if tok.kind != 'f' {
|
||||
continue
|
||||
}
|
||||
for _, name := range tok.names {
|
||||
a := splitArm(name, nil)
|
||||
if _, ok := t.col[a.key]; tok.kind == 'f' && !ok && !isRef(a.key) && a.key != "" {
|
||||
if _, ok := t.col[a.key]; !ok && !isRef(a.key) && a.key != "" {
|
||||
return fmt.Errorf("format names no column %q of %s; the columns are %v", a.key, t.file, t.columns)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -265,10 +265,10 @@ func hintableRef(name string) bool {
|
||||
}
|
||||
|
||||
// builtinOperands lists the fields a call reads as operands, empty for a builtin that
|
||||
// reads none, or a call checkFunc refuses.
|
||||
// reads none or is unknown.
|
||||
func builtinOperands(name string, args []string) []string {
|
||||
b, known := builtins[name]
|
||||
if !known || b.operands == nil || (b.arity >= 0 && len(args) != b.arity) {
|
||||
if !known || b.operands == nil {
|
||||
return nil
|
||||
}
|
||||
return b.operands(args)
|
||||
|
||||
@@ -37,7 +37,8 @@ This round, in order:
|
||||
- Split `drawCheck.reads`'s six-term condition into named predicates.
|
||||
- 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
|
||||
`ftoken` and a builtin in `op`; `drawAt.alt` holds the rows
|
||||
`ftoken` and a builtin in `formatToken` and `op`; `tokens` is a template's parsed format
|
||||
and a table's cell templates; `drawAt.alt` holds the rows
|
||||
a walk entered.
|
||||
- Run the nine-seat panel again and file what it names here.
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ func transformArg(fields map[string]node, a []string) error {
|
||||
return checkArm(leaf, fields, false)
|
||||
}
|
||||
func transformOperand(a []string) []string {
|
||||
if len(a) != 1 {
|
||||
return nil
|
||||
}
|
||||
leaf, _, err := unwrapTransform(a[0])
|
||||
if err != nil {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user