classCodeReader
final class CodeReader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Reads a { ... } block as Lemon's tokenizer does.
Braces nest, and braces inside comments, strings and character literals do not count. Backslashes escape inside strings and character literals.
Methods§
public function read(Cursor $cursor): stringReads the block the cursor is at and returns the text between the braces.
Parameters
$cursor | Cursor | Positioned at the opening brace |
Returns
string The code without its bracesThrows
SyntaxException When the file ends before the closing braceTest cases 2
Called from 1
Calls 9
- method-call Cursor::location() line 30
- method-call Cursor::take() line 31
- method-call Cursor::offset() line 32
- method-call Cursor::eof() line 34
- method-call Cursor::peek() line 35
- function-call
substrline 37 - method-call CodeReader::comment() line 48
- method-call CodeReader::literal() line 50
- new SyntaxException line 55
public function comment(Cursor $cursor): voidMoves past a comment inside code.
Parameters
$cursor | Cursor | Positioned at the slash |
Test cases 1
Called from 1
Calls 5
- method-call Cursor::peek() line 65
- method-call Cursor::match() line 66
- method-call Cursor::take() line 70
- method-call Cursor::takeUntil() line 71
- function-call
strlenline 72
public function literal(Cursor $cursor): voidMoves past a string or character literal inside code.
Parameters
$cursor | Cursor | Positioned at the opening quote |
Test cases 1
Called from 1
Calls 2
- method-call Cursor::take() line 83
- method-call Cursor::eof() line 85
Test cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 8
LemonGrammarCompilerTestcallsLemonGrammarReaderTestcallsParserTestcallsScannerTestcallsDeclarationReaderTestcallsGrammarReaderTestcallsRuleReaderTestcallsSymbolListReaderTestcalls