Skip to content

Commit 383156b

Browse files
committed
use builtins for parsing
1 parent d2cb0f2 commit 383156b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/stencil/infix.clj

+1-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676
(when (contains? digits (first characters))
7777
(let [content (string (take-while (set "1234567890._")) characters)
7878
content (.replaceAll content "_" "")
79-
number (if (some #{\.} content)
80-
(Double/parseDouble content)
81-
(Long/parseLong content))]
79+
number (if (some #{\.} content) (parse-double content) (parse-long content))]
8280
[number (drop (count content) characters)])))
8381

8482
(defn- read-ops2 [chars]

version.bb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
(when-let [[[_ major minor patch modifier]]
55
(seq (re-seq #"(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?"
66
version))]
7-
{:major (Long/parseLong major)
8-
:minor (Long/parseLong minor)
9-
:patch (Long/parseLong patch)
7+
{:major (parse-long major)
8+
:minor (parse-long minor)
9+
:patch (parse-long patch)
1010
:modifier (case modifier
1111
"-SNAPSHOT" modifier-snapshot
1212
nil nil)}))

0 commit comments

Comments
 (0)