From 03bafbc86c7abcf4eb1906df241a0a40353edf4a Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Thu, 15 Jul 2010 19:17:51 +0200 Subject: [PATCH] Gracefully handle invalid space characters inside the P&E code (print a warning, but continue processing) --- pae2xml.pl | 4 ++++ sample_files/Invalid-space.pae | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 sample_files/Invalid-space.pae diff --git a/pae2xml.pl b/pae2xml.pl index 060d1ab..a33111c 100755 --- a/pae2xml.pl +++ b/pae2xml.pl @@ -381,6 +381,10 @@ sub parse_notes { elsif ($notes =~ s/(\d+\.*)\(((\,|\')*(x|xx|b|bb|n)?\d*\.*(g|q)?(\-|A|B|C|D|E|F|G)t?\+?)\)/\($1$2\)/gs) { # pull duration into fermata parentheses # print "after replacement: $notes\n"; exit; } + elsif ($notes =~ /^ +(.*)$/) { + $notes = $1; + print("Invalid space encountered in notes before $notes\n"); + } else { print_error("got stuck with $notes\n"); $notes = ""; diff --git a/sample_files/Invalid-space.pae b/sample_files/Invalid-space.pae new file mode 100644 index 0000000..ac087c1 --- /dev/null +++ b/sample_files/Invalid-space.pae @@ -0,0 +1,7 @@ +Test Composer +Test case for invalid spaces inside Plaine and Easie code +1.1.1: S +plain&easy: %C-1@c$bB� '4C DEF/ GAB''C// + +Test Library +00000000 \ No newline at end of file -- GitLab