-
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
Add Clojure #1311
Add Clojure #1311
Conversation
Moved the thread-first macro (->) further up the group capture in order to have it properly highlight...
I would like to rename the `boolean` group to something else as I don't believe it is accurate now that `nil` is there.
Forgot to compile with gulp in the last commit. my bad.
cc @Golmote wondering if you could review this please? :) |
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.
@tkjone Hi! Thanks for taking care of this. I added just a few comments. We're almost there!
components/prism-clojure.js
Outdated
Prism.languages.clojure = { | ||
comment: /;+.*/, | ||
string: /"(?:\\.|[^\\"\r\n])*"/, | ||
operator: /(::|[:|'])\b[a-zA-Z][a-zA-Z0-9*+!-_?]*\b/g, //used for symbols and keywords |
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.
Can you make the group non-capturing here? And also remove the g
flag. You could add the i
flag to shorten the regexp a bit, and use \w
in the second character class. Finally, I think the last -
is supposed to be escaped (or moved at the end).
The whole pattern could be something like:
/(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i
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.
Resolved
@@ -0,0 +1,13 @@ | |||
false | |||
true | |||
|
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.
Could you add a test for nil
here? Since it's handled in the boolean
pattern.
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.
Resolved
(let) | ||
(var) | ||
(fn) | ||
|
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.
Ideally, we should add checks for each and every keyword here.
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.
I added about 70 new keywords here - a lot of the ones that were posing issues when I was testing e.g. <=
and >=
. I am happy to fill out the rest, but I have a high degree of confidence that the ones I did not include will pass 😉
|
||
[ | ||
["punctuation", "("], | ||
["keyword", "def"], |
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.
Could you indent those lines with a tab, please?
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.
Finished 😌
@Golmote Thanks for the review! Let me know what you think 💪 |
@tkjone Yay! LGTM! |
Closes #1147
Implements the updates requested in #1214 and adds syntax highlighting for:
Regarding the updates, you will notice that each of my commits addresses the comments made by @Golmote in #1214. Further, each commit should be in the order of the requested fixes. I apologize for not piggybacking directly off the other PR.
Let me know if there is anything else I can improve upon.