m-yac / xen-calc

A multi-purpose calculator for microtonal(/xenharmonic) music
9 stars 1 forks source link

Better error messages instead of parse errors #8

Open m-yac opened 3 years ago

m-yac commented 3 years ago

In general, the parser should be more lenient, so that the user sees less parse errors and instead more human-readable errors and/or more "Did you mean" messages. For example:

  1. Hyphenation should be allowed anywhere in a verbose color prefix, with "Did you mean" text when it's non canonical. See: https://github.com/m-yac/microtonal-utils/issues/5#issuecomment-890806820
  2. Trying to combine additive and multiplicative expressions shouldn't give a parse error, it should give a more helpful and readable error. Same with trying to add/multiply/etc. two notes.

This would involve significantly rewriting the parser to make it more lenient, and replacing eval.js with something more robust to enable it to inspect the output of the parser in more detail.

m-yac commented 3 years ago

(1) is done in m-yac/microtonal-utils@e9ffc30ed304c3597d5c13a216c75726b62e9979 and 702dc157fd2375e3ac36b66ef593eb0af4715a0b.