[PD] PdParser

Chris McCormick chris at mccormick.cx
Wed Dec 2 12:21:44 CET 2009


Hi,

>From the RjDj labs:

PdParser can be used to parse Pd files in Python (for stuff like documentation
for example).

Browse here for the download:
<http://mccormick.cx/dev/PdParser/>

Or check it out with bzr:
bzr co http://mccormick.cx/dev/PdParser/

Example:

(Find all objects which are comment boxes in the subpatch 'REFERENCE', and all
messages boxes in the subpatch 'hello')

>>> p = PdParser("my-patch.pd")
>>>
>>> def found(canvasStack, type, action, bits):
...   print "canvasStack:", canvasStack, "type:", type, "action:", action, "arguments:", bits
... 
>>> p.add_filter_method(found, canvas="REFERENCE", type="#X", action="text")
>>> p.add_filter_method(found, canvas="hello", type="#X", action="msg")
>>> print p.parse(), "elements found"

Best,

Chris.

-------------------
http://mccormick.cx




More information about the Pd-list mailing list