aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/build/packages/tom/README.md
blob: e6adcbe165f1d746165a033fd51b0655c24943eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# tom

A Gleam TOML parser!

[![Package Version](https://img.shields.io/hexpm/v/tom)](https://hex.pm/packages/tom)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/tom/)


```sh
gleam add tom
```
```gleam
import tom

const config = "
  [person]
  name = \"Lucy\"
  is_cool = true
"

pub fn main() {
  // Parse a string of TOML
  let assert Ok(parsed) = tom.parse(config)

  // Now you can work with the data directly, or you can use the `get_*`
  // functions to retrieve values.

  tom.get_string(parsed, ["person", "name"])
  // -> Ok("Lucy")

  let is_cool = tom.get_bool(parsed, ["person", "is_cool"])
  // -> Ok(True)
}
```

Further documentation can be found at <https://hexdocs.pm/tom>.

## Status

The following string escape sequences are not supported yet:

- `\b`
- `\f`
- `\e`
- `\xHH`
- `\uHHHH`
- `\UHHHHHHHH`