malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
1.99k stars 76 forks source link

Error on empty .malloy files #271

Closed anikaks closed 2 years ago

anikaks commented 2 years ago

I get an error when I have nothing in a .malloy file, but it doesn't seem to mind if there's stuff there but just commented out. Not sure if there's a reason not to do this, but I think having an immediate error when you create a file is a bit off-putting (plus the error persists if you delete said file), and ideally we could just accept empty models. no model:

Screen Shot 2022-01-25 at 4 45 43 PM

commented model:

Screen Shot 2022-01-25 at 4 45 35 PM
mtoy-googly-moogly commented 2 years ago

So a file with no statements in it is legal, and if you parse a file containing a single newline, everything works fine, but if you parse a file containing no characters, ANTLR refuses to return a parser.

I'll hack around it by parsing "" as "\n"

mtoy-googly-moogly commented 2 years ago

Good catch @anikaks ! All fixed.