Skip to content

Commit

Permalink
use builtins for parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
erdos committed Nov 19, 2023
1 parent d2cb0f2 commit 383156b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/stencil/infix.clj
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
(when (contains? digits (first characters))
(let [content (string (take-while (set "1234567890._")) characters)
content (.replaceAll content "_" "")
number (if (some #{\.} content)
(Double/parseDouble content)
(Long/parseLong content))]
number (if (some #{\.} content) (parse-double content) (parse-long content))]
[number (drop (count content) characters)])))

(defn- read-ops2 [chars]
Expand Down
6 changes: 3 additions & 3 deletions version.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
(when-let [[[_ major minor patch modifier]]
(seq (re-seq #"(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?"
version))]
{:major (Long/parseLong major)
:minor (Long/parseLong minor)
:patch (Long/parseLong patch)
{:major (parse-long major)
:minor (parse-long minor)
:patch (parse-long patch)
:modifier (case modifier
"-SNAPSHOT" modifier-snapshot
nil nil)}))
Expand Down

0 comments on commit 383156b

Please sign in to comment.