neilcsmith-net commented on code in PR #9258:
URL: https://github.com/apache/netbeans/pull/9258#discussion_r2918481633
##########
java/java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java:
##########
@@ -1196,7 +1196,9 @@ else if ('0' <= c && c <= '9') { // float literal
next = nextToken();
} while (next != null &&
AFTER_VAR_TOKENS.contains(next.id()));
- varKeyword = next != null && next.id()
== JavaTokenId.IDENTIFIER;
+ varKeyword = next != null
+ && (next.id() ==
JavaTokenId.IDENTIFIER
+ || next.id() ==
JavaTokenId.UNDERSCORE);
}
input.backup(input.readLengthEOF()- len);
Review Comment:
Makes sense (not that I use the JShell support, so hadn't noticed). This
ended up being a minimal fix after a long trawl into the reformatter. I didn't
really look further at the lexer.
I note that your linked commit shows the same issue in
`TreeUtilities::isVarType` and `Reformatter::isVarIdentifier` ?
I wonder if it would make sense or be less problematic to always return a
`var` token type, and then check whether it's valid in circumstances where
that's necessary?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists