Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Commit

Permalink
Upgrade to tools.reader 1.0.5, fix broken call to read-token (Issue #11)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkinnear committed Oct 9, 2017
1 parent 5fe6eeb commit 0168690
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.228"
:exclusions [org.apache.ant/ant]]
[org.clojure/tools.reader "1.0.0-alpha3"]]
[org.clojure/tools.reader "1.0.5"]]
:doo {:build "test"}
:profiles {:dev
{:plugins [[lein-cljsbuild "1.1.2"]
Expand Down
7 changes: 4 additions & 3 deletions src/rewrite_clj/reader.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[goog.string :as gstring]
[rewrite-clj.node.protocols :as nd]))

(def reader-error reader-types/reader-error)
(def read-char reader-types/read-char)
(def get-column-number reader-types/get-column-number)
(def get-line-number reader-types/get-line-number)
Expand Down Expand Up @@ -179,7 +178,7 @@

(defn read-keyword
[^not-native reader initch]
(let [tok (cljs.tools.reader/read-token reader (read-char reader))
(let [tok (cljs.tools.reader/read-token reader :keyword (read-char reader))
a (re-matches* (re-pattern "^[:]?([^0-9/].*/)?([^0-9/][^/]*)$") tok)
token (aget a 0)
ns (aget a 1)
Expand All @@ -188,7 +187,9 @@
(identical? (. ns (substring (- (.-length ns) 2) (.-length ns))) ":/"))
(identical? (aget name (dec (.-length name))) ":")
(not (== (.indexOf token "::" 1) -1)))
(reader-error reader "Invalid token: " token)
(cljs.tools.reader.impl.errors/reader-error reader
"Invalid token: "
token)
(if (and (not (nil? ns)) (> (.-length ns) 0))
(keyword (.substring ns 0 (.indexOf ns "/")) name)
(keyword (.substring token 1))))))
Expand Down

0 comments on commit 0168690

Please sign in to comment.