Created
June 29, 2013 07:40
-
-
Save anonymous/5890252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
my $l1 = "1: 2 3 4"; | |
#my $l2 = "11: 2 3 4"; # Works | |
grammar Data { | |
rule TOP { ^ <date> ':' <datasequence> $ } | |
rule date { \d?\d } # problem with '?' | |
rule datasequence { (\s?<dane>)+ } | |
rule dane { \d+ } | |
} | |
say Data.parse( $l1 ); # Fail | |
say "OK" if $l1 ~~ /\d?\d:/; # OK | |
#say Data.parse( $l2 ); # Works |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment