-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prog8 sensitive to ending on newline #40
Comments
This isn't easily fixable in the grammar, as a module file consists of blocks and a block (and other scopes) are required to be finalized with an EOL. However it can probably be worked around quite easily in the ModuleImporter by just appending a single EOL character before feeding it to the parser |
I think that would be a nice solution, just for convenience. It's one of those "fix by cheating" that requires good comments in the code to prevent accidental removal later. |
Hi, I had been stumbling over this as well. It is minor, but still annoying IMHO. It should be possible to adjust the grammar, something like treating EOF as a scope-terminator just like EOL. I think this should be fixed, so I'd vote for re-opening this issue. Not utterly urgent, though. |
@meisl It has been fixed in the linked commit, just not by changing the grammar but by adjusting the input file. I was adjusting that anyway already to normalize the line endings. |
Sorry, I obviously misunderstood. |
Maybe it can be fixed in the grammar file itself and then the line munging in the code could be removed, but I couldn't get it to work. My Antlr-Fu isn't big enough. |
How about changing Line 78 in 19e9920
to
? Line endings should more efficiently be dealt with there, too: change Line 21 in 19e9920
to
(saves searching and basically copying the whole file content) p.s.: beware, that's purely by looking at it - haven't tried it. Seems that it's getting time for me to set things up for building myself... |
…we can see that tests actually fail
…ust have a newline after their closing `}`
…doesn't actually fail with old grammar, but a built jar does - WHY?!*
…): also test sole \r AND do not allow any recovery, neither from parser not lexer.
… a "synthesized double EOF" (behavior remains exactly the same)
This is just a small annoyance and possibly just cause by my choice of editor (Emacs). The editor does not automatically add a newline at the last line when editing normally.
test.p8:9:1: missing EOL at ''
Attaching a minimal file that reproduce the error.
test.zip
The text was updated successfully, but these errors were encountered: