Compile a format in format.go

This commit is contained in:
2026-09-29 15:27:21 +02:00
committed by Lillem4n
parent c2ac7bf843
commit ba43eb1c91
3 changed files with 10 additions and 13 deletions
+10
View File
@@ -434,6 +434,16 @@ func (c *formatOps) field(tok formatToken, refs map[string]refBinding) {
c.ops = append(c.ops, op{formatToken: tok, arms: arms})
}
// compileFormat compiles a format into ops, and applies the fences that need the
// compiled reads.
func compileFormat(toks []formatToken, refs map[string]refBinding) (formatOps, error) {
c := compileOps(toks, refs)
if err := checkNoOverlap(c); err != nil {
return c, err
}
return c, checkNoRepeatedRead(c)
}
// compileOps compiles a parsed format. Call checkTokens first: it is what proves
// every token valid.
func compileOps(toks []formatToken, refs map[string]refBinding) formatOps {
-10
View File
@@ -227,16 +227,6 @@ func (t *template) fixedText() (string, bool) {
return "", false
}
// compileFormat compiles a format into ops, and applies the fences that need the
// compiled reads.
func compileFormat(toks []formatToken, refs map[string]refBinding) (formatOps, error) {
c := compileOps(toks, refs)
if err := checkNoOverlap(c); err != nil {
return c, err
}
return c, checkNoRepeatedRead(c)
}
func compileChoice(items []any, pos position) (node, error) {
itemPos := inFormat
if pos == inColumn {
-3
View File
@@ -34,9 +34,6 @@ ranking `readSurvey.walk` and `edge` hardest and the unit they would least modif
This round, in order:
- Compile a format in `format.go`: `linkTemplate` calls `compileFormat` in `node.go`,
which calls `compileOps` and `holdfence.go`'s two checks, and both architects placed
the step wrong.
- Delete the "so which … is reported does not vary" clause at its five sites past
`checkNodeFences`, and `checkRecordDraws`' "A record-only template's format renders
nothing", which runs over templates with a format too.