Skip to content

Commit

Permalink
Recognize '->' token more specifically
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 29, 2023
1 parent 2dbd0aa commit f9e455e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/expr.rs
Expand Up @@ -10,8 +10,8 @@ pub fn parse(input: &mut TokenIter) -> Result<Expr> {
enum Lookbehind {
JointColon,
DoubleColon,
JointHyphen,
Other,
JointOther,
}

let mut expr = TokenStream::new();
Expand All @@ -32,14 +32,12 @@ pub fn parse(input: &mut TokenIter) -> Result<Expr> {
angle_bracket_depth += 1;
Lookbehind::Other
}
'>' if angle_bracket_depth > 0 && lookbehind != Lookbehind::JointOther => {
'>' if angle_bracket_depth > 0 && lookbehind != Lookbehind::JointHyphen => {
angle_bracket_depth -= 1;
Lookbehind::Other
}
_ => match spacing {
Spacing::Joint => Lookbehind::JointOther,
Spacing::Alone => Lookbehind::Other,
},
'-' if spacing == Spacing::Joint => Lookbehind::JointHyphen,
_ => Lookbehind::Other,
};
}
Some(token) => expr.extend(iter::once(token)),
Expand Down

0 comments on commit f9e455e

Please sign in to comment.