Tiny QDF Parser
parser c
I wanted to write a parser for a key-value text based data format recently. Something similar to JSON and KeyValues, but easier to write than JSON, and with more features than KeyValues (mainly arrays).
The format looks like this:
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 // Keys can have multiple values in parenthesis one(two "three") // or spread out over many statements "one" four one five one six // Keys can have no value and a block after them one { // Blocks contain more key-value pairs two three } one { two("three" four five) } // Keys can have many values and a block after them one(two three four) { five six seven eight } // Blocks can be arbitrarily nested one(two) { three(four) { five(six) { seven eight } } nine(ten eleven) } Ozxy and I have named this the Quick Data Format, or QDF.
Read more...