www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Range-based INI parser

Playing around with ranges I built [0] a little parser for INI 
files [1].

It does not support multiline values, since then I cannot do the 
line splitting in a different component. Any good architecture 
ideas here?

The thing with INI is that the definition is fuzzy. This means 
the parser should be highly configurable. What symbols for 
key-value-separation? What symbol for comments? Case sensitivity? 
Etc. I used template parameters for configuration, since that 
should be best for performance. Better ideas?

I like my idea to output a range of (section,key,value) items. 
This lets the user decide, what to do with duplicate keys and 
avoids data structures for sections.

Would something like this be a good idea for Phobos?

[0] http://dpaste.dzfl.pl/1b29ef20
[1] http://en.wikipedia.org/wiki/INI_file
Aug 25 2013