aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-29 13:09:44 +0200
committerMartin Fischer <martin@push-f.com>2023-09-28 10:36:01 +0200
commit826907487e2b593f1c54e98b59fe2f6eb8cb6937 (patch)
treede48a91090a240033a6f02eb8e984da133b71025 /src/tokenizer.rs
parent2b4c52758c503b08d3299ad2d1ee369ad5f597f1 (diff)
break!: remove Token::Error
An error isn't a token (in general and also according to the spec). You shouldn't have to filter out errors when you're just interested in tokens but most importantly having errors in the Token enum is annoying when implementing tree construction (since the spec conditions exhaustively cover all Token variants except Token::Error).
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 7e1e85f..270d3d0 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -111,6 +111,11 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
pub fn handle_cdata_open(&mut self, action: CdataAction) {
machine::handle_cdata_open(self, action);
}
+
+ /// Returns a mutable reference to the emitter.
+ pub fn emitter_mut(&mut self) -> &mut E {
+ &mut self.emitter
+ }
}
/// Used by [`Tokenizer::handle_cdata_open`] to determine how to process `<![CDATA[`