зеркало из https://github.com/mozilla/gecko-dev.git
No bug - Revendor rust dependencies
This commit is contained in:
Родитель
4f4b90db1f
Коммит
88c4d2a154
|
@ -1 +1 @@
|
|||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"7d35a8de9f311d00bd9dfa96e533e3db0584f914b1798d4937ddf1ff6baff74e","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"2c84b8ca5884347d2007f49aecbd85b4c7582085526e2704399817249996e19b","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"17f014269795809cbbee0462eb1a0ecfb73a6e9f3e60d19971430cfc9662911a","src/parser.rs":"69ef59a1c28e49b89cfc67effc7408e59af63c416128889b5e8d48022e17c06d","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"4b5e4f6fa209bfe4ff8e44fdf10535a5eba5b7b644afac7ee32b60923c23460c","src/tests.rs":"3572f340d9e38b3482f5f8e6bdbabc99c8ff9caeb8f92cdb7d266a1e5110abb1","src/tokenizer.rs":"c46d540cf589de8a2a2a0d918575a257de4d6a55af78e87b0d9c1345032b80ef","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"89af8ca7a36c8c591a9ff56ffb88ea2597095d8c1b834af9ca5be5032dcfe06e"}
|
||||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"fac23b751b4a88d7102e488a4417d695099287c6c88541e64f11dd8bb52d710f","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"2c84b8ca5884347d2007f49aecbd85b4c7582085526e2704399817249996e19b","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"c92cdb9dcabcc63de005478ca770858b330f02ee712f9fd21b31eeb7472df72d","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"a0433a3cf2147e09a8b2471f50ca136d3494d7fc764417b43dc146e2dd5a09ff","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"0450aa21ecc4639cbe350a143598d570ed9d2b03ac21b9cb795577e0f92f3be6","src/parser.rs":"3533ece7309e694eccf4858435ad090fc6bf98123d443691572931c4323f44d4","src/rules_and_declarations.rs":"eda11baa27c80df932e43460ec6864ff8c3367aaf7673c15410443097efe2506","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"ccbbd8601646798f87b57877135346bc270736560d2c85b5e5ae8cd6492efd65","src/tests.rs":"e8c2593ee6e93e10fd2bb6a9b8b872d280577ba132c04a533f76c58c7233bf70","src/tokenizer.rs":"c46d540cf589de8a2a2a0d918575a257de4d6a55af78e87b0d9c1345032b80ef","src/unicode_range.rs":"c1c4ed2493e09d248c526ce1ef8575a5f8258da3962b64ffc814ef3bdf9780d0"},"package":"44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "cssparser"
|
||||
version = "0.21.3"
|
||||
version = "0.22.0"
|
||||
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
|
||||
build = "build.rs"
|
||||
exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"]
|
||||
|
@ -22,21 +22,18 @@ readme = "README.md"
|
|||
keywords = ["css", "syntax", "parser"]
|
||||
license = "MPL-2.0"
|
||||
repository = "https://github.com/servo/rust-cssparser"
|
||||
[dependencies.matches]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.phf]
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.cssparser-macros]
|
||||
[dependencies.itoa]
|
||||
version = "0.3"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.dtoa-short]
|
||||
version = "0.3"
|
||||
[dependencies.procedural-masquerade]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.matches]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.heapsize]
|
||||
version = ">= 0.3, < 0.5"
|
||||
|
@ -45,19 +42,22 @@ optional = true
|
|||
[dependencies.smallvec]
|
||||
version = "0.4.3"
|
||||
|
||||
[dependencies.procedural-masquerade]
|
||||
version = "0.1"
|
||||
[dependencies.phf]
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.itoa]
|
||||
[dependencies.cssparser-macros]
|
||||
version = "0.3"
|
||||
|
||||
[dependencies.dtoa-short]
|
||||
version = "0.3"
|
||||
[dev-dependencies.rustc-serialize]
|
||||
version = "0.3"
|
||||
|
||||
[dev-dependencies.encoding_rs]
|
||||
version = "0.7"
|
||||
|
||||
[dev-dependencies.difference]
|
||||
version = "1.0"
|
||||
|
||||
[dev-dependencies.encoding_rs]
|
||||
version = "0.7"
|
||||
[build-dependencies.syn]
|
||||
version = "0.11"
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ impl Color {
|
|||
/// FIXME(#2) Deprecated CSS2 System Colors are not supported yet.
|
||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Color, BasicParseError<'i>> {
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
let location = input.current_source_location();
|
||||
let token = input.next()?.clone();
|
||||
match token {
|
||||
Token::Hash(ref value) | Token::IDHash(ref value) => {
|
||||
|
@ -158,12 +159,11 @@ impl Color {
|
|||
Token::Ident(ref value) => parse_color_keyword(&*value),
|
||||
Token::Function(ref name) => {
|
||||
return input.parse_nested_block(|arguments| {
|
||||
parse_color_function(&*name, arguments)
|
||||
.map_err(|e| ParseError::Basic(e))
|
||||
parse_color_function(&*name, arguments).map_err(|e| e.into())
|
||||
}).map_err(ParseError::<()>::basic);
|
||||
}
|
||||
_ => Err(())
|
||||
}.map_err(|()| BasicParseError::UnexpectedToken(token))
|
||||
}.map_err(|()| location.new_basic_unexpected_token_error(token))
|
||||
}
|
||||
|
||||
/// Parse a color hash, without the leading '#' character.
|
||||
|
@ -424,7 +424,7 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R
|
|||
let (red, green, blue, uses_commas) = match_ignore_ascii_case! { name,
|
||||
"rgb" | "rgba" => parse_rgb_components_rgb(arguments)?,
|
||||
"hsl" | "hsla" => parse_rgb_components_hsl(arguments)?,
|
||||
_ => return Err(BasicParseError::UnexpectedToken(Token::Ident(name.to_owned().into()))),
|
||||
_ => return Err(arguments.new_basic_unexpected_token_error(Token::Ident(name.to_owned().into()))),
|
||||
};
|
||||
|
||||
let alpha = if !arguments.is_exhausted() {
|
||||
|
@ -433,6 +433,7 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R
|
|||
} else {
|
||||
arguments.expect_delim('/')?;
|
||||
};
|
||||
let location = arguments.current_source_location();
|
||||
match *arguments.next()? {
|
||||
Token::Number { value: v, .. } => {
|
||||
clamp_unit_f32(v)
|
||||
|
@ -441,7 +442,7 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R
|
|||
clamp_unit_f32(v)
|
||||
}
|
||||
ref t => {
|
||||
return Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
return Err(location.new_basic_unexpected_token_error(t.clone()))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -462,6 +463,8 @@ fn parse_rgb_components_rgb<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u
|
|||
|
||||
// Either integers or percentages, but all the same type.
|
||||
// https://drafts.csswg.org/css-color/#rgb-functions
|
||||
// FIXME: remove .clone() when lifetimes are non-lexical.
|
||||
let location = arguments.current_source_location();
|
||||
match arguments.next()?.clone() {
|
||||
Token::Number { value: v, .. } => {
|
||||
red = clamp_floor_256_f32(v);
|
||||
|
@ -471,7 +474,7 @@ fn parse_rgb_components_rgb<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u
|
|||
uses_commas = true;
|
||||
arguments.expect_number()?
|
||||
}
|
||||
t => return Err(BasicParseError::UnexpectedToken(t))
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
});
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
|
@ -486,14 +489,14 @@ fn parse_rgb_components_rgb<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u
|
|||
uses_commas = true;
|
||||
arguments.expect_percentage()?
|
||||
}
|
||||
t => return Err(BasicParseError::UnexpectedToken(t))
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
});
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
}
|
||||
blue = clamp_unit_f32(arguments.expect_percentage()?);
|
||||
}
|
||||
t => return Err(BasicParseError::UnexpectedToken(t))
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
};
|
||||
return Ok((red, green, blue, uses_commas));
|
||||
}
|
||||
|
@ -503,6 +506,7 @@ fn parse_rgb_components_hsl<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u
|
|||
let mut uses_commas = false;
|
||||
// Hue given as an angle
|
||||
// https://drafts.csswg.org/css-values/#angles
|
||||
let location = arguments.current_source_location();
|
||||
let hue_degrees = match *arguments.next()? {
|
||||
Token::Number { value: v, .. } => v,
|
||||
Token::Dimension { value: v, ref unit, .. } => {
|
||||
|
@ -511,10 +515,10 @@ fn parse_rgb_components_hsl<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u
|
|||
"grad" => v * 360. / 400.,
|
||||
"rad" => v * 360. / (2. * PI),
|
||||
"turn" => v * 360.,
|
||||
_ => return Err(BasicParseError::UnexpectedToken(Token::Ident(unit.clone()))),
|
||||
_ => return Err(location.new_basic_unexpected_token_error(Token::Ident(unit.clone()))),
|
||||
}
|
||||
}
|
||||
ref t => return Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
ref t => return Err(location.new_basic_unexpected_token_error(t.clone()))
|
||||
};
|
||||
// Subtract an integer before rounding, to avoid some rounding errors:
|
||||
let hue_normalized_degrees = hue_degrees - 360. * (hue_degrees / 360.).floor();
|
||||
|
@ -522,13 +526,14 @@ fn parse_rgb_components_hsl<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u
|
|||
|
||||
// Saturation and lightness are clamped to 0% ... 100%
|
||||
// https://drafts.csswg.org/css-color/#the-hsl-notation
|
||||
let location = arguments.current_source_location();
|
||||
let saturation = match arguments.next()?.clone() {
|
||||
Token::Percentage { unit_value, .. } => unit_value,
|
||||
Token::Comma => {
|
||||
uses_commas = true;
|
||||
arguments.expect_percentage()?
|
||||
}
|
||||
t => return Err(BasicParseError::UnexpectedToken(t))
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
};
|
||||
let saturation = saturation.max(0.).min(1.);
|
||||
|
||||
|
|
|
@ -86,13 +86,14 @@ pub use cssparser_macros::*;
|
|||
pub use tokenizer::{Token, SourcePosition, SourceLocation};
|
||||
pub use rules_and_declarations::{parse_important};
|
||||
pub use rules_and_declarations::{DeclarationParser, DeclarationListParser, parse_one_declaration};
|
||||
pub use rules_and_declarations::{RuleListParser, parse_one_rule, PreciseParseError};
|
||||
pub use rules_and_declarations::{RuleListParser, parse_one_rule};
|
||||
pub use rules_and_declarations::{AtRuleType, QualifiedRuleParser, AtRuleParser};
|
||||
pub use from_bytes::{stylesheet_encoding, EncodingSupport};
|
||||
pub use color::{RGBA, Color, parse_color_keyword};
|
||||
pub use nth::parse_nth;
|
||||
pub use serializer::{ToCss, CssStringWriter, serialize_identifier, serialize_string, TokenSerializationType};
|
||||
pub use parser::{Parser, Delimiter, Delimiters, ParserState, ParseError, BasicParseError, ParserInput};
|
||||
pub use parser::{Parser, Delimiter, Delimiters, ParserState, ParserInput};
|
||||
pub use parser::{ParseError, ParseErrorKind, BasicParseError, BasicParseErrorKind};
|
||||
pub use unicode_range::UnicodeRange;
|
||||
pub use cow_rc_str::CowRcStr;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ pub fn parse_nth<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(i32, i32), Basic
|
|||
"n-" => Ok(try!(parse_signless_b(input, a, -1))),
|
||||
_ => match parse_n_dash_digits(&*unit) {
|
||||
Ok(b) => Ok((a, b)),
|
||||
Err(()) => Err(BasicParseError::UnexpectedToken(Token::Ident(unit.clone())))
|
||||
Err(()) => Err(input.new_basic_unexpected_token_error(Token::Ident(unit.clone())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ pub fn parse_nth<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(i32, i32), Basic
|
|||
};
|
||||
match parse_n_dash_digits(slice) {
|
||||
Ok(b) => Ok((a, b)),
|
||||
Err(()) => Err(BasicParseError::UnexpectedToken(Token::Ident(value.clone())))
|
||||
Err(()) => Err(input.new_basic_unexpected_token_error(Token::Ident(value.clone())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,13 +57,13 @@ pub fn parse_nth<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(i32, i32), Basic
|
|||
"n-" => parse_signless_b(input, 1, -1),
|
||||
_ => match parse_n_dash_digits(&*value) {
|
||||
Ok(b) => Ok((1, b)),
|
||||
Err(()) => Err(BasicParseError::UnexpectedToken(Token::Ident(value.clone())))
|
||||
Err(()) => Err(input.new_basic_unexpected_token_error(Token::Ident(value.clone())))
|
||||
}
|
||||
}
|
||||
}
|
||||
token => Err(BasicParseError::UnexpectedToken(token)),
|
||||
token => Err(input.new_basic_unexpected_token_error(token)),
|
||||
},
|
||||
token => Err(BasicParseError::UnexpectedToken(token)),
|
||||
token => Err(input.new_basic_unexpected_token_error(token)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,10 @@ fn parse_b<'i, 't>(input: &mut Parser<'i, 't>, a: i32) -> Result<(i32, i32), Bas
|
|||
}
|
||||
|
||||
fn parse_signless_b<'i, 't>(input: &mut Parser<'i, 't>, a: i32, b_sign: i32) -> Result<(i32, i32), BasicParseError<'i>> {
|
||||
match *input.next()? {
|
||||
// FIXME: remove .clone() when lifetimes are non-lexical.
|
||||
match input.next()?.clone() {
|
||||
Token::Number { has_sign: false, int_value: Some(b), .. } => Ok((a, b_sign * b)),
|
||||
ref token => Err(BasicParseError::UnexpectedToken(token.clone()))
|
||||
token => Err(input.new_basic_unexpected_token_error(token))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,44 +40,114 @@ impl ParserState {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// The funamental parsing errors that can be triggered by built-in parsing routines.
|
||||
/// Details about a `BasicParseError`
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum BasicParseError<'a> {
|
||||
pub enum BasicParseErrorKind<'i> {
|
||||
/// An unexpected token was encountered.
|
||||
UnexpectedToken(Token<'a>),
|
||||
UnexpectedToken(Token<'i>),
|
||||
/// The end of the input was encountered unexpectedly.
|
||||
EndOfInput,
|
||||
/// An `@` rule was encountered that was invalid.
|
||||
AtRuleInvalid(CowRcStr<'a>),
|
||||
AtRuleInvalid(CowRcStr<'i>),
|
||||
/// The body of an '@' rule was invalid.
|
||||
AtRuleBodyInvalid,
|
||||
/// A qualified rule was encountered that was invalid.
|
||||
QualifiedRuleInvalid,
|
||||
}
|
||||
|
||||
impl<'a, T> From<BasicParseError<'a>> for ParseError<'a, T> {
|
||||
/// The funamental parsing errors that can be triggered by built-in parsing routines.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct BasicParseError<'i> {
|
||||
/// Details of this error
|
||||
pub kind: BasicParseErrorKind<'i>,
|
||||
/// Location where this error occurred
|
||||
pub location: SourceLocation,
|
||||
}
|
||||
|
||||
impl<'i, T> From<BasicParseError<'i>> for ParseError<'i, T> {
|
||||
#[inline]
|
||||
fn from(this: BasicParseError<'a>) -> ParseError<'a, T> {
|
||||
ParseError::Basic(this)
|
||||
fn from(this: BasicParseError<'i>) -> ParseError<'i, T> {
|
||||
ParseError {
|
||||
kind: ParseErrorKind::Basic(this.kind),
|
||||
location: this.location,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceLocation {
|
||||
/// Create a new BasicParseError at this location for an unexpected token
|
||||
#[inline]
|
||||
pub fn new_basic_unexpected_token_error<'i>(self, token: Token<'i>) -> BasicParseError<'i> {
|
||||
BasicParseError {
|
||||
kind: BasicParseErrorKind::UnexpectedToken(token),
|
||||
location: self,
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new ParseError at this location for an unexpected token
|
||||
#[inline]
|
||||
pub fn new_unexpected_token_error<'i, E>(self, token: Token<'i>) -> ParseError<'i, E> {
|
||||
ParseError {
|
||||
kind: ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(token)),
|
||||
location: self,
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new custom ParseError at this location
|
||||
#[inline]
|
||||
pub fn new_custom_error<'i, E1: Into<E2>, E2>(self, error: E1) -> ParseError<'i, E2> {
|
||||
ParseError {
|
||||
kind: ParseErrorKind::Custom(error.into()),
|
||||
location: self,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Details of a `ParseError`
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum ParseErrorKind<'i, T: 'i> {
|
||||
/// A fundamental parse error from a built-in parsing routine.
|
||||
Basic(BasicParseErrorKind<'i>),
|
||||
/// A parse error reported by downstream consumer code.
|
||||
Custom(T),
|
||||
}
|
||||
|
||||
impl<'i, T> ParseErrorKind<'i, T> {
|
||||
/// Like `std::convert::Into::into`
|
||||
pub fn into<U>(self) -> ParseErrorKind<'i, U> where T: Into<U> {
|
||||
match self {
|
||||
ParseErrorKind::Basic(basic) => ParseErrorKind::Basic(basic),
|
||||
ParseErrorKind::Custom(custom) => ParseErrorKind::Custom(custom.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Extensible parse errors that can be encountered by client parsing implementations.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum ParseError<'a, T: 'a> {
|
||||
/// A fundamental parse error from a built-in parsing routine.
|
||||
Basic(BasicParseError<'a>),
|
||||
/// A parse error reported by downstream consumer code.
|
||||
Custom(T),
|
||||
pub struct ParseError<'i, E: 'i> {
|
||||
/// Details of this error
|
||||
pub kind: ParseErrorKind<'i, E>,
|
||||
/// Location where this error occurred
|
||||
pub location: SourceLocation,
|
||||
}
|
||||
|
||||
impl<'a, T> ParseError<'a, T> {
|
||||
impl<'i, T> ParseError<'i, T> {
|
||||
/// Extract the fundamental parse error from an extensible error.
|
||||
pub fn basic(self) -> BasicParseError<'a> {
|
||||
match self {
|
||||
ParseError::Basic(e) => e,
|
||||
ParseError::Custom(_) => panic!("Not a basic parse error"),
|
||||
pub fn basic(self) -> BasicParseError<'i> {
|
||||
match self.kind {
|
||||
ParseErrorKind::Basic(kind) => BasicParseError {
|
||||
kind: kind,
|
||||
location: self.location,
|
||||
},
|
||||
ParseErrorKind::Custom(_) => panic!("Not a basic parse error"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Like `std::convert::Into::into`
|
||||
pub fn into<U>(self) -> ParseError<'i, U> where T: Into<U> {
|
||||
ParseError {
|
||||
kind: self.kind.into(),
|
||||
location: self.location,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +298,21 @@ impl Delimiters {
|
|||
}
|
||||
}
|
||||
|
||||
/// Used in some `fn expect_*` methods
|
||||
macro_rules! expect {
|
||||
($parser: ident, $($branches: tt)+) => {
|
||||
{
|
||||
let start_location = $parser.current_source_location();
|
||||
match *$parser.next()? {
|
||||
$($branches)+
|
||||
ref token => {
|
||||
return Err(start_location.new_basic_unexpected_token_error(token.clone()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'i: 't, 't> Parser<'i, 't> {
|
||||
/// Create a new parser
|
||||
#[inline]
|
||||
|
@ -260,9 +345,9 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
pub fn expect_exhausted(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
let start = self.state();
|
||||
let result = match self.next() {
|
||||
Err(BasicParseError::EndOfInput) => Ok(()),
|
||||
Err(BasicParseError { kind: BasicParseErrorKind::EndOfInput, .. }) => Ok(()),
|
||||
Err(e) => unreachable!("Unexpected error encountered: {:?}", e),
|
||||
Ok(t) => Err(BasicParseError::UnexpectedToken(t.clone())),
|
||||
Ok(t) => Err(start.source_location().new_basic_unexpected_token_error(t.clone())),
|
||||
};
|
||||
self.reset(&start);
|
||||
result
|
||||
|
@ -300,6 +385,42 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
self.input.tokenizer.current_source_url()
|
||||
}
|
||||
|
||||
/// Create a new BasicParseError at the current location
|
||||
#[inline]
|
||||
pub fn new_basic_error(&self, kind: BasicParseErrorKind<'i>) -> BasicParseError<'i> {
|
||||
BasicParseError {
|
||||
kind: kind,
|
||||
location: self.current_source_location(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new basic ParseError at the current location
|
||||
#[inline]
|
||||
pub fn new_error<E>(&self, kind: BasicParseErrorKind<'i>) -> ParseError<'i, E> {
|
||||
ParseError {
|
||||
kind: ParseErrorKind::Basic(kind),
|
||||
location: self.current_source_location(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new custom BasicParseError at the current location
|
||||
#[inline]
|
||||
pub fn new_custom_error<E1: Into<E2>, E2>(&self, error: E1) -> ParseError<'i, E2> {
|
||||
self.current_source_location().new_custom_error(error)
|
||||
}
|
||||
|
||||
/// Create a new unexpected token BasicParseError at the current location
|
||||
#[inline]
|
||||
pub fn new_basic_unexpected_token_error(&self, token: Token<'i>) -> BasicParseError<'i> {
|
||||
self.new_basic_error(BasicParseErrorKind::UnexpectedToken(token))
|
||||
}
|
||||
|
||||
/// Create a new unexpected token ParseError at the current location
|
||||
#[inline]
|
||||
pub fn new_unexpected_token_error<E>(&self, token: Token<'i>) -> ParseError<'i, E> {
|
||||
self.new_error(BasicParseErrorKind::UnexpectedToken(token))
|
||||
}
|
||||
|
||||
/// Return the current internal state of the parser (including position within the input).
|
||||
///
|
||||
/// This state can later be restored with the `Parser::reset` method.
|
||||
|
@ -430,7 +551,7 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
|
||||
let byte = self.input.tokenizer.next_byte();
|
||||
if self.stop_before.contains(Delimiters::from_byte(byte)) {
|
||||
return Err(BasicParseError::EndOfInput)
|
||||
return Err(self.new_basic_error(BasicParseErrorKind::EndOfInput))
|
||||
}
|
||||
|
||||
let token_start_position = self.input.tokenizer.position();
|
||||
|
@ -446,7 +567,8 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
token = &cached_token.token
|
||||
}
|
||||
_ => {
|
||||
let new_token = self.input.tokenizer.next().map_err(|()| BasicParseError::EndOfInput)?;
|
||||
let new_token = self.input.tokenizer.next()
|
||||
.map_err(|()| self.new_basic_error(BasicParseErrorKind::EndOfInput))?;
|
||||
self.input.cached_token = Some(CachedToken {
|
||||
token: new_token,
|
||||
start_position: token_start_position,
|
||||
|
@ -550,18 +672,18 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// Parse a <whitespace-token> and return its value.
|
||||
#[inline]
|
||||
pub fn expect_whitespace(&mut self) -> Result<&'i str, BasicParseError<'i>> {
|
||||
let start_location = self.current_source_location();
|
||||
match *self.next_including_whitespace()? {
|
||||
Token::WhiteSpace(value) => Ok(value),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
ref t => Err(start_location.new_basic_unexpected_token_error(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a <ident-token> and return the unescaped value.
|
||||
#[inline]
|
||||
pub fn expect_ident(&mut self) -> Result<&CowRcStr<'i>, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Ident(ref value) => Ok(value),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,18 +696,16 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// Parse a <ident-token> whose unescaped value is an ASCII-insensitive match for the given value.
|
||||
#[inline]
|
||||
pub fn expect_ident_matching(&mut self, expected_value: &str) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Ident(ref value) if value.eq_ignore_ascii_case(expected_value) => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a <string-token> and return the unescaped value.
|
||||
#[inline]
|
||||
pub fn expect_string(&mut self) -> Result<&CowRcStr<'i>, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::QuotedString(ref value) => Ok(value),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -598,10 +718,9 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// Parse either a <ident-token> or a <string-token>, and return the unescaped value.
|
||||
#[inline]
|
||||
pub fn expect_ident_or_string(&mut self) -> Result<&CowRcStr<'i>, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Ident(ref value) => Ok(value),
|
||||
Token::QuotedString(ref value) => Ok(value),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,12 +728,11 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
#[inline]
|
||||
pub fn expect_url(&mut self) -> Result<CowRcStr<'i>, BasicParseError<'i>> {
|
||||
// FIXME: revert early returns when lifetimes are non-lexical
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::UnquotedUrl(ref value) => return Ok(value.clone()),
|
||||
Token::Function(ref name) if name.eq_ignore_ascii_case("url") => {}
|
||||
ref t => return Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
self.parse_nested_block(|input| input.expect_string().map_err(ParseError::Basic).map(|s| s.clone()))
|
||||
self.parse_nested_block(|input| input.expect_string().map_err(Into::into).map(|s| s.clone()))
|
||||
.map_err(ParseError::<()>::basic)
|
||||
}
|
||||
|
||||
|
@ -622,33 +740,28 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
#[inline]
|
||||
pub fn expect_url_or_string(&mut self) -> Result<CowRcStr<'i>, BasicParseError<'i>> {
|
||||
// FIXME: revert early returns when lifetimes are non-lexical
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::UnquotedUrl(ref value) => return Ok(value.clone()),
|
||||
Token::QuotedString(ref value) => return Ok(value.clone()),
|
||||
Token::Function(ref name) if name.eq_ignore_ascii_case("url") => {}
|
||||
ref t => return Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
self.parse_nested_block(|input| input.expect_string().map_err(ParseError::Basic).map(|s| s.clone()))
|
||||
self.parse_nested_block(|input| input.expect_string().map_err(Into::into).map(|s| s.clone()))
|
||||
.map_err(ParseError::<()>::basic)
|
||||
}
|
||||
|
||||
/// Parse a <number-token> and return the integer value.
|
||||
#[inline]
|
||||
pub fn expect_number(&mut self) -> Result<f32, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Number { value, .. } => Ok(value),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a <number-token> that does not have a fractional part, and return the integer value.
|
||||
#[inline]
|
||||
pub fn expect_integer(&mut self) -> Result<i32, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
Token::Number { int_value: Some(int_value), .. } => {
|
||||
Ok(int_value)
|
||||
}
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
expect! {self,
|
||||
Token::Number { int_value: Some(int_value), .. } => Ok(int_value),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -656,45 +769,40 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// `0%` and `100%` map to `0.0` and `1.0` (not `100.0`), respectively.
|
||||
#[inline]
|
||||
pub fn expect_percentage(&mut self) -> Result<f32, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Percentage { unit_value, .. } => Ok(unit_value),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a `:` <colon-token>.
|
||||
#[inline]
|
||||
pub fn expect_colon(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Colon => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a `;` <semicolon-token>.
|
||||
#[inline]
|
||||
pub fn expect_semicolon(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Semicolon => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a `,` <comma-token>.
|
||||
#[inline]
|
||||
pub fn expect_comma(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Comma => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a <delim-token> with the given value.
|
||||
#[inline]
|
||||
pub fn expect_delim(&mut self, expected_value: char) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Delim(value) if value == expected_value => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -703,9 +811,8 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// If the result is `Ok`, you can then call the `Parser::parse_nested_block` method.
|
||||
#[inline]
|
||||
pub fn expect_curly_bracket_block(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::CurlyBracketBlock => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,9 +821,8 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// If the result is `Ok`, you can then call the `Parser::parse_nested_block` method.
|
||||
#[inline]
|
||||
pub fn expect_square_bracket_block(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::SquareBracketBlock => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -725,9 +831,8 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// If the result is `Ok`, you can then call the `Parser::parse_nested_block` method.
|
||||
#[inline]
|
||||
pub fn expect_parenthesis_block(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::ParenthesisBlock => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -736,9 +841,8 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// If the result is `Ok`, you can then call the `Parser::parse_nested_block` method.
|
||||
#[inline]
|
||||
pub fn expect_function(&mut self) -> Result<&CowRcStr<'i>, BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Function(ref name) => Ok(name),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,9 +851,8 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// If the result is `Ok`, you can then call the `Parser::parse_nested_block` method.
|
||||
#[inline]
|
||||
pub fn expect_function_matching(&mut self, expected_name: &str) -> Result<(), BasicParseError<'i>> {
|
||||
match *self.next()? {
|
||||
expect! {self,
|
||||
Token::Function(ref name) if name.eq_ignore_ascii_case(expected_name) => Ok(()),
|
||||
ref t => Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,25 +861,29 @@ impl<'i: 't, 't> Parser<'i, 't> {
|
|||
/// See `Token::is_parse_error`. This also checks nested blocks and functions recursively.
|
||||
#[inline]
|
||||
pub fn expect_no_error_token(&mut self) -> Result<(), BasicParseError<'i>> {
|
||||
// FIXME: remove break and intermediate variable when lifetimes are non-lexical
|
||||
let token;
|
||||
loop {
|
||||
match self.next_including_whitespace_and_comments() {
|
||||
Ok(&Token::Function(_)) |
|
||||
Ok(&Token::ParenthesisBlock) |
|
||||
Ok(&Token::SquareBracketBlock) |
|
||||
Ok(&Token::CurlyBracketBlock) => {}
|
||||
Ok(token) => {
|
||||
if token.is_parse_error() {
|
||||
//FIXME: maybe these should be separate variants of BasicParseError instead?
|
||||
return Err(BasicParseError::UnexpectedToken(token.clone()))
|
||||
Ok(t) => {
|
||||
if t.is_parse_error() {
|
||||
token = t.clone();
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
Err(_) => return Ok(())
|
||||
}
|
||||
let result = self.parse_nested_block(|input| input.expect_no_error_token()
|
||||
.map_err(|e| ParseError::Basic(e)));
|
||||
.map_err(|e| Into::into(e)));
|
||||
result.map_err(ParseError::<()>::basic)?
|
||||
}
|
||||
// FIXME: maybe these should be separate variants of BasicParseError instead?
|
||||
Err(self.new_basic_unexpected_token_error(token))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
use cow_rc_str::CowRcStr;
|
||||
use parser::{parse_until_before, parse_until_after, parse_nested_block, ParserState};
|
||||
use std::ascii::AsciiExt;
|
||||
use super::{Token, Parser, Delimiter, ParseError, BasicParseError, SourceLocation};
|
||||
|
||||
use super::{Token, Parser, Delimiter, ParseError, BasicParseError, BasicParseErrorKind};
|
||||
|
||||
/// Parse `!important`.
|
||||
///
|
||||
|
@ -19,7 +18,6 @@ pub fn parse_important<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(), BasicPa
|
|||
input.expect_ident_matching("important")
|
||||
}
|
||||
|
||||
|
||||
/// The return value for `AtRuleParser::parse_prelude`.
|
||||
/// Indicates whether the at-rule is expected to have a `{ /* ... */ }` block
|
||||
/// or end with a `;` semicolon.
|
||||
|
@ -112,7 +110,7 @@ pub trait AtRuleParser<'i> {
|
|||
ParseError<'i, Self::Error>> {
|
||||
let _ = name;
|
||||
let _ = input;
|
||||
Err(ParseError::Basic(BasicParseError::AtRuleInvalid(name)))
|
||||
Err(input.new_error(BasicParseErrorKind::AtRuleInvalid(name)))
|
||||
}
|
||||
|
||||
/// End an at-rule which doesn't have block. Return the finished
|
||||
|
@ -139,7 +137,7 @@ pub trait AtRuleParser<'i> {
|
|||
-> Result<Self::AtRule, ParseError<'i, Self::Error>> {
|
||||
let _ = prelude;
|
||||
let _ = input;
|
||||
Err(ParseError::Basic(BasicParseError::AtRuleBodyInvalid))
|
||||
Err(input.new_error(BasicParseErrorKind::AtRuleBodyInvalid))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,7 +173,7 @@ pub trait QualifiedRuleParser<'i> {
|
|||
fn parse_prelude<'t>(&mut self, input: &mut Parser<'i, 't>)
|
||||
-> Result<Self::Prelude, ParseError<'i, Self::Error>> {
|
||||
let _ = input;
|
||||
Err(ParseError::Basic(BasicParseError::QualifiedRuleInvalid))
|
||||
Err(input.new_error(BasicParseErrorKind::QualifiedRuleInvalid))
|
||||
}
|
||||
|
||||
/// Parse the content of a `{ /* ... */ }` block for the body of the qualified rule.
|
||||
|
@ -187,7 +185,7 @@ pub trait QualifiedRuleParser<'i> {
|
|||
-> Result<Self::QualifiedRule, ParseError<'i, Self::Error>> {
|
||||
let _ = prelude;
|
||||
let _ = input;
|
||||
Err(ParseError::Basic(BasicParseError::QualifiedRuleInvalid))
|
||||
Err(input.new_error(BasicParseErrorKind::QualifiedRuleInvalid))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,9 +230,9 @@ where P: DeclarationParser<'i, Declaration = I, Error = E> +
|
|||
impl<'i: 't, 't: 'a, 'a, I, P, E: 'i> Iterator for DeclarationListParser<'i, 't, 'a, P>
|
||||
where P: DeclarationParser<'i, Declaration = I, Error = E> +
|
||||
AtRuleParser<'i, AtRule = I, Error = E> {
|
||||
type Item = Result<I, PreciseParseError<'i, E>>;
|
||||
type Item = Result<I, (ParseError<'i, E>, &'i str)>;
|
||||
|
||||
fn next(&mut self) -> Option<Result<I, PreciseParseError<'i, E>>> {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
let start = self.input.state();
|
||||
// FIXME: remove intermediate variable when lifetimes are non-lexical
|
||||
|
@ -248,31 +246,25 @@ where P: DeclarationParser<'i, Declaration = I, Error = E> +
|
|||
match ident {
|
||||
Ok(Ok(name)) => {
|
||||
// Ident
|
||||
return Some({
|
||||
let result = {
|
||||
let parser = &mut self.parser;
|
||||
// FIXME: https://github.com/rust-lang/rust/issues/42508
|
||||
parse_until_after::<'i, 't, _, _, _>(self.input, Delimiter::Semicolon, |input| {
|
||||
input.expect_colon()?;
|
||||
parser.parse_value(name, input)
|
||||
})
|
||||
}.map_err(|e| PreciseParseError {
|
||||
error: e,
|
||||
slice: self.input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
}))
|
||||
};
|
||||
return Some(result.map_err(|e| (e, self.input.slice_from(start.position()))))
|
||||
}
|
||||
Ok(Err(name)) => {
|
||||
// At-keyword
|
||||
return Some(parse_at_rule(&start, name, self.input, &mut self.parser))
|
||||
}
|
||||
Err(token) => {
|
||||
return Some(self.input.parse_until_after(Delimiter::Semicolon,
|
||||
|_| Err(ParseError::Basic(BasicParseError::UnexpectedToken(token.clone()))))
|
||||
.map_err(|e| PreciseParseError {
|
||||
error: e,
|
||||
slice: self.input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
}))
|
||||
let result = self.input.parse_until_after(Delimiter::Semicolon, |_| {
|
||||
Err(start.source_location().new_unexpected_token_error(token.clone()))
|
||||
});
|
||||
return Some(result.map_err(|e| (e, self.input.slice_from(start.position()))))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,9 +329,9 @@ where P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E> +
|
|||
impl<'i: 't, 't: 'a, 'a, R, P, E: 'i> Iterator for RuleListParser<'i, 't, 'a, P>
|
||||
where P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E> +
|
||||
AtRuleParser<'i, AtRule = R, Error = E> {
|
||||
type Item = Result<R, PreciseParseError<'i, E>>;
|
||||
type Item = Result<R, (ParseError<'i, E>, &'i str)>;
|
||||
|
||||
fn next(&mut self) -> Option<Result<R, PreciseParseError<'i, E>>> {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
if self.is_stylesheet {
|
||||
self.input.skip_cdc_and_cdo()
|
||||
|
@ -375,12 +367,8 @@ where P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E> +
|
|||
}
|
||||
} else {
|
||||
self.any_rule_so_far = true;
|
||||
return Some(parse_qualified_rule(self.input, &mut self.parser)
|
||||
.map_err(|e| PreciseParseError {
|
||||
error: e,
|
||||
slice: self.input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
}))
|
||||
let result = parse_qualified_rule(self.input, &mut self.parser);
|
||||
return Some(result.map_err(|e| (e, self.input.slice_from(start.position()))))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -390,19 +378,15 @@ where P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E> +
|
|||
/// Parse a single declaration, such as an `( /* ... */ )` parenthesis in an `@supports` prelude.
|
||||
pub fn parse_one_declaration<'i, 't, P, E>(input: &mut Parser<'i, 't>, parser: &mut P)
|
||||
-> Result<<P as DeclarationParser<'i>>::Declaration,
|
||||
PreciseParseError<'i, E>>
|
||||
(ParseError<'i, E>, &'i str)>
|
||||
where P: DeclarationParser<'i, Error = E> {
|
||||
let start_position = input.position();
|
||||
let start_location = input.current_source_location();
|
||||
input.parse_entirely(|input| {
|
||||
let name = input.expect_ident()?.clone();
|
||||
input.expect_colon()?;
|
||||
parser.parse_value(name, input)
|
||||
}).map_err(|e| PreciseParseError {
|
||||
error: e,
|
||||
slice: input.slice_from(start_position),
|
||||
location: start_location,
|
||||
})
|
||||
.map_err(|e| (e, input.slice_from(start_position)))
|
||||
}
|
||||
|
||||
|
||||
|
@ -430,28 +414,17 @@ where P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E> +
|
|||
}
|
||||
|
||||
if let Some(name) = at_keyword {
|
||||
parse_at_rule(&start, name, input, parser).map_err(|e| e.error)
|
||||
parse_at_rule(&start, name, input, parser).map_err(|e| e.0)
|
||||
} else {
|
||||
parse_qualified_rule(input, parser)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// A parse error with details of where it occured
|
||||
pub struct PreciseParseError<'i, E: 'i> {
|
||||
/// Error details
|
||||
pub error: ParseError<'i, E>,
|
||||
|
||||
/// The relevant slice of the input.
|
||||
pub slice: &'i str,
|
||||
|
||||
/// The line number and column number of the start of the relevant input slice.
|
||||
pub location: SourceLocation,
|
||||
}
|
||||
|
||||
fn parse_at_rule<'i: 't, 't, P, E>(start: &ParserState, name: CowRcStr<'i>,
|
||||
input: &mut Parser<'i, 't>, parser: &mut P)
|
||||
-> Result<<P as AtRuleParser<'i>>::AtRule, PreciseParseError<'i, E>>
|
||||
-> Result<<P as AtRuleParser<'i>>::AtRule,
|
||||
(ParseError<'i, E>, &'i str)>
|
||||
where P: AtRuleParser<'i, Error = E> {
|
||||
let delimiters = Delimiter::Semicolon | Delimiter::CurlyBracketBlock;
|
||||
// FIXME: https://github.com/rust-lang/rust/issues/42508
|
||||
|
@ -462,11 +435,10 @@ fn parse_at_rule<'i: 't, 't, P, E>(start: &ParserState, name: CowRcStr<'i>,
|
|||
Ok(AtRuleType::WithoutBlock(prelude)) => {
|
||||
match input.next() {
|
||||
Ok(&Token::Semicolon) | Err(_) => Ok(parser.rule_without_block(prelude)),
|
||||
Ok(&Token::CurlyBracketBlock) => Err(PreciseParseError {
|
||||
error: ParseError::Basic(BasicParseError::UnexpectedToken(Token::CurlyBracketBlock)),
|
||||
slice: input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
}),
|
||||
Ok(&Token::CurlyBracketBlock) => Err((
|
||||
input.new_unexpected_token_error(Token::CurlyBracketBlock),
|
||||
input.slice_from(start.position()),
|
||||
)),
|
||||
Ok(_) => unreachable!()
|
||||
}
|
||||
}
|
||||
|
@ -475,22 +447,13 @@ fn parse_at_rule<'i: 't, 't, P, E>(start: &ParserState, name: CowRcStr<'i>,
|
|||
Ok(&Token::CurlyBracketBlock) => {
|
||||
// FIXME: https://github.com/rust-lang/rust/issues/42508
|
||||
parse_nested_block::<'i, 't, _, _, _>(input, move |input| parser.parse_block(prelude, input))
|
||||
.map_err(|e| PreciseParseError {
|
||||
error: e,
|
||||
slice: input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
})
|
||||
.map_err(|e| (e, input.slice_from(start.position())))
|
||||
}
|
||||
Ok(&Token::Semicolon) => Err(PreciseParseError {
|
||||
error: ParseError::Basic(BasicParseError::UnexpectedToken(Token::Semicolon)),
|
||||
slice: input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
}),
|
||||
Err(e) => Err(PreciseParseError {
|
||||
error: ParseError::Basic(e),
|
||||
slice: input.slice_from(start.position()),
|
||||
location: start.source_location(),
|
||||
}),
|
||||
Ok(&Token::Semicolon) => Err((
|
||||
input.new_unexpected_token_error(Token::Semicolon),
|
||||
input.slice_from(start.position()),
|
||||
)),
|
||||
Err(e) => Err((e.into(), input.slice_from(start.position()))),
|
||||
Ok(_) => unreachable!()
|
||||
}
|
||||
}
|
||||
|
@ -500,11 +463,7 @@ fn parse_at_rule<'i: 't, 't, P, E>(start: &ParserState, name: CowRcStr<'i>,
|
|||
Ok(&Token::CurlyBracketBlock) | Ok(&Token::Semicolon) | Err(_) => {},
|
||||
_ => unreachable!()
|
||||
};
|
||||
Err(PreciseParseError {
|
||||
error: error,
|
||||
slice: input.slice(start.position()..end_position),
|
||||
location: start.source_location(),
|
||||
})
|
||||
Err((error, input.slice(start.position()..end_position)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,5 @@ size_of_test!(parser, ::parser::Parser, 16);
|
|||
size_of_test!(source_position, ::SourcePosition, 8);
|
||||
size_of_test!(parser_state, ::ParserState, 24);
|
||||
|
||||
size_of_test!(basic_parse_error, ::BasicParseError, 40);
|
||||
size_of_test!(parse_error_lower_bound, ::ParseError<()>, 48);
|
||||
size_of_test!(precise_parse_error_lower_bound, ::PreciseParseError<()>, 72);
|
||||
size_of_test!(basic_parse_error, ::BasicParseError, 48);
|
||||
size_of_test!(parse_error_lower_bound, ::ParseError<()>, 56);
|
||||
|
|
|
@ -11,8 +11,9 @@ use rustc_serialize::json::{self, Json, ToJson};
|
|||
#[cfg(feature = "bench")]
|
||||
use self::test::Bencher;
|
||||
|
||||
use super::{Parser, Delimiter, Token, SourceLocation, ParseError,
|
||||
DeclarationListParser, DeclarationParser, RuleListParser, BasicParseError,
|
||||
use super::{Parser, Delimiter, Token, SourceLocation,
|
||||
ParseError, ParseErrorKind, BasicParseError, BasicParseErrorKind,
|
||||
DeclarationListParser, DeclarationParser, RuleListParser,
|
||||
AtRuleType, AtRuleParser, QualifiedRuleParser, ParserInput,
|
||||
parse_one_declaration, parse_one_rule, parse_important,
|
||||
stylesheet_encoding, EncodingSupport,
|
||||
|
@ -263,9 +264,7 @@ fn outer_block_end_consumed() {
|
|||
let mut input = Parser::new(&mut input);
|
||||
assert!(input.expect_parenthesis_block().is_ok());
|
||||
assert!(input.parse_nested_block(|input| {
|
||||
let result: Result<_, ParseError<()>> = input.expect_function_matching("calc")
|
||||
.map_err(|e| ParseError::Basic(e));
|
||||
result
|
||||
input.expect_function_matching("calc").map_err(Into::<ParseError<()>>::into)
|
||||
}).is_ok());
|
||||
println!("{:?}", input.position());
|
||||
assert!(input.next().is_err());
|
||||
|
@ -337,7 +336,7 @@ fn test_expect_url() {
|
|||
fn run_color_tests<F: Fn(Result<Color, ()>) -> Json>(json_data: &str, to_json: F) {
|
||||
run_json_tests(json_data, |input| {
|
||||
let result: Result<_, ParseError<()>> = input.parse_entirely(|i| {
|
||||
Color::parse(i).map_err(|e| ParseError::Basic(e))
|
||||
Color::parse(i).map_err(Into::into)
|
||||
});
|
||||
to_json(result.map_err(|_| ()))
|
||||
});
|
||||
|
@ -367,7 +366,7 @@ fn color3_keywords() {
|
|||
fn nth() {
|
||||
run_json_tests(include_str!("css-parsing-tests/An+B.json"), |input| {
|
||||
input.parse_entirely(|i| {
|
||||
let result: Result<_, ParseError<()>> = parse_nth(i).map_err(|e| ParseError::Basic(e));
|
||||
let result: Result<_, ParseError<()>> = parse_nth(i).map_err(Into::into);
|
||||
result
|
||||
}).ok().to_json()
|
||||
});
|
||||
|
@ -779,7 +778,9 @@ impl<'i> AtRuleParser<'i> for JsonParser {
|
|||
];
|
||||
match_ignore_ascii_case! { &*name,
|
||||
"media" | "foo-with-block" => Ok(AtRuleType::WithBlock(prelude)),
|
||||
"charset" => Err(BasicParseError::AtRuleInvalid(name.clone()).into()),
|
||||
"charset" => {
|
||||
Err(input.new_error(BasicParseErrorKind::AtRuleInvalid(name.clone()).into()))
|
||||
}
|
||||
_ => Ok(AtRuleType::WithoutBlock(prelude)),
|
||||
}
|
||||
}
|
||||
|
@ -1016,7 +1017,10 @@ fn cdc_regression_test() {
|
|||
let mut parser = Parser::new(&mut input);
|
||||
parser.skip_cdc_and_cdo();
|
||||
assert_eq!(parser.next(), Ok(&Token::Ident("x".into())));
|
||||
assert_eq!(parser.next(), Err(BasicParseError::EndOfInput));
|
||||
assert_eq!(parser.next(), Err(BasicParseError {
|
||||
kind: BasicParseErrorKind::EndOfInput,
|
||||
location: SourceLocation { line: 0, column: 5 }
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1025,8 +1029,11 @@ fn parse_entirely_reports_first_error() {
|
|||
enum E { Foo }
|
||||
let mut input = ParserInput::new("ident");
|
||||
let mut parser = Parser::new(&mut input);
|
||||
let result: Result<(), _> = parser.parse_entirely(|_| Err(ParseError::Custom(E::Foo)));
|
||||
assert_eq!(result, Err(ParseError::Custom(E::Foo)));
|
||||
let result: Result<(), _> = parser.parse_entirely(|p| Err(p.new_custom_error(E::Foo)));
|
||||
assert_eq!(result, Err(ParseError {
|
||||
kind: ParseErrorKind::Custom(E::Foo),
|
||||
location: SourceLocation { line: 0, column: 1 },
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1140,7 +1147,7 @@ fn utf16_columns() {
|
|||
// Read all tokens.
|
||||
loop {
|
||||
match parser.next() {
|
||||
Err(BasicParseError::EndOfInput) => { break; }
|
||||
Err(BasicParseError { kind: BasicParseErrorKind::EndOfInput, .. }) => { break; }
|
||||
Err(_) => { assert!(false); }
|
||||
Ok(_) => {}
|
||||
};
|
||||
|
|
|
@ -44,10 +44,10 @@ impl UnicodeRange {
|
|||
|
||||
let range = match parse_concatenated(concatenated_tokens.as_bytes()) {
|
||||
Ok(range) => range,
|
||||
Err(()) => return Err(BasicParseError::UnexpectedToken(Token::Ident(concatenated_tokens.into()))),
|
||||
Err(()) => return Err(input.new_basic_unexpected_token_error(Token::Ident(concatenated_tokens.into()))),
|
||||
};
|
||||
if range.end > char::MAX as u32 || range.start > range.end {
|
||||
Err(BasicParseError::UnexpectedToken(Token::Ident(concatenated_tokens.into())))
|
||||
Err(input.new_basic_unexpected_token_error(Token::Ident(concatenated_tokens.into())))
|
||||
} else {
|
||||
Ok(range)
|
||||
}
|
||||
|
@ -57,10 +57,11 @@ impl UnicodeRange {
|
|||
fn parse_tokens<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(), BasicParseError<'i>> {
|
||||
match input.next_including_whitespace()?.clone() {
|
||||
Token::Delim('+') => {
|
||||
match *input.next_including_whitespace()? {
|
||||
// FIXME: remove .clone() when lifetimes are non-lexical.
|
||||
match input.next_including_whitespace()?.clone() {
|
||||
Token::Ident(_) => {}
|
||||
Token::Delim('?') => {}
|
||||
ref t => return Err(BasicParseError::UnexpectedToken(t.clone()))
|
||||
t => return Err(input.new_basic_unexpected_token_error(t))
|
||||
}
|
||||
parse_question_marks(input)
|
||||
}
|
||||
|
@ -76,7 +77,7 @@ fn parse_tokens<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(), BasicParseErro
|
|||
_ => input.reset(&after_number)
|
||||
}
|
||||
}
|
||||
t => return Err(BasicParseError::UnexpectedToken(t))
|
||||
t => return Err(input.new_basic_unexpected_token_error(t))
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.21.3"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -559,7 +559,7 @@ name = "geckoservo"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -759,7 +759,7 @@ name = "malloc_size_of"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashglobe 0.1.0",
|
||||
"servo_arc 0.0.1",
|
||||
|
@ -1191,7 +1191,7 @@ name = "selectors"
|
|||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
|
@ -1298,7 +1298,7 @@ dependencies = [
|
|||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fallible 0.0.1",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1352,7 +1352,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"malloc_size_of_derive 0.0.1",
|
||||
|
@ -1697,7 +1697,7 @@ dependencies = [
|
|||
"checksum core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bc9fb3d6cb663e6fd7cf1c63f9b144ee2b1e4a78595a0451dd34bff85b9a3387"
|
||||
"checksum core-graphics 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2fd47addfc77b7e574d24e5434f95bb64a863769dfd4f1d451ca4ff5530ba01a"
|
||||
"checksum core-text 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a23bef779fab70e5e6af23e36eed03a48e1c1687dea8929505d405ea48d1f5e"
|
||||
"checksum cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)" = "89af8ca7a36c8c591a9ff56ffb88ea2597095d8c1b834af9ca5be5032dcfe06e"
|
||||
"checksum cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"
|
||||
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
|
||||
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
|
||||
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"
|
||||
|
|
|
@ -298,7 +298,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.21.3"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -558,7 +558,7 @@ name = "geckoservo"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -758,7 +758,7 @@ name = "malloc_size_of"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashglobe 0.1.0",
|
||||
"servo_arc 0.0.1",
|
||||
|
@ -1179,7 +1179,7 @@ name = "selectors"
|
|||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
|
@ -1290,7 +1290,7 @@ dependencies = [
|
|||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fallible 0.0.1",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1344,7 +1344,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"malloc_size_of_derive 0.0.1",
|
||||
|
@ -1357,7 +1357,7 @@ name = "stylo_tests"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
|
@ -1709,7 +1709,7 @@ dependencies = [
|
|||
"checksum core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bc9fb3d6cb663e6fd7cf1c63f9b144ee2b1e4a78595a0451dd34bff85b9a3387"
|
||||
"checksum core-graphics 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2fd47addfc77b7e574d24e5434f95bb64a863769dfd4f1d451ca4ff5530ba01a"
|
||||
"checksum core-text 7.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a23bef779fab70e5e6af23e36eed03a48e1c1687dea8929505d405ea48d1f5e"
|
||||
"checksum cssparser 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)" = "89af8ca7a36c8c591a9ff56ffb88ea2597095d8c1b834af9ca5be5032dcfe06e"
|
||||
"checksum cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"
|
||||
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
|
||||
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
|
||||
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"
|
||||
|
|
Загрузка…
Ссылка в новой задаче