Debugging Grammars

2009-12-27 Thread Ovid
To understand grammars better, I figured I would convert Config::Tiny to Perl 6. I've started with the following: grammar Config::Tiny::Grammar { token TOP { ? + } token root_section { + } token section {

Re: [perl #71536] [BUG] Rakudo allows two multi variants with the exact same signature to be defined

2009-12-27 Thread Jonathan Worthington
On 22/12/2009 10:22, Moritz Lenz wrote: Carl MXXsak (via RT) wrote: This be Rakudo 8dc189. $ perl6 -e 'multi sub f($a) {}; multi sub f($a) {}; f(42)' Ambiguous dispatch to multi 'f'. Ambiguous candidates had signatures: :(Any $a) :(Any $a) The definition of two variants with equivalent sig

Re: Debugging Grammars

2009-12-27 Thread Patrick R. Michaud
On Sun, Dec 27, 2009 at 01:30:18AM -0800, Ovid wrote: > > my $config = Config::Tiny::Grammar.parse($text); > #say $config ?? 'yes' || 'no'; > say $config.perl; > > Currently this matches, but if I add a \s* before the final \n > in the section token, it fails to match. I don't know

Re: Debugging Grammars

2009-12-27 Thread Ovid
- Original Message > From: Patrick R. Michaud > Any \s* will end up matching the final \n, and since quantifiers > in tokens default to "non backtracking", \s* \n in a token will > always fail. (In P5, it'd be like "(?>\s*)\n".) Perhaps > \h* \n would do what you want here? Works l