Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplify input, work old note handling code into new match loop.

  • Loading branch information...
commit ffafa4bc817a7cefb5418d47dfd81c238d8fd606 1 parent 1e422a3
@LastOfTheCarelessMen authored
Showing with 19 additions and 24 deletions.
  1. +19 −24 dg-check.pl
View
43 dg-check.pl
@@ -3,31 +3,26 @@
BEGIN { push @*INC, "lib" }
use ABC;
-regex between { \v+ }
-regex file { \s* <ABC::tune> ** <between> }
-
-my $abcs = $*IN.lines.join("\n");
-my @matches = $abcs.comb(m/ <ABC::tune> /, :match);
+my @matches = $*IN.lines.join("\n").comb(m/ <ABC::tune> /, :match);
for @matches {
my %header = header_hash(.<ABC::tune><header>);
- say %header<T>;
-}
+ say %header<T> ~ ":";
+
+ my @notes = gather for .<ABC::tune><music><line_of_music> -> $line
+ {
+ for $line<bar> -> $bar
+ {
+ for $bar<element>
+ {
+ when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
+ when .<note> { take .<note>; }
+ }
+ }
+ }
-#
-# my @notes = gather for $match<ABC::tune><music><line_of_music> -> $line
-# {
-# for $line<bar> -> $bar
-# {
-# for $bar<element>
-# {
-# when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
-# when .<note> { take .<note>; }
-# }
-# }
-# }
-#
-# my %header = header_hash($match<ABC::tune><header>);
-# my %key_signature = key_signature(%header<K>);
-#
-# @notes.map({say .<pitch> ~ " => " ~ apply_key_signature(%key_signature, .<pitch>)});
+ my %header = header_hash(.<ABC::tune><header>);
+ my %key_signature = key_signature(%header<K>);
+
+ @notes.map({say .<pitch> ~ " => " ~ apply_key_signature(%key_signature, .<pitch>)});
+}
Please sign in to comment.
Something went wrong with that request. Please try again.