-
Notifications
You must be signed in to change notification settings - Fork 7
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
Newline required at end of file with test statement #87
Comments
What's the bug? |
Sorry, was going to come back and add more details later but today was crazy busy. Edited with more info. |
https://github.com/JMU-CS/less-java/blob/master/src/main/antlr/LJ.g4#L20 Yeah seems the grammar requires an EOL. Could we redefine EOL to be a new line character or end of file? Here's some discussion I found online about that: http://antlr.1301665.n2.nabble.com/How-to-treat-EOF-as-NEWLINE-td7579363.html The second to last comment seems to provide a solution:
|
Aha. Figured it was something like that. Yes, this seems like a fine solution to me. |
Did some testing and I can't quite get it to work. It also appears that it's maybe not recommended: https://www.antlr3.org/pipermail/antlr-interest/2011-January/040642.html That claims that it's probably easier to just add a new line to the input if there isn't one present. Dealing with it in the grammar can be more trouble than it's worth. |
Can't figure out if there's an elegant way for me to add a commit to #84 but the change is simple. before this line: https://github.com/lam2mo/less-java/blob/ui/src/main/java/com/github/lessjava/LJUI.java#L98 add:
|
Fixes JMU-CS#87 in the UI by avoiding EOL/EOF issues with ANTLR: https://www.antlr3.org/pipermail/antlr-interest/2011-January/040642.html
During the UI testing (see #84) I discovered that I was getting a parse error if the file ended with a "test" statement that didn't terminate with a newline. This may be a UI-only issue; more testing is necessary.
The text was updated successfully, but these errors were encountered: