[Pyparsing] Parsing/lexing Tcl style {} strings
Brought to you by:
ptmcg
From: Ian B. <ia...@co...> - 2007-10-19 21:33:10
|
Howdy. I'm hoping someone can give me an idea of how to parse/lex Tcl-style {} strings. In Tcl a string like {this} is basically equivalent to "this", except that when you get the string you keep the {}'s balanced. So you can have: proc keep_trying { do_forever { stuff } } And that calls proc('keep_trying', '\n do forever {\n stuff\n }\n') So you don't actually descend into {} strings at all (meaning that you'd have to parse the stuff in {} later, but that's fine). I don't think you can match this with a regular expression. Is there a way to match this while keeping the {}'s balanced? -- Ian Bicking : ia...@co... : http://blog.ianbicking.org |