classQuotedLiteralScanner
final class QuotedLiteralScanner
implements BisonScanner
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Consumes a quoted literal.
Bison spells a token's own text in single quotes and its alias in double quotes, so the quote character decides which lexeme was written. Both are read the same way, escapes included; only the resulting lexeme differs.
Methods§
public function handles(string $character): boolReports whether a quoted literal can start here.
Parameters
$character | string | A single character; never the empty string |
Returns
bool True for either quote characterTest cases 1
QuotedLiteralScannerTest::testHandlesClaimsBothQuoteCharacterscovers and calls
public function scan(SourceCursor $cursor): BisonTokenConsumes the literal including both quotes.
Parameters
$cursor | SourceCursor | Cursor positioned on the opening quote |
Returns
BisonToken The unescaped text between the quotesTest cases 4
QuotedLiteralScannerTest::testScanKeepsReadingPastAnEscapedQuotecovers and callsQuotedLiteralScannerTest::testScanReadsAnEmptyLiteralcovers and callsQuotedLiteralScannerTest::testScanReadsDoubleQuotesAsAStringLiteralcovers and callsQuotedLiteralScannerTest::testScanReadsSingleQuotesAsACharacterLiteralcovers and calls
Calls 6
- method-call SourceCursor::offset() line 43
- method-call SourceCursor::current() line 44
- class-const BisonLexeme::CharLiteral() line 45
- class-const BisonLexeme::StringLiteral() line 45
- new BisonToken line 47
- method-call SourceCursor::takeQuoted() line 47
Test cases 22§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
QuotedLiteralScannerTest::testHandlesClaimsBothQuoteCharacterscovers and callsQuotedLiteralScannerTest::testScanKeepsReadingPastAnEscapedQuotecovers and callsQuotedLiteralScannerTest::testScanReadsAnEmptyLiteralcovers and callsQuotedLiteralScannerTest::testScanReadsDoubleQuotesAsAStringLiteralcovers and callsQuotedLiteralScannerTest::testScanReadsSingleQuotesAsACharacterLiteralcovers and calls
Other tests reaching this symbol 17
BisonParserTestcallsBisonPreambleReaderTestcallsBisonDirectiveReaderChainTestcallsDefineDirectiveReaderTestcallsExpectDirectiveReaderTestcallsParamDirectiveReaderTestcallsPrecedenceDirectiveReaderTestcallsStartDirectiveReaderTestcallsTokenDirectiveReaderTestcallsTypeDirectiveReaderTestcallsUnknownDirectiveReaderTestcallsBisonLexerTestcallsBisonScannerChainTest::providerClaimedCharactercallsBisonScannerTest::providerScannercallsBisonTokenStreamTestcallsBisonAlternativeReaderTestcallsBisonRuleReaderTestcalls