How would I go about parsing this string
"a:foo[and it's cousin bar[are here]]"
into this
"a:" "foo[" "and" "it's" "cousin" "bar[" "are" "here" "]" "]"
In essence I’m looking to accomplish three things, extract an assignment “a:”, extract sections “foo[” (including nested sections) and the closing section “]”. I could evenly space them and just do a simple parse but I don’t want to do that.
Hope it makes sense. Any help will be greatly appreciated!
Thanks!
Define the elements of your language, then collect them as you match them:
Note: I use
'useto isolate words used solely for this purpose.