Answer prose round 1 and product-owner round 1: CheckIdentifier's doc counts a bound name, FuncCall and the grammar doc say PathRead and identifiers, the Layout's list.go, name.go and data-import rows read on one pass, the locality row says a postort with no street is dropped, geo.py's docs name what they take, well_cased says what it drops, and item 61 names the next steps to share
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Package grammar is how the template language is written: format tokens, paths and
|
||||
// their selectors, reference sigils, names, calc expressions, and whether an argument is a
|
||||
// their selectors, reference sigils, identifiers, calc expressions, and whether an argument is a
|
||||
// template or a path. It reads strings only.
|
||||
package grammar
|
||||
|
||||
@@ -122,7 +122,7 @@ func ParseFormat(format string) ([]Token, error) {
|
||||
}
|
||||
|
||||
// FuncCall splits a "{token}" body shaped name(args) into its parts; ok is false
|
||||
// for a name-read body. A '(' without a trailing ')' yields ok=false.
|
||||
// for a PathRead body. A '(' without a trailing ')' yields ok=false.
|
||||
func FuncCall(body string) (name string, args []string, ok bool) {
|
||||
lp := indexOutside(body, '(')
|
||||
if lp < 0 || !strings.HasSuffix(body, ")") {
|
||||
|
||||
@@ -8,14 +8,13 @@ import (
|
||||
// reservedInIdentifier is what an identifier may not contain: a dot
|
||||
// separates the segments of a path, '|' the arms of a token, '(' opens a function
|
||||
// call, braces delimit the token, '/' starts a reference, and brackets and a quote
|
||||
// open a JSON value. An identifier carrying one is rejected where it is authored rather
|
||||
// than where it would be unreachable.
|
||||
// open a JSON value. An identifier carrying one is rejected where it is authored.
|
||||
const reservedInIdentifier = ".|({}/[]\""
|
||||
|
||||
var reservedList = strings.Join(strings.Split(reservedInIdentifier, ""), " ")
|
||||
|
||||
// CheckIdentifier rejects an identifier, the name of a folder, category, field or column, that the
|
||||
// dot path, {token} and JSON grammars cannot spell, or a struct tag cannot read.
|
||||
// An identifier names a folder, category, field, column or bound name. CheckIdentifier rejects one
|
||||
// that the dot path, {token} and JSON grammars cannot spell, or that a struct tag cannot read.
|
||||
func CheckIdentifier(name string) error {
|
||||
if name == "" {
|
||||
return fmt.Errorf("%q is empty, which is not a path segment, so List never offers it", name)
|
||||
|
||||
Reference in New Issue
Block a user