Permalink
Browse files

Allow K L and M header fields in tune bodies, for backwards compatibi…

…lity.
  • Loading branch information...
1 parent 363a3dc commit 15767d79474bd4366de42997b770dbe9fff77512 @colomon committed May 16, 2012
Showing with 10 additions and 2 deletions.
  1. +5 −1 lib/ABC/Actions.pm
  2. +5 −1 lib/ABC/Grammar.pm
View
@@ -20,6 +20,10 @@ class ABC::Actions {
make ~$<header_field_name> => ~$<header_field_data>;
}
+ method interior_header_field($/) {
+ make ~$<interior_header_field_name> => ~$<interior_header_field_data>;
+ }
+
method header($/) {
my $header = ABC::Header.new;
for @( $<header_field> ) -> $field {
@@ -177,7 +181,7 @@ class ABC::Actions {
@music.push($_);
}
}
- when *.key eq "header_field" {
+ when *.key eq "interior_header_field" {
@music.push("inline_field" => $_.value.ast);
}
}
View
@@ -77,7 +77,11 @@ grammar ABC::Grammar
regex line_of_music { <barline>? <bar>+ '\\'? }
- regex music { [<line_of_music> \s*\v?]+ }
+ regex interior_header_field_name { < K M L > }
+ regex interior_header_field_data { \N* }
+ regex interior_header_field { ^^ <interior_header_field_name> ':' \s* <interior_header_field_data> $$ }
+
+ regex music { [[<line_of_music> | <interior_header_field>] \s*]+ }
regex tune { <header> <music> }

0 comments on commit 15767d7

Please sign in to comment.