aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-01 19:58:33 +0200
committerMartin Fischer <martin@push-f.com>2023-09-03 23:00:05 +0200
commit822cc78d438e8df6a068d811d3cc825b883aba36 (patch)
tree060564fb15d42a911b7e5a6221e6dbe7a4ee5929 /src/tokenizer.rs
parentfd43f18f20afcead7f3976ac893a4b5c4155b41f (diff)
fix: too small char ref error spans
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index f41f5ae..cecc0f6 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -50,6 +50,7 @@ pub struct Tokenizer<R: Reader, O, E: Emitter<O>> {
last_start_tag_name: String,
is_start_tag: bool,
/// * Set to the start offset of `<!doctype` in [`InternalState::MarkupDeclarationOpen`].
+ /// * Set to the offset of `&` in [`InternalState::CharacterReference`].
pub(crate) some_offset: O,
/// This boolean flag exists so that the [`NaiveParser`](crate::NaiveParser) can work with any [`Emitter`]
/// (it cannot call [`Tokenizer::set_state`] using the emitted start tags since they can be of an arbitrary type).
@@ -189,6 +190,14 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
| Error::MissingSemicolonAfterCharacterReference => {
self.reader.position()..self.reader.position()
}
+ Error::AbsenceOfDigitsInNumericCharacterReference
+ | Error::NullCharacterReference
+ | Error::CharacterReferenceOutsideUnicodeRange
+ | Error::SurrogateCharacterReference
+ | Error::NoncharacterCharacterReference
+ | Error::ControlCharacterReference
+ | Error::UnknownNamedCharacterReference => self.some_offset..self.reader.position(),
+
_ => self.reader.position() - 1..self.reader.position(),
};
self.emitter.emit_error(error, span);