What would be the best way in Python to parse out chunks of text contained in matching brackets?
"{ { a } { b } { { { c } } } }"
should initially return:
[ "{ a } { b } { { { c } } }" ]
putting that as an input should return:
[ "a", "b", "{ { c } }" ]
which should return:
[ "{ c }" ]
[ "c" ]
[]
Or this pyparsing version:
>>> from pyparsing import nestedExpr
>>> txt = "{ { a } { b } { { { c } } } }"
>>>
>>> nestedExpr('{','}').parseString(txt).asList()
[[['a'], ['b'], [[['c']]]]]
>>>