abacaj / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 gpary...@live.com on 30 Sep 2014 at 7:10