Fix parsing of multiple consecutive underscore in digits #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-underscore-digit-parsing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In Java, having multiple underscores in between digits is valid syntax. e.g.
but it seems that is not being properly highlighted in CodeMirror. This PR attempts to address that by modifying the grammar to permit an arbitrary number of
_in between numbers when parsing digits. Let me know if this looks right.Are you sure this is valid Java? When I try this I get a "SyntaxError: number cannot contain multiple adjacent underscores" error.
yes I believe it's only valid for JDK 8+. Am referencing the docs here. Have a runnable example here: https://replit.com/@SergeiChestakov/undercore-int-example
Ah, seems you are right. Could you change the
*to a+in your change? I am pretty sure Lezer's DFA generation will handle the scary ambiguity of the way you have it now, but it seems needlessly obscure and will cause people used to backtracking regexps to get nervous when they read it.done, thanks!