diff options
author | Henri Sara <hesara@vaadin.com> | 2012-08-09 14:53:56 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-08-09 14:53:56 +0300 |
commit | 0a4a462fd1e4edc71682d4b350cd03bb27700b72 (patch) | |
tree | dafdf5fc91784a81d54756df12e73dfc8a144002 /sass | |
parent | ef64d5becc40d85a5a27735775376062fa4ed8ff (diff) | |
download | vaadin-framework-0a4a462fd1e4edc71682d4b350cd03bb27700b72.tar.gz vaadin-framework-0a4a462fd1e4edc71682d4b350cd03bb27700b72.zip |
Merge SASS change: Fixed a bug regarding replaceValue in LexicalUnitImpl
Diffstat (limited to 'sass')
-rw-r--r-- | sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java | 7 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/parser/Parser.java | 12 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/parser/Parser.jj | 12 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/tree/CommentNode.java | 2 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/util/ColorUtil.java | 2 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/visitor/VariableVisitor.java | 18 |
6 files changed, 34 insertions, 19 deletions
diff --git a/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java b/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java index 2a62c0dcf9..e268da8ed5 100644 --- a/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java +++ b/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java @@ -572,4 +572,11 @@ public class LexicalUnitImpl implements LexicalUnit, SCSSLexicalUnit, return new LexicalUnitImpl(SAC_OPERATOR_SLASH, line, column, previous); } + @Override + public LexicalUnitImpl clone() { + LexicalUnitImpl cloned = new LexicalUnitImpl(type, line, column, + (LexicalUnitImpl) prev); + cloned.replaceValue(this); + return cloned; + } } diff --git a/sass/src/com/vaadin/sass/parser/Parser.java b/sass/src/com/vaadin/sass/parser/Parser.java index cc9c39176e..710c7d5be7 100644 --- a/sass/src/com/vaadin/sass/parser/Parser.java +++ b/sass/src/com/vaadin/sass/parser/Parser.java @@ -25,7 +25,6 @@ import org.w3c.flute.parser.selectors.SelectorFactoryImpl; import org.w3c.flute.parser.selectors.ConditionFactoryImpl; import org.w3c.flute.util.Encoding; - import com.vaadin.sass.handler.*; import com.vaadin.sass.tree.*; @@ -556,9 +555,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { label_7: while (true) { ; - if(token.specialToken!=null){ - documentHandler.comment(token.specialToken.image); - } + if (token.specialToken != null){ + Token tmp_t = token.specialToken; + while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken; + while (tmp_t != null) { + documentHandler.comment(tmp_t.image); + tmp_t = tmp_t.next; + } + } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VARIABLE: variable(); diff --git a/sass/src/com/vaadin/sass/parser/Parser.jj b/sass/src/com/vaadin/sass/parser/Parser.jj index 2f43be5f6e..62892c8159 100644 --- a/sass/src/com/vaadin/sass/parser/Parser.jj +++ b/sass/src/com/vaadin/sass/parser/Parser.jj @@ -43,7 +43,6 @@ import org.w3c.flute.parser.selectors.SelectorFactoryImpl; import org.w3c.flute.parser.selectors.ConditionFactoryImpl; import org.w3c.flute.util.Encoding; - import com.vaadin.sass.handler.*; import com.vaadin.sass.tree.*; @@ -733,9 +732,14 @@ void afterImportDeclaration() : { ( { - if(token.specialToken!=null){ - documentHandler.comment(token.specialToken.image); - } + if (token.specialToken != null){ + Token tmp_t = token.specialToken; + while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken; + while (tmp_t != null) { + documentHandler.comment(tmp_t.image); + tmp_t = tmp_t.next; + } + } } ( variable() | mixinDirective() | includeDirective() | styleRule() | media()| page() | fontFace() | { l = getLocator(); } ret=skipStatement() diff --git a/sass/src/com/vaadin/sass/tree/CommentNode.java b/sass/src/com/vaadin/sass/tree/CommentNode.java index 649d2df581..3bdb563312 100644 --- a/sass/src/com/vaadin/sass/tree/CommentNode.java +++ b/sass/src/com/vaadin/sass/tree/CommentNode.java @@ -21,6 +21,6 @@ public class CommentNode extends Node { @Override public String toString() { - return comment.trim(); + return comment; } } diff --git a/sass/src/com/vaadin/sass/util/ColorUtil.java b/sass/src/com/vaadin/sass/util/ColorUtil.java index 9abcf57310..fe3f8f6e9b 100644 --- a/sass/src/com/vaadin/sass/util/ColorUtil.java +++ b/sass/src/com/vaadin/sass/util/ColorUtil.java @@ -81,7 +81,7 @@ public class ColorUtil { hslParam = (LexicalUnitImpl) hslParam.getNextLexicalUnit(); i++; } - float h = ((hue.getFloatValue() % 360) + 360) % 360 / 360; + float h = ((hue.getIntegerValue() % 360) + 360) % 360 / 360f; float s = saturation.getFloatValue() / 100; float l = lightness.getFloatValue() / 100; float m2, m1; diff --git a/sass/src/com/vaadin/sass/visitor/VariableVisitor.java b/sass/src/com/vaadin/sass/visitor/VariableVisitor.java index 8a567dacae..bb790a0aee 100644 --- a/sass/src/com/vaadin/sass/visitor/VariableVisitor.java +++ b/sass/src/com/vaadin/sass/visitor/VariableVisitor.java @@ -52,16 +52,16 @@ public class VariableVisitor implements Visitor { if (value == null) { return; } - for (String variable : variables.keySet()) { - if (value.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) { - if (value.getStringValue().contains(variable)) { - LexicalUnitImpl lexVal = (LexicalUnitImpl) value; - lexVal.replaceValue(variables.get(variable)); - } - } else if (value.getLexicalUnitType() == SCSSLexicalUnit.SAC_FUNCTION) { - LexicalUnit params = value.getParameters(); - updateValue(params, variables); + if (value.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) { + LexicalUnitImpl variableValue = variables.get( + value.getStringValue()).clone(); + if (variableValue != null) { + LexicalUnitImpl lexVal = (LexicalUnitImpl) value; + lexVal.replaceValue(variableValue); } + } else if (value.getLexicalUnitType() == SCSSLexicalUnit.SAC_FUNCTION) { + LexicalUnit params = value.getParameters(); + updateValue(params, variables); } LexicalUnit next = value.getNextLexicalUnit(); updateValue(next, variables); |