Skip to content

Commit 185465a

Browse files
committed
Deprecate Lexer::token with Lexer::next_token
1 parent 2414acf commit 185465a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/lexer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,17 +389,17 @@ impl Lexer {
389389
Ok(self.token)
390390
}
391391

392+
#[deprecated(
393+
since = "0.1.0",
394+
note = "This function returns the next token, not the current token. Use `next_token` instead of this."
395+
)]
392396
/// Get the current token.
393397
pub(crate) fn token(&mut self) -> Result<Option<Token>> {
394-
// TODO: This shouldn't be used, next_token should be used instead.
395-
// This gives a wrong meaning to what is happening. next_token is more
396-
// verbose.
397398
Ok(self.next_token()?)
398399
}
399400

400401
/// Consumes last set token and moves onto the next token in buffer.
401402
pub(crate) fn consume(&mut self, token: Token) -> Result<()> {
402-
// TODO: use Lexer::is_token?
403403
if let Some(last_token) = &self.token {
404404
assert_eq!(
405405
token, *last_token,

src/parser.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,6 @@ impl Parser {
716716
);
717717
let mut imports = Vec::new();
718718

719-
// TODO: Move this entirely in parse_module, parse_module should return
720-
// a Qast and it can recursively call itself when `module` is seen
721-
// inside the file.
722719
self.lexer.next_token()?;
723720
loop {
724721
if self.lexer.token.is_none() {
@@ -816,7 +813,6 @@ impl Parser {
816813
// Here and in the cyclic import case as well.
817814
let err: QccError = QccErrorKind::UnknownImport.into();
818815
err.report(&function);
819-
// err.report(format!("{} {}", function, self.lexer.location).as_str());
820816
Err(QccErrorKind::ParseError)?
821817
}
822818
}

0 commit comments

Comments
 (0)