Commit Graph

64 Commits

Author SHA1 Message Date
Dave Yarwood
d766a75b5c Fix a bug where a duration in seconds at the end of an event sequence was causing a parse error 2021-07-31 23:29:58 -04:00
Dave Yarwood
ecb5aae370 Hack to work around aurora not supporting NO_COLOR 2021-06-28 11:04:48 -04:00
David Lu
c8afe42062 Added tests 2021-06-06 21:03:48 -04:00
Dave Yarwood
6bd3c3c0fb Gracefully handle "file not found" error when playing a score file 2021-06-06 20:41:10 -04:00
David Lu
6795bc6bf0 Set up preliminary musicxml importer 2021-05-01 20:01:46 -04:00
Dave Yarwood
b3956dde60 scaffolding for better user-facing error messages 2021-01-16 15:27:22 -05:00
Dave Yarwood
51e4fb4f2e improve description of unexpected characters in error message 2020-11-14 20:59:29 -05:00
Dave Yarwood
228c81171c fix an edge case where "ab =" wasn't throwing an error
Input like "ab =" should result in an error because it's a variable definition
with no content.
2020-11-14 20:35:45 -05:00
Dave Yarwood
e0d11b1ec2 include source context EVERYWHERE
This provides filename/line/column context for any error I could possibly find.
To achieve this, I made it so that all ScoreUpdates have source context, so when
updating the score results in an error, we can print out the line and column
number corresponding to the error.

It's a bit more complicated than that, because score updates are nestable (e.g.
event sequences can contain cram expressions can contain chords, etc.), which
essentially gives us a stacktrace whenever a score update results in an error. I
punted on giving the user the full stacktrace, in favor of doing something
simpler and just showing the bottom-most error, because that's probably going to
be the line and column number that's the most helpful.
2020-11-14 20:34:04 -05:00
Dave Yarwood
f961abfd3c reorganize source context stuff a bit 2020-10-29 20:42:46 -04:00
Dave Yarwood
3bec60084b refactor / create an error type that wraps an error to provide alda source code context 2020-10-29 20:19:03 -04:00
Dave Yarwood
3a9a36e6b1 better string versions of token types (visible in user-facing error messages) 2020-10-29 20:18:01 -04:00
Dave Yarwood
709d669d9c improvements to line/column information in scan/parse error messages
1. Added column to parse error messages.

2. It turns out that we weren't even keeping track of the line and column where
   a token starts, let alone including it in the error message. Added
   `startLine` and `startColumn` fields to the scanner struct, made it so that
   they get updated in sync with the `start` (i.e. start index) field, and made
   it so that we're using the start line and column in error messages, instead
   of the _current_ line and column, which was less helpful.
2020-10-22 20:28:42 -04:00
Dave Yarwood
77d85bdf72 fixes an obscure parser bug where consumeWhile can sometimes try to consume past EOF 2020-07-31 08:32:37 -04:00
Dave Yarwood
7c9fd98fc9 use reachedEOF for readability 2020-07-31 08:26:02 -04:00
Dave Yarwood
b629e4c4c8 use eofIsNext helper function here for readability 2020-07-31 08:23:28 -04:00
Dave Yarwood
2679477d36 attempt to handle \r better 2020-05-10 21:32:06 -04:00
Dave Yarwood
86f1d6178f quick hack to avoid printing control characters weirdly (e.g. \r jumping to the beginning of the line) 2020-05-10 21:30:57 -04:00
Dave Yarwood
3d86b5d6c4 CRAM => cram 2020-04-25 16:18:16 -04:00
Dave Yarwood
4dd0fd4954 add parser test for V0: (voice group end marker) 2020-04-21 22:15:00 -04:00
Dave Yarwood
0144be5cb5 fix: a a repeat can be immediately followed by ] or } 2020-04-21 21:46:50 -04:00
Dave Yarwood
a5100b0f43 fix: " is not a valid lisp symbol char 2020-04-21 21:43:53 -04:00
Dave Yarwood
ed570636b0 use float64 everywhere to fix inaccuracies caused by converting float32 <=> float64 2020-04-18 21:02:35 -04:00
Dave Yarwood
e23f70e16f make log message more accurate 2020-02-23 21:21:38 -05:00
Dave Yarwood
6e2b33bbe1 alda doctor command 2020-02-03 08:08:17 -05:00
Dave Yarwood
86fa3810fc fix bug in scanner where lisp numbers can't be parsed if they're negative 2019-11-16 22:55:21 -05:00
Dave Yarwood
01f4382542 cap line length at 80 chars where possible 2019-11-10 07:45:47 -05:00
Dave Yarwood
a6aa4e560a rename OnIterations => OnRepetitions 2019-11-09 22:06:13 -05:00
Dave Yarwood
12603a2829 rm stray comment 2019-11-04 21:00:43 -05:00
Dave Yarwood
3588fd4689 make PitchIdentifier an interface instead of implicitly using certain fields of Note in certain situations
In accordance with the "don't make invalid data representable" principle.

This also allows us to create a LispPitch type in alda.lisp, which will just
wrap PitchIdentifier.
2019-11-04 09:32:51 -05:00
Dave Yarwood
67e6931abe consider "slur" to be an attribute of note only, not duration
i.e. a duration cannot be "slurred" anymore, but a note can be slurred
2019-10-30 23:01:16 -04:00
Dave Yarwood
cb09882fef use p.match(this, that) instead of p.match(this) || p.match(that) 2019-10-30 22:58:36 -04:00
Dave Yarwood
1416f7514d allow p.check to accept a variable number of token types 2019-10-30 22:57:44 -04:00
Dave Yarwood
e1b991448f adjust wording in comment 2019-10-29 22:35:26 -04:00
Dave Yarwood
8edaa55c4c WIP: lisp, attributes 2019-06-13 18:33:37 -04:00
Dave Yarwood
b1dbc804eb expand examples_test to include compiling the score
Tests currently failing until `updateScore` is implemented on every type of
ScoreUpdate.
2019-06-07 22:43:03 -04:00
Dave Yarwood
3db102922e ToString() => String() (more idiomatic) 2019-05-25 22:16:34 -04:00
Dave Yarwood
daf226e7e3 rename endings => iterations; introduce OnIterations event which can implement ScoreUpdate 2019-05-23 13:04:26 -04:00
Dave Yarwood
2f64fa5206 terminology change: nickname => alias 2019-05-21 22:11:33 -04:00
Dave Yarwood
6698bcc88d fix usage of append on a list 2019-05-21 21:48:13 -04:00
Dave Yarwood
32ef4e079a port parser tests from alda v1 2019-05-05 13:11:34 -04:00
Dave Yarwood
f271855295 bugfix: allow a variable definition to end with EOF 2019-05-05 13:11:16 -04:00
Dave Yarwood
1052ddef24 better grammar 2019-05-05 07:47:02 -04:00
Dave Yarwood
dae6c42d45 bugfix: don't include surrounding quotes in nickname 2019-05-04 21:59:36 -04:00
Dave Yarwood
57b2d7ce06 improve/fix parsing of endings 2019-05-04 21:58:32 -04:00
Dave Yarwood
e091439b2b bugfix: concatenate events instead of appending the slices 2019-05-04 15:02:56 -04:00
Dave Yarwood
47296a42d8 bugfix: better handle terminating a note length after a seconds note length 2019-05-04 14:12:31 -04:00
Dave Yarwood
601d302066 bugfix: correctly parse a second duration at the end of the score 2019-05-04 14:00:52 -04:00
Dave Yarwood
7f548d09f9 note lengths can be fractional; model S note lengths in terms of Ms 2019-05-04 14:00:30 -04:00
Dave Yarwood
0b6de9fb66 treat tabs as whitespace 2019-05-01 09:12:14 -04:00