From 202b5782ebc9661420623878898bc06ce861051b Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 27 Sep 2023 17:28:20 +0200 Subject: chore: move emit_error method up --- src/default_emitter.rs | 8 ++++---- src/emitter.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/default_emitter.rs b/src/default_emitter.rs index 7ef96ec..c5eb081 100644 --- a/src/default_emitter.rs +++ b/src/default_emitter.rs @@ -42,14 +42,14 @@ impl Iterator for DefaultEmitter { } impl Emitter for DefaultEmitter { - fn emit_eof(&mut self) { - self.flush_current_characters(); - } - fn emit_error(&mut self, error: Error, span: Range) { self.push_error(error, span); } + fn emit_eof(&mut self) { + self.flush_current_characters(); + } + fn emit_string(&mut self, s: &str) { self.current_characters.push_str(s); } diff --git a/src/emitter.rs b/src/emitter.rs index 923da1c..ccc5a60 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -24,12 +24,12 @@ use crate::Error; #[allow(unused_variables)] // workaround for https://github.com/rust-lang/rust/issues/91074 pub trait Emitter { - /// The state machine has reached the end of the file. - fn emit_eof(&mut self); - /// A (probably recoverable) parsing error has occurred. fn emit_error(&mut self, error: Error, span: Range); + /// The state machine has reached the end of the file. + fn emit_eof(&mut self); + /// Emit a bunch of plain characters as character tokens. fn emit_string(&mut self, c: &str); -- cgit v1.2.3