Skip to content
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

Java code highlighting does not support underscores in numeric literals #353

Open
GoogleCodeExporter opened this issue Feb 20, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Try typing code like `int x = 0b0110_0101;`
2. Prettify the code like normal.
3. See the issue.
(Please include HTML, not just your source code)


What is the expected output?  What do you see instead?

In Java 7, a new feature was added to Java that allows underscores to be placed 
within numeric literals in order to improve the readability of them. However, 
the Java code highlighting in Prettify is not properly treating numeric 
literals with underscores as numeric literals.

Right now, Java numeric literals show up as red to stand out from what 
surrounds it. However, when an underscore is used in such a numeric literal, 
only the part to the left of the first underscore is highlighted as red; the 
rest of the number is just black. Whenever this new feature is used in Prettify 
code, it should be the entire numeric literal that is highlighted, not just the 
first part of it.

What version are you using?  On what browser?

I'm using the Stack Overflow (http://stackoverflow.com/) implementation of 
Prettify, on Internet Explorer 11.

Please provide any additional information below.

Relevant Meta Stack Overflow question: 
http://meta.stackoverflow.com/questions/272508/java-code-highlighting-does-not-s
upport-underscores-in-numeric-literals

Oracle documentation for underscores in literals: 
http://docs.oracle.com/javase/8/docs/technotes/guides/language/underscores-liter
als.html

Original issue reported on code.google.com by [email protected] on 30 Sep 2014 at 7:10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant