Update to cssparser 0.22 (source location in error types)

This commit is contained in:
Simon Sapin 2017-09-29 21:18:35 +02:00
parent 056e599562
commit c0f8f15f39
90 changed files with 974 additions and 790 deletions

View file

@ -205,7 +205,9 @@
};
match result {
Some(result) => content.push(result?),
None => return Err(StyleParseError::UnexpectedFunction(name.clone()).into())
None => return Err(input.new_custom_error(
StyleParseErrorKind::UnexpectedFunction(name.clone())
))
}
}
Ok(Token::Ident(ref ident)) => {
@ -218,15 +220,15 @@
_ => false,
};
if !valid {
return Err(SelectorParseError::UnexpectedIdent(ident.clone()).into())
return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
}
}
Err(_) => break,
Ok(t) => return Err(BasicParseError::UnexpectedToken(t).into())
Ok(t) => return Err(input.new_unexpected_token_error(t))
}
}
if content.is_empty() {
return Err(StyleParseError::UnspecifiedError.into());
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
Ok(SpecifiedValue::Items(content))
}
@ -332,9 +334,10 @@
let mut counters = Vec::new();
loop {
let location = input.current_source_location();
let counter_name = match input.next() {
Ok(&Token::Ident(ref ident)) => CustomIdent::from_ident(ident, &["none"])?,
Ok(t) => return Err(BasicParseError::UnexpectedToken(t.clone()).into()),
Ok(&Token::Ident(ref ident)) => CustomIdent::from_ident(location, ident, &["none"])?,
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(_) => break,
};
let counter_delta = input.try(|input| specified::parse_integer(context, input))
@ -345,7 +348,7 @@
if !counters.is_empty() {
Ok(SpecifiedValue(counters))
} else {
Err(StyleParseError::UnspecifiedError.into())
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}
}
</%helpers:longhand>