From 7993e04d95de36c1e4f4435bd14dc3ae6903539a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 18 Sep 2026 00:26:58 +0200 Subject: [PATCH] Skip the row loop of a column walk when a table has no token cells, and scan a cell for braces by byte --- graph.go | 3 +++ table.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/graph.go b/graph.go index 08358f2..79ad8bd 100644 --- a/graph.go +++ b/graph.go @@ -63,6 +63,9 @@ func contained(n node) []namedNode { case *table: return append([]namedNode{{node: n.format}}, named(n.fields)...) case *column: + if len(n.t.tokens) == 0 { + return nil + } var out []namedNode for r := 0; r < n.t.rows(); r++ { if cell := n.t.cellNode(r, n.i); cell != nil { diff --git a/table.go b/table.go index 3f94851..dd8c811 100644 --- a/table.go +++ b/table.go @@ -285,7 +285,7 @@ func (t *table) checkCells() error { if (col == t.key || col == t.name) && strings.ContainsAny(cell, inSelector) { return fmt.Errorf("line %d: %s %q contains %q, which a selector cannot spell", row+2, t.columns[col], cell, cell[strings.IndexAny(cell, inSelector):][:1]) } - if !strings.ContainsAny(cell, "{}") { + if strings.IndexByte(cell, '{') < 0 && strings.IndexByte(cell, '}') < 0 { continue } n, err := compileString(cell)