Fix allowing arithmetic expressions without spaces and no need for extra operator e.g. "4+-5". "4-5" works. #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @arothuis! I realize this project is a small demonstration of ANTLR4, but I was interested in expanding the calculator's function and became annoyed with the strict formatting of the input. For example, I wanted to enter "6-4" instead of "6 + -4". No spaces to worry about. This PR accomplishes that objective. The trade-off is a slight muddling of your clear demo code.
This can be considered a hack, but it didn't seem too egregious and the benefit is nice. Also, a discussion of the fix could be beneficial to new users of ANTLR. Let me know what you think.
There are a few more minor edits to address compilation warnings.