Fork me on GitHub
#rewrite-clj
<
2024-06-28
>
lread15:06:15

I stumbled upon some strangeness with character handling.

user=> (require '[rewrite-clj.parser :as p])
user=> (-> "\newline" p/parse-string-all :children)
( )
I would have expected \newline to be stored in a single node. It doesn't have rewriting repercussions because both nodes are written:
user=> (-> "\newline" p/parse-string-all str)
"\newline"
But it would not be great for analysis. Do you remember addressing this in your clj-kondo rewrite-clj fork, @borkdude?

lread15:06:05

Oh stupid me. Forgot that I had to escape in string!

😂 1
duckie 1
lread15:06:38

user=> (-> "\\newline" p/parse-string-all :children)
(<token: \newline>)

lread15:06:56

I would delete the above messages... but I'd rather stay humble and oh so fallible. simple_smile

❤️ 1
teodorlu15:06:42

I celebrate humility and fallibility! 😊 I'd say it works better in practice than the alternatives.

borkdude15:06:51

@lee glad you solved it duckie

❤️ 1