classSymbolListReader
final class SymbolListReader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Reads the lists of terminals that end with a period.
Methods§
public function ranked(TokenStream $tokens, SymbolRegistry $registry): list<Symbol>Reads the terminals of %left, %right or %nonassoc.
Parameters
$tokens | TokenStream | The rest |
$registry | SymbolRegistry | Symbols seen so far |
Returns
list<Symbol> The terminalsThrows
SyntaxException When something is not a terminal or already rankedTest cases 2
Called from 1
Calls 4
- method-call SymbolListReader::untilPeriod() line 32
- new SyntaxException line 34
- method-call SymbolRegistry::rank() line 36
- new Symbol line 37
public function fallbacks(TokenStream $tokens, SymbolRegistry $registry): list<Symbol>Reads the terminals of %fallback.
Parameters
$tokens | TokenStream | The rest |
$registry | SymbolRegistry | Symbols seen so far |
Returns
list<Symbol> The fallback first, then the tokens that fall back to itThrows
SyntaxException When something is not a terminal or already falls backTest cases 3
Called from 1
Calls 5
- method-call SymbolListReader::untilPeriod() line 56
- new SyntaxException line 58
- method-call SymbolRegistry::see() line 61
- method-call SymbolRegistry::fallBack() line 63
- new Symbol line 65
public function tokens(
TokenStream $tokens,
SymbolRegistry $registry,
string $keyword,
): list<Symbol>Reads the terminals of %token.
Parameters
$tokens | TokenStream | The rest |
$registry | SymbolRegistry | Symbols seen so far |
$keyword | string | The keyword, for messages |
Returns
list<Symbol> The terminalsThrows
SyntaxException When something is not a terminalTest cases 2
Called from 1
Calls 4
- method-call SymbolListReader::untilPeriod() line 85
- new SyntaxException line 87
- method-call SymbolRegistry::see() line 89
- new Symbol line 90
public function wildcard(TokenStream $tokens, SymbolRegistry $registry): Symbol|nullReads the terminal of %wildcard.
Parameters
$tokens | TokenStream | The rest |
$registry | SymbolRegistry | Symbols seen so far |
Returns
Symbol|null The terminal, or null when none was writtenThrows
SyntaxException When something is not a terminal or a second one is namedTest cases 3
Called from 1
Calls 4
- method-call SymbolListReader::untilPeriod() line 109
- new SyntaxException line 111
- method-call SymbolRegistry::wildcard() line 113
- new Symbol line 114
public function classTokens(TokenStream $tokens, SymbolRegistry $registry): list<Symbol>Reads the terminals of %token_class, written bare or after | or /.
Parameters
$tokens | TokenStream | The rest |
$registry | SymbolRegistry | Symbols seen so far |
Returns
list<Symbol> The terminalsThrows
SyntaxException When something is not a terminalTest cases 2
Called from 1
Calls 6
- method-call SymbolListReader::untilPeriod() line 133
- class-const TokenKind::Compound() line 134
- function-call
ctype_upperline 134 - new SyntaxException line 136
- method-call SymbolRegistry::see() line 138
- new Symbol line 139
public function untilPeriod(TokenStream $tokens): list<Token>Takes tokens up to the period that ends a list.
Parameters
$tokens | TokenStream | The rest |
Returns
list<Token> The tokens before the periodThrows
SyntaxException When the file ends firstTest cases 2
Called from 5
- method-call LemonParser\Syntax\SymbolListReader::ranked() packages/lemon-parser/src/Syntax/SymbolListReader.php:32
- method-call LemonParser\Syntax\SymbolListReader::fallbacks() packages/lemon-parser/src/Syntax/SymbolListReader.php:56
- method-call LemonParser\Syntax\SymbolListReader::tokens() packages/lemon-parser/src/Syntax/SymbolListReader.php:85
- method-call LemonParser\Syntax\SymbolListReader::wildcard() packages/lemon-parser/src/Syntax/SymbolListReader.php:109
- method-call LemonParser\Syntax\SymbolListReader::classTokens() packages/lemon-parser/src/Syntax/SymbolListReader.php:133
Calls 3
- method-call TokenStream::next() line 158
- class-const TokenKind::End() line 162
- new SyntaxException line 163
Test cases 19§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 14
SymbolListReaderTest::testClassTokenscallsSymbolListReaderTest::testClassTokensRejectsANonterminalcallsSymbolListReaderTest::testFallbackscallsSymbolListReaderTest::testFallbacksRejectsANonterminalcallsSymbolListReaderTest::testFallbacksRejectsASecondFallbackForATokencallsSymbolListReaderTest::testRankedcallsSymbolListReaderTest::testRankedRejectsANonterminalcallsSymbolListReaderTest::testTokenscallsSymbolListReaderTest::testTokensRejectsANonterminalcallsSymbolListReaderTest::testUntilPeriodcallsSymbolListReaderTest::testUntilPeriodRejectsTheEndOfTheFilecallsSymbolListReaderTest::testWildcardcallsSymbolListReaderTest::testWildcardRejectsANonterminalcallsSymbolListReaderTest::testWildcardRejectsASecondTokencalls
Other tests reaching this symbol 5
LemonGrammarCompilerTestcallsLemonGrammarReaderTestcallsParserTestcallsDeclarationReaderTestcallsGrammarReaderTestcalls
Relations§
Instantiated in 1
Method calls 5
- method-call LemonParser\Syntax\DeclarationReader::read() packages/lemon-parser/src/Syntax/DeclarationReader.php:64
- method-call LemonParser\Syntax\DeclarationReader::read() packages/lemon-parser/src/Syntax/DeclarationReader.php:70
- method-call LemonParser\Syntax\DeclarationReader::read() packages/lemon-parser/src/Syntax/DeclarationReader.php:71
- method-call LemonParser\Syntax\DeclarationReader::read() packages/lemon-parser/src/Syntax/DeclarationReader.php:72
- method-call LemonParser\Syntax\DeclarationReader::readTokenClass() packages/lemon-parser/src/Syntax/DeclarationReader.php:172