diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/emitter.rs | 16 | ||||
| -rw-r--r-- | src/tokenizer.rs | 18 | 
2 files changed, 15 insertions, 19 deletions
| diff --git a/src/emitter.rs b/src/emitter.rs index e872b1f..fba1f6a 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -36,12 +36,6 @@ pub trait Emitter<R> {      /// yields when used as an iterator.      type Token; -    /// Set the name of the _last start tag_. -    /// -    /// This is primarily for testing purposes. This is *not* supposed to override the tag name of -    /// the current tag. -    fn set_last_start_tag(&mut self, last_start_tag: Option<&str>); -      /// The state machine has reached the end of the file. It will soon call `pop_token` for the      /// last time.      fn emit_eof(&mut self); @@ -252,16 +246,16 @@ impl<R, S: Span<R>> DefaultEmitter<R, S> {          // that exact          self.emitted_tokens.push_front(Token::Error { error, span });      } -} - -impl<R, S: Span<R>> Emitter<R> for DefaultEmitter<R, S> { -    type Token = Token<S>; -    fn set_last_start_tag(&mut self, last_start_tag: Option<&str>) { +    pub(crate) fn set_last_start_tag(&mut self, last_start_tag: Option<&str>) {          self.last_start_tag.clear();          self.last_start_tag              .push_str(last_start_tag.unwrap_or_default());      } +} + +impl<R, S: Span<R>> Emitter<R> for DefaultEmitter<R, S> { +    type Token = Token<S>;      fn emit_eof(&mut self) {          self.flush_current_characters(); diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 6e928e9..44793a5 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -128,14 +128,6 @@ impl<R: Reader, E: Emitter<R>> Tokenizer<R, E> {          self.emitter.emit_error(error, &self.reader);      } -    /// Test-internal function to override internal state. -    /// -    /// Only available with the `integration-tests` feature which is not public API. -    #[cfg(feature = "integration-tests")] -    pub fn set_last_start_tag(&mut self, last_start_tag: Option<&str>) { -        self.emitter.set_last_start_tag(last_start_tag); -    } -      #[inline]      pub(crate) fn unread_char(&mut self, c: Option<char>) {          self.to_reconsume.push(c); @@ -306,3 +298,13 @@ impl<R: Reader<Error = Never>, E: Emitter<R>> DerefMut for InfallibleTokenizer<R          &mut self.0      }  } + +impl<S: crate::spans::Span<R>, R: Reader> Tokenizer<R, DefaultEmitter<R, S>> { +    /// Test-internal function to override internal state. +    /// +    /// Only available with the `integration-tests` feature which is not public API. +    #[cfg(feature = "integration-tests")] +    pub fn set_last_start_tag(&mut self, last_start_tag: &str) { +        self.emitter.set_last_start_tag(Some(last_start_tag)); +    } +} | 
