https://github.com/LightQuantumArchive/opam-file-format-rs
Parser for the opam file syntax written in rust
https://github.com/LightQuantumArchive/opam-file-format-rs
Last synced: 10 months ago
JSON representation
Parser for the opam file syntax written in rust
- Host: GitHub
- URL: https://github.com/LightQuantumArchive/opam-file-format-rs
- Owner: LightQuantumArchive
- License: apache-2.0
- Created: 2020-10-31T20:55:37.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-06-17T01:41:30.000Z (almost 4 years ago)
- Last Synced: 2025-08-23T09:53:26.423Z (10 months ago)
- Language: Rust
- Size: 68.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# opam-file-format-rs
Parser for the opam file syntax written in rust.
## Get Started
### Binary
First, let's run a benchmark and sanity check.
``` shell script
$ git clone https://github.com/ocaml/opam-repository
$ find ./opam-repository -name "opam" > opam-files
$ opam-file-format-rs --benchmark ./opam-files
reading files into memory...
parsing files...
parsed 15955 files. elapsed 0.36 secs. speed: 44691.88 files/sec
```
By default, `opam-file-format-rs` outputs the AST of opam files.
``` shell script
$ opam-file-format-rs ./opam
OpamAST {
items: {
"opam-version": Variable(
String(
"2.0",
),
),
...
},
}
```
To make your life easier, you may ask `opam-file-format-rs` to output json format.
``` shell script
$ opam-file-format-rs ./opam --json | jq
{
"opam-version": "2.0",
"maintainer": "Thomas Gazagnaire ",
"authors": [
"Thomas Gazagnaire opam:5:13
| license: "ISC"
5 | boo: dev-repo: "git+https://github.com/realworldocaml/craml.git"
| ^
| bug-reports: "https://github.com/realworldocaml/craml/issues"
```
## Library
The document is WIP. You may take a peek at the bin crate to grasp a general idea how it works.