pyparsing frames and tweens - take 2

Paul McGuire ptmcg at austin.rr.com
Mon Nov 5 09:38:17 EST 2007


Donn -

The exception you posted is from using an old version of pyparsing.
You can get the latest from SourceForge - if you download the Windows
binary install, please get the docs package too.  It has a full doc
directory (generated with epydoc), plus example scripts for a variety
of applications.  There is also an e-book available from O'Reilly that
just came out in early October.

To add an optional lead-in of one or more blanks,just change animation
from:

animation = OneOrMore((frame + Optional(
                            (tween + FollowedBy(frame)) |
                            OneOrMore(copy | blank) ) ) )

to:

animation = Optional(OneOrMore(blank)) + \
            OneOrMore((frame + Optional(
                            (tween + FollowedBy(frame)) |
                            OneOrMore(copy | blank) ) ) )

I modified your test, and there were no problems parsing strings with
and without the leading '_'s.

-- Paul




More information about the Python-list mailing list