Skip to content

Commit ff95358

Browse files
committed
Woops, sep!() does not support separated_nonempty_list.
1 parent 190fc41 commit ff95358

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<IIT: IsItTyped> ParamlistParser<IIT> {
227227
* Parse positional arguments:
228228
* tfpdef ['=' test] (',' tfpdef ['=' test])*
229229
*/
230-
positional_args: separated_nonempty_list!(char!(','), call!(IIT::fpdef_with_default)) >>
230+
positional_args: separated_nonempty_list!(ws2!(char!(',')), call!(IIT::fpdef_with_default)) >>
231231
r: opt!(ws4!(preceded!(char!(','), opt!( // FIXME: ws! is needed here because it does not traverse opt!
232232

233233
alt!(
@@ -246,7 +246,7 @@ impl<IIT: IsItTyped> ParamlistParser<IIT> {
246246
| do_parse!(
247247
char!('*') >>
248248
star_args: opt!(call!(IIT::fpdef)) >>
249-
keyword_args: opt!(preceded!(char!(','), separated_nonempty_list!(char!(','), call!(IIT::fpdef_with_default)))) >>
249+
keyword_args: opt!(ws4!(preceded!(char!(','), separated_nonempty_list!(ws4!(char!(',')), call!(IIT::fpdef_with_default))))) >>
250250
star_kwargs: opt!(ws4!(preceded!(char!(','), opt!(preceded!(tag!("**"), call!(IIT::fpdef)))))) >> ( // FIXME: ws! is needed here because it does not traverse opt!
251251
IIT::make_list(positional_args.clone(), Some(star_args), keyword_args.unwrap_or(Vec::new()), star_kwargs.unwrap_or(None)) // FIXME: do not clone
252252
)

src/statements.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ named_args!(pub statement(indent: usize) <StrSpan, Vec<Statement>>,
2525
// simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
2626
named_args!(simple_stmt() <StrSpan, Vec<Statement>>,
2727
do_parse!(
28-
stmts: separated_nonempty_list!(semicolon, call!(small_stmt)) >>
28+
stmts: separated_nonempty_list!(ws2!(semicolon), call!(small_stmt)) >>
2929
opt!(semicolon) >> (
3030
stmts
3131
)
@@ -181,14 +181,14 @@ named!(raise_stmt<StrSpan, Statement>,
181181
// global_stmt: 'global' NAME (',' NAME)*
182182
named!(global_stmt<StrSpan, Statement>,
183183
map!(preceded!(tuple!(tag!("global"), space_sep2),
184-
ws2!(separated_nonempty_list!(char!(','), name))
184+
ws2!(separated_nonempty_list!(ws2!(char!(',')), name))
185185
), |names| Statement::Global(names))
186186
);
187187

188188
// nonlocal_stmt: 'nonlocal' NAME (',' NAME)*
189189
named!(nonlocal_stmt<StrSpan, Statement>,
190190
map!(preceded!(tuple!(tag!("nonlocal"), space_sep2),
191-
ws2!(separated_nonempty_list!(char!(','), name))
191+
ws2!(separated_nonempty_list!(ws2!(char!(',')), name))
192192
), |names| Statement::Nonlocal(names))
193193
);
194194

@@ -288,19 +288,19 @@ named!(dotted_as_name<StrSpan, (Vec<Name>, Option<Name>)>,
288288
// import_as_names: import_as_name (',' import_as_name)* [',']
289289
named!(import_as_names<StrSpan, Vec<(Name, Option<Name>)>>,
290290
terminated!(
291-
separated_nonempty_list!(tuple!(spaces!(), char!(','), spaces!()), call!(Self::import_as_name)),
291+
separated_nonempty_list!(ws2!(char!(',')), call!(Self::import_as_name)),
292292
opt!(tuple!(spaces!(), char!(','), spaces!()))
293293
)
294294
);
295295

296296
// dotted_as_names: dotted_as_name (',' dotted_as_name)*
297297
named!(dotted_as_names<StrSpan, Vec<(Vec<Name>, Option<Name>)>>,
298-
separated_nonempty_list!(tuple!(spaces!(), char!(','), spaces!()), call!(Self::dotted_as_name))
298+
separated_nonempty_list!(ws2!(char!(',')), call!(Self::dotted_as_name))
299299
);
300300

301301
// dotted_name: NAME ('.' NAME)*
302302
named!(pub dotted_name<StrSpan, Vec<Name>>,
303-
separated_nonempty_list!(tuple!(spaces!(), char!('.'), spaces!()), name)
303+
separated_nonempty_list!(ws2!(char!('.')), name)
304304
);
305305

306306
} // end ImportParser

0 commit comments

Comments
 (0)