Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
+15
-15
@@ -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
|
// 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.
|
// cells the walk is in.
|
||||||
type drawAt struct {
|
type drawAt struct {
|
||||||
group string
|
group string
|
||||||
route drawRoute
|
route drawRoute
|
||||||
pinned pinSet
|
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
|
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
|
whole pinSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// drawRoute is how a render reaches a draw: as its author spells it, and the root edge's label.
|
// 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 {
|
type nodeVisit struct {
|
||||||
n node
|
n node
|
||||||
group string
|
group string
|
||||||
rows string
|
rowsKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
type readKey struct {
|
type readKey struct {
|
||||||
group string
|
group string
|
||||||
path string
|
path string
|
||||||
rows string
|
rowsKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDrawWalk() *drawWalk {
|
func newDrawWalk() *drawWalk {
|
||||||
@@ -251,16 +251,16 @@ func (w *drawWalk) walk(n node, at drawAt) {
|
|||||||
in.whole = at.whole.clone()
|
in.whole = at.whole.clone()
|
||||||
in.whole.add(cell.cellOf, cell.cellRow)
|
in.whole.add(cell.cellOf, cell.cellRow)
|
||||||
w.edge(n, e, in)
|
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 := at
|
||||||
in.pinned = at.pinned.entered(cell.cellOf, cell.cellRow)
|
in.pins = at.pins.entered(cell.cellOf, cell.cellRow)
|
||||||
w.edge(n, e, in)
|
w.edge(n, e, in)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rowsKey spells the rows the walk stands in, pinned and whole, for a map.
|
// 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
|
// 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.
|
// 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})
|
w.reads = append(w.reads, pathRead{at, a, tr})
|
||||||
}
|
}
|
||||||
if tr != nil {
|
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)
|
w.walk(e.to, at)
|
||||||
|
|||||||
@@ -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,
|
// alternatives reports whether two reads sit in different rows of one table: rows the walks pinned,
|
||||||
// or rows of one whole draw.
|
// or rows of one whole draw.
|
||||||
// docs/decisions.md#the-rows-of-a-table-are-alternatives
|
// 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) }
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func contained(n node) []namedNode {
|
|||||||
}
|
}
|
||||||
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.cellTemplate(r, n.i); cell != nil {
|
||||||
out = append(out, namedNode{node: cell})
|
out = append(out, namedNode{node: cell})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func render(s *session, n node, sc renderScope) string {
|
|||||||
if sc.t != n.t {
|
if sc.t != n.t {
|
||||||
sc.t, sc.row = n.t, sc.hold().pins.mustRow(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 render(s, cell, sc)
|
||||||
}
|
}
|
||||||
return n.t.cell(sc.row, n.i)
|
return n.t.cell(sc.row, n.i)
|
||||||
|
|||||||
@@ -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] }
|
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.
|
// 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.
|
// tableOptions are the keys a table object takes; every other key is refused.
|
||||||
var tableOptions = []string{"format", "key", "name", "parent", "rows", "weight"}
|
var tableOptions = []string{"format", "key", "name", "parent", "rows", "weight"}
|
||||||
|
|||||||
+3
-3
@@ -996,11 +996,11 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) {
|
|||||||
for cr := 0; cr < cand.rows(); cr++ {
|
for cr := 0; cr < cand.rows(); cr++ {
|
||||||
beside := s.clone()
|
beside := s.clone()
|
||||||
refused := beside.pinRow(cand, cr) != nil
|
refused := beside.pinRow(cand, cr) != nil
|
||||||
pinned := drawAt{pinned: none.entered(cand, cr)}
|
candAt := drawAt{pins: none.entered(cand, cr)}
|
||||||
if got := alternatives(drawAt{pinned: s}, pinned); got != refused {
|
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)
|
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))
|
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}
|
other := drawAt{drawn: cand}
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ Self-sufficiency 5.6), every seat capped by Locality or Self-sufficiency.
|
|||||||
|
|
||||||
This round, in order:
|
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.
|
- Run the nine-seat panel again and file what it names here.
|
||||||
|
|
||||||
### Data
|
### Data
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ func (p *valueProof) cells(c *column) proven {
|
|||||||
var v proven
|
var v proven
|
||||||
for r := 0; r < c.t.rows(); r++ {
|
for r := 0; r < c.t.rows(); r++ {
|
||||||
var w proven
|
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)
|
w = p.of(cell)
|
||||||
} else {
|
} else {
|
||||||
w = literalValue(c.t.cell(r, c.i))
|
w = literalValue(c.t.cell(r, c.i))
|
||||||
|
|||||||
Reference in New Issue
Block a user