{"id":32179190,"url":"https://github.com/uswitch/tools.reader","last_synced_at":"2025-10-21T21:03:35.975Z","repository":{"id":31716235,"uuid":"35282042","full_name":"uswitch/tools.reader","owner":"uswitch","description":"Clojure reader in Clojure","archived":true,"fork":true,"pushed_at":"2015-06-09T08:44:04.000Z","size":1122,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-09-20T19:23:24.040Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"clojure/tools.reader","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uswitch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-08T13:53:16.000Z","updated_at":"2025-02-11T13:33:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/uswitch/tools.reader","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/uswitch/tools.reader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Ftools.reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Ftools.reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Ftools.reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Ftools.reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uswitch","download_url":"https://codeload.github.com/uswitch/tools.reader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Ftools.reader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280333505,"owners_count":26312845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-21T21:01:14.857Z","updated_at":"2025-10-21T21:03:35.967Z","avatar_url":"https://github.com/uswitch.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"clojure.tools.reader\n========================================\n\nA complete Clojure reader and an EDN-only reader, works with Clojure versions \u003e= 1.4.0\n\n* [Rationale](#rationale)\n* [Releases and Dependency Information](#releases-and-dependency-information)\n* [Changelog](#changelog)\n* [API Index](#api-index)\n* [Developer Information](#developer-information)\n* [Example Usage](#example-usage)\n* [Differences from LispReader.java](#differences-from-lispreaderjava)\n* [License](#license)\n\nRationale\n========================================\n\nclojure.tools.reader offers all functionality of the reader from clojure-1.7.0, and more.\n\nFor a list of additional features of the reader, read [Differences from LispReader.java](#differences-from-lispreaderjava)\n\nMoreover, by using reader types from `clojure.tools.reader.reader-types`, if using an IndexingReader, column info is available and both line and column metadata is attached not only to lists, but to symbols, vectors and maps too, when additional debugging info is needed (note that the edn reader doesn't add any line/column metadata at all).\n\n\nYourKit\n========================================\nYourKit has given an open source license for their profiler, greatly simplifying the profiling of tools.reader performance.\n\nYourKit is kindly supporting open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products:\n\n* \u003ca href=\"http://www.yourkit.com/java/profiler/index.jsp\"\u003eYourKit Java Profiler\u003c/a\u003e and\n* \u003ca href=\"http://www.yourkit.com/.net/profiler/index.jsp\"\u003eYourKit .NET Profiler\u003c/a\u003e.\n\nReleases and Dependency Information\n========================================\n\nLatest stable release: 0.9.2\n\n* [All Released Versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.reader%22)\n\n* [Development Snapshot Versions](https://oss.sonatype.org/index.html#nexus-search;gav%7Eorg.clojure%7Etools.reader%7E%7E%7E)\n\n[Leiningen](https://github.com/technomancy/leiningen) dependency information:\n\n```clojure\n[org.clojure/tools.reader \"0.9.2\"]\n```\n[Maven](http://maven.apache.org/) dependency information:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.clojure\u003c/groupId\u003e\n  \u003cartifactId\u003etools.reader\u003c/artifactId\u003e\n  \u003cversion\u003e0.9.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n[Changelog](CHANGELOG.md)\n========================================\n\nAPI Index\n========================================\n\n* [CrossClj Documentation](http://crossclj.info/doc/org.clojure/tools.reader/lastest/index.html)\n* [API index](http://clojure.github.io/tools.reader)\n\nDeveloper Information\n========================================\n\n* [GitHub project](https://github.com/clojure/tools.reader)\n\n* [Bug Tracker](http://dev.clojure.org/jira/browse/TRDR)\n\n* [Continuous Integration](http://build.clojure.org/job/tools.reader/)\n\n* [Compatibility Test Matrix](http://build.clojure.org/job/tools.reader-test-matrix/)\n\nExample Usage\n========================================\n\nTo read data structures, functions from `clojure.tools.reader.edn` should be used, since those are **safe** and don't allow any code execution at all.\n\nRemember that when using `read` you *need* to use a reader that implements `IPushbackReader` such as `string-push-back-reader`.\n\nNote that since no code-execution is permitted, reader literals are also disabled.\n\n```clojure\n(require '[clojure.tools.reader.edn :as edn])\n;=\u003e nil\n(edn/read-string \"1\")\n;=\u003e 1\n(edn/read-string \"#inst \\\"2010-11-12T13:14:15.666\\\"\")\n;=\u003e #inst \"2010-11-12T13:14:15.666-00:00\"\n(let [my-unknown (fn [tag val] {:unknown-tag tag :value val})]\n   (edn/read-string {:default my-unknown} \"#foo bar\"))\n;=\u003e {:unknown-tag foo, :value bar}\n(edn/read-string {:readers {'foo (constantly 1)}} \"#foo bar\")\n;=\u003e 1\n```\n\nTo switch from using `clojure.core/read-string` to `clojure.tools.reader.edn/read-string` in your projects, put this in your namespace declaration:\n```clojure\n(:refer-clojure :exclude [read read-string])\n(:use [clojure.tools.reader.edn :only [read read-string]])\n```\n\nIf (and only if) reading from a **trusted** source, and advanced features that need some level of code-execution during read are needed, functions from `clojure.tools.reader` should be used.\n```clojure\n(require '[clojure.tools.reader :as r])\n;=\u003e nil\n(r/read-string \"1\")\n;=\u003e 1\n;; WARNING!\n(r/read-string \"#=(+ 1 2)\")\n;=\u003e 3\n(binding [r/*read-eval* false]\n  (r/read-string \"#=(+ 1 2)\"))\n=\u003e ExceptionInfo #= not allowed when *read-eval* is false\n```\n\nTo switch from using `clojure.core/read-string` to `clojure.tools.reader/read-string` in your projects, put this in your namespace declaration:\n```clojure\n(:refer-clojure :exclude [read read-string *default-data-reader-fn* *read-eval* *data-readers*])\n(:use [clojure.tools.reader :only [read read-string *default-data-reader-fn* *read-eval* *data-readers*]])\n```\n\nReader types example usage:\n\n```clojure\n(require '[clojure.tools.reader.reader-types :as t])\n;=\u003e nil\n(def reader (t/string-push-back-reader \"1\"))\n;=\u003e #'user/reader\n(t/read-char reader)\n;=\u003e \\1\n(t/unread reader \\a)\n;=\u003e \\a\n(t/peek-char reader)\n;=\u003e \\a\n(t/read-char reader)\n;=\u003e \\a\n(t/read-char reader)\n;=\u003e nil\n```\nNote that the pushback buffer is of dimension 1 by default, and an exception will be thrown if trying to\nunread more chars than the pushback buffer dimension.\n\nEvery predefined reader type has an additional arity that allows to specify the pushback buffer dimension.\n\n```clojure\n(def reader (t/string-push-back-reader \"\" 2))\n;=\u003e nil\n(t/unread reader \\a)\n;=\u003e \\a\n(t/unread reader \\b)\n;=\u003e \\b\n(t/read-char reader)\n;=\u003e \\b\n(t/read-char reader)\n;=\u003e \\a\n(t/read-char reader)\n;=\u003e nil\n```\n\nDifferences from LispReader.java\n========================================\n\nThere are small differences from clojure.lang.LispReader:\n\n* `read` throws an `ex-info` for almost every exception, whereas `clojure.lang.LispReader/read` throws a `ReaderException` wrapping the causing exception.\n* `read` is capable of reading `Infinity` `+Infinity` `-Infinity` and `NaN` as per [#CLJ-1074](http://dev.clojure.org/jira/browse/CLJ-1074)\n* `read` is capable of reading literal tags containing periods, fixing [#CLJ-1100](http://dev.clojure.org/jira/browse/CLJ-1100)\n* `clojure.tools.reader/read` checks if `clojure.tools.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\n* `clojure.tools.reader/read` adds additional line/column info to symbols, vectors and maps when possible\n* `clojure.tools.reader.reader-types/read-line` has an additional arity with which is possible to specify the reader to read from\n\n## License\n\nCopyright © 2013-2015 Nicola Mometto, Rich Hickey \u0026 contributors.\n\nLicensed under the EPL. (See the file epl.html.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuswitch%2Ftools.reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuswitch%2Ftools.reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuswitch%2Ftools.reader/lists"}