Skip to content

(java) Support for Hexadecimal Floating Point Literals #2507

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

Closed
0xflotus opened this issue Apr 24, 2020 · 2 comments · Fixed by #2509
Closed

(java) Support for Hexadecimal Floating Point Literals #2507

0xflotus opened this issue Apr 24, 2020 · 2 comments · Fixed by #2509
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language

Comments

@0xflotus
Copy link
Contributor

0xflotus commented Apr 24, 2020

Describe the issue

Which language seems to have the issue?

According to Oracle Blog Hexadecimal Floating Point Literals are supported in Java.

Are you using highlight or highlightAuto?

highlight

Sample Code to Reproduce

Cases a-h are all legal literals in Java, tested on JShell Version 13.0.2

https://jsfiddle.net/ohqapxnc/

a = 0x4fa6p2; // 81560.0
b = 0x.4p2; // 1.0
c = 0xa.ffp3f; // 87.96875
d = 0x1.0p2F; // 4.0
d2 = 0x1.p2; // 4.0
e = 0x1.0p2f; // 4.0
f = 0x1p1; // 2.0
g = 0x.3p4d; // 3.0
h = 0x1.2ep5D; // 37.75

Expected behavior

I would expect that all legal literals are highlighted as numbers.

@0xflotus 0xflotus added bug help welcome Could use help from community language labels Apr 24, 2020
@joshgoebel joshgoebel added the good first issue Should be easier for first time contributors label Apr 24, 2020
@joshgoebel
Copy link
Member

Tagging beginner friendly as this is probably just finding the correct regex and adding another numeric variant.

@0xflotus
Copy link
Contributor Author

0xflotus commented Apr 24, 2020

Maybe 0[xX](([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)?[\.])?([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)?[pP]([\d]+)[dDfF]? could be a possible regex to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants