Created
March 24, 2019 12:29
-
-
Save dmaestro/15aa917cd7238f8dcea637ea5a5e3526 to your computer and use it in GitHub Desktop.
Test for rakudo/rakudo issue #2791
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; | |
grammar Chord { | |
rule TOP { <key> \S* } | |
regex bare-key { <key> <!before \S > } | |
regex bare-key-one { <key> [ <!before \S > | $ ] } | |
regex bare-key-two { <key> <!before <:!Space> > } | |
token natural-note { <[ A..G ]> } | |
token accidental { <[ \# b ]> } | |
regex key { <natural-note> <accidental>? } | |
} | |
use Test; | |
ok Chord.parse('C#'); | |
ok my $m = Chord.parse('C#m'); | |
note 'C#m: ', $m; | |
ok ! Chord.subparse(:rule(<bare-key>), 'C#m'); | |
ok Chord.subparse(:rule(<bare-key>), 'C# m'); | |
ok Chord.subparse(:rule(<bare-key>), 'C# '); | |
ok Chord.subparse(:rule(<bare-key>), 'C#'), 'Character class recognizes end-of-line'; | |
ok Chord.subparse(:rule(<bare-key-one>), 'C#'), 'Alternation recognizes end-of-line'; | |
ok Chord.subparse(:rule(<bare-key-two>), 'C#'), 'Property recognizes end-of-line'; | |
done-testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment