Scott David Daniels wrote: > What kind of shenanigans must a parser go through to translate: > <x**2 with(x)><<x**3 with(x)> > > this is the comparison of two functions, but it looks like a left- > shift on a function until the second with is encountered. Then > you need to backtrack to the shift and convert it to a pair of > less-thans before you can successfully translate it.
I hadn't thought of that, but after much diving into the Python grammar, the grammar would still work with a greedy tokenizer if "<<" (and also ">>", for identical reasons) were replaced in 'shift_expr" with "<" "<" and ">" ">". That, of course, introduces some weirdness of '''a = 5 < < 3''' being valid. I'm not sure whether that is a wart big enough to justify a special-case rule regarding '>>' and '<<' tokens. We do allow 'def f () :' as-is, so I'm not sure this is too big of a problem. -- http://mail.python.org/mailman/listinfo/python-list