Skip to content

Commit 509f34a

Browse files
author
Yannick Scherer
committed
fix handling of symbols with trailing quote. (closes #24)
1 parent c439313 commit 509f34a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/rewrite_clj/parser/token.clj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
(read-to-boundary reader)
1818
""))))
1919

20+
(defn- symbol-node
21+
"Symbols allow for trailing quotes that have to be handled
22+
explicitly."
23+
[reader value value-string]
24+
(if (= (r/peek reader) \')
25+
(let [s (str value-string (r/next reader))]
26+
(node/token-node
27+
(r/string->edn s)
28+
s))
29+
(node/token-node value value-string)))
30+
2031
(defn parse-token
2132
"Parse a single token."
2233
[reader]
@@ -26,4 +37,6 @@
2637
(read-to-boundary reader))
2738
(str first-char))
2839
v (r/string->edn s)]
29-
(node/token-node v s)))
40+
(if (symbol? v)
41+
(symbol-node reader v s)
42+
(node/token-node v s))))

0 commit comments

Comments
 (0)