Created
September 18, 2015 15:39
-
-
Save ronaldxs/227c871493478ce5224e to your computer and use it in GitHub Desktop.
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
use v6; | |
#`{{ | |
Combining character classes broken in lots of ways | |
}} | |
grammar TestGrammar { | |
token TOP { ^ <reserved2>+ $ } | |
token reserved1 { <gen_delims>+ } | |
token reserved2 { <+ gen_delims >+ }; # works ok | |
token reserved3 { <sub-delims>+ }; | |
token reserved4 { <+gen_delims+sub_delims>+ };# works OK | |
# what I really want because of http://www.ietf.org/rfc/rfc3986.txt | |
token reserved { <+gen-delims +sub-delims >+ }; | |
token gen_delims { <[a]> }; | |
token gen-delims { <[b]> }; | |
token sub_delims { <[c]> }; | |
token sub-delims { <[d]> }; | |
} | |
# say 'Any case that results in a type of (Any) is broken'; | |
my $m = TestGrammar.parse('aaa', :rule<reserved1>); | |
say $m.WHAT; | |
$m = TestGrammar.parse('aaa', :rule<reserved2>); | |
say $m.WHAT; | |
$m = TestGrammar.parse('ddd', :rule<reserved3>); | |
say $m.WHAT; | |
$m = TestGrammar.parse('acac', :rule<reserved4>); | |
say $m.WHAT; | |
$m = TestGrammar.parse('bdbd', :rule<reserved>); | |
say $m.WHAT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment