summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md1
-rw-r--r--src/default_emitter.rs1
3 files changed, 5 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e59e008..aab7a86 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,9 @@
* Added the `EndOfFile` variant.
+* The `DefaultEmitter` now emits `Token::EndOfFile` on the end-of-file.
+ (Previously it did not emit any token symbolizing the end-of-file.)
+
* `Emitter` trait
* Removed `pop_token` method and `Token` associated type.
diff --git a/README.md b/README.md
index 07d9e06..6513b61 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@ for token in NaiveParser::new(html).flatten() {
Token::EndTag(tag) => {
write!(new_html, "</{}>", tag.name).unwrap();
}
+ Token::EndOfFile => {},
_ => panic!("unexpected input"),
}
}
diff --git a/src/default_emitter.rs b/src/default_emitter.rs
index 5edf848..c9a390a 100644
--- a/src/default_emitter.rs
+++ b/src/default_emitter.rs
@@ -53,6 +53,7 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> {
}
fn emit_eof(&mut self) {
+ self.emit_token(Token::EndOfFile);
}
fn emit_char(&mut self, c: char) {