@@ -387,15 +387,15 @@ impl ExpressionParser<NewlinesAreSpaces> {
387
387
// ((test | star_expr)
388
388
// (comp_for | (',' (test | star_expr))* [','])) )
389
389
named ! ( dictorsetmaker<StrSpan , Box <Expression >>,
390
- alt!(
390
+ ws4! ( alt!(
391
391
do_parse!(
392
- ws4! ( tag!( "**" ) ) >>
392
+ tag!( "**" ) >>
393
393
e: map!( call!( Self :: expr) , |e: Box <_>| DictItem :: Star ( * e) ) >>
394
394
r: call!( Self :: dictmaker, e) >>
395
395
( r)
396
396
)
397
397
| do_parse!(
398
- ws4! ( tag!( "*" ) ) >>
398
+ tag!( "*" ) >>
399
399
e: map!( call!( Self :: expr) , |e: Box <_>| SetItem :: Star ( * e) ) >>
400
400
r: call!( Self :: setmaker, e) >>
401
401
( r)
@@ -404,7 +404,7 @@ named!(dictorsetmaker<StrSpan, Box<Expression>>,
404
404
key: call!( Self :: test) >>
405
405
r: alt!(
406
406
do_parse!(
407
- ws4! ( char !( ':' ) ) >>
407
+ char !( ':' ) >>
408
408
item: map!( call!( Self :: test) , |value: Box <_>| DictItem :: Unique ( * key. clone( ) , * value) ) >> // FIXME: do not clone
409
409
r: call!( Self :: dictmaker, item) >>
410
410
( r)
@@ -413,21 +413,21 @@ named!(dictorsetmaker<StrSpan, Box<Expression>>,
413
413
) >>
414
414
( r)
415
415
)
416
- )
416
+ ) )
417
417
) ;
418
418
419
419
named_args ! ( dictmaker( item1: DictItem ) <StrSpan , Box <Expression >>,
420
420
map!(
421
- opt!( alt!(
422
- preceded !( char !( ',' ) , separated_list!( char !( ',' ) , call!( Self :: dictitem) ) ) => { |v: Vec <_>| {
421
+ opt!( ws4! ( alt!(
422
+ delimited !( char !( ',' ) , separated_list!( char !( ',' ) , call!( Self :: dictitem) ) , opt! ( ws4! ( char ! ( ',' ) ) ) ) => { |v: Vec <_>| {
423
423
let mut v = v;
424
424
v. insert( 0 , item1. clone( ) ) ; // FIXME: do not clone
425
425
Box :: new( Expression :: DictLiteral ( v) )
426
426
} }
427
427
| preceded!( peek!( tuple!( tag!( "for" ) , call!( helpers:: space_sep) ) ) , call!( Self :: comp_for) ) => { |comp| {
428
428
Box :: new( Expression :: DictComp ( Box :: new( item1. clone( ) ) , comp) ) // FIXME: do not clone
429
429
} }
430
- ) ) ,
430
+ ) ) ) ,
431
431
|rest| {
432
432
match rest {
433
433
Some ( r) => r,
@@ -439,16 +439,16 @@ named_args!(dictmaker(item1: DictItem) <StrSpan, Box<Expression>>,
439
439
440
440
named_args ! ( setmaker( item1: SetItem ) <StrSpan , Box <Expression >>,
441
441
do_parse!(
442
- rest: opt!( alt!(
443
- preceded !( char !( ',' ) , separated_list!( char !( ',' ) , call!( Self :: setitem) ) ) => { |v: Vec <_>| {
442
+ rest: opt!( ws4! ( alt!(
443
+ delimited !( char !( ',' ) , separated_list!( char !( ',' ) , call!( Self :: setitem) ) , opt! ( ws4! ( char ! ( ',' ) ) ) ) => { |v: Vec <_>| {
444
444
let mut v = v;
445
445
v. insert( 0 , item1. clone( ) ) ; // FIXME: do not clone
446
446
Box :: new( Expression :: SetLiteral ( v) )
447
447
} }
448
448
| call!( Self :: comp_for) => { |comp| {
449
449
Box :: new( Expression :: SetComp ( Box :: new( item1. clone( ) ) , comp) ) // FIXME: do not clone
450
450
} }
451
- ) ) >> (
451
+ ) ) ) >> (
452
452
match rest {
453
453
Some ( r) => r,
454
454
None => Box :: new( Expression :: SetLiteral ( vec![ item1] ) ) ,
0 commit comments