diff options
author | Henri Sara <hesara@vaadin.com> | 2012-08-08 17:02:33 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-08-08 17:02:33 +0300 |
commit | 3580acbd26e877db0e79bb9fa5b46d947ce619c4 (patch) | |
tree | 34b91908f2ba708c9b0a4a3811e9c704df602d02 /sass | |
parent | cfa455d6cfd4a535fd77cbc76637a57e7024e9ac (diff) | |
download | vaadin-framework-3580acbd26e877db0e79bb9fa5b46d947ce619c4.tar.gz vaadin-framework-3580acbd26e877db0e79bb9fa5b46d947ce619c4.zip |
Apply changeset from SASS repository: comment handling
Diffstat (limited to 'sass')
-rw-r--r-- | sass/src/com/vaadin/sass/handler/SCSSDocumentHandlerImpl.java | 4 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/parser/Parser.java | 63 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/parser/Parser.jj | 8 | ||||
-rw-r--r-- | sass/src/com/vaadin/sass/tree/CommentNode.java | 22 |
4 files changed, 65 insertions, 32 deletions
diff --git a/sass/src/com/vaadin/sass/handler/SCSSDocumentHandlerImpl.java b/sass/src/com/vaadin/sass/handler/SCSSDocumentHandlerImpl.java index f4e9398599..ccfa327829 100644 --- a/sass/src/com/vaadin/sass/handler/SCSSDocumentHandlerImpl.java +++ b/sass/src/com/vaadin/sass/handler/SCSSDocumentHandlerImpl.java @@ -13,6 +13,7 @@ import org.w3c.css.sac.SelectorList; import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.tree.BlockNode; +import com.vaadin.sass.tree.CommentNode; import com.vaadin.sass.tree.EachNode; import com.vaadin.sass.tree.ExtendNode; import com.vaadin.sass.tree.ForNode; @@ -123,7 +124,8 @@ public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler { @Override public void comment(String text) throws CSSException { - System.out.println("comment(String text): " + text); + CommentNode node = new CommentNode(text); + nodeStack.peek().appendChild(node); } @Override diff --git a/sass/src/com/vaadin/sass/parser/Parser.java b/sass/src/com/vaadin/sass/parser/Parser.java index df70d812aa..cc9c39176e 100644 --- a/sass/src/com/vaadin/sass/parser/Parser.java +++ b/sass/src/com/vaadin/sass/parser/Parser.java @@ -556,6 +556,9 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { label_7: while (true) { ; + if(token.specialToken!=null){ + documentHandler.comment(token.specialToken.image); + } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VARIABLE: variable(); @@ -4142,36 +4145,6 @@ LexicalUnit exp; finally { jj_save(3, xla); } } - private boolean jj_3R_130() { - if (jj_scan_token(COMMA)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_scan_token(1)) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_129() { - if (jj_scan_token(DIV)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_scan_token(1)) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_119() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_129()) { - jj_scanpos = xsp; - if (jj_3R_130()) return true; - } - return false; - } - private boolean jj_3R_168() { if (jj_scan_token(UNICODERANGE)) return true; return false; @@ -4694,6 +4667,36 @@ LexicalUnit exp; return false; } + private boolean jj_3R_130() { + if (jj_scan_token(COMMA)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_scan_token(1)) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_129() { + if (jj_scan_token(DIV)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_scan_token(1)) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_119() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_129()) { + jj_scanpos = xsp; + if (jj_3R_130()) return true; + } + return false; + } + /** Generated Token Manager. */ public ParserTokenManager token_source; /** Current token. */ diff --git a/sass/src/com/vaadin/sass/parser/Parser.jj b/sass/src/com/vaadin/sass/parser/Parser.jj index 67fe870e03..2f43be5f6e 100644 --- a/sass/src/com/vaadin/sass/parser/Parser.jj +++ b/sass/src/com/vaadin/sass/parser/Parser.jj @@ -731,7 +731,13 @@ void afterImportDeclaration() : Locator l; } { - ( ( variable() | mixinDirective() | includeDirective() | styleRule() | media()| page() | fontFace() + ( + { + if(token.specialToken!=null){ + documentHandler.comment(token.specialToken.image); + } + } + ( variable() | mixinDirective() | includeDirective() | styleRule() | media()| page() | fontFace() | { l = getLocator(); } ret=skipStatement() { if ((ret == null) || (ret.length() == 0)) { diff --git a/sass/src/com/vaadin/sass/tree/CommentNode.java b/sass/src/com/vaadin/sass/tree/CommentNode.java new file mode 100644 index 0000000000..442e5f995e --- /dev/null +++ b/sass/src/com/vaadin/sass/tree/CommentNode.java @@ -0,0 +1,22 @@ +package com.vaadin.sass.tree; + +public class CommentNode extends Node { + private String comment; + + public CommentNode(String comment) { + this.comment = comment; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + @Override + public String toString() { + return comment.trim(); + } +} |