aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-13 20:42:02 +0200
committerMartin Fischer <martin@push-f.com>2023-08-19 13:41:55 +0200
commit26cd63394f640920db4ea9402d77cec1358fb098 (patch)
tree4badbe32b41dce80c812ea08839f7367150f9e0c
parent1edeab2b7b7d039fd9dd83bc14255bddff47618c (diff)
break!: replace set_doctype_* methods with init_ methods
-rw-r--r--src/emitter.rs16
-rw-r--r--src/machine.rs24
2 files changed, 20 insertions, 20 deletions
diff --git a/src/emitter.rs b/src/emitter.rs
index 63ef4b1..cf22a44 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -137,15 +137,15 @@ pub trait Emitter<O> {
/// If there is no current attribute, this method may panic.
fn push_attribute_value(&mut self, s: &str);
- /// Assuming the _current token_ is a doctype, set its "public identifier" to the given string.
+ /// Assuming the _current token_ is a doctype, set its "public identifier" to the empty string.
///
/// If the current token is not a doctype, this method may panic.
- fn set_doctype_public_identifier(&mut self, value: &str);
+ fn init_doctype_public_identifier(&mut self);
- /// Assuming the _current token_ is a doctype, set its "system identifier" to the given string.
+ /// Assuming the _current token_ is a doctype, set its "system identifier" to the empty string.
///
/// If the current token is not a doctype, this method may panic.
- fn set_doctype_system_identifier(&mut self, value: &str);
+ fn init_doctype_system_identifier(&mut self);
/// Assuming the _current token_ is a doctype, append a string to its "public identifier" to the given string.
///
@@ -403,24 +403,24 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> {
let current_attr = self.current_attribute.as_mut().unwrap();
current_attr.1.value.push_str(s);
}
- fn set_doctype_public_identifier(&mut self, value: &str) {
+ fn init_doctype_public_identifier(&mut self) {
if let Some(Token::Doctype(Doctype {
ref mut public_identifier,
..
})) = self.current_token
{
- *public_identifier = Some(value.to_owned());
+ *public_identifier = Some("".to_owned());
} else {
debug_assert!(false);
}
}
- fn set_doctype_system_identifier(&mut self, value: &str) {
+ fn init_doctype_system_identifier(&mut self) {
if let Some(Token::Doctype(Doctype {
ref mut system_identifier,
..
})) = self.current_token
{
- *system_identifier = Some(value.to_owned());
+ *system_identifier = Some("".to_owned());
} else {
debug_assert!(false);
}
diff --git a/src/machine.rs b/src/machine.rs
index ccd3052..4a9034e 100644
--- a/src/machine.rs
+++ b/src/machine.rs
@@ -1266,13 +1266,13 @@ where
}
Some('"') => {
slf.emit_error(Error::MissingWhitespaceAfterDoctypePublicKeyword);
- slf.emitter.set_doctype_public_identifier("");
+ slf.emitter.init_doctype_public_identifier();
slf.state = State::DoctypePublicIdentifierDoubleQuoted;
Ok(ControlToken::Continue)
}
Some('\'') => {
slf.emit_error(Error::MissingWhitespaceAfterDoctypePublicKeyword);
- slf.emitter.set_doctype_public_identifier("");
+ slf.emitter.init_doctype_public_identifier();
slf.state = State::DoctypePublicIdentifierSingleQuoted;
Ok(ControlToken::Continue)
}
@@ -1300,12 +1300,12 @@ where
State::BeforeDoctypePublicIdentifier => match slf.read_char()? {
Some(whitespace_pat!()) => Ok(ControlToken::Continue),
Some('"') => {
- slf.emitter.set_doctype_public_identifier("");
+ slf.emitter.init_doctype_public_identifier();
slf.state = State::DoctypePublicIdentifierDoubleQuoted;
Ok(ControlToken::Continue)
}
Some('\'') => {
- slf.emitter.set_doctype_public_identifier("");
+ slf.emitter.init_doctype_public_identifier();
slf.state = State::DoctypePublicIdentifierSingleQuoted;
Ok(ControlToken::Continue)
}
@@ -1398,13 +1398,13 @@ where
}
Some('"') => {
slf.emit_error(Error::MissingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierDoubleQuoted;
Ok(ControlToken::Continue)
}
Some('\'') => {
slf.emit_error(Error::MissingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierSingleQuoted;
Ok(ControlToken::Continue)
}
@@ -1430,12 +1430,12 @@ where
Ok(ControlToken::Continue)
}
Some('"') => {
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierDoubleQuoted;
Ok(ControlToken::Continue)
}
Some('\'') => {
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierSingleQuoted;
Ok(ControlToken::Continue)
}
@@ -1460,13 +1460,13 @@ where
}
Some('"') => {
slf.emit_error(Error::MissingWhitespaceAfterDoctypeSystemKeyword);
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierDoubleQuoted;
Ok(ControlToken::Continue)
}
Some('\'') => {
slf.emit_error(Error::MissingWhitespaceAfterDoctypeSystemKeyword);
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierSingleQuoted;
Ok(ControlToken::Continue)
}
@@ -1494,12 +1494,12 @@ where
State::BeforeDoctypeSystemIdentifier => match slf.read_char()? {
Some(whitespace_pat!()) => Ok(ControlToken::Continue),
Some('"') => {
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierDoubleQuoted;
Ok(ControlToken::Continue)
}
Some('\'') => {
- slf.emitter.set_doctype_system_identifier("");
+ slf.emitter.init_doctype_system_identifier();
slf.state = State::DoctypeSystemIdentifierSingleQuoted;
Ok(ControlToken::Continue)
}