/weird.txt Secret
Created
December 17, 2014 17:46
Grammar succeeds once Grammar::Tracer is imported
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6 -e 'grammar G { regex TOP { [<x> ['\'';'\'' | $$] \s*]* }; token x { B | \s* <y> \s* '\''()'\''* }; regex y { A | B } }; my $s = "B\nA();"; say ?G.parse($s)' | |
False | |
$ perl6 -e 'use Grammar::Tracer; grammar G { regex TOP { [<x> ['\'';'\'' | $$] \s*]* }; token x { B | \s* <y> \s* '\''()'\''* }; regex y { A | B } }; my $s = "B\nA();"; say ?G.parse($s)' | |
TOP | |
| x | |
| * MATCH "B" | |
| x | |
| | y | |
| | * MATCH "A" | |
| * MATCH "A()" | |
| x | |
| | y | |
| | * FAIL | |
| * FAIL | |
* MATCH "B\nA();" | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment