Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jan 14, 2023
1 parent 40d2b1a commit 82a006b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A pod exposing [Instaparse](https://github.com/Engelberg/instaparse) to babashka

Only a subset of instaparse is exposed. If you are missing functionality, please create an issue.

### instaparse.core
### pod.babashka.instaparse

- `parser`
- `parse`
Expand All @@ -26,7 +26,7 @@ Only a subset of instaparse is exposed. If you are missing functionality, please

;; loading the pod creates the instaparse.core namespace

(require '[instaparse.core :as insta])
(require '[pod.babashka.instaparse :as insta])

(def as-and-bs
(insta/parser
Expand Down
2 changes: 1 addition & 1 deletion resources/POD_BABASHKA_INSTAPARSE_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1-SNAPSHOT
0.0.1
17 changes: 9 additions & 8 deletions src/pod/babashka/instaparse.clj
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
(p s)))

#_(def parser-wrapper (str '(do (defn parser [grammar]
(let [p (-parser grammar)]
p #_(fn [s]
(-call-parser p s)))))))
(let [p (-parser grammar)]
p #_(fn [s]
(-call-parser p s)))))))

(defn mark-failure [x]
(if (insta/failure? x)
Expand All @@ -64,10 +64,11 @@
mark-failure)))

(def lookup*
{'instaparse.core {#_#_'-parser -parser
'parse parse
'parser -parser
#_#_'-call-parser -call-parser}})
{'pod.babashka.instaparse
{#_#_'-parser -parser
'parse parse
'parser -parser
#_#_'-call-parser -call-parser}})

(defn lookup [var]
(let [var-ns (symbol (namespace var))
Expand All @@ -80,7 +81,7 @@
(if (ident? v) (name v)
v))
{:format :transit+json
:namespaces [{:name "instaparse.core"
:namespaces [{:name "pod.babashka.instaparse"
:vars [#_{"name" "-parser"}
#_{"name" "-call-parser"}
{"name" "parser" #_#_"code" parser-wrapper}
Expand Down
2 changes: 1 addition & 1 deletion test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(pods/load-pod "./pod-babashka-instaparse")
(pods/load-pod ["clojure" "-M" "-m" "pod.babashka.instaparse"]))

(require '[instaparse.core :as insta])
(require '[pod.babashka.instaparse :as insta])

(def as-and-bs
(insta/parser
Expand Down

0 comments on commit 82a006b

Please sign in to comment.