Scanner - Moved is_at_end()
This commit is contained in:
parent
8bdfbe59de
commit
5af93af827
1 changed files with 5 additions and 5 deletions
|
@ -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.
|
/// Advance to the next character and return it.
|
||||||
fn advance(&mut self) -> char {
|
fn advance(&mut self) -> char {
|
||||||
let ch = self.cur_char();
|
let ch = self.cur_char();
|
||||||
|
@ -105,11 +110,6 @@ impl Scanner {
|
||||||
self.source.chars().nth(self.current).unwrap()
|
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.
|
/// Add a token to the output.
|
||||||
fn add_token(&mut self, token_type: TokenType) {
|
fn add_token(&mut self, token_type: TokenType) {
|
||||||
let lexeme = self
|
let lexeme = self
|
||||||
|
|
Loading…
Reference in a new issue