diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-03-18 23:36:18 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-03-18 23:43:58 +0100 |
| commit | beca01c826ee51c9ee6d5eadd7e5ef10f7fb9f58 (patch) | |
| tree | e0ebb40b8775bba3b4be7bc47dceda3d349e2ac0 /src/parse/parser.rs | |
| parent | 77d153d315a2a5909840ebcd47491e4cef14428b (diff) | |
Methods
Diffstat (limited to 'src/parse/parser.rs')
| -rw-r--r-- | src/parse/parser.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 33cf489c..63ba4918 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -352,7 +352,16 @@ impl<'s> Parser<'s> { match self.groups.last().map(|group| group.kind) { Some(Group::Strong | Group::Emph) => n >= 2, - Some(Group::Expr | Group::Imports) => n >= 1, + Some(Group::Imports) => n >= 1, + Some(Group::Expr) if n >= 1 => { + // Allow else and method call to continue on next line. + self.groups.iter().nth_back(1).map(|group| group.kind) + != Some(Group::Brace) + || !matches!( + self.tokens.clone().next(), + Some(NodeKind::Else | NodeKind::Dot) + ) + } _ => false, } } |
