From 7493f019cd7991c336324711af2247eda3851ec5 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Thu, 28 Sep 2023 07:10:57 +0200 Subject: break!: rename Emitter::emit_error to report_error --- src/default_emitter.rs | 4 ++-- src/emitter.rs | 6 +++--- src/tokenizer.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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 Iterator for DefaultEmitter { } impl Emitter for DefaultEmitter { - fn emit_error(&mut self, error: Error, span: Range) { + fn report_error(&mut self, error: Error, span: Range) { self.push_error(error, span); } @@ -126,7 +126,7 @@ impl Emitter for DefaultEmitter { *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 { - /// A (probably recoverable) parsing error has occurred. - fn emit_error(&mut self, error: Error, span: Range); + /// Reports a parse error. + fn report_error(&mut self, error: Error, span: Range); /// 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, O: Offset, E: Emitter> Tokenizer { _ => 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. -- cgit v1.2.3