we're relying on the greediness of .*
to definitely eat the \n
even though it`s got a ?
on it?
well, .
by default means non-newline chars in regex-land
the \n?
had me worried that it might parse [" foo" " bar"]
from " foo bar"
but yes we are relying on the greediness
👍
#".*(\n|$)"
might be safer
btw I believe @dave has some prior art on nested parsers for Alda
actually just kidding I think he migrated away from instaparse in more recent versions of Alda
indeed, i ended up rolling my own parser, mostly in the hope that someday we can start to asynchronously process parsed expressions/statements as they are parsed -- meaning that a score could start playing before it's even done being parsed
...although in doing so, performance got significantly better, to the extent that we might never need to do that 😄
before moving away from instaparse, i was doing some pretty complicated stuff with multiple grammars. it was starting to make my head hurt a little, so that may have had something to do with the decision too
the grammars needed to share some rules with each other, so i was defining grammars using bits and pieces strung together
the reason for that was basically to try and get better perf (without being super knowledgeable about how to improve parser performance otherwise), instead of a big master grammar like i had before, i started parsing out large chunks with more specialized grammars, and do the parsing in multiple passes