En Mon, 09 Apr 2007 12:39:44 -0300, Paul McGuire <[EMAIL PROTECTED]>  
escribió:

> On Apr 9, 7:19 am, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote:
>>
>>    Suppose I have a string of expressions such as:
>> "((($IP = "127.1.2.3") AND ($AX < 15)) OR (($IP = "127.1.2.4") AND ($AY  
>> !=
>> 0)))
>>   I would like to split up into something like:
>>
>> [ "OR",
>>   ["AND", "($IP = "127.1.2.3")", "($AX < 15)"],
>>   ["AND", "(($IP = "127.1.2.4")", ($AY != 0))"] ]
>>
>
> This problem is right down the pyparsing fairway!  Pyparsing is a
> module for defining recursive-descent parsers, and it has some built-
> in help just for applications such as this.

Sometimes I've seen you proposing the usage of PyParsing on problems that,  
in my opinion, were better solved using some other standard tools, but  
this time you're absolutely right: this is perfectly suited for PyParsing!  
:)

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to