Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rakudo doesn't seem to like =. alias, so alias both the first and the…

… second gracings in broken_rhythm so you can tell the difference.
  • Loading branch information...
commit 599652e4a6ea516d062c2f21d58e230dc9542c8b 1 parent 479f3de
@LastOfTheCarelessMen authored
Showing with 9 additions and 5 deletions.
  1. +2 −4 lib/ABC.pm
  2. +7 −1 t/01-regexes.t
View
6 lib/ABC.pm
@@ -22,15 +22,13 @@ grammar ABC
regex gracing { '+' <alpha>+ '+' }
regex broken_rhythm_bracket { ['<'+ | '>'+] }
- regex broken_rhythm { <note> <gracing>* <broken_rhythm_bracket> <g2=gracing>* <note> }
+ regex broken_rhythm { <note> <g1=gracing>* <broken_rhythm_bracket> <g2=gracing>* <note> }
regex element { <note> | <broken_rhythm> | <rest> | <gracing> }
regex barline { '|' | ':|' | '|:' | ':|:' | '::' }
- regex line_of_music { <barline> | [<barline>? <element>+ [<barline> <element>+]* <barline>?] }
-
-
+ regex line_of_music { <barline> | [<barline>? <element>+ [<barline> <element>+]* <barline>?] }
}
class ABCHeader
View
8 t/01-regexes.t
@@ -127,7 +127,7 @@ plan *;
is $match<ABC::broken_rhythm><note>[0]<pitch><octave>, "'", 'first note has an octave tick';
is $match<ABC::broken_rhythm><note>[0]<pitch><accidental>, "", 'first note has no accidental';
is $match<ABC::broken_rhythm><note>[0]<note_length>, "", 'first note has no length';
- is $match<ABC::broken_rhythm><gracing>[0], "+p+", 'first gracing is +p+';
+ is $match<ABC::broken_rhythm><g1>[0], "+p+", 'first gracing is +p+';
is $match<ABC::broken_rhythm><broken_rhythm_bracket>, "<<<", 'angle is <<<';
is $match<ABC::broken_rhythm><g2>[0], "+accent+", 'second gracing is +accent+';
is $match<ABC::broken_rhythm><note>[1]<pitch><basenote>, "B", 'second note is B';
@@ -136,4 +136,10 @@ plan *;
is $match<ABC::broken_rhythm><note>[1]<note_length>, "", 'second note has no length';
}
+{
+ my $match = "g>ecg ec e/f/g/e/ | d/c/B/A/ Gd BG B/c/d/B/ |" ~~ m/ <ABC::line_of_music> /;
+ isa_ok $match, Match, 'line of music recognized';
+ say $match<ABC::line_of_music>.perl;
+}
+
done_testing;
Please sign in to comment.
Something went wrong with that request. Please try again.