validateModelGlobToken validates a model-glob-token (may contain "*").
(token string)
| 263 | |
| 264 | // validateModelGlobToken validates a model-glob-token (may contain "*"). |
| 265 | func validateModelGlobToken(token string) error { |
| 266 | if token == "" { |
| 267 | return errors.New("model identifier: model glob token must not be empty (segment type: model)") |
| 268 | } |
| 269 | for _, r := range token { |
| 270 | switch { |
| 271 | case r >= 'A' && r <= 'Z', r >= 'a' && r <= 'z', r >= '0' && r <= '9': |
| 272 | // ALPHA / DIGIT — always allowed |
| 273 | case r == '-', r == '_', r == '.', r == '*': |
| 274 | // allowed in glob tokens |
| 275 | default: |
| 276 | return fmt.Errorf("model identifier: character %q is not allowed in glob model token %q (segment type: model)", r, token) |
| 277 | } |
| 278 | } |
| 279 | return nil |
| 280 | } |
| 281 | |
| 282 | // validateBareName validates a bare identifier name per the ABNF grammar. |
| 283 | func validateBareName(name string) error { |
no test coverage detected