diff --git a/README.md b/README.md index af454d3..354a080 100644 --- a/README.md +++ b/README.md @@ -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 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 `[`, `]`, `{`, `}`, -`"` or `|`, which a selector cannot spell; `New` maps the keys, and the lookups by name -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 +`"` or `|`, which a selector cannot spell; `New` maps the keys, and a name or parent column +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]` 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 @@ -760,9 +760,9 @@ token {w} is repeated, and uppercase operand "w" holds "w" to one draw per expan ### Performance -Each file is parsed, validated and weight-indexed once, in `New`, bar a table with a -name or a parent column, which indexes its rows on the first `Fake` that selects or -descends through it. Proving the draw fences adds a pass over the loaded tree per +Each file is parsed, validated and weight-indexed once, in `New`, bar a table's name and +parent columns, which are mapped on the first `Fake` that selects by name or descends +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 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 diff --git a/inline.go b/inline.go index 1b13b61..f03fda9 100644 --- a/inline.go +++ b/inline.go @@ -49,11 +49,11 @@ func (f *Generator) FakeTemplate(input string) (string, error) { return t.Fake(), nil } -// IsTemplate reports whether arg is an inline template rather than a path, by its shape: a { -// token, or a JSON object, array or string, is a template, and anything else is a path. An -// arg that is not valid JSON errors where it holds a } or a quote, or starts with [, since no -// path may; so do a template of one reference alone, which is a path written as a template, -// and a path written with a leading /. +// IsTemplate reports whether arg is an inline template rather than a path, by its shape: an +// arg holding a {, or a valid JSON array or string, is a template, and anything else is a +// path. A path errors where it holds a } or a quote, starts with [, or is no valid path; so +// do a template of one reference alone, which is a path written as a template, and a path +// written with a leading /. func IsTemplate(arg string) (bool, error) { inline, err := isTemplate(arg) if err != nil {