in src/go/util/httppattern/uri_template_parser.go [217:248]
func (p *parser) parseIdentifier() bool {
addFieldIdentifier := func(id string) bool {
if p.inVariable && len(p.variables) > 0 {
p.currentVariable().FieldPath = append(p.currentVariable().FieldPath, id)
return true
} else {
// something's wrong we're not in a variable
return false
}
}
var idf bytes.Buffer
// Initialize to false to handle empty literal.
result := false
for p.nextChar() {
switch c := p.currentChar(); c {
case '.':
fallthrough
case '}':
fallthrough
case '=':
return result && addFieldIdentifier(idf.String())
default:
p.consume(c)
idf.WriteByte(c)
break
}
result = true
}
return result && addFieldIdentifier(idf.String())
}