Permalink
Browse files

Allow comments everywhere, though they aren't handled properly in the…

… header section yet.
  • Loading branch information...
colomon committed May 26, 2012
1 parent dda7786 commit 2d3cd6847f030f8958ecaeffe94765a51e97ecc2
Showing with 5 additions and 4 deletions.
  1. +4 −3 lib/ABC/Grammar.pm
  2. +1 −1 t/01-regexes.t
View
@@ -3,7 +3,8 @@ use v6;
grammar ABC::Grammar
{
- regex comment_line { ^^ \h* '%' \N* $$ }
+ regex comment { \h* '%' \N* $$ }
+ regex comment_line { ^^ <comment> }
token header_field_name { \w }
token header_field_data { \N* }
@@ -77,11 +78,11 @@ grammar ABC::Grammar
token bar { <element>+ <barline>? }
- token line_of_music { <barline>? <bar>+ '\\'? }
+ token line_of_music { <barline>? <bar>+ '\\'? <comment>? $$ }
token interior_header_field_name { < K M L > }
token interior_header_field_data { \N* }
- token interior_header_field { ^^ <interior_header_field_name> ':' \s* <interior_header_field_data> $$ }
+ token interior_header_field { ^^ <interior_header_field_name> ':' \h* <interior_header_field_data> $$ }
token music { [[<line_of_music> | <interior_header_field> | <comment_line> ] \s*]+ }
View
@@ -429,7 +429,7 @@ M:4/4
L:1/8
K:D
A/B/c/A/ +trill+c>d e>deg | GG +trill+B>c d/B/A/G/ B/c/d/B/ |
-A/B/c/A/ c>d e>deg | dB/A/ gB +trill+A2 +trill+e2 ::
+A/B/c/A/ c>d e>deg | dB/A/ gB +trill+A2 +trill+e2 :: % test comment
g>ecg ec e/f/g/e/ | d/c/B/A/ Gd BG B/c/d/B/ |
g/f/e/d/ c/d/e/f/ gc e/f/g/e/ | dB/A/ gB +trill+A2 +trill+e2 :|
»;

0 comments on commit 2d3cd68

Please sign in to comment.