mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Introduce CommaWithSpace
This allows us to support stroke-dasharray the same way as comma-separated values.
This commit is contained in:
parent
17875b8a81
commit
c03f5f19ab
4 changed files with 39 additions and 23 deletions
|
@ -172,22 +172,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Parse a non-empty space-separated or comma-separated list of objects parsed by parse_one
|
||||
pub fn parse_space_or_comma_separated<'i, 't, F, T>(input: &mut Parser<'i, 't>, mut parse_one: F)
|
||||
-> Result<Vec<T>, ParseError<'i>>
|
||||
where F: for<'ii, 'tt> FnMut(&mut Parser<'ii, 'tt>) -> Result<T, ParseError<'ii>> {
|
||||
let first = parse_one(input)?;
|
||||
let mut vec = vec![first];
|
||||
loop {
|
||||
let _ = input.try(|i| i.expect_comma());
|
||||
if let Ok(val) = input.try(|i| parse_one(i)) {
|
||||
vec.push(val)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
Ok(vec)
|
||||
}
|
||||
impl Parse for UnicodeRange {
|
||||
fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<Self, ParseError<'i>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue