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 {
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
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
- 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