[librsvg] parse_transform.lalrpop: Only make parse_Num and parse_TransformList public



commit 971f6ce7b1ddf28b324a726996e224556fca63fe
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Sep 4 10:12:39 2017 -0500

    parse_transform.lalrpop: Only make parse_Num and parse_TransformList public
    
    We'll adjust the tests for individual transformations so that they use
    the toplevel parse_TransformList().

 rust/src/parse_transform.lalrpop |   12 ++++++------
 rust/src/transform.rs            |   28 ++++++++++++++--------------
 2 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/rust/src/parse_transform.lalrpop b/rust/src/parse_transform.lalrpop
index 6129610..6537de5 100644
--- a/rust/src/parse_transform.lalrpop
+++ b/rust/src/parse_transform.lalrpop
@@ -37,20 +37,20 @@ Transform: cairo::Matrix = {
     SkewY
 };
 
-pub Matrix: cairo::Matrix = "matrix" "(" <Num> maybe_comma <Num> maybe_comma <Num> maybe_comma <Num> 
maybe_comma <Num> maybe_comma <Num> ")" =>
+Matrix: cairo::Matrix = "matrix" "(" <Num> maybe_comma <Num> maybe_comma <Num> maybe_comma <Num> maybe_comma 
<Num> maybe_comma <Num> ")" =>
     cairo::Matrix::new (<>);
 
-pub Translate: cairo::Matrix = {
+Translate: cairo::Matrix = {
     "translate" "(" <Num> ")" => cairo::Matrix::new (1.0, 0.0, 0.0, 1.0, <>, 0.0),
     "translate" "(" <Num> maybe_comma <Num> ")" => cairo::Matrix::new (1.0, 0.0, 0.0, 1.0, <>)
 };
 
-pub Scale: cairo::Matrix = {
+Scale: cairo::Matrix = {
     "scale" "(" <Num> ")" => cairo::Matrix::new (<>, 0.0, 0.0, <>, 0.0, 0.0),
     "scale" "(" <sx: Num> maybe_comma <sy: Num> ")" => cairo::Matrix::new (sx, 0.0, 0.0, sy, 0.0, 0.0),
 };
 
-pub Rotate: cairo::Matrix = {
+Rotate: cairo::Matrix = {
     "rotate" "(" <angle: Num> ")" => {
         let a = angle * PI / 180.0;
         let (s, c) = a.sin_cos ();
@@ -68,7 +68,7 @@ pub Rotate: cairo::Matrix = {
     }
 };
 
-pub SkewX: cairo::Matrix = {
+SkewX: cairo::Matrix = {
     "skewX" "(" <angle: Num> ")" => {
         let a = angle * PI / 180.0;
         cairo::Matrix::new (1.0,      0.0,
@@ -77,7 +77,7 @@ pub SkewX: cairo::Matrix = {
     }
 };
 
-pub SkewY: cairo::Matrix = {
+SkewY: cairo::Matrix = {
     "skewY" "(" <angle: Num> ")" => {
         let a = angle * PI / 180.0;
         cairo::Matrix::new (1.0,  a.tan (),
diff --git a/rust/src/transform.rs b/rust/src/transform.rs
index 822bfc3..42fe60f 100644
--- a/rust/src/transform.rs
+++ b/rust/src/transform.rs
@@ -133,45 +133,45 @@ mod parser_tests {
 
     #[test]
     fn parses_matrix () {
-        assert_eq! (parse_Matrix ("matrix (1 2 3 4 5 6)").unwrap (),
+        assert_eq! (parse_TransformList ("matrix (1 2 3 4 5 6)").unwrap (),
                     cairo::Matrix::new (1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
 
-        assert_eq! (parse_Matrix ("matrix (1,2,3,4 5 6)").unwrap (),
+        assert_eq! (parse_TransformList ("matrix (1,2,3,4 5 6)").unwrap (),
                     cairo::Matrix::new (1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
 
-        assert_eq! (parse_Matrix ("matrix (1,2.25,-3.25e2,4 5 6)").unwrap (),
+        assert_eq! (parse_TransformList ("matrix (1,2.25,-3.25e2,4 5 6)").unwrap (),
                     cairo::Matrix::new (1.0, 2.25, -325.0, 4.0, 5.0, 6.0));
     }
 
     #[test]
     fn parses_translate () {
-        assert_eq! (parse_Translate ("translate(-1 -2)").unwrap (),
+        assert_eq! (parse_TransformList ("translate(-1 -2)").unwrap (),
                     cairo::Matrix::new (1.0, 0.0, 0.0, 1.0, -1.0, -2.0));
 
-        assert_eq! (parse_Translate ("translate(-1, -2)").unwrap (),
+        assert_eq! (parse_TransformList ("translate(-1, -2)").unwrap (),
                     cairo::Matrix::new (1.0, 0.0, 0.0, 1.0, -1.0, -2.0));
 
-        assert_eq! (parse_Translate ("translate(-1)").unwrap (),
+        assert_eq! (parse_TransformList ("translate(-1)").unwrap (),
                     cairo::Matrix::new (1.0, 0.0, 0.0, 1.0, -1.0, 0.0));
     }
 
     #[test]
     fn parses_scale () {
-        assert_eq! (parse_Scale ("scale(-1 -2)").unwrap (),
+        assert_eq! (parse_TransformList ("scale(-1 -2)").unwrap (),
                     cairo::Matrix::new (-1.0, 0.0, 0.0, -2.0, 0.0, 0.0));
 
-        assert_eq! (parse_Scale ("scale(-1, -2)").unwrap (),
+        assert_eq! (parse_TransformList ("scale(-1, -2)").unwrap (),
                     cairo::Matrix::new (-1.0, 0.0, 0.0, -2.0, 0.0, 0.0));
 
-        assert_eq! (parse_Scale ("scale(-1)").unwrap (),
+        assert_eq! (parse_TransformList ("scale(-1)").unwrap (),
                     cairo::Matrix::new (-1.0, 0.0, 0.0, -1.0, 0.0, 0.0));
     }
 
     #[test]
     fn parses_rotate () {
-        assert_eq! (parse_Rotate ("rotate (30)").unwrap (), make_rotation_matrix (30.0, 0.0, 0.0));
-        assert_eq! (parse_Rotate ("rotate (30,-1,-2)").unwrap (), make_rotation_matrix (30.0, -1.0, -2.0));
-        assert_eq! (parse_Rotate ("rotate (30, -1, -2)").unwrap (), make_rotation_matrix (30.0, -1.0, -2.0));
+        assert_eq! (parse_TransformList ("rotate (30)").unwrap (), make_rotation_matrix (30.0, 0.0, 0.0));
+        assert_eq! (parse_TransformList ("rotate (30,-1,-2)").unwrap (), make_rotation_matrix (30.0, -1.0, 
-2.0));
+        assert_eq! (parse_TransformList ("rotate (30, -1, -2)").unwrap (), make_rotation_matrix (30.0, -1.0, 
-2.0));
     }
 
     fn make_skew_x_matrix (angle_degrees: f64) -> cairo::Matrix {
@@ -190,12 +190,12 @@ mod parser_tests {
 
     #[test]
     fn parses_skew_x () {
-        assert_eq! (parse_SkewX ("skewX (30)").unwrap (), make_skew_x_matrix (30.0));
+        assert_eq! (parse_TransformList ("skewX (30)").unwrap (), make_skew_x_matrix (30.0));
     }
 
     #[test]
     fn parses_skew_y () {
-        assert_eq! (parse_SkewY ("skewY (30)").unwrap (), make_skew_y_matrix (30.0));
+        assert_eq! (parse_TransformList ("skewY (30)").unwrap (), make_skew_y_matrix (30.0));
     }
 
     #[test]


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