Create a gist now

Instantly share code, notes, and snippets.

@jnthn /mismatch.p6 Secret
Created Apr 21, 2017

What would you like to do?
grammar Parser {
token TOP { <matcher>+ }
proto token matcher { * }
token matcher:sym<[]> { '[' <( <-[\]]>+ )> ']' }
token matcher:sym<lit> { <-[/*?[]>+ }
}
class RuleCompiler {
# Simply commenting out this causes the matcher:sym<lit> to get the .txt it should. With
# this, it gets ].txt instead.
method matcher:sym<[]>($/) { }
}
say Parser.parse('[AB].txt', :actions(RuleCompiler));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment