Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

rests at the end of event sequence blocks throw a parser error #41

Closed
elydpg opened this issue May 31, 2017 · 4 comments
Closed

rests at the end of event sequence blocks throw a parser error #41

elydpg opened this issue May 31, 2017 · 4 comments

Comments

@elydpg
Copy link

elydpg commented May 31, 2017

This one is best explained with examples

[c d c ] #parsed correctly
[c d c] #parsed correctly
[c d c r ] #parsed correctly
[c d c r] #throws parse error
@daveyarwood
Copy link
Member

Good catch! I think this should be an easy fix.

@elydpg
Copy link
Author

elydpg commented May 31, 2017

Hm... I'm still not all that familiar with the clojure code though I could take a look if I knew where...

@daveyarwood
Copy link
Member

Sure, that would be great!

In this case, I think I know exactly where the problem is. While we're tokenizing the input and parsing through the characters in a rest, we only consider the rest to be "done" when we encounter a space, newline, EOF, or a digit representing duration, and we throw an exception otherwise. The code for that logic is here.

I was having the same problem for notes, and I fixed it by doing this: when an unknown character (e.g. a ]) is encountered, instead of throwing an error, we just say that the note is "done" and start trying to parse a new token (e.g. a "close event sequence" event).

I think that if we do the same thing in the "else" branch for rests, that will fix this problem.

I'd like to add test cases, too, so we can make sure this stays fixed in the future.

@daveyarwood
Copy link
Member

Fixed in 1.0.0-rc58.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants