diff -Nru tools-reader-clojure-1.2.1/CHANGELOG.md tools-reader-clojure-1.3.4/CHANGELOG.md --- tools-reader-clojure-1.2.1/CHANGELOG.md 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/CHANGELOG.md 2020-11-14 17:39:19.000000000 +0000 @@ -1,7 +1,34 @@ Changelog ======================================== + +* Release 1.3.3 on 9 Aug 2020 + * Fix tagged literals returning non truthy values in EDN reader (#TRDR-62) + * Refer to `cljs.tools.reader` instead of `clojure.tools.reader` in docstrings (#TRDR-56) +* Release 1.3.2 on 26 Oct 2018 + * Fix bad arities for read+string +* Release 1.3.1 on 22 Oct 2018 + * Changes to read+string 2-arity to match new clojure arity (#CLJ-2358) + * Fix buffer overflow when reading files with consecutive carriage returns (#TRDR-54) +* Release 1.3.0 on 5 Jul 2018 + * Fix private var warning in cljs impl +* Release 1.3.0-alpha3 on 25 Feb 2018 + * Improve memory footprint of source-logging-pushback-reader + * Trim output of read+string to match clojure impl + * Workaround for bad read+string 2-arity +* Release 1.3.0-alpha2 on 25 Feb 2018 + * Reduce memory footprint of source-logging-pushback-reader by cleaning up buffer after use + * Exclude read+string from import to remove warning when using clojure 1.9.0 +* Release 1.3.0-alpha1 on 24 Feb 2018 + * Implement read+string + * Attach metadata to all IObjs instead of requiring IMeta +* Release 1.2.2 on 18 Feb 2018 + * Exclude reader-conditional and tagged-literal import to remove warning when using newer versions of clojure +* Release 1.2.1 on 25 Jan 2018 + * Fix potential stack overflow introduced by previous release +* Release 1.2.0 on 25 Jan 2018 + * Fixed wrong recurson point in read, that caused source logging issues * Release 1.1.3.1 on 19 Jan 2017 - * Fix malformed error message for cljs reaer (#TRDR-51) + * Fix malformed error message for cljs reader (#TRDR-51) * Release 1.1.2 on 17 Jan 2017 * Fixed cljs edn reader wrt unicode limits (#TRDR-50) * Release 1.1.1 on 07 Nov 2017 diff -Nru tools-reader-clojure-1.2.1/CONTRIBUTING.md tools-reader-clojure-1.3.4/CONTRIBUTING.md --- tools-reader-clojure-1.2.1/CONTRIBUTING.md 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/CONTRIBUTING.md 2020-11-14 17:39:19.000000000 +0000 @@ -3,12 +3,10 @@ Under the Clojure contrib [guidelines], this project cannot accept pull requests. All patches must be submitted via [JIRA]. -See [Contributing] and the [FAQ] on the Clojure development [wiki] for +See [Contributing] on the Clojure website for more information on how to contribute. -[Clojure contrib]: http://dev.clojure.org/display/doc/Clojure+Contrib -[Contributing]: http://dev.clojure.org/display/community/Contributing -[FAQ]: http://dev.clojure.org/display/community/Contributing+FAQ +[Clojure contrib]: https://clojure.org/community/contrib_libs +[Contributing]: https://clojure.org/community/contributing [JIRA]: http://dev.clojure.org/jira/browse/TRDR -[guidelines]: http://dev.clojure.org/display/community/Guidelines+for+Clojure+Contrib+committers -[wiki]: http://dev.clojure.org/ +[guidelines]: https://clojure.org/community/contrib_howto diff -Nru tools-reader-clojure-1.2.1/debian/changelog tools-reader-clojure-1.3.4/debian/changelog --- tools-reader-clojure-1.2.1/debian/changelog 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/changelog 2020-12-07 22:54:28.000000000 +0000 @@ -1,3 +1,15 @@ +tools-reader-clojure (1.3.4-1) unstable; urgency=medium + + * Team upload. + * New upstream release. + * Build using leiningen. + * d/watch: port to v4 and use git mode. + * d/control: Update to Standards Version 4.5.1. Add Rules-Requires-Root. + * d/control: upgrade to debhelper 13. + * d/tests: add autopkgtests. + + -- Louis-Philippe VĂ©ronneau Mon, 07 Dec 2020 17:54:28 -0500 + tools-reader-clojure (1.2.1-1) unstable; urgency=medium * Team upload. diff -Nru tools-reader-clojure-1.2.1/debian/control tools-reader-clojure-1.3.4/debian/control --- tools-reader-clojure-1.2.1/debian/control 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/control 2020-12-07 22:54:28.000000000 +0000 @@ -5,22 +5,26 @@ Uploaders: Apollon Oikonomopoulos , Build-Depends: - clojure, - debhelper-compat (= 10), + debhelper-compat (= 13), default-jdk, javahelper, - markdown, maven-repo-helper, -Standards-Version: 4.5.0 + libclojure-java, + libnrepl-clojure , + libcomplete-clojure , + leiningen, +Standards-Version: 4.5.1 Homepage: https://github.com/clojure/tools.reader Vcs-Git: https://salsa.debian.org/clojure-team/tools-reader-clojure.git Vcs-Browser: https://salsa.debian.org/clojure-team/tools-reader-clojure +Rules-Requires-Root: no Package: libtools-reader-clojure Architecture: all Depends: ${java:Depends}, ${misc:Depends}, + libclojure-java, Recommends: ${java:Recommends}, Description: complete Clojure and EDN-only reader diff -Nru tools-reader-clojure-1.2.1/debian/libtools-reader-clojure.poms tools-reader-clojure-1.3.4/debian/libtools-reader-clojure.poms --- tools-reader-clojure-1.2.1/debian/libtools-reader-clojure.poms 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/libtools-reader-clojure.poms 2020-12-07 22:54:28.000000000 +0000 @@ -1,28 +1 @@ -# List of POM files for the package -# Format of this file is: -# [option]* -# where option can be: -# --ignore: ignore this POM and its artifact if any -# --ignore-pom: don't install the POM. To use on POM files that are created -# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] -# --no-parent: remove the tag from the POM -# --package=: an alternative package to use when installing this POM -# and its artifact -# --has-package-version: to indicate that the original version of the POM is the same as the upstream part -# of the version for the package. -# --keep-elements=: a list of XML elements to keep in the POM -# during a clean operation with mh_cleanpom or mh_installpom -# --artifact=: path to the build artifact associated with this POM, -# it will be installed when using the command mh_install. [mh_install] -# --java-lib: install the jar into /usr/share/java to comply with Debian -# packaging guidelines -# --usj-name=: name to use when installing the library in /usr/share/java -# --usj-version=: version to use when installing the library in /usr/share/java -# --no-usj-versionless: don't install the versionless link in /usr/share/java -# --dest-jar=: the destination for the real jar. -# It will be installed with mh_install. [mh_install] -# --classifier=: Optional, the classifier for the jar. Empty by default. -# --site-xml=: Optional, the location for site.xml if it needs to be installed. -# Empty by default. [mh_install] -# -pom.xml --no-parent --artifact=*.jar --java-lib +debian/pom.xml --artifact=target/tools.reader.jar --usj-name=tools.reader diff -Nru tools-reader-clojure-1.2.1/debian/maven.cleanIgnoreRules tools-reader-clojure-1.3.4/debian/maven.cleanIgnoreRules --- tools-reader-clojure-1.2.1/debian/maven.cleanIgnoreRules 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/maven.cleanIgnoreRules 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru tools-reader-clojure-1.2.1/debian/maven.ignoreRules tools-reader-clojure-1.3.4/debian/maven.ignoreRules --- tools-reader-clojure-1.2.1/debian/maven.ignoreRules 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/maven.ignoreRules 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru tools-reader-clojure-1.2.1/debian/maven.publishedRules tools-reader-clojure-1.3.4/debian/maven.publishedRules --- tools-reader-clojure-1.2.1/debian/maven.publishedRules 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/maven.publishedRules 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru tools-reader-clojure-1.2.1/debian/maven.rules tools-reader-clojure-1.3.4/debian/maven.rules --- tools-reader-clojure-1.2.1/debian/maven.rules 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/maven.rules 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ - -* clojure * s/([0-9]+)\.([0-9]+).*/$1.$2.x/ * * diff -Nru tools-reader-clojure-1.2.1/debian/patches/0001_Lein_Local.patch tools-reader-clojure-1.3.4/debian/patches/0001_Lein_Local.patch --- tools-reader-clojure-1.2.1/debian/patches/0001_Lein_Local.patch 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/patches/0001_Lein_Local.patch 2020-12-07 22:54:28.000000000 +0000 @@ -0,0 +1,40 @@ +Patch project.clj to build locally with lein. +Index: tools-reader-clojure/project.clj +=================================================================== +--- tools-reader-clojure.orig/project.clj ++++ tools-reader-clojure/project.clj +@@ -1,14 +1,12 @@ +-(defproject org.clojure/tools.reader "1.0.0-SNAPSHOT" ++(defproject org.clojure/tools.reader "1.3.4" + :description "A Clojure reader in Clojure" +- :parent [org.clojure/pom.contrib "0.2.0"] + :url "https://github.com/clojure/tools.reader" + :license {:name "Eclipse Public License" + :url "http://www.eclipse.org/legal/epl-v10.html"} + :source-paths ["src/main/clojure" "src/main/cljs"] + :test-paths ["src/test/clojure"] + :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"} +- :dependencies [[org.clojure/clojure "1.10.0-master-SNAPSHOT"] +- [org.clojure/clojurescript "1.9.946" :scope "provided"]] ++ :dependencies [[org.clojure/clojure "1.10.x"]] + :profiles {:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]} + :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]} + :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} +@@ -18,9 +16,7 @@ + :aliases {"test-all" ["with-profile" "test,1.5:test,1.6:test,1.7:test,1.8:test,1.9:test,1.10" "test"] + "check-all" ["with-profile" "1.5:1.6:1.7:1.8:1.9" "check"]} + :min-lein-version "2.0.0" +- :global-vars {*warn-on-reflection* true +- *unchecked-math* :warn-on-boxed} +- :plugins [[lein-cljsbuild "1.1.4"]] ++ :global-vars {*warn-on-reflection* true} + :cljsbuild + {:builds [{:id "dev" + :source-paths ["src/main/cljs"] +@@ -46,4 +42,5 @@ + :output-dir "target/test/out-advanced"}}] + :test-commands + {"simple" ["node" "target/test/tests-simple.js"] +- "advanced" ["node" "target/test/tests-advanced.js"]}}) ++ "advanced" ["node" "target/test/tests-advanced.js"]}} ++ :local-repo "debian/maven-repo") diff -Nru tools-reader-clojure-1.2.1/debian/patches/series tools-reader-clojure-1.3.4/debian/patches/series --- tools-reader-clojure-1.2.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/patches/series 2020-12-07 22:54:28.000000000 +0000 @@ -0,0 +1 @@ +0001_Lein_Local.patch diff -Nru tools-reader-clojure-1.2.1/debian/pom.xml tools-reader-clojure-1.3.4/debian/pom.xml --- tools-reader-clojure-1.2.1/debian/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/pom.xml 2020-12-07 22:54:28.000000000 +0000 @@ -0,0 +1,103 @@ + + 4.0.0 + org.clojure + tools.reader + jar + 1.3.4 + tools.reader + A Clojure reader in Clojure + https://github.com/clojure/tools.reader + + + Eclipse Public License + http://www.eclipse.org/legal/epl-v10.html + + + + 91cc6a035490aca95a48379ca3010643c0e0f91d + + + src/main/clojure + src/test/clojure + + + resources + + + + + resources + + + target + target/classes + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-source + generate-sources + + add-source + + + + src/main/cljs + + + + + + + + + + central + https://repo1.maven.org/maven2/ + + false + + + true + + + + clojars + https://repo.clojars.org/ + + true + + + true + + + + sonatype-oss-public + https://oss.sonatype.org/content/groups/public/ + + true + + + true + + + + + + + + + org.clojure + clojure + 1.10.x + + + + + diff -Nru tools-reader-clojure-1.2.1/debian/README.source tools-reader-clojure-1.3.4/debian/README.source --- tools-reader-clojure-1.2.1/debian/README.source 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/README.source 2020-12-07 22:54:28.000000000 +0000 @@ -0,0 +1,10 @@ +Since we're patching out piggieback, on new releases we need to generate the +debian/pom.xml file after having applied patches: + + $ quilt push -a + $ lein pom debian/pom.xml + $ quilt pop -a + +We're not running the upstream testsuite as an autopkgtest, as it requires some +files that are not packaged (in src/test). We _could_ package a -test package +and try to include them, but it would mean a lot of patches and a trip via NEW. diff -Nru tools-reader-clojure-1.2.1/debian/rules tools-reader-clojure-1.3.4/debian/rules --- tools-reader-clojure-1.2.1/debian/rules 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/rules 2020-12-07 22:54:28.000000000 +0000 @@ -1,71 +1,30 @@ #!/usr/bin/make -f -include /usr/share/javahelper/java-vars.mk include /usr/share/dpkg/pkg-info.mk +include /usr/share/javahelper/java-vars.mk -MDWN_DOCS = $(patsubst %.md,%.html,$(wildcard $(CURDIR)/*.md)) - -export CLASSPATH=/usr/share/java/clojure.jar - -DEB_PKGNAME := $(shell dpkg-parsechangelog -SSource) -DEB_VERSION := $(shell dpkg-parsechangelog -SVersion) -DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) -DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') -GIT_TAG := $(shell echo '$(DEB_UPSTREAM_VERSION)' | sed -e 's/~/_/') -UPSTREAM_GIT = https://github.com/clojure/tools.reader - -PRODUCED_JAR=tools.reader.jar +export LEIN_HOME=$(CURDIR)/.lein +export LEIN_OFFLINE=true +NAME=tools.reader %: dh $@ --with javahelper --with maven_repo_helper -override_jh_build: $(MDWN_DOCS) - jar cf $(PRODUCED_JAR) -C src/main/clojure . - mkdir -p $(CURDIR)/doc/html && mv $^ $(CURDIR)/doc/html +override_dh_auto_configure: + cd debian && ln -sf /usr/share/maven-repo . -override_dh_auto_test: - dh_auto_test - (cd src/test/clojure && \ - find . -name "test_*.clj" | xargs clojure -cp $(CURDIR)/$(PRODUCED_JAR)) +override_dh_auto_build: + lein jar + # symlink so we don't need a version in debian/*.poms + cd target && ln -sf $(NAME)-$(DEB_VERSION_UPSTREAM).jar $(NAME).jar -override_jh_classpath: - jh_classpath $(PRODUCED_JAR) +override_dh_auto_test: + lein test override_jh_installlibs: - jh_installlibs --upstream-version=$(DEB_VERSION_UPSTREAM) $(PRODUCED_JAR) + jh_installlibs target/$(NAME).jar -override_jh_clean: - jh_clean - rm -f $(CURDIR)/$(PRODUCED_JAR) - rm -rf $(CURDIR)/doc - -get-orig-source: - uscan --download-version $(DEB_VERSION_UPSTREAM) --force-download --rename - -%.html:%.md - @echo '' > $@ - @echo "" >> $@ - @echo "" >> $@ - @echo "$(shell head -n 1 $< | sed 's/^#*\s*//')" >> $@ - @echo "" >> $@ - @echo "" >> $@ - markdown $< >> $@ - @echo "" >> $@ - @echo "" >> $@ - -gen-orig-xz: - git tag -v $(GIT_TAG) || true - if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \ - git archive --prefix=$(DEB_PKGNAME)-$(DEB_UPSTREAM_VERSION)/ $(GIT_TAG) | xz >../$(DEB_PKGNAME)_$(DEB_UPSTREAM_VERSION).orig.tar.xz ; \ - mkdir -p ../build-area ; \ - cp ../$(DEB_PKGNAME)_$(DEB_UPSTREAM_VERSION).orig.tar.xz ../build-area ; \ - fi - -fetch-upstream-remote: -ifeq (,$(findstring https:,$(UPSTREAM_GIT))) - $(error Using insecure proto in UPSTREAM_GIT: $(UPSTREAM_GIT)) -endif - git remote add upstream $(UPSTREAM_GIT) || true - git remote set-url upstream $(UPSTREAM_GIT) - git fetch upstream +override_dh_clean: + rm -f debian/maven-repo + rm -Rf target + dh_clean diff -Nru tools-reader-clojure-1.2.1/debian/tests/build tools-reader-clojure-1.3.4/debian/tests/build --- tools-reader-clojure-1.2.1/debian/tests/build 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/tests/build 2020-12-07 22:54:28.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/sh + +CLASSPATH=/usr/share/java/clojure.jar:/usr/share/java/tools.reader.jar + +clojure -cp $CLASSPATH -e '(use '"'"'clojure.tools.reader)' diff -Nru tools-reader-clojure-1.2.1/debian/tests/control tools-reader-clojure-1.3.4/debian/tests/control --- tools-reader-clojure-1.2.1/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/tests/control 2020-12-07 22:54:28.000000000 +0000 @@ -0,0 +1,3 @@ +Tests: build +Depends: @, clojure +Restrictions: superficial, allow-stderr diff -Nru tools-reader-clojure-1.2.1/debian/watch tools-reader-clojure-1.3.4/debian/watch --- tools-reader-clojure-1.2.1/debian/watch 2020-11-04 21:26:22.000000000 +0000 +++ tools-reader-clojure-1.3.4/debian/watch 2020-12-07 22:54:28.000000000 +0000 @@ -1,3 +1,4 @@ -version=3 -opts="uversionmangle=s/-(alpha|beta)/~$1/" \ - https://github.com/clojure/tools.reader/tags .*\-([\d\.]+(?:-(?:alpha|beta)[0-9]+)?)\.tar\.gz +version=4 +opts="mode=git, uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/" \ +https://github.com/clojure/tools.reader.git \ +refs/tags/tools.reader-([\d\.]+) diff -Nru tools-reader-clojure-1.2.1/LICENSE tools-reader-clojure-1.3.4/LICENSE --- tools-reader-clojure-1.2.1/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ tools-reader-clojure-1.3.4/LICENSE 2020-11-14 17:39:19.000000000 +0000 @@ -0,0 +1,205 @@ +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC +LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM +CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation + distributed under this Agreement, and +b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are + distributed by that particular Contributor. A Contribution 'originates' + from a Contributor if it was added to the Program by such Contributor + itself or anyone acting on such Contributor's behalf. Contributions do not + include additions to the Program which: (i) are separate modules of + software distributed in conjunction with the Program under their own + license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are +necessarily infringed by the use or sale of its Contribution alone or when +combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, +including all Contributors. + +2. GRANT OF RIGHTS + a) Subject to the terms of this Agreement, each Contributor hereby grants + Recipient a non-exclusive, worldwide, royalty-free copyright license to + reproduce, prepare derivative works of, publicly display, publicly + perform, distribute and sublicense the Contribution of such Contributor, + if any, and such derivative works, in source code and object code form. + b) Subject to the terms of this Agreement, each Contributor hereby grants + Recipient a non-exclusive, worldwide, royalty-free patent license under + Licensed Patents to make, use, sell, offer to sell, import and otherwise + transfer the Contribution of such Contributor, if any, in source code and + object code form. This patent license shall apply to the combination of + the Contribution and the Program if, at the time the Contribution is + added by the Contributor, such addition of the Contribution causes such + combination to be covered by the Licensed Patents. The patent license + shall not apply to any other combinations which include the Contribution. + No hardware per se is licensed hereunder. + c) Recipient understands that although each Contributor grants the licenses + to its Contributions set forth herein, no assurances are provided by any + Contributor that the Program does not infringe the patent or other + intellectual property rights of any other entity. Each Contributor + disclaims any liability to Recipient for claims brought by any other + entity based on infringement of intellectual property rights or + otherwise. As a condition to exercising the rights and licenses granted + hereunder, each Recipient hereby assumes sole responsibility to secure + any other intellectual property rights needed, if any. For example, if a + third party patent license is required to allow Recipient to distribute + the Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + d) Each Contributor represents that to its knowledge it has sufficient + copyright rights in its Contribution, if any, to grant the copyright + license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under +its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + b) its license agreement: + i) effectively disclaims on behalf of all Contributors all warranties + and conditions, express and implied, including warranties or + conditions of title and non-infringement, and implied warranties or + conditions of merchantability and fitness for a particular purpose; + ii) effectively excludes on behalf of all Contributors all liability for + damages, including direct, indirect, special, incidental and + consequential damages, such as lost profits; + iii) states that any provisions which differ from this Agreement are + offered by that Contributor alone and not by any other party; and + iv) states that source code for the Program is available from such + Contributor, and informs licensees how to obtain it in a reasonable + manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + b) a copy of this Agreement must be included with each copy of the Program. + Contributors may not remove or alter any copyright notices contained + within the Program. + +Each Contributor must identify itself as the originator of its Contribution, +if +any, in a manner that reasonably allows subsequent Recipients to identify the +originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with +respect to end users, business partners and the like. While this license is +intended to facilitate the commercial use of the Program, the Contributor who +includes the Program in a commercial product offering should do so in a manner +which does not create potential liability for other Contributors. Therefore, +if a Contributor includes the Program in a commercial product offering, such +Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits and +other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such Commercial +Contributor in connection with its distribution of the Program in a commercial +product offering. The obligations in this section do not apply to any claims +or Losses relating to any actual or alleged intellectual property +infringement. In order to qualify, an Indemnified Contributor must: +a) promptly notify the Commercial Contributor in writing of such claim, and +b) allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such claim at +its own expense. + +For example, a Contributor might include the Program in a commercial product +offering, Product X. That Contributor is then a Commercial Contributor. If +that Commercial Contributor then makes performance claims, or offers +warranties related to Product X, those performance claims and warranties are +such Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each +Recipient is solely responsible for determining the appropriateness of using +and distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to the +risks and costs of program errors, compliance with applicable laws, damage to +or loss of data, programs or equipment, and unavailability or interruption of +operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY +CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION +LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of the +remainder of the terms of this Agreement, and without further action by the +parties hereto, such provision shall be reformed to the minimum extent +necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Program itself +(excluding combinations of the Program with other software or hardware) +infringes such Recipient's patent(s), then such Recipient's rights granted +under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to +comply with any of the material terms or conditions of this Agreement and does +not cure such failure in a reasonable period of time after becoming aware of +such noncompliance. If all Recipient's rights under this Agreement terminate, +Recipient agrees to cease use and distribution of the Program as soon as +reasonably practicable. However, Recipient's obligations under this Agreement +and any licenses granted by Recipient relating to the Program shall continue +and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in +order to avoid inconsistency the Agreement is copyrighted and may only be +modified in the following manner. The Agreement Steward reserves the right to +publish new versions (including revisions) of this Agreement from time to +time. No one other than the Agreement Steward has the right to modify this +Agreement. The Eclipse Foundation is the initial Agreement Steward. The +Eclipse Foundation may assign the responsibility to serve as the Agreement +Steward to a suitable separate entity. Each new version of the Agreement will +be given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly +stated in Sections 2(a) and 2(b) above, Recipient receives no rights or +licenses to the intellectual property of any Contributor under this Agreement, +whether expressly, by implication, estoppel or otherwise. All rights in the +Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the +intellectual property laws of the United States of America. No party to this +Agreement will bring a legal action under this Agreement more than one year +after the cause of action arose. Each party waives its rights to a jury trial in +any resulting litigation. + + diff -Nru tools-reader-clojure-1.2.1/pom.xml tools-reader-clojure-1.3.4/pom.xml --- tools-reader-clojure-1.2.1/pom.xml 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/pom.xml 2020-11-14 17:39:19.000000000 +0000 @@ -2,7 +2,7 @@ 4.0.0 tools.reader - 1.2.1 + 1.3.4 tools.reader A Clojure reader in Clojure https://github.com/clojure/tools.reader @@ -127,6 +127,6 @@ scm:git:git://github.com/clojure/tools.reader.git scm:git:git://github.com/clojure/tools.reader.git http://github.com/clojure/tools.reader - tools.reader-1.2.1 + tools.reader-1.3.4 diff -Nru tools-reader-clojure-1.2.1/project.clj tools-reader-clojure-1.3.4/project.clj --- tools-reader-clojure-1.2.1/project.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/project.clj 2020-11-14 17:39:19.000000000 +0000 @@ -7,14 +7,15 @@ :source-paths ["src/main/clojure" "src/main/cljs"] :test-paths ["src/test/clojure"] :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"} - :dependencies [[org.clojure/clojure "1.9.0-master-SNAPSHOT"] + :dependencies [[org.clojure/clojure "1.10.0-master-SNAPSHOT"] [org.clojure/clojurescript "1.9.946" :scope "provided"]] :profiles {:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]} :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]} - :1.9 {:dependencies [[org.clojure/clojure "1.9.0-master-SNAPSHOT"]]}} - :aliases {"test-all" ["with-profile" "test,1.5:test,1.6:test,1.7:test,1.8:test,1.9" "test"] + :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} + :1.10 {:dependencies [[org.clojure/clojure "1.10.0-master-SNAPSHOT"]]}} + :aliases {"test-all" ["with-profile" "test,1.5:test,1.6:test,1.7:test,1.8:test,1.9:test,1.10" "test"] "check-all" ["with-profile" "1.5:1.6:1.7:1.8:1.9" "check"]} :min-lein-version "2.0.0" :global-vars {*warn-on-reflection* true diff -Nru tools-reader-clojure-1.2.1/README.md tools-reader-clojure-1.3.4/README.md --- tools-reader-clojure-1.2.1/README.md 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/README.md 2020-11-14 17:39:19.000000000 +0000 @@ -34,7 +34,7 @@ Releases and Dependency Information ======================================== -Latest stable release: 1.2.0 +Latest stable release: 1.3.3 * [All Released Versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.reader%22) @@ -42,13 +42,13 @@ [clj](https://clojure.org/guides/getting_started) dependency information: ```clojure -org.clojure/tools.reader {:mvn/version "1.2.0"} +org.clojure/tools.reader {:mvn/version "1.3.3"} ``` [Leiningen](https://github.com/technomancy/leiningen) dependency information: ```clojure -[org.clojure/tools.reader "1.2.0"] +[org.clojure/tools.reader "1.3.3"] ``` [Maven](http://maven.apache.org/) dependency information: @@ -56,7 +56,7 @@ org.clojure tools.reader - 1.2.0 + 1.3.3 ``` @@ -66,7 +66,6 @@ API Index ======================================== -* [CrossClj Documentation](http://crossclj.info/doc/org.clojure/tools.reader/lastest/index.html) * [API index](http://clojure.github.io/tools.reader) Developer Information diff -Nru tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader/edn.cljs tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader/edn.cljs --- tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader/edn.cljs 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader/edn.cljs 2020-11-14 17:39:19.000000000 +0000 @@ -15,10 +15,10 @@ [read-char unread peek-char indexing-reader? get-line-number get-column-number get-file-name string-push-back-reader]] [cljs.tools.reader.impl.utils :refer - [char ex-info? whitespace? numeric? desugar-meta namespace-keys second']] + [char ex-info? whitespace? numeric? desugar-meta namespace-keys second' char-code]] [cljs.tools.reader.impl.commons :refer [number-literal? read-past match-number parse-symbol read-comment throwing-reader]] - [cljs.tools.reader :refer [default-data-readers char-code]] + [cljs.tools.reader :refer [default-data-readers]] [goog.string :as gstring]) (:import goog.string.StringBuffer)) @@ -69,9 +69,7 @@ (if-let [ch (read-char rdr)] (if-let [dm (dispatch-macros ch)] (dm rdr ch opts) - (if-let [obj (read-tagged (doto rdr (unread ch)) ch opts)] - obj - (err/throw-no-dispatch rdr ch))) + (read-tagged (doto rdr (unread ch)) ch opts)) (err/throw-eof-at-dispatch rdr))) (defn- read-unmatched-delimiter @@ -385,7 +383,7 @@ Reads data in the edn format (subset of Clojure data): http://edn-format.org - clojure.tools.reader.edn/read doesn't depend on dynamic Vars, all configuration + cljs.tools.reader.edn/read doesn't depend on dynamic Vars, all configuration is done by passing an opt map. opts is a map that can include the following keys: @@ -441,7 +439,7 @@ Reads data in the edn format (subset of Clojure data): http://edn-format.org - opts is a map as per clojure.tools.reader.edn/read" + opts is a map as per cljs.tools.reader.edn/read" ([s] (read-string {:eof nil} s)) ([opts s] (when (and s (not= s "")) diff -Nru tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader/impl/errors.cljs tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader/impl/errors.cljs --- tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader/impl/errors.cljs 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader/impl/errors.cljs 2020-11-14 17:39:19.000000000 +0000 @@ -111,9 +111,6 @@ (defn throw-eof-at-dispatch [rdr] (eof-error rdr "Unexpected EOF while reading dispatch character.")) -(defn throw-bad-dispatch [rdr ch] - (reader-error rdr "No dispatch macro for " ch ".")) - (defn throw-unmatch-delimiter [rdr ch] (reader-error rdr "Unmatched delimiter " ch ".")) @@ -121,9 +118,6 @@ (let [init (case kind :regex "#\"" :string \")] (eof-error rdr "Unexpected EOF reading " (name kind) " starting " (apply str init start) "."))) -(defn throw-no-dispatch [rdr ch] - (throw-bad-dispatch rdr ch)) - (defn throw-invalid-unicode-char[rdr token] (reader-error rdr diff -Nru tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader/impl/utils.cljs tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader/impl/utils.cljs --- tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader/impl/utils.cljs 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader/impl/utils.cljs 2020-11-14 17:39:19.000000000 +0000 @@ -95,3 +95,9 @@ (defn second' [[a b]] (when-not a b)) + +(defn char-code [ch base] + (let [code (js/parseInt ch base)] + (if (js/isNaN code) + -1 + code))) diff -Nru tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader.cljs tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader.cljs --- tools-reader-clojure-1.2.1/src/main/cljs/cljs/tools/reader.cljs 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/cljs/cljs/tools/reader.cljs 2020-11-14 17:39:19.000000000 +0000 @@ -9,7 +9,7 @@ (ns ^{:doc "A clojure reader in clojure" :author "Bronsa"} cljs.tools.reader - (:refer-clojure :exclude [read read-line read-string char + (:refer-clojure :exclude [read read-line read-string char read+string default-data-readers *default-data-reader-fn* *data-readers* *suppress-read*]) (:require-macros [cljs.tools.reader.reader-types :refer [log-source]]) @@ -19,7 +19,7 @@ string-push-back-reader]] [cljs.tools.reader.impl.utils :refer [char ex-info? whitespace? numeric? desugar-meta next-id namespace-keys second' - ReaderConditional reader-conditional reader-conditional?]] + ReaderConditional reader-conditional reader-conditional? char-code]] [cljs.tools.reader.impl.commons :refer [number-literal? read-past match-number parse-symbol read-comment throwing-reader]] [cljs.tools.reader.impl.errors :as err] @@ -99,12 +99,6 @@ (.append sb ch))) (recur (read-char rdr)))))))) -(defn- char-code [ch base] - (let [code (js/parseInt ch base)] - (if (js/isNaN code) - -1 - code))) - (defn- read-unicode-char ([token offset length base] (let [l (+ offset length)] @@ -911,7 +905,7 @@ (defn read "Reads the first object from an IPushbackReader. Returns the object read. If EOF, throws if eof-error? is true. - Otherwise returns sentinel. If no stream is providen, *in* will be used. + Otherwise returns sentinel. If no stream is provided, *in* will be used. Opts is a persistent map with valid keys: :read-cond - :allow to process reader conditionals, or @@ -920,11 +914,11 @@ :eof - on eof, return value unless :eofthrow, then throw. if not specified, will throw - To read data structures only, use clojure.tools.reader.edn/read + To read data structures only, use cljs.tools.reader.edn/read - Note that the function signature of clojure.tools.reader/read and - clojure.tools.reader.edn/read is not the same for eof-handling" - {:arglists '([] [reader] [opts reader] [reader eof-error? eof-value])} + Note that the function signature of cljs.tools.reader/read and + cljs.tools.reader.edn/read is not the same for eof-handling" + {:arglists '([reader] [opts reader] [reader eof-error? eof-value])} ([reader] (read reader true nil)) ([{eof :eof :as opts :or {eof :eofthrow}} reader] (read* reader (= eof :eofthrow) eof nil opts (to-array []))) ([reader eof-error? sentinel] (read* reader eof-error? sentinel nil {} (to-array [])))) @@ -933,12 +927,29 @@ "Reads one object from the string s. Returns nil when s is nil or empty. - To read data structures only, use clojure.tools.reader.edn/read-string + To read data structures only, use cljs.tools.reader.edn/read-string - Note that the function signature of clojure.tools.reader/read-string and - clojure.tools.reader.edn/read-string is not the same for eof-handling" + Note that the function signature of cljs.tools.reader/read-string and + cljs.tools.reader.edn/read-string is not the same for eof-handling" ([s] (read-string {} s)) ([opts s] (when (and s (not (identical? s ""))) (read opts (string-push-back-reader s))))) + +(defn read+string + "Like read, and taking the same args. reader must be a SourceLoggingPushbackReader. + Returns a vector containing the object read and the (whitespace-trimmed) string read." + ([stream] (read+string stream true nil)) + ([stream eof-error? eof-value] + (let [buf (fn [stream] (str (:buffer @(.-frames stream)))) + offset (count (buf stream)) + o (log-source stream (read stream eof-error? eof-value)) + s (.trim (subs (buf stream) offset))] + [o s])) + ([opts stream] + (let [buf (fn [stream] (str (:buffer @(.-frames stream)))) + offset (count (buf stream)) + o (log-source stream (read opts stream)) + s (.trim (subs (buf stream) offset))] + [o s]))) diff -Nru tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/edn.clj tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/edn.clj --- tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/edn.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/edn.clj 2020-11-14 17:39:19.000000000 +0000 @@ -52,14 +52,15 @@ :else (loop [sb (StringBuilder.) - ch (do (unread rdr initch) initch)] + ch initch] (if (or (whitespace? ch) (macro-terminating? ch) (nil? ch)) - (str sb) + (do (unread rdr ch) + (str sb)) (if (not-constituent? ch) (err/throw-bad-char rdr kind ch) - (recur (doto sb (.append (read-char rdr))) (peek-char rdr)))))))) + (recur (doto sb (.append ch)) (read-char rdr)))))))) @@ -70,9 +71,7 @@ (if-let [ch (read-char rdr)] (if-let [dm (dispatch-macros ch)] (dm rdr ch opts) - (if-let [obj (read-tagged (doto rdr (unread ch)) ch opts)] - obj - (err/throw-no-dispatch rdr ch))) + (read-tagged (doto rdr (unread ch)) ch opts)) (err/throw-eof-at-dispatch rdr))) (defn- read-unmatched-delimiter diff -Nru tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/impl/errors.clj tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/impl/errors.clj --- tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/impl/errors.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/impl/errors.clj 2020-11-14 17:39:19.000000000 +0000 @@ -105,9 +105,6 @@ (defn throw-eof-at-dispatch [rdr] (eof-error rdr "Unexpected EOF while reading dispatch character.")) -(defn throw-bad-dispatch [rdr ch] - (reader-error rdr "No dispatch macro for " ch ".")) - (defn throw-unmatch-delimiter [rdr ch] (reader-error rdr "Unmatched delimiter " ch ".")) @@ -115,9 +112,6 @@ (let [init (case kind :regex "#\"" :string \")] (eof-error rdr "Unexpected EOF reading " (name kind) " starting " (apply str init start) "."))) -(defn throw-no-dispatch [rdr ch] - (throw-bad-dispatch rdr ch)) - (defn throw-invalid-unicode-char[rdr token] (throw (illegal-arg-error rdr diff -Nru tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/impl/utils.clj tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/impl/utils.clj --- tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/impl/utils.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/impl/utils.clj 2020-11-14 17:39:19.000000000 +0000 @@ -7,7 +7,7 @@ ;; You must not remove this notice, or any other, from this software. (ns ^:skip-wiki clojure.tools.reader.impl.utils - (:refer-clojure :exclude [char])) + (:refer-clojure :exclude [char reader-conditional tagged-literal])) (defn char [x] (when x diff -Nru tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/reader_types.clj tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/reader_types.clj --- tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader/reader_types.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader/reader_types.clj 2020-11-14 17:39:19.000000000 +0000 @@ -102,23 +102,25 @@ (when (instance? Closeable rdr) (.close ^Closeable rdr)))) -(defn- normalize-newline [rdr ch] - (if (identical? \return ch) - (let [c (peek-char rdr)] - (when (or (identical? \formfeed c) - (identical? \newline c)) - (read-char rdr)) - \newline) - ch)) - (deftype IndexingPushbackReader [rdr ^:unsynchronized-mutable ^long line ^:unsynchronized-mutable ^long column ^:unsynchronized-mutable line-start? ^:unsynchronized-mutable prev - ^:unsynchronized-mutable ^long prev-column file-name] + ^:unsynchronized-mutable ^long prev-column file-name + ^:unsynchronized-mutable normalize?] Reader (read-char [reader] (when-let [ch (read-char rdr)] - (let [ch (normalize-newline rdr ch)] + (let [ch (if normalize? + (do (set! normalize? false) + (if (or (identical? \newline ch) + (identical? \formfeed ch)) + (read-char rdr) + ch)) + ch) + ch (if (identical? \return ch) + (do (set! normalize? true) + \newline) + ch)] (set! prev line-start?) (set! line-start? (newline? ch)) (when line-start? @@ -138,7 +140,23 @@ (set! column prev-column)) (update! column dec)) (set! line-start? prev) - (unread rdr ch)) + ;; This may look a bit convoluted, but it helps in the following + ;; scenario: + ;; + The underlying reader is about to return \return from the + ;; next read-char, and then \newline after that. + ;; + read-char gets \return, sets normalize? to true, returns + ;; \newline instead. + ;; + Caller calls unread on the \newline it just got. If we + ;; unread the \newline to the underlying reader, now it is ready + ;; to return two \newline chars in a row, which will throw off + ;; the tracked line numbers. + (let [ch (if normalize? + (do (set! normalize? false) + (if (identical? \newline ch) + \return + ch)) + ch)] + (unread rdr ch))) IndexingReader (get-line-number [reader] (int line)) @@ -157,7 +175,7 @@ (read-char [rdr] (let [c (.read ^java.io.PushbackReader rdr)] (when (>= c 0) - (normalize-newline rdr (char c))))) + (char c)))) (peek-char [rdr] (when-let [c (read-char rdr)] @@ -245,11 +263,22 @@ (deftype SourceLoggingPushbackReader [rdr ^:unsynchronized-mutable ^long line ^:unsynchronized-mutable ^long column ^:unsynchronized-mutable line-start? ^:unsynchronized-mutable prev - ^:unsynchronized-mutable ^long prev-column file-name source-log-frames] + ^:unsynchronized-mutable ^long prev-column file-name source-log-frames + ^:unsynchronized-mutable normalize?] Reader (read-char [reader] (when-let [ch (read-char rdr)] - (let [ch (normalize-newline rdr ch)] + (let [ch (if normalize? + (do (set! normalize? false) + (if (or (identical? \newline ch) + (identical? \formfeed ch)) + (read-char rdr) + ch)) + ch) + ch (if (identical? \return ch) + (do (set! normalize? true) + \newline) + ch)] (set! prev line-start?) (set! line-start? (newline? ch)) (when line-start? @@ -291,7 +320,7 @@ new-frame (assoc-in @frame [:offset] (.length buffer))] (with-bindings {frame new-frame} (let [ret (f)] - (if (instance? clojure.lang.IMeta ret) + (if (instance? clojure.lang.IObj ret) (merge-meta ret {:source (peek-source-log frame)}) ret))))) @@ -347,7 +376,7 @@ (indexing-push-back-reader s-or-rdr buf-len nil)) ([s-or-rdr buf-len file-name] (IndexingPushbackReader. - (to-pbr s-or-rdr buf-len) 1 1 true nil 0 file-name))) + (to-pbr s-or-rdr buf-len) 1 1 true nil 0 file-name false))) (defn ^Closeable source-logging-push-back-reader "Creates a SourceLoggingPushbackReader from a given string or PushbackReader" @@ -366,7 +395,8 @@ file-name (doto (make-var) (alter-var-root (constantly {:buffer (StringBuilder.) - :offset 0})))))) + :offset 0}))) + false))) (defn read-line "Reads a line from the reader or from *in* if no reader is specified" diff -Nru tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader.clj tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader.clj --- tools-reader-clojure-1.2.1/src/main/clojure/clojure/tools/reader.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/main/clojure/clojure/tools/reader.clj 2020-11-14 17:39:19.000000000 +0000 @@ -9,11 +9,11 @@ (ns ^{:doc "A clojure reader in clojure" :author "Bronsa"} clojure.tools.reader - (:refer-clojure :exclude [read read-line read-string char + (:refer-clojure :exclude [read read-line read-string char read+string default-data-readers *default-data-reader-fn* *read-eval* *data-readers* *suppress-read*]) (:require [clojure.tools.reader.reader-types :refer - [read-char unread peek-char indexing-reader? + [read-char unread peek-char indexing-reader? source-logging-push-back-reader source-logging-reader? get-line-number get-column-number get-file-name string-push-back-reader log-source]] [clojure.tools.reader.impl.utils :refer :all] ;; [char ex-info? whitespace? numeric? desugar-meta] [clojure.tools.reader.impl.errors :as err] @@ -22,8 +22,10 @@ (:import (clojure.lang PersistentHashSet IMeta RT Symbol Reflector Var IObj PersistentVector IRecord Namespace) + clojure.tools.reader.reader_types.SourceLoggingPushbackReader java.lang.reflect.Constructor - (java.util regex.Pattern List LinkedList))) + java.util.regex.Pattern + (java.util List LinkedList))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; helpers @@ -68,7 +70,7 @@ (if-let [ch (read-char rdr)] (if-let [dm (dispatch-macros ch)] (dm rdr ch opts pending-forms) - (read-tagged (doto rdr (unread ch)) ch opts pending-forms)) ;; ctor reader is implemented as a tagged literal + (read-tagged (doto rdr (unread ch)) ch opts pending-forms)) ;; ctor reader is implemented as a taggedx literal (err/throw-eof-at-dispatch rdr))) (defn- read-unmatched-delimiter @@ -919,10 +921,9 @@ (nil? ch) (if eof-error? (err/throw-eof-error reader nil) sentinel) (= ch return-on) READ_FINISHED (number-literal? reader ch) (read-number reader ch) - :else (let [f (macros ch)] - (if f - (f reader ch opts pending-forms) - (read-symbol reader ch)))))))] + :else (if-let [f (macros ch)] + (f reader ch opts pending-forms) + (read-symbol reader ch))))))] (if (identical? ret reader) (recur) ret))) @@ -970,8 +971,16 @@ {:arglists '([] [reader] [opts reader] [reader eof-error? eof-value])} ([] (read *in* true nil)) ([reader] (read reader true nil)) - ([{eof :eof :as opts :or {eof :eofthrow}} reader] (read* reader (= eof :eofthrow) eof nil opts (LinkedList.))) - ([reader eof-error? sentinel] (read* reader eof-error? sentinel nil {} (LinkedList.)))) + ([{eof :eof :as opts :or {eof :eofthrow}} reader] + (when (source-logging-reader? reader) + (let [^StringBuilder buf (:buffer @(.source-log-frames ^SourceLoggingPushbackReader reader))] + (.setLength buf 0))) + (read* reader (= eof :eofthrow) eof nil opts (LinkedList.))) + ([reader eof-error? sentinel] + (when (source-logging-reader? reader) + (let [^StringBuilder buf (:buffer @(.source-log-frames ^SourceLoggingPushbackReader reader))] + (.setLength buf 0))) + (read* reader eof-error? sentinel nil {} (LinkedList.)))) (defn read-string "Reads one object from the string s. @@ -996,3 +1005,17 @@ [form] (binding [gensym-env {}] (syntax-quote* form))) + +(defn read+string + "Like read, and taking the same args. reader must be a SourceLoggingPushbackReader. + Returns a vector containing the object read and the (whitespace-trimmed) string read." + ([] (read+string (source-logging-push-back-reader *in*))) + ([stream] (read+string stream true nil)) + ([^SourceLoggingPushbackReader stream eof-error? eof-value] + (let [o (log-source stream (read stream eof-error? eof-value)) + s (.trim (str (:buffer @(.source-log-frames stream))))] + [o s])) + ([opts ^SourceLoggingPushbackReader stream] + (let [o (log-source stream (read opts stream)) + s (.trim (str (:buffer @(.source-log-frames stream))))] + [o s]))) diff -Nru tools-reader-clojure-1.2.1/src/test/clojure/clojure/tools/metadata_test.clj tools-reader-clojure-1.3.4/src/test/clojure/clojure/tools/metadata_test.clj --- tools-reader-clojure-1.2.1/src/test/clojure/clojure/tools/metadata_test.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/test/clojure/clojure/tools/metadata_test.clj 2020-11-14 17:39:19.000000000 +0000 @@ -6,7 +6,7 @@ [clojure.string :as str] [clojure.walk :as walk]) (:import java.nio.charset.Charset - (java.io StringReader) + (java.io StringReader BufferedReader) clojure.lang.LineNumberingPushbackReader)) (defn compare-forms-with-meta [expected-form actual-form] @@ -28,9 +28,12 @@ (defn test-reader "Return a fresh byte array input stream reading off test-bytes" - [] + [test-contents] (StringReader. test-contents)) +(defn replace-newlines [s replacement] + (str/replace s "\n" replacement)) + (def expected-haiku-ns (with-meta '(^{:line 1 :column 2 :end-line 1 :end-column 4 :file "haiku.clj"} ns ^{:line 1 :column 5 :end-line 1 :end-column 31 :file "haiku.clj"} clojure.tools.reader.haiku) @@ -56,15 +59,29 @@ {:line 8 :column 5 :end-line 10 :end-column 32 :file "haiku.clj"})) {:line 3 :column 1 :end-line 10 :end-column 33 :file "haiku.clj"})) -(deftest read-metadata - (let [reader (-> (test-reader) - (LineNumberingPushbackReader.) - (reader-types/indexing-push-back-reader 1 "haiku.clj")) - first-form (read reader) - second-form (read reader)] +(defn multiple-reader-variants-from-string [s filename] + [(-> (test-reader s) + (LineNumberingPushbackReader.) + (reader-types/indexing-push-back-reader 1 filename)) + (-> (test-reader s) + (BufferedReader.) + (reader-types/indexing-push-back-reader 1 filename))]) + +(defn read-metadata-helper [reader] + (let [first-form (read reader) + second-form (read reader) + third-form (read reader false :eof)] (is (= {:line 1 :column 1 :end-line 1 :end-column 32 :file "haiku.clj"} (meta first-form))) (compare-forms-with-meta expected-haiku-ns first-form) - (compare-forms-with-meta expected-haiku-defn second-form))) + (compare-forms-with-meta expected-haiku-defn second-form) + (is (= :eof third-form)))) + +(deftest read-metadata + (doseq [s [test-contents + (replace-newlines test-contents "\r") + (replace-newlines test-contents "\r\n")] + rdr (multiple-reader-variants-from-string s "haiku.clj")] + (read-metadata-helper rdr))) (def expected-haiku-ns-with-source (with-meta '(^{:line 1 :column 2 :end-line 1 :end-column 4 :source "ns" :file "haiku.clj"} ns @@ -101,8 +118,8 @@ ^{:last last-five} [1 2 3]) first-five middle-seven))" :file "haiku.clj"})) -(deftest read-metadata-with-source - (let [reader (-> (test-reader) +(defn read-metadata-with-source-helper [rdr] + (let [reader (-> rdr (LineNumberingPushbackReader.) (reader-types/source-logging-push-back-reader 1 "haiku.clj")) first-form (read reader) @@ -111,6 +128,12 @@ (compare-forms-with-meta expected-haiku-ns-with-source first-form) (compare-forms-with-meta expected-haiku-defn-with-source second-form))) +(deftest read-metadata-with-source + (doseq [s [test-contents + (replace-newlines test-contents "\r") + (replace-newlines test-contents "\r\n")]] + (read-metadata-with-source-helper (test-reader s)))) + (def test2-contents (str/join "\n" @@ -157,3 +180,23 @@ (reader-types/indexing-push-back-reader 1 "vector.clj")) first-form (read reader)] (compare-forms-with-meta expected-vector first-form))) + +(defn test-string [n linesep] + (apply str (concat ["a "] (repeat n linesep) [" b"]))) + +(deftest many-consecutive-lineseps + ;; With older versions of tools.reader, consecutive-lineseps of + ;; 10,000, linesep "\r", and one of the variants of reader, would + ;; cause a StackOverflowError exception. + (doseq [consecutive-lineseps [1 10 10000] + linesep ["\n" "\r" "\r\n"] + reader (multiple-reader-variants-from-string + (test-string consecutive-lineseps linesep) "foo.clj")] + (let [first-form (read reader) + second-form (read reader) + third-form (read reader false :eof)] + (is (= {:line 1 :column 1 :end-line 1 :end-column 2 :file "foo.clj"} (meta first-form))) + (is (= {:line (inc consecutive-lineseps) :column 2 + :end-line (inc consecutive-lineseps) :end-column 3 :file "foo.clj"} + (meta second-form))) + (is (= :eof third-form))))) diff -Nru tools-reader-clojure-1.2.1/src/test/clojure/clojure/tools/reader_edn_test.clj tools-reader-clojure-1.3.4/src/test/clojure/clojure/tools/reader_edn_test.clj --- tools-reader-clojure-1.2.1/src/test/clojure/clojure/tools/reader_edn_test.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/test/clojure/clojure/tools/reader_edn_test.clj 2020-11-14 17:39:19.000000000 +0000 @@ -1,7 +1,7 @@ (ns clojure.tools.reader-edn-test (:refer-clojure :exclude [read-string]) - (:use [clojure.tools.reader.edn :only [read-string]] - [clojure.test :only [deftest is]]) + (:use [clojure.tools.reader.edn :as edn :only [read-string]] + [clojure.test :only [deftest is testing]]) (:import clojure.lang.BigInt)) (load "common_tests") @@ -32,3 +32,7 @@ (let [my-unknown (fn [tag val] {:unknown-tag tag :value val})] (is (= {:unknown-tag 'foo :value 'bar} (read-string {:default my-unknown} "#foo bar"))))) + +(deftest pushback-reader-test + (testing "TRDR-63" + (is (= '(+) (edn/read (java.io.PushbackReader. (java.io.StringReader. "(+)"))))))) diff -Nru tools-reader-clojure-1.2.1/src/test/clojure/clojure/tools/reader_test.clj tools-reader-clojure-1.3.4/src/test/clojure/clojure/tools/reader_test.clj --- tools-reader-clojure-1.2.1/src/test/clojure/clojure/tools/reader_test.clj 2018-01-25 19:42:14.000000000 +0000 +++ tools-reader-clojure-1.3.4/src/test/clojure/clojure/tools/reader_test.clj 2020-11-14 17:39:19.000000000 +0000 @@ -1,10 +1,14 @@ (ns clojure.tools.reader-test (:refer-clojure :exclude [read read-string *default-data-reader-fn* *data-readers*]) (:use [clojure.tools.reader :only [read read-string *default-data-reader-fn* *data-readers*]] - [clojure.tools.reader.reader-types :only [string-push-back-reader]] + [clojure.tools.reader.reader-types :only [string-push-back-reader + indexing-push-back-reader]] [clojure.test :only [deftest is are testing]] [clojure.tools.reader.impl.utils :exclude [char]]) - (:import clojure.lang.BigInt)) + (:require [clojure.tools.reader.edn :as tre]) + (:import clojure.lang.BigInt + (java.io StringReader BufferedReader) + clojure.lang.LineNumberingPushbackReader)) (load "common_tests") @@ -177,3 +181,21 @@ (is (= {::foo 1 :bar 2} (read-string "#::{:foo 1 :_/bar 2}"))) (is (= {:a/foo 1 :bar 2} (read-string "#:a{:foo 1 :_/bar 2}"))) (is (= {:clojure.core/foo 2} (read-string "#::c.c{:foo 2}"))))) + +(defn multiple-reader-variants-from-string [s filename] + [(-> (StringReader. s) + (LineNumberingPushbackReader.) + (indexing-push-back-reader 1 filename)) + (-> (StringReader. s) + (BufferedReader.) + (indexing-push-back-reader 1 filename))]) + +(defn first-reads-from-multiple-readers [s] + (for [rdr (multiple-reader-variants-from-string s "file.edn")] + (tre/read rdr))) + +(deftest trdr-54 + (let [read-vals (mapcat first-reads-from-multiple-readers + ["[a\rb]" "[a\r b]" "[a \rb]"])] + (doseq [pairs (partition 2 1 read-vals)] + (is (= (first pairs) (second pairs))))))