classLemonText
final class LemonText
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Removes from a Lemon file everything that is not grammar.
A Lemon file carries the C the generated parser is built from as well as the rules it recognises: comments, include blocks, destructors, and declarations about types and names. None of that says what the parser accepts, and all of it can contain text that reads like a rule, so it is taken out before the rules are looked for.
Methods§
public function withoutComments(string $input): stringRemoves C comments.
Parameters
$input | string | Contents of the grammar file |
Returns
string The same text with its comments goneTest cases 2
LemonTextTest::testWithoutCommentsLeavesGrammarAlonecovers and callsLemonTextTest::testWithoutCommentsRemovesBlockAndLineCommentscovers and calls
Called from 1
Calls 1
- function-call
preg_replaceline 29
public function withoutDirectiveBlocks(string $input): stringRemoves the directives that carry C or configure the generated parser.
Parameters
$input | string | Contents of the grammar file |
Returns
string The same text with those directives goneTest cases 2
Called from 1
Calls 1
- function-call
preg_replaceline 41
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
LemonTextTest::testWithoutCommentsLeavesGrammarAlonecovers and callsLemonTextTest::testWithoutCommentsRemovesBlockAndLineCommentscovers and callsLemonTextTest::testWithoutDirectiveBlocksRemovesTheCTheParserIsBuiltFromcovers and callsLemonTextTest::testWithoutDirectiveBlocksRemovesTheDeclarationsThatConfigureTheParsercovers and calls
Other tests reaching this symbol 2
LemonParserTestcallsLemonRulesTestcalls