Compile a format in format.go
This commit is contained in:
@@ -434,6 +434,16 @@ func (c *formatOps) field(tok formatToken, refs map[string]refBinding) {
|
|||||||
c.ops = append(c.ops, op{formatToken: tok, arms: arms})
|
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
|
// compileOps compiles a parsed format. Call checkTokens first: it is what proves
|
||||||
// every token valid.
|
// every token valid.
|
||||||
func compileOps(toks []formatToken, refs map[string]refBinding) formatOps {
|
func compileOps(toks []formatToken, refs map[string]refBinding) formatOps {
|
||||||
|
|||||||
@@ -227,16 +227,6 @@ func (t *template) fixedText() (string, bool) {
|
|||||||
return "", false
|
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) {
|
func compileChoice(items []any, pos position) (node, error) {
|
||||||
itemPos := inFormat
|
itemPos := inFormat
|
||||||
if pos == inColumn {
|
if pos == inColumn {
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ ranking `readSurvey.walk` and `edge` hardest and the unit they would least modif
|
|||||||
|
|
||||||
This round, in order:
|
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
|
- 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
|
`checkNodeFences`, and `checkRecordDraws`' "A record-only template's format renders
|
||||||
nothing", which runs over templates with a format too.
|
nothing", which runs over templates with a format too.
|
||||||
|
|||||||
Reference in New Issue
Block a user