rir has asked for the wisdom of the Perl Monks concerning the following question:
In the below, I don't see why the x matches
differently from the * ?
rir
Be well,#!/home/rir/rakudo/parrot_install/bin/perl6 use v6; grammar Calc { rule TOP { <term> <op> <term> } # rule TOP { <term>\s?<op>\s?<term> } # a fix token term { \d+(\.\d*)? } token op { '*' | 'x' } } my @t = ( [ 44, " 8.8 * 5.0 " ], [ 44, " 8.8 x 5.0 " ], [ 44, " 8.8*5.0 " ], [ 44, " 8.8x5.0 " ], # no match ); for @t -> $i { my $m = Calc.parse( $i[1]); print $m ?? " " !! "no"; say " match: $i[1]" }
rir
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: P6: parsing whitespace
by moritz (Cardinal) on Jun 09, 2010 at 18:01 UTC |
Back to
Seekers of Perl Wisdom