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
enh(ruby) add support for real, imaginary, and e-notation numbers #2786
Conversation
@@ -128,7 +128,7 @@ export default function(hljs) { | |||
}, | |||
{ | |||
className: 'number', | |||
begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b', | |||
begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?([ri]|[eE][-+]?[0-9_]+i?)?)|[0_]\\b', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please break these out into variants as in the python?
@@ -0,0 +1,3 @@ | |||
number = 1.0e1_2 | |||
number = 1.0e1_2i | |||
number = 1.0r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more tests for 0.
and some other edge cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update (see notes).
Sorry @khamer I think that's accurate and we need to go with #2788 on this one. There are some other low hanging fruit issues if you'd like to find a different issue to contribute to. Not sure if you were jus looking to help out or really wanted to fix this one particular issue. Sorry for any confusion. |
Changes to regex for matching numbers in ruby. Resolves #2766.
Changes
Changes the number regex for ruby to support exponential notation (1e123) as well as adding a trailing
r
ori
- for real or imaginary numbers.Checklist
AUTHORS.txt
under Contributors