aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer/mod.rs')
-rw-r--r--src/tokenizer/mod.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs
index 6793eb2..1809275 100644
--- a/src/tokenizer/mod.rs
+++ b/src/tokenizer/mod.rs
@@ -538,7 +538,10 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
};
if dup {
- self.emit_error(Error::DuplicateAttribute);
+ self.emit_error(Error::DuplicateAttribute {
+ #[cfg(feature = "spans")]
+ span: self.spans.current_attr_name.clone(),
+ });
self.current_attr_name.clear();
self.current_attr_value.clear();
} else {
@@ -598,7 +601,11 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
}
fn emit_error(&mut self, error: Error) {
- self.process_token_and_continue(ParseError(error));
+ self.process_token_and_continue(ParseError {
+ error,
+ #[cfg(feature = "spans")]
+ span: self.spans.current_pos - 1..self.spans.current_pos - 1,
+ });
}
}
//ยง END
@@ -2293,7 +2300,7 @@ mod test {
self.current_str.push('\0');
}
- token @ ParseError(_) => {
+ token @ ParseError { .. } => {
self.push(token, line_number);
}
@@ -2453,7 +2460,7 @@ mod test {
(3, CharacterTokens(c1)),
(
3,
- ParseError(Error::CharRef(CharRefError::InvalidNamedCharRef)),
+ ParseError{error: Error::CharRef(CharRefError::InvalidNamedCharRef), ..},
),
(4, CharacterTokens(c2)),
] if c1 == "&\n" && c2 == "&aamp;\n"