48 lines
1.1 KiB
Markdown
48 lines
1.1 KiB
Markdown
# cfg
|
||
|
||
is a spartan fast configuration language.
|
||
|
||
It has numbers, strings, lists, and sections.
|
||
|
||
The reference implementation is WIP. There will most certainly be memory leaks.
|
||
|
||
You’re not alone: I also wish the code were documented.
|
||
|
||
## Example
|
||
|
||
`cfg` has no comments, but let’s pretend we had `#` comments.
|
||
|
||
```
|
||
# lists start with a name, then an indent, then a hyphen, a space,
|
||
# and then a value
|
||
my_list
|
||
- "value"
|
||
- 12
|
||
|
||
# strings are quoted
|
||
my_string "this is a string"
|
||
|
||
# all numbers are doubles
|
||
my_num 42.0
|
||
|
||
# sections have names, and are indented by 2
|
||
my_section
|
||
my_inner_string "inner"
|
||
my_second_numer 23.0
|
||
```
|
||
|
||
Keys cannot contain spaces. Indents are always two spaces. There is one space
|
||
between the hyphen and the value in an array, unless there is a linebreak
|
||
immediately after. This is all.
|
||
|
||
It is a simple format, some might think it is too simple. It is, however,
|
||
possible, to write a simple, fast implementation in a few hundred lines of C
|
||
(QED), and that might be worth a bit of reduction.
|
||
|
||
See the [`examples/`](examples/) directory for an example of how to use the
|
||
pretty printer and parser APIs.
|
||
|
||
<hr/>
|
||
|
||
Have fun!
|