[Pyparsing] How to get to a specific block of text I need
Brought to you by:
ptmcg
From: Malahal N. <ma...@gm...> - 2017-02-26 05:04:10
|
I am trying to implement a config editor for a project. The config syntax is very simple. It consists of "key value" pairs in blocks. Blocks may have sub-blocks (only one level at this time). An example: export { path = path1; key2 = value2; client { clientid = value3; key4 = value4; } client { clientid = value6; } } The "export" is uniquely identified by a specific "path" value. Same is the case with "client" block inside the "export" block which is identified by the "clientid" value. Given an export path, I would like to fetch the corresponding export block. Of course, I can easily match all exports and search each such block for a matching "path". Similarly, for a given path and clientid, I would like to get the corresponding "client" block quickly as there may be 1000's of these sub-blocks in the export block. Regards, Malahal. |