@@ -5,7 +5,7 @@ use nom::IResult;
55use ast:: * ;
66use expressions:: ExpressionParser ;
77use helpers:: * ;
8- use statements:: { block, ImportParser } ;
8+ use statements:: { block, func_body_suite , ImportParser } ;
99
1010/*********************************************************************
1111 * Decorators
@@ -46,7 +46,7 @@ named_args!(pub decorated(indent: usize) <StrSpan, CompoundStatement>,
4646 *********************************************************************/
4747
4848// async_funcdef: 'async' funcdef
49- // funcdef: 'def' NAME parameters ['->' test] ':' suite
49+ // funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] func_body_suite
5050named_args ! ( funcdef( indent: usize , decorators: Vec <Decorator >) <StrSpan , CompoundStatement >,
5151 do_parse!(
5252 indent!( indent) >>
@@ -57,7 +57,7 @@ named_args!(funcdef(indent: usize, decorators: Vec<Decorator>) <StrSpan, Compoun
5757 parameters: ws_nonl!( parameters) >>
5858 return_type: opt!( ws_nonl!( preceded!( tag!( "->" ) , call!( ExpressionParser :: <NewlinesAreNotSpaces >:: test) ) ) ) >>
5959 ws_nonl!( char !( ':' ) ) >>
60- code: call!( block , indent) >> (
60+ code: call!( func_body_suite , indent) >> (
6161 CompoundStatement :: Funcdef ( Funcdef {
6262 async : async . is_some( ) , decorators, name, parameters, return_type: return_type. map( |t| * t) , code
6363 } )
@@ -195,11 +195,11 @@ named!(parameters<StrSpan, TypedArgsList>,
195195 map!( delimited!( char !( '(' ) , opt!( ws_comm!( typedargslist) ) , char !( ')' ) ) , |o| o. unwrap_or_default( ) )
196196) ;
197197
198- // typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [
199- // '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
200- // | '**' tfpdef [',']]]
201- // | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
202- // | '**' tfpdef [','])
198+ // typedargslist: (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [
199+ // '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [ '**' tfpdef [','] [TYPE_COMMENT]]])
200+ // | '**' tfpdef [','] [TYPE_COMMENT]]])
201+ // | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [ '**' tfpdef [','] [TYPE_COMMENT]]])
202+ // | '**' tfpdef [','] [TYPE_COMMENT ])
203203//
204204// tfpdef: NAME [':' test]
205205//
0 commit comments