diff --git a/drawfence.go b/drawfence.go index def7c1c..aebaa52 100644 --- a/drawfence.go +++ b/drawfence.go @@ -191,11 +191,11 @@ type drawWalk struct { // table rows it pinned, the table a whole read draws a row of, and the rows of whole draws whose // cells the walk is in. type drawAt struct { - group string - route drawRoute - pinned pinSet - drawn *table // left out of the visit keys: only this table's own cells compare against it, which the own-family fence keeps true - whole pinSet + group string + route drawRoute + pins pinSet + drawn *table // left out of the visit keys: only this table's own cells compare against it, which the own-family fence keeps true + whole pinSet } // drawRoute is how a render reaches a draw: as its author spells it, and the root edge's label. @@ -209,15 +209,15 @@ type pathRead struct { } type nodeVisit struct { - n node - group string - rows string + n node + group string + rowsKey string } type readKey struct { - group string - path string - rows string + group string + path string + rowsKey string } func newDrawWalk() *drawWalk { @@ -251,16 +251,16 @@ func (w *drawWalk) walk(n node, at drawAt) { in.whole = at.whole.clone() in.whole.add(cell.cellOf, cell.cellRow) w.edge(n, e, in) - case at.pinned.clash(cell.cellOf, cell.cellRow) == nil: + case at.pins.clash(cell.cellOf, cell.cellRow) == nil: in := at - in.pinned = at.pinned.entered(cell.cellOf, cell.cellRow) + in.pins = at.pins.entered(cell.cellOf, cell.cellRow) w.edge(n, e, in) } } } // rowsKey spells the rows the walk stands in, pinned and whole, for a map. -func (at drawAt) rowsKey() string { return at.pinned.key() + "|" + at.whole.key() } +func (at drawAt) rowsKey() string { return at.pins.key() + "|" + at.whole.key() } // edge records the reference an edge reads, then walks on with every row the read // pins entered, so a selected row renders only its own cells. @@ -272,7 +272,7 @@ func (w *drawWalk) edge(from node, e renderEdge, at drawAt) { w.reads = append(w.reads, pathRead{at, a, tr}) } if tr != nil { - tr.pins.each(func(t *table, r int) { at.pinned = at.pinned.entered(t, r) }) + tr.pins.each(func(t *table, r int) { at.pins = at.pins.entered(t, r) }) } } w.walk(e.to, at) diff --git a/family.go b/family.go index 18230d0..4893597 100644 --- a/family.go +++ b/family.go @@ -219,4 +219,4 @@ func checkOwnFamily(t *template) error { // alternatives reports whether two reads sit in different rows of one table: rows the walks pinned, // or rows of one whole draw. // docs/decisions.md#the-rows-of-a-table-are-alternatives -func alternatives(a, b drawAt) bool { return a.pinned.differs(&b.pinned) || a.whole.differs(&b.whole) } +func alternatives(a, b drawAt) bool { return a.pins.differs(&b.pins) || a.whole.differs(&b.whole) } diff --git a/graph.go b/graph.go index d17b10c..09fcc11 100644 --- a/graph.go +++ b/graph.go @@ -68,7 +68,7 @@ func contained(n node) []namedNode { } var out []namedNode for r := 0; r < n.t.rows(); r++ { - if cell := n.t.cellNode(r, n.i); cell != nil { + if cell := n.t.cellTemplate(r, n.i); cell != nil { out = append(out, namedNode{node: cell}) } } diff --git a/render.go b/render.go index be0194d..4aea292 100644 --- a/render.go +++ b/render.go @@ -70,7 +70,7 @@ func render(s *session, n node, sc renderScope) string { if sc.t != n.t { sc.t, sc.row = n.t, sc.hold().pins.mustRow(n.t) } - if cell := n.t.cellNode(sc.row, n.i); cell != nil { + if cell := n.t.cellTemplate(sc.row, n.i); cell != nil { return render(s, cell, sc) } return n.t.cell(sc.row, n.i) diff --git a/table.go b/table.go index b06fcd3..45471fb 100644 --- a/table.go +++ b/table.go @@ -62,9 +62,9 @@ func (t *table) rows() int { return len(t.cells) / len(t.columns) } func (t *table) cell(row, col int) string { return t.cells[row*len(t.columns)+col] } -// cellNode is what a cell renders: its compiled template where it carries tokens, +// cellTemplate is what a cell renders: its compiled template where it carries tokens, // else nil for its text. -func (t *table) cellNode(row, col int) *template { return t.cellTemplates[row*len(t.columns)+col] } +func (t *table) cellTemplate(row, col int) *template { return t.cellTemplates[row*len(t.columns)+col] } // tableOptions are the keys a table object takes; every other key is refused. var tableOptions = []string{"format", "key", "name", "parent", "rows", "weight"} diff --git a/table_test.go b/table_test.go index 8fce3e6..99838c8 100644 --- a/table_test.go +++ b/table_test.go @@ -996,11 +996,11 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) { for cr := 0; cr < cand.rows(); cr++ { beside := s.clone() refused := beside.pinRow(cand, cr) != nil - pinned := drawAt{pinned: none.entered(cand, cr)} - if got := alternatives(drawAt{pinned: s}, pinned); got != refused { + candAt := drawAt{pins: none.entered(cand, cr)} + if got := alternatives(drawAt{pins: s}, candAt); got != refused { t.Errorf("alternatives(%s, %s) = %v, but pinning both refuses = %v", entered.selectorSpelling(row), cand.selectorSpelling(cr), got, refused) } - if alternatives(whole, pinned) || alternatives(pinned, whole) { + if alternatives(whole, candAt) || alternatives(candAt, whole) { t.Errorf("%s rendered whole is an alternative to %s pinned, though the whole draw ignores the pin", entered.selectorSpelling(row), cand.selectorSpelling(cr)) } other := drawAt{drawn: cand} diff --git a/todo.md b/todo.md index 8ae15fc..e8de440 100644 --- a/todo.md +++ b/todo.md @@ -19,6 +19,9 @@ Self-sufficiency 5.6), every seat capped by Locality or Self-sufficiency. This round, in order: +- Hold only the `{token}` grammar's tests in `format_test.go`: move the helpers seven + other test files use (`engine`, `parse`, `compiled`, `mustRender`) and the weight, + recursion and path-navigation tests to files named for what they test. - Run the nine-seat panel again and file what it names here. ### Data diff --git a/value.go b/value.go index 94a1acf..250bb25 100644 --- a/value.go +++ b/value.go @@ -103,7 +103,7 @@ func (p *valueProof) cells(c *column) proven { var v proven for r := 0; r < c.t.rows(); r++ { var w proven - if cell := c.t.cellNode(r, c.i); cell != nil { + if cell := c.t.cellTemplate(r, c.i); cell != nil { w = p.of(cell) } else { w = literalValue(c.t.cell(r, c.i))