diff --git a/lib/ABC.pm b/lib/ABC.pm index 1863d0d..a133ca3 100644 --- a/lib/ABC.pm +++ b/lib/ABC.pm @@ -22,15 +22,13 @@ grammar ABC regex gracing { '+' + '+' } regex broken_rhythm_bracket { ['<'+ | '>'+] } - regex broken_rhythm { * * } + regex broken_rhythm { * * } regex element { | | | } regex barline { '|' | ':|' | '|:' | ':|:' | '::' } - regex line_of_music { | [? + [ +]* ?] } - - + regex line_of_music { | [? + [ +]* ?] } } class ABCHeader diff --git a/t/01-regexes.t b/t/01-regexes.t index 0579a83..bb1dff1 100644 --- a/t/01-regexes.t +++ b/t/01-regexes.t @@ -127,7 +127,7 @@ plan *; is $match[0], "'", 'first note has an octave tick'; is $match[0], "", 'first note has no accidental'; is $match[0], "", 'first note has no length'; - is $match[0], "+p+", 'first gracing is +p+'; + is $match[0], "+p+", 'first gracing is +p+'; is $match, "<<<", 'angle is <<<'; is $match[0], "+accent+", 'second gracing is +accent+'; is $match[1], "B", 'second note is B'; @@ -136,4 +136,10 @@ plan *; is $match[1], "", '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/ /; + isa_ok $match, Match, 'line of music recognized'; + say $match.perl; +} + done_testing; \ No newline at end of file