Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix #133 <unicode-range> parsing corner case
Unexpected tokens after U+<integer> are not an error,
just not part of the <unicode-range>.
  • Loading branch information
SimonSapin committed Apr 11, 2017
commit 8f84448302a5eab8e91839a2198255a0d8e130a7
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "cssparser"
version = "0.12.1"
version = "0.12.2"
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]

description = "Rust implementation of CSS Syntax Level 3"
Expand Down
4 changes: 4 additions & 0 deletions src/css-parsing-tests/urange.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
null
],

"U+2 , U+???", [
[2, 2],
[0, 4095]
],

"u+20-3F, u+3F-3F, u+3F-3E, U+0-110000, U+0-10FFFF, U+100000-2, U+1000000-2, U+10-200000", [
[32, 63],
Expand Down
6 changes: 2 additions & 4 deletions src/unicode_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ fn concatenate_tokens(input: &mut Parser, remaining: &mut &mut [u8]) -> Result<(
let int_value = positive_integer_with_plus_sign(value)?;
write!(remaining, "{}", int_value)?;

let after_number = input.position();
match input.next_including_whitespace() {
// EOF here is fine
Err(()) => {},

Ok(Token::Delim('?')) => {
// If `remaining` is already full, `int_value` has too many digits
// so we can use `result?` Rust syntax.
Expand All @@ -105,7 +103,7 @@ fn concatenate_tokens(input: &mut Parser, remaining: &mut &mut [u8]) -> Result<(
write!(remaining, "{}", int_value)?
}

_ => return Err(Error)
_ => input.reset(after_number)
}
}

Expand Down