Assume that identifier only contains letters, underscores, digits (0-9), or dollar signs ($). See https://www.postgresql.org/docs/current/sql-syntax-lexical.html.
(delimiter rune)
| 481 | // Assume that identifier only contains letters, underscores, digits (0-9), or dollar signs ($). |
| 482 | // See https://www.postgresql.org/docs/current/sql-syntax-lexical.html. |
| 483 | func (t *Tokenizer) scanIdentifier(delimiter rune) error { |
| 484 | if t.char(0) != delimiter { |
| 485 | return errors.Errorf("delimiter doesn't start with delimiter: %c, but found: %c", delimiter, t.char(0)) |
| 486 | } |
| 487 | |
| 488 | t.skip(1) |
| 489 | for { |
| 490 | switch t.char(0) { |
| 491 | case delimiter: |
| 492 | t.skip(1) |
| 493 | return nil |
| 494 | case eofRune: |
| 495 | return errors.Errorf("invalid indentifier: not found delimiter: %c, but found EOF", delimiter) |
| 496 | default: |
| 497 | t.skip(1) |
| 498 | } |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | // There are two ways to include a single quote('), using \' or two single-quotes. |
| 503 | // We only handle the case \', because the second case does not require special handling. |
no test coverage detected