Skip to content

Commit b2dcacb

Browse files
committed
fix lexer match guard
1 parent f28f9cf commit b2dcacb

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

src/lexer.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,14 @@ impl<'input> Lexer<'input> {
173173
// block-comment form (the official compiler rejects `/*` as an
174174
// invalid token). Treating `/*` as a comment would also swallow
175175
// the XML all-children navigation step `x/*`.
176-
'/' => {
177-
if self.peek_next() == Some('/') {
178-
self.advance(); // Consume '/'
179-
self.advance(); // Consume second '/'
180-
while self.peek() != Some(&'\n') && !self.is_at_end() {
181-
self.advance();
182-
}
183-
if self.peek() == Some(&'\n') {
184-
self.advance();
185-
}
186-
} else {
187-
return Ok(());
176+
'/' if self.peek_next() == Some('/') => {
177+
self.advance(); // Consume '/'
178+
self.advance(); // Consume second '/'
179+
while self.peek() != Some(&'\n') && !self.is_at_end() {
180+
self.advance();
181+
}
182+
if self.peek() == Some(&'\n') {
183+
self.advance();
188184
}
189185
}
190186
_ => return Ok(()),

0 commit comments

Comments
 (0)