-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Changed regex Prism.languages.javascript.number #63
Conversation
Regex treated var names matching /[a-f]+/ as numbers. Added support for scientific notation (e.g. 1.23e-4). Added support for upper case notation (e.g. 0xBEEF). Small issues remaining: * Leading decimal point is marked up as 'punctuation', instead as part of the number (e.g. .1; 0.1 is matched correctly). Maybe a problem with the tokenizer? * Maybe Prism.languages.clike.number should be changed as well?
Hi there, Thanks for this contribution! It looks like your editor changed the whitespace, causing the diff to be all messed up, which makes it impossible for me to review changes. Could you please fix that? Thanks! Also, it would be great if you ported these changes to the |
@LeaVerou btw, GitHub have a way to see any diff without the changes in whitespaces: you can just add |
Changes: * Variable names matching /[a-f]+/ are no longer treated as numbers. * Added support for upper case and scientific notation. * Also changed corresponding files in /components. Minor issues: * No support for type suffixes (e.g. 300f for float). * Leading decimal point is marked up as 'punctuation', instead as part of * the number (e.g. .1; 0.1 is matched correctly).
This should be merged. It correctly fixes a bug. |
Gah, can't merge this any more. Could you please submit a new one? Sorry :( |
Thanks to @kizu’s suggestion (thanks!) I was able to review this and it looks great. Disregard my previous comment, I will merge this manually. |
Merged, thank you @mseeboeck! |
Regex treated var names matching /[a-f]+/ as numbers.
Added support for scientific notation (e.g. 1.23e-4).
Added support for upper case notation (e.g. 0xBEEF).
Trimmed empty lines (sorry for the mess).
Small issues remaining:
number (e.g. .1; 0.1 is matched correctly). Maybe a problem with the
tokenizer?