isReservedKeyword reports whether a bare-shaped name is a reserved keyword that cannot be used as an unquoted identifier. omni exposes no reserved-word predicate, so we parse-check only names that lex as a single keyword token (plain identifiers are never reserved), which keeps this cheap for ordina
(name string)
| 383 | // (plain identifiers are never reserved), which keeps this cheap for ordinary |
| 384 | // names. A keyword is reserved iff it cannot stand as a bare table reference. |
| 385 | func isReservedKeyword(name string) bool { |
| 386 | upper := strings.ToUpper(name) |
| 387 | toks := tidbparser.Tokenize(upper) |
| 388 | if len(toks) != 1 || tidbparser.TokenName(toks[0].Type) == "" { |
| 389 | return false |
| 390 | } |
| 391 | _, err := tidbparser.Parse("SELECT 1 FROM " + upper) |
| 392 | return err != nil |
| 393 | } |
| 394 | |
| 395 | // caretInsideBacktickIdentifier reports whether the caret sits inside an open |
| 396 | // backtick-quoted identifier (an odd number of backticks precede it), in which |
no outgoing calls
no test coverage detected