Skip to content

Instantly share code, notes, and snippets.

@omega
Created January 10, 2011 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omega/02da976d5e03b700ce3f to your computer and use it in GitHub Desktop.
Save omega/02da976d5e03b700ce3f to your computer and use it in GitHub Desktop.
Specify a rule name in a lexical variable
{
my $m = m(@strings[1]);
ok $m, "mathced @strings[1]";
is $m<paragraph>.elems, 2;
}
#is($f->convert('* list'), "\\begin{itemize}\n\\item list\n\\end{itemize}");
sub m($str, $rule = 'TOP') {
diag("rule: $rule");
my $m = JIRA::Formater::Wiki::Grammar.parse($str, :rule<$rule>);
return $m;
}
# this results in this:
# rule: TOP
Method '$rule' not found for invocant of class ''
in 'Grammar::parse' at line 6150:CORE.setting
in 'm' at line 40:t/wiki.t
in main program body at line 25:t/wiki.t
#### Now if I write it out, like put :rule<TOP>, it works?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment