pgen2 use questions.

  • Thread starter Brian L. Troutwine
  • Start date
B

Brian L. Troutwine

I happened to stumble upon Guido's announcement of his python2 to
python3 refactoring tool earlier today
(http://mail.python.org/pipermail/python-3000/2006-December/005102.html),
and, after playing with it a bit, I have some use questions as I don't
quite understand how the pattern matching language works.

In some instances I cannot grok matching certain sorts of patterns,
sometimes very simple ones. For instance, how is the following
incorrect for matching pass statements?

pass_stmt< 'pass'>

If I wanted to insert "# Do nothing, and well." after each pass
statement how would the transformation work?

Why would this pattern not match function statements?

funcdef<
decorators < decs=any >
'def'
atom < def_name=NAME >
parameters < pars=any >
':'
suite said:

If I wanted to change the function name how would I do so? How about
parts of the function body?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top