diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/default_emitter.rs | 4 | ||||
-rw-r--r-- | src/emitter.rs | 6 | ||||
-rw-r--r-- | src/tokenizer.rs | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 03652cd..961665c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ * Removed `pop_token` method and `Token` associated type. `std::iter::Iterator` is used instead now. + * Renamed `emit_error` to `report_error`. + ### 0.5.1 - 2023-09-03 #### Features diff --git a/src/default_emitter.rs b/src/default_emitter.rs index c5eb081..16766c8 100644 --- a/src/default_emitter.rs +++ b/src/default_emitter.rs @@ -42,7 +42,7 @@ impl<O> Iterator for DefaultEmitter<O> { } impl<O: Offset> Emitter<O> for DefaultEmitter<O> { - fn emit_error(&mut self, error: Error, span: Range<O>) { + fn report_error(&mut self, error: Error, span: Range<O>) { self.push_error(error, span); } @@ -126,7 +126,7 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { *self_closing = true; } Token::EndTag(_) => { - self.emit_error(Error::EndTagWithTrailingSolidus, slash_span); + self.report_error(Error::EndTagWithTrailingSolidus, slash_span); } _ => { debug_assert!(false); diff --git a/src/emitter.rs b/src/emitter.rs index ccc5a60..2a47f40 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -17,15 +17,15 @@ use crate::Error; /// doesn't mean you need to follow it. For example: /// /// * If your usage of the tokenizer will ignore all errors, none of the error handling and -/// validation requirements apply to you. You can implement `emit_error` as noop and omit all +/// validation requirements apply to you. You can implement `report_error` as noop and omit all /// checks that would emit errors. /// /// * If you don't care about attributes at all, you can make all related methods a noop. #[allow(unused_variables)] // workaround for https://github.com/rust-lang/rust/issues/91074 pub trait Emitter<O> { - /// A (probably recoverable) parsing error has occurred. - fn emit_error(&mut self, error: Error, span: Range<O>); + /// Reports a parse error. + fn report_error(&mut self, error: Error, span: Range<O>); /// The state machine has reached the end of the file. fn emit_eof(&mut self); diff --git a/src/tokenizer.rs b/src/tokenizer.rs index f4c0c48..7e1e85f 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -218,7 +218,7 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> { _ => self.position_before_match..self.reader.position(), }; - self.emitter.emit_error(error, span); + self.emitter.report_error(error, span); } /// Assuming the _current token_ is an end tag, return true if all of these hold. Return false otherwise. |