aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs2
-rw-r--r--src/tokenizer.rs20
2 files changed, 12 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index f3e0431..2125776 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,7 +13,7 @@ mod tokenizer;
mod utils;
#[cfg(feature = "integration-tests")]
-pub use utils::State;
+pub use utils::State as InternalState;
pub use emitter::{DefaultEmitter, Doctype, Emitter, EndTag, StartTag, Token};
pub use error::Error;
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index ec3ae44..b09e030 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -1,5 +1,7 @@
use crate::machine;
-use crate::utils::{control_pat, noncharacter_pat, surrogate_pat, ControlToken, State};
+use crate::utils::{
+ control_pat, noncharacter_pat, surrogate_pat, ControlToken, State as InternalState,
+};
use crate::{DefaultEmitter, Emitter, Error, Never, Readable, Reader};
// this is a stack that can hold 0 to 2 Ts
@@ -31,13 +33,13 @@ impl<T: Copy> Stack2<T> {
/// A HTML tokenizer. See crate-level docs for basic usage.
pub struct Tokenizer<R: Reader, E: Emitter = DefaultEmitter> {
eof: bool,
- pub(crate) state: State,
+ pub(crate) state: InternalState,
pub(crate) emitter: E,
pub(crate) temporary_buffer: String,
reader: R,
to_reconsume: Stack2<Option<char>>,
pub(crate) character_reference_code: u32,
- pub(crate) return_state: Option<State>,
+ pub(crate) return_state: Option<InternalState>,
}
impl<R: Reader> Tokenizer<R> {
@@ -61,7 +63,7 @@ impl<R: Reader, E: Emitter> Tokenizer<R, E> {
pub fn new_with_emitter<'a, S: Readable<'a, Reader = R>>(input: S, emitter: E) -> Self {
Tokenizer {
eof: false,
- state: State::Data,
+ state: InternalState::Data,
emitter,
temporary_buffer: String::new(),
to_reconsume: Stack2::default(),
@@ -75,7 +77,7 @@ impl<R: Reader, E: Emitter> Tokenizer<R, E> {
///
/// Only available with the `integration-tests` feature which is not public API.
#[cfg(feature = "integration-tests")]
- pub fn set_state(&mut self, state: State) {
+ pub fn set_internal_state(&mut self, state: InternalState) {
self.state = state;
}
@@ -84,7 +86,7 @@ impl<R: Reader, E: Emitter> Tokenizer<R, E> {
///
/// This tokenizer never gets into that state naturally.
pub fn set_plaintext_state(&mut self) {
- self.state = State::PlainText;
+ self.state = InternalState::PlainText;
}
/// Test-internal function to override internal state.
@@ -176,9 +178,9 @@ impl<R: Reader, E: Emitter> Tokenizer<R, E> {
matches!(
self.return_state,
Some(
- State::AttributeValueDoubleQuoted
- | State::AttributeValueSingleQuoted
- | State::AttributeValueUnquoted
+ InternalState::AttributeValueDoubleQuoted
+ | InternalState::AttributeValueSingleQuoted
+ | InternalState::AttributeValueUnquoted
)
)
}