Zac Burns gmail.com> writes:
> I'm trying to match any function block,
the two examples were just a part of
my unit tests.
I know. I was just giving an example to indicate why it doesn't work.
find_pattern.py is useful because it gives you a base from which
it's easy to
extrapolate the genera
On Tue, Dec 22, 2009 at 3:21 PM, Benjamin Peterson wrote:
>
> The pattern for that is funcdef< 'def' 'singleLineFunc' parameters< '(' ')'
> >
> ':' simple_stmt< return_stmt< 'return' arith_expr< '1' '+' '2' > > '\n' >
> >. No
> suite.
>
>
I'm trying to match any function block, the two examples we
Zac Burns gmail.com> writes:
>
>
> 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:
>
> Single-line defs are not matched. Eg: "def singleLineFunc(): re
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,