Skip the row loop of a column walk when a table has no token cells, and scan a cell for braces by byte
This commit is contained in:
@@ -63,6 +63,9 @@ func contained(n node) []namedNode {
|
|||||||
case *table:
|
case *table:
|
||||||
return append([]namedNode{{node: n.format}}, named(n.fields)...)
|
return append([]namedNode{{node: n.format}}, named(n.fields)...)
|
||||||
case *column:
|
case *column:
|
||||||
|
if len(n.t.tokens) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
var out []namedNode
|
var out []namedNode
|
||||||
for r := 0; r < n.t.rows(); r++ {
|
for r := 0; r < n.t.rows(); r++ {
|
||||||
if cell := n.t.cellNode(r, n.i); cell != nil {
|
if cell := n.t.cellNode(r, n.i); cell != nil {
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ func (t *table) checkCells() error {
|
|||||||
if (col == t.key || col == t.name) && strings.ContainsAny(cell, inSelector) {
|
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])
|
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
|
continue
|
||||||
}
|
}
|
||||||
n, err := compileString(cell)
|
n, err := compileString(cell)
|
||||||
|
|||||||
Reference in New Issue
Block a user