Say which input errors in IsTemplate, and which columns wait for the first draw
This commit is contained in:
@@ -491,8 +491,8 @@ table, `{/misc.currency[SEK].symbol}` on one row and `{/misc.currency[EUR].symbo
|
|||||||
on the next, since only one row renders. `New` proves the header, the options and every
|
on the next, since only one row renders. `New` proves the header, the options and every
|
||||||
cell token, and refuses a TSV no category names, a key that is empty or repeats, a
|
cell token, and refuses a TSV no category names, a key that is empty or repeats, a
|
||||||
weight that is not a positive number, and a key or name holding `[`, `]`, `{`, `}`,
|
weight that is not a positive number, and a key or name holding `[`, `]`, `{`, `}`,
|
||||||
`"` or `|`, which a selector cannot spell; `New` maps the keys, and the lookups by name
|
`"` or `|`, which a selector cannot spell; `New` maps the keys, and a name or parent column
|
||||||
and by parent wait for the first draw that selects one. A `name` needs a `key`, since a name naming several rows is reported by
|
is mapped on the first draw that selects by name or descends through the table. A `name` needs a `key`, since a name naming several rows is reported by
|
||||||
their keys, or a `parent`, inside whose row a name names one row, so `first-name[Kim]`
|
their keys, or a `parent`, inside whose row a name names one row, so `first-name[Kim]`
|
||||||
is settled by the `sex` selected before it and a name repeating inside one parent row
|
is settled by the `sex` selected before it and a name repeating inside one parent row
|
||||||
is refused; a name spelling another row's key is refused, since the key would
|
is refused; a name spelling another row's key is refused, since the key would
|
||||||
@@ -760,9 +760,9 @@ token {w} is repeated, and uppercase operand "w" holds "w" to one draw per expan
|
|||||||
|
|
||||||
### Performance
|
### Performance
|
||||||
|
|
||||||
Each file is parsed, validated and weight-indexed once, in `New`, bar a table with a
|
Each file is parsed, validated and weight-indexed once, in `New`, bar a table's name and
|
||||||
name or a parent column, which indexes its rows on the first `Fake` that selects or
|
parent columns, which are mapped on the first `Fake` that selects by name or descends
|
||||||
descends through it. Proving the draw fences adds a pass over the loaded tree per
|
through it. Proving the draw fences adds a pass over the loaded tree per
|
||||||
fence, and walks what a render reads only where data binds a reference, so a set that
|
fence, and walks what a render reads only where data binds a reference, so a set that
|
||||||
binds none pays for the passes alone. A `Fake` call then costs about what its output
|
binds none pays for the passes alone. A `Fake` call then costs about what its output
|
||||||
costs: an unweighted pick is O(1) whatever the list's length, a weighted one
|
costs: an unweighted pick is O(1) whatever the list's length, a weighted one
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ func (f *Generator) FakeTemplate(input string) (string, error) {
|
|||||||
return t.Fake(), nil
|
return t.Fake(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsTemplate reports whether arg is an inline template rather than a path, by its shape: a {
|
// IsTemplate reports whether arg is an inline template rather than a path, by its shape: an
|
||||||
// token, or a JSON object, array or string, is a template, and anything else is a path. An
|
// arg holding a {, or a valid JSON array or string, is a template, and anything else is a
|
||||||
// arg that is not valid JSON errors where it holds a } or a quote, or starts with [, since no
|
// path. A path errors where it holds a } or a quote, starts with [, or is no valid path; so
|
||||||
// path may; so do a template of one reference alone, which is a path written as a template,
|
// do a template of one reference alone, which is a path written as a template, and a path
|
||||||
// and a path written with a leading /.
|
// written with a leading /.
|
||||||
func IsTemplate(arg string) (bool, error) {
|
func IsTemplate(arg string) (bool, error) {
|
||||||
inline, err := isTemplate(arg)
|
inline, err := isTemplate(arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user