lib2to3 pattern creation with unexpected results
Zac Burns
zac256 at gmail.com
Tue Dec 22 12:42:02 EST 2009
Greetings,
I'm trying to re-purpose the lib2to3 module and along the way came up with
this pattern:
"funcdef<'def' name=NAME parameters ['->' test] ':' suite=suite>"
It seems to have 2 problems:
1. Single-line defs are not matched. Eg: "def singleLineFunc(): return 1
+ 2" is not matched, but "def multiLineFunc():\n a = 1 + 2\n return a"
is matched.
2. The first multi-line function in a file is matched twice (eg, the same
node, results pair is passed to the transform method.
Why are these happening? If anyone could point me to a general discussion
about creating these would be most helpful. I haven't found a lot of
resources for these and investigating has been more of a struggle than
usual.
Thanks,
--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091222/2e2b877e/attachment-0001.html>
More information about the Python-list
mailing list