What would be the best practice - if there is any - to parse multiple config files?
I want to parse the mysql server configuration and also write the configuration again
In your pyparsing code, attach a parse action to the expression that matches the include
statements, have it parse the contents of the referenced files or directory of files, then merge those results into the current parse output. The parse action would make the successive calls to parseString
, your code would only make a single call.
See this new example added to the pyparsing examples directory: https://github.com/pyparsing/pyparsing/blob/master/examples/include_preprocessor.py