Commit 7483f2df authored by Emilio Cobos Álvarez 's avatar Emilio Cobos Álvarez
Browse files

Bug 1680558 - Update cssparser to get ParserState in rule parser. r=heycam, a=RyanVM

The changes should be trivial.

The third_party changes are up for review in
https://github.com/servo/rust-cssparser/pull/277 (and of course I'll
land with a bump to 0.28 rather than the override after that gets r+'d).

The basic idea is that with this we have the actual start offset of the
rule, so we wouldn't include html comments or other invalid stuff we
discard during sanitization in bug 1680084. But that's a separate
change.

Differential Revision: https://phabricator.services.mozilla.com/D98677
parent 4537b1c6
...@@ -898,9 +898,9 @@ dependencies = [ ...@@ -898,9 +898,9 @@ dependencies = [
[[package]] [[package]]
name = "cssparser" name = "cssparser"
version = "0.27.2" version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" checksum = "809d22aba9ffd53e9028f2d37261f1826ef613d0e96b1a5ddeefa97cde82bcca"
dependencies = [ dependencies = [
"cssparser-macros", "cssparser-macros",
"dtoa-short", "dtoa-short",
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
let tests = [ let tests = [
{ sheetNo: 0, ruleNo: 0, lineNo: 1, columnNo: 1 }, { sheetNo: 0, ruleNo: 0, lineNo: 1, columnNo: 1 },
{ sheetNo: 1, ruleNo: 0, lineNo: 2, columnNo: 14 }, { sheetNo: 1, ruleNo: 0, lineNo: 2, columnNo: 5 },
{ sheetNo: 1, ruleNo: 1, lineNo: 8, columnNo: 5 }, { sheetNo: 1, ruleNo: 1, lineNo: 8, columnNo: 5 },
{ sheetNo: 2, ruleNo: 0, lineNo: 1, columnNo: 1 }, { sheetNo: 2, ruleNo: 0, lineNo: 1, columnNo: 1 },
{ sheetNo: 2, ruleNo: 1, lineNo: 0, columnNo: 1 }, { sheetNo: 2, ruleNo: 1, lineNo: 0, columnNo: 1 },
......
...@@ -31,7 +31,7 @@ accountable-refcell = { version = "0.2.0", optional = true } ...@@ -31,7 +31,7 @@ accountable-refcell = { version = "0.2.0", optional = true }
app_units = "0.7" app_units = "0.7"
content-security-policy = {version = "0.3.0", features = ["serde"], optional = true} content-security-policy = {version = "0.3.0", features = ["serde"], optional = true}
crossbeam-channel = { version = "0.3", optional = true } crossbeam-channel = { version = "0.3", optional = true }
cssparser = "0.27" cssparser = "0.28"
euclid = "0.20" euclid = "0.20"
hashglobe = { path = "../hashglobe" } hashglobe = { path = "../hashglobe" }
hyper = { version = "0.12", optional = true } hyper = { version = "0.12", optional = true }
......
...@@ -22,7 +22,7 @@ bench = [] ...@@ -22,7 +22,7 @@ bench = []
[dependencies] [dependencies]
bitflags = "1.0" bitflags = "1.0"
matches = "0.1" matches = "0.1"
cssparser = "0.27" cssparser = "0.28"
derive_more = "0.99" derive_more = "0.99"
log = "0.4" log = "0.4"
fxhash = "0.2" fxhash = "0.2"
......
...@@ -32,7 +32,7 @@ arrayvec = "0.5" ...@@ -32,7 +32,7 @@ arrayvec = "0.5"
atomic_refcell = "0.1" atomic_refcell = "0.1"
bitflags = "1.0" bitflags = "1.0"
byteorder = "1.0" byteorder = "1.0"
cssparser = "0.27" cssparser = "0.28"
crossbeam-channel = { version = "0.4", optional = true } crossbeam-channel = { version = "0.4", optional = true }
derive_more = "0.99" derive_more = "0.99"
new_debug_unreachable = "1.0" new_debug_unreachable = "1.0"
......
...@@ -20,7 +20,7 @@ use crate::values::serialize_atom_identifier; ...@@ -20,7 +20,7 @@ use crate::values::serialize_atom_identifier;
use crate::Atom; use crate::Atom;
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr}; use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
use cssparser::{DeclarationListParser, DeclarationParser, Parser}; use cssparser::{DeclarationListParser, DeclarationParser, Parser};
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token}; use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, ParserState, Token};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
...@@ -413,7 +413,7 @@ macro_rules! font_feature_values_blocks { ...@@ -413,7 +413,7 @@ macro_rules! font_feature_values_blocks {
fn parse_block<'t>( fn parse_block<'t>(
&mut self, &mut self,
prelude: BlockType, prelude: BlockType,
_location: SourceLocation, _: &ParserState,
input: &mut Parser<'i, 't> input: &mut Parser<'i, 't>
) -> Result<Self::AtRule, ParseError<'i>> { ) -> Result<Self::AtRule, ParseError<'i>> {
debug_assert_eq!(self.context.rule_type(), CssRuleType::FontFeatureValues); debug_assert_eq!(self.context.rule_type(), CssRuleType::FontFeatureValues);
......
...@@ -17,7 +17,7 @@ use crate::str::CssStringWriter; ...@@ -17,7 +17,7 @@ use crate::str::CssStringWriter;
use crate::stylesheets::rule_parser::VendorPrefix; use crate::stylesheets::rule_parser::VendorPrefix;
use crate::stylesheets::{CssRuleType, StylesheetContents}; use crate::stylesheets::{CssRuleType, StylesheetContents};
use crate::values::{serialize_percentage, KeyframesName}; use crate::values::{serialize_percentage, KeyframesName};
use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token}; use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, ParserState, SourceLocation, Token};
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser}; use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser};
use servo_arc::Arc; use servo_arc::Arc;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
...@@ -533,7 +533,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for KeyframeListParser<'a> { ...@@ -533,7 +533,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for KeyframeListParser<'a> {
fn parse_block<'t>( fn parse_block<'t>(
&mut self, &mut self,
selector: Self::Prelude, selector: Self::Prelude,
source_location: SourceLocation, start: &ParserState,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self::QualifiedRule, ParseError<'i>> { ) -> Result<Self::QualifiedRule, ParseError<'i>> {
let context = ParserContext::new_with_rule_type( let context = ParserContext::new_with_rule_type(
...@@ -566,7 +566,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for KeyframeListParser<'a> { ...@@ -566,7 +566,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for KeyframeListParser<'a> {
Ok(Arc::new(self.shared_lock.wrap(Keyframe { Ok(Arc::new(self.shared_lock.wrap(Keyframe {
selector, selector,
block: Arc::new(self.shared_lock.wrap(block)), block: Arc::new(self.shared_lock.wrap(block)),
source_location, source_location: start.source_location(),
}))) })))
} }
} }
......
...@@ -27,7 +27,7 @@ use crate::values::computed::font::FamilyName; ...@@ -27,7 +27,7 @@ use crate::values::computed::font::FamilyName;
use crate::values::{CssUrl, CustomIdent, KeyframesName}; use crate::values::{CssUrl, CustomIdent, KeyframesName};
use crate::{Namespace, Prefix}; use crate::{Namespace, Prefix};
use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser}; use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser};
use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, SourceLocation}; use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, ParserState};
use selectors::SelectorList; use selectors::SelectorList;
use servo_arc::Arc; use servo_arc::Arc;
use style_traits::{ParseError, StyleParseErrorKind}; use style_traits::{ParseError, StyleParseErrorKind};
...@@ -251,10 +251,10 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> { ...@@ -251,10 +251,10 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
fn parse_block<'t>( fn parse_block<'t>(
&mut self, &mut self,
prelude: AtRuleBlockPrelude, prelude: AtRuleBlockPrelude,
location: SourceLocation, start: &ParserState,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<CssRule, ParseError<'i>> { ) -> Result<CssRule, ParseError<'i>> {
AtRuleParser::parse_block(&mut self.nested(), prelude, location, input).map(|rule| { AtRuleParser::parse_block(&mut self.nested(), prelude, start, input).map(|rule| {
self.state = State::Body; self.state = State::Body;
rule rule
}) })
...@@ -264,8 +264,8 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> { ...@@ -264,8 +264,8 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
fn rule_without_block( fn rule_without_block(
&mut self, &mut self,
prelude: AtRuleNonBlockPrelude, prelude: AtRuleNonBlockPrelude,
source_location: SourceLocation, start: &ParserState,
) -> CssRule { ) -> Self::AtRule {
match prelude { match prelude {
AtRuleNonBlockPrelude::Import(url, media) => { AtRuleNonBlockPrelude::Import(url, media) => {
let loader = self let loader = self
...@@ -274,7 +274,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> { ...@@ -274,7 +274,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
let import_rule = loader.request_stylesheet( let import_rule = loader.request_stylesheet(
url, url,
source_location, start.source_location(),
&self.context, &self.context,
&self.shared_lock, &self.shared_lock,
media, media,
...@@ -296,7 +296,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> { ...@@ -296,7 +296,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
CssRule::Namespace(Arc::new(self.shared_lock.wrap(NamespaceRule { CssRule::Namespace(Arc::new(self.shared_lock.wrap(NamespaceRule {
prefix, prefix,
url, url,
source_location, source_location: start.source_location(),
}))) })))
}, },
} }
...@@ -324,10 +324,10 @@ impl<'a, 'i> QualifiedRuleParser<'i> for TopLevelRuleParser<'a> { ...@@ -324,10 +324,10 @@ impl<'a, 'i> QualifiedRuleParser<'i> for TopLevelRuleParser<'a> {
fn parse_block<'t>( fn parse_block<'t>(
&mut self, &mut self,
prelude: Self::Prelude, prelude: Self::Prelude,
location: SourceLocation, start: &ParserState,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<CssRule, ParseError<'i>> { ) -> Result<CssRule, ParseError<'i>> {
QualifiedRuleParser::parse_block(&mut self.nested(), prelude, location, input).map( QualifiedRuleParser::parse_block(&mut self.nested(), prelude, start, input).map(
|result| { |result| {
self.state = State::Body; self.state = State::Body;
result result
...@@ -461,7 +461,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -461,7 +461,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
fn parse_block<'t>( fn parse_block<'t>(
&mut self, &mut self,
prelude: AtRuleBlockPrelude, prelude: AtRuleBlockPrelude,
source_location: SourceLocation, start: &ParserState,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<CssRule, ParseError<'i>> { ) -> Result<CssRule, ParseError<'i>> {
match prelude { match prelude {
...@@ -473,7 +473,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -473,7 +473,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
); );
Ok(CssRule::FontFace(Arc::new(self.shared_lock.wrap( Ok(CssRule::FontFace(Arc::new(self.shared_lock.wrap(
parse_font_face_block(&context, input, source_location).into(), parse_font_face_block(&context, input, start.source_location()).into(),
)))) ))))
}, },
AtRuleBlockPrelude::FontFeatureValues(family_names) => { AtRuleBlockPrelude::FontFeatureValues(family_names) => {
...@@ -484,7 +484,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -484,7 +484,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
); );
Ok(CssRule::FontFeatureValues(Arc::new(self.shared_lock.wrap( Ok(CssRule::FontFeatureValues(Arc::new(self.shared_lock.wrap(
FontFeatureValuesRule::parse(&context, input, family_names, source_location), FontFeatureValuesRule::parse(&context, input, family_names, start.source_location()),
)))) ))))
}, },
AtRuleBlockPrelude::CounterStyle(name) => { AtRuleBlockPrelude::CounterStyle(name) => {
...@@ -495,14 +495,14 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -495,14 +495,14 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
); );
Ok(CssRule::CounterStyle(Arc::new(self.shared_lock.wrap( Ok(CssRule::CounterStyle(Arc::new(self.shared_lock.wrap(
parse_counter_style_body(name, &context, input, source_location)?.into(), parse_counter_style_body(name, &context, input, start.source_location())?.into(),
)))) ))))
}, },
AtRuleBlockPrelude::Media(media_queries) => { AtRuleBlockPrelude::Media(media_queries) => {
Ok(CssRule::Media(Arc::new(self.shared_lock.wrap(MediaRule { Ok(CssRule::Media(Arc::new(self.shared_lock.wrap(MediaRule {
media_queries, media_queries,
rules: self.parse_nested_rules(input, CssRuleType::Media), rules: self.parse_nested_rules(input, CssRuleType::Media),
source_location, source_location: start.source_location(),
})))) }))))
}, },
AtRuleBlockPrelude::Supports(condition) => { AtRuleBlockPrelude::Supports(condition) => {
...@@ -518,7 +518,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -518,7 +518,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
condition, condition,
rules: self.parse_nested_rules(input, CssRuleType::Supports), rules: self.parse_nested_rules(input, CssRuleType::Supports),
enabled, enabled,
source_location, source_location: start.source_location(),
}, },
)))) ))))
}, },
...@@ -545,7 +545,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -545,7 +545,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
name, name,
keyframes: parse_keyframe_list(&context, input, self.shared_lock), keyframes: parse_keyframe_list(&context, input, self.shared_lock),
vendor_prefix, vendor_prefix,
source_location, source_location: start.source_location(),
}, },
)))) ))))
}, },
...@@ -559,7 +559,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -559,7 +559,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
let declarations = parse_property_declaration_list(&context, input, None); let declarations = parse_property_declaration_list(&context, input, None);
Ok(CssRule::Page(Arc::new(self.shared_lock.wrap(PageRule { Ok(CssRule::Page(Arc::new(self.shared_lock.wrap(PageRule {
block: Arc::new(self.shared_lock.wrap(declarations)), block: Arc::new(self.shared_lock.wrap(declarations)),
source_location, source_location: start.source_location(),
})))) }))))
}, },
AtRuleBlockPrelude::Document(condition) => { AtRuleBlockPrelude::Document(condition) => {
...@@ -570,7 +570,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -570,7 +570,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
DocumentRule { DocumentRule {
condition, condition,
rules: self.parse_nested_rules(input, CssRuleType::Document), rules: self.parse_nested_rules(input, CssRuleType::Document),
source_location, source_location: start.source_location(),
}, },
)))) ))))
}, },
...@@ -598,7 +598,7 @@ impl<'a, 'b, 'i> QualifiedRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -598,7 +598,7 @@ impl<'a, 'b, 'i> QualifiedRuleParser<'i> for NestedRuleParser<'a, 'b> {
fn parse_block<'t>( fn parse_block<'t>(
&mut self, &mut self,
selectors: Self::Prelude, selectors: Self::Prelude,
source_location: SourceLocation, start: &ParserState,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<CssRule, ParseError<'i>> { ) -> Result<CssRule, ParseError<'i>> {
let context = let context =
...@@ -609,7 +609,7 @@ impl<'a, 'b, 'i> QualifiedRuleParser<'i> for NestedRuleParser<'a, 'b> { ...@@ -609,7 +609,7 @@ impl<'a, 'b, 'i> QualifiedRuleParser<'i> for NestedRuleParser<'a, 'b> {
Ok(CssRule::Style(Arc::new(self.shared_lock.wrap(StyleRule { Ok(CssRule::Style(Arc::new(self.shared_lock.wrap(StyleRule {
selectors, selectors,
block, block,
source_location, source_location: start.source_location(),
})))) }))))
} }
} }
...@@ -15,7 +15,7 @@ gecko = [] ...@@ -15,7 +15,7 @@ gecko = []
[dependencies] [dependencies]
app_units = "0.7" app_units = "0.7"
cssparser = "0.27" cssparser = "0.28"
bitflags = "1.0" bitflags = "1.0"
euclid = "0.20" euclid = "0.20"
lazy_static = "1" lazy_static = "1"
......
...@@ -14,7 +14,7 @@ servo = ["cssparser/serde", "string_cache"] ...@@ -14,7 +14,7 @@ servo = ["cssparser/serde", "string_cache"]
gecko = [] gecko = []
[dependencies] [dependencies]
cssparser = "0.27" cssparser = "0.28"
servo_arc = { path = "../servo_arc" } servo_arc = { path = "../servo_arc" }
smallbitvec = "2.1.1" smallbitvec = "2.1.1"
smallvec = "1.0" smallvec = "1.0"
......
...@@ -16,7 +16,7 @@ gecko_refcount_logging = ["style/gecko_refcount_logging", "servo_arc/gecko_refco ...@@ -16,7 +16,7 @@ gecko_refcount_logging = ["style/gecko_refcount_logging", "servo_arc/gecko_refco
[dependencies] [dependencies]
atomic_refcell = "0.1" atomic_refcell = "0.1"
bincode = "1.0" bincode = "1.0"
cssparser = "0.27" cssparser = "0.28"
cstr = "0.1.2" cstr = "0.1.2"
libc = "0.2" libc = "0.2"
log = {version = "0.4", features = ["release_max_level_info"]} log = {version = "0.4", features = ["release_max_level_info"]}
......
...@@ -11,7 +11,7 @@ doctest = false ...@@ -11,7 +11,7 @@ doctest = false
[dependencies] [dependencies]
atomic_refcell = "0.1" atomic_refcell = "0.1"
cssparser = "0.27" cssparser = "0.28"
cstr = "0.1.2" cstr = "0.1.2"
env_logger = { version = "0.6", default-features = false } env_logger = { version = "0.6", default-features = false }
geckoservo = {path = "../../../ports/geckolib"} geckoservo = {path = "../../../ports/geckolib"}
......
...@@ -12,7 +12,7 @@ doctest = false ...@@ -12,7 +12,7 @@ doctest = false
[dependencies] [dependencies]
byteorder = "1.0" byteorder = "1.0"
app_units = "0.7" app_units = "0.7"
cssparser = "0.27" cssparser = "0.28"
euclid = "0.20" euclid = "0.20"
html5ever = "0.22" html5ever = "0.22"
parking_lot = "0.10" parking_lot = "0.10"
......
{"files":{"Cargo.toml":"53761c6ce14b954599553cc780908f422dc9e48b6183876a7be0e435fd200fa0","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"a533b45a9c43083c6a6000a9c99a1acfed123d6430b232352ae02f1144a09f12","build.rs":"a9619dbf086f20d3cbfee2b05c1a761f683acb30191d7286d24ad53617e9043b","build/match_byte.rs":"f57faf0597cb7b3e32999c5fb1215a43a5603121588c67d5031f720362171e1c","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"d2e14b341fbc2d141b1fed4b4a91b31e32bf92461b067036bd4227cda19e4e72","src/cow_rc_str.rs":"89b5dff5cf80eef3fcff0c11799e54a978d02d8b8963a621fbb999d35e7c03a3","src/from_bytes.rs":"b1cf15c4e975523fef46b575598737a39f3c63e5ce0b2bfd6ec627c69c6ea54a","src/lib.rs":"2b20764b713020d59b7533ee686ef688ad70e85f61d2b3fab70e1af0f409f8e4","src/macros.rs":"cc5b13b5c605cd138b8311a9484d184fa3d063189e75d291223178f9eafe53c7","src/nth.rs":"2490db52a28d09009d73474336f12738ef5f0ffbbc4f1b49ee1e56ca9ca8b34b","src/parser.rs":"3bfeeda068567699e6ff5a6967c95473bc99910aedceb406347e05a98339cdac","src/rules_and_declarations.rs":"19d0079eca3e1776823ef8a16a0afd1619b9f7a392068c583487d891674225b2","src/serializer.rs":"c3b810e0970688a40d279101c379cfee110b100e1ff1a2cc40363971fd7bf591","src/size_of_tests.rs":"acd10556e060e4149e9f565f36058ca26bf3b3296d512d45127845fa12b94539","src/tests.rs":"247b0b332e77c1703ffbaaad9b5540571609e0fdc49f91998171820619d06f03","src/tokenizer.rs":"76360e46c0efceff82b6336b3522c95bdb8ef96379a617e7eed12eec9bad7ab7","src/unicode_range.rs":"20d96f06fbb73921e308cc340c9fe065e27f19843005689fb259007a6a372bcc"},"package":"754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a"} {"files":{"Cargo.toml":"3433246693b26ae30214281dadded990707a23c70bc915ee2ca5b1482f15b05c","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"a533b45a9c43083c6a6000a9c99a1acfed123d6430b232352ae02f1144a09f12","build.rs":"a9619dbf086f20d3cbfee2b05c1a761f683acb30191d7286d24ad53617e9043b","build/match_byte.rs":"f57faf0597cb7b3e32999c5fb1215a43a5603121588c67d5031f720362171e1c","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"d8f574e2b6b3f5c144e5030037eb5e9db31d96d484a60e6503ca98395fd7f3af","src/cow_rc_str.rs":"89b5dff5cf80eef3fcff0c11799e54a978d02d8b8963a621fbb999d35e7c03a3","src/from_bytes.rs":"b1cf15c4e975523fef46b575598737a39f3c63e5ce0b2bfd6ec627c69c6ea54a","src/lib.rs":"2b20764b713020d59b7533ee686ef688ad70e85f61d2b3fab70e1af0f409f8e4","src/macros.rs":"cc5b13b5c605cd138b8311a9484d184fa3d063189e75d291223178f9eafe53c7","src/nth.rs":"ae2f8b0f2c9e8b1ffb3cb842ca78c0060829a7d2e0762d1eb427f40188686ba1","src/parser.rs":"5c8ed6ccc069d0d2526016aeeba7200275b5fb1d8271926ccdb7a848124cde45","src/rules_and_declarations.rs":"1f171431f5f4d0d6bd631deeb7c684100c6e15f10e06b8fff1e6d676567c27c3","src/serializer.rs":"c3b810e0970688a40d279101c379cfee110b100e1ff1a2cc40363971fd7bf591","src/size_of_tests.rs":"acd10556e060e4149e9f565f36058ca26bf3b3296d512d45127845fa12b94539","src/tests.rs":"8022811a7fc90199e1f775fb1cf567ac15fca8a00d5f2cf934863a8b36997cba","src/tokenizer.rs":"76360e46c0efceff82b6336b3522c95bdb8ef96379a617e7eed12eec9bad7ab7","src/unicode_range.rs":"20d96f06fbb73921e308cc340c9fe065e27f19843005689fb259007a6a372bcc"},"package":"809d22aba9ffd53e9028f2d37261f1826ef613d0e96b1a5ddeefa97cde82bcca"}
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
[package] [package]
edition = "2018" edition = "2018"
name = "cssparser" name = "cssparser"
version = "0.27.2" version = "0.28.0"
authors = ["Simon Sapin <simon.sapin@exyr.org>"] authors = ["Simon Sapin <simon.sapin@exyr.org>"]
build = "build.rs" build = "build.rs"
exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"] exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"]
......
...@@ -291,7 +291,7 @@ impl Color { ...@@ -291,7 +291,7 @@ impl Color {
let name = name.clone(); let name = name.clone();
return input.parse_nested_block(|arguments| { return input.parse_nested_block(|arguments| {
parse_color_function(component_parser, &*name, arguments) parse_color_function(component_parser, &*name, arguments)
}) });
} }
_ => Err(()), _ => Err(()),
} }
......
...@@ -73,12 +73,12 @@ pub fn parse_nth<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(i32, i32), Basic ...@@ -73,12 +73,12 @@ pub fn parse_nth<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(i32, i32), Basic
ref token => { ref token => {
let token = token.clone(); let token = token.clone();
Err(input.new_basic_unexpected_token_error(token)) Err(input.new_basic_unexpected_token_error(token))
}, }
}, },
ref token => { ref token => {
let token = token.clone(); let token = token.clone();
Err(input.new_basic_unexpected_token_error(token)) Err(input.new_basic_unexpected_token_error(token))
}, }
} }
} }
......
...@@ -933,17 +933,15 @@ impl<'i: 't, 't> Parser<'i, 't> { ...@@ -933,17 +933,15 @@ impl<'i: 't, 't> Parser<'i, 't> {
Ok(&Token::Function(_)) Ok(&Token::Function(_))
| Ok(&Token::ParenthesisBlock) | Ok(&Token::ParenthesisBlock)
| Ok(&Token::SquareBracketBlock) | Ok(&Token::SquareBracketBlock)
| Ok(&Token::CurlyBracketBlock) => { | Ok(&Token::CurlyBracketBlock) => self
self.parse_nested_block(|input| { .parse_nested_block(|input| input.expect_no_error_token().map_err(Into::into))
input.expect_no_error_token().map_err(Into::into) .map_err(ParseError::<()>::basic)?,
}).map_err(ParseError::<()>::basic)?
}
Ok(t) => { Ok(t) => {
// FIXME: maybe these should be separate variants of // FIXME: maybe these should be separate variants of
// BasicParseError instead? // BasicParseError instead?
if t.is_parse_error() { if t.is_parse_error() {
let token = t.clone(); let token = t.clone();
return Err(self.new_basic_unexpected_token_error(token)) return Err(self.new_basic_unexpected_token_error(token));
} }
} }
Err(_) => return Ok(()), Err(_) => return Ok(()),
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// https://drafts.csswg.org/css-syntax/#parsing // https://drafts.csswg.org/css-syntax/#parsing
use super::{BasicParseError, BasicParseErrorKind, Delimiter}; use super::{BasicParseError, BasicParseErrorKind, Delimiter};
use super::{ParseError, Parser, SourceLocation, Token}; use super::{ParseError, Parser, Token};
use crate::cow_rc_str::CowRcStr; use crate::cow_rc_str::CowRcStr;
use crate::parser::{parse_nested_block, parse_until_after, parse_until_before, ParserState}; use crate::parser::{parse_nested_block, parse_until_after, parse_until_before, ParserState};
...@@ -130,10 +130,10 @@ pub trait AtRuleParser<'i> { ...@@ -130,10 +130,10 @@ pub trait AtRuleParser<'i> {
fn rule_without_block( fn rule_without_block(
&mut self, &mut self,
prelude: Self::PreludeNoBlock, prelude: Self::PreludeNoBlock,
location: SourceLocation, start: &ParserState,
) -> Self::AtRule { ) -> Self::AtRule {
let _ = prelude; let _ = prelude;
let _ = location; let _ = start;
panic!( panic!(
"The `AtRuleParser::rule_without_block` method must be overriden \ "The `AtRuleParser::rule_without_block` method must be overriden \
if `AtRuleParser::parse_prelude` ever returns `AtRuleType::WithoutBlock`."