-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Some valid floats are highlighted incorrectly #1378
Comments
Hello. Thanks for reporting! This probably goes wrong in the tmLanguage config. See https://github.com/BetterThanTomorrow/calva/wiki/How-to-Hack-on-Calva#syntax-grammar for how to hack on that. As mentioned on that wiki-page Calva has two grammar definition. tmLanguage, and then a custom one defined in Let me know if the wiki is not helpful enough. |
@PEZ I submitted a PR to https://github.com/atom/language-clojure I don't know if you have any workflow for updating the tmLanguage config in Calva through that repository. |
A PR is welcome. There's no linking back to the atom grammar. We have diverged quite a lot. Also, my last PR to that repo took half a year to get reviewed... |
While working on improved number highlighting for highlight.js, I noticed that there are some valid Clojure numbers that Calva does not correctly highlight.
I don't know how Calva / VS Code does its highlighting, if you could point me towards the right place that would be great.
They are indeed valid Clojure numbers.
Here are some regex form cljs.tools.reader
I have written the following monolithic (JavaScript)-regex for this if you need it:
/[-+]?(((0[xX][0-9a-fA-F]+|0[0-7]+|[1-9][0-9]?[rR][0-9a-zA-Z]+)N?)|[0-9]+(\/[0-9]+|N|((\.[0-9]*)?([eE][+-]?[0-9]+)?M?)))/
I had them split at first, but it wouldn't match them correctly (42 can be matched as an int and as a float with the rules above), I am currently working on this to pull this apart again.
highlightjs/highlight.js@e1fda58#diff-acf0030489ef9b080c066ef3ba1df651db3c94c56b5da44cbf6319b0689559c0R48
This is the full list I tested against:
(GitHub makes even more mistakes, I will submit a PR to them as well.)
The text was updated successfully, but these errors were encountered: