How to parse over a Python expr?

Stefan Franke franke at ableton.com
Fri Aug 30 18:53:19 EDT 2002


On Fri, 30 Aug 2002 13:28:53 -0700, Erik Max Francis <max at alcyone.com> wrote:

>In empy, Python expressions are set off with the @(...) notation.  In
>order to pull out the expression, I walk along the substring ...,
>keeping track of the depth (starting with zero) of the parentheses (an
>open parenthesis increments the depth; a close parenthesis decrements
>it) as I go, and ignoring any parentheses that appear inside of a string
>literal.  [...]

I had a quick glance at the empy source. Am I going right that 
Parser.scanComplex() does that thing? That function looks if
it could be fooled by triple-quoted strings, e.g. this one:
''' here's ')]" an evil "string '''

(Excuse my ignorance if this is handled elsewhere..)

However, it shouldn't be a big deal to handle this case 
correctly. My question was more aiming at if not Python itself
could be used for the parsing work..

Stefan




More information about the Python-list mailing list