This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-09
Channels
- # aws (51)
- # beginners (57)
- # calva (10)
- # chlorine-clover (7)
- # cider (20)
- # clj-kondo (55)
- # clojure (43)
- # clojure-europe (9)
- # clojure-italy (1)
- # clojure-nl (5)
- # clojure-spec (8)
- # clojure-uk (71)
- # clojurescript (33)
- # core-async (22)
- # cursive (20)
- # datomic (3)
- # emacs (8)
- # figwheel-main (8)
- # fulcro (13)
- # garden (2)
- # graalvm (60)
- # graphql (26)
- # jobs (6)
- # joker (6)
- # kaocha (2)
- # lambdaisland (5)
- # malli (36)
- # off-topic (9)
- # portkey (15)
- # re-frame (3)
- # reagent (25)
- # remote-jobs (4)
- # spacemacs (3)
- # sql (111)
- # tree-sitter (29)
- # uncomplicate (3)
- # xtdb (2)
tree-sitter gotcha: although it looks like the rules: { ... }
part of the grammar looks like a js object, order matters for the very first key-value pair. getting this wrong can (will?) cause chaos.
re: ignore markers and tag markers -- conceptually, i've been thinking of them as follows (hopefully correctly, but who knows?). for tags:
#my-outer-tag #my-inner-tag 'a
#my-outer-tag is "waiting" for (the function associated with) #my-inner-tag to have done something with 'a.
alternatively:
#my-outer-tag (#my-inner-tag ('a))
for discards, what i've currently got in the tree-sitter grammar (adapted from Tavistock's) is:
discard_form: $ =>
seq($._discard,
optional($.discard_form),
$._non_discard),
so for:
#_ #_ 1 2
the inner #_
causes the 1 to be ignored, and the outer #_
doesn't see the #_ 1
and ends up ignoring the 2.my guess: #my-inner-tag 'a is "swallowed" by #_ so #my-outer-tag's associated reader function(?) is passed 'b for processing
here is an example:
user=> #uuid #_ #inst "1985-04-12" "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
#uuid "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
Don't try this:
#uuid #_ #uuid "84098d2d-2ed5-4de5-bd4a-c4b967f9e468" #uuid "8ce4afa3-1599-4a98-b642-59eb5e9e83b8"
Which is the same as this, naturally, which never returns either
#uuid #uuid "8ce4afa3-1599-4a98-b642-59eb5e9e83b8"
well, thanks to this discussion, i have more grammar hacking to do...and i thought i was close to finishing 🙂
However, I have my crude, line based, scanner, and you have that sophisticated super tool. 😃
actually, i'm not terribly fond of tree-sitter to be honest for certain tasks -- your scanner can be more flexible.
My scanner can be almost anything I want. Which is nice. However, the line based part of it... I wish I had lots of time so I could get rid of that!
it's pretty amazing that it can do so much even being line based -- i was surprised to be sure
The scanner isn't of my creation, btw. I have modified it a lot so have some right to call it partly mine, but it was Matt Seddon creating it. I think it was the 100th time he created one, so he really knows these things at a level that boggles my mind. He is creating a new one as we speak, for a new LISP that he is creating at the same time. Haha, I guess he just likes to have work.
I am nudging things so that he hopefully will create a non-line-based thing this time. And DFA. Then I plan to bring that into Calva, replacing my current thing.