Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing project.clj eval error #763

Closed
brandonstubbs opened this issue Aug 21, 2020 · 3 comments
Closed

Parsing project.clj eval error #763

brandonstubbs opened this issue Aug 21, 2020 · 3 comments

Comments

@brandonstubbs
Copy link
Contributor

Hi

I am working on some OSS projects that are a mono-repo and the version is shared into the microservices. Below is an example project.clj

(defn ver [] "1.10.1") ; originally (defn ver [] (-> "../ver/project.version" slurp .trim)))
(defproject error "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure #=(ver)]]
  :repl-options {:init-ns error.core})

You won't be able to jack-in as the cljs.tools.reader library does not support read-eval
So you will get Error: read-eval not supported while trying to parse-forms

I propose to change the following parse.cljs#L36 to (let [pbr (rt/string-push-back-reader (str/replace s #"#=\(" "#_("))] ultimately ignoring the eval.

Please let me know if you are happy with this approach and I will open a PR for this change.

@bpringe
Copy link
Member

bpringe commented Aug 21, 2020

If this works for you it seems fine to change, but I don't know what other implications there could be (if it would affect parsing negatively in any scenarios, but likely not). I'll defer to @PEZ to decide.

@brandonstubbs
Copy link
Contributor Author

@PEZ Please let me know your thoughts on the above thanks 😄

@PEZ
Copy link
Collaborator

PEZ commented Aug 23, 2020

Yes, sorry for late response. This is pragmatic. It will work and will not break anything.

We should parse these files using the token cursor, but for now, this change is super.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants