[librsvg: 2/43] Temporarily rename ParseError to CssParseError



commit cee6918cb6f2084724a4f127c8488fb56d0eec89
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Dec 19 18:15:05 2019 -0600

    Temporarily rename ParseError to CssParseError

 rsvg_internals/src/css.rs        |  2 +-
 rsvg_internals/src/error.rs      |  6 +++---
 rsvg_internals/src/parsers.rs    |  4 ++--
 rsvg_internals/src/properties.rs |  8 +++++---
 rsvg_internals/src/transform.rs  | 20 ++++++++++----------
 5 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index f2f2619e..c59894f7 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -120,7 +120,7 @@ impl<'i> DeclarationParser<'i> for DeclParser {
         &mut self,
         name: CowRcStr<'i>,
         input: &mut Parser<'i, 't>,
-    ) -> Result<Declaration, cssparser::ParseError<'i, ValueErrorKind>> {
+    ) -> Result<Declaration, CssParseError<'i>> {
         let prop_name = QualName::new(None, ns!(svg), LocalName::from(name.as_ref()));
         let property =
             parse_property(&prop_name, input, true).map_err(|e| input.new_custom_error(e))?;
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 2ca560e7..73aecb46 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -20,7 +20,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 ParseError<'i> = cssparser::ParseError<'i, ValueErrorKind>;
+pub type CssParseError<'i> = cssparser::ParseError<'i, ValueErrorKind>;
 
 /// A simple error which refers to an attribute's value
 #[derive(Debug, Clone, PartialEq)]
@@ -182,12 +182,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, ParseError<'i>> {
+impl<'i, O> AttributeResultExt<O> for Result<O, CssParseError<'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 ParseError {
+            let CssParseError {
                 kind,
                 location: _location,
             } = e;
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index 96019fe7..d8f36ad9 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -88,11 +88,11 @@ impl Parse for f64 {
 }
 
 pub trait ParseToParseError: Sized {
-    fn parse_to_parse_error<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>>;
+    fn parse_to_parse_error<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>>;
 }
 
 impl ParseToParseError for f64 {
-    fn parse_to_parse_error<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
+    fn parse_to_parse_error<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
         let loc = parser.current_source_location();
         parser
             .expect_number()
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 51045bfb..7519c9a6 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -543,8 +543,8 @@ impl SpecifiedValues {
 
                 rsvg_log!(
                     "(ignoring invalid presentation attribute {:?}\n    \
-                         value=\"{}\"\n    \
-                         {})",
+                     value=\"{}\"\n    \
+                     {})",
                     attr.expanded(),
                     value,
                     e
@@ -632,7 +632,9 @@ where
 }
 
 // Parses the value for the type `T` of the property out of the Parser, including `inherit` values.
-fn parse_input_to_parse_error<'i, T>(input: &mut Parser<'i, '_>) -> Result<SpecifiedValue<T>, ParseError<'i>>
+fn parse_input_to_parse_error<'i, T>(
+    input: &mut Parser<'i, '_>,
+) -> Result<SpecifiedValue<T>, CssParseError<'i>>
 where
     T: Property<ComputedValues> + Clone + Default + ParseToParseError,
 {
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index 145a3309..71b7bd65 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -25,7 +25,7 @@ impl Parse for cairo::Matrix {
 // Its operataion and grammar are described here:
 // https://www.w3.org/TR/SVG/coords.html#TransformAttribute
 
-fn parse_transform_list<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
+fn parse_transform_list<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     let mut matrix = cairo::Matrix::identity();
 
     loop {
@@ -44,7 +44,7 @@ fn parse_transform_list<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix
 
 fn parse_transform_command<'i>(
     parser: &mut Parser<'i, '_>,
-) -> Result<cairo::Matrix, ParseError<'i>> {
+) -> Result<cairo::Matrix, CssParseError<'i>> {
     let loc = parser.current_source_location();
 
     match parser.next()?.clone() {
@@ -62,7 +62,7 @@ fn parse_transform_command<'i>(
 fn parse_transform_function<'i>(
     name: &str,
     parser: &mut Parser<'i, '_>,
-) -> Result<cairo::Matrix, ParseError<'i>> {
+) -> Result<cairo::Matrix, CssParseError<'i>> {
     let loc = parser.current_source_location();
 
     match name {
@@ -78,7 +78,7 @@ fn parse_transform_function<'i>(
     }
 }
 
-fn parse_matrix_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
+fn parse_matrix_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     parser.parse_nested_block(|p| {
         let xx = f64::parse_to_parse_error(p)?;
         optional_comma(p);
@@ -101,7 +101,7 @@ fn parse_matrix_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, P
     })
 }
 
-fn parse_translate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
+fn parse_translate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     parser.parse_nested_block(|p| {
         let tx = f64::parse_to_parse_error(p)?;
 
@@ -116,7 +116,7 @@ fn parse_translate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix
     })
 }
 
-fn parse_scale_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
+fn parse_scale_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     parser.parse_nested_block(|p| {
         let x = f64::parse_to_parse_error(p)?;
 
@@ -131,12 +131,12 @@ fn parse_scale_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, Pa
     })
 }
 
-fn parse_rotate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
+fn parse_rotate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     parser.parse_nested_block(|p| {
         let angle = f64::parse_to_parse_error(p)? * PI / 180.0;
 
         let (tx, ty) = p
-            .try_parse(|p| -> Result<_, ParseError> {
+            .try_parse(|p| -> Result<_, CssParseError> {
                 optional_comma(p);
                 let tx = f64::parse_to_parse_error(p)?;
 
@@ -157,14 +157,14 @@ fn parse_rotate_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, P
     })
 }
 
-fn parse_skewx_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, ParseError<'i>> {
+fn parse_skewx_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     parser.parse_nested_block(|p| {
         let a = f64::parse_to_parse_error(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, ParseError<'i>> {
+fn parse_skewy_args<'i>(parser: &mut Parser<'i, '_>) -> Result<cairo::Matrix, CssParseError<'i>> {
     parser.parse_nested_block(|p| {
         let a = f64::parse_to_parse_error(p)? * PI / 180.0;
         Ok(cairo::Matrix::new(1.0, a.tan(), 0.0, 1.0, 0.0, 0.0))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]