I've noticed that clojure.edn
parser will skip rest of the file if it manages to find the first valid token that will complete collection. For example:
;; demo.edn
{
:foo 1
:bar 2 }
:baz 3
}
with:
(require '[clojure.edn :as edn]
'[clojure.java.io :as io])
(with-open [r (io/reader "demo.edn")]
(edn/read (java.io.PushbackReader. r)))
user=> {:foo 1, :bar 2}
It will also ignore rest of the file when the file is clearly malformed:
{
:foo 1
:bar 2 }
xxxx yyyy }}}}} {{{{ ((
:baz 3
it returns again:
user=> {:foo 1, :bar 2}
I was expecting it to throw EOF exception or at least '}' mismatch. Is this behavior by design or a possible bug?