diff --git a/README.md b/README.md index 0821d7d..2e227f3 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ There are small differences from clojure's LispReader.java: `blind.reader/read` is capable of reading literal tags contaning periods, fixing #CLJ-1100 +`blind.reader/read` checks if `blind.reader/*alias-map*` is bound, if that's the case, aliases will be resolved by querying it (must be a map), otherwhise (ns-aliases *ns*) will be used + `blind.reader/read-line` has an additional arity with which is possible to specify the reader to read from ## License diff --git a/src/blind/reader.clj b/src/blind/reader.clj index 5813f7a..cf5678a 100644 --- a/src/blind/reader.clj +++ b/src/blind/reader.clj @@ -505,8 +505,10 @@ (symbol (p 0) (p 1))) (reader-error rdr "Invalid token: " token))))) +(def ^:dynamic *alias-map* nil) (defn- resolve-ns [sym] - (or ((ns-aliases *ns*) sym) + (or ((or *alias-map* + (ns-aliases *ns*)) sym) (find-ns sym))) (defn read-keyword