Skip to content

Commit

Permalink
Rakudo doesn't seem to like =. alias, so alias both the first and the…
Browse files Browse the repository at this point in the history
… second gracings in broken_rhythm so you can tell the difference.
  • Loading branch information
LastOfTheCarelessMen committed Dec 17, 2009
1 parent 479f3de commit 599652e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/ABC.pm
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion t/01-regexes.t
Expand Up @@ -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';
Expand All @@ -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;

0 comments on commit 599652e

Please sign in to comment.