This commit is contained in:
2020-03-18 23:08:40 +01:00
commit 435fab86e3
3 changed files with 520 additions and 0 deletions

48
README.md Normal file
View File

@@ -0,0 +1,48 @@
# cfg
is a spartan fast configuration language.
It has numbers, strings, lists, and sections.
The reference implementation is WIP. I just got to finishing the data type and
pretty printer today, a parser will be provided soon. I didnt quite create a
correct implementation today. There will most certainly also be memory leaks.
I promised a friend I would share this “later today”, though, and Im not one
to break promises just because my code is crap. You have been warned.
Youre not alone: I also wish the code were documented.
## Example
`cfg` has no comments, but lets pretend we had `#` comments.
```
# lists start with a name, then an indent, 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. 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.
<hr/>
Have fun!