On Tuesday, January 13, 2015 at 10:06:50 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 12 Jan 2015 19:48:18 +0000, Ian wrote: > > > My recommendation would be to write a recursive decent parser for your > > files. > > > > That way will be easier to write, > > I know that writing parsers is a solved problem in computer science, and > that doing so is allegedly one of the more trivial things computer > scientists are supposed to be able to do, but the learning curve to write > parsers is if anything even higher than the learning curve to write a > regex. > > I wish that Python made it as easy to use EBNF to write a parser as it > makes to use a regex :-( > > http://en.wikipedia.org/wiki/Extended_Backus-Naur_Form > > > > -- > Steven
There appears to be at least one python package for this https://pypi.python.org/pypi/iscconf And for those wanting to use regexes to parse CFGs, the requried reading is: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags -- https://mail.python.org/mailman/listinfo/python-list