summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-09 21:42:17 +0200
committerMartin Fischer <martin@push-f.com>2023-09-28 10:36:08 +0200
commit2c73901944e2d22747a2a4ebcc11881b3f8c2ad3 (patch)
tree310726d807df6f6ae6911033dd31e5bd139a0559
parent2a0c35906d96203a3dc2b41cf8a1be74e025b285 (diff)
refactor: move utils module under tokenizer::machine
-rw-r--r--src/lib.rs3
-rw-r--r--src/tokenizer.rs4
-rw-r--r--src/tokenizer/machine.rs8
-rw-r--r--src/tokenizer/machine/utils.rs (renamed from src/utils.rs)0
4 files changed, 8 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index baacb38..3c7e77b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,7 +13,6 @@ mod entities;
mod error;
mod naive_parser;
mod tokenizer;
-mod utils;
/// Types for HTML attributes.
pub mod attr {
@@ -33,7 +32,7 @@ pub use token::{Comment, Doctype, EndTag, StartTag, Token};
pub use tokenizer::{CdataAction, Event, State, Tokenizer};
#[cfg(feature = "integration-tests")]
-pub use utils::State as InternalState;
+pub use tokenizer::InternalState;
/// Relative links in the README.md don't work in rustdoc, so we have to override them.
macro_rules! file_url {
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 7e05477..6f698f6 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -3,12 +3,12 @@ mod machine;
use crate::naive_parser::naive_next_state;
use crate::offset::{Offset, Position};
use crate::reader::{IntoReader, Reader};
-use crate::utils::{control_pat, noncharacter_pat, surrogate_pat};
use crate::{Emitter, Error};
+use machine::utils::{control_pat, noncharacter_pat, surrogate_pat};
use machine::ControlToken;
#[cfg(feature = "integration-tests")]
-use crate::utils::State as InternalState;
+pub use machine::State as InternalState;
// this is a stack that can hold 0 to 2 Ts
#[derive(Debug, Default, Clone, Copy)]
diff --git a/src/tokenizer/machine.rs b/src/tokenizer/machine.rs
index 07d4c05..fc31a42 100644
--- a/src/tokenizer/machine.rs
+++ b/src/tokenizer/machine.rs
@@ -1,13 +1,15 @@
+pub(super) mod utils;
+
use crate::entities::try_read_character_reference;
use crate::offset::{Offset, Position};
use crate::token::AttrValueSyntax;
use crate::tokenizer::CdataAction;
-use crate::utils::{
+use crate::{reader::Reader, Emitter, Error, Tokenizer};
+use utils::{
ascii_digit_pat, control_pat, ctostr, noncharacter_pat, surrogate_pat, whitespace_pat,
};
-use crate::{reader::Reader, Emitter, Error, Tokenizer};
-pub use crate::utils::State;
+pub use utils::State;
pub enum ControlToken {
Eof,
diff --git a/src/utils.rs b/src/tokenizer/machine/utils.rs
index 7d220cf..7d220cf 100644
--- a/src/utils.rs
+++ b/src/tokenizer/machine/utils.rs