leiningen icon indicating copy to clipboard operation
leiningen copied to clipboard

"RuntimeException EOF while reading" when pasting multiple lines

Open farmdawgnation opened this issue 10 years ago • 3 comments

There seems to be an issue introduced in Leiningen recently that breaks the ability to write in multiple lines of things. Take, for example, this example session:

user=> (def elements-that-can-contain-simple-types
  #_=>   #{:xs:attribute

RuntimeException EOF while reading, starting at line 2  clojure.lang.Util.runtimeException (Util.java:221)

The Clojure compiler doesn't throw this error when the file is read, but I'm unable to paste or manually type it in without the repl blowing up on me with the EOF while reading error. A coworker who is running an older version of leiningen, 2.3.2, is not experiencing this issue. I am currently running 2.5.0.

I tried to find other issues describing the same behavior but haven't found one, so it's entirely possible I'm missing something, but it's becoming really obnoxious...

farmdawgnation avatar Dec 04 '14 20:12 farmdawgnation

:xs:attribute is the culprit here. http://clojure.org/reader says that keywords are governed by similar rules to symbols, and the symbol section of that spec includes the text "A symbol can contain one or more non-repeating ':'s.".

So I think this should be fixed. I've opened an issue in sjacket.

trptcolin avatar Dec 04 '14 20:12 trptcolin

Hmm, so maybe my problem is with enlive? I was trying to trim down a minimal test case when I saw this issue.

I get the following error from time to time when using lein repl. I'm able to compile the code and run it from a JAR, and have tested it in Light Table as well.

I've encountered this problem in a couple different areas, but the smallest reproducible instance I've come across is using enlive (1.1.5) as follows:

(def page "<html><body><div class=\"test\"><ul><li id=\"first\"/><li id=\"last\"/></ul></div></body></html>")
(def dom (html/html-resource (java.io.StringReader. page)))
(defn last-elem [dom]
  (if-let [li-last (html/select dom [:div.test :li#last])]
    li-last))

After hitting return on the "if-let" line, I get the following:

RuntimeException EOF while reading, starting at line 1  clojure.lang.Util.runtimeException (Util.java:221)

*e is:

#<ReaderException clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading, starting at line 1>

I don't get the same problem when I run a raw REPL invoking java -cp ... clojure.main, but I haven't gone to the trouble of pulling in all the dependencies yet.

defndaines avatar Dec 13 '14 23:12 defndaines

Thanks. Yeah, similar issue, same root cause, but it's sjacket, not enlive. I've updated cgrand/sjacket#22 with details.

trptcolin avatar Dec 14 '14 00:12 trptcolin