]> source.dussan.org Git - vaadin-framework.git/commitdiff
Parser stripped minus of negative numbers with unknown units (#12811)
authorjoheriks <joheriks@vaadin.com>
Mon, 28 Oct 2013 12:28:57 +0000 (14:28 +0200)
committerjoheriks <joheriks@vaadin.com>
Mon, 28 Oct 2013 13:05:37 +0000 (15:05 +0200)
Change-Id: I8964b1732f867cb3c5aa5859d12e94a5978adece

theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj
theme-compiler/tests/resources/automatic/css/negative-ch-value.css [new file with mode: 0644]
theme-compiler/tests/resources/automatic/scss/negative-ch-value.scss [new file with mode: 0644]

index d7662d35a8b0fff6359a42e19e8fe07b8e711e51..6989490648ee403a5fe5ceae1f6bdf7deef585b5 100755 (executable)
@@ -159,6 +159,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
 
     /**
      * This method parses only one rule (style rule or at-rule, except
+     * 
      * @charset).
      * 
      * @param source
@@ -5574,9 +5575,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
                         && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) {
                     i++;
                 }
+                /*
+                 * result = LexicalUnitImpl.createDimen(n.beginLine,
+                 * n.beginColumn, prev, Float.valueOf(s.substring(0,
+                 * i)).floatValue(), s.substring(i));
+                 */
                 result = LexicalUnitImpl.createDimen(n.beginLine,
-                        n.beginColumn, prev, Float.valueOf(s.substring(0, i))
-                                .floatValue(), s.substring(i));
+                        n.beginColumn, prev, number(op, n, s.length() - i),
+                        s.substring(i));
                 break;
             case FUNCTION:
                 result = function(op, prev);
@@ -7110,15 +7116,15 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_299() {
-        if (jj_scan_token(INTERPOLATION)) {
+    private boolean jj_3R_266() {
+        if (jj_3R_187()) {
             return true;
         }
         return false;
     }
 
-    private boolean jj_3R_266() {
-        if (jj_3R_187()) {
+    private boolean jj_3R_299() {
+        if (jj_scan_token(INTERPOLATION)) {
             return true;
         }
         return false;
@@ -7138,6 +7144,28 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
+    private boolean jj_3R_256() {
+        if (jj_scan_token(FUNCTION)) {
+            return true;
+        }
+        Token xsp;
+        while (true) {
+            xsp = jj_scanpos;
+            if (jj_scan_token(1)) {
+                jj_scanpos = xsp;
+                break;
+            }
+        }
+        xsp = jj_scanpos;
+        if (jj_3R_266()) {
+            jj_scanpos = xsp;
+        }
+        if (jj_scan_token(RPARAN)) {
+            return true;
+        }
+        return false;
+    }
+
     private boolean jj_3R_263() {
         Token xsp;
         xsp = jj_scanpos;
@@ -7187,8 +7215,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_256() {
-        if (jj_scan_token(FUNCTION)) {
+    private boolean jj_3R_180() {
+        if (jj_scan_token(COMMA)) {
             return true;
         }
         Token xsp;
@@ -7199,47 +7227,32 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
                 break;
             }
         }
-        xsp = jj_scanpos;
-        if (jj_3R_266()) {
-            jj_scanpos = xsp;
-        }
-        if (jj_scan_token(RPARAN)) {
-            return true;
-        }
         return false;
     }
 
-    private boolean jj_3R_180() {
-        if (jj_scan_token(COMMA)) {
+    private boolean jj_3R_247() {
+        if (jj_3R_260()) {
             return true;
         }
-        Token xsp;
-        while (true) {
-            xsp = jj_scanpos;
-            if (jj_scan_token(1)) {
-                jj_scanpos = xsp;
-                break;
-            }
-        }
         return false;
     }
 
-    private boolean jj_3R_247() {
-        if (jj_3R_260()) {
+    private boolean jj_3R_246() {
+        if (jj_3R_259()) {
             return true;
         }
         return false;
     }
 
-    private boolean jj_3R_298() {
-        if (jj_scan_token(IDENT)) {
+    private boolean jj_3R_245() {
+        if (jj_3R_258()) {
             return true;
         }
         return false;
     }
 
-    private boolean jj_3R_246() {
-        if (jj_3R_259()) {
+    private boolean jj_3R_298() {
+        if (jj_scan_token(IDENT)) {
             return true;
         }
         return false;
@@ -7257,13 +7270,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_245() {
-        if (jj_3R_258()) {
-            return true;
-        }
-        return false;
-    }
-
     private boolean jj_3R_297() {
         if (jj_3R_219()) {
             return true;
@@ -7525,21 +7531,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_196() {
-        if (jj_3R_220()) {
-            return true;
-        }
-        Token xsp;
-        while (true) {
-            xsp = jj_scanpos;
-            if (jj_3R_273()) {
-                jj_scanpos = xsp;
-                break;
-            }
-        }
-        return false;
-    }
-
     private boolean jj_3R_199() {
         Token xsp;
         xsp = jj_scanpos;
@@ -7561,6 +7552,21 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
+    private boolean jj_3R_196() {
+        if (jj_3R_220()) {
+            return true;
+        }
+        Token xsp;
+        while (true) {
+            xsp = jj_scanpos;
+            if (jj_3R_273()) {
+                jj_scanpos = xsp;
+                break;
+            }
+        }
+        return false;
+    }
+
     private boolean jj_3R_195() {
         if (jj_3R_219()) {
             return true;
@@ -7899,6 +7905,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
+    private boolean jj_3R_258() {
+        if (jj_scan_token(HASH)) {
+            return true;
+        }
+        return false;
+    }
+
     private boolean jj_3_1() {
         if (jj_3R_176()) {
             return true;
@@ -8013,13 +8026,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_258() {
-        if (jj_scan_token(HASH)) {
-            return true;
-        }
-        return false;
-    }
-
     private boolean jj_3_4() {
         if (jj_3R_179()) {
             return true;
@@ -8027,15 +8033,15 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_251() {
-        if (jj_3R_186()) {
+    private boolean jj_3R_259() {
+        if (jj_scan_token(URL)) {
             return true;
         }
         return false;
     }
 
-    private boolean jj_3R_259() {
-        if (jj_scan_token(URL)) {
+    private boolean jj_3R_251() {
+        if (jj_3R_186()) {
             return true;
         }
         return false;
@@ -8088,6 +8094,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
+    private boolean jj_3R_260() {
+        if (jj_scan_token(UNICODERANGE)) {
+            return true;
+        }
+        return false;
+    }
+
     private boolean jj_3R_255() {
         Token xsp;
         xsp = jj_scanpos;
@@ -8107,13 +8120,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
         return false;
     }
 
-    private boolean jj_3R_260() {
-        if (jj_scan_token(UNICODERANGE)) {
-            return true;
-        }
-        return false;
-    }
-
     private boolean jj_3_8() {
         Token xsp;
         xsp = jj_scanpos;
index 871be2c4d0aad5375a00838d8b3cb4ffea654b22..406030f7c98f83892114876b64ab4a0bbea9b519 100644 (file)
@@ -2382,8 +2382,9 @@ LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev) :\r{\rLexicalUnitImpl result
                   && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) {
                i++;
            }
+
            result = LexicalUnitImpl.createDimen(n.beginLine, n.beginColumn, prev, 
-                                                Float.valueOf(s.substring(0, i)).floatValue(),
+                                                number(op,n,s.length()-i),
                                                 s.substring(i));
        }
     | result=function(op, prev) ) )
diff --git a/theme-compiler/tests/resources/automatic/css/negative-ch-value.css b/theme-compiler/tests/resources/automatic/css/negative-ch-value.css
new file mode 100644 (file)
index 0000000..2cc75b2
--- /dev/null
@@ -0,0 +1,3 @@
+* {
+           top: -0.1ch;
+}
\ No newline at end of file
diff --git a/theme-compiler/tests/resources/automatic/scss/negative-ch-value.scss b/theme-compiler/tests/resources/automatic/scss/negative-ch-value.scss
new file mode 100644 (file)
index 0000000..2cc75b2
--- /dev/null
@@ -0,0 +1,3 @@
+* {
+           top: -0.1ch;
+}
\ No newline at end of file