-
-
Notifications
You must be signed in to change notification settings - Fork 247
Make the ns regexp more permissive #350
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
Conversation
@@ -1009,7 +1009,7 @@ nil." | |||
(one-or-more (any whitespace "\n"))) | |||
;; why is this here? oh (in-ns 'foo) or (ns+ :user) | |||
(zero-or-one (any ":'")) | |||
(group (one-or-more (not (any "()\"" whitespace))) word-end))) | |||
(group (one-or-more (not (any "()\"" whitespace))) symbol-end))) |
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.
Not sure how correct our symbol definition is. If memory serves - not very correct. This change definitely requires unit tests illustrating it actually solves something.
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.
Our symbol definition is inherited from elisp so it's at least better than using the word definition. I can't think of any notable differences in clojure's and elisp's notion of what a symbol is.
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.
The problem is that I tried using symbol instead of word semantics when I inherited the mode and everything broke, therefore my reservations... Using symbol semantics is the reasonable thing to do for pretty much everything, but I really think something was fucked up regarding them (don't remember what). I recall lisp-mode
's code was full of word references itself, which was odd.
At any rate - a few unit tests won't hurt.
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.
AFAICT, that regexp should be just (1+ (any symbol word))
. But you're the voice of experience here @bbatsov.
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.
That sounds reasonable. But on a general note @expez is right that there should be fewer word checks and symbols checks, as we're talking about symbols 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.
Yes. I agree too.
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.
Btw, most of this word stuff predates me becoming the maintainer of clojure-mode
. I always wanted to redo it (and unify the regex syntax used in clojure-mode
), but never had the time to do.
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.
AFAICT, that regexp should be just (1+ (any symbol word)).
Correction, what I wrote is not valid rx. It would have to be (1+ (or (syntax word) (syntax symbol)))
ba333d7
to
b61fbc6
Compare
|
b61fbc6
to
f344852
Compare
Actually, I've restored the regexp to my first suggestion, because (group (one-or-more (or (syntax symbol) (syntax word)))) fails on namespaces like this:
|
Ideally, each of those tests would also check that |
Apart from @Malabarba's suggestion - a changelog entry would be nice. No other remarks from me. P.S. We should turn more comments into specs. :-) |
7a277dd
to
01568a3
Compare
Any valid symbol can be used to name an ns. The current regexp would fail to parse symbols ending in certain characters, e.g. `+`. This closes clojure-emacs/cider#1433
01568a3
to
9b7885e
Compare
Aright let's go |
Make the ns regexp more permissive
👍 |
Any valid symbol can be used to name an ns. The current regexp would fail
to parse symbols ending in certain characters, e.g.
+
.This closes clojure-emacs/cider#1433