aboutsummaryrefslogtreecommitdiff
path: root/src/default_emitter.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-27 17:19:27 +0200
committerMartin Fischer <martin@push-f.com>2023-09-27 17:19:27 +0200
commit518edf281f93cceb9793224f700a8f3d63d78ea2 (patch)
treec6c0adfe88da9f329ac9c80f8c1e97607c749742 /src/default_emitter.rs
parent67a812003a18cca016ff8b918610b4b6276ffd86 (diff)
break!: remove Emitter::pop_token, use Iterator instead
Diffstat (limited to 'src/default_emitter.rs')
-rw-r--r--src/default_emitter.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/default_emitter.rs b/src/default_emitter.rs
index 9d5ab52..7ef96ec 100644
--- a/src/default_emitter.rs
+++ b/src/default_emitter.rs
@@ -33,9 +33,15 @@ impl<O> Default for DefaultEmitter<O> {
}
}
-impl<O: Offset> Emitter<O> for DefaultEmitter<O> {
- type Token = Token<O>;
+impl<O> Iterator for DefaultEmitter<O> {
+ type Item = Token<O>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.emitted_tokens.pop_back()
+ }
+}
+impl<O: Offset> Emitter<O> for DefaultEmitter<O> {
fn emit_eof(&mut self) {
self.flush_current_characters();
}
@@ -44,10 +50,6 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> {
self.push_error(error, span);
}
- fn pop_token(&mut self) -> Option<Self::Token> {
- self.emitted_tokens.pop_back()
- }
-
fn emit_string(&mut self, s: &str) {
self.current_characters.push_str(s);
}