diff --git a/src/scanner.rs b/src/scanner.rs index af4441b..c8e62e2 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -81,6 +81,11 @@ impl Scanner { } } + /// Check whether the end of the input has been reached. + fn is_at_end(&self) -> bool { + self.current >= self.len + } + /// Advance to the next character and return it. fn advance(&mut self) -> char { let ch = self.cur_char(); @@ -105,11 +110,6 @@ impl Scanner { self.source.chars().nth(self.current).unwrap() } - /// Check whether the end of the input has been reached. - fn is_at_end(&self) -> bool { - self.current >= self.len - } - /// Add a token to the output. fn add_token(&mut self, token_type: TokenType) { let lexeme = self