[librsvg: 2/3] Finally rename CssParseError to ParseError.
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/3] Finally rename CssParseError to ParseError.
- Date: Tue, 14 Jan 2020 00:34:24 +0000 (UTC)
commit ff41b8c5194bcbe94e71677b5b73195a0cf1c32a
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jan 13 17:50:02 2020 -0600
Finally rename CssParseError to ParseError.
rsvg_internals/src/angle.rs | 2 +-
rsvg_internals/src/aspect_ratio.rs | 2 +-
rsvg_internals/src/color.rs | 8 ++++----
rsvg_internals/src/coord_units.rs | 4 ++--
rsvg_internals/src/css.rs | 24 ++++++++++++++----------
rsvg_internals/src/dasharray.rs | 2 +-
rsvg_internals/src/error.rs | 6 +++---
rsvg_internals/src/filters/blend.rs | 2 +-
rsvg_internals/src/filters/color_matrix.rs | 2 +-
rsvg_internals/src/filters/component_transfer.rs | 2 +-
rsvg_internals/src/filters/composite.rs | 2 +-
rsvg_internals/src/filters/convolve_matrix.rs | 4 ++--
rsvg_internals/src/filters/displacement_map.rs | 2 +-
rsvg_internals/src/filters/input.rs | 4 ++--
rsvg_internals/src/filters/morphology.rs | 2 +-
rsvg_internals/src/filters/turbulence.rs | 4 ++--
rsvg_internals/src/font_props.rs | 10 +++++-----
rsvg_internals/src/gradient.rs | 2 +-
rsvg_internals/src/iri.rs | 2 +-
rsvg_internals/src/length.rs | 2 +-
rsvg_internals/src/marker.rs | 4 ++--
rsvg_internals/src/number_list.rs | 4 ++--
rsvg_internals/src/paint_server.rs | 2 +-
rsvg_internals/src/parsers.rs | 10 +++++-----
rsvg_internals/src/properties.rs | 14 +++++++-------
rsvg_internals/src/property_defs.rs | 8 ++++----
rsvg_internals/src/property_macros.rs | 6 +++---
rsvg_internals/src/shapes.rs | 2 +-
rsvg_internals/src/style.rs | 2 +-
rsvg_internals/src/transform.rs | 24 ++++++++++++------------
rsvg_internals/src/unit_interval.rs | 2 +-
rsvg_internals/src/viewbox.rs | 2 +-
32 files changed, 86 insertions(+), 82 deletions(-)
---
diff --git a/rsvg_internals/src/angle.rs b/rsvg_internals/src/angle.rs
index 436bdf79..ed647c9f 100644
--- a/rsvg_internals/src/angle.rs
+++ b/rsvg_internals/src/angle.rs
@@ -62,7 +62,7 @@ impl Angle {
// angle ::= number ("deg" | "grad" | "rad")?
//
impl Parse for Angle {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Angle, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Angle, ParseError<'i>> {
let angle = {
let loc = parser.current_source_location();
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index f51b7a23..c8d441ef 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -220,7 +220,7 @@ fn parse_fit_mode<'i>(parser: &mut Parser<'i, '_>) -> Result<FitMode, BasicParse
}
impl Parse for AspectRatio {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<AspectRatio, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<AspectRatio, ParseError<'i>> {
let defer = parser
.try_parse(|p| p.expect_ident_matching("defer"))
.is_ok();
diff --git a/rsvg_internals/src/color.rs b/rsvg_internals/src/color.rs
index 4bafbcb6..ddd271fe 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -10,13 +10,13 @@ use crate::util::utf8_cstr;
pub use cssparser::Color;
impl Parse for cssparser::Color {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<cssparser::Color, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<cssparser::Color, ParseError<'i>> {
Ok(cssparser::Color::parse(parser)?)
}
}
impl Parse for cssparser::RGBA {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<cssparser::RGBA, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<cssparser::RGBA, ParseError<'i>> {
let loc = parser.current_source_location();
match cssparser::Color::parse(parser)? {
@@ -66,8 +66,8 @@ pub fn rgba_to_argb(rgba: cssparser::RGBA) -> u32 {
| u32::from(rgba.blue)
}
-impl<'i> From<Result<Option<cssparser::Color>, CssParseError<'i>>> for ColorSpec {
- fn from(result: Result<Option<cssparser::Color>, CssParseError<'i>>) -> ColorSpec {
+impl<'i> From<Result<Option<cssparser::Color>, ParseError<'i>>> for ColorSpec {
+ fn from(result: Result<Option<cssparser::Color>, ParseError<'i>>) -> ColorSpec {
match result {
Ok(None) => ColorSpec {
kind: ColorKind::Inherit,
diff --git a/rsvg_internals/src/coord_units.rs b/rsvg_internals/src/coord_units.rs
index febd6c77..20925ef9 100644
--- a/rsvg_internals/src/coord_units.rs
+++ b/rsvg_internals/src/coord_units.rs
@@ -15,7 +15,7 @@ pub enum CoordUnits {
}
impl Parse for CoordUnits {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"userSpaceOnUse" => CoordUnits::UserSpaceOnUse,
@@ -53,7 +53,7 @@ macro_rules! coord_units {
impl $crate::parsers::Parse for $name {
fn parse<'i>(
parser: &mut ::cssparser::Parser<'i, '_>,
- ) -> Result<Self, $crate::error::CssParseError<'i>> {
+ ) -> Result<Self, $crate::error::ParseError<'i>> {
Ok($name($crate::coord_units::CoordUnits::parse(parser)?))
}
}
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index 6d654dea..7cde8715 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -73,7 +73,11 @@
//! the rules in the stylesheets and gather the matches; then sort the
//! matches by specificity and apply the result to each element.
-use cssparser::*;
+use cssparser::{
+ self, match_ignore_ascii_case, parse_important, AtRuleParser, AtRuleType, BasicParseErrorKind,
+ CowRcStr, DeclarationListParser, DeclarationParser, Parser, ParserInput, QualifiedRuleParser,
+ RuleListParser, SourceLocation, ToCss, _cssparser_internal_to_lowercase,
+};
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, QuirksMode};
use selectors::{OpaqueElement, SelectorImpl, SelectorList};
@@ -119,10 +123,10 @@ impl<'i> DeclarationParser<'i> for DeclParser {
&mut self,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
- ) -> Result<Declaration, CssParseError<'i>> {
+ ) -> Result<Declaration, ParseError<'i>> {
let prop_name = QualName::new(None, ns!(), LocalName::from(name.as_ref()));
let property = parse_property(&prop_name, input, true)
- .map_err(|_| input.new_custom_error(ValueErrorKind::parse_error("parse error")))?;
+ .map_err(|_| input.new_custom_error(ValueErrorKind::parse_error("parse error")))?;
let important = input.try_parse(parse_important).is_ok();
@@ -151,13 +155,13 @@ pub struct RuleParser;
/// Errors from the CSS parsing process
#[derive(Debug)]
-pub enum CssParseErrorKind<'i> {
+pub enum ParseErrorKind<'i> {
Selector(selectors::parser::SelectorParseErrorKind<'i>),
}
-impl<'i> From<selectors::parser::SelectorParseErrorKind<'i>> for CssParseErrorKind<'i> {
- fn from(e: selectors::parser::SelectorParseErrorKind) -> CssParseErrorKind {
- CssParseErrorKind::Selector(e)
+impl<'i> From<selectors::parser::SelectorParseErrorKind<'i>> for ParseErrorKind<'i> {
+ fn from(e: selectors::parser::SelectorParseErrorKind) -> ParseErrorKind {
+ ParseErrorKind::Selector(e)
}
}
@@ -186,7 +190,7 @@ pub enum Rule {
// Required to implement the `Prelude` associated type in `cssparser::QualifiedRuleParser`
impl<'i> selectors::Parser<'i> for RuleParser {
type Impl = Selector;
- type Error = CssParseErrorKind<'i>;
+ type Error = ParseErrorKind<'i>;
fn default_namespace(&self) -> Option<<Self::Impl as SelectorImpl>::NamespaceUrl> {
Some(ns!(svg))
@@ -226,7 +230,7 @@ impl<'i> selectors::Parser<'i> for RuleParser {
impl<'i> QualifiedRuleParser<'i> for RuleParser {
type Prelude = SelectorList<Selector>;
type QualifiedRule = Rule;
- type Error = CssParseErrorKind<'i>;
+ type Error = ParseErrorKind<'i>;
fn parse_prelude<'t>(
&mut self,
@@ -265,7 +269,7 @@ impl<'i> AtRuleParser<'i> for RuleParser {
type PreludeBlock = ();
type PreludeNoBlock = AtRulePrelude;
type AtRule = Rule;
- type Error = CssParseErrorKind<'i>;
+ type Error = ParseErrorKind<'i>;
fn parse_prelude<'t>(
&mut self,
diff --git a/rsvg_internals/src/dasharray.rs b/rsvg_internals/src/dasharray.rs
index 1b31c269..35080c55 100644
--- a/rsvg_internals/src/dasharray.rs
+++ b/rsvg_internals/src/dasharray.rs
@@ -19,7 +19,7 @@ impl Default for Dasharray {
}
impl Parse for Dasharray {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Dasharray, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Dasharray, ParseError<'i>> {
if parser
.try_parse(|p| p.expect_ident_matching("none"))
.is_ok()
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index ba7f38fb..aee3f3d9 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -18,7 +18,7 @@ use crate::node::RsvgNode;
/// The code flow will sometimes require preserving this error as a long-lived struct;
/// see the `impl<'i, O> AttributeResultExt<O> for Result<O, ParseError<'i>>` for that
/// purpose.
-pub type CssParseError<'i> = cssparser::ParseError<'i, ValueErrorKind>;
+pub type ParseError<'i> = cssparser::ParseError<'i, ValueErrorKind>;
/// A simple error which refers to an attribute's value
#[derive(Debug, Clone, PartialEq)]
@@ -180,12 +180,12 @@ impl<O, E: Into<ValueErrorKind>> AttributeResultExt<O> for Result<O, E> {
}
/// Turns a short-lived `ParseError` into a long-lived `NodeError`
-impl<'i, O> AttributeResultExt<O> for Result<O, CssParseError<'i>> {
+impl<'i, O> AttributeResultExt<O> for Result<O, ParseError<'i>> {
fn attribute(self, attr: QualName) -> Result<O, NodeError> {
self.map_err(|e| {
// FIXME: eventually, here we'll want to preserve the location information
- let CssParseError {
+ let ParseError {
kind,
location: _location,
} = e;
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index b8fe5ebd..8bef9b96 100755
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -105,7 +105,7 @@ impl FilterEffect for FeBlend {
}
impl Parse for Mode {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"normal" => Mode::Normal,
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index 6b2f53c2..5882e93a 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -224,7 +224,7 @@ impl FilterEffect for FeColorMatrix {
}
impl Parse for OperationType {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"matrix" => OperationType::Matrix,
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 0fd21293..5024ccc2 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -60,7 +60,7 @@ enum FunctionType {
}
impl Parse for FunctionType {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"identity" => FunctionType::Identity,
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 615971e7..aec3fd9f 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -117,7 +117,7 @@ impl FilterEffect for FeComposite {
}
impl Parse for Operator {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"over" => Operator::Over,
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index df3d074b..4a22a028 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -334,7 +334,7 @@ impl FilterEffect for FeConvolveMatrix {
}
impl Parse for EdgeMode {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"duplicate" => EdgeMode::Duplicate,
@@ -346,7 +346,7 @@ impl Parse for EdgeMode {
// Used for the preserveAlpha attribute
impl Parse for bool {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"false" => false,
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index 7588a228..aa7d8b3e 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -146,7 +146,7 @@ impl FilterEffect for FeDisplacementMap {
}
impl Parse for ColorChannel {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"R" => ColorChannel::R,
diff --git a/rsvg_internals/src/filters/input.rs b/rsvg_internals/src/filters/input.rs
index 2547edad..55bb69bf 100644
--- a/rsvg_internals/src/filters/input.rs
+++ b/rsvg_internals/src/filters/input.rs
@@ -20,7 +20,7 @@ pub enum Input {
pub struct CustomIdent(String);
impl Parse for Input {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
parser
.try_parse(|p| {
Ok(parse_identifiers!(
@@ -41,7 +41,7 @@ impl Parse for Input {
}
impl Parse for CustomIdent {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
let loc = parser.current_source_location();
let token = parser.next()?;
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index 046a8c30..83302fb2 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -158,7 +158,7 @@ impl FilterEffect for FeMorphology {
}
impl Parse for Operator {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"erode" => Operator::Erode,
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index 348ae3f7..817e5d45 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -418,7 +418,7 @@ impl FilterEffect for FeTurbulence {
}
impl Parse for StitchTiles {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"stitch" => StitchTiles::Stitch,
@@ -428,7 +428,7 @@ impl Parse for StitchTiles {
}
impl Parse for NoiseType {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"fractalNoise" => NoiseType::FractalNoise,
diff --git a/rsvg_internals/src/font_props.rs b/rsvg_internals/src/font_props.rs
index e8c9c94e..d61a9da3 100644
--- a/rsvg_internals/src/font_props.rs
+++ b/rsvg_internals/src/font_props.rs
@@ -61,7 +61,7 @@ impl FontSizeSpec {
}
impl Parse for FontSizeSpec {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<FontSizeSpec, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<FontSizeSpec, ParseError<'i>> {
parser
.try_parse(|p| Length::<Both>::parse(p))
.and_then(|l| Ok(FontSizeSpec::Value(l)))
@@ -101,7 +101,7 @@ pub enum FontWeightSpec {
}
impl Parse for FontWeightSpec {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<FontWeightSpec, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<FontWeightSpec, ParseError<'i>> {
parser
.try_parse(|p| {
Ok(parse_identifiers!(
@@ -112,7 +112,7 @@ impl Parse for FontWeightSpec {
"lighter" => FontWeightSpec::Lighter,
)?)
})
- .or_else(|_: CssParseError| {
+ .or_else(|_: ParseError| {
let loc = parser.current_source_location();
parser
.expect_integer()
@@ -163,7 +163,7 @@ impl LetterSpacingSpec {
}
impl Parse for LetterSpacingSpec {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<LetterSpacingSpec, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<LetterSpacingSpec, ParseError<'i>> {
parser
.try_parse(|p| Length::<Horizontal>::parse(p))
.and_then(|l| Ok(LetterSpacingSpec::Value(l)))
@@ -181,7 +181,7 @@ impl Parse for LetterSpacingSpec {
pub struct SingleFontFamily(pub String);
impl Parse for SingleFontFamily {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<SingleFontFamily, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<SingleFontFamily, ParseError<'i>> {
let loc = parser.current_source_location();
if let Ok(cow) = parser.try_parse(|p| p.expect_string_cloned()) {
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index dda0e1b1..89bfbf9e 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -43,7 +43,7 @@ enum SpreadMethod {
}
impl Parse for SpreadMethod {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<SpreadMethod, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<SpreadMethod, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"pad" => SpreadMethod::Pad,
diff --git a/rsvg_internals/src/iri.rs b/rsvg_internals/src/iri.rs
index 4ab2a3dc..3478210a 100644
--- a/rsvg_internals/src/iri.rs
+++ b/rsvg_internals/src/iri.rs
@@ -35,7 +35,7 @@ impl IRI {
}
impl Parse for IRI {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<IRI, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<IRI, ParseError<'i>> {
if parser
.try_parse(|i| i.expect_ident_matching("none"))
.is_ok()
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index eef0fb50..be8f58ef 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -227,7 +227,7 @@ const MM_PER_INCH: f64 = 25.4;
const PICA_PER_INCH: f64 = 6.0;
impl<N: Normalize> Parse for Length<N> {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Length<N>, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Length<N>, ParseError<'i>> {
let length = {
let token = parser.next()?.clone();
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 22158cba..5c31439d 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -37,7 +37,7 @@ impl Default for MarkerUnits {
}
impl Parse for MarkerUnits {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<MarkerUnits, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<MarkerUnits, ParseError<'i>> {
Ok(parse_identifiers!(
parser,
"userSpaceOnUse" => MarkerUnits::UserSpaceOnUse,
@@ -60,7 +60,7 @@ impl Default for MarkerOrient {
}
impl Parse for MarkerOrient {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<MarkerOrient, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<MarkerOrient, ParseError<'i>> {
parser
.try_parse(|p| p.expect_ident_matching("auto").map(|_| MarkerOrient::Auto))
.or_else(|_| Angle::parse(parser).map(MarkerOrient::Angle))
diff --git a/rsvg_internals/src/number_list.rs b/rsvg_internals/src/number_list.rs
index e0768ea5..c1035bdb 100644
--- a/rsvg_internals/src/number_list.rs
+++ b/rsvg_internals/src/number_list.rs
@@ -18,7 +18,7 @@ impl NumberList {
pub fn parse<'i>(
parser: &mut Parser<'i, '_>,
length: NumberListLength,
- ) -> Result<Self, CssParseError<'i>> {
+ ) -> Result<Self, ParseError<'i>> {
let mut v = match length {
NumberListLength::Exact(l) if l > 0 => Vec::<f64>::with_capacity(l),
NumberListLength::Exact(_) => unreachable!("NumberListLength::Exact cannot be 0"),
@@ -62,7 +62,7 @@ impl NumberList {
pub fn parse_str<'i>(
s: &'i str,
length: NumberListLength,
- ) -> Result<NumberList, CssParseError<'i>> {
+ ) -> Result<NumberList, ParseError<'i>> {
let mut input = ParserInput::new(s);
let mut parser = Parser::new(&mut input);
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index 3bd56946..61f17d98 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -22,7 +22,7 @@ pub enum PaintServer {
}
impl Parse for PaintServer {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<PaintServer, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<PaintServer, ParseError<'i>> {
if parser
.try_parse(|i| i.expect_ident_matching("none"))
.is_ok()
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index be6d5863..5ee31a27 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -12,13 +12,13 @@ pub trait Parse: Sized {
/// Parses a value out of the `parser`.
///
/// All value types should implement this for composability.
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>>;
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>>;
/// Convenience function to parse a value out of a `&str`.
///
/// This is useful mostly for tests which want to avoid creating a
/// `cssparser::Parser` by hand.
- fn parse_str<'i>(s: &'i str) -> Result<Self, CssParseError<'i>> {
+ fn parse_str<'i>(s: &'i str) -> Result<Self, ParseError<'i>> {
let mut input = ParserInput::new(s);
let mut parser = Parser::new(&mut input);
@@ -79,7 +79,7 @@ impl<T: Parse> ParseValue<T> for QualName {
}
impl Parse for f64 {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
let loc = parser.current_source_location();
parser.expect_number().map_err(|e| e.into()).and_then(|n| {
if n.is_finite() {
@@ -98,7 +98,7 @@ impl Parse for f64 {
pub struct NumberOptionalNumber<T: Parse>(pub T, pub T);
impl<T: Parse + Copy> Parse for NumberOptionalNumber<T> {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
let x = Parse::parse(parser)?;
if !parser.is_exhausted() {
@@ -116,7 +116,7 @@ impl Parse for i32 {
/// CSS integer
///
/// https://www.w3.org/TR/SVG11/types.html#DataTypeInteger
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
Ok(parser.expect_integer()?)
}
}
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 6b04d654..41f4a924 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -227,7 +227,7 @@ pub struct ComputedValues {
}
#[cfg_attr(rustfmt, rustfmt_skip)]
-pub fn parse_property<'i>(prop_name: &QualName, input: &mut Parser<'i, '_>, accept_shorthands: bool) ->
Result<ParsedProperty, CssParseError<'i>> {
+pub fn parse_property<'i>(prop_name: &QualName, input: &mut Parser<'i, '_>, accept_shorthands: bool) ->
Result<ParsedProperty, ParseError<'i>> {
// please keep these sorted
match prop_name.expanded() {
expanded_name!("", "baseline-shift") =>
@@ -541,7 +541,7 @@ impl SpecifiedValues {
Ok(prop) => self.set_parsed_property(&prop),
// not a presentation attribute; just ignore it
- Err(CssParseError {
+ Err(ParseError {
kind: ParseErrorKind::Custom(ValueErrorKind::UnknownProperty),
..
}) => (),
@@ -549,7 +549,7 @@ impl SpecifiedValues {
// https://www.w3.org/TR/CSS2/syndata.html#unsupported-values
// For all the following cases, ignore illegal values; don't set the whole node to
// be in error in that case.
- Err(CssParseError {
+ Err(ParseError {
kind: ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(ref t)),
..
}) => {
@@ -565,7 +565,7 @@ impl SpecifiedValues {
);
}
- Err(CssParseError {
+ Err(ParseError {
kind: ParseErrorKind::Basic(BasicParseErrorKind::EndOfInput),
..
}) => {
@@ -577,7 +577,7 @@ impl SpecifiedValues {
);
}
- Err(CssParseError {
+ Err(ParseError {
kind: ParseErrorKind::Basic(_),
..
}) => {
@@ -589,7 +589,7 @@ impl SpecifiedValues {
);
}
- Err(CssParseError {
+ Err(ParseError {
kind: ParseErrorKind::Custom(ref v),
..
}) => {
@@ -665,7 +665,7 @@ impl SpecifiedValues {
}
// Parses the value for the type `T` of the property out of the Parser, including `inherit` values.
-fn parse_input<'i, T>(input: &mut Parser<'i, '_>) -> Result<SpecifiedValue<T>, CssParseError<'i>>
+fn parse_input<'i, T>(input: &mut Parser<'i, '_>) -> Result<SpecifiedValue<T>, ParseError<'i>>
where
T: Property<ComputedValues> + Clone + Default + Parse,
{
diff --git a/rsvg_internals/src/property_defs.rs b/rsvg_internals/src/property_defs.rs
index 24fee846..3df0ba8b 100644
--- a/rsvg_internals/src/property_defs.rs
+++ b/rsvg_internals/src/property_defs.rs
@@ -44,9 +44,9 @@ make_property!(
impl Parse for BaselineShift {
// These values come from Inkscape's SP_CSS_BASELINE_SHIFT_(SUB/SUPER/BASELINE);
// see sp_style_merge_baseline_shift_from_parent()
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<BaselineShift,
crate::error::CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<BaselineShift, crate::error::ParseError<'i>>
{
parser.try_parse(|p| Ok(BaselineShift(Length::<Both>::parse(p)?)))
- .or_else(|_: CssParseError| {
+ .or_else(|_: ParseError| {
Ok(parse_identifiers!(
parser,
"baseline" => BaselineShift(Length::<Both>::new(0.0, LengthUnit::Percent)),
@@ -534,7 +534,7 @@ make_property!(
parse_impl: {
impl Parse for TextDecoration {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<TextDecoration, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<TextDecoration, ParseError<'i>> {
let mut overline = false;
let mut underline = false;
let mut strike = false;
@@ -691,7 +691,7 @@ make_property!(
impl Parse for XmlLang {
fn parse<'i>(
parser: &mut Parser<'i, '_>,
- ) -> Result<XmlLang, CssParseError<'i>> {
+ ) -> Result<XmlLang, ParseError<'i>> {
Ok(XmlLang(parser.expect_ident()?.to_string()))
}
}
diff --git a/rsvg_internals/src/property_macros.rs b/rsvg_internals/src/property_macros.rs
index 33211fca..99149e86 100644
--- a/rsvg_internals/src/property_macros.rs
+++ b/rsvg_internals/src/property_macros.rs
@@ -46,7 +46,7 @@ macro_rules! make_property {
impl_property!($computed_values_type, $name, $inherits_automatically);
impl crate::parsers::Parse for $name {
- fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name,
crate::error::CssParseError<'i>> {
+ fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name,
crate::error::ParseError<'i>> {
Ok(parse_identifiers!(
parser,
$($str_prop => $name::$variant,)+
@@ -68,7 +68,7 @@ macro_rules! make_property {
impl_property!($computed_values_type, $name, $inherits_automatically);
impl crate::parsers::Parse for $name {
- fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name,
crate::error::CssParseError<'i>> {
+ fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name,
crate::error::ParseError<'i>> {
Ok($name(<$type as crate::parsers::Parse>::parse(parser)?))
}
}
@@ -88,7 +88,7 @@ macro_rules! make_property {
$prop
impl crate::parsers::Parse for $name {
- fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name,
crate::error::CssParseError<'i>> {
+ fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name,
crate::error::ParseError<'i>> {
Ok($name(<$type as crate::parsers::Parse>::parse(parser)?))
}
}
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 0c827a6a..5d5429bc 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -153,7 +153,7 @@ impl Deref for Points {
// Parse a list-of-points as for polyline and polygon elements
// https://www.w3.org/TR/SVG/shapes.html#PointsBNF
impl Parse for Points {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Points, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Points, ParseError<'i>> {
let mut v = Vec::new();
loop {
diff --git a/rsvg_internals/src/style.rs b/rsvg_internals/src/style.rs
index 4f395a0e..b10a49a9 100644
--- a/rsvg_internals/src/style.rs
+++ b/rsvg_internals/src/style.rs
@@ -20,7 +20,7 @@ pub enum StyleType {
}
impl Parse for StyleType {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<StyleType, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<StyleType, ParseError<'i>> {
parser.expect_ident_matching("text/css")?;
Ok(StyleType::TextCss)
}
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index ad9d6256..a51d6d77 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -8,7 +8,7 @@ use crate::error::*;
use crate::parsers::{optional_comma, Parse};
impl Parse for cairo::Matrix {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
let loc = parser.current_source_location();
let matrix = parse_transform_list(parser)?;
@@ -27,7 +27,7 @@ impl Parse for cairo::Matrix {
fn parse_transform_list<'i>(
parser: &mut Parser<'i, '_>,
-) -> Result<cairo::Matrix, CssParseError<'i>> {
+) -> Result<cairo::Matrix, ParseError<'i>> {
let mut matrix = cairo::Matrix::identity();
loop {
@@ -46,7 +46,7 @@ fn parse_transform_list<'i>(
fn parse_transform_command<'i>(
parser: &mut Parser<'i, '_>,
-) -> Result<cairo::Matrix, CssParseError<'i>> {
+) -> Result<cairo::Matrix, ParseError<'i>> {
let loc = parser.current_source_location();
match parser.next()?.clone() {
@@ -64,7 +64,7 @@ fn parse_transform_command<'i>(
fn parse_transform_function<'i>(
name: &str,
parser: &mut Parser<'i, '_>,
-) -> Result<cairo::Matrix, CssParseError<'i>> {
+) -> Result<cairo::Matrix, ParseError<'i>> {
let loc = parser.current_source_location();
match name {
@@ -80,7 +80,7 @@ fn parse_transform_function<'i>(
}
}
-fn parse_matrix_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
+fn parse_matrix_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
parser.parse_nested_block(|p| {
let xx = f64::parse(p)?;
optional_comma(p);
@@ -105,7 +105,7 @@ fn parse_matrix_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, C
fn parse_translate_args<'i>(
parser: &mut Parser<'i, '_>,
-) -> Result<cairo::Matrix, CssParseError<'i>> {
+) -> Result<cairo::Matrix, ParseError<'i>> {
parser.parse_nested_block(|p| {
let tx = f64::parse(p)?;
@@ -120,7 +120,7 @@ fn parse_translate_args<'i>(
})
}
-fn parse_scale_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
+fn parse_scale_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
parser.parse_nested_block(|p| {
let x = f64::parse(p)?;
@@ -135,12 +135,12 @@ fn parse_scale_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, Cs
})
}
-fn parse_rotate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
+fn parse_rotate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
parser.parse_nested_block(|p| {
let angle = f64::parse(p)? * PI / 180.0;
let (tx, ty) = p
- .try_parse(|p| -> Result<_, CssParseError> {
+ .try_parse(|p| -> Result<_, ParseError> {
optional_comma(p);
let tx = f64::parse(p)?;
@@ -161,14 +161,14 @@ fn parse_rotate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, C
})
}
-fn parse_skewx_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
+fn parse_skewx_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
parser.parse_nested_block(|p| {
let a = f64::parse(p)? * PI / 180.0;
Ok(cairo::Matrix::new(1.0, 0.0, a.tan(), 1.0, 0.0, 0.0))
})
}
-fn parse_skewy_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
+fn parse_skewy_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
parser.parse_nested_block(|p| {
let a = f64::parse(p)? * PI / 180.0;
Ok(cairo::Matrix::new(1.0, a.tan(), 0.0, 1.0, 0.0, 0.0))
@@ -195,7 +195,7 @@ mod tests {
use float_cmp::ApproxEq;
use std::f64;
- fn parse_transform(s: &str) -> Result<cairo::Matrix, CssParseError> {
+ fn parse_transform(s: &str) -> Result<cairo::Matrix, ParseError> {
cairo::Matrix::parse_str(s)
}
diff --git a/rsvg_internals/src/unit_interval.rs b/rsvg_internals/src/unit_interval.rs
index 2aad1c3f..646e84c1 100644
--- a/rsvg_internals/src/unit_interval.rs
+++ b/rsvg_internals/src/unit_interval.rs
@@ -16,7 +16,7 @@ impl UnitInterval {
}
impl Parse for UnitInterval {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<UnitInterval, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<UnitInterval, ParseError<'i>> {
let x = f64::parse(parser)?;
Ok(UnitInterval::clamp(x))
}
diff --git a/rsvg_internals/src/viewbox.rs b/rsvg_internals/src/viewbox.rs
index 9a6fa247..e075d315 100644
--- a/rsvg_internals/src/viewbox.rs
+++ b/rsvg_internals/src/viewbox.rs
@@ -19,7 +19,7 @@ impl Parse for ViewBox {
// x, y, w, h
//
// Where w and h must be nonnegative.
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<ViewBox, CssParseError<'i>> {
+ fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<ViewBox, ParseError<'i>> {
let loc = parser.current_source_location();
let NumberList(v) = NumberList::parse(parser, NumberListLength::Exact(4))?;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]