Gather the pick key's load and render sides in pick.go, and name each thing for what it is

This commit is contained in:
2026-10-09 10:54:35 +02:00
committed by Lillem4n
parent ee4b40bd25
commit 0002efb9d4
20 changed files with 202 additions and 227 deletions
-9
View File
@@ -54,15 +54,6 @@ func pathArm(name, head string, segs []string) arm {
return arm{spelling: name, head: head, tail: segs, levels: levelKeys(append([]string{head}, segs...), 1)}
}
// levelKeys is the key of each prefix of path holding at least from segments, shortest first.
func levelKeys(path []string, from int) []pickKey {
levels := make([]pickKey, len(path)-from+1)
for i := range levels {
levels[i] = pickKey(grammar.JoinSegments(path[:from+i]))
}
return levels
}
// key is the key of the leaf a lands on, the one key every way of writing this read shares.
func (a arm) key() pickKey { return a.levels[len(a.levels)-1] }