What's wrong
Arrangement.TryParse (Semantics.Music/Arrangement.cs:96) splits the text on exactly "\n\n". It then passes each block to Section.TryParse without trimming it. Section.TryParse requires the block's first character to be [ (Section.cs:116-118). Two layouts break this:
- Three newlines between sections. The next block starts with
"\n", so it fails the [ check.
- A blank line holding a space or tab (
"\n \n"). The split never happens, so two sections are read as one block.
Either way the whole parse fails.
Reproduced against HEAD 9c64b67, starting from a valid arrangement a with a Verse and a Chorus:
Arrangement.Parse(a.ToString()) round-trips. CRLF input is also fine.
Arrangement.Parse(a.ToString().Replace("\n\n", "\n\n\n")) throws FormatException.
Arrangement.Parse(a.ToString().Replace("\n\n", "\n \n")) throws FormatException.
Why it matters
Arrangements are hand-written chart files. An extra blank line between sections, or an editor leaving trailing whitespace on the separator line, makes a valid chart unparseable. The error doesn't point at the cause.
Suggested fix
Split into lines and treat any run of empty or whitespace-only lines as one section separator. Alternatively, trim leading and trailing newlines from each block and drop blocks that are empty after trimming.
Acceptance criteria
- Both variants above parse equal to
a.
- The existing arrangement round-trip tests still pass.
What's wrong
Arrangement.TryParse(Semantics.Music/Arrangement.cs:96) splits the text on exactly"\n\n". It then passes each block toSection.TryParsewithout trimming it.Section.TryParserequires the block's first character to be[(Section.cs:116-118). Two layouts break this:"\n", so it fails the[check."\n \n"). The split never happens, so two sections are read as one block.Either way the whole parse fails.
Reproduced against HEAD 9c64b67, starting from a valid arrangement
awith a Verse and a Chorus:Arrangement.Parse(a.ToString())round-trips. CRLF input is also fine.Arrangement.Parse(a.ToString().Replace("\n\n", "\n\n\n"))throwsFormatException.Arrangement.Parse(a.ToString().Replace("\n\n", "\n \n"))throwsFormatException.Why it matters
Arrangements are hand-written chart files. An extra blank line between sections, or an editor leaving trailing whitespace on the separator line, makes a valid chart unparseable. The error doesn't point at the cause.
Suggested fix
Split into lines and treat any run of empty or whitespace-only lines as one section separator. Alternatively, trim leading and trailing newlines from each block and drop blocks that are empty after trimming.
Acceptance criteria
a.