classSqlWordReader
final class SqlWordReader
Reads what is written plainly: a bare word or a number.
A bare word is a keyword or an unquoted identifier; nothing here tells them apart, because which words are keywords is not a question the reader has to answer. How far a number runs is the dialect's business, since exponents, hex and separators differ, so the profile measures it.
Methods§
public function readAt(string $sql, int $offset, SqlLexerProfile $profile): SqlLexeme|nullAnswers what plain lexeme starts at an offset.
Parameters
$sql | string | The statement, as written |
$offset | int | Where to look |
$profile | SqlLexerProfile | What the dialect spells things with |
Returns
SqlLexeme|null The lexeme read there, or null when none starts thereTest cases 4
SqlWordReaderTest::testReadAtAnswersNothingWhereNeitherAWordNorANumberBeginscovers and callsSqlWordReaderTest::testReadAtReadsAsFarIntoANumberAsTheDialectSpellsOnecovers and callsSqlWordReaderTest::testReadAtReadsAWholeBareWordAsOneLexemecovers and callsSqlWordReaderTest::testReadAtReadsAWordThatRunsToTheEndOfTheStatementcovers and calls
Called from 1
Calls 7
- method-call SqlLexerProfile::isIdentifierStart() line 31
- function-call
strlenline 32 - method-call SqlLexerProfile::isIdentifierPart() line 34
- new SqlLexeme line 39
- class-const SqlTokenKind::Word() line 39
- method-call SqlLexerProfile::numberLengthAt() line 42
- class-const SqlTokenKind::Number() line 44
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
SqlWordReaderTest::testReadAtAnswersNothingWhereNeitherAWordNorANumberBeginscovers and callsSqlWordReaderTest::testReadAtReadsAsFarIntoANumberAsTheDialectSpellsOnecovers and callsSqlWordReaderTest::testReadAtReadsAWholeBareWordAsOneLexemecovers and callsSqlWordReaderTest::testReadAtReadsAWordThatRunsToTheEndOfTheStatementcovers and calls
Other tests reaching this symbol 4
SqlIdentifierComponentTestcallsSqlKeywordSequenceTestcallsSqlTokenScannerTestcallsSqlTokenStreamTestcalls