All Grammars Are Germophobes in 楽土

[ The following is a rantish post. If you don’t like negative words, please visit this site. ]

So today I’ve been goodish at following TDD (I’m only starting, mind you), and I wanted to be able to make the grammar parse config options in Pod directives. Config options are used in Pod directives to turn on and off and otherwise modify various options for the block. In S26’s source code, you’ll find it in this line a lot (it’s the :allow<R> part):

=begin code :allow<R>

The easiest way is to match that part of the line to a colonpair. Alas, it’s not that simple. I have again been bitten by the very… germophobic nature of grammars in Rakudo. You can’t use /<Perl6::Grammar::colonpair>/, nor /[:lang(Perl6::Grammar) <colonpair>]/, nor “:a<b>” ~~ Perl6::Grammar.colonpair. The only thing that works is eval(“:a<b>”) ~~ Pair, and that won’t work inside a regex.

It seems like every time I try to use grammars, I eventually get stopped by the inability to use regexes in other grammars. </rant>

[ by the way, the Japanese in this post’s title has a double meaning. I think it’s called a ‘pun’ 🙂 ]

This entry was posted in Cantina and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s