Due to the use of clojure's reader in zetta.parser.seq/number.
Clojure's reader interprets a sequence of digits with leading 0s as base 8, e.g. (parse-number "010") => 8 , (parse-number "08") => nil and (parse-number "07") => 7.
(parse-number "010") => 8
(parse-number "08") => nil
(parse-number "07") => 7
307 (let [m (.getDeclaredMethod clojure.lang.LispReader
309 (into-array [String]))]
310 (.setAccessible m true)
311 (defn- read-number [s]
312 (.invoke m clojure.lang.LispReader (into-array [s]))))
Roman: instead of using LispReader as kjw pointed out, how about using Java's BigInteger constructor, and convert it to appropriate Clojure data type?
(defn- read-number [x]
(let [big-int (BigInteger. x)]
(if (< big-int Long/MAX_VALUE)
and also we should provide the previous zetta.parser.seq/number as another name, like zetta.parser.seq/number-clojure
note that Roman, the author of zetta-parser, is busy in May so let's just wait until the end of month :)
Problem with using BigInteger. is it doesn't read rationals. Would be nice to keep that functionality (though there's probably a case for having separate integer and number parsers).