diff options
Diffstat (limited to 'users/tazjin/rlox/src/scanner.rs')
-rw-r--r-- | users/tazjin/rlox/src/scanner.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/users/tazjin/rlox/src/scanner.rs b/users/tazjin/rlox/src/scanner.rs index 314b56d6d380..4e8f07b61f5e 100644 --- a/users/tazjin/rlox/src/scanner.rs +++ b/users/tazjin/rlox/src/scanner.rs @@ -106,9 +106,15 @@ impl<'a> Scanner<'a> { // possible multi-character tokens '!' => self.add_if_next('=', TokenKind::BangEqual, TokenKind::Bang), - '=' => self.add_if_next('=', TokenKind::EqualEqual, TokenKind::Equal), + '=' => { + self.add_if_next('=', TokenKind::EqualEqual, TokenKind::Equal) + } '<' => self.add_if_next('=', TokenKind::LessEqual, TokenKind::Less), - '>' => self.add_if_next('=', TokenKind::GreaterEqual, TokenKind::Greater), + '>' => self.add_if_next( + '=', + TokenKind::GreaterEqual, + TokenKind::Greater, + ), '/' => { // support comments until EOL by discarding characters @@ -228,7 +234,8 @@ impl<'a> Scanner<'a> { self.advance(); } - let ident: String = self.source[self.start..self.current].iter().collect(); + let ident: String = + self.source[self.start..self.current].iter().collect(); // Determine whether this is an identifier, or a keyword: let token_kind = match ident.as_str() { |