From 5af93af82796a37182485068008274d5e1d10bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 30 Dec 2022 18:21:17 +0100 Subject: [PATCH] Scanner - Moved is_at_end() --- src/scanner.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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