diff options
author | denisanisimov <denis@vaadin.com> | 2014-01-27 13:20:31 +0200 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2014-02-13 11:45:13 +0200 |
commit | 6f5b334247e024143b82c1c9e0c84b41d9bd2abb (patch) | |
tree | effbb89bbdf74f2e18b9ea8f80b50d80977a4bd0 /theme-compiler/src/com | |
parent | 3a9327925b2d987430866a6ec1806a4b35ff2697 (diff) | |
download | vaadin-framework-6f5b334247e024143b82c1c9e0c84b41d9bd2abb.tar.gz vaadin-framework-6f5b334247e024143b82c1c9e0c84b41d9bd2abb.zip |
Avoid error in rgb() function if variables are used (#12752).
Change-Id: Id51ffef257c193900026a4644eb99dbd3926c668
Diffstat (limited to 'theme-compiler/src/com')
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java | 41 | ||||
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj | 17 |
2 files changed, 38 insertions, 20 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java index e68b24355b..06a413649e 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java +++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java @@ -5857,12 +5857,15 @@ LexicalUnitImpl result = null; if ("rgb(".equals(f)) { // this is a RGB declaration (e.g. rgb(255, 50%, 0) ) int i = 0; + boolean hasVariables = false; while (loop && l != null && i < 5) { switch (i) { case 0: case 2: case 4: - if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER) + if (l.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) { + hasVariables = true; + } else if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER) && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) { loop = false; } @@ -5882,9 +5885,15 @@ LexicalUnitImpl result = null; } } if ((i == 5) && loop && (l == null)) { - {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine, - n.beginColumn, - prev, params);} + if (hasVariables) { + {if (true) return LexicalUnitImpl.createFunction(n.beginLine, + n.beginColumn, prev, + f.substring(0, f.length() - 1), params);} + } else { + {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine, + n.beginColumn, + prev, params);} + } } else { if (errorHandler != null) { String errorText; @@ -7221,6 +7230,11 @@ LexicalUnitImpl result = null; return false; } + private boolean jj_3R_256() { + if (jj_scan_token(HASH)) return true; + return false; + } + private boolean jj_3R_216() { if (jj_scan_token(NUMBER)) return true; return false; @@ -7314,8 +7328,8 @@ LexicalUnitImpl result = null; return false; } - private boolean jj_3R_256() { - if (jj_scan_token(HASH)) return true; + private boolean jj_3R_257() { + if (jj_scan_token(URL)) return true; return false; } @@ -7324,11 +7338,6 @@ LexicalUnitImpl result = null; return false; } - private boolean jj_3R_257() { - if (jj_scan_token(URL)) return true; - return false; - } - private boolean jj_3_2() { if (jj_3R_177()) return true; if (jj_3R_178()) return true; @@ -7371,6 +7380,11 @@ LexicalUnitImpl result = null; return false; } + private boolean jj_3R_258() { + if (jj_scan_token(UNICODERANGE)) return true; + return false; + } + private boolean jj_3R_197() { Token xsp; xsp = jj_scanpos; @@ -7409,11 +7423,6 @@ LexicalUnitImpl result = null; return false; } - private boolean jj_3R_258() { - if (jj_scan_token(UNICODERANGE)) return true; - return false; - } - private boolean jj_3_8() { Token xsp; xsp = jj_scanpos; diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj index f8b6a86af7..9be5236bc3 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj +++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj @@ -2575,12 +2575,15 @@ LexicalUnitImpl function(char operator, LexicalUnitImpl prev) : if ("rgb(".equals(f)) { // this is a RGB declaration (e.g. rgb(255, 50%, 0) ) int i = 0; + boolean hasVariables = false; while (loop && l != null && i < 5) { switch (i) { case 0: case 2: case 4: - if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER) + if (l.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) { + hasVariables = true; + } else if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER) && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) { loop = false; } @@ -2600,9 +2603,15 @@ LexicalUnitImpl function(char operator, LexicalUnitImpl prev) : } } if ((i == 5) && loop && (l == null)) { - return LexicalUnitImpl.createRGBColor(n.beginLine, - n.beginColumn, - prev, params); + if (hasVariables) { + return LexicalUnitImpl.createFunction(n.beginLine, + n.beginColumn, prev, + f.substring(0, f.length() - 1), params); + } else { + return LexicalUnitImpl.createRGBColor(n.beginLine, + n.beginColumn, + prev, params); + } } else { if (errorHandler != null) { String errorText; |