Skip to content

Commit c33b8ac

Browse files
committed
address comments
1 parent 3a6f0e1 commit c33b8ac

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tokenizer.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,8 +1627,9 @@ impl<'a> Tokenizer<'a> {
16271627
chars.next();
16281628
match chars.peek() {
16291629
Some('>') => self.consume_for_binop(chars, "<=>", Token::Spaceship),
1630-
Some('+') => Ok(Some(Token::LtEq)),
1631-
Some('-') => Ok(Some(Token::LtEq)),
1630+
// `<=+` and `<=-` are not valid combined operators; treat `<=` as
1631+
// the operator and leave `+`/`-` to be tokenized separately.
1632+
Some('+') | Some('-') => Ok(Some(Token::LtEq)),
16321633
_ => self.start_binop(chars, "<=", Token::LtEq),
16331634
}
16341635
}
@@ -1648,10 +1649,12 @@ impl<'a> Tokenizer<'a> {
16481649
}
16491650
}
16501651
Some('<') => self.consume_for_binop(chars, "<<", Token::ShiftLeft),
1652+
// `<+` is not a valid combined operator; treat `<` as the operator
1653+
// and leave `+` to be tokenized separately.
16511654
Some('+') => Ok(Some(Token::Lt)),
16521655
Some('-') if self.dialect.supports_geometric_types() => {
16531656
if chars.peekable.clone().nth(1) == Some('>') {
1654-
chars.next(); // consume
1657+
chars.next(); // consume `-`
16551658
self.consume_for_binop(chars, "<->", Token::TwoWayArrow)
16561659
} else {
16571660
Ok(Some(Token::Lt))

0 commit comments

Comments
 (0)