summaryrefslogtreecommitdiff
path: root/src/tokenizer/char_ref
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-04-08 12:42:04 +0200
committerMartin Fischer <martin@push-f.com>2021-04-08 15:40:48 +0200
commite0bef0105e0cc64bb610889b6921fd94897431d9 (patch)
tree4601b8a86778c10b65d232f99c1f5fd4b289c22a /src/tokenizer/char_ref
parent8bb20dcdeec57b2109b05351663ec1dba9c65f84 (diff)
drop tendril dependency
Diffstat (limited to 'src/tokenizer/char_ref')
-rw-r--r--src/tokenizer/char_ref/mod.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/tokenizer/char_ref/mod.rs b/src/tokenizer/char_ref/mod.rs
index 484a9e1..6daeb13 100644
--- a/src/tokenizer/char_ref/mod.rs
+++ b/src/tokenizer/char_ref/mod.rs
@@ -8,7 +8,6 @@
// except according to those terms.
use super::{TokenSink, Tokenizer};
-use tendril::StrTendril;
use crate::util::buffer_queue::BufferQueue;
use crate::util::str::is_ascii_alnum;
@@ -55,7 +54,7 @@ pub struct CharRefTokenizer {
seen_digit: bool,
hex_marker: Option<char>,
- name_buf_opt: Option<StrTendril>,
+ name_buf_opt: Option<String>,
name_match: Option<(u32, u32)>,
name_len: usize,
}
@@ -84,13 +83,13 @@ impl CharRefTokenizer {
self.result.expect("get_result called before done")
}
- fn name_buf(&self) -> &StrTendril {
+ fn name_buf(&self) -> &str {
self.name_buf_opt
.as_ref()
.expect("name_buf missing in named character reference")
}
- fn name_buf_mut(&mut self) -> &mut StrTendril {
+ fn name_buf_mut(&mut self) -> &mut String {
self.name_buf_opt
.as_mut()
.expect("name_buf missing in named character reference")
@@ -189,7 +188,7 @@ impl CharRefTokenizer {
_ => {
self.state = Named;
- self.name_buf_opt = Some(StrTendril::new());
+ self.name_buf_opt = Some(String::new());
Progress
},
}
@@ -265,9 +264,9 @@ impl CharRefTokenizer {
tokenizer: &mut Tokenizer<Sink>,
input: &mut BufferQueue,
) -> Status {
- let mut unconsume = StrTendril::from_char('#');
+ let mut unconsume = String::from('#');
match self.hex_marker {
- Some(c) => unconsume.push_char(c),
+ Some(c) => unconsume.push(c),
None => (),
}
@@ -316,7 +315,7 @@ impl CharRefTokenizer {
input: &mut BufferQueue,
) -> Status {
let c = unwrap_or_return!(tokenizer.get_char(input), Stuck);
- self.name_buf_mut().push_char(c);
+ self.name_buf_mut().push(c);
self.finish_named(tokenizer, input, Some(c))
}
@@ -411,7 +410,7 @@ impl CharRefTokenizer {
self.unconsume_name(input);
self.finish_none()
} else {
- input.push_front(StrTendril::from_slice(&self.name_buf()[name_len..]));
+ input.push_front(String::from(&self.name_buf()[name_len..]));
self.result = Some(CharRef {
chars: [from_u32(c1).unwrap(), from_u32(c2).unwrap()],
num_chars: if c2 == 0 { 1 } else { 2 },
@@ -428,7 +427,7 @@ impl CharRefTokenizer {
input: &mut BufferQueue,
) -> Status {
let c = unwrap_or_return!(tokenizer.get_char(input), Stuck);
- self.name_buf_mut().push_char(c);
+ self.name_buf_mut().push(c);
match c {
_ if is_ascii_alnum(c) => return Progress,
';' => self.emit_name_error(tokenizer),
@@ -462,7 +461,7 @@ impl CharRefTokenizer {
},
Octothorpe => {
- input.push_front(StrTendril::from_slice("#"));
+ input.push_front(String::from("#"));
tokenizer.emit_error(Borrowed("EOF after '#' in character reference"));
self.finish_none();
},