# dms-rs

Rust reference parser for **DMS**, a config language with strong typing, ordered maps,
multi-line heredocs, and front-matter metadata.

This crate is the canonical implementation. Six other ports (C, Zig, Go, Python,
JavaScript, Perl) check against the same fixture corpus.

## Install

```toml
# Cargo.toml — note the rename so source code can still `use dms::...`
[dependencies]
dms = { package = "dms-rs", version = "0.1" }
```

Or:

```sh
cargo add dms-rs --rename dms
```

## Usage

```rust
use dms::Parser;

let src = std::fs::read_to_string("config.dms")?;
let value = Parser::parse(&src)?;
```

## Crates in this workspace

| crate         | crates.io      | purpose                                          |
| ------------- | -------------- | ------------------------------------------------ |
| `crates/dms`         | **`dms-rs`**   | the parser                                       |
| `crates/dms-encoder` | `dms-encoder`  | DMS → tagged-JSON encoder (conformance suite)    |
| `crates/serde_dms`   | `serde_dms`    | Serde `Deserializer` adapter                     |

## Build & test

```sh
cargo build --workspace
cargo test  --workspace
```

## Conformance

`conformance/` is a git submodule — the [dms-tests](https://gitlab.com/flo-labs/pub/dms-tests)
corpus (4500+ fixture pairs). Initialise it on first clone:

```sh
git submodule update --init --recursive
```

Then run the full sweep against the encoder:

```sh
cargo build --release -p dms-encoder
python3 conformance/run_conformance.py target/release/dms-encoder
```

## Publish

```sh
cargo publish -p dms-rs           # parser
cargo publish -p dms-encoder      # depends on dms-rs being published
cargo publish -p serde_dms        # ditto
```

You'll need `cargo login <token>` once. Publishing must be in dependency order
(`dms-rs` → `dms-encoder` / `serde_dms`).

## License

MIT OR Apache-2.0
