https://github.com/babashka/pod-babashka-instaparse
Instaparse pod
https://github.com/babashka/pod-babashka-instaparse
Last synced: 3 months ago
JSON representation
Instaparse pod
- Host: GitHub
- URL: https://github.com/babashka/pod-babashka-instaparse
- Owner: babashka
- License: epl-1.0
- Created: 2023-01-14T12:04:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-06T12:27:01.000Z (3 months ago)
- Last Synced: 2026-03-06T15:28:57.704Z (3 months ago)
- Language: Clojure
- Size: 53.7 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pod-babashka-instaparse
A pod exposing [Instaparse](https://github.com/Engelberg/instaparse) to babashka.
It's recommended to use this pod via the [instaparse.bb](https://github.com/babashka/instaparse.bb) library.
## API
Only a subset of instaparse is exposed. If you are missing functionality, please create an issue.
### pod.babashka.instaparse
- `parser`
- `parse`
- `parses`
- `failure?`
- `span`
- `add-line-and-column-info-to-metadata`
## Differences with instaparse
- Parser only works on a string grammar input
- The result of `parser` must be used with `parse` or `parses`, it cannot be called as a function directly
## Example
``` clojure
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/instaparse "0.0.7")
;; loading the pod creates the instaparse.core namespace
(require '[pod.babashka.instaparse :as insta])
(def as-and-bs
(insta/parser
"S = AB*
AB = A B
A = 'a'+
B = 'b'+"))
(prn (insta/parse as-and-bs "aaaaabbbaaaabb"))
(def failure (insta/parse as-and-bs "xaaaaabbbaaaabb"))
(prn failure)
(prn :failure? (insta/failure? failure))
```
## Build
Run `script/compile`. This requires `GRAALVM_HOME` to be set.
## Test
To test the pod code with JVM clojure, run `clojure -M test.clj`.
To test the native image with bb, run `bb test.clj`.
## License
Copyright © Michiel Borkent
Distributed under the EPL 1.0 license, same as Instaparse and Clojure. See LICENSE.