mirror of
https://github.com/joshuadavidthomas/django-template-ast.git
synced 2025-08-04 08:58:17 +00:00
rename previous to peek previous
This commit is contained in:
parent
52eea54ed7
commit
74ea421ee6
2 changed files with 3 additions and 7 deletions
|
@ -239,12 +239,8 @@ impl<'a> Scanner for Lexer<'a> {
|
|||
self.item_at(self.state.current + 1)
|
||||
}
|
||||
|
||||
fn previous(&self) -> Result<Self::Item, Self::Error> {
|
||||
if self.state.current > 0 {
|
||||
self.item_at(self.state.current - 1)
|
||||
} else {
|
||||
Err(LexerError::AtBeginningOfInput)
|
||||
}
|
||||
fn peek_previous(&self) -> Result<Self::Item, Self::Error> {
|
||||
self.item_at(self.state.current - 1)
|
||||
}
|
||||
|
||||
fn item_at(&self, index: usize) -> Result<Self::Item, Self::Error> {
|
||||
|
|
|
@ -23,7 +23,7 @@ pub trait Scanner {
|
|||
fn advance(&mut self) -> Result<Self::Item, Self::Error>;
|
||||
fn peek(&self) -> Result<Self::Item, Self::Error>;
|
||||
fn peek_next(&self) -> Result<Self::Item, Self::Error>;
|
||||
fn previous(&self) -> Result<Self::Item, Self::Error>;
|
||||
fn peek_previous(&self) -> Result<Self::Item, Self::Error>;
|
||||
fn item_at(&self, index: usize) -> Result<Self::Item, Self::Error>;
|
||||
fn is_at_end(&self) -> bool;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue