A complete Clojure reader implemented in Clojure.
Latest stable release: 0.6.2
Leiningen dependency information:
[org.clojure/tools.reader "0.6.2"]Maven dependency information:
<dependency>
<groupId>org.clojure</groupId>
<artifactId>tools.reader</artifactId>
<version>0.6.2</version>
</dependency>(require '[clojure.tools.reader :as t.r])
(def reader (t.r/string-push-back-reader "1"))
(t.r/read-char reader) ;=> \1
(t.r/unread reader \1) ;=> \1
(t.r/read reader) ;=> 1
(t.r/read-string "2") ;=> 2There are small differences from clojure.lang.LispReader:
-
t.r/readthrows anex-infofor almost every exception, whereasclojure.lang.LispReader/readthrows aReaderExceptionwrapping the causing exception. -
t.r/readis capable of reading\xescaped chars -
t.r/readis capable of readingInfinity+Infinity-InfinityandNaNas per #CLJ-1074 -
t.r/readis capable of reading literal tags contaning periods, fixing #CLJ-1100 -
t.r/readchecks ift.r/*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 -
t.r/read-linehas an additional arity with which is possible to specify the reader to read from
- More consistent error handling
- Better documentation
- Port to clojurescript
- Release 0.6.0 on Feb 03, 2013
- Initial release.
- Release 0.6.2 on Feb 04, 2013
- Add line/column metadata on vectors, maps and symbols
Copyright © Nicola Mometto, Rich Hickey & contributors.
Licensed under the EPL. (See the file epl.html.)