Skip to content

Commit

Permalink
fix handling of symbols with trailing quote. (closes #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick Scherer committed Feb 4, 2015
1 parent c439313 commit 509f34a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/rewrite_clj/parser/token.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
(read-to-boundary reader)
""))))

(defn- symbol-node
"Symbols allow for trailing quotes that have to be handled
explicitly."
[reader value value-string]
(if (= (r/peek reader) \')
(let [s (str value-string (r/next reader))]
(node/token-node
(r/string->edn s)
s))
(node/token-node value value-string)))

(defn parse-token
"Parse a single token."
[reader]
Expand All @@ -26,4 +37,6 @@
(read-to-boundary reader))
(str first-char))
v (r/string->edn s)]
(node/token-node v s)))
(if (symbol? v)
(symbol-node reader v s)
(node/token-node v s))))

0 comments on commit 509f34a

Please sign in to comment.