From bb2bbe96979e359fdf4210d6a2fe84e493c9bc7a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 24 Sep 2026 23:33:05 +0200 Subject: [PATCH] Keep the transform's arity inside its operand func, skip calls in compileWhole's column check, and file the two tokens for renaming --- table.go | 5 ++++- template.go | 4 ++-- todo.md | 3 ++- transform.go | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/table.go b/table.go index f61ebd7..f60d9cd 100644 --- a/table.go +++ b/table.go @@ -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) } } diff --git a/template.go b/template.go index e7e1d2e..b5f8a45 100644 --- a/template.go +++ b/template.go @@ -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) diff --git a/todo.md b/todo.md index 684cec7..3bb0ae8 100644 --- a/todo.md +++ b/todo.md @@ -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. diff --git a/transform.go b/transform.go index 872917b..2b9fecd 100644 --- a/transform.go +++ b/transform.go @@ -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