classLexicalDelimiters
final class LexicalDelimiters
Refuses lexical data a scanner could not use.
An empty delimiter matches at every position without consuming anything, so a scanner given one would never move on. Refusing it where the profile is built means the scanner can take every delimiter it is handed as something it can actually advance past.
Methods§
public function __construct(private LexicalPattern $patterns = new \ZtdQuery\Sql\LexicalPattern())Parameters
$patterns | LexicalPattern | Reads a regular expression |
Test cases 6
LexicalDelimitersTest::testNonEmptyAnswersTheDelimitersItWasGivencoversLexicalDelimitersTest::testPairsAnswersThePairsItWasGivencoversLexicalDelimitersTest::testPairsNamesWhatItWasRefusingInTheRefusalcoversLexicalDelimitersTest::testPerPrefixListsAnswersTheListsItWasGivencoversLexicalDelimitersTest::testPerPrefixPatternsAnswersThePatternsItWasGivencoversLexicalDelimitersTest::testValidPatternsAnswersThePatternsItWasGivencovers
Calls 1
public function nonEmpty(list<string> $values): list<non-empty-string>Answers the delimiters, having refused any that is empty.
Parameters
$values | list<string> | Delimiters as the dialect declared them |
Returns
list<non-empty-string> The same delimitersThrows
InvalidDefinitionException When one of them is emptyTest cases 3
Called from 5
- method-call ZtdQuery\Sql\LexicalDelimiters::perPrefixLists() packages/ztd-query-core/src/Sql/LexicalDelimiters.php:82
- method-call ZtdQuery\Sql\LexicalDelimiters::validPatterns() packages/ztd-query-core/src/Sql/LexicalDelimiters.php:120
- method-call ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:45
- method-call ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:46
- method-call ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:51
Calls 1
public function pairs(
array<string, string> $pairs,
string $kind,
): array<non-empty-string, non-empty-string>Answers the opening-to-closing pairs, having refused any empty end.
Parameters
$pairs | array<string, string> | Opening delimiter => the one that closes it |
$kind | string | What the pairs delimit, for the refusal |
Returns
array<non-empty-string, non-empty-string> The same pairsThrows
InvalidDefinitionException When either end of a pair is emptyTest cases 2
LexicalDelimitersTest::testPairsAnswersThePairsItWasGivencovers and callsLexicalDelimitersTest::testPairsNamesWhatItWasRefusingInTheRefusalcovers and calls
Called from 3
- method-call ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:49
- method-call ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:49
- method-call ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:50
Calls 1
public function perPrefixLists(array<string, list<string>> $parameters): array<non-empty-string, list<non-empty-string>>Answers the per-prefix lists, having refused any empty prefix or entry.
Parameters
$parameters | array<string, list<string>> | Parameter prefix => delimiters that may follow it |
Returns
array<non-empty-string, list<non-empty-string>> The same listsThrows
InvalidDefinitionException When a prefix or one of its entries is emptyTest cases 1
LexicalDelimitersTest::testPerPrefixListsAnswersTheListsItWasGivencovers and calls
Called from 2
Calls 2
- new InvalidDefinitionException line 80
- method-call LexicalDelimiters::nonEmpty() line 82
public function perPrefixPatterns(array<string, string> $patterns): array<non-empty-string, non-empty-string>Answers the per-prefix patterns, having refused any preg cannot read.
Parameters
$patterns | array<string, string> | Parameter prefix => pattern for what may follow its name |
Returns
array<non-empty-string, non-empty-string> The same patternsThrows
InvalidDefinitionException When a prefix is empty or a pattern is unreadableTest cases 1
Called from 1
Calls 2
- new InvalidDefinitionException line 101
- method-call LexicalPattern::assertValid() line 103
public function validPatterns(list<string> $patterns): list<non-empty-string>Answers the patterns, having refused any preg cannot read.
Parameters
$patterns | list<string> | Patterns as the dialect declared them |
Returns
list<non-empty-string> The same patternsThrows
InvalidDefinitionException When one of them is empty or unreadableTest cases 1
LexicalDelimitersTest::testValidPatternsAnswersThePatternsItWasGivencovers and calls
Called from 1
Calls 2
- method-call LexicalDelimiters::nonEmpty() line 120
- method-call LexicalPattern::assertValid() line 122
Private surface 1§
Implementation details, listed for orientation only.
private LexicalPattern $patterns = new \ZtdQuery\Sql\LexicalPattern()Test cases 19§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
LexicalDelimitersTest::testNonEmptyAnswersTheDelimitersItWasGivencovers and callsLexicalDelimitersTest::testPairsAnswersThePairsItWasGivencovers and callsLexicalDelimitersTest::testPairsNamesWhatItWasRefusingInTheRefusalcovers and callsLexicalDelimitersTest::testPerPrefixListsAnswersTheListsItWasGivencovers and callsLexicalDelimitersTest::testPerPrefixPatternsAnswersThePatternsItWasGivencovers and callsLexicalDelimitersTest::testValidPatternsAnswersThePatternsItWasGivencovers and calls
Other tests reaching this symbol 13
SqlCommentProfileTestcallsSqlParameterProfileTestcallsSqlQuoteProfileTestcallsSqlBlockCommentReaderTestcallsSqlDelimitedReaderTestcallsSqlParameterReaderTestcallsSqlTriviaReaderTestcallsSqlWordReaderTestcallsSqlIdentifierComponentTestcallsSqlKeywordSequenceTestcallsSqlLexerProfileTestcallsSqlTokenScannerTestcallsSqlTokenStreamTestcalls
Relations§
Instantiated in 3
- new ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:43
- new ZtdQuery\Sql\Profile\SqlParameterProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlParameterProfile.php:49
- new ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:47
Method calls 10
- method-call ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:45
- method-call ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:46
- method-call ZtdQuery\Sql\Profile\SqlCommentProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:49
- method-call ZtdQuery\Sql\Profile\SqlParameterProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlParameterProfile.php:51
- method-call ZtdQuery\Sql\Profile\SqlParameterProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlParameterProfile.php:52
- method-call ZtdQuery\Sql\Profile\SqlParameterProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlParameterProfile.php:53
- method-call ZtdQuery\Sql\Profile\SqlParameterProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlParameterProfile.php:54
- method-call ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:49
- method-call ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:50
- method-call ZtdQuery\Sql\Profile\SqlQuoteProfile::__construct() packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:51
Type declarations 3
- type ZtdQuery\Sql\Profile\SqlCommentProfile packages/ztd-query-core/src/Sql/Profile/SqlCommentProfile.php:43
- type ZtdQuery\Sql\Profile\SqlParameterProfile packages/ztd-query-core/src/Sql/Profile/SqlParameterProfile.php:49
- type ZtdQuery\Sql\Profile\SqlQuoteProfile packages/ztd-query-core/src/Sql/Profile/SqlQuoteProfile.php:47