mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Introduce Separator::parse
This commit is contained in:
parent
6c17bb03ce
commit
17875b8a81
6 changed files with 59 additions and 26 deletions
|
@ -7,7 +7,7 @@
|
|||
use context::QuirksMode;
|
||||
use cssparser::{Parser, SourcePosition, UnicodeRange};
|
||||
use error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use style_traits::{OneOrMoreSeparated, IsCommaSeparator, ParseError, ParsingMode};
|
||||
use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator};
|
||||
#[cfg(feature = "gecko")]
|
||||
use style_traits::{PARSING_MODE_DEFAULT, PARSING_MODE_ALLOW_UNITLESS_LENGTH, PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES};
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData, Namespaces};
|
||||
|
@ -161,12 +161,14 @@ pub trait Parse : Sized {
|
|||
-> Result<Self, ParseError<'i>>;
|
||||
}
|
||||
|
||||
impl<T> Parse for Vec<T> where T: Parse + OneOrMoreSeparated,
|
||||
<T as OneOrMoreSeparated>::S: IsCommaSeparator
|
||||
impl<T> Parse for Vec<T>
|
||||
where
|
||||
T: Parse + OneOrMoreSeparated,
|
||||
<T as OneOrMoreSeparated>::S: Separator,
|
||||
{
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<Self, ParseError<'i>> {
|
||||
input.parse_comma_separated(|input| T::parse(context, input))
|
||||
<T as OneOrMoreSeparated>::S::parse(input, |i| T::parse(context, i))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue