aboutsummaryrefslogtreecommitdiff
path: root/src/default_emitter.rs
diff options
context:
space:
mode:
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);
}