Skip to content

Commit

Permalink
Make the library compatible with babashka interpreter
Browse files Browse the repository at this point in the history
There is no need to use the .toMatchResult method to get the matching
start and end. Those methods are alreay available in the Matcher
class. They return the exact same values and they don't need to use an
inner class. This access is not allowed when using the babashka
Clojure(Script) interpreter.

Babashka is statically compiled using GraalVM, and GraalVM is fairly
restrictive with access to classes. Unless you specifically list them
in the build configuration, the access is denied. Potentially even it
can completely strip the classes out, if it thinks they are not
used (it performs some static analysis to determine it, but it can
fail depending on how the classes are used).
  • Loading branch information
iarenaza committed Apr 6, 2022
1 parent 0858082 commit 23c30a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cljstache/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
matcher (re-matcher regex s)]
(if (nil? (re-find matcher))
-1
(+ index (.start (.toMatchResult matcher)))))))))
(+ index (.start matcher))))))))

#?(:cljs
(defn- next-index
Expand Down

0 comments on commit 23c30a6

Please sign in to comment.