Skip to content

Commit

Permalink
Fix usage of peeking first_word on unindents (should fail, not error).
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Oct 28, 2018
1 parent 52e8673 commit ae8ae0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ named_args!(decorators(indent: usize) <StrSpan, Vec<Decorator>>,
named_args!(pub decorated(indent: usize) <StrSpan, CompoundStatement>,
do_parse!(
decorators: call!(decorators, indent) >>
s: switch!(peek!(ws_nonl!(first_word)),
s: switch!(peek!(preceded!(indent!(indent), first_word)),
"def" => call!(funcdef, indent, decorators.clone()) // FIXME: do not clone
| "async" => call!(funcdef, indent, decorators.clone()) // FIXME: do not clone
| "class" => call!(classdef, indent, decorators)
Expand Down
2 changes: 1 addition & 1 deletion src/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ named_args!(cond_and_block(indent: usize) <StrSpan, (Expression, Vec<Statement>)
// compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
named_args!(compound_stmt(indent: usize) <StrSpan, CompoundStatement>,
alt!(
switch!(peek!(ws_nonl!(first_word)),
switch!(peek!(preceded!(indent!(indent), first_word)),
"if" => return_error!(call!(if_stmt, indent))
| "for" => return_error!(call!(for_stmt, indent))
| "while" => return_error!(call!(while_stmt, indent))
Expand Down

0 comments on commit ae8ae0f

Please sign in to comment.