[Python-porting] lib2to3 and matching of fixers

Benjamin Peterson benjamin at python.org
Wed Dec 14 02:30:16 CET 2011


2011/12/13 Vinay Sajip <vinay_sajip at yahoo.co.uk>:
> I'm trying to write a custom lib2to3 fixer which, when processing the source
>
> x = b'foo' b'bar'
>
> will match the right hand side of the expression. From what I can see I should
> be able to match it with 'atom' or 'power', but it doesn't seem to match either
> of those. The individual byte-string tokens are matched using STRING, as
> expected.

What are you using exactly? I would expect "atom< STRING+>" to work.

>
> What should I use to match the right-hand side, for example if I want to do
> constant folding and transform to something like b'foobar'?



-- 
Regards,
Benjamin


More information about the Python-porting mailing list