classQuotedScanner
final class QuotedScanner
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Reads MySQL's quoted tokens: strings, quoted identifiers and prefixed literals.
A single-quoted run is a string, and so is a double-quoted one unless ANSI_QUOTES makes it an identifier. Backticks always quote identifiers. A quote right after N, X or B opens a national string, a hexadecimal literal or a bit literal.
Methods§
Reads the quoted token at the cursor, if one starts there.
Parameters
$scan | Scan | The tokenization in progress |
Returns
Lexeme|null The lexeme, or null when no quoted token starts hereThrows
LexicalException When the token never closes or a hexadecimal literal has an odd lengthTest cases 3
Called from 1
Calls 6
- method-call QuotedScanner::string() line 37
- method-call QuotedScanner::quotedIdentifier() line 40
- function-call
strtoupperline 45 - function-call
strlenline 53 - static-call LexicalException::unterminated() line 54
- method-call Scan::lexeme() line 57
Reads a string literal delimited by a quote.
Parameters
$scan | Scan | The tokenization in progress, positioned on the quote |
$name | string | Terminal the string stands for |
$quote | string | The quote character |
$start | int|null | Offset the lexeme began at, when a prefix came first |
Returns
Lexeme The lexemeThrows
LexicalException When the string never closesTest cases 2
Called from 2
Calls 2
- static-call LexicalException::unterminated() line 80
- method-call Scan::lexeme() line 83
Reads an identifier delimited by backticks or, under ANSI_QUOTES, double quotes.
Parameters
$scan | Scan | The tokenization in progress, positioned on the quote |
$quote | string | The quote character |
Returns
Lexeme The lexemeThrows
LexicalException When the identifier never closesTest cases 2
Called from 1
Calls 2
- static-call LexicalException::unterminated() line 101
- method-call Scan::lexeme() line 104
Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
QuotedScannerTest::testQuotedIdentifiercallsQuotedScannerTest::testQuotedIdentifierRejectsAnUnterminatedIdentifiercallsQuotedScannerTest::testScanReadsPrefixedLiteralscallsQuotedScannerTest::testScanReadsStringsAndIdentifierscallsQuotedScannerTest::testScanRejectsAnOddHexadecimalLiteralcallsQuotedScannerTest::testStringcallsQuotedScannerTest::testStringRejectsAnUnterminatedStringcalls
Other tests reaching this symbol 2
MySqlLexerTestcallsMySqlParserTestcalls