-
Notifications
You must be signed in to change notification settings - Fork 55
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 more type related helpers #114
Comments
Issue comments from rewrite-cljc-playground: @lread: @lread: We agreed the existing granularity provided by @borkdude chimed in with examples of what he uses for his custom version of rewrite-clj in clj-kondo: (defn boolean-token? [node]
(boolean? (:value node)))
(defn char-token? [node]
(char? (:value node)))
(defn string-from-token [node]
(when-let [lines (:lines node)]
(str/join "\n" lines)))
(defn number-token? [node]
(number? (:value node)))
(defn symbol-token? [node]
(symbol? (:value node)))
(defn symbol-from-token [node]
(when-let [?sym (:value node)]
(when (symbol? ?sym)
?sym))) And then @borkdude also shared another idea:
(defn tag+ [node] (if (symbol? (:value node)) :symbol) ...)
(case (tag+ node) :symbol ...)
|
I think I like the idea of a |
One idea is to also use |
Directly related: #131 (comment) |
I already wondered where I left that comment, thanks. |
Ha! Yeah, I was searching for it yesterday, oddly enough! |
Draft 0 of hierarchy: tag+ name, example/desc, current tag, node record
Thoughts:
|
Among the "reader-macro" things, here's a fun construct I didn't know about for a long time [1] [2]: #user.Fun[1 2]
#user.Fun{:a 1 :b 2} Haven't seen it very much in the wild (^^; [1] There are even some docs. [2] Here is where I struggled with naming... |
Hi @sogaiu! Thanks so much for sharing! ❤️ I did not know about that syntax, thanks! I'll compare my list above with the elements that tree-sitter-clojure recognizes and look for anything else I might have missed. |
If you see anything missing or amiss in tree-sitter-clojure, please mention! |
Originally raised by me as lread/rewrite-cljc-playground#5
Related to #113 - capturing valuable feedback from @sogaiu so I don't lose it. Need to review and evaluate more type related helpers.
Snippit from @sogaiu
Also: pointer to similar can be found within clj-kondo fork of rewrite-clj.
The text was updated successfully, but these errors were encountered: