Permalink
Browse files

Switch from the complete tuplet implementation to the simpler one tha…

…t only allows triplets, quadruplets, and quintuplets but works on Rakudo
  • Loading branch information...
1 parent da4ff16 commit 9c1390f4903966d36e1b8dad9ad36592b5eb7ed2 @colomon committed Feb 8, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/ABC/Grammar.pm
View
9 lib/ABC/Grammar.pm
@@ -46,12 +46,13 @@ grammar ABC::Grammar
token broken_rhythm { <stem> <g1=b_elem>* <broken_rhythm_bracket> <g2=b_elem>* <stem> }
token t_elem { <gracing> | <grace_notes> | <broken_rhythm> | <slur_begin> | <slur_end> }
- token tuplet { '('(<digit>+) {} [<t_elem>* <stem>] ** { +$0 } <slur_end>? }
+ # token tuplet { '('(<digit>+) {} [<t_elem>* <stem>] ** { +$0 } <slur_end>? }
# If the previous line fails, you can use the next rule to get the most common cases
# next block makes the most common cases work
- # token tuplet { ['(3' [<t_elem>* <stem>] ** 3 <slur_end>? ]
- # | ['(4' [<t_elem>* <stem>] ** 4 <slur_end>? ]
- # | ['(5' [<t_elem>* <stem>] ** 5 <slur_end>? ] }
+ # token tuplet { '(' (<digit>+) {} (<t_elem>* <stem>)*? <?{ say $1.perl; say $0.perl; $1.elems == $0 }> <slur_end>? }
+ token tuplet { ['(3' [<t_elem>* <stem>] ** 3 <slur_end>? ]
+ | ['(4' [<t_elem>* <stem>] ** 4 <slur_end>? ]
+ | ['(5' [<t_elem>* <stem>] ** 5 <slur_end>? ] }
token nth_repeat_num { <digit>+ [[',' | '-'] <digit>+]* }
token nth_repeat_text { '"' .*? '"' }

0 comments on commit 9c1390f

Please sign in to comment.