classScan
final class Scan
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
The state one SQLite tokenization carries from token to token.
Properties§
public list<Lexeme> $lexemes = []Lexemes read so far, in text order.
public Cursor $cursorpublic KeywordTable $keywordspublic array<string, true> $fallbacks = []Methods§
public function __construct(
public Cursor $cursor,
public KeywordTable $keywords,
public array<string, true> $fallbacks = [],
)Parameters
$cursor | Cursor | Reads the SQL text |
$keywords | KeywordTable | Keywords of the release |
$fallbacks | array<string, true> | Keywords the grammar lets fall back to identifiers |
public function lexeme(string $name, int $start): LexemeMakes the lexeme spanning from an offset to the cursor.
Parameters
$name | string | Terminal name |
$start | int | Byte offset the lexeme began at |
Returns
Lexeme The lexemeTest cases 1
ScanTest::testLexemecalls
Called from 8
- method-call SqlParser\Sqlite\Lexer\NumberScanner::scan() packages/sql-parser/src/Sqlite/Lexer/NumberScanner.php:50
- method-call SqlParser\Sqlite\Lexer\OperatorScanner::scan() packages/sql-parser/src/Sqlite/Lexer/OperatorScanner.php:44
- method-call SqlParser\Sqlite\Lexer\QuotedScanner::scan() packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:39
- method-call SqlParser\Sqlite\Lexer\QuotedScanner::scan() packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:46
- method-call SqlParser\Sqlite\Lexer\QuotedScanner::scan() packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:53
- method-call SqlParser\Sqlite\Lexer\VariableScanner::scan() packages/sql-parser/src/Sqlite/Lexer/VariableScanner.php:38
- method-call SqlParser\Sqlite\Lexer\VariableScanner::scan() packages/sql-parser/src/Sqlite/Lexer/VariableScanner.php:65
- method-call SqlParser\Sqlite\Lexer\WordScanner::scan() packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:44
Calls 3
- new Lexeme line 46
- function-call
substrline 46 - method-call Cursor::offset() line 46
public function last(): Lexeme|nullAnswers the lexeme read last, if any.
Returns
Lexeme|null The last lexemeTest cases 1
ScanTest::testLastcalls
Called from 2
Calls 1
- function-call
countline 56
public static function isIdentifierByte(string $byte): boolReports whether a byte can be part of an unquoted identifier.
Parameters
$byte | string | The byte, or an empty string at the end |
Returns
bool True for letters, digits, underscore, dollar and every byte of a multi-byte characterTest cases 1
Called from 2
Test cases 23§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
ScanTest::testIsIdentifierBytecallsScanTest::testLastcallsScanTest::testLexemecalls
Other tests reaching this symbol 20
NumberScannerTest::testScancallsNumberScannerTest::testScanRejectsTrailingJunkcallsOperatorScannerTest::testScancallsOperatorScannerTest::testScanRejectsAForeignCharactercallsQuotedScannerTest::testScancallsQuotedScannerTest::testScanRejectsAnOddBlobcallsQuotedScannerTest::testScanRejectsAnUnterminatedBracketcallsQuotedScannerTest::testScanRejectsAnUnterminatedStringcallsSqliteLexerTestcallsTriviaScannerTest::testSkipcallsTriviaScannerTest::testSkipLeavesASlashBeforeTheEndAlonecallsTriviaScannerTest::testSkipRunsAnUnterminatedCommentToTheEndcallsVariableScannerTest::testScancallsVariableScannerTest::testScanRejectsAnUnterminatedSuffixcallsVariableScannerTest::testScanRejectsASigilWithoutANamecallsWordScannerTest::testAheadcallsWordScannerTest::testContextualcallsWordScannerTest::testProbecallsWordScannerTest::testScancallsSqliteParserTestcalls
Relations§
Instantiated in 2
Static calls 2
Method calls 10
- method-call SqlParser\Sqlite\Lexer\NumberScanner::scan() packages/sql-parser/src/Sqlite/Lexer/NumberScanner.php:50
- method-call SqlParser\Sqlite\Lexer\OperatorScanner::scan() packages/sql-parser/src/Sqlite/Lexer/OperatorScanner.php:44
- method-call SqlParser\Sqlite\Lexer\QuotedScanner::scan() packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:39
- method-call SqlParser\Sqlite\Lexer\QuotedScanner::scan() packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:46
- method-call SqlParser\Sqlite\Lexer\QuotedScanner::scan() packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:53
- method-call SqlParser\Sqlite\Lexer\SqliteLexer::scan() packages/sql-parser/src/Sqlite/Lexer/SqliteLexer.php:66
- method-call SqlParser\Sqlite\Lexer\VariableScanner::scan() packages/sql-parser/src/Sqlite/Lexer/VariableScanner.php:38
- method-call SqlParser\Sqlite\Lexer\VariableScanner::scan() packages/sql-parser/src/Sqlite/Lexer/VariableScanner.php:65
- method-call SqlParser\Sqlite\Lexer\WordScanner::scan() packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:44
- method-call SqlParser\Sqlite\Lexer\WordScanner::contextual() packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:58
Type declarations 9
- type SqlParser\Sqlite\Lexer\NumberScanner packages/sql-parser/src/Sqlite/Lexer/NumberScanner.php:31
- type SqlParser\Sqlite\Lexer\OperatorScanner packages/sql-parser/src/Sqlite/Lexer/OperatorScanner.php:36
- type SqlParser\Sqlite\Lexer\QuotedScanner packages/sql-parser/src/Sqlite/Lexer/QuotedScanner.php:29
- type SqlParser\Sqlite\Lexer\TriviaScanner packages/sql-parser/src/Sqlite/Lexer/TriviaScanner.php:22
- type SqlParser\Sqlite\Lexer\VariableScanner packages/sql-parser/src/Sqlite/Lexer/VariableScanner.php:30
- type SqlParser\Sqlite\Lexer\WordScanner packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:31
- type SqlParser\Sqlite\Lexer\WordScanner packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:56
- type SqlParser\Sqlite\Lexer\WordScanner packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:82
- type SqlParser\Sqlite\Lexer\WordScanner packages/sql-parser/src/Sqlite/Lexer/WordScanner.php:105