import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.vaadin.sass.ScssStylesheet;
+import com.vaadin.sass.internal.ScssStylesheet;
import com.vaadin.server.AbstractCommunicationManager.Callback;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.ui.UI;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
-import com.vaadin.sass.ScssStylesheet;
+import com.vaadin.sass.internal.ScssStylesheet;
/**
* Helper to combine css divided into separate per component dirs into one to
import java.io.FileWriter;
import java.io.IOException;
+import com.vaadin.sass.internal.ScssStylesheet;
+
public class SassCompiler {
public static void main(String[] args) throws Exception {
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.InputSource;
-
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.handler.SCSSErrorHandler;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.resolver.ScssStylesheetResolver;
-import com.vaadin.sass.resolver.VaadinResolver;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.MixinDefNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.VariableNode;
-import com.vaadin.sass.tree.controldirective.IfElseDefNode;
-import com.vaadin.sass.visitor.ImportNodeHandler;
-
-public class ScssStylesheet extends Node {
-
- private static final long serialVersionUID = 3849790204404961608L;
-
- private static ScssStylesheet mainStyleSheet = null;
-
- private static final HashMap<String, VariableNode> variables = new HashMap<String, VariableNode>();
-
- private static final Map<String, MixinDefNode> mixinDefs = new HashMap<String, MixinDefNode>();
-
- private static final HashSet<IfElseDefNode> ifElseDefNodes = new HashSet<IfElseDefNode>();
-
- private static HashMap<Node, Node> lastNodeAdded = new HashMap<Node, Node>();
-
- private String fileName;
-
- /**
- * Read in a file SCSS and parse it into a ScssStylesheet
- *
- * @param file
- * @throws IOException
- */
- public ScssStylesheet() {
- super();
- }
-
- /**
- * Main entry point for the SASS compiler. Takes in a file and builds upp a
- * ScssStylesheet tree out of it. Calling compile() on it will transform
- * SASS into CSS. Calling toString() will print out the SCSS/CSS.
- *
- * @param file
- * @return
- * @throws CSSException
- * @throws IOException
- */
- public static ScssStylesheet get(String identifier) throws CSSException,
- IOException {
- File file = new File(identifier);
- file = file.getCanonicalFile();
-
- SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl();
- ScssStylesheet stylesheet = handler.getStyleSheet();
-
- InputSource source = stylesheet.resolveStylesheet(identifier);
- if (source == null) {
- return null;
- }
-
- Parser parser = new Parser();
- parser.setErrorHandler(new SCSSErrorHandler());
- parser.setDocumentHandler(handler);
- parser.parseStyleSheet(source);
-
- return stylesheet;
- }
-
- private static ScssStylesheetResolver[] resolvers = null;
-
- public static void setStylesheetResolvers(
- ScssStylesheetResolver... styleSheetResolvers) {
- resolvers = Arrays.copyOf(styleSheetResolvers,
- styleSheetResolvers.length);
- }
-
- public InputSource resolveStylesheet(String identifier) {
- if (resolvers == null) {
- setStylesheetResolvers(new VaadinResolver());
- }
-
- for (ScssStylesheetResolver resolver : resolvers) {
- InputSource source = resolver.resolve(identifier);
- if (source != null) {
- File f = new File(source.getURI());
- setFileName(f.getParent());
- return source;
- }
- }
-
- return null;
- }
-
- /**
- * Applies all the visitors and compiles SCSS into Css.
- *
- * @throws Exception
- */
- public void compile() throws Exception {
- mainStyleSheet = this;
- mixinDefs.clear();
- variables.clear();
- ifElseDefNodes.clear();
- lastNodeAdded.clear();
- importOtherFiles(this);
- populateDefinitions(this);
- traverse(this);
- removeEmptyBlocks(this);
- }
-
- private void importOtherFiles(ScssStylesheet node) {
- ImportNodeHandler.traverse(node);
- }
-
- private void populateDefinitions(Node node) {
- if (node instanceof MixinDefNode) {
- mixinDefs.put(((MixinDefNode) node).getName(), (MixinDefNode) node);
- node.getParentNode().removeChild(node);
- } else if (node instanceof IfElseDefNode) {
- ifElseDefNodes.add((IfElseDefNode) node);
- }
-
- for (final Node child : new ArrayList<Node>(node.getChildren())) {
- populateDefinitions(child);
- }
-
- }
-
- /**
- * Prints out the current state of the node tree. Will return SCSS before
- * compile and CSS after.
- *
- * For now this is an own method with it's own implementation that most node
- * types will implement themselves.
- */
- @Override
- public String toString() {
- StringBuilder string = new StringBuilder("");
- if (children.size() > 0) {
- string.append(children.get(0).toString());
- }
- String delimeter = "\n\n";
- if (children.size() > 1) {
- for (int i = 1; i < children.size(); i++) {
- String childString = children.get(i).toString();
- if (childString != null) {
- string.append(delimeter).append(childString);
- }
- }
- }
- String output = string.toString();
- return output;
- }
-
- public void addChild(int index, VariableNode node) {
- if (node != null) {
- children.add(index, node);
- }
- }
-
- public static ScssStylesheet get() {
- return mainStyleSheet;
- }
-
- @Override
- public void traverse() {
- // Not used for ScssStylesheet
- }
-
- /**
- * Traverses a node and its children recursively, calling all the
- * appropriate handlers via {@link Node#traverse()}.
- *
- * The node itself may be removed during the traversal and replaced with
- * other nodes at the same position or later on the child list of its
- * parent.
- *
- * @param node
- * node to traverse
- * @return true if the node was removed (and possibly replaced by others),
- * false if not
- */
- public boolean traverse(Node node) {
- Node originalParent = node.getParentNode();
-
- node.traverse();
-
- @SuppressWarnings("unchecked")
- HashMap<String, VariableNode> variableScope = (HashMap<String, VariableNode>) variables
- .clone();
-
- // the size of the child list may change on each iteration: current node
- // may get deleted and possibly other nodes have been inserted where it
- // was or after that position
- for (int i = 0; i < node.getChildren().size(); i++) {
- Node current = node.getChildren().get(i);
- if (traverse(current)) {
- // current has been removed
- --i;
- }
- }
-
- variables.clear();
- variables.putAll(variableScope);
-
- // has the node been removed from its parent?
- if (originalParent != null) {
- return !originalParent.getChildren().contains(node);
- } else {
- return false;
- }
- }
-
- public void removeEmptyBlocks(Node node) {
- // depth first for avoiding re-checking parents of removed nodes
- for (Node child : new ArrayList<Node>(node.getChildren())) {
- removeEmptyBlocks(child);
- }
- Node parent = node.getParentNode();
- if (node instanceof BlockNode && node.getChildren().isEmpty()
- && parent != null) {
- // remove empty block
- parent.removeChild(node);
- }
- }
-
- public static void addVariable(VariableNode node) {
- variables.put(node.getName(), node);
- }
-
- public static VariableNode getVariable(String string) {
- return variables.get(string);
- }
-
- public static ArrayList<VariableNode> getVariables() {
- return new ArrayList<VariableNode>(variables.values());
- }
-
- public static MixinDefNode getMixinDefinition(String name) {
- return mixinDefs.get(name);
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public String getFileName() {
- return fileName;
- }
-
- public static HashMap<Node, Node> getLastNodeAdded() {
- return lastNodeAdded;
- }
-
- public static final void warning(String msg) {
- Logger.getLogger(ScssStylesheet.class.getName()).warning(msg);
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.handler;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.DocumentHandler;
-import org.w3c.css.sac.SACMediaList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.tree.ForNode;
-import com.vaadin.sass.tree.VariableNode;
-import com.vaadin.sass.tree.WhileNode;
-import com.vaadin.sass.tree.controldirective.EachDefNode;
-
-public interface SCSSDocumentHandler extends DocumentHandler {
- ScssStylesheet getStyleSheet();
-
- void variable(String name, LexicalUnitImpl value, boolean guarded);
-
- void startMixinDirective(String name, Collection<VariableNode> args);
-
- void endMixinDirective(String name, Collection<VariableNode> args);
-
- void debugDirective();
-
- ForNode forDirective(String var, String from, String to, boolean exclusive,
- String body);
-
- WhileNode whileDirective(String condition, String body);
-
- void startNestedProperties(String name);
-
- void endNestedProperties(String name);
-
- void includeDirective(String name, Collection<LexicalUnitImpl> args);
-
- void importStyle(String uri, SACMediaList media, boolean isURL);
-
- void property(String name, LexicalUnitImpl value, boolean important,
- String comment);
-
- EachDefNode startEachDirective(String variable, ArrayList<String> list);
-
- void endEachDirective();
-
- void startIfElseDirective();
-
- void endIfElseDirective();
-
- void ifDirective(String evaluator);
-
- void elseDirective();
-
- void startSelector(ArrayList<String> selectors) throws CSSException;
-
- void endSelector() throws CSSException;
-
- void extendDirective(ArrayList<String> list);
-
- void microsoftDirective(String name, String value);
-
- EachDefNode startEachDirective(String var, String listVariable);
-
- void removeDirective(String variable, String list, String remove,
- String separator);
-
- void appendDirective(String variable, String list, String remove,
- String separator);
-
- void containsDirective(String variable, String list, String contains,
- String separator);
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.handler;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Stack;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.InputSource;
-import org.w3c.css.sac.LexicalUnit;
-import org.w3c.css.sac.SACMediaList;
-import org.w3c.css.sac.SelectorList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.CommentNode;
-import com.vaadin.sass.tree.ExtendNode;
-import com.vaadin.sass.tree.FontFaceNode;
-import com.vaadin.sass.tree.ForNode;
-import com.vaadin.sass.tree.ImportNode;
-import com.vaadin.sass.tree.ListAppendNode;
-import com.vaadin.sass.tree.ListContainsNode;
-import com.vaadin.sass.tree.ListRemoveNode;
-import com.vaadin.sass.tree.MediaNode;
-import com.vaadin.sass.tree.MicrosoftRuleNode;
-import com.vaadin.sass.tree.MixinDefNode;
-import com.vaadin.sass.tree.MixinNode;
-import com.vaadin.sass.tree.NestPropertiesNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.RuleNode;
-import com.vaadin.sass.tree.VariableNode;
-import com.vaadin.sass.tree.WhileNode;
-import com.vaadin.sass.tree.controldirective.EachDefNode;
-import com.vaadin.sass.tree.controldirective.ElseNode;
-import com.vaadin.sass.tree.controldirective.IfElseDefNode;
-import com.vaadin.sass.tree.controldirective.IfNode;
-
-public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
-
- private final ScssStylesheet styleSheet;
- Stack<Node> nodeStack = new Stack<Node>();
-
- public SCSSDocumentHandlerImpl() {
- this(new ScssStylesheet());
- }
-
- public SCSSDocumentHandlerImpl(ScssStylesheet styleSheet) {
- this.styleSheet = styleSheet;
- nodeStack.push(styleSheet);
- }
-
- @Override
- public ScssStylesheet getStyleSheet() {
- return styleSheet;
- }
-
- @Override
- public void startDocument(InputSource source) throws CSSException {
- nodeStack.push(styleSheet);
- }
-
- @Override
- public void endDocument(InputSource source) throws CSSException {
- }
-
- @Override
- public void variable(String name, LexicalUnitImpl value, boolean guarded) {
- VariableNode node = new VariableNode(name, value, guarded);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void debugDirective() {
- }
-
- @Override
- public ForNode forDirective(String var, String from, String to,
- boolean exclusive, String body) {
- ForNode node = new ForNode(var, from, to, exclusive, body);
- System.out.println(node);
- return node;
- }
-
- @Override
- public EachDefNode startEachDirective(String var, ArrayList<String> list) {
- EachDefNode node = new EachDefNode(var, list);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- return node;
- }
-
- @Override
- public EachDefNode startEachDirective(String var, String listVariable) {
- EachDefNode node = new EachDefNode(var, listVariable);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- return node;
- }
-
- @Override
- public void endEachDirective() {
- nodeStack.pop();
- }
-
- @Override
- public WhileNode whileDirective(String condition, String body) {
- WhileNode node = new WhileNode(condition, body);
- System.out.println(node);
- return node;
- }
-
- @Override
- public void comment(String text) throws CSSException {
- CommentNode node = new CommentNode(text);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void ignorableAtRule(String atRule) throws CSSException {
- System.out.println("ignorableAtRule(String atRule): " + atRule);
- }
-
- @Override
- public void namespaceDeclaration(String prefix, String uri)
- throws CSSException {
- System.out.println("namespaceDeclaration(String prefix, String uri): "
- + prefix + ", " + uri);
- }
-
- @Override
- public void importStyle(String uri, SACMediaList media,
- String defaultNamespaceURI) throws CSSException {
- }
-
- @Override
- public void startMedia(SACMediaList media) throws CSSException {
- MediaNode node = new MediaNode(media);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endMedia(SACMediaList media) throws CSSException {
- nodeStack.pop();
- }
-
- @Override
- public void startPage(String name, String pseudo_page) throws CSSException {
- System.out.println("startPage(String name, String pseudo_page): "
- + name + ", " + pseudo_page);
- }
-
- @Override
- public void endPage(String name, String pseudo_page) throws CSSException {
- System.out.println("endPage(String name, String pseudo_page): " + name
- + ", " + pseudo_page);
- }
-
- @Override
- public void startFontFace() throws CSSException {
- FontFaceNode node = new FontFaceNode();
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endFontFace() throws CSSException {
- nodeStack.pop();
- }
-
- @Override
- public void startSelector(ArrayList<String> selectors) throws CSSException {
- BlockNode node = new BlockNode(selectors);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endSelector() throws CSSException {
- nodeStack.pop();
- }
-
- @Override
- public void property(String name, LexicalUnit value, boolean important)
- throws CSSException {
- property(name, (LexicalUnitImpl) value, important, null);
- }
-
- @Override
- public void property(String name, LexicalUnitImpl value, boolean important,
- String comment) {
- RuleNode node = new RuleNode(name, value, important, comment);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void extendDirective(ArrayList<String> list) {
- ExtendNode node = new ExtendNode(list);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void startNestedProperties(String name) {
- NestPropertiesNode node = new NestPropertiesNode(name);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endNestedProperties(String name) {
- nodeStack.pop();
- }
-
- @Override
- public void startMixinDirective(String name, Collection<VariableNode> args) {
- MixinDefNode node = new MixinDefNode(name.trim(), args);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endMixinDirective(String name, Collection<VariableNode> args) {
- nodeStack.pop();
- }
-
- @Override
- public void includeDirective(String name, Collection<LexicalUnitImpl> args) {
- MixinNode node = new MixinNode(name, args);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void importStyle(String uri, SACMediaList media, boolean isURL) {
- ImportNode node = new ImportNode(uri, media, isURL);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void startIfElseDirective() {
- final IfElseDefNode node = new IfElseDefNode();
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void ifDirective(String evaluator) {
- if (nodeStack.peek() instanceof IfNode) {
- nodeStack.pop();
- }
- IfNode node = new IfNode(evaluator);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void elseDirective() {
- if (nodeStack.peek() instanceof IfNode) {
- nodeStack.pop();
- }
- ElseNode node = new ElseNode();
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endIfElseDirective() {
- if ((nodeStack.peek() instanceof ElseNode)
- || (nodeStack.peek() instanceof IfNode)) {
- nodeStack.pop();
- }
- nodeStack.pop();
- }
-
- @Override
- public void microsoftDirective(String name, String value) {
- MicrosoftRuleNode node = new MicrosoftRuleNode(name, value);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void endSelector(SelectorList arg0) throws CSSException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void startSelector(SelectorList arg0) throws CSSException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void removeDirective(String variable, String list, String remove,
- String separator) {
- ListRemoveNode node = new ListRemoveNode(variable, list, remove,
- separator);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void appendDirective(String variable, String list, String append,
- String separator) {
- ListAppendNode node = new ListAppendNode(variable, list, append,
- separator);
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void containsDirective(String variable, String list,
- String contains, String separator) {
- ListContainsNode node = new ListContainsNode(variable, list, contains,
- separator);
- nodeStack.peek().appendChild(node);
- }
-}
+++ /dev/null
-package com.vaadin.sass.handler;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.CSSParseException;
-import org.w3c.css.sac.ErrorHandler;
-
-public class SCSSErrorHandler implements ErrorHandler {
-
- @Override
- public void error(CSSParseException arg0) throws CSSException {
- System.out.println("Error when parsing file \n" + arg0.getURI()
- + " on line " + arg0.getLineNumber() + ", column "
- + arg0.getColumnNumber());
- System.out.println(arg0.getMessage() + "\n");
- }
-
- @Override
- public void fatalError(CSSParseException arg0) throws CSSException {
- System.out.println("FATAL Error when parsing file \n" + arg0.getURI()
- + " on line " + arg0.getLineNumber() + ", column "
- + arg0.getColumnNumber());
- System.out.println(arg0.getMessage() + "\n");
- }
-
- @Override
- public void warning(CSSParseException arg0) throws CSSException {
- System.out.println("Warning when parsing file \n" + arg0.getURI()
- + " on line " + arg0.getLineNumber() + ", column "
- + arg0.getColumnNumber());
- System.out.println(arg0.getMessage() + "\n");
- }
-
-}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.InputSource;
+
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.handler.SCSSErrorHandler;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.resolver.ScssStylesheetResolver;
+import com.vaadin.sass.internal.resolver.VaadinResolver;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.MixinDefNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.VariableNode;
+import com.vaadin.sass.internal.tree.controldirective.IfElseDefNode;
+import com.vaadin.sass.internal.visitor.ImportNodeHandler;
+
+public class ScssStylesheet extends Node {
+
+ private static final long serialVersionUID = 3849790204404961608L;
+
+ private static ScssStylesheet mainStyleSheet = null;
+
+ private static final HashMap<String, VariableNode> variables = new HashMap<String, VariableNode>();
+
+ private static final Map<String, MixinDefNode> mixinDefs = new HashMap<String, MixinDefNode>();
+
+ private static final HashSet<IfElseDefNode> ifElseDefNodes = new HashSet<IfElseDefNode>();
+
+ private static HashMap<Node, Node> lastNodeAdded = new HashMap<Node, Node>();
+
+ private String fileName;
+
+ /**
+ * Read in a file SCSS and parse it into a ScssStylesheet
+ *
+ * @param file
+ * @throws IOException
+ */
+ public ScssStylesheet() {
+ super();
+ }
+
+ /**
+ * Main entry point for the SASS compiler. Takes in a file and builds upp a
+ * ScssStylesheet tree out of it. Calling compile() on it will transform
+ * SASS into CSS. Calling toString() will print out the SCSS/CSS.
+ *
+ * @param file
+ * @return
+ * @throws CSSException
+ * @throws IOException
+ */
+ public static ScssStylesheet get(String identifier) throws CSSException,
+ IOException {
+ File file = new File(identifier);
+ file = file.getCanonicalFile();
+
+ SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl();
+ ScssStylesheet stylesheet = handler.getStyleSheet();
+
+ InputSource source = stylesheet.resolveStylesheet(identifier);
+ if (source == null) {
+ return null;
+ }
+
+ Parser parser = new Parser();
+ parser.setErrorHandler(new SCSSErrorHandler());
+ parser.setDocumentHandler(handler);
+ parser.parseStyleSheet(source);
+
+ return stylesheet;
+ }
+
+ private static ScssStylesheetResolver[] resolvers = null;
+
+ public static void setStylesheetResolvers(
+ ScssStylesheetResolver... styleSheetResolvers) {
+ resolvers = Arrays.copyOf(styleSheetResolvers,
+ styleSheetResolvers.length);
+ }
+
+ public InputSource resolveStylesheet(String identifier) {
+ if (resolvers == null) {
+ setStylesheetResolvers(new VaadinResolver());
+ }
+
+ for (ScssStylesheetResolver resolver : resolvers) {
+ InputSource source = resolver.resolve(identifier);
+ if (source != null) {
+ File f = new File(source.getURI());
+ setFileName(f.getParent());
+ return source;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Applies all the visitors and compiles SCSS into Css.
+ *
+ * @throws Exception
+ */
+ public void compile() throws Exception {
+ mainStyleSheet = this;
+ mixinDefs.clear();
+ variables.clear();
+ ifElseDefNodes.clear();
+ lastNodeAdded.clear();
+ importOtherFiles(this);
+ populateDefinitions(this);
+ traverse(this);
+ removeEmptyBlocks(this);
+ }
+
+ private void importOtherFiles(ScssStylesheet node) {
+ ImportNodeHandler.traverse(node);
+ }
+
+ private void populateDefinitions(Node node) {
+ if (node instanceof MixinDefNode) {
+ mixinDefs.put(((MixinDefNode) node).getName(), (MixinDefNode) node);
+ node.getParentNode().removeChild(node);
+ } else if (node instanceof IfElseDefNode) {
+ ifElseDefNodes.add((IfElseDefNode) node);
+ }
+
+ for (final Node child : new ArrayList<Node>(node.getChildren())) {
+ populateDefinitions(child);
+ }
+
+ }
+
+ /**
+ * Prints out the current state of the node tree. Will return SCSS before
+ * compile and CSS after.
+ *
+ * For now this is an own method with it's own implementation that most node
+ * types will implement themselves.
+ */
+ @Override
+ public String toString() {
+ StringBuilder string = new StringBuilder("");
+ if (children.size() > 0) {
+ string.append(children.get(0).toString());
+ }
+ String delimeter = "\n\n";
+ if (children.size() > 1) {
+ for (int i = 1; i < children.size(); i++) {
+ String childString = children.get(i).toString();
+ if (childString != null) {
+ string.append(delimeter).append(childString);
+ }
+ }
+ }
+ String output = string.toString();
+ return output;
+ }
+
+ public void addChild(int index, VariableNode node) {
+ if (node != null) {
+ children.add(index, node);
+ }
+ }
+
+ public static ScssStylesheet get() {
+ return mainStyleSheet;
+ }
+
+ @Override
+ public void traverse() {
+ // Not used for ScssStylesheet
+ }
+
+ /**
+ * Traverses a node and its children recursively, calling all the
+ * appropriate handlers via {@link Node#traverse()}.
+ *
+ * The node itself may be removed during the traversal and replaced with
+ * other nodes at the same position or later on the child list of its
+ * parent.
+ *
+ * @param node
+ * node to traverse
+ * @return true if the node was removed (and possibly replaced by others),
+ * false if not
+ */
+ public boolean traverse(Node node) {
+ Node originalParent = node.getParentNode();
+
+ node.traverse();
+
+ @SuppressWarnings("unchecked")
+ HashMap<String, VariableNode> variableScope = (HashMap<String, VariableNode>) variables
+ .clone();
+
+ // the size of the child list may change on each iteration: current node
+ // may get deleted and possibly other nodes have been inserted where it
+ // was or after that position
+ for (int i = 0; i < node.getChildren().size(); i++) {
+ Node current = node.getChildren().get(i);
+ if (traverse(current)) {
+ // current has been removed
+ --i;
+ }
+ }
+
+ variables.clear();
+ variables.putAll(variableScope);
+
+ // has the node been removed from its parent?
+ if (originalParent != null) {
+ return !originalParent.getChildren().contains(node);
+ } else {
+ return false;
+ }
+ }
+
+ public void removeEmptyBlocks(Node node) {
+ // depth first for avoiding re-checking parents of removed nodes
+ for (Node child : new ArrayList<Node>(node.getChildren())) {
+ removeEmptyBlocks(child);
+ }
+ Node parent = node.getParentNode();
+ if (node instanceof BlockNode && node.getChildren().isEmpty()
+ && parent != null) {
+ // remove empty block
+ parent.removeChild(node);
+ }
+ }
+
+ public static void addVariable(VariableNode node) {
+ variables.put(node.getName(), node);
+ }
+
+ public static VariableNode getVariable(String string) {
+ return variables.get(string);
+ }
+
+ public static ArrayList<VariableNode> getVariables() {
+ return new ArrayList<VariableNode>(variables.values());
+ }
+
+ public static MixinDefNode getMixinDefinition(String name) {
+ return mixinDefs.get(name);
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public static HashMap<Node, Node> getLastNodeAdded() {
+ return lastNodeAdded;
+ }
+
+ public static final void warning(String msg) {
+ Logger.getLogger(ScssStylesheet.class.getName()).warning(msg);
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.handler;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.SACMediaList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.tree.ForNode;
+import com.vaadin.sass.internal.tree.VariableNode;
+import com.vaadin.sass.internal.tree.WhileNode;
+import com.vaadin.sass.internal.tree.controldirective.EachDefNode;
+
+public interface SCSSDocumentHandler extends DocumentHandler {
+ ScssStylesheet getStyleSheet();
+
+ void variable(String name, LexicalUnitImpl value, boolean guarded);
+
+ void startMixinDirective(String name, Collection<VariableNode> args);
+
+ void endMixinDirective(String name, Collection<VariableNode> args);
+
+ void debugDirective();
+
+ ForNode forDirective(String var, String from, String to, boolean exclusive,
+ String body);
+
+ WhileNode whileDirective(String condition, String body);
+
+ void startNestedProperties(String name);
+
+ void endNestedProperties(String name);
+
+ void includeDirective(String name, Collection<LexicalUnitImpl> args);
+
+ void importStyle(String uri, SACMediaList media, boolean isURL);
+
+ void property(String name, LexicalUnitImpl value, boolean important,
+ String comment);
+
+ EachDefNode startEachDirective(String variable, ArrayList<String> list);
+
+ void endEachDirective();
+
+ void startIfElseDirective();
+
+ void endIfElseDirective();
+
+ void ifDirective(String evaluator);
+
+ void elseDirective();
+
+ void startSelector(ArrayList<String> selectors) throws CSSException;
+
+ void endSelector() throws CSSException;
+
+ void extendDirective(ArrayList<String> list);
+
+ void microsoftDirective(String name, String value);
+
+ EachDefNode startEachDirective(String var, String listVariable);
+
+ void removeDirective(String variable, String list, String remove,
+ String separator);
+
+ void appendDirective(String variable, String list, String remove,
+ String separator);
+
+ void containsDirective(String variable, String list, String contains,
+ String separator);
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.handler;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Stack;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.LexicalUnit;
+import org.w3c.css.sac.SACMediaList;
+import org.w3c.css.sac.SelectorList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.CommentNode;
+import com.vaadin.sass.internal.tree.ExtendNode;
+import com.vaadin.sass.internal.tree.FontFaceNode;
+import com.vaadin.sass.internal.tree.ForNode;
+import com.vaadin.sass.internal.tree.ImportNode;
+import com.vaadin.sass.internal.tree.ListAppendNode;
+import com.vaadin.sass.internal.tree.ListContainsNode;
+import com.vaadin.sass.internal.tree.ListRemoveNode;
+import com.vaadin.sass.internal.tree.MediaNode;
+import com.vaadin.sass.internal.tree.MicrosoftRuleNode;
+import com.vaadin.sass.internal.tree.MixinDefNode;
+import com.vaadin.sass.internal.tree.MixinNode;
+import com.vaadin.sass.internal.tree.NestPropertiesNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.RuleNode;
+import com.vaadin.sass.internal.tree.VariableNode;
+import com.vaadin.sass.internal.tree.WhileNode;
+import com.vaadin.sass.internal.tree.controldirective.EachDefNode;
+import com.vaadin.sass.internal.tree.controldirective.ElseNode;
+import com.vaadin.sass.internal.tree.controldirective.IfElseDefNode;
+import com.vaadin.sass.internal.tree.controldirective.IfNode;
+
+public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
+
+ private final ScssStylesheet styleSheet;
+ Stack<Node> nodeStack = new Stack<Node>();
+
+ public SCSSDocumentHandlerImpl() {
+ this(new ScssStylesheet());
+ }
+
+ public SCSSDocumentHandlerImpl(ScssStylesheet styleSheet) {
+ this.styleSheet = styleSheet;
+ nodeStack.push(styleSheet);
+ }
+
+ @Override
+ public ScssStylesheet getStyleSheet() {
+ return styleSheet;
+ }
+
+ @Override
+ public void startDocument(InputSource source) throws CSSException {
+ nodeStack.push(styleSheet);
+ }
+
+ @Override
+ public void endDocument(InputSource source) throws CSSException {
+ }
+
+ @Override
+ public void variable(String name, LexicalUnitImpl value, boolean guarded) {
+ VariableNode node = new VariableNode(name, value, guarded);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void debugDirective() {
+ }
+
+ @Override
+ public ForNode forDirective(String var, String from, String to,
+ boolean exclusive, String body) {
+ ForNode node = new ForNode(var, from, to, exclusive, body);
+ System.out.println(node);
+ return node;
+ }
+
+ @Override
+ public EachDefNode startEachDirective(String var, ArrayList<String> list) {
+ EachDefNode node = new EachDefNode(var, list);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ return node;
+ }
+
+ @Override
+ public EachDefNode startEachDirective(String var, String listVariable) {
+ EachDefNode node = new EachDefNode(var, listVariable);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ return node;
+ }
+
+ @Override
+ public void endEachDirective() {
+ nodeStack.pop();
+ }
+
+ @Override
+ public WhileNode whileDirective(String condition, String body) {
+ WhileNode node = new WhileNode(condition, body);
+ System.out.println(node);
+ return node;
+ }
+
+ @Override
+ public void comment(String text) throws CSSException {
+ CommentNode node = new CommentNode(text);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void ignorableAtRule(String atRule) throws CSSException {
+ System.out.println("ignorableAtRule(String atRule): " + atRule);
+ }
+
+ @Override
+ public void namespaceDeclaration(String prefix, String uri)
+ throws CSSException {
+ System.out.println("namespaceDeclaration(String prefix, String uri): "
+ + prefix + ", " + uri);
+ }
+
+ @Override
+ public void importStyle(String uri, SACMediaList media,
+ String defaultNamespaceURI) throws CSSException {
+ }
+
+ @Override
+ public void startMedia(SACMediaList media) throws CSSException {
+ MediaNode node = new MediaNode(media);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void endMedia(SACMediaList media) throws CSSException {
+ nodeStack.pop();
+ }
+
+ @Override
+ public void startPage(String name, String pseudo_page) throws CSSException {
+ System.out.println("startPage(String name, String pseudo_page): "
+ + name + ", " + pseudo_page);
+ }
+
+ @Override
+ public void endPage(String name, String pseudo_page) throws CSSException {
+ System.out.println("endPage(String name, String pseudo_page): " + name
+ + ", " + pseudo_page);
+ }
+
+ @Override
+ public void startFontFace() throws CSSException {
+ FontFaceNode node = new FontFaceNode();
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void endFontFace() throws CSSException {
+ nodeStack.pop();
+ }
+
+ @Override
+ public void startSelector(ArrayList<String> selectors) throws CSSException {
+ BlockNode node = new BlockNode(selectors);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void endSelector() throws CSSException {
+ nodeStack.pop();
+ }
+
+ @Override
+ public void property(String name, LexicalUnit value, boolean important)
+ throws CSSException {
+ property(name, (LexicalUnitImpl) value, important, null);
+ }
+
+ @Override
+ public void property(String name, LexicalUnitImpl value, boolean important,
+ String comment) {
+ RuleNode node = new RuleNode(name, value, important, comment);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void extendDirective(ArrayList<String> list) {
+ ExtendNode node = new ExtendNode(list);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void startNestedProperties(String name) {
+ NestPropertiesNode node = new NestPropertiesNode(name);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void endNestedProperties(String name) {
+ nodeStack.pop();
+ }
+
+ @Override
+ public void startMixinDirective(String name, Collection<VariableNode> args) {
+ MixinDefNode node = new MixinDefNode(name.trim(), args);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void endMixinDirective(String name, Collection<VariableNode> args) {
+ nodeStack.pop();
+ }
+
+ @Override
+ public void includeDirective(String name, Collection<LexicalUnitImpl> args) {
+ MixinNode node = new MixinNode(name, args);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void importStyle(String uri, SACMediaList media, boolean isURL) {
+ ImportNode node = new ImportNode(uri, media, isURL);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void startIfElseDirective() {
+ final IfElseDefNode node = new IfElseDefNode();
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void ifDirective(String evaluator) {
+ if (nodeStack.peek() instanceof IfNode) {
+ nodeStack.pop();
+ }
+ IfNode node = new IfNode(evaluator);
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void elseDirective() {
+ if (nodeStack.peek() instanceof IfNode) {
+ nodeStack.pop();
+ }
+ ElseNode node = new ElseNode();
+ nodeStack.peek().appendChild(node);
+ nodeStack.push(node);
+ }
+
+ @Override
+ public void endIfElseDirective() {
+ if ((nodeStack.peek() instanceof ElseNode)
+ || (nodeStack.peek() instanceof IfNode)) {
+ nodeStack.pop();
+ }
+ nodeStack.pop();
+ }
+
+ @Override
+ public void microsoftDirective(String name, String value) {
+ MicrosoftRuleNode node = new MicrosoftRuleNode(name, value);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void endSelector(SelectorList arg0) throws CSSException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void startSelector(SelectorList arg0) throws CSSException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeDirective(String variable, String list, String remove,
+ String separator) {
+ ListRemoveNode node = new ListRemoveNode(variable, list, remove,
+ separator);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void appendDirective(String variable, String list, String append,
+ String separator) {
+ ListAppendNode node = new ListAppendNode(variable, list, append,
+ separator);
+ nodeStack.peek().appendChild(node);
+ }
+
+ @Override
+ public void containsDirective(String variable, String list,
+ String contains, String separator) {
+ ListContainsNode node = new ListContainsNode(variable, list, contains,
+ separator);
+ nodeStack.peek().appendChild(node);
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.handler;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.ErrorHandler;
+
+public class SCSSErrorHandler implements ErrorHandler {
+
+ @Override
+ public void error(CSSParseException arg0) throws CSSException {
+ System.out.println("Error when parsing file \n" + arg0.getURI()
+ + " on line " + arg0.getLineNumber() + ", column "
+ + arg0.getColumnNumber());
+ System.out.println(arg0.getMessage() + "\n");
+ }
+
+ @Override
+ public void fatalError(CSSParseException arg0) throws CSSException {
+ System.out.println("FATAL Error when parsing file \n" + arg0.getURI()
+ + " on line " + arg0.getLineNumber() + ", column "
+ + arg0.getColumnNumber());
+ System.out.println(arg0.getMessage() + "\n");
+ }
+
+ @Override
+ public void warning(CSSParseException arg0) throws CSSException {
+ System.out.println("Warning when parsing file \n" + arg0.getURI()
+ + " on line " + arg0.getLineNumber() + ", column "
+ + arg0.getColumnNumber());
+ System.out.println(arg0.getMessage() + "\n");
+ }
+
+}
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */
+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package com.vaadin.sass.internal.parser;
+
+/**
+ * This interface describes a character stream that maintains line and
+ * column number positions of the characters. It also has the capability
+ * to backup the stream to some extent. An implementation of this
+ * interface is used in the TokenManager implementation generated by
+ * JavaCCParser.
+ *
+ * All the methods except backup can be implemented in any fashion. backup
+ * needs to be implemented correctly for the correct operation of the lexer.
+ * Rest of the methods are all used to get information like line number,
+ * column number and the String that constitutes a token and are not used
+ * by the lexer. Hence their implementation won't affect the generated lexer's
+ * operation.
+ */
+
+public
+interface CharStream {
+
+ /**
+ * Returns the next character from the selected input. The method
+ * of selecting the input is the responsibility of the class
+ * implementing this interface. Can throw any java.io.IOException.
+ */
+ char readChar() throws java.io.IOException;
+
+ @Deprecated
+ /**
+ * Returns the column position of the character last read.
+ * @deprecated
+ * @see #getEndColumn
+ */
+ int getColumn();
+
+ @Deprecated
+ /**
+ * Returns the line number of the character last read.
+ * @deprecated
+ * @see #getEndLine
+ */
+ int getLine();
+
+ /**
+ * Returns the column number of the last character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ int getEndColumn();
+
+ /**
+ * Returns the line number of the last character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ int getEndLine();
+
+ /**
+ * Returns the column number of the first character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ int getBeginColumn();
+
+ /**
+ * Returns the line number of the first character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ int getBeginLine();
+
+ /**
+ * Backs up the input stream by amount steps. Lexer calls this method if it
+ * had already read some characters, but could not use them to match a
+ * (longer) token. So, they will be used again as the prefix of the next
+ * token and it is the implemetation's responsibility to do this right.
+ */
+ void backup(int amount);
+
+ /**
+ * Returns the next character that marks the beginning of the next token.
+ * All characters must remain in the buffer between two successive calls
+ * to this method to implement backup correctly.
+ */
+ char BeginToken() throws java.io.IOException;
+
+ /**
+ * Returns a string made up of characters from the marked token beginning
+ * to the current buffer position. Implementations have the choice of returning
+ * anything that they want to. For example, for efficiency, one might decide
+ * to just return null, which is a valid implementation.
+ */
+ String GetImage();
+
+ /**
+ * Returns an array of characters that make up the suffix of length 'len' for
+ * the currently matched token. This is used to build up the matched string
+ * for use in actions in the case of MORE. A simple and inefficient
+ * implementation of this is as follows :
+ *
+ * {
+ * String t = GetImage();
+ * return t.substring(t.length() - len, t.length()).toCharArray();
+ * }
+ */
+ char[] GetSuffix(int len);
+
+ /**
+ * The lexer calls this function to indicate that it is done with the stream
+ * and hence implementations can free any resources held by this class.
+ * Again, the body of this function can be just empty and it will not
+ * affect the lexer's operation.
+ */
+ void Done();
+
+}
+/* JavaCC - OriginalChecksum=28e31651bf0ffe57018eaaa3310c55ac (do not edit this line) */
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. Generic_CharStream.java Version 0.7pre6 */
+package com.vaadin.sass.internal.parser;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public final class Generic_CharStream implements CharStream
+{
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private java.io.Reader reader;
+
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = reader.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ reader.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = (char)((char)0xff & buffer[bufpos]);
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public Generic_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ reader = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public Generic_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ reader = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+ return ret;
+ }
+
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
--- /dev/null
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: JumpException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class JumpException extends RuntimeException {
+ private static final long serialVersionUID = -2010286909393046205L;
+
+ /**
+ * Creates a new JumpException
+ */
+ public JumpException() {
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: LexicalUnitImpl.java,v 1.3 2000/02/15 02:08:19 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+import java.io.Serializable;
+
+import org.w3c.css.sac.LexicalUnit;
+
+import com.vaadin.sass.internal.util.ColorUtil;
+
+/**
+ * @version $Revision: 1.3 $
+ * @author Philippe Le Hegaret
+ *
+ * @modified Sebastian Nyholm @ Vaadin Ltd
+ */
+public class LexicalUnitImpl implements LexicalUnit, SCSSLexicalUnit,
+ Serializable {
+ private static final long serialVersionUID = -6649833716809789399L;
+
+ LexicalUnitImpl prev;
+ LexicalUnitImpl next;
+
+ short type;
+ int line;
+ int column;
+
+ int i;
+ float f;
+ short dimension;
+ String sdimension;
+ String s;
+ String fname;
+ LexicalUnitImpl params;
+
+ LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl p) {
+ if (p != null) {
+ prev = p;
+ p.next = this;
+ }
+ this.line = line;
+ this.column = column - 1;
+ this.type = type;
+ }
+
+ LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, int i) {
+ this(SAC_INTEGER, line, column, previous);
+ this.i = i;
+ }
+
+ LexicalUnitImpl(int line, int column, LexicalUnitImpl previous,
+ short dimension, String sdimension, float f) {
+ this(dimension, line, column, previous);
+ this.f = f;
+ this.dimension = dimension;
+ this.sdimension = sdimension;
+ }
+
+ LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, short type,
+ String s) {
+ this(type, line, column, previous);
+ this.s = s;
+ }
+
+ LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl previous,
+ String fname, LexicalUnitImpl params) {
+ this(type, line, column, previous);
+ this.fname = fname;
+ this.params = params;
+ }
+
+ public int getLineNumber() {
+ return line;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ @Override
+ public short getLexicalUnitType() {
+ return type;
+ }
+
+ public void setLexicalUnitType(short type) {
+ this.type = type;
+ }
+
+ public void getLexicalUnitType(short type) {
+ this.type = type;
+ }
+
+ @Override
+ public LexicalUnitImpl getNextLexicalUnit() {
+ return next;
+ }
+
+ public void setNextLexicalUnit(LexicalUnitImpl n) {
+ next = n;
+ }
+
+ @Override
+ public LexicalUnitImpl getPreviousLexicalUnit() {
+ return prev;
+ }
+
+ public void setPrevLexicalUnit(LexicalUnitImpl n) {
+ prev = n;
+ }
+
+ @Override
+ public int getIntegerValue() {
+ return i;
+ }
+
+ void setIntegerValue(int i) {
+ this.i = i;
+ }
+
+ @Override
+ public float getFloatValue() {
+ return f;
+ }
+
+ public void setFloatValue(float f) {
+ this.f = f;
+ }
+
+ @Override
+ public String getDimensionUnitText() {
+ switch (type) {
+ case SAC_PERCENTAGE:
+ return "%";
+ case SAC_EM:
+ return "em";
+ case SAC_EX:
+ return "ex";
+ case SAC_PIXEL:
+ return "px";
+ case SAC_CENTIMETER:
+ return "cm";
+ case SAC_MILLIMETER:
+ return "mm";
+ case SAC_INCH:
+ return "in";
+ case SAC_POINT:
+ return "pt";
+ case SAC_PICA:
+ return "pc";
+ case SAC_DEGREE:
+ return "deg";
+ case SAC_RADIAN:
+ return "rad";
+ case SAC_GRADIAN:
+ return "grad";
+ case SAC_MILLISECOND:
+ return "ms";
+ case SAC_SECOND:
+ return "s";
+ case SAC_HERTZ:
+ return "Hz";
+ case SAC_KILOHERTZ:
+ return "kHz";
+ case SAC_DIMENSION:
+ return sdimension;
+ default:
+ throw new IllegalStateException("invalid dimension " + type);
+ }
+ }
+
+ @Override
+ public String getStringValue() {
+ return s;
+ }
+
+ public void setStringValue(String str) {
+ s = str;
+ }
+
+ @Override
+ public String getFunctionName() {
+ return fname;
+ }
+
+ @Override
+ public LexicalUnitImpl getParameters() {
+ return params;
+ }
+
+ @Override
+ public LexicalUnitImpl getSubValues() {
+ return params;
+ }
+
+ @Override
+ public String toString() {
+ short type = getLexicalUnitType();
+ String text = null;
+ switch (type) {
+ case SCSS_VARIABLE:
+ text = "$" + s;
+ break;
+ case LexicalUnit.SAC_OPERATOR_COMMA:
+ text = ",";
+ break;
+ case LexicalUnit.SAC_OPERATOR_PLUS:
+ text = "+";
+ break;
+ case LexicalUnit.SAC_OPERATOR_MINUS:
+ text = "-";
+ break;
+ case LexicalUnit.SAC_OPERATOR_MULTIPLY:
+ text = "*";
+ break;
+ case LexicalUnit.SAC_OPERATOR_SLASH:
+ text = "/";
+ break;
+ case LexicalUnit.SAC_OPERATOR_MOD:
+ text = "%";
+ break;
+ case LexicalUnit.SAC_OPERATOR_EXP:
+ text = "^";
+ break;
+ case LexicalUnit.SAC_OPERATOR_LT:
+ text = "<";
+ break;
+ case LexicalUnit.SAC_OPERATOR_GT:
+ text = ">";
+ break;
+ case LexicalUnit.SAC_OPERATOR_LE:
+ text = "<=";
+ break;
+ case LexicalUnit.SAC_OPERATOR_GE:
+ text = "=>";
+ break;
+ case LexicalUnit.SAC_OPERATOR_TILDE:
+ text = "~";
+ break;
+ case LexicalUnit.SAC_INHERIT:
+ text = "inherit";
+ break;
+ case LexicalUnit.SAC_INTEGER:
+ text = Integer.toString(getIntegerValue(), 10);
+ break;
+ case LexicalUnit.SAC_REAL:
+ text = getFloatValue() + "";
+ break;
+ case LexicalUnit.SAC_EM:
+ case LexicalUnit.SAC_EX:
+ case LexicalUnit.SAC_PIXEL:
+ case LexicalUnit.SAC_INCH:
+ case LexicalUnit.SAC_CENTIMETER:
+ case LexicalUnit.SAC_MILLIMETER:
+ case LexicalUnit.SAC_POINT:
+ case LexicalUnit.SAC_PICA:
+ case LexicalUnit.SAC_PERCENTAGE:
+ case LexicalUnit.SAC_DEGREE:
+ case LexicalUnit.SAC_GRADIAN:
+ case LexicalUnit.SAC_RADIAN:
+ case LexicalUnit.SAC_MILLISECOND:
+ case LexicalUnit.SAC_SECOND:
+ case LexicalUnit.SAC_HERTZ:
+ case LexicalUnit.SAC_KILOHERTZ:
+ case LexicalUnit.SAC_DIMENSION:
+ float f = getFloatValue();
+ int i = (int) f;
+ if ((i) == f) {
+ text = i + getDimensionUnitText();
+ } else {
+ text = f + getDimensionUnitText();
+ }
+ break;
+ case LexicalUnit.SAC_URI:
+ text = "url(" + getStringValue() + ")";
+ break;
+ case LexicalUnit.SAC_RGBCOLOR:
+ case LexicalUnit.SAC_COUNTER_FUNCTION:
+ case LexicalUnit.SAC_COUNTERS_FUNCTION:
+ case LexicalUnit.SAC_RECT_FUNCTION:
+ case LexicalUnit.SAC_FUNCTION:
+ String funcName = getFunctionName();
+ LexicalUnitImpl firstParam = getParameters();
+ if ("round".equals(funcName)) {
+ firstParam
+ .setFloatValue(Math.round(firstParam.getFloatValue()));
+ text = firstParam.toString();
+ } else if ("ceil".equals(funcName)) {
+ firstParam.setFloatValue((float) Math.ceil(firstParam
+ .getFloatValue()));
+ text = firstParam.toString();
+ } else if ("floor".equals(funcName)) {
+ firstParam.setFloatValue((float) Math.floor(firstParam
+ .getFloatValue()));
+ text = firstParam.toString();
+ } else if ("abs".equals(funcName)) {
+ firstParam.setFloatValue(Math.abs(firstParam.getFloatValue()));
+ text = firstParam.toString();
+ } else if ("darken".equals(funcName)) {
+ LexicalUnitImpl dark = ColorUtil.darken(this);
+ text = dark.toString();
+ } else if ("lighten".equals(funcName)) {
+ text = ColorUtil.lighten(this).toString();
+ } else {
+ text = getFunctionName() + "(" + getParameters() + ")";
+ }
+ break;
+ case LexicalUnit.SAC_IDENT:
+ text = getStringValue();
+ break;
+ case LexicalUnit.SAC_STRING_VALUE:
+ // @@SEEME. not exact
+ text = "\"" + getStringValue() + "\"";
+ break;
+ case LexicalUnit.SAC_ATTR:
+ text = "attr(" + getStringValue() + ")";
+ break;
+ case LexicalUnit.SAC_UNICODERANGE:
+ text = "@@TODO";
+ break;
+ case LexicalUnit.SAC_SUB_EXPRESSION:
+ text = getSubValues().toString();
+ break;
+ default:
+ text = "@unknown";
+ break;
+ }
+ if (getNextLexicalUnit() != null) {
+ if (getNextLexicalUnit().getLexicalUnitType() == SAC_OPERATOR_COMMA) {
+ return text + getNextLexicalUnit();
+ }
+ return text + ' ' + getNextLexicalUnit();
+ } else {
+ return text;
+ }
+ }
+
+ @Override
+ public LexicalUnitImpl divide(LexicalUnitImpl denominator) {
+ setFloatValue(getFloatValue() / denominator.getIntegerValue());
+ return this;
+ }
+
+ @Override
+ public LexicalUnitImpl add(LexicalUnitImpl another) {
+ setFloatValue(getFloatValue() + another.getFloatValue());
+ return this;
+ }
+
+ @Override
+ public LexicalUnitImpl minus(LexicalUnitImpl another) {
+ setFloatValue(getFloatValue() - another.getFloatValue());
+ return this;
+ }
+
+ @Override
+ public LexicalUnitImpl multiply(LexicalUnitImpl another) {
+ setFloatValue(getFloatValue() * another.getIntegerValue());
+ return this;
+ }
+
+ public void replaceValue(LexicalUnitImpl another) {
+ type = another.getLexicalUnitType();
+ i = another.getIntegerValue();
+ f = another.getFloatValue();
+ s = another.getStringValue();
+ fname = another.getFunctionName();
+ prev = another.getPreviousLexicalUnit();
+ dimension = another.getDimension();
+ sdimension = another.getSdimension();
+ params = another.getParameters();
+
+ LexicalUnitImpl finalNextInAnother = another;
+ while (finalNextInAnother.getNextLexicalUnit() != null) {
+ finalNextInAnother = finalNextInAnother.getNextLexicalUnit();
+ }
+
+ finalNextInAnother.setNextLexicalUnit(next);
+ next = another.next;
+ }
+
+ public void setParameters(LexicalUnitImpl params) {
+ this.params = params;
+ }
+
+ public short getDimension() {
+ return dimension;
+ }
+
+ public String getSdimension() {
+ return sdimension;
+ }
+
+ // here some useful function for creation
+ public static LexicalUnitImpl createVariable(int line, int column,
+ LexicalUnitImpl previous, String name) {
+ return new LexicalUnitImpl(line, column, previous, SCSS_VARIABLE, name);
+ }
+
+ public static LexicalUnitImpl createNumber(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ int i = (int) v;
+ if (v == i) {
+ return new LexicalUnitImpl(line, column, previous, i);
+ } else {
+ return new LexicalUnitImpl(line, column, previous, SAC_REAL, "", v);
+ }
+ }
+
+ public static LexicalUnitImpl createInteger(int line, int column,
+ LexicalUnitImpl previous, int i) {
+ return new LexicalUnitImpl(line, column, previous, i);
+ }
+
+ public static LexicalUnitImpl createPercentage(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_PERCENTAGE,
+ null, v);
+ }
+
+ static LexicalUnitImpl createEMS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_EM, null, v);
+ }
+
+ static LexicalUnitImpl createEXS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_EX, null, v);
+ }
+
+ public static LexicalUnitImpl createPixel(float p) {
+ return new LexicalUnitImpl(0, 0, null, SAC_PIXEL, null, p);
+ }
+
+ static LexicalUnitImpl createPX(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_PIXEL, null, v);
+ }
+
+ static LexicalUnitImpl createCM(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_CENTIMETER,
+ null, v);
+ }
+
+ static LexicalUnitImpl createMM(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_MILLIMETER,
+ null, v);
+ }
+
+ static LexicalUnitImpl createIN(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_INCH, null, v);
+ }
+
+ static LexicalUnitImpl createPT(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_POINT, null, v);
+ }
+
+ static LexicalUnitImpl createPC(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_PICA, null, v);
+ }
+
+ static LexicalUnitImpl createDEG(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_DEGREE, null, v);
+ }
+
+ static LexicalUnitImpl createRAD(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_RADIAN, null, v);
+ }
+
+ static LexicalUnitImpl createGRAD(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_GRADIAN, null, v);
+ }
+
+ static LexicalUnitImpl createMS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Time values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous, SAC_MILLISECOND,
+ null, v);
+ }
+
+ static LexicalUnitImpl createS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Time values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous, SAC_SECOND, null, v);
+ }
+
+ static LexicalUnitImpl createHZ(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Frequency values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous, SAC_HERTZ, null, v);
+ }
+
+ static LexicalUnitImpl createKHZ(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Frequency values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous, SAC_KILOHERTZ, null,
+ v);
+ }
+
+ static LexicalUnitImpl createDimen(int line, int column,
+ LexicalUnitImpl previous, float v, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_DIMENSION, s, v);
+ }
+
+ static LexicalUnitImpl createInherit(int line, int column,
+ LexicalUnitImpl previous) {
+ return new LexicalUnitImpl(line, column, previous, SAC_INHERIT,
+ "inherit");
+ }
+
+ public static LexicalUnitImpl createIdent(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_IDENT, s);
+ }
+
+ public static LexicalUnitImpl createString(String s) {
+ return new LexicalUnitImpl(0, 0, null, SAC_STRING_VALUE, s);
+ }
+
+ static LexicalUnitImpl createString(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_STRING_VALUE, s);
+ }
+
+ static LexicalUnitImpl createURL(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_URI, s);
+ }
+
+ static LexicalUnitImpl createAttr(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_ATTR, s);
+ }
+
+ static LexicalUnitImpl createCounter(int line, int column,
+ LexicalUnitImpl previous, LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_COUNTER_FUNCTION, line, column,
+ previous, "counter", (LexicalUnitImpl) params);
+ }
+
+ public static LexicalUnitImpl createCounters(int line, int column,
+ LexicalUnitImpl previous, LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_COUNTERS_FUNCTION, line, column,
+ previous, "counters", (LexicalUnitImpl) params);
+ }
+
+ public static LexicalUnitImpl createRGBColor(int line, int column,
+ LexicalUnitImpl previous, LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_RGBCOLOR, line, column, previous, "rgb",
+ (LexicalUnitImpl) params);
+ }
+
+ public static LexicalUnitImpl createRect(int line, int column,
+ LexicalUnitImpl previous, LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_RECT_FUNCTION, line, column, previous,
+ "rect", (LexicalUnitImpl) params);
+ }
+
+ public static LexicalUnitImpl createFunction(int line, int column,
+ LexicalUnitImpl previous, String fname, LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_FUNCTION, line, column, previous, fname,
+ (LexicalUnitImpl) params);
+ }
+
+ public static LexicalUnitImpl createUnicodeRange(int line, int column,
+ LexicalUnit previous, LexicalUnit params) {
+ // @@ return new LexicalUnitImpl(line, column, previous, null,
+ // SAC_UNICODERANGE, params);
+ return null;
+ }
+
+ public static LexicalUnitImpl createComma(int line, int column,
+ LexicalUnitImpl previous) {
+ return new LexicalUnitImpl(SAC_OPERATOR_COMMA, line, column, previous);
+ }
+
+ public static LexicalUnitImpl createSlash(int line, int column,
+ LexicalUnitImpl previous) {
+ 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;
+ }
+
+ /**
+ * Tries to return the value for this {@link LexicalUnitImpl} without
+ * considering any related units.
+ *
+ * @return
+ */
+ public Object getValue() {
+ if (s != null) {
+ return s;
+ } else if (i != -1) {
+ return i;
+ } else if (f != -1) {
+ return f;
+ } else
+ return null;
+ }
+
+ public void setFunctionName(String functionName) {
+ fname = functionName;
+ }
+
+ public static LexicalUnitImpl createIdent(String s) {
+ return new LexicalUnitImpl(0, 0, null, SAC_IDENT, s);
+ }
+
+ public static void replaceValues(LexicalUnitImpl unit,
+ LexicalUnitImpl replaceWith) {
+ unit.setLexicalUnitType(replaceWith.getLexicalUnitType());
+ unit.setStringValue(replaceWith.getStringValue());
+ unit.setFloatValue(replaceWith.getFloatValue());
+ unit.setIntegerValue(replaceWith.getIntegerValue());
+ unit.setFunctionName(replaceWith.getFunctionName());
+
+ if (replaceWith.getParameters() != null) {
+ unit.setParameters(replaceWith.getParameters());
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: LocatorImpl.java,v 1.2 2000/02/14 16:59:06 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+import org.w3c.css.sac.Locator;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class LocatorImpl implements Locator {
+
+ // W3C DEBUG mode
+ private static boolean W3CDebug;
+ static {
+ try {
+ W3CDebug = (Boolean.getBoolean("debug")
+ || Boolean
+ .getBoolean("org.w3c.flute.parser.LocatorImpl.debug")
+ || Boolean.getBoolean("org.w3c.flute.parser.debug")
+ || Boolean.getBoolean("org.w3c.flute.debug")
+ || Boolean.getBoolean("org.w3c.debug") || Boolean
+ .getBoolean("org.debug"));
+ } catch (Exception e) {
+ // nothing
+ }
+ }
+
+ String uri;
+ int line;
+ int column;
+
+ public String getURI() {
+ return uri;
+ }
+
+ public int getLineNumber() {
+ return line;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ /**
+ * Creates a new LocatorImpl
+ */
+ public LocatorImpl(Parser p) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::newLocator(" + p + ");");
+ }
+ uri = p.source.getURI();
+ line = p.token.beginLine;
+ column = p.token.beginColumn;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl(Parser p, Token tok) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::newLocator(" + p + ", " + tok
+ + ");");
+ }
+ uri = p.source.getURI();
+ line = tok.beginLine;
+ column = tok.beginColumn;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl(Parser p, int line, int column) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::newLocator(" + p + ", " + line
+ + ", " + column + ");");
+ }
+ uri = p.source.getURI();
+ this.line = line;
+ this.column = column;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::reInit(" + p + ");");
+ }
+ uri = p.source.getURI();
+ line = p.token.beginLine;
+ column = p.token.beginColumn;
+ return this;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p, Token tok) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::reInit(" + p + ", " + tok + ");");
+ }
+ uri = p.source.getURI();
+ line = tok.beginLine;
+ column = tok.beginColumn;
+ return this;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p, int line, int column) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::reInit(" + p + ", " + line + ", "
+ + column + ");");
+ }
+ uri = p.source.getURI();
+ this.line = line;
+ this.column = column;
+ return this;
+ }
+}
--- /dev/null
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: MediaListImpl.java,v 1.4 2000/04/26 13:40:19 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+import java.io.Serializable;
+
+import org.w3c.css.sac.SACMediaList;
+
+/**
+ * @version $Revision: 1.4 $
+ * @author Philippe Le Hegaret
+ */
+public class MediaListImpl implements SACMediaList, Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ String[] array = new String[10];
+ int current;
+
+ @Override
+ public int getLength() {
+ return current;
+ }
+
+ @Override
+ public String item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return array[index];
+ }
+
+ void addItem(String medium) {
+ if (medium.equals("all")) {
+ array[0] = "all";
+ current = 1;
+ return;
+ }
+ for (int i = 0; i < current; i++) {
+ if (medium.equals(array[i])) {
+ return;
+ }
+ }
+ if (current == array.length) {
+ String[] old = array;
+ array = new String[current + current];
+ System.arraycopy(old, 0, array, 0, current);
+ }
+ array[current++] = medium;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ */
+ @Override
+ public String toString() {
+ switch (current) {
+ case 0:
+ return "";
+ case 1:
+ return array[0];
+ default:
+ boolean not_done = true;
+ int i = 0;
+ StringBuffer buf = new StringBuffer(50);
+ do {
+ buf.append(array[i++]);
+ if (i == current) {
+ not_done = false;
+ } else {
+ buf.append(", ");
+ }
+ } while (not_done);
+ return buf.toString();
+ }
+ }
+}
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+package com.vaadin.sass.internal.parser;
+
+import org.w3c.css.sac.CSSException;
+
+/**
+ * This exception is thrown when parse errors are encountered. You can
+ * explicitly create objects of this exception type by calling the method
+ * generateParseException in the generated parser.
+ *
+ * You can modify this class to customize your error reporting mechanisms so
+ * long as you retain the public fields.
+ */
+public class ParseException extends CSSException {
+ private static final long serialVersionUID = -8556588037264585977L;
+
+ /**
+ * This constructor is used by the method "generateParseException" in the
+ * generated parser. Calling this constructor generates a new object of this
+ * type with the fields "currentToken", "expectedTokenSequences", and
+ * "tokenImage" set. The boolean flag "specialConstructor" is also set to
+ * true to indicate that this constructor was used to create this object.
+ * This constructor calls its super class with the empty string to force the
+ * "toString" method of parent class "Throwable" to print the error message
+ * in the form: ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever purpose you
+ * can think of. Constructing the exception in this manner makes the
+ * exception behave in the normal way - i.e., as documented in the class
+ * "Throwable". The fields "errorToken", "expectedTokenSequences", and
+ * "tokenImage" do not contain relevant information. The JavaCC generated
+ * code does not use these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create this object
+ * and thereby affects the semantics of the "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If this
+ * object has been created due to a parse error, the token followng this
+ * token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array of integers
+ * represents a sequence of tokens (by their ordinal values) that is
+ * expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated parser
+ * within which the parse error occurred. This array is defined in the
+ * generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been created
+ * using the standard constructors. Otherwise, it uses "currentToken" and
+ * "expectedTokenSequences" to generate a parse error message and returns
+ * it. If this object has been created due to a parse error, and you do not
+ * catch it (it gets thrown from the parser), then this method is called
+ * during the printing of the final stack trace, and hence the correct error
+ * message gets displayed.
+ */
+ @Override
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) {
+ retval += " ";
+ }
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column "
+ + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version when these raw
+ * version cannot be used as part of an ASCII string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i)) {
+ case 0:
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u"
+ + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. Parser.java */
+package com.vaadin.sass.internal.parser;
+
+import java.io.*;
+import java.net.*;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.ErrorHandler;
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.Locator;
+import org.w3c.css.sac.LexicalUnit;
+
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+
+import org.w3c.flute.util.Encoding;
+
+import com.vaadin.sass.internal.handler.*;
+
+import com.vaadin.sass.internal.tree.*;
+
+/**
+ * A CSS2 parser
+ *
+ * @author Philippe Le H�garet
+ * @version $Revision: 1.15 $
+ */
+public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
+
+ // replaces all \t, \n, etc with this StringBuffer.
+ static final StringBuilder SPACE = new StringBuilder(" ");
+
+ // the document handler for the parser
+ protected SCSSDocumentHandlerImpl documentHandler;
+ // the error handler for the parser
+ protected ErrorHandler errorHandler;
+ // the input source for the parser
+ protected InputSource source;
+
+ protected ConditionFactory conditionFactory;
+ protected SelectorFactory selectorFactory;
+
+ // temporary place holder for pseudo-element ...
+ private String pseudoElt;
+
+ /**
+ * Creates a new Parser
+ */
+ public Parser() {
+ this((CharStream) null);
+ }
+
+ /**
+ * @@TODO
+ * @exception CSSException Not yet implemented
+ */
+ public void setLocale(Locale locale) throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Set the document handler for this parser
+ */
+ public void setDocumentHandler(DocumentHandler handler) {
+ this.documentHandler = (SCSSDocumentHandlerImpl) handler;
+ }
+
+ public void setSelectorFactory(SelectorFactory selectorFactory) {
+ this.selectorFactory = selectorFactory;
+ }
+
+ public void setConditionFactory(ConditionFactory conditionFactory) {
+ this.conditionFactory = conditionFactory;
+ }
+
+ /**
+ * Set the error handler for this parser
+ */
+ public void setErrorHandler(ErrorHandler error) {
+ this.errorHandler = error;
+ }
+
+ /**
+ * Main parse methods
+ *
+ * @param source the source of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+
+ parserUnit();
+ }
+
+ /**
+ * Convenient method for URIs.
+ *
+ * @param systemId the fully resolved URI of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(String systemId)
+ throws CSSException, IOException {
+ parseStyleSheet(new InputSource(systemId));
+ }
+
+ /**
+ * This method parses only one rule (style rule or at-rule, except @charset).
+ *
+ * @param source the source of the rule.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseRule();
+ }
+
+ /**
+ * This method parses a style declaration (including the surrounding curly
+ * braces).
+ *
+ * @param source the source of the style declaration.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleDeclaration(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseDeclarationBlock();
+ }
+
+ /**
+ * This methods returns "http://www.w3.org/TR/REC-CSS2".
+ * @return the string "http://www.w3.org/TR/REC-CSS2".
+ */
+ public String getParserVersion() {
+ return "http://www.w3.org/TR/REC-CSS2";
+ }
+
+ /**
+ * Parse methods used by DOM Level 2 implementation.
+ */
+ public void parseImportRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseImportRule();
+ }
+
+ public void parseMediaRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseMediaRule();
+ }
+
+ public SelectorList parseSelectors(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return null;
+ }
+
+ public LexicalUnit parsePropertyValue(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return expr();
+ }
+
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return prio();
+ }
+
+ /**
+ * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
+ */
+ private Reader getReader(InputSource source) throws IOException {
+ if (source.getCharacterStream() != null) {
+ return source.getCharacterStream();
+ } else if (source.getByteStream() != null) {
+ // My DOM level 2 implementation doesn't use this case.
+ if (source.getEncoding() == null) {
+ // unknown encoding, use ASCII as default.
+ return new InputStreamReader(source.getByteStream(), "ASCII");
+ } else {
+ return new InputStreamReader(source.getByteStream(),
+ source.getEncoding());
+ }
+ } else {
+ // systemId
+ // @@TODO
+ throw new CSSException("not yet implemented");
+ }
+ }
+
+ /**
+ * Convert the source into a CharStream with encoding informations.
+ * The encoding can be found in the InputSource or in the CSS document.
+ * Since this method marks the reader and make a reset after looking for
+ * the charset declaration, you'll find the charset declaration into the
+ * stream.
+ */
+ private CharStream getCharStreamWithLurk(InputSource source)
+ throws CSSException, IOException {
+ if (source.getCharacterStream() != null) {
+ // all encoding are supposed to be resolved by the user
+ // return the reader
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ } else if (source.getByteStream() == null) {
+ // @@CONTINUE ME. see also getReader() with systemId
+ try {
+ source.setByteStream(new URL(source.getURI()).openStream());
+ } catch (Exception e) {
+ try {
+ source.setByteStream(new FileInputStream(source.getURI()));
+ } catch (IOException ex) {
+ throw new CSSException("invalid url ?");
+ }
+ }
+ }
+ String encoding = "ASCII";
+ InputStream input = source.getByteStream();
+ char c = ' ';
+
+ if (!input.markSupported()) {
+ input = new BufferedInputStream(input);
+ source.setByteStream(input);
+ }
+ input.mark(100);
+ c = (char) input.read();
+
+ if (c == '@') {
+ // hum, is it a charset ?
+ int size = 100;
+ byte[] buf = new byte[size];
+ input.read(buf, 0, 7);
+ String keyword = new String(buf, 0, 7);
+ if (keyword.equals("charset")) {
+ // Yes, this is the charset declaration !
+
+ // here I don't use the right declaration : white space are ' '.
+ while ((c = (char) input.read()) == ' ') {
+ // find the first quote
+ }
+ char endChar = c;
+ int i = 0;
+
+ if ((endChar != '"') && (endChar != '\u005c'')) {
+ // hum this is not a quote.
+ throw new CSSException("invalid charset declaration");
+ }
+
+ while ((c = (char) input.read()) != endChar) {
+ buf[i++] = (byte) c;
+ if (i == size) {
+ byte[] old = buf;
+ buf = new byte[size + 100];
+ System.arraycopy(old, 0, buf, 0, size);
+ size += 100;
+ }
+ }
+ while ((c = (char) input.read()) == ' ') {
+ // find the next relevant character
+ }
+ if (c != ';') {
+ // no semi colon at the end ?
+ throw new CSSException("invalid charset declaration: "
+ + "missing semi colon");
+ }
+ encoding = new String(buf, 0, i);
+ if (source.getEncoding() != null) {
+ // compare the two encoding informations.
+ // For example, I don't accept to have ASCII and after UTF-8.
+ // Is it really good ? That is the question.
+ if (!encoding.equals(source.getEncoding())) {
+ throw new CSSException("invalid encoding information.");
+ }
+ }
+ } // else no charset declaration available
+ }
+ // ok set the real encoding of this source.
+ source.setEncoding(encoding);
+ // set the real reader of this source.
+ source.setCharacterStream(new InputStreamReader(source.getByteStream(),
+ Encoding.getJavaEncoding(encoding)));
+ // reset the stream (leave the charset declaration in the stream).
+ input.reset();
+
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ }
+
+ private LocatorImpl currentLocator;
+ private Locator getLocator() {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this);
+ }
+ private LocatorImpl getLocator(Token save) {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this, save);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this, save);
+ }
+
+ private void reportError(Locator l, Exception e) {
+ if (errorHandler != null) {
+ if (e instanceof ParseException) {
+ // construct a clean error message.
+ ParseException pe = (ParseException) e;
+ if (pe.specialConstructor) {
+ StringBuffer errorM = new StringBuffer();
+ if (pe.currentToken != null) {
+ errorM.append("encountered \u005c"")
+ .append(pe.currentToken.next);
+ }
+ errorM.append('"');
+ if (pe.expectedTokenSequences.length != 0) {
+ errorM.append(". Was expecting one of: ");
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ int kind = pe.expectedTokenSequences[i][j];
+ if (kind != S) {
+ errorM.append(pe.tokenImage[kind]);
+ errorM.append(' ');
+ }
+ }
+ }
+ }
+ errorHandler.error(new CSSParseException(errorM.toString(),
+ l, e));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(),
+ l, e));
+ }
+ } else if (e == null) {
+ errorHandler.error(new CSSParseException("error", l, null));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(), l, e));
+ }
+ }
+ }
+
+ private void reportWarningSkipText(Locator l, String text) {
+ if (errorHandler != null && text != null) {
+ errorHandler.warning(new CSSParseException("Skipping: " + text, l));
+ }
+ }
+
+/*
+ * The grammar of CSS2
+ */
+
+/**
+ * The main entry for the parser.
+ *
+ * @exception ParseException exception during the parse
+ */
+ final public void parserUnit() throws ParseException {
+ try {
+ documentHandler.startDocument(source);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CHARSET_SYM:
+ charset();
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ ;
+ }
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ break label_1;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ jj_consume_token(S);
+ comments();
+ break;
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ignoreStatement();
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ label_2:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORT_SYM:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_2;
+ }
+ importDeclaration();
+ label_3:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ break label_3;
+ }
+ ignoreStatement();
+ label_4:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ break label_4;
+ }
+ jj_consume_token(S);
+ }
+ }
+ }
+ afterImportDeclaration();
+ jj_consume_token(0);
+ } finally {
+ documentHandler.endDocument(source);
+ }
+ }
+
+ final public void charset() throws ParseException {
+ Token n;
+ try {
+ jj_consume_token(CHARSET_SYM);
+ label_5:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ break label_5;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(STRING);
+ label_6:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ break label_6;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+ final public void afterImportDeclaration() throws ParseException {
+ String ret;
+ Locator l;
+ label_7:
+ while (true) {
+ ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VARIABLE:
+ if (jj_2_1(5)) {
+ listModifyDirective();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case IF_SYM:
+ ifDirective();
+ break;
+ case MIXIN_SYM:
+ mixinDirective();
+ break;
+ case EACH_SYM:
+ eachDirective();
+ break;
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ l = getLocator();
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ label_8:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ break label_8;
+ }
+ ignoreStatement();
+ label_9:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ break label_9;
+ }
+ jj_consume_token(S);
+ }
+ }
+ }
+ }
+
+ final public void ignoreStatement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ jj_consume_token(CDO);
+ break;
+ case CDC:
+ jj_consume_token(CDC);
+ break;
+ case ATKEYWORD:
+ atRuleDeclaration();
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/**
+ * The import statement
+ *
+ * @exception ParseException exception during the parse
+ */
+ final public void importDeclaration() throws ParseException {
+ Token n;
+ String uri;
+ MediaListImpl ml = new MediaListImpl();
+ boolean isURL = false;
+ try {
+ jj_consume_token(IMPORT_SYM);
+ label_10:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ break label_10;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ n = jj_consume_token(STRING);
+ uri = convertStringIndex(n.image, 1,
+ n.image.length() -1);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ isURL=true;
+ uri = n.image.substring(4, n.image.length()-1).trim();
+ if ((uri.charAt(0) == '"')
+ || (uri.charAt(0) == '\u005c'')) {
+ uri = uri.substring(1, uri.length()-1);
+ }
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_11:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ break label_11;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ mediaStatement(ml);
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ label_12:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ break label_12;
+ }
+ jj_consume_token(S);
+ }
+ if (ml.getLength() == 0) {
+ // see section 6.3 of the CSS2 recommandation.
+ ml.addItem("all");
+ }
+ documentHandler.importStyle(uri, ml, isURL);
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void media() throws ParseException {
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+ try {
+ jj_consume_token(MEDIA_SYM);
+ label_13:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ break label_13;
+ }
+ jj_consume_token(S);
+ }
+ mediaStatement(ml);
+ start = true; documentHandler.startMedia(ml);
+ jj_consume_token(LBRACE);
+ label_14:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ break label_14;
+ }
+ jj_consume_token(S);
+ }
+ label_15:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case NONASCII:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case HASH:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ ;
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ break label_15;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case NONASCII:
+ case STRING:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ skipUnknownRule();
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_16:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ break label_16;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+ }
+
+ final public void mediaStatement(MediaListImpl ml) throws ParseException {
+ String m;
+ m = medium();
+ label_17:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ break label_17;
+ }
+ jj_consume_token(COMMA);
+ label_18:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ break label_18;
+ }
+ jj_consume_token(S);
+ }
+ ml.addItem(m);
+ m = medium();
+ }
+ ml.addItem(m);
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String medium() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_19:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_19;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void page() throws ParseException {
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+ try {
+ jj_consume_token(PAGE_SYM);
+ label_20:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ break label_20;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ label_21:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[27] = jj_gen;
+ break label_21;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[28] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ pseudo = pseudo_page();
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ ;
+ }
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ jj_consume_token(LBRACE);
+ label_22:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ break label_22;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[31] = jj_gen;
+ ;
+ }
+ label_23:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[32] = jj_gen;
+ break label_23;
+ }
+ jj_consume_token(SEMICOLON);
+ label_24:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[33] = jj_gen;
+ break label_24;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[34] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_25:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[35] = jj_gen;
+ break label_25;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+ }
+
+ final public String pseudo_page() throws ParseException {
+ Token n;
+ jj_consume_token(COLON);
+ n = jj_consume_token(IDENT);
+ label_26:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[36] = jj_gen;
+ break label_26;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void fontFace() throws ParseException {
+ boolean start = false;
+ try {
+ jj_consume_token(FONT_FACE_SYM);
+ label_27:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[37] = jj_gen;
+ break label_27;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LBRACE);
+ label_28:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[38] = jj_gen;
+ break label_28;
+ }
+ jj_consume_token(S);
+ }
+ start = true; documentHandler.startFontFace();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[39] = jj_gen;
+ ;
+ }
+ label_29:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[40] = jj_gen;
+ break label_29;
+ }
+ jj_consume_token(SEMICOLON);
+ label_30:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[41] = jj_gen;
+ break label_30;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[42] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_31:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[43] = jj_gen;
+ break label_31;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void atRuleDeclaration() throws ParseException {
+ Token n;
+ String ret;
+ n = jj_consume_token(ATKEYWORD);
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+
+ final public void skipUnknownRule() throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ATKEYWORD:
+ n = jj_consume_token(ATKEYWORD);
+ break;
+ case CDO:
+ n = jj_consume_token(CDO);
+ break;
+ case CHARSET_SYM:
+ n = jj_consume_token(CHARSET_SYM);
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ break;
+ case DASHMATCH:
+ n = jj_consume_token(DASHMATCH);
+ break;
+ case FONT_FACE_SYM:
+ n = jj_consume_token(FONT_FACE_SYM);
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ break;
+ case IMPORTANT_SYM:
+ n = jj_consume_token(IMPORTANT_SYM);
+ break;
+ case IMPORT_SYM:
+ n = jj_consume_token(IMPORT_SYM);
+ break;
+ case INCLUDES:
+ n = jj_consume_token(INCLUDES);
+ break;
+ case LBRACE:
+ n = jj_consume_token(LBRACE);
+ break;
+ case MEDIA_SYM:
+ n = jj_consume_token(MEDIA_SYM);
+ break;
+ case NONASCII:
+ n = jj_consume_token(NONASCII);
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ break;
+ case PAGE_SYM:
+ n = jj_consume_token(PAGE_SYM);
+ break;
+ case PERCENTAGE:
+ n = jj_consume_token(PERCENTAGE);
+ break;
+ case STRING:
+ n = jj_consume_token(STRING);
+ break;
+ case UNICODERANGE:
+ n = jj_consume_token(UNICODERANGE);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ break;
+ case SEMICOLON:
+ n = jj_consume_token(SEMICOLON);
+ break;
+ case PLUS:
+ n = jj_consume_token(PLUS);
+ break;
+ case PRECEDES:
+ n = jj_consume_token(PRECEDES);
+ break;
+ case MINUS:
+ n = jj_consume_token(MINUS);
+ break;
+ case UNKNOWN:
+ n = jj_consume_token(UNKNOWN);
+ break;
+ default:
+ jj_la1[44] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char combinator() throws ParseException {
+char connector = ' ';
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ label_32:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[45] = jj_gen;
+ break label_32;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '+';}
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ label_33:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[46] = jj_gen;
+ break label_33;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '>';}
+ break;
+ case S:
+ jj_consume_token(S);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case PRECEDES:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ connector = '+';
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ connector = '>';
+ break;
+ default:
+ jj_la1[47] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_34:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[48] = jj_gen;
+ break label_34;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[49] = jj_gen;
+ ;
+ }
+ {if (true) return connector;}
+ break;
+ default:
+ jj_la1[50] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void microsoftExtension() throws ParseException {
+ Token n;
+ String name = "";
+ String value = "";
+ n = jj_consume_token(MICROSOFT_RULE);
+ label_35:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[51] = jj_gen;
+ break label_35;
+ }
+ jj_consume_token(S);
+ }
+ name = n.image;
+ jj_consume_token(COLON);
+ label_36:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ value += n.image;
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ value += n.image;
+ break;
+ case INTERPOLATION:
+ n = jj_consume_token(INTERPOLATION);
+ value += n.image;
+ break;
+ case COLON:
+ n = jj_consume_token(COLON);
+ value += n.image;
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ value += n.image;
+ break;
+ case RPARAN:
+ n = jj_consume_token(RPARAN);
+ value += n.image;
+ break;
+ case EQ:
+ n = jj_consume_token(EQ);
+ value += n.image;
+ break;
+ case DOT:
+ n = jj_consume_token(DOT);
+ value += n.image;
+ break;
+ case S:
+ n = jj_consume_token(S);
+ if(value.lastIndexOf(' ') != value.length()-1)
+ { value += n.image; }
+ break;
+ default:
+ jj_la1[52] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case EQ:
+ case DOT:
+ case RPARAN:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case NUMBER:
+ case FUNCTION:
+ ;
+ break;
+ default:
+ jj_la1[53] = jj_gen;
+ break label_36;
+ }
+ }
+ jj_consume_token(SEMICOLON);
+ label_37:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[54] = jj_gen;
+ break label_37;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.microsoftDirective(name, value);
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String property() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_38:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[55] = jj_gen;
+ break label_38;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String variableName() throws ParseException {
+ Token n;
+ n = jj_consume_token(VARIABLE);
+ label_39:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[56] = jj_gen;
+ break label_39;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image.substring(1));}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String functionName() throws ParseException {
+ Token n;
+ n = jj_consume_token(FUNCTION);
+ label_40:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[57] = jj_gen;
+ break label_40;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image.substring(0, n.image.length()-1));}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void styleRule() throws ParseException {
+ boolean start = false;
+ ArrayList<String> l = null;
+ Token save;
+ Locator loc;
+ try {
+ l = selectorList();
+ save = token;
+ jj_consume_token(LBRACE);
+ label_41:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[58] = jj_gen;
+ break label_41;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startSelector(l);
+ label_42:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EACH_SYM:
+ case IF_SYM:
+ case EXTEND_SYM:
+ case MICROSOFT_RULE:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[59] = jj_gen;
+ break label_42;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IF_SYM:
+ ifDirective();
+ break;
+ default:
+ jj_la1[61] = jj_gen;
+ if (jj_2_2(5)) {
+ listModifyDirective();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case EACH_SYM:
+ eachDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[62] = jj_gen;
+ if (jj_2_3(3)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MICROSOFT_RULE:
+ microsoftExtension();
+ break;
+ case IDENT:
+ declarationOrNestedProperties();
+ break;
+ default:
+ jj_la1[60] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[63] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_43:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[64] = jj_gen;
+ break label_43;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ThrowedParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.e.currentToken.next.beginLine,
+ e.e.currentToken.next.beginColumn-1);
+ reportError(li, e.e);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (TokenMgrError e) {
+ reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endSelector();
+ }
+ }
+ }
+
+ final public ArrayList<String> selectorList() throws ParseException {
+ ArrayList<String> selectors = new ArrayList<String>();
+ String selector;
+ selector = selector();
+ label_44:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[65] = jj_gen;
+ break label_44;
+ }
+ jj_consume_token(COMMA);
+ label_45:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[66] = jj_gen;
+ break label_45;
+ }
+ jj_consume_token(S);
+ }
+ selectors.add(selector);
+ selector = selector();
+ }
+ selectors.add(selector);
+ {if (true) return selectors;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String selector() throws ParseException {
+ String selector;
+ char comb;
+ try {
+ selector = simple_selector(null, ' ');
+ label_46:
+ while (true) {
+ if (jj_2_4(2)) {
+ ;
+ } else {
+ break label_46;
+ }
+ comb = combinator();
+ selector = simple_selector(selector, comb);
+ }
+ label_47:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[67] = jj_gen;
+ break label_47;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return selector;}
+ } catch (ParseException e) {
+ /*
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+ reportWarningSkipText(getLocator(), s.toString());
+ */
+ Token t = getToken(1);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ getNextToken();
+ t = getToken(1);
+ }
+
+ {if (true) throw new ThrowedParseException(e);}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String simple_selector(String selector, char comb) throws ParseException {
+ String simple_current = null;
+ String cond = null;
+
+ pseudoElt = null;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ANY:
+ case PARENT:
+ case INTERPOLATION:
+ case IDENT:
+ simple_current = element_name();
+ label_48:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[68] = jj_gen;
+ break label_48;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[69] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case HASH:
+ cond = hash(cond);
+ label_49:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ ;
+ break;
+ default:
+ jj_la1[70] = jj_gen;
+ break label_49;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[71] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case DOT:
+ cond = _class(cond);
+ label_50:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ break label_50;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[73] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ label_51:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[74] = jj_gen;
+ break label_51;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[75] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ label_52:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[76] = jj_gen;
+ break label_52;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[77] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ default:
+ jj_la1[78] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ if (simple_current == null) {
+ simple_current = "";
+ }
+ if (cond != null) {
+ simple_current = simple_current + cond;
+ }
+ if (selector != null) {
+ switch (comb) {
+ case ' ':
+ selector = selector + comb + simple_current;
+ break;
+ case '+':
+ selector = selector + " " + comb + " " + simple_current;
+ break;
+ case '>':
+ selector = selector + " " + comb + " " + simple_current;
+ break;
+ default:
+ {if (true) throw new ParseException("invalid state. send a bug report");}
+ }
+ } else {
+ selector= simple_current;
+ }
+ if (pseudoElt != null) {
+ selector = selector + pseudoElt;
+ }
+ {if (true) return selector;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String _class(String pred) throws ParseException {
+ Token t;
+String s = ".";
+ jj_consume_token(DOT);
+ label_53:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ t = jj_consume_token(IDENT);
+ s += t.image;
+ break;
+ case INTERPOLATION:
+ t = jj_consume_token(INTERPOLATION);
+ s += t.image;
+ break;
+ default:
+ jj_la1[79] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTERPOLATION:
+ case IDENT:
+ ;
+ break;
+ default:
+ jj_la1[80] = jj_gen;
+ break label_53;
+ }
+ }
+ if (pred == null) {
+ {if (true) return s;}
+ } else {
+ {if (true) return pred + s;}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String element_name() throws ParseException {
+ Token t; String s = "";
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTERPOLATION:
+ case IDENT:
+ label_54:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ t = jj_consume_token(IDENT);
+ s += t.image;
+ break;
+ case INTERPOLATION:
+ t = jj_consume_token(INTERPOLATION);
+ s += t.image;
+ break;
+ default:
+ jj_la1[81] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTERPOLATION:
+ case IDENT:
+ ;
+ break;
+ default:
+ jj_la1[82] = jj_gen;
+ break label_54;
+ }
+ }
+ {if (true) return s;}
+ break;
+ case ANY:
+ jj_consume_token(ANY);
+ {if (true) return "*";}
+ break;
+ case PARENT:
+ jj_consume_token(PARENT);
+ {if (true) return "&";}
+ break;
+ default:
+ jj_la1[83] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String attrib(String pred) throws ParseException {
+ int cases = 0;
+ Token att = null;
+ Token val = null;
+ String attValue = null;
+ jj_consume_token(LBRACKET);
+ label_55:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[84] = jj_gen;
+ break label_55;
+ }
+ jj_consume_token(S);
+ }
+ att = jj_consume_token(IDENT);
+ label_56:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[85] = jj_gen;
+ break label_56;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DASHMATCH:
+ case CARETMATCH:
+ case DOLLARMATCH:
+ case STARMATCH:
+ case INCLUDES:
+ case EQ:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EQ:
+ jj_consume_token(EQ);
+ cases = 1;
+ break;
+ case INCLUDES:
+ jj_consume_token(INCLUDES);
+ cases = 2;
+ break;
+ case DASHMATCH:
+ jj_consume_token(DASHMATCH);
+ cases = 3;
+ break;
+ case CARETMATCH:
+ jj_consume_token(CARETMATCH);
+ cases = 4;
+ break;
+ case DOLLARMATCH:
+ jj_consume_token(DOLLARMATCH);
+ cases = 5;
+ break;
+ case STARMATCH:
+ jj_consume_token(STARMATCH);
+ cases = 6;
+ break;
+ default:
+ jj_la1[86] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_57:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[87] = jj_gen;
+ break label_57;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ val = jj_consume_token(IDENT);
+ attValue = val.image;
+ break;
+ case STRING:
+ val = jj_consume_token(STRING);
+ attValue = val.image;
+ break;
+ default:
+ jj_la1[88] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_58:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[89] = jj_gen;
+ break label_58;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[90] = jj_gen;
+ ;
+ }
+ jj_consume_token(RBRACKET);
+ String name = convertIdent(att.image);
+ String c;
+ switch (cases) {
+ case 0:
+ c = name;
+ break;
+ case 1:
+ c = name + "=" + attValue;
+ break;
+ case 2:
+ c = name + "~=" + attValue;
+ break;
+ case 3:
+ c = name + "|=" +attValue;
+ break;
+ case 4:
+ c = name + "^=" +attValue;
+ break;
+ case 5:
+ c = name + "$=" +attValue;
+ break;
+ case 6:
+ c = name + "*=" +attValue;
+ break;
+ default:
+ // never reached.
+ c = null;
+ }
+ c = "[" + c + "]";
+ if (pred == null) {
+ {if (true) return c;}
+ } else {
+ {if (true) return pred + c;}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String pseudo(String pred) throws ParseException {
+ Token n;
+Token language;
+boolean isPseudoElement = false;
+ jj_consume_token(COLON);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ isPseudoElement=true;
+ break;
+ default:
+ jj_la1[91] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ String s = ":" + convertIdent(n.image);
+ if (isPseudoElement) {
+ if (pseudoElt != null) {
+ {if (true) throw new CSSParseException("duplicate pseudo element definition "
+ + s, getLocator());}
+ } else {
+ pseudoElt = ":"+s;
+ {if (true) return pred;}
+ }
+ } else {
+ String c = s;
+ if (pred == null) {
+ {if (true) return c;}
+ } else {
+ {if (true) return pred + c;}
+ }
+ }
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ label_59:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[92] = jj_gen;
+ break label_59;
+ }
+ jj_consume_token(S);
+ }
+ language = jj_consume_token(IDENT);
+ label_60:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[93] = jj_gen;
+ break label_60;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(RPARAN);
+ String f = convertIdent(n.image);
+ if (f.equals("lang(")) {
+ String d = convertIdent(language.image);
+ if (pred == null) {
+ {if (true) return d;}
+ } else {
+ {if (true) return pred + d;}
+ }
+ } else {
+ {if (true) throw new CSSParseException("invalid pseudo function name "
+ + f, getLocator());}
+ }
+ break;
+ default:
+ jj_la1[94] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String hash(String pred) throws ParseException {
+ Token n;
+ n = jj_consume_token(HASH);
+ String d = n.image;
+ if (pred == null) {
+ {if (true) return d;}
+ } else {
+ {if (true) return pred + d;}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void variable() throws ParseException {
+ String name;
+ LexicalUnitImpl exp = null;
+ boolean guarded = false;
+ String raw;
+ try {
+ name = variableName();
+ jj_consume_token(COLON);
+ label_61:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[95] = jj_gen;
+ break label_61;
+ }
+ jj_consume_token(S);
+ }
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case GUARDED_SYM:
+ guarded = guarded();
+ break;
+ default:
+ jj_la1[96] = jj_gen;
+ ;
+ }
+ label_62:
+ while (true) {
+ jj_consume_token(SEMICOLON);
+ label_63:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[97] = jj_gen;
+ break label_63;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[98] = jj_gen;
+ break label_62;
+ }
+ }
+ documentHandler.variable(name, exp, guarded);
+ } catch (JumpException e) {
+ skipAfterExpression();
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ } else {
+ skipAfterExpression();
+ }
+ }
+ }
+
+ final public void ifDirective() throws ParseException {
+ Token n = null;
+ String evaluator = "";
+ jj_consume_token(IF_SYM);
+ label_64:
+ while (true) {
+ n = booleanExpressionToken();
+ evaluator += n.image;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case EQ:
+ case PLUS:
+ case MINUS:
+ case PRECEDES:
+ case SUCCEEDS:
+ case DIV:
+ case ANY:
+ case LPARAN:
+ case RPARAN:
+ case COMPARE:
+ case OR:
+ case AND:
+ case NOT_EQ:
+ case IDENT:
+ case NUMBER:
+ case VARIABLE:
+ ;
+ break;
+ default:
+ jj_la1[99] = jj_gen;
+ break label_64;
+ }
+ }
+ jj_consume_token(LBRACE);
+ label_65:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[100] = jj_gen;
+ break label_65;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startIfElseDirective();
+ documentHandler.ifDirective(evaluator);
+ label_66:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[101] = jj_gen;
+ break label_66;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[102] = jj_gen;
+ if (jj_2_5(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[103] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_67:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[104] = jj_gen;
+ break label_67;
+ }
+ jj_consume_token(S);
+ }
+ label_68:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ELSE_SYM:
+ ;
+ break;
+ default:
+ jj_la1[105] = jj_gen;
+ break label_68;
+ }
+ elseDirective();
+ }
+ documentHandler.endIfElseDirective();
+ }
+
+ final public void elseDirective() throws ParseException {
+ String evaluator = "";
+ Token n = null;
+ jj_consume_token(ELSE_SYM);
+ label_69:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[106] = jj_gen;
+ break label_69;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IF:
+ jj_consume_token(IF);
+ label_70:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case EQ:
+ case PLUS:
+ case MINUS:
+ case PRECEDES:
+ case SUCCEEDS:
+ case DIV:
+ case ANY:
+ case LPARAN:
+ case RPARAN:
+ case COMPARE:
+ case OR:
+ case AND:
+ case NOT_EQ:
+ case IDENT:
+ case NUMBER:
+ case VARIABLE:
+ ;
+ break;
+ default:
+ jj_la1[107] = jj_gen;
+ break label_70;
+ }
+ n = booleanExpressionToken();
+ if(n != null) evaluator += n.image;
+ }
+ break;
+ default:
+ jj_la1[108] = jj_gen;
+ ;
+ }
+ jj_consume_token(LBRACE);
+ label_71:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[109] = jj_gen;
+ break label_71;
+ }
+ jj_consume_token(S);
+ }
+ if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); }
+ else{ documentHandler.elseDirective(); }
+ label_72:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[110] = jj_gen;
+ break label_72;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[111] = jj_gen;
+ if (jj_2_6(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[112] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_73:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[113] = jj_gen;
+ break label_73;
+ }
+ jj_consume_token(S);
+ }
+ }
+
+ final public Token booleanExpressionToken() throws ParseException {
+ Token n = null;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VARIABLE:
+ n = jj_consume_token(VARIABLE);
+ break;
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ break;
+ case LPARAN:
+ n = jj_consume_token(LPARAN);
+ break;
+ case RPARAN:
+ n = jj_consume_token(RPARAN);
+ break;
+ case PLUS:
+ n = jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ n = jj_consume_token(MINUS);
+ break;
+ case DIV:
+ n = jj_consume_token(DIV);
+ break;
+ case ANY:
+ n = jj_consume_token(ANY);
+ break;
+ case COMPARE:
+ n = jj_consume_token(COMPARE);
+ break;
+ case EQ:
+ n = jj_consume_token(EQ);
+ break;
+ case PRECEDES:
+ n = jj_consume_token(PRECEDES);
+ break;
+ case SUCCEEDS:
+ n = jj_consume_token(SUCCEEDS);
+ break;
+ case OR:
+ n = jj_consume_token(OR);
+ break;
+ case AND:
+ n = jj_consume_token(AND);
+ break;
+ case S:
+ n = jj_consume_token(S);
+ break;
+ case NOT_EQ:
+ n = jj_consume_token(NOT_EQ);
+ break;
+ default:
+ jj_la1[114] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return n;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void eachDirective() throws ParseException {
+ Token var;
+ ArrayList<String> list = null;
+ String listVariable = null;
+ jj_consume_token(EACH_SYM);
+ label_74:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[115] = jj_gen;
+ break label_74;
+ }
+ jj_consume_token(S);
+ }
+ var = jj_consume_token(VARIABLE);
+ label_75:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[116] = jj_gen;
+ break label_75;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(EACH_IN);
+ label_76:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[117] = jj_gen;
+ break label_76;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ list = stringList();
+ documentHandler.startEachDirective(var.image, list);
+ break;
+ case VARIABLE:
+ listVariable = variableName();
+ documentHandler.startEachDirective(var.image, listVariable);
+ break;
+ default:
+ jj_la1[118] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(LBRACE);
+ label_77:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[119] = jj_gen;
+ break label_77;
+ }
+ jj_consume_token(S);
+ }
+ label_78:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[120] = jj_gen;
+ break label_78;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ default:
+ jj_la1[121] = jj_gen;
+ if (jj_2_7(5)) {
+ listModifyDirective();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[122] = jj_gen;
+ if (jj_2_8(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[123] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_79:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[124] = jj_gen;
+ break label_79;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.endEachDirective();
+ }
+
+ final public ArrayList<String > stringList() throws ParseException {
+ ArrayList<String > strings = new ArrayList<String >();
+ Token input;
+ input = jj_consume_token(IDENT);
+ label_80:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[125] = jj_gen;
+ break label_80;
+ }
+ jj_consume_token(S);
+ }
+ strings.add(input.image);
+ label_81:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[126] = jj_gen;
+ break label_81;
+ }
+ jj_consume_token(COMMA);
+ label_82:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[127] = jj_gen;
+ break label_82;
+ }
+ jj_consume_token(S);
+ }
+ input = jj_consume_token(IDENT);
+ strings.add(input.image);
+ label_83:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[128] = jj_gen;
+ break label_83;
+ }
+ jj_consume_token(S);
+ }
+ }
+ {if (true) return strings;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void mixinDirective() throws ParseException {
+ String name;
+ ArrayList<VariableNode> args = null;
+ String body;
+ jj_consume_token(MIXIN_SYM);
+ label_84:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[129] = jj_gen;
+ break label_84;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ name = property();
+ break;
+ case FUNCTION:
+ name = functionName();
+ args = arglist();
+ jj_consume_token(RPARAN);
+ label_85:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[130] = jj_gen;
+ break label_85;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[131] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(LBRACE);
+ label_86:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[132] = jj_gen;
+ break label_86;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startMixinDirective(name, args);
+ label_87:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EACH_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[133] = jj_gen;
+ break label_87;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ default:
+ jj_la1[134] = jj_gen;
+ if (jj_2_9(5)) {
+ listModifyDirective();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EACH_SYM:
+ eachDirective();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[135] = jj_gen;
+ if (jj_2_10(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[136] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_88:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[137] = jj_gen;
+ break label_88;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.endMixinDirective(name, args);
+ }
+
+ final public ArrayList<VariableNode> arglist() throws ParseException {
+ ArrayList<VariableNode> args = new ArrayList<VariableNode>();
+ VariableNode arg;
+ boolean hasNonOptionalArgument = false;
+ arg = mixinArg();
+ label_89:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[138] = jj_gen;
+ break label_89;
+ }
+ jj_consume_token(COMMA);
+ label_90:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[139] = jj_gen;
+ break label_90;
+ }
+ jj_consume_token(S);
+ }
+ hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
+ arg = mixinArg();
+ }
+ hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
+ {if (true) return args;}
+ throw new Error("Missing return statement in function");
+ }
+
+ boolean checkMixinForNonOptionalArguments(VariableNode arg, boolean hasNonOptionalArguments) throws ParseException {
+ boolean currentArgHasArguments = arg.getExpr() != null && arg.getExpr().getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE && arg.getExpr().getNextLexicalUnit() != null;
+
+ if(currentArgHasArguments)
+ {
+ if(hasNonOptionalArguments)
+ {
+ throw new ParseException("Sass Error: Required argument $"+ arg.getName() +" must come before any optional arguments.");
+ }
+ return hasNonOptionalArguments;
+ }else
+ {
+ return true;
+ }
+ }
+
+ final public VariableNode mixinArg() throws ParseException {
+ String name;
+ Token variable = null;
+ LexicalUnitImpl first = null;
+ LexicalUnitImpl prev = null;
+ LexicalUnitImpl next = null;
+ name = variableName();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ case VARIABLE:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ label_91:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[140] = jj_gen;
+ break label_91;
+ }
+ jj_consume_token(S);
+ }
+ first = nonVariableTerm(null);
+ prev = first;
+ label_92:
+ while (true) {
+ if (jj_2_11(3)) {
+ ;
+ } else {
+ break label_92;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ label_93:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[141] = jj_gen;
+ break label_93;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[142] = jj_gen;
+ ;
+ }
+ prev = nonVariableTerm(prev);
+ }
+ break;
+ case VARIABLE:
+ variable = jj_consume_token(VARIABLE);
+ first = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
+ prev, variable.image);
+ break;
+ default:
+ jj_la1[143] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[144] = jj_gen;
+ ;
+ }
+ VariableNode arg = new VariableNode(name, first, false);
+ {if (true) return arg;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public ArrayList<LexicalUnitImpl> argValuelist() throws ParseException {
+ ArrayList<LexicalUnitImpl> args = new ArrayList<LexicalUnitImpl>();
+ LexicalUnitImpl first = null;
+ LexicalUnitImpl next = null;
+ LexicalUnitImpl prev = null;
+ first = term(null);
+ args.add(first); prev = first;
+ label_94:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case DOT:
+ case COLON:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ ;
+ break;
+ default:
+ jj_la1[145] = jj_gen;
+ break label_94;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ label_95:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[146] = jj_gen;
+ break label_95;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[147] = jj_gen;
+ ;
+ }
+ next = term(prev);
+ prev.setNextLexicalUnit(next); prev = next;
+ }
+ label_96:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[148] = jj_gen;
+ break label_96;
+ }
+ jj_consume_token(COMMA);
+ label_97:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[149] = jj_gen;
+ break label_97;
+ }
+ jj_consume_token(S);
+ }
+ first = term(null);
+ args.add(first); prev = first;
+ label_98:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case DOT:
+ case COLON:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ ;
+ break;
+ default:
+ jj_la1[150] = jj_gen;
+ break label_98;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ label_99:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[151] = jj_gen;
+ break label_99;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[152] = jj_gen;
+ ;
+ }
+ next = term(prev);
+ prev.setNextLexicalUnit(next); prev = next;
+ }
+ }
+ {if (true) return args;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void includeDirective() throws ParseException {
+ String name;
+ ArrayList<LexicalUnitImpl> args=null;
+ jj_consume_token(INCLUDE_SYM);
+ label_100:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[153] = jj_gen;
+ break label_100;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ name = property();
+ break;
+ case VARIABLE:
+ name = variableName();
+ name = "$"+name;
+ break;
+ case INTERPOLATION:
+ name = interpolation();
+ break;
+ case FUNCTION:
+ name = functionName();
+ args = argValuelist();
+ jj_consume_token(RPARAN);
+ break;
+ default:
+ jj_la1[154] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_101:
+ while (true) {
+ jj_consume_token(SEMICOLON);
+ label_102:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[155] = jj_gen;
+ break label_102;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[156] = jj_gen;
+ break label_101;
+ }
+ }
+ documentHandler.includeDirective(name, args);
+ }
+
+ final public String interpolation() throws ParseException {
+ Token n;
+ n = jj_consume_token(INTERPOLATION);
+ {if (true) return n.image;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void listModifyDirective() throws ParseException {
+ if (jj_2_12(5)) {
+ removeDirective();
+ } else if (jj_2_13(5)) {
+ appendDirective();
+ } else if (jj_2_14(5)) {
+ containsDirective();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void appendDirective() throws ParseException {
+ String list = null;
+ String remove = null;
+ String separator = null;
+ String variable = null;
+ Token n = null;
+ n = jj_consume_token(VARIABLE);
+ variable = n.image;
+ label_103:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[157] = jj_gen;
+ break label_103;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(COLON);
+ label_104:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[158] = jj_gen;
+ break label_104;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(APPEND);
+ label_105:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[159] = jj_gen;
+ break label_105;
+ }
+ jj_consume_token(S);
+ }
+ list = listModifyDirectiveArgs(0);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case RPARAN:
+ jj_consume_token(RPARAN);
+ break;
+ default:
+ jj_la1[160] = jj_gen;
+ ;
+ }
+ jj_consume_token(COMMA);
+ label_106:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[161] = jj_gen;
+ break label_106;
+ }
+ jj_consume_token(S);
+ }
+ remove = listModifyDirectiveArgs(1);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ label_107:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[162] = jj_gen;
+ break label_107;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(IDENT);
+ separator = n.image;
+ label_108:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[163] = jj_gen;
+ break label_108;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[164] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPARAN);
+ label_109:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[165] = jj_gen;
+ break label_109;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ label_110:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[166] = jj_gen;
+ break label_110;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.appendDirective(variable,list,remove,separator);
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void removeDirective() throws ParseException {
+ String list = null;
+ String remove = null;
+ String separator = null;
+ String variable = null;
+ Token n = null;
+ n = jj_consume_token(VARIABLE);
+ variable = n.image;
+ label_111:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[167] = jj_gen;
+ break label_111;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(COLON);
+ label_112:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[168] = jj_gen;
+ break label_112;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(REMOVE);
+ label_113:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[169] = jj_gen;
+ break label_113;
+ }
+ jj_consume_token(S);
+ }
+ list = listModifyDirectiveArgs(0);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case RPARAN:
+ jj_consume_token(RPARAN);
+ break;
+ default:
+ jj_la1[170] = jj_gen;
+ ;
+ }
+ jj_consume_token(COMMA);
+ label_114:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[171] = jj_gen;
+ break label_114;
+ }
+ jj_consume_token(S);
+ }
+ remove = listModifyDirectiveArgs(1);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ label_115:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[172] = jj_gen;
+ break label_115;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(IDENT);
+ separator = n.image;
+ label_116:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[173] = jj_gen;
+ break label_116;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[174] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPARAN);
+ label_117:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[175] = jj_gen;
+ break label_117;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ label_118:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[176] = jj_gen;
+ break label_118;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.removeDirective(variable,list,remove,separator);
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void containsDirective() throws ParseException {
+ String list = null;
+ String remove = null;
+ String separator = null;
+ String variable = null;
+ Token n = null;
+ n = jj_consume_token(VARIABLE);
+ variable = n.image;
+ label_119:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[177] = jj_gen;
+ break label_119;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(COLON);
+ label_120:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[178] = jj_gen;
+ break label_120;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(CONTAINS);
+ label_121:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[179] = jj_gen;
+ break label_121;
+ }
+ jj_consume_token(S);
+ }
+ list = listModifyDirectiveArgs(0);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case RPARAN:
+ jj_consume_token(RPARAN);
+ break;
+ default:
+ jj_la1[180] = jj_gen;
+ ;
+ }
+ jj_consume_token(COMMA);
+ label_122:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[181] = jj_gen;
+ break label_122;
+ }
+ jj_consume_token(S);
+ }
+ remove = listModifyDirectiveArgs(1);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ label_123:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[182] = jj_gen;
+ break label_123;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(IDENT);
+ separator = n.image;
+ label_124:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[183] = jj_gen;
+ break label_124;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[184] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPARAN);
+ label_125:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[185] = jj_gen;
+ break label_125;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ label_126:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[186] = jj_gen;
+ break label_126;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.containsDirective(variable,list,remove,separator);
+ }
+
+ String listModifyDirectiveArgs(int nest) throws ParseException {
+ String list = "";
+ int nesting = nest;
+ Token t = null;
+
+ while(true)
+ {
+ t = getToken(1);
+ String s = t.image;
+ if(t.kind == VARIABLE||t.kind == IDENT)
+ {
+ list += s;
+ }else if(s.toLowerCase().equals("auto")||s.toLowerCase().equals("space")||s.toLowerCase().equals("comma"))
+ {
+ int i = 2;
+ Token temp = getToken(i);
+ boolean isLast = true;
+ while(temp.kind != SEMICOLON)
+ {
+ if(temp.kind != RPARAN || temp.kind != S)
+ {
+ isLast = false;
+ }
+ i++;
+ temp = getToken(i);
+ }
+
+ if(isLast)
+ {
+ return list;
+ }
+ }
+ else if(t.kind == STRING)
+ {
+ list += s.substring(1,s.length()).substring(0,s.length()-2);
+
+ }else if(t.kind == LPARAN)
+ {
+ nesting++;
+ if(nesting > nest+1)
+ {
+ throw new CSSParseException("Only one ( ) pair per parameter allowed", getLocator());
+ }
+ }else if(t.kind == RPARAN)
+ {
+ nesting--;
+ if(nesting == 0)
+ {
+ return list;
+ }
+ } else if(t.kind == COMMA)
+ {
+ if(nesting == nest)
+ {
+ return list;
+ }else
+ {
+ list += ",";
+ }
+
+ }else if(t.kind == S)
+ {
+ list += " ";
+ } else if(t.kind == LBRACE)
+ {
+ throw new CSSParseException("Invalid token,'{' found", getLocator());
+ }
+
+ getNextToken();
+ }
+ }
+
+ final public Node returnDirective() throws ParseException {
+ String raw;
+ raw = skipStatement();
+ {if (true) return null;}
+ throw new Error("Missing return statement in function");
+ }
+
+ void debugDirective() throws ParseException {
+ }
+
+ void warnDirective() throws ParseException {
+ }
+
+ final public Node forDirective() throws ParseException {
+ String var;
+ String from;
+ String to;
+ boolean exclusive;
+ String body;
+ Token tok;
+ var = variableName();
+ int[] toThrough = {TO, THROUGH};
+ from = skipStatementUntil(toThrough);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TO:
+ tok = jj_consume_token(TO);
+ exclusive = true;
+ break;
+ case THROUGH:
+ tok = jj_consume_token(THROUGH);
+ exclusive = false;
+ break;
+ default:
+ jj_la1[187] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ to = skipStatementUntilLeftBrace();
+ label_127:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[188] = jj_gen;
+ break label_127;
+ }
+ jj_consume_token(S);
+ }
+ body = skipStatement();
+ {if (true) return documentHandler.forDirective(var, from, to, exclusive, body);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Node whileDirective() throws ParseException {
+ String condition;
+ String body;
+ condition = skipStatementUntilLeftBrace();
+ body = skipStatement();
+ {if (true) return documentHandler.whileDirective(condition, body);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void extendDirective() throws ParseException {
+ ArrayList<String> list;
+ jj_consume_token(EXTEND_SYM);
+ label_128:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[189] = jj_gen;
+ break label_128;
+ }
+ jj_consume_token(S);
+ }
+ list = selectorList();
+ label_129:
+ while (true) {
+ jj_consume_token(SEMICOLON);
+ label_130:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[190] = jj_gen;
+ break label_130;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[191] = jj_gen;
+ break label_129;
+ }
+ }
+ documentHandler.extendDirective(list);
+ }
+
+ Node importDirective() throws ParseException {
+ return null;
+ }
+
+ Node charsetDirective() throws ParseException {
+ return null;
+ }
+
+ Node mozDocumentDirective() throws ParseException {
+ return null;
+ }
+
+ Node supportsDirective() throws ParseException {
+ return null;
+ }
+
+ final public void nestedProperties() throws ParseException {
+ String name;
+LexicalUnit exp;
+ name = property();
+ jj_consume_token(COLON);
+ label_131:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[192] = jj_gen;
+ break label_131;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LBRACE);
+ label_132:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[193] = jj_gen;
+ break label_132;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startNestedProperties(name);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[194] = jj_gen;
+ ;
+ }
+ label_133:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[195] = jj_gen;
+ break label_133;
+ }
+ jj_consume_token(SEMICOLON);
+ label_134:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[196] = jj_gen;
+ break label_134;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[197] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ documentHandler.endNestedProperties(name);
+ label_135:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[198] = jj_gen;
+ break label_135;
+ }
+ jj_consume_token(S);
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void declarationOrNestedProperties() throws ParseException {
+ boolean important = false;
+ String name;
+ LexicalUnitImpl exp;
+ Token save;
+ String comment = null;
+ try {
+ name = property();
+ save = token;
+ jj_consume_token(COLON);
+ label_136:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[199] = jj_gen;
+ break label_136;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case DOT:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ important = prio();
+ break;
+ default:
+ jj_la1[200] = jj_gen;
+ ;
+ }
+ Token next = getToken(1);
+ if(next.kind == SEMICOLON || next.kind == RBRACE){
+ while(next.kind == SEMICOLON){
+ skipStatement();
+ next = getToken(1);
+ }
+ if(token.specialToken!=null){
+ documentHandler.property(name, exp, important, token.specialToken.image);
+ }else{
+ documentHandler.property(name, exp, important, null);
+ }
+ }
+ break;
+ case LBRACE:
+ jj_consume_token(LBRACE);
+ label_137:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[201] = jj_gen;
+ break label_137;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startNestedProperties(name);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[202] = jj_gen;
+ ;
+ }
+ label_138:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[203] = jj_gen;
+ break label_138;
+ }
+ jj_consume_token(SEMICOLON);
+ label_139:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[204] = jj_gen;
+ break label_139;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[205] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_140:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[206] = jj_gen;
+ break label_140;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.endNestedProperties(name);
+ break;
+ default:
+ jj_la1[207] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void declaration() throws ParseException {
+ boolean important = false;
+ String name;
+ LexicalUnit exp;
+ Token save;
+ try {
+ name = property();
+ save = token;
+ jj_consume_token(COLON);
+ label_141:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[208] = jj_gen;
+ break label_141;
+ }
+ jj_consume_token(S);
+ }
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ important = prio();
+ break;
+ default:
+ jj_la1[209] = jj_gen;
+ ;
+ }
+ documentHandler.property(name, exp, important);
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public boolean prio() throws ParseException {
+ jj_consume_token(IMPORTANT_SYM);
+ label_142:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[210] = jj_gen;
+ break label_142;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return true;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public boolean guarded() throws ParseException {
+ jj_consume_token(GUARDED_SYM);
+ label_143:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[211] = jj_gen;
+ break label_143;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return true;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl operator(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DIV:
+ n = jj_consume_token(DIV);
+ label_144:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[212] = jj_gen;
+ break label_144;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ label_145:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[213] = jj_gen;
+ break label_145;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ default:
+ jj_la1[214] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl expr() throws ParseException {
+ LexicalUnitImpl first, res;
+ char op;
+ first = term(null);
+ res = first;
+ label_146:
+ while (true) {
+ if (jj_2_15(2)) {
+ ;
+ } else {
+ break label_146;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ case DIV:
+ res = operator(res);
+ break;
+ default:
+ jj_la1[215] = jj_gen;
+ ;
+ }
+ res = term(res);
+ }
+ {if (true) return first;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char unaryOperator() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MINUS:
+ jj_consume_token(MINUS);
+ {if (true) return '-';}
+ break;
+ case PLUS:
+ jj_consume_token(PLUS);
+ {if (true) return '+';}
+ break;
+ default:
+ jj_la1[216] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl term(LexicalUnitImpl prev) throws ParseException {
+ LexicalUnitImpl result = null;
+ Token n = null;
+ char op = ' ';
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case DOT:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ result = nonVariableTerm(prev);
+ break;
+ case VARIABLE:
+ result = variableTerm(prev);
+ break;
+ default:
+ jj_la1[217] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public LexicalUnitImpl variableTerm(LexicalUnitImpl prev) throws ParseException {
+ LexicalUnitImpl result = null;
+ String varName = "";
+ varName = variableName();
+ result = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
+ prev, varName); {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev) throws ParseException {
+LexicalUnitImpl result = null;
+ Token n = null;
+ char op = ' ';
+ String varName;
+ String s = "";
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case NUMBER:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case FUNCTION:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ op = unaryOperator();
+ break;
+ default:
+ jj_la1[218] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
+ prev, number(op, n, 0));
+ break;
+ case PERCENTAGE:
+ n = jj_consume_token(PERCENTAGE);
+ result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1));
+ break;
+ case PT:
+ n = jj_consume_token(PT);
+ result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case CM:
+ n = jj_consume_token(CM);
+ result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case MM:
+ n = jj_consume_token(MM);
+ result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case PC:
+ n = jj_consume_token(PC);
+ result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case IN:
+ n = jj_consume_token(IN);
+ result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case PX:
+ n = jj_consume_token(PX);
+ result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case EMS:
+ n = jj_consume_token(EMS);
+ result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case EXS:
+ n = jj_consume_token(EXS);
+ result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case DEG:
+ n = jj_consume_token(DEG);
+ result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case RAD:
+ n = jj_consume_token(RAD);
+ result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case GRAD:
+ n = jj_consume_token(GRAD);
+ result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case SECOND:
+ n = jj_consume_token(SECOND);
+ result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1));
+ break;
+ case MS:
+ n = jj_consume_token(MS);
+ result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case HZ:
+ n = jj_consume_token(HZ);
+ result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case KHZ:
+ n = jj_consume_token(KHZ);
+ result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case DIMEN:
+ n = jj_consume_token(DIMEN);
+ s = n.image;
+ int i = 0;
+ while (i < s.length()
+ && (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));
+ break;
+ case FUNCTION:
+ result = function(op, prev);
+ break;
+ default:
+ jj_la1[219] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ case DOT:
+ case STRING:
+ case IDENT:
+ case URL:
+ case HASH:
+ case UNICODERANGE:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ n = jj_consume_token(STRING);
+ result =
+ LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
+ convertStringIndex(n.image, 1,
+ n.image.length() -1));
+ break;
+ case DOT:
+ case IDENT:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOT:
+ jj_consume_token(DOT);
+ s+=".";
+ break;
+ default:
+ jj_la1[220] = jj_gen;
+ ;
+ }
+ n = jj_consume_token(IDENT);
+ s += convertIdent(n.image);
+ if ("inherit".equals(s)) {
+ result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
+ prev);
+ } else {
+ result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, convertIdent(n.image));
+ }
+
+ /* /
+ Auto correction code used in the CSS Validator but must not
+ be used by a conformant CSS2 parser.
+ * Common error :
+ * H1 {
+ * color : black
+ * background : white
+ * }
+ *
+ Token t = getToken(1);
+ Token semicolon = new Token();
+ semicolon.kind = SEMICOLON;
+ semicolon.image = ";";
+ if (t.kind == COLON) {
+ // @@SEEME. (generate a warning?)
+ // @@SEEME if expression is a single ident,
+ generate an error ?
+ rejectToken(semicolon);
+
+ result = prev;
+ }
+ / */
+
+ break;
+ case HASH:
+ result = hexcolor(prev);
+ break;
+ case URL:
+ result = url(prev);
+ break;
+ case UNICODERANGE:
+ result = unicode(prev);
+ break;
+ default:
+ jj_la1[221] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[222] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_147:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[223] = jj_gen;
+ break label_147;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * Handle all CSS2 functions.
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl function(char operator, LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ LexicalUnit params = null;
+ n = jj_consume_token(FUNCTION);
+ label_148:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[224] = jj_gen;
+ break label_148;
+ }
+ jj_consume_token(S);
+ }
+ String fname = convertIdent(n.image);
+ if("alpha(".equals(fname)){
+ String body = skipStatementUntilSemiColon();
+ {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ null, "alpha("+body);}
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case DOT:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ params = expr();
+ break;
+ default:
+ jj_la1[225] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPARAN);
+ if (operator != ' ') {
+ {if (true) throw new CSSParseException("invalid operator before a function.",
+ getLocator());}
+ }
+ String f = convertIdent(n.image);
+ LexicalUnitImpl l = (LexicalUnitImpl) params;
+ boolean loop = true;
+ if ("rgb(".equals(f)) {
+ // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
+ && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ if (loop) {
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ }
+ if ((i == 5) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine,
+ n.beginColumn,
+ prev, params);}
+ } else {
+ if (errorHandler != null) {
+ String errorText;
+ Locator loc;
+ if (i < 5) {
+ if (params == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters.";
+ } else if (l == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters: "
+ + params.toString();
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "invalid parameter: "
+ + l.toString();
+ }
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "too many parameters: "
+ + l.toString();
+ }
+ errorHandler.error(new CSSParseException(errorText, loc));
+ }
+
+ {if (true) throw new JumpException();}
+ }
+ } else if ("counter".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 3) {
+ switch (i) {
+ case 0:
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 1:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 1) || (i == 3)) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
+ prev, params);}
+ }
+
+ } else if ("counters(".equals(f)) {
+
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 4:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 3) || (i == 5)) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
+ prev, params);}
+ }
+ } else if ("attr(".equals(f)) {
+ if ((l != null)
+ && (l.getNextLexicalUnit() == null)
+ && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
+ {if (true) return LexicalUnitImpl.createAttr(l.getLineNumber(),
+ l.getColumnNumber(),
+ prev, l.getStringValue());}
+ }
+ } else if ("rect(".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 7) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ switch (l.getLexicalUnitType()) {
+ case LexicalUnit.SAC_INTEGER:
+ if (l.getIntegerValue() != 0) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_IDENT:
+ if (!l.getStringValue().equals("auto")) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_EM:
+ case LexicalUnit.SAC_EX:
+ case LexicalUnit.SAC_PIXEL:
+ case LexicalUnit.SAC_CENTIMETER:
+ case LexicalUnit.SAC_MILLIMETER:
+ case LexicalUnit.SAC_INCH:
+ case LexicalUnit.SAC_POINT:
+ case LexicalUnit.SAC_PICA:
+ // nothing
+ break;
+ default:
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ case 5:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if ((i == 7) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
+ prev, params);}
+ }
+ }
+ {if (true) return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
+ f.substring(0,
+ f.length() -1),
+ params);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public LexicalUnitImpl unicode(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(UNICODERANGE);
+ LexicalUnitImpl params = null;
+ String s = n.image.substring(2);
+ int index = s.indexOf('-');
+ if (index == -1) {
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s, 16));
+ } else {
+ String s1 = s.substring(0, index);
+ String s2 = s.substring(index);
+
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s1, 16));
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s2, 16));
+ }
+
+ {if (true) return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
+ prev, params);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public LexicalUnitImpl url(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(URL);
+ String urlname = n.image.substring(4, n.image.length()-1).trim();
+ {if (true) return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(HASH);
+ int r;
+ LexicalUnitImpl first, params = null;
+ String s = n.image.substring(1);
+
+ if(s.length()!=3 && s.length()!=6) {
+ first = null;
+ {if (true) throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
+ getLocator());}
+ }
+ {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ float number(char operator, Token n, int lengthUnit) throws ParseException {
+ String image = n.image;
+ float f = 0;
+
+ if (lengthUnit != 0) {
+ image = image.substring(0, image.length() - lengthUnit);
+ }
+ f = Float.valueOf(image).floatValue();
+ return (operator == '-')? -f: f;
+ }
+
+ String skipStatementUntilSemiColon() throws ParseException {
+ int[] semicolon = {SEMICOLON};
+ return skipStatementUntil(semicolon);
+ }
+
+ String skipStatementUntilLeftBrace() throws ParseException {
+ int[] lBrace = {LBRACE};
+ return skipStatementUntil(lBrace);
+ }
+
+ String skipStatementUntilRightParan() throws ParseException {
+ int[] rParan = {RPARAN};
+ return skipStatementUntil(rParan);
+ }
+
+ String skipStatementUntil(int[] symbols) throws ParseException {
+ StringBuffer s = new StringBuffer();
+ boolean stop = false;
+ Token tok;
+ while(!stop){
+ tok = getToken(1);
+ if(tok.kind == EOF) {
+ return null;
+ }
+ for(int sym : symbols){
+ if(tok.kind == sym){
+ stop = true;
+ break;
+ }
+ }
+ if(!stop){
+ if (tok.image != null) {
+ s.append(tok.image);
+ }
+ getNextToken();
+ }
+ }
+ return s.toString().trim();
+ }
+
+ String skipStatement() throws ParseException {
+ StringBuffer s = new StringBuffer();
+ Token tok = getToken(0);
+ if (tok.image != null) {
+ s.append(tok.image);
+ }
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ return null;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ getNextToken();
+ s.append(skip_to_matching_brace());
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == RBRACE) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == SEMICOLON) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ }
+ getNextToken();
+ }
+
+ // skip white space
+ while (true) {
+ if (tok.kind != S) {
+ break;
+ }
+ tok = getNextToken();
+ tok = getToken(1);
+ }
+
+ return s.toString().trim();
+ }
+
+ String skip_to_matching_brace() throws ParseException {
+ StringBuffer s = new StringBuffer();
+ Token tok;
+ int nesting = 1;
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ break;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ nesting++;
+ } else if (tok.kind == RBRACE) {
+ nesting--;
+ if (nesting == 0) {
+ break;
+ }
+ }
+ getNextToken();
+ }
+ return s.toString();
+ }
+
+ String convertStringIndex(String s, int start, int len) throws ParseException {
+ StringBuffer buf = new StringBuffer(len);
+ int index = start;
+
+ while (index < len) {
+ char c = s.charAt(index);
+ if (c == '\u005c\u005c') {
+ if (++index < len) {
+ c = s.charAt(index);
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ int numValue = Character.digit(c, 16);
+ int count = 0;
+ int p = 16;
+
+ while (index + 1 < len && count < 6) {
+ c = s.charAt(index+1);
+
+ if (Character.digit(c, 16) != -1) {
+ numValue = (numValue * 16) + Character.digit(c, 16);
+ p *= 16;
+ index++;
+ } else {
+ if (c == ' ') {
+ // skip the latest white space
+ index++;
+ }
+ break;
+ }
+ }
+ buf.append((char) numValue);
+ break;
+ case '\u005cn':
+ case '\u005cf':
+ break;
+ case '\u005cr':
+ if (index + 1 < len) {
+ if (s.charAt(index + 1) == '\u005cn') {
+ index ++;
+ }
+ }
+ break;
+ default:
+ buf.append(c);
+ }
+ } else {
+ throw new CSSParseException("invalid string " + s, getLocator());
+ }
+ } else {
+ buf.append(c);
+ }
+ index++;
+ }
+
+ return buf.toString();
+ }
+
+ String convertIdent(String s) throws ParseException {
+ return convertStringIndex(s, 0, s.length());
+ }
+
+ String convertString(String s) throws ParseException {
+ return convertStringIndex(s, 0, s.length());
+ }
+
+ void comments() throws ParseException {
+ 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;
+ }
+ }
+ }
+
+ void rejectToken(Token t) throws ParseException {
+ Token fakeToken = new Token();
+ t.next = token;
+ fakeToken.next = t;
+ token = fakeToken;
+ }
+
+ String skipAfterExpression() throws ParseException {
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+
+ while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+
+ return s.toString();
+ }
+
+/**
+ * The following functions are useful for a DOM CSS implementation only and are
+ * not part of the general CSS2 parser.
+ */
+ final public void _parseRule() throws ParseException {
+ String ret = null;
+ label_149:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[226] = jj_gen;
+ break label_149;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORT_SYM:
+ importDeclaration();
+ break;
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[227] = jj_gen;
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
+ }
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ } else {
+ {if (true) throw new CSSParseException("unrecognize rule: " + ret,
+ getLocator());}
+ }
+ }
+ }
+
+ final public void _parseImportRule() throws ParseException {
+ label_150:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[228] = jj_gen;
+ break label_150;
+ }
+ jj_consume_token(S);
+ }
+ importDeclaration();
+ }
+
+ final public void _parseMediaRule() throws ParseException {
+ label_151:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[229] = jj_gen;
+ break label_151;
+ }
+ jj_consume_token(S);
+ }
+ media();
+ }
+
+ final public void _parseDeclarationBlock() throws ParseException {
+ label_152:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[230] = jj_gen;
+ break label_152;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[231] = jj_gen;
+ ;
+ }
+ label_153:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[232] = jj_gen;
+ break label_153;
+ }
+ jj_consume_token(SEMICOLON);
+ label_154:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[233] = jj_gen;
+ break label_154;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[234] = jj_gen;
+ ;
+ }
+ }
+ }
+
+ final public ArrayList<String> _parseSelectors() throws ParseException {
+ ArrayList<String> p = null;
+ try {
+ label_155:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[235] = jj_gen;
+ break label_155;
+ }
+ jj_consume_token(S);
+ }
+ p = selectorList();
+ {if (true) return p;}
+ } catch (ThrowedParseException e) {
+ {if (true) throw (ParseException) e.e.fillInStackTrace();}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_1(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(0, xla); }
+ }
+
+ private boolean jj_2_2(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_2(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(1, xla); }
+ }
+
+ private boolean jj_2_3(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_3(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(2, xla); }
+ }
+
+ private boolean jj_2_4(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_4(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(3, xla); }
+ }
+
+ private boolean jj_2_5(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_5(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(4, xla); }
+ }
+
+ private boolean jj_2_6(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_6(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(5, xla); }
+ }
+
+ private boolean jj_2_7(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_7(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(6, xla); }
+ }
+
+ private boolean jj_2_8(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_8(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(7, xla); }
+ }
+
+ private boolean jj_2_9(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_9(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(8, xla); }
+ }
+
+ private boolean jj_2_10(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_10(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(9, xla); }
+ }
+
+ private boolean jj_2_11(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_11(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(10, xla); }
+ }
+
+ private boolean jj_2_12(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_12(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(11, xla); }
+ }
+
+ private boolean jj_2_13(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_13(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(12, xla); }
+ }
+
+ private boolean jj_2_14(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_14(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(13, xla); }
+ }
+
+ private boolean jj_2_15(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_15(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(14, xla); }
+ }
+
+ private boolean jj_3R_202() {
+ if (jj_scan_token(PX)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_201() {
+ if (jj_scan_token(IN)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_200() {
+ if (jj_scan_token(PC)) return true;
+ return false;
+ }
+
+ private boolean jj_3_1() {
+ if (jj_3R_156()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_199() {
+ if (jj_scan_token(MM)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_198() {
+ if (jj_scan_token(CM)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_180() {
+ if (jj_scan_token(LBRACE)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_197() {
+ if (jj_scan_token(PT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_196() {
+ if (jj_scan_token(PERCENTAGE)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_185() {
+ if (jj_3R_221()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_195() {
+ if (jj_scan_token(NUMBER)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_194() {
+ if (jj_3R_236()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_181() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_194()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_195()) {
+ jj_scanpos = xsp;
+ if (jj_3R_196()) {
+ jj_scanpos = xsp;
+ if (jj_3R_197()) {
+ jj_scanpos = xsp;
+ if (jj_3R_198()) {
+ jj_scanpos = xsp;
+ if (jj_3R_199()) {
+ jj_scanpos = xsp;
+ if (jj_3R_200()) {
+ jj_scanpos = xsp;
+ if (jj_3R_201()) {
+ jj_scanpos = xsp;
+ if (jj_3R_202()) {
+ jj_scanpos = xsp;
+ if (jj_3R_203()) {
+ jj_scanpos = xsp;
+ if (jj_3R_204()) {
+ jj_scanpos = xsp;
+ if (jj_3R_205()) {
+ jj_scanpos = xsp;
+ if (jj_3R_206()) {
+ jj_scanpos = xsp;
+ if (jj_3R_207()) {
+ jj_scanpos = xsp;
+ if (jj_3R_208()) {
+ jj_scanpos = xsp;
+ if (jj_3R_209()) {
+ jj_scanpos = xsp;
+ if (jj_3R_210()) {
+ jj_scanpos = xsp;
+ if (jj_3R_211()) {
+ jj_scanpos = xsp;
+ if (jj_3R_212()) {
+ jj_scanpos = xsp;
+ if (jj_3R_213()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_4() {
+ if (jj_3R_159()) return true;
+ if (jj_3R_160()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_179() {
+ if (jj_3R_193()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_163() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_181()) {
+ jj_scanpos = xsp;
+ if (jj_3R_182()) return true;
+ }
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3_7() {
+ if (jj_3R_156()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_191() {
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ private boolean jj_3_6() {
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_161() {
+ if (jj_3R_178()) return true;
+ if (jj_scan_token(COLON)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ xsp = jj_scanpos;
+ if (jj_3R_179()) {
+ jj_scanpos = xsp;
+ if (jj_3R_180()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_239() {
+ if (jj_scan_token(HASH)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_221() {
+ if (jj_3R_242()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_166() {
+ if (jj_scan_token(VARIABLE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(COLON)) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(CONTAINS)) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
+ return false;
+ }
+
+ private boolean jj_3_14() {
+ if (jj_3R_166()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_240() {
+ if (jj_scan_token(URL)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_184() {
+ if (jj_3R_163()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_168() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_184()) {
+ jj_scanpos = xsp;
+ if (jj_3R_185()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_5() {
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_167() {
+ if (jj_3R_183()) return true;
+ return false;
+ }
+
+ private boolean jj_3_2() {
+ if (jj_3R_156()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_164() {
+ if (jj_scan_token(VARIABLE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(COLON)) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(REMOVE)) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
+ return false;
+ }
+
+ private boolean jj_3R_245() {
+ if (jj_scan_token(PLUS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_244() {
+ if (jj_scan_token(MINUS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_236() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_244()) {
+ jj_scanpos = xsp;
+ if (jj_3R_245()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_15() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_167()) jj_scanpos = xsp;
+ if (jj_3R_168()) return true;
+ return false;
+ }
+
+ private boolean jj_3_13() {
+ if (jj_3R_165()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_193() {
+ if (jj_3R_168()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_15()) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_241() {
+ if (jj_scan_token(UNICODERANGE)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_246() {
+ if (jj_3R_193()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_165() {
+ if (jj_scan_token(VARIABLE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(COLON)) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(APPEND)) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
+ return false;
+ }
+
+ private boolean jj_3R_248() {
+ if (jj_scan_token(INTERPOLATION)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_220() {
+ 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_237() {
+ 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_246()) jj_scanpos = xsp;
+ if (jj_scan_token(RPARAN)) return true;
+ return false;
+ }
+
+ private boolean jj_3_10() {
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_219() {
+ 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_183() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_219()) {
+ jj_scanpos = xsp;
+ if (jj_3R_220()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_192() {
+ if (jj_scan_token(LBRACKET)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_158() {
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_178() {
+ if (jj_scan_token(IDENT)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_218() {
+ if (jj_3R_241()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_242() {
+ if (jj_scan_token(VARIABLE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_217() {
+ if (jj_3R_240()) return true;
+ return false;
+ }
+
+ private boolean jj_3_12() {
+ if (jj_3R_164()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_156() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_12()) {
+ jj_scanpos = xsp;
+ if (jj_3_13()) {
+ jj_scanpos = xsp;
+ if (jj_3_14()) return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_216() {
+ if (jj_3R_239()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_235() {
+ if (jj_scan_token(PARENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_234() {
+ if (jj_scan_token(ANY)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_247() {
+ if (jj_scan_token(IDENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_243() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_247()) {
+ jj_scanpos = xsp;
+ if (jj_3R_248()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_233() {
+ Token xsp;
+ if (jj_3R_243()) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_243()) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_188() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_233()) {
+ jj_scanpos = xsp;
+ if (jj_3R_234()) {
+ jj_scanpos = xsp;
+ if (jj_3R_235()) return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_230() {
+ if (jj_scan_token(S)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_229() {
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_157() {
+ if (jj_3R_169()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_228() {
+ if (jj_scan_token(EQ)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_227() {
+ if (jj_scan_token(RPARAN)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_226() {
+ if (jj_scan_token(FUNCTION)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_225() {
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_224() {
+ if (jj_scan_token(INTERPOLATION)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_223() {
+ if (jj_scan_token(NUMBER)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_222() {
+ if (jj_scan_token(IDENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_186() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_222()) {
+ jj_scanpos = xsp;
+ if (jj_3R_223()) {
+ jj_scanpos = xsp;
+ if (jj_3R_224()) {
+ jj_scanpos = xsp;
+ if (jj_3R_225()) {
+ jj_scanpos = xsp;
+ if (jj_3R_226()) {
+ jj_scanpos = xsp;
+ if (jj_3R_227()) {
+ jj_scanpos = xsp;
+ if (jj_3R_228()) {
+ jj_scanpos = xsp;
+ if (jj_3R_229()) {
+ jj_scanpos = xsp;
+ if (jj_3R_230()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_3() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_157()) {
+ jj_scanpos = xsp;
+ if (jj_3R_158()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_190() {
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_169() {
+ if (jj_scan_token(MICROSOFT_RULE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(COLON)) return true;
+ if (jj_3R_186()) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_186()) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_162() {
+ 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_238() {
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_232() {
+ if (jj_scan_token(PRECEDES)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_215() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_238()) jj_scanpos = xsp;
+ if (jj_scan_token(IDENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_231() {
+ if (jj_scan_token(PLUS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_187() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_231()) {
+ jj_scanpos = xsp;
+ if (jj_3R_232()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_8() {
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_214() {
+ if (jj_scan_token(STRING)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_171() {
+ if (jj_scan_token(PRECEDES)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_213() {
+ if (jj_3R_237()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_182() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_214()) {
+ jj_scanpos = xsp;
+ if (jj_3R_215()) {
+ jj_scanpos = xsp;
+ if (jj_3R_216()) {
+ jj_scanpos = xsp;
+ if (jj_3R_217()) {
+ jj_scanpos = xsp;
+ if (jj_3R_218()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_172() {
+ if (jj_scan_token(S)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_187()) jj_scanpos = xsp;
+ return false;
+ }
+
+ private boolean jj_3R_170() {
+ if (jj_scan_token(PLUS)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_159() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_170()) {
+ jj_scanpos = xsp;
+ if (jj_3R_171()) {
+ jj_scanpos = xsp;
+ if (jj_3R_172()) return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_11() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_162()) jj_scanpos = xsp;
+ if (jj_3R_163()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_212() {
+ if (jj_scan_token(DIMEN)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_211() {
+ if (jj_scan_token(KHZ)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_210() {
+ if (jj_scan_token(HZ)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_209() {
+ if (jj_scan_token(MS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_177() {
+ if (jj_3R_192()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_208() {
+ if (jj_scan_token(SECOND)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_176() {
+ if (jj_3R_191()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_175() {
+ if (jj_3R_190()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_207() {
+ if (jj_scan_token(GRAD)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_174() {
+ if (jj_3R_189()) return true;
+ return false;
+ }
+
+ private boolean jj_3_9() {
+ if (jj_3R_156()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_206() {
+ if (jj_scan_token(RAD)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_205() {
+ if (jj_scan_token(DEG)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_173() {
+ if (jj_3R_188()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_160() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_173()) {
+ jj_scanpos = xsp;
+ if (jj_3R_174()) {
+ jj_scanpos = xsp;
+ if (jj_3R_175()) {
+ jj_scanpos = xsp;
+ if (jj_3R_176()) {
+ jj_scanpos = xsp;
+ if (jj_3R_177()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_189() {
+ if (jj_scan_token(HASH)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_204() {
+ if (jj_scan_token(EXS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_203() {
+ if (jj_scan_token(EMS)) return true;
+ return false;
+ }
+
+ /** Generated Token Manager. */
+ public ParserTokenManager token_source;
+ /** Current token. */
+ public Token token;
+ /** Next token. */
+ public Token jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[236];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static private int[] jj_la1_2;
+ static private int[] jj_la1_3;
+ static {
+ jj_la1_init_0();
+ jj_la1_init_1();
+ jj_la1_init_2();
+ jj_la1_init_3();
+ }
+ private static void jj_la1_init_0() {
+ jj_la1_0 = new int[] {0x0,0xc02,0xc02,0x0,0xc00,0x2,0x2,0x2,0x0,0xe8000000,0xc00,0x2,0xc00,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0xe9f45400,0xe9f45400,0x2,0x400000,0x2,0x2,0x2,0x2,0x0,0x0,0x2,0x0,0x800000,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x800000,0x2,0x0,0x2,0x1f45400,0x2,0x2,0x1100000,0x2,0x1100000,0x1100002,0x2,0x80080002,0x80080002,0x2,0x2,0x2,0x2,0x2,0xe8000000,0x0,0x0,0x0,0xe8000000,0x2,0x400000,0x2,0x2,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0xe8000000,0x0,0x0,0x0,0x0,0x60000000,0x2,0x2,0xfc000,0x2,0x0,0x2,0xfc000,0x0,0x2,0x2,0x0,0x2,0x0,0x2,0x800000,0x27380002,0x2,0xe8000000,0x0,0xe8000000,0x2,0x0,0x2,0x27380002,0x0,0x2,0xe8000000,0x0,0xe8000000,0x2,0x27380002,0x2,0x2,0x2,0x0,0x2,0xe8000000,0x0,0x0,0xe8000000,0x2,0x2,0x400000,0x2,0x2,0x2,0x2,0x0,0x2,0xe8000000,0x0,0x0,0xe8000000,0x2,0x400000,0x2,0x2,0x2,0x400000,0x0,0x0,0x80300000,0x2,0x0,0x400000,0x2,0x80300000,0x2,0x0,0x2,0x0,0x2,0x800000,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x400000,0x2,0x2,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x400000,0x2,0x2,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x400000,0x2,0x2,0x0,0x2,0x2,0x2,0x800000,0x2,0x2,0x0,0x800000,0x2,0x0,0x2,0x2,0x0,0x2,0x0,0x800000,0x2,0x0,0x2,0x80301000,0x2,0x0,0x2,0x2,0x2,0x2,0x4400000,0x4400000,0x300000,0x80300000,0x300000,0x0,0x80000000,0x80000000,0x80300000,0x2,0x2,0x80300000,0x2,0xe8000000,0x2,0x2,0x2,0x0,0x800000,0x2,0x0,0x2,};
+ }
+ private static void jj_la1_init_1() {
+ jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x283000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c0,0x1c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc2,0xc2,0x0,0x0,0x0,0x0,0x0,0xa82000c0,0x0,0x20000000,0x88200000,0xc0,0x0,0x0,0x0,0x0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0x0,0x802000c0,0x80200000,0xc0,0x0,0x40000000,0x0,0x3f,0x0,0x0,0x802000c0,0x80200000,0xc0,0x0,0x3f,0x0,0x0,0x0,0x0,0x0,0x802000c0,0x200000,0x80000000,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x882000c0,0x200000,0x88000000,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x40,0x40,0x0,0x40,0x0,0x0,0x40,0x0,0x40,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x60000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ }
+ private static void jj_la1_init_2() {
+ jj_la1_2 = new int[] {0x80000000,0x0,0x0,0x20000000,0x0,0x0,0x0,0x0,0x400,0x50000440,0x0,0x0,0x0,0x0,0x220,0x0,0x40,0x0,0x0,0x0,0xf0000ae0,0xf0000ae0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0xe0000aa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x50000444,0x44,0x0,0x40000400,0x10000040,0x0,0x0,0x0,0x0,0x10000000,0x10000000,0x0,0x0,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000040,0x40,0x40,0x40,0x40,0x40,0x0,0x0,0x0,0x0,0x60,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x10,0x0,0x0,0x4c0,0x0,0x50000440,0x40000400,0x10000040,0x0,0x0,0x0,0x4c0,0x8,0x0,0x50000440,0x40000400,0x10000040,0x0,0x4c0,0x0,0x0,0x0,0x440,0x0,0x50000440,0x0,0x40000400,0x10000040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x50000440,0x40000000,0x400,0x10000040,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x400,0x1ffffee0,0x0,0x0,0x0,0x0,0x1ffffee0,0x0,0x0,0x0,0x440,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x1ffffee0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1ffffee0,0x0,0xffff880,0x0,0x10000260,0x1ffffae0,0x0,0x0,0x1ffffee0,0x0,0x70000040,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,};
+ }
+ private static void jj_la1_init_3() {
+ jj_la1_3 = new int[] {0x0,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x3,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6200f,0x6200f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6200f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x22000,0x0,0x0,0x0,0x0,0x22000,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x22000,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x22000,0x0,0x20000,0x0,0x2000,0x22000,0x0,0x0,0x22000,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ }
+ final private JJCalls[] jj_2_rtns = new JJCalls[15];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ /** Constructor with user supplied CharStream. */
+ public Parser(CharStream stream) {
+ token_source = new ParserTokenManager(stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 236; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Reinitialise. */
+ public void ReInit(CharStream stream) {
+ token_source.ReInit(stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 236; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Constructor with generated Token Manager. */
+ public Parser(ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 236; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Reinitialise. */
+ public void ReInit(ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 236; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ static private final class LookaheadSuccess extends java.lang.Error { }
+ final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+ private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ if (jj_scanpos.kind != kind) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+ return false;
+ }
+
+
+/** Get the next Token. */
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+/** Get the specific Token. */
+ final public Token getToken(int index) {
+ Token t = token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
+ int[] oldentry = (int[])(it.next());
+ if (oldentry.length == jj_expentry.length) {
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ continue jj_entries_loop;
+ }
+ }
+ jj_expentries.add(jj_expentry);
+ break jj_entries_loop;
+ }
+ }
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ /** Generate ParseException. */
+ public ParseException generateParseException() {
+ jj_expentries.clear();
+ boolean[] la1tokens = new boolean[115];
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 236; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ if ((jj_la1_2[i] & (1<<j)) != 0) {
+ la1tokens[64+j] = true;
+ }
+ if ((jj_la1_3[i] & (1<<j)) != 0) {
+ la1tokens[96+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 115; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.add(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = jj_expentries.get(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ /** Enable tracing. */
+ final public void enable_tracing() {
+ }
+
+ /** Disable tracing. */
+ final public void disable_tracing() {
+ }
+
+ private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 15; i++) {
+ try {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ case 1: jj_3_2(); break;
+ case 2: jj_3_3(); break;
+ case 3: jj_3_4(); break;
+ case 4: jj_3_5(); break;
+ case 5: jj_3_6(); break;
+ case 6: jj_3_7(); break;
+ case 7: jj_3_8(); break;
+ case 8: jj_3_9(); break;
+ case 9: jj_3_10(); break;
+ case 10: jj_3_11(); break;
+ case 11: jj_3_12(); break;
+ case 12: jj_3_13(); break;
+ case 13: jj_3_14(); break;
+ case 14: jj_3_15(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ } catch(LookaheadSuccess ls) { }
+ }
+ jj_rescan = false;
+ }
+
+ private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
--- /dev/null
+/* -*-java-extended-*-
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: Parser.jj,v 1.15 2000/10/27 21:09:37 plehegar Exp $
+ */
+
+options {
+ IGNORE_CASE = true;
+ STATIC = false;
+ USER_CHAR_STREAM = true;
+ /* DEBUG_TOKEN_MANAGER = true;
+ DEBUG_PARSER = true; */
+}
+
+PARSER_BEGIN(Parser)
+
+package com.vaadin.sass.internal.parser;
+
+import java.io.*;
+import java.net.*;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.ErrorHandler;
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.Locator;
+import org.w3c.css.sac.LexicalUnit;
+
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+
+import org.w3c.flute.util.Encoding;
+
+import com.vaadin.sass.internal.handler.*;
+
+import com.vaadin.sass.internal.tree.*;
+
+/**
+ * A CSS2 parser
+ *
+ * @author Philippe Le H�garet
+ * @version $Revision: 1.15 $
+ */
+public class Parser implements org.w3c.css.sac.Parser {
+
+ // replaces all \t, \n, etc with this StringBuffer.
+ static final StringBuilder SPACE = new StringBuilder(" ");
+
+ // the document handler for the parser
+ protected SCSSDocumentHandlerImpl documentHandler;
+ // the error handler for the parser
+ protected ErrorHandler errorHandler;
+ // the input source for the parser
+ protected InputSource source;
+
+ protected ConditionFactory conditionFactory;
+ protected SelectorFactory selectorFactory;
+
+ // temporary place holder for pseudo-element ...
+ private String pseudoElt;
+
+ /**
+ * Creates a new Parser
+ */
+ public Parser() {
+ this((CharStream) null);
+ }
+
+ /**
+ * @@TODO
+ * @exception CSSException Not yet implemented
+ */
+ public void setLocale(Locale locale) throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Set the document handler for this parser
+ */
+ public void setDocumentHandler(DocumentHandler handler) {
+ this.documentHandler = (SCSSDocumentHandlerImpl) handler;
+ }
+
+ public void setSelectorFactory(SelectorFactory selectorFactory) {
+ this.selectorFactory = selectorFactory;
+ }
+
+ public void setConditionFactory(ConditionFactory conditionFactory) {
+ this.conditionFactory = conditionFactory;
+ }
+
+ /**
+ * Set the error handler for this parser
+ */
+ public void setErrorHandler(ErrorHandler error) {
+ this.errorHandler = error;
+ }
+
+ /**
+ * Main parse methods
+ *
+ * @param source the source of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+
+ parserUnit();
+ }
+
+ /**
+ * Convenient method for URIs.
+ *
+ * @param systemId the fully resolved URI of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(String systemId)
+ throws CSSException, IOException {
+ parseStyleSheet(new InputSource(systemId));
+ }
+
+ /**
+ * This method parses only one rule (style rule or at-rule, except @charset).
+ *
+ * @param source the source of the rule.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseRule();
+ }
+
+ /**
+ * This method parses a style declaration (including the surrounding curly
+ * braces).
+ *
+ * @param source the source of the style declaration.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleDeclaration(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseDeclarationBlock();
+ }
+
+ /**
+ * This methods returns "http://www.w3.org/TR/REC-CSS2".
+ * @return the string "http://www.w3.org/TR/REC-CSS2".
+ */
+ public String getParserVersion() {
+ return "http://www.w3.org/TR/REC-CSS2";
+ }
+
+ /**
+ * Parse methods used by DOM Level 2 implementation.
+ */
+ public void parseImportRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseImportRule();
+ }
+
+ public void parseMediaRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseMediaRule();
+ }
+
+ public SelectorList parseSelectors(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return null;
+ }
+
+ public LexicalUnit parsePropertyValue(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return expr();
+ }
+
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return prio();
+ }
+
+ /**
+ * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
+ */
+ private Reader getReader(InputSource source) throws IOException {
+ if (source.getCharacterStream() != null) {
+ return source.getCharacterStream();
+ } else if (source.getByteStream() != null) {
+ // My DOM level 2 implementation doesn't use this case.
+ if (source.getEncoding() == null) {
+ // unknown encoding, use ASCII as default.
+ return new InputStreamReader(source.getByteStream(), "ASCII");
+ } else {
+ return new InputStreamReader(source.getByteStream(),
+ source.getEncoding());
+ }
+ } else {
+ // systemId
+ // @@TODO
+ throw new CSSException("not yet implemented");
+ }
+ }
+
+ /**
+ * Convert the source into a CharStream with encoding informations.
+ * The encoding can be found in the InputSource or in the CSS document.
+ * Since this method marks the reader and make a reset after looking for
+ * the charset declaration, you'll find the charset declaration into the
+ * stream.
+ */
+ private CharStream getCharStreamWithLurk(InputSource source)
+ throws CSSException, IOException {
+ if (source.getCharacterStream() != null) {
+ // all encoding are supposed to be resolved by the user
+ // return the reader
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ } else if (source.getByteStream() == null) {
+ // @@CONTINUE ME. see also getReader() with systemId
+ try {
+ source.setByteStream(new URL(source.getURI()).openStream());
+ } catch (Exception e) {
+ try {
+ source.setByteStream(new FileInputStream(source.getURI()));
+ } catch (IOException ex) {
+ throw new CSSException("invalid url ?");
+ }
+ }
+ }
+ String encoding = "ASCII";
+ InputStream input = source.getByteStream();
+ char c = ' ';
+
+ if (!input.markSupported()) {
+ input = new BufferedInputStream(input);
+ source.setByteStream(input);
+ }
+ input.mark(100);
+ c = (char) input.read();
+
+ if (c == '@') {
+ // hum, is it a charset ?
+ int size = 100;
+ byte[] buf = new byte[size];
+ input.read(buf, 0, 7);
+ String keyword = new String(buf, 0, 7);
+ if (keyword.equals("charset")) {
+ // Yes, this is the charset declaration !
+
+ // here I don't use the right declaration : white space are ' '.
+ while ((c = (char) input.read()) == ' ') {
+ // find the first quote
+ }
+ char endChar = c;
+ int i = 0;
+
+ if ((endChar != '"') && (endChar != '\'')) {
+ // hum this is not a quote.
+ throw new CSSException("invalid charset declaration");
+ }
+
+ while ((c = (char) input.read()) != endChar) {
+ buf[i++] = (byte) c;
+ if (i == size) {
+ byte[] old = buf;
+ buf = new byte[size + 100];
+ System.arraycopy(old, 0, buf, 0, size);
+ size += 100;
+ }
+ }
+ while ((c = (char) input.read()) == ' ') {
+ // find the next relevant character
+ }
+ if (c != ';') {
+ // no semi colon at the end ?
+ throw new CSSException("invalid charset declaration: "
+ + "missing semi colon");
+ }
+ encoding = new String(buf, 0, i);
+ if (source.getEncoding() != null) {
+ // compare the two encoding informations.
+ // For example, I don't accept to have ASCII and after UTF-8.
+ // Is it really good ? That is the question.
+ if (!encoding.equals(source.getEncoding())) {
+ throw new CSSException("invalid encoding information.");
+ }
+ }
+ } // else no charset declaration available
+ }
+ // ok set the real encoding of this source.
+ source.setEncoding(encoding);
+ // set the real reader of this source.
+ source.setCharacterStream(new InputStreamReader(source.getByteStream(),
+ Encoding.getJavaEncoding(encoding)));
+ // reset the stream (leave the charset declaration in the stream).
+ input.reset();
+
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ }
+
+ private LocatorImpl currentLocator;
+ private Locator getLocator() {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this);
+ }
+ private LocatorImpl getLocator(Token save) {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this, save);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this, save);
+ }
+
+ private void reportError(Locator l, Exception e) {
+ if (errorHandler != null) {
+ if (e instanceof ParseException) {
+ // construct a clean error message.
+ ParseException pe = (ParseException) e;
+ if (pe.specialConstructor) {
+ StringBuffer errorM = new StringBuffer();
+ if (pe.currentToken != null) {
+ errorM.append("encountered \"")
+ .append(pe.currentToken.next);
+ }
+ errorM.append('"');
+ if (pe.expectedTokenSequences.length != 0) {
+ errorM.append(". Was expecting one of: ");
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ int kind = pe.expectedTokenSequences[i][j];
+ if (kind != S) {
+ errorM.append(pe.tokenImage[kind]);
+ errorM.append(' ');
+ }
+ }
+ }
+ }
+ errorHandler.error(new CSSParseException(errorM.toString(),
+ l, e));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(),
+ l, e));
+ }
+ } else if (e == null) {
+ errorHandler.error(new CSSParseException("error", l, null));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(), l, e));
+ }
+ }
+ }
+
+ private void reportWarningSkipText(Locator l, String text) {
+ if (errorHandler != null && text != null) {
+ errorHandler.warning(new CSSParseException("Skipping: " + text, l));
+ }
+ }
+}
+
+PARSER_END(Parser)
+
+/*
+ * The tokenizer
+ */
+
+<DEFAULT>
+TOKEN :
+{
+ < S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ >
+ { image = Parser.SPACE; }
+}
+
+<DEFAULT>
+MORE :
+{
+ "//" : IN_SINGLE_LINE_COMMENT
+}
+
+<IN_SINGLE_LINE_COMMENT>
+MORE :
+{
+ < ~["\n","\r"] > : IN_SINGLE_LINE_COMMENT
+}
+
+<IN_SINGLE_LINE_COMMENT>
+SKIP :
+{
+ < "\n"|"\r"|"\r\n" > : DEFAULT
+}
+
+<DEFAULT>
+MORE :
+{
+ <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
+|
+ "/*" : IN_MULTI_LINE_COMMENT
+}
+<IN_FORMAL_COMMENT>
+SPECIAL_TOKEN :
+{
+ <FORMAL_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_MULTI_LINE_COMMENT>
+SKIP :
+{
+ <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
+MORE :
+{
+ < ~[] >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < CDO : "<!--" >
+ | < CDC : "-->" >
+ | < LBRACE : "{" >
+ | < RBRACE : "}">
+ | < DASHMATCH : "|=" >
+ | < CARETMATCH : "^=" >
+ | < DOLLARMATCH : "$=" >
+ | < STARMATCH : "*=" >
+ | < INCLUDES : "~=" >
+ | < EQ : "=" >
+ | < PLUS : "+" >
+ | < MINUS : "-" >
+ | < COMMA : "," >
+ | < SEMICOLON : ";" >
+ | < PRECEDES : ">" >
+ | < SUCCEEDS : "<" >
+ | < DIV : "/" >
+ | < LBRACKET : "[" >
+ | < RBRACKET : "]" >
+ | < ANY : "*" >
+ | < PARENT : "&" >
+ | < DOT : "." >
+ | < LPARAN : "(" >
+ | < RPARAN : ")">
+ | < COMPARE : "==" >
+ | < OR : "||" >
+ | < AND : "&&" >
+ | < NOT_EQ : "!=" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < COLON : ":" >
+}
+
+< DEFAULT >
+TOKEN :
+{
+ < INTERPOLATION : "#{"< VARIABLE > "}">
+}
+
+<DEFAULT>
+TOKEN : /* basic tokens */
+{
+ < NONASCII : ["\200"-"\377"] >
+ | < #H : ["0"-"9", "a"-"f"] >
+ | < #UNICODE : "\\" <H> ( <H> )? /* I can't say {1,6} */
+ ( <H> )? ( <H> )?
+ ( <H> )? ( <H> )?
+ ( [ " ", "\t" , "\n" , "\r", "\f" ] )? >
+ | < #ESCAPE : <UNICODE> | ( "\\" [ " "-"~","\200"-"\377" ] ) >
+ | < #NMSTART : ("-")?[ "a"-"z"] | <NONASCII> | <ESCAPE> >
+ | < #NMCHAR : ["a"-"z", "0"-"9", "-", "_"] | <NONASCII> | <ESCAPE> >
+ | < #STRINGCHAR : [ "\t"," ","!","#","$","%","&","("-"~" ]
+ | "\\\n" | "\\\r\n" | "\\\r" | "\\\f"
+ | <NONASCII> | <ESCAPE> >
+ | < #D : ["0"-"9"] >
+ | < #NAME : ( <NMCHAR> )+ >
+
+}
+
+<DEFAULT>
+TOKEN :
+{
+ <TO : "to">
+ |<THROUGH : "through">
+ |<EACH_IN : "in">
+}
+
+/* DERECTIVES */
+<DEFAULT>
+TOKEN :
+{
+ <MIXIN_SYM : "@mixin">
+ | <INCLUDE_SYM : "@include">
+ | <FUNCTION_SYM : "@function">
+ | <RETURN_SYM : "@return">
+ | <DEBUG_SYM : "@debug">
+ | <WARN_SYM : "@warn">
+ | <FOR_SYM : "@for">
+ | <EACH_SYM : "@each">
+ | <WHILE_SYM : "@while">
+ | <IF_SYM : "@if">
+ | <ELSE_SYM : "@else">
+ | <EXTEND_SYM : "@extend">
+ | <MOZ_DOCUMENT_SYM : "@-moz-document">
+ | <SUPPORTS_SYM : "@supports">
+}
+
+< DEFAULT >
+TOKEN:
+{
+ < MICROSOFT_RULE : "filter"|"-ms-filter" >
+}
+
+< DEFAULT >
+TOKEN:
+{
+ < IF : "if" >
+}
+
+<DEFAULT>
+TOKEN:
+{
+ < GUARDED_SYM : "!" ( <S> )? "default">
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < STRING : ( "\"" ( <STRINGCHAR> | "'" )* "\"" ) |
+ ( "'" ( <STRINGCHAR> | "\"" )* "'" ) >
+ | < IDENT : <NMSTART> ( <NMCHAR> )* >
+ | < NUMBER : ( <D> )+ | ( <D> )* "." ( <D> )+ >
+ | < #_URL : [ "!","#","$","%","&","*"-"~" ] | <NONASCII> | <ESCAPE> >
+ | < URL : "url(" ( <S> )*
+ ( <STRING> | ( <_URL> )* ) ( <S> )* ")" >
+}
+
+<DEFAULT>
+TOKEN:
+{
+ < VARIABLE : "$" <IDENT>>
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < PERCENTAGE : <NUMBER> "%" >
+ | < PT : <NUMBER> "pt" >
+ | < MM : <NUMBER> "mm" >
+ | < CM : <NUMBER> "cm" >
+ | < PC : <NUMBER> "pc" >
+ | < IN : <NUMBER> "in" >
+ | < PX : <NUMBER> "px" >
+ | < EMS : <NUMBER> "em" >
+ | < EXS : <NUMBER> "ex" >
+ | < DEG : <NUMBER> "deg" >
+ | < RAD : <NUMBER> "rad" >
+ | < GRAD : <NUMBER> "grad" >
+ | < MS : <NUMBER> "ms" >
+ | < SECOND : <NUMBER> "s" >
+ | < HZ : <NUMBER> "Hz" >
+ | < KHZ : <NUMBER> "kHz" >
+ | < DIMEN : <NUMBER> <IDENT> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < HASH : "#" <NAME> >
+}
+
+/* RESERVED ATRULE WORDS */
+<DEFAULT>
+TOKEN :
+{
+ < IMPORT_SYM : "@import">
+ | < MEDIA_SYM : "@media" >
+ | < CHARSET_SYM : "@charset" >
+ | < PAGE_SYM : "@page" >
+ | < FONT_FACE_SYM: "@font-face" >
+ | < ATKEYWORD : "@" <IDENT> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < IMPORTANT_SYM : "!" ( <S> )? "important" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < #RANGE0 : <H> <H> <H> <H> <H> >
+ | < #RANGE1 : <H> <H> <H> <H> <H> ( "?" )? >
+ | < #RANGE2 : <H> <H> <H> <H> ( "?" )? ( "?" )? >
+ | < #RANGE3 : <H> <H> <H> ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE4 : <H> <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE5 : <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE6 : "?" ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE : <RANGE0> | <RANGE1> | <RANGE2>
+ | <RANGE3> | <RANGE4> | <RANGE5> | <RANGE6> >
+ | < #UNI : <H> ( <H> )? ( <H> )? ( <H> )? ( <H> )? ( <H> )? >
+ | < UNICODERANGE : "U+" <RANGE>
+ | "U+" <UNI> "-" <UNI> >
+}
+
+< DEFAULT >
+TOKEN :
+{
+ < REMOVE : "remove" (< S >)? "(" >
+ | < APPEND : "append" (< S >)? "(" >
+ | < CONTAINS : "contains" (< S >)? "(" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < FUNCTION : <IDENT>(< S >)* "(" >
+}
+
+<DEFAULT, IN_MULTI_LINE_COMMENT>
+TOKEN :
+{ /* avoid token manager error */
+ < UNKNOWN : ~[] >
+}
+
+/*
+ * The grammar of CSS2
+ */
+
+/**
+ * The main entry for the parser.
+ *
+ * @exception ParseException exception during the parse
+ */
+void parserUnit() :
+{}
+{
+ try {
+ { documentHandler.startDocument(source); }
+ ( charset() )?
+ ( <S> comments()
+ | ignoreStatement() )*
+ ( importDeclaration() ( ignoreStatement() ( <S> )* )* )*
+ afterImportDeclaration()
+ <EOF>
+ } finally {
+ documentHandler.endDocument(source);
+ }
+}
+
+void charset() :
+{ Token n; }
+{
+ try {
+ <CHARSET_SYM> ( <S> )* n=<STRING> ( <S> )* ";"
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ }
+}
+
+void afterImportDeclaration() :
+{String ret;
+ Locator l;
+}
+{
+ (
+ ( (LOOKAHEAD(5)listModifyDirective()|variable()) | ifDirective()|mixinDirective()| eachDirective() | includeDirective() | styleRule() | media()| page() | fontFace()
+ | { l = getLocator(); } ret=skipStatement()
+ {
+ if ((ret == null) || (ret.length() == 0)) {
+ return;
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ )
+ ( ignoreStatement() ( <S> )* )* )*
+}
+
+void ignoreStatement() :
+{}
+{
+ <CDO> | <CDC> | atRuleDeclaration()
+}
+
+/**
+ * The import statement
+ *
+ * @exception ParseException exception during the parse
+ */
+void importDeclaration() :
+{Token n;
+ String uri;
+ MediaListImpl ml = new MediaListImpl();
+ boolean isURL = false;
+}
+{
+ try {
+ <IMPORT_SYM>
+ ( <S> )* ( n=<STRING> { uri = convertStringIndex(n.image, 1,
+ n.image.length() -1); }
+ | n=<URL>
+ {
+ isURL=true;
+ uri = n.image.substring(4, n.image.length()-1).trim();
+ if ((uri.charAt(0) == '"')
+ || (uri.charAt(0) == '\'')) {
+ uri = uri.substring(1, uri.length()-1);
+ }
+ }
+ )
+ ( <S> )* ( mediaStatement(ml) )? ";"
+ ( <S> )*
+ {
+ if (ml.getLength() == 0) {
+ // see section 6.3 of the CSS2 recommandation.
+ ml.addItem("all");
+ }
+ documentHandler.importStyle(uri, ml, isURL);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void media() :
+{
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+}
+{
+ try {
+ <MEDIA_SYM> ( <S> )*
+ mediaStatement(ml)
+ { start = true; documentHandler.startMedia(ml); }
+ <LBRACE> ( <S> )* ( styleRule() | skipUnknownRule() )* <RBRACE> ( <S> )*
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+}
+
+void mediaStatement(MediaListImpl ml) :
+{
+ String m;
+}
+{
+ m=medium() ( <COMMA> ( <S> )* { ml.addItem(m); } m=medium() )*
+ { ml.addItem(m); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String medium() : /* tv, projection, screen, ... */
+{Token n;}
+{
+ n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void page() :
+{
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+}
+{
+ try {
+ <PAGE_SYM> ( <S> )* ( n=<IDENT> ( <S> )* )?
+ ( pseudo=pseudo_page() )?
+ {
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ }
+ <LBRACE> (<S>)*
+ {
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+}
+
+String pseudo_page() :
+{ Token n; }
+{
+ ":" n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+void fontFace() :
+{
+ boolean start = false;
+}
+{
+ try {
+ <FONT_FACE_SYM> ( <S> )*
+ <LBRACE> (<S>)*
+ { start = true; documentHandler.startFontFace(); }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void atRuleDeclaration() :
+{Token n;
+ String ret;
+}
+{
+ n=<ATKEYWORD>
+ {
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+}
+
+void skipUnknownRule() :
+{ Token n;}
+{
+ ( n=<ATKEYWORD>
+| n=<CDO>
+| n=<CHARSET_SYM>
+| n=<COMMA>
+| n=<DASHMATCH>
+| n=<FONT_FACE_SYM>
+| n=<FUNCTION>
+| n=<IMPORTANT_SYM>
+| n=<IMPORT_SYM>
+| n=<INCLUDES>
+| n=<LBRACE>
+| n=<MEDIA_SYM>
+| n=<NONASCII>
+| n=<NUMBER>
+| n=<PAGE_SYM>
+| n=<PERCENTAGE>
+| n=<STRING>
+| n=<UNICODERANGE>
+| n=<URL>
+| n=";"
+| n="+"
+| n=">"
+| n="-"
+| n=<UNKNOWN>
+ ) {
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+char combinator() :
+{
+char connector = ' ';
+}
+{
+ "+" ( <S> )* { return '+'; }
+ | ">" ( <S> )* { return '>'; }
+| <S> ( ( "+" { connector = '+'; }
+ | ">" { connector = '>'; } )
+ ( <S> )* )? { return connector; }
+}
+
+void microsoftExtension() :
+{
+ Token n;
+ String name = "";
+ String value = "";
+}
+
+{
+ n = < MICROSOFT_RULE > (< S >)* { name = n.image; }
+ < COLON >
+ ((n = < IDENT > { value += n.image; })
+ | (n = < NUMBER > { value += n.image; })
+ | (n = < INTERPOLATION > { value += n.image; })
+ | (n = < COLON > { value += n.image; })
+ | (n = < FUNCTION > { value += n.image; })
+ | (n = < RPARAN > { value += n.image; })
+ | (n = < EQ > { value += n.image; })
+ | (n = < DOT > { value += n.image; })
+ | (n = < S > { if(value.lastIndexOf(' ') != value.length()-1)
+ { value += n.image; } }
+ ) )+
+ < SEMICOLON >
+ (< S >)*
+ { documentHandler.microsoftDirective(name, value); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String property() :
+{Token n;
+}
+{
+ n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+String variableName() :
+{Token n;}
+{
+ n=<VARIABLE> (<S>)* {return convertIdent(n.image.substring(1));}
+}
+
+String functionName() :
+{Token n;}
+{
+ n=<FUNCTION> ( <S> )* {return convertIdent(n.image.substring(0, n.image.length()-1));}
+}
+/**
+ * @exception ParseException exception during the parse
+ */
+void styleRule() :
+{
+ boolean start = false;
+ ArrayList<String> l = null;
+ Token save;
+ Locator loc;
+}
+{
+ try {
+ l=selectorList() { save = token; } <LBRACE> (<S>)*
+ {
+ start = true;
+ documentHandler.startSelector(l);
+ }
+ ( ifDirective() | LOOKAHEAD(5)listModifyDirective() | includeDirective() | media() | extendDirective()| eachDirective() | variable() | LOOKAHEAD(3) (microsoftExtension()|declarationOrNestedProperties()) | styleRule())*
+ <RBRACE> (<S>)*
+ } catch (ThrowedParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.e.currentToken.next.beginLine,
+ e.e.currentToken.next.beginColumn-1);
+ reportError(li, e.e);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } catch (TokenMgrError e) {
+ reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endSelector();
+ }
+ }
+}
+
+ ArrayList<String> selectorList() :
+{
+ ArrayList<String> selectors = new ArrayList<String>();
+ String selector;
+}
+{
+ selector=selector() ( <COMMA> (<S>)* { selectors.add(selector); }
+ selector=selector() )*
+ { selectors.add(selector);
+ return selectors;
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String selector() :
+{
+ String selector;
+ char comb;
+}
+{
+ try {
+ selector=simple_selector(null, ' ')
+ ( LOOKAHEAD(2) comb=combinator()
+ selector=simple_selector(selector, comb) )* (<S>)*
+ {
+ return selector;
+ }
+ } catch (ParseException e) {
+ /*
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+ reportWarningSkipText(getLocator(), s.toString());
+ */
+ Token t = getToken(1);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ getNextToken();
+ t = getToken(1);
+ }
+
+ throw new ThrowedParseException(e);
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String simple_selector(String selector, char comb) :
+{
+ String simple_current = null;
+ String cond = null;
+
+ pseudoElt = null;
+}
+{
+ ( simple_current=element_name()
+ ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=hash(cond) ( cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=_class(cond) ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=pseudo(cond) ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=attrib(cond) ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ )
+ {
+ if (simple_current == null) {
+ simple_current = "";
+ }
+ if (cond != null) {
+ simple_current = simple_current + cond;
+ }
+ if (selector != null) {
+ switch (comb) {
+ case ' ':
+ selector = selector + comb + simple_current;
+ break;
+ case '+':
+ selector = selector + " " + comb + " " + simple_current;
+ break;
+ case '>':
+ selector = selector + " " + comb + " " + simple_current;
+ break;
+ default:
+ throw new ParseException("invalid state. send a bug report");
+ }
+ } else {
+ selector= simple_current;
+ }
+ if (pseudoElt != null) {
+ selector = selector + pseudoElt;
+ }
+ return selector;
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String _class(String pred) :
+{Token t;
+String s = ".";
+}
+{
+ "." (t = <IDENT>{s += t.image; }|t = < INTERPOLATION >{ s += t.image; })+
+ {
+
+ if (pred == null) {
+ return s;
+ } else {
+ return pred + s;
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String element_name() :
+{Token t; String s = "";}
+{
+ (t = <IDENT>{s += t.image; }|t = < INTERPOLATION >{ s += t.image; })+
+ {
+ return s;
+ }
+ | "*"
+ { return "*"; }
+ | "&"
+ { return "&"; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String attrib(String pred) :
+{
+ int cases = 0;
+ Token att = null;
+ Token val = null;
+ String attValue = null;
+}
+{
+ "[" ( <S> )* att=<IDENT> ( <S> )*
+ ( ( "=" { cases = 1; }
+ | <INCLUDES> { cases = 2; }
+ | <DASHMATCH> { cases = 3; }
+ | <CARETMATCH> { cases = 4; }
+ | <DOLLARMATCH> { cases = 5; }
+ | <STARMATCH> { cases = 6; } ) ( <S> )*
+ ( val=<IDENT> { attValue = val.image; }
+ | val=<STRING> { attValue = val.image; }
+ )
+ ( <S> )* )?
+ "]"
+ {
+ String name = convertIdent(att.image);
+ String c;
+ switch (cases) {
+ case 0:
+ c = name;
+ break;
+ case 1:
+ c = name + "=" + attValue;
+ break;
+ case 2:
+ c = name + "~=" + attValue;
+ break;
+ case 3:
+ c = name + "|=" +attValue;
+ break;
+ case 4:
+ c = name + "^=" +attValue;
+ break;
+ case 5:
+ c = name + "$=" +attValue;
+ break;
+ case 6:
+ c = name + "*=" +attValue;
+ break;
+ default:
+ // never reached.
+ c = null;
+ }
+ c = "[" + c + "]";
+ if (pred == null) {
+ return c;
+ } else {
+ return pred + c;
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String pseudo(String pred) :
+{Token n;
+Token language;
+boolean isPseudoElement = false;
+}
+{
+ ":" (":"{isPseudoElement=true;})?( n=<IDENT>
+ {
+ String s = ":" + convertIdent(n.image);
+ if (isPseudoElement) {
+ if (pseudoElt != null) {
+ throw new CSSParseException("duplicate pseudo element definition "
+ + s, getLocator());
+ } else {
+ pseudoElt = ":"+s;
+ return pred;
+ }
+ } else {
+ String c = s;
+ if (pred == null) {
+ return c;
+ } else {
+ return pred + c;
+ }
+ }
+ }
+ | ( n=<FUNCTION> ( <S> )* language=<IDENT> ( <S> )* ")"
+ {
+ String f = convertIdent(n.image);
+ if (f.equals("lang(")) {
+ String d = convertIdent(language.image);
+ if (pred == null) {
+ return d;
+ } else {
+ return pred + d;
+ }
+ } else {
+ throw new CSSParseException("invalid pseudo function name "
+ + f, getLocator());
+ }
+ }
+ )
+ )
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String hash(String pred) :
+{Token n; }
+{
+ n=<HASH>
+ {
+ String d = n.image;
+ if (pred == null) {
+ return d;
+ } else {
+ return pred + d;
+ }
+ }
+}
+
+void variable() :
+{
+ String name;
+ LexicalUnitImpl exp = null;
+ boolean guarded = false;
+ String raw;
+}
+{
+ try{
+ name = variableName()
+ ":" ( <S> )* exp=expr() ( guarded=guarded() )?(";"(<S>)*)+
+ //raw=skipStatementUntilSemiColon()
+ {
+ documentHandler.variable(name, exp, guarded);
+ }
+ }catch (JumpException e) {
+ skipAfterExpression();
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ } else {
+ skipAfterExpression();
+ }
+ }
+}
+
+void ifDirective() :
+{
+ Token n = null;
+ String evaluator = "";
+}
+{
+ < IF_SYM >
+ ( n = booleanExpressionToken() { evaluator += n.image; } )+
+ < LBRACE >(< S >)*
+ { documentHandler.startIfElseDirective();
+ documentHandler.ifDirective(evaluator);
+ }
+ ( includeDirective() | media() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
+ < RBRACE >(< S >)*
+ (elseDirective())*
+ { documentHandler.endIfElseDirective(); }
+}
+
+void elseDirective() :
+{
+ String evaluator = "";
+ Token n = null;
+}
+{
+ < ELSE_SYM >(< S >)*
+ ( < IF > (n = booleanExpressionToken() { if(n != null) evaluator += n.image; })*)?
+ < LBRACE >(< S >)*
+ { if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); }
+ else{ documentHandler.elseDirective(); }
+ }
+ ( includeDirective() | media() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
+ < RBRACE >(< S >)*
+}
+
+Token booleanExpressionToken() :
+{
+ Token n = null;
+}
+{
+ (
+ n = < VARIABLE >
+ |n = < IDENT >
+ |n = < NUMBER >
+ |n = < LPARAN >
+ |n = < RPARAN >
+ |n = < PLUS >
+ |n = < MINUS >
+ |n = < DIV >
+ |n = < ANY >
+ |n = < COMPARE >
+ |n = < EQ >
+ |n = < PRECEDES >
+ |n = < SUCCEEDS >
+ |n = < OR >
+ |n = < AND >
+ |n = < S >
+ |n = < NOT_EQ >
+){
+ return n;
+ }
+}
+
+void eachDirective() :
+{
+ Token var;
+ ArrayList<String> list = null;
+ String listVariable = null;
+}
+{
+ < EACH_SYM >
+ (< S >)*
+ var = < VARIABLE > (< S >)* < EACH_IN > (< S >)*
+ (list = stringList()
+ {documentHandler.startEachDirective(var.image, list);}
+ |listVariable = variableName()
+ {documentHandler.startEachDirective(var.image, listVariable);}
+ )
+ < LBRACE >(< S >)*
+ ( includeDirective() | LOOKAHEAD(5)listModifyDirective() | media() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
+ < RBRACE >(< S >)*
+ { documentHandler.endEachDirective();}
+}
+
+ArrayList<String > stringList():
+{
+ ArrayList<String > strings = new ArrayList<String >();
+ Token input;
+}
+{
+ (input = < IDENT > (< S >)*)
+ { strings.add(input.image); }
+
+ (< COMMA >(< S >)* input = < IDENT > { strings.add(input.image); } (< S >)*)*
+ { return strings; }
+
+}
+
+void mixinDirective() :
+{
+ String name;
+ ArrayList<VariableNode> args = null;
+ String body;
+}
+{
+ <MIXIN_SYM>
+ (<S>)*
+ (name = property()
+ |(name = functionName()
+ args = arglist()) <RPARAN> (<S>)*) <LBRACE> (<S>)*
+ {documentHandler.startMixinDirective(name, args);}
+ ( includeDirective() | media() | LOOKAHEAD(5)listModifyDirective()|eachDirective() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
+ <RBRACE>(<S>)*
+ {documentHandler.endMixinDirective(name, args);}
+}
+
+ArrayList<VariableNode> arglist() :
+{
+ ArrayList<VariableNode> args = new ArrayList<VariableNode>();
+ VariableNode arg;
+ boolean hasNonOptionalArgument = false;
+}
+{
+ arg=mixinArg() ( <COMMA> (<S>)* { hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg); }
+ arg=mixinArg() )*
+ { hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
+ return args;
+ }
+}
+
+JAVACODE
+boolean checkMixinForNonOptionalArguments(VariableNode arg, boolean hasNonOptionalArguments)\r{
+ boolean currentArgHasArguments = arg.getExpr() != null && arg.getExpr().getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE && arg.getExpr().getNextLexicalUnit() != null;
+ \r if(currentArgHasArguments)\r {
+ if(hasNonOptionalArguments)\r {\r throw new ParseException("Sass Error: Required argument $"+ arg.getName() +" must come before any optional arguments.");
+ }
+ return hasNonOptionalArguments;
+ }else\r {\r return true;
+ }
+}
+
+VariableNode mixinArg() :
+{
+ String name;
+ Token variable = null;
+ LexicalUnitImpl first = null;
+ LexicalUnitImpl prev = null;
+ LexicalUnitImpl next = null;
+}
+{
+ name=variableName() (< COLON > (< S >)*
+
+ (\r first = nonVariableTerm(null)\r {
+ prev = first;\r }
+ (LOOKAHEAD(3)(< COMMA >(< S >)*)? prev = nonVariableTerm(prev))*\r )
+ | (variable = < VARIABLE >{ first = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
+ prev, variable.image);}
+
+ )
+ )?
+ {
+ VariableNode arg = new VariableNode(name, first, false);
+ return arg;
+ }
+}
+
+ArrayList<LexicalUnitImpl> argValuelist() :
+{
+ ArrayList<LexicalUnitImpl> args = new ArrayList<LexicalUnitImpl>();
+ LexicalUnitImpl first = null;
+ LexicalUnitImpl next = null;
+ LexicalUnitImpl prev = null;
+}
+{
+ first = term(null) { args.add(first); prev = first;}((< COLON > (< S >)*)?next=term(prev){prev.setNextLexicalUnit(next); prev = next;})*
+ ( <COMMA> (<S>)*
+ first = term(null) { args.add(first); prev = first;}((< COLON > (< S >)*)?next=term(prev){prev.setNextLexicalUnit(next); prev = next;})*
+ )*
+ {return args;}
+}
+
+void includeDirective() :
+{
+ String name;
+ ArrayList<LexicalUnitImpl> args=null;
+}
+{
+ <INCLUDE_SYM>
+ (<S>)*
+ (name = property()|name = variableName(){ name = "$"+name;}|name = interpolation()
+ |(name = functionName()
+ args = argValuelist()) <RPARAN>)(";"(<S>)*)+
+ {documentHandler.includeDirective(name, args);}
+}
+
+String interpolation() :
+{
+ Token n;\r}\r{
+ n = < INTERPOLATION >
+ {
+ return n.image;\r }\r}
+
+void listModifyDirective() :\r{
+}
+{
+LOOKAHEAD(5)removeDirective()|LOOKAHEAD(5)appendDirective()|LOOKAHEAD(5)containsDirective()
+}
+
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void appendDirective() :
+{
+ String list = null;
+ String remove = null;
+ String separator = null;
+ String variable = null;
+ Token n = null;
+}
+{
+ n = < VARIABLE >{ variable = n.image; }(< S >)* ":" (< S >)*
+ < APPEND >(< S >)*
+ (list = listModifyDirectiveArgs(0))
+ (< RPARAN >)? < COMMA >(< S >)*
+ (remove = listModifyDirectiveArgs(1))
+ ( < COMMA >(< S >)* n = < IDENT >{ separator = n.image; } (< S >)*)?
+ < RPARAN >(< S >)* < SEMICOLON >(< S >)*
+
+ { documentHandler.appendDirective(variable,list,remove,separator); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void removeDirective() :\r{\r String list = null;
+ String remove = null;
+ String separator = null;
+ String variable = null;
+ Token n = null;
+}
+{
+ n = < VARIABLE >{ variable = n.image; }(< S >)* ":" (< S >)*
+ < REMOVE >(< S >)*
+ (list = listModifyDirectiveArgs(0))
+ (< RPARAN >)? < COMMA >(< S >)*
+ (remove = listModifyDirectiveArgs(1))
+ ( < COMMA >(< S >)* n = < IDENT >{ separator = n.image; } (< S >)*)?
+ < RPARAN >(< S >)* < SEMICOLON >(< S >)*
+
+ { documentHandler.removeDirective(variable,list,remove,separator); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void containsDirective() :
+{
+ String list = null;
+ String remove = null;
+ String separator = null;
+ String variable = null;
+ Token n = null;
+}
+{
+ n = < VARIABLE >{ variable = n.image; }(< S >)* ":" (< S >)*
+ < CONTAINS >(< S >)*
+ (list = listModifyDirectiveArgs(0))
+ (< RPARAN >)? < COMMA >(< S >)*
+ (remove = listModifyDirectiveArgs(1))
+ ( < COMMA >(< S >)* n = < IDENT >{ separator = n.image; } (< S >)*)?
+ < RPARAN >(< S >)* < SEMICOLON >(< S >)*
+
+ { documentHandler.containsDirective(variable,list,remove,separator); }
+}
+
+JAVACODE
+String listModifyDirectiveArgs(int nest)\r{
+ String list = "";
+ int nesting = nest;
+ Token t = null;
+
+ while(true)\r {\r t = getToken(1);
+ String s = t.image;
+ if(t.kind == VARIABLE||t.kind == IDENT)\r {
+ list += s;
+ }else if(s.toLowerCase().equals("auto")||s.toLowerCase().equals("space")||s.toLowerCase().equals("comma"))\r {
+ int i = 2;
+ Token temp = getToken(i);
+ boolean isLast = true;
+ while(temp.kind != SEMICOLON)
+ {\r if(temp.kind != RPARAN || temp.kind != S)
+ {\r isLast = false;\r }
+ i++;
+ temp = getToken(i);
+ }
+
+ if(isLast)\r {\r return list;
+ }
+ }\r else if(t.kind == STRING)\r {\r list += s.substring(1,s.length()).substring(0,s.length()-2);
+
+ }else if(t.kind == LPARAN)\r {\r nesting++;
+ if(nesting > nest+1)\r {\r throw new CSSParseException("Only one ( ) pair per parameter allowed", getLocator());
+ }
+ }else if(t.kind == RPARAN)\r {\r nesting--;
+ if(nesting == 0)\r {
+ return list;
+ }
+ } else if(t.kind == COMMA)\r {
+ if(nesting == nest)\r {
+ return list;\r }else\r {
+ list += ",";\r }
+
+ }else if(t.kind == S)\r {
+ list += " ";\r } else if(t.kind == LBRACE)\r {
+ throw new CSSParseException("Invalid token,'{' found", getLocator());\r }
+ \r getNextToken();
+ }
+}
+
+Node returnDirective() :
+{
+ String raw;
+}
+{
+ raw = skipStatement()
+ {return null;}
+}
+
+JAVACODE
+void debugDirective(){
+}
+
+JAVACODE
+void warnDirective(){
+}
+
+Node forDirective() :
+{
+ String var;
+ String from;
+ String to;
+ boolean exclusive;
+ String body;
+ Token tok;
+}
+{
+ var = variableName()
+ {
+ int[] toThrough = {TO, THROUGH};
+ from = skipStatementUntil(toThrough);
+ }
+ (tok = <TO> {exclusive = true;}
+ | tok = <THROUGH> {exclusive = false;})
+ to = skipStatementUntilLeftBrace()
+ (<S>)*
+ body = skipStatement()
+ {return documentHandler.forDirective(var, from, to, exclusive, body);}
+}
+
+Node whileDirective() :
+{
+ String condition;
+ String body;
+}
+{
+ condition = skipStatementUntilLeftBrace()
+ body = skipStatement()
+ { return documentHandler.whileDirective(condition, body);}
+}
+
+void extendDirective() :
+{ArrayList<String> list;}
+{
+ <EXTEND_SYM>
+ (<S>)*
+ list = selectorList()
+ (";"(<S>)*)+
+ {documentHandler.extendDirective(list);}
+}
+
+JAVACODE
+Node importDirective(){
+ return null;
+}
+
+JAVACODE
+Node charsetDirective(){
+ return null;
+}
+
+JAVACODE
+Node mozDocumentDirective(){
+ return null;
+}
+
+JAVACODE
+Node supportsDirective(){
+ return null;
+}
+
+
+void nestedProperties():
+{String name;
+LexicalUnit exp;}
+{
+ name=property()
+ ":" ( <S> )*
+ <LBRACE> (<S>)*
+ {
+ documentHandler.startNestedProperties(name);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE>
+ {
+ documentHandler.endNestedProperties(name);
+ }
+ (<S>)*
+}
+/**
+ * @exception ParseException exception during the parse
+ */
+void declarationOrNestedProperties() :
+{ boolean important = false;
+ String name;
+ LexicalUnitImpl exp;
+ Token save;
+ String comment = null;
+}
+{
+ try {
+ name=property()
+ { save = token; }
+ ":" ( <S> )*
+ (exp=expr() ( important=prio() )?
+ {
+ Token next = getToken(1);
+ if(next.kind == SEMICOLON || next.kind == RBRACE){
+ while(next.kind == SEMICOLON){
+ skipStatement();
+ next = getToken(1);
+ }
+ if(token.specialToken!=null){
+ documentHandler.property(name, exp, important, token.specialToken.image);
+ }else{
+ documentHandler.property(name, exp, important, null);
+ }
+ }
+ }
+ |<LBRACE> (<S>)*
+ {
+ documentHandler.startNestedProperties(name);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE>(<S>)*
+ {
+ documentHandler.endNestedProperties(name);
+ }
+ )
+
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void declaration() :
+{ boolean important = false;
+ String name;
+ LexicalUnit exp;
+ Token save;
+}
+{
+ try {
+ name=property()
+ { save = token; }
+ ":" ( <S> )* exp=expr() ( important=prio() )?
+ {
+ documentHandler.property(name, exp, important);
+ }
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+boolean prio() :
+{}
+{
+ <IMPORTANT_SYM> ( <S> )* { return true; }
+}
+
+boolean guarded() :
+{}
+{
+ <GUARDED_SYM> (<S>)* {return true;}
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl operator(LexicalUnitImpl prev) :
+{Token n;}
+{
+n="/" ( <S> )* { return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev); }
+| n="," ( <S> )* { return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl expr() :
+{
+ LexicalUnitImpl first, res;
+ char op;
+}
+{
+ first=term(null){ res = first; }
+ ( LOOKAHEAD(2) ( res=operator(res) )? res=term(res))*
+ { return first; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+char unaryOperator() :
+{}
+{
+ "-" { return '-'; }
+| "+" { return '+'; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl term(LexicalUnitImpl prev) :
+{ LexicalUnitImpl result = null;
+ Token n = null;
+ char op = ' ';
+}
+{
+ (result = nonVariableTerm(prev)| result = variableTerm(prev))
+ {
+ return result;
+ }
+}
+
+LexicalUnitImpl variableTerm(LexicalUnitImpl prev) :\r{
+ LexicalUnitImpl result = null;
+ String varName = "";\r}\r{
+ varName = variableName()
+ {result = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
+ prev, varName); return result;}\r}
+
+LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev) :\r{\rLexicalUnitImpl result = null;
+ Token n = null;
+ char op = ' ';
+ String varName;
+ String s = "";
+}
+{
+( ( ( op=unaryOperator() )?
+ (
+ n=<NUMBER>
+ { result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
+ prev, number(op, n, 0)); }
+ | n=<PERCENTAGE>
+ { result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1)); }
+ | n=<PT>
+ { result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<CM>
+ { result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<MM>
+ { result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<PC>
+ { result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<IN>
+ { result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<PX>
+ { result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<EMS>
+ { result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<EXS>
+ { result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<DEG>
+ { result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<RAD>
+ { result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<GRAD>
+ { result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<SECOND>
+ { result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1)); }
+ | n=<MS>
+ { result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<HZ>
+ { result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<KHZ>
+ { result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<DIMEN>
+ {
+ s = n.image;
+ int i = 0;
+ while (i < s.length()
+ && (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=function(op, prev) ) )
+ | ( n=<STRING>
+ { result =
+ LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
+ convertStringIndex(n.image, 1,
+ n.image.length() -1));}
+ | (< DOT >{ s+="."; })?n=<IDENT>
+ { s += convertIdent(n.image);
+ if ("inherit".equals(s)) {
+ result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
+ prev);
+ } else {
+ result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, convertIdent(n.image));
+ }
+
+ /* /
+ Auto correction code used in the CSS Validator but must not
+ be used by a conformant CSS2 parser.
+ * Common error :
+ * H1 {
+ * color : black
+ * background : white
+ * }
+ *
+ Token t = getToken(1);
+ Token semicolon = new Token();
+ semicolon.kind = SEMICOLON;
+ semicolon.image = ";";
+ if (t.kind == COLON) {
+ // @@SEEME. (generate a warning?)
+ // @@SEEME if expression is a single ident,
+ generate an error ?
+ rejectToken(semicolon);
+
+ result = prev;
+ }
+ / */
+ }
+ | result=hexcolor(prev)
+ | result=url(prev)
+ | result=unicode(prev)
+ ) ) ( <S> )*
+ {
+ return result;\r }\r}
+
+/**
+ * Handle all CSS2 functions.
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl function(char operator, LexicalUnitImpl prev) :
+{Token n;
+ LexicalUnit params = null;
+}
+{
+ n=<FUNCTION> ( <S> )*
+ {
+ String fname = convertIdent(n.image);
+ if("alpha(".equals(fname)){
+ String body = skipStatementUntilSemiColon();
+ return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ null, "alpha("+body);
+ }
+ }
+ ( params=expr() )? ")"
+ {
+ if (operator != ' ') {
+ throw new CSSParseException("invalid operator before a function.",
+ getLocator());
+ }
+ String f = convertIdent(n.image);
+ LexicalUnitImpl l = (LexicalUnitImpl) params;
+ boolean loop = true;
+ if ("rgb(".equals(f)) {
+ // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
+ && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ if (loop) {
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ }
+ if ((i == 5) && loop && (l == null)) {
+ return LexicalUnitImpl.createRGBColor(n.beginLine,
+ n.beginColumn,
+ prev, params);
+ } else {
+ if (errorHandler != null) {
+ String errorText;
+ Locator loc;
+ if (i < 5) {
+ if (params == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters.";
+ } else if (l == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters: "
+ + params.toString();
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "invalid parameter: "
+ + l.toString();
+ }
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "too many parameters: "
+ + l.toString();
+ }
+ errorHandler.error(new CSSParseException(errorText, loc));
+ }
+
+ throw new JumpException();
+ }
+ } else if ("counter".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 3) {
+ switch (i) {
+ case 0:
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 1:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 1) || (i == 3)) && loop && (l == null)) {
+ return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+
+ } else if ("counters(".equals(f)) {
+
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 4:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 3) || (i == 5)) && loop && (l == null)) {
+ return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+ } else if ("attr(".equals(f)) {
+ if ((l != null)
+ && (l.getNextLexicalUnit() == null)
+ && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
+ return LexicalUnitImpl.createAttr(l.getLineNumber(),
+ l.getColumnNumber(),
+ prev, l.getStringValue());
+ }
+ } else if ("rect(".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 7) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ switch (l.getLexicalUnitType()) {
+ case LexicalUnit.SAC_INTEGER:
+ if (l.getIntegerValue() != 0) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_IDENT:
+ if (!l.getStringValue().equals("auto")) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_EM:
+ case LexicalUnit.SAC_EX:
+ case LexicalUnit.SAC_PIXEL:
+ case LexicalUnit.SAC_CENTIMETER:
+ case LexicalUnit.SAC_MILLIMETER:
+ case LexicalUnit.SAC_INCH:
+ case LexicalUnit.SAC_POINT:
+ case LexicalUnit.SAC_PICA:
+ // nothing
+ break;
+ default:
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ case 5:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if ((i == 7) && loop && (l == null)) {
+ return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+ }
+ return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
+ f.substring(0,
+ f.length() -1),
+ params);
+ }
+}
+
+LexicalUnitImpl unicode(LexicalUnitImpl prev) :
+{ Token n;
+}
+{
+ n=<UNICODERANGE>
+ {
+ LexicalUnitImpl params = null;
+ String s = n.image.substring(2);
+ int index = s.indexOf('-');
+ if (index == -1) {
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s, 16));
+ } else {
+ String s1 = s.substring(0, index);
+ String s2 = s.substring(index);
+
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s1, 16));
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s2, 16));
+ }
+
+ return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+}
+
+LexicalUnitImpl url(LexicalUnitImpl prev) :
+{ Token n;
+}
+{
+ n=<URL>
+ {
+ String urlname = n.image.substring(4, n.image.length()-1).trim();
+ return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname);
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl hexcolor(LexicalUnitImpl prev) :
+{Token n;
+}
+{
+ n=<HASH>
+ {
+ int r;
+ LexicalUnitImpl first, params = null;
+ String s = n.image.substring(1);
+
+ if(s.length()!=3 && s.length()!=6) {
+ first = null;
+ throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
+ getLocator());
+ }
+ return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, n.image);
+ }
+}
+
+JAVACODE
+float number(char operator, Token n, int lengthUnit) {
+ String image = n.image;
+ float f = 0;
+
+ if (lengthUnit != 0) {
+ image = image.substring(0, image.length() - lengthUnit);
+ }
+ f = Float.valueOf(image).floatValue();
+ return (operator == '-')? -f: f;
+}
+
+JAVACODE
+String skipStatementUntilSemiColon(){
+ int[] semicolon = {SEMICOLON};
+ return skipStatementUntil(semicolon);
+}
+
+JAVACODE
+String skipStatementUntilLeftBrace(){
+ int[] lBrace = {LBRACE};
+ return skipStatementUntil(lBrace);
+}
+
+JAVACODE
+String skipStatementUntilRightParan(){
+ int[] rParan = {RPARAN};
+ return skipStatementUntil(rParan);
+}
+
+JAVACODE
+String skipStatementUntil(int[] symbols){
+ StringBuffer s = new StringBuffer();
+ boolean stop = false;
+ Token tok;
+ while(!stop){
+ tok = getToken(1);
+ if(tok.kind == EOF) {
+ return null;
+ }
+ for(int sym : symbols){
+ if(tok.kind == sym){
+ stop = true;
+ break;
+ }
+ }
+ if(!stop){
+ if (tok.image != null) {
+ s.append(tok.image);
+ }
+ getNextToken();
+ }
+ }
+ return s.toString().trim();
+}
+
+
+JAVACODE
+String skipStatement() {
+ StringBuffer s = new StringBuffer();
+ Token tok = getToken(0);
+ if (tok.image != null) {
+ s.append(tok.image);
+ }
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ return null;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ getNextToken();
+ s.append(skip_to_matching_brace());
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == RBRACE) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == SEMICOLON) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ }
+ getNextToken();
+ }
+
+ // skip white space
+ while (true) {
+ if (tok.kind != S) {
+ break;
+ }
+ tok = getNextToken();
+ tok = getToken(1);
+ }
+
+ return s.toString().trim();
+}
+
+JAVACODE
+String skip_to_matching_brace() {
+ StringBuffer s = new StringBuffer();
+ Token tok;
+ int nesting = 1;
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ break;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ nesting++;
+ } else if (tok.kind == RBRACE) {
+ nesting--;
+ if (nesting == 0) {
+ break;
+ }
+ }
+ getNextToken();
+ }
+ return s.toString();
+}
+
+/*
+ * Here I handle all CSS2 unicode character stuffs.
+ * I convert all \XXXXXX character into a single character.
+ * Don't forget that the parser has recognize the token before.
+ * (So IDENT won't contain newline and stuffs like this).
+ */
+JAVACODE
+String convertStringIndex(String s, int start, int len) {
+ StringBuffer buf = new StringBuffer(len);
+ int index = start;
+
+ while (index < len) {
+ char c = s.charAt(index);
+ if (c == '\\') {
+ if (++index < len) {
+ c = s.charAt(index);
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ int numValue = Character.digit(c, 16);
+ int count = 0;
+ int p = 16;
+
+ while (index + 1 < len && count < 6) {
+ c = s.charAt(index+1);
+
+ if (Character.digit(c, 16) != -1) {
+ numValue = (numValue * 16) + Character.digit(c, 16);
+ p *= 16;
+ index++;
+ } else {
+ if (c == ' ') {
+ // skip the latest white space
+ index++;
+ }
+ break;
+ }
+ }
+ buf.append((char) numValue);
+ break;
+ case '\n':
+ case '\f':
+ break;
+ case '\r':
+ if (index + 1 < len) {
+ if (s.charAt(index + 1) == '\n') {
+ index ++;
+ }
+ }
+ break;
+ default:
+ buf.append(c);
+ }
+ } else {
+ throw new CSSParseException("invalid string " + s, getLocator());
+ }
+ } else {
+ buf.append(c);
+ }
+ index++;
+ }
+
+ return buf.toString();
+}
+
+JAVACODE
+String convertIdent(String s) {
+ return convertStringIndex(s, 0, s.length());
+}
+
+JAVACODE
+String convertString(String s) {
+ return convertStringIndex(s, 0, s.length());
+}
+
+JAVACODE
+void comments(){
+ 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;
+ }
+ }
+}
+
+/*
+ * @@HACK
+ * I can't insert a token into the tokens flow.
+ * It's jj_consume_token implementation dependant! :-(
+ */
+JAVACODE
+void rejectToken(Token t) {
+ Token fakeToken = new Token();
+ t.next = token;
+ fakeToken.next = t;
+ token = fakeToken;
+}
+
+/**
+ * skip after an expression
+ */
+JAVACODE
+String skipAfterExpression() {
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+
+ while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+
+ return s.toString();
+}
+
+/**
+ * The following functions are useful for a DOM CSS implementation only and are
+ * not part of the general CSS2 parser.
+ */
+
+void _parseRule() :
+{String ret = null;
+}
+{
+ ( <S> )*
+ ( importDeclaration() | styleRule() | media() | page()
+ | fontFace() | ret=skipStatement()
+ {
+ if ((ret == null) || (ret.length() == 0)) {
+ return;
+ }
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ } else {
+ throw new CSSParseException("unrecognize rule: " + ret,
+ getLocator());
+ }
+ }
+ )
+}
+
+void _parseImportRule() :
+{
+}
+{
+ ( <S> )* importDeclaration()
+}
+
+void _parseMediaRule() :
+{
+}
+{
+ ( <S> )* media()
+}
+
+void _parseDeclarationBlock() :
+{
+}
+{
+ ( <S> )*
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ }
+
+ArrayList<String> _parseSelectors() :
+{ ArrayList<String> p = null;
+}
+{
+ try {
+ ( <S> )* p = selectorList()
+ { return p; }
+ } catch (ThrowedParseException e) {
+ throw (ParseException) e.e.fillInStackTrace();
+ }
+}
+
+/*
+ * Local Variables:
+ * compile-command: javacc Parser.jj & javac Parser.java
+ * End:
+ */
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */
+package com.vaadin.sass.internal.parser;
+
+
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
+public interface ParserConstants {
+
+ /** End of File. */
+ int EOF = 0;
+ /** RegularExpression Id. */
+ int S = 1;
+ /** RegularExpression Id. */
+ int FORMAL_COMMENT = 7;
+ /** RegularExpression Id. */
+ int MULTI_LINE_COMMENT = 8;
+ /** RegularExpression Id. */
+ int CDO = 10;
+ /** RegularExpression Id. */
+ int CDC = 11;
+ /** RegularExpression Id. */
+ int LBRACE = 12;
+ /** RegularExpression Id. */
+ int RBRACE = 13;
+ /** RegularExpression Id. */
+ int DASHMATCH = 14;
+ /** RegularExpression Id. */
+ int CARETMATCH = 15;
+ /** RegularExpression Id. */
+ int DOLLARMATCH = 16;
+ /** RegularExpression Id. */
+ int STARMATCH = 17;
+ /** RegularExpression Id. */
+ int INCLUDES = 18;
+ /** RegularExpression Id. */
+ int EQ = 19;
+ /** RegularExpression Id. */
+ int PLUS = 20;
+ /** RegularExpression Id. */
+ int MINUS = 21;
+ /** RegularExpression Id. */
+ int COMMA = 22;
+ /** RegularExpression Id. */
+ int SEMICOLON = 23;
+ /** RegularExpression Id. */
+ int PRECEDES = 24;
+ /** RegularExpression Id. */
+ int SUCCEEDS = 25;
+ /** RegularExpression Id. */
+ int DIV = 26;
+ /** RegularExpression Id. */
+ int LBRACKET = 27;
+ /** RegularExpression Id. */
+ int RBRACKET = 28;
+ /** RegularExpression Id. */
+ int ANY = 29;
+ /** RegularExpression Id. */
+ int PARENT = 30;
+ /** RegularExpression Id. */
+ int DOT = 31;
+ /** RegularExpression Id. */
+ int LPARAN = 32;
+ /** RegularExpression Id. */
+ int RPARAN = 33;
+ /** RegularExpression Id. */
+ int COMPARE = 34;
+ /** RegularExpression Id. */
+ int OR = 35;
+ /** RegularExpression Id. */
+ int AND = 36;
+ /** RegularExpression Id. */
+ int NOT_EQ = 37;
+ /** RegularExpression Id. */
+ int COLON = 38;
+ /** RegularExpression Id. */
+ int INTERPOLATION = 39;
+ /** RegularExpression Id. */
+ int NONASCII = 40;
+ /** RegularExpression Id. */
+ int H = 41;
+ /** RegularExpression Id. */
+ int UNICODE = 42;
+ /** RegularExpression Id. */
+ int ESCAPE = 43;
+ /** RegularExpression Id. */
+ int NMSTART = 44;
+ /** RegularExpression Id. */
+ int NMCHAR = 45;
+ /** RegularExpression Id. */
+ int STRINGCHAR = 46;
+ /** RegularExpression Id. */
+ int D = 47;
+ /** RegularExpression Id. */
+ int NAME = 48;
+ /** RegularExpression Id. */
+ int TO = 49;
+ /** RegularExpression Id. */
+ int THROUGH = 50;
+ /** RegularExpression Id. */
+ int EACH_IN = 51;
+ /** RegularExpression Id. */
+ int MIXIN_SYM = 52;
+ /** RegularExpression Id. */
+ int INCLUDE_SYM = 53;
+ /** RegularExpression Id. */
+ int FUNCTION_SYM = 54;
+ /** RegularExpression Id. */
+ int RETURN_SYM = 55;
+ /** RegularExpression Id. */
+ int DEBUG_SYM = 56;
+ /** RegularExpression Id. */
+ int WARN_SYM = 57;
+ /** RegularExpression Id. */
+ int FOR_SYM = 58;
+ /** RegularExpression Id. */
+ int EACH_SYM = 59;
+ /** RegularExpression Id. */
+ int WHILE_SYM = 60;
+ /** RegularExpression Id. */
+ int IF_SYM = 61;
+ /** RegularExpression Id. */
+ int ELSE_SYM = 62;
+ /** RegularExpression Id. */
+ int EXTEND_SYM = 63;
+ /** RegularExpression Id. */
+ int MOZ_DOCUMENT_SYM = 64;
+ /** RegularExpression Id. */
+ int SUPPORTS_SYM = 65;
+ /** RegularExpression Id. */
+ int MICROSOFT_RULE = 66;
+ /** RegularExpression Id. */
+ int IF = 67;
+ /** RegularExpression Id. */
+ int GUARDED_SYM = 68;
+ /** RegularExpression Id. */
+ int STRING = 69;
+ /** RegularExpression Id. */
+ int IDENT = 70;
+ /** RegularExpression Id. */
+ int NUMBER = 71;
+ /** RegularExpression Id. */
+ int _URL = 72;
+ /** RegularExpression Id. */
+ int URL = 73;
+ /** RegularExpression Id. */
+ int VARIABLE = 74;
+ /** RegularExpression Id. */
+ int PERCENTAGE = 75;
+ /** RegularExpression Id. */
+ int PT = 76;
+ /** RegularExpression Id. */
+ int MM = 77;
+ /** RegularExpression Id. */
+ int CM = 78;
+ /** RegularExpression Id. */
+ int PC = 79;
+ /** RegularExpression Id. */
+ int IN = 80;
+ /** RegularExpression Id. */
+ int PX = 81;
+ /** RegularExpression Id. */
+ int EMS = 82;
+ /** RegularExpression Id. */
+ int EXS = 83;
+ /** RegularExpression Id. */
+ int DEG = 84;
+ /** RegularExpression Id. */
+ int RAD = 85;
+ /** RegularExpression Id. */
+ int GRAD = 86;
+ /** RegularExpression Id. */
+ int MS = 87;
+ /** RegularExpression Id. */
+ int SECOND = 88;
+ /** RegularExpression Id. */
+ int HZ = 89;
+ /** RegularExpression Id. */
+ int KHZ = 90;
+ /** RegularExpression Id. */
+ int DIMEN = 91;
+ /** RegularExpression Id. */
+ int HASH = 92;
+ /** RegularExpression Id. */
+ int IMPORT_SYM = 93;
+ /** RegularExpression Id. */
+ int MEDIA_SYM = 94;
+ /** RegularExpression Id. */
+ int CHARSET_SYM = 95;
+ /** RegularExpression Id. */
+ int PAGE_SYM = 96;
+ /** RegularExpression Id. */
+ int FONT_FACE_SYM = 97;
+ /** RegularExpression Id. */
+ int ATKEYWORD = 98;
+ /** RegularExpression Id. */
+ int IMPORTANT_SYM = 99;
+ /** RegularExpression Id. */
+ int RANGE0 = 100;
+ /** RegularExpression Id. */
+ int RANGE1 = 101;
+ /** RegularExpression Id. */
+ int RANGE2 = 102;
+ /** RegularExpression Id. */
+ int RANGE3 = 103;
+ /** RegularExpression Id. */
+ int RANGE4 = 104;
+ /** RegularExpression Id. */
+ int RANGE5 = 105;
+ /** RegularExpression Id. */
+ int RANGE6 = 106;
+ /** RegularExpression Id. */
+ int RANGE = 107;
+ /** RegularExpression Id. */
+ int UNI = 108;
+ /** RegularExpression Id. */
+ int UNICODERANGE = 109;
+ /** RegularExpression Id. */
+ int REMOVE = 110;
+ /** RegularExpression Id. */
+ int APPEND = 111;
+ /** RegularExpression Id. */
+ int CONTAINS = 112;
+ /** RegularExpression Id. */
+ int FUNCTION = 113;
+ /** RegularExpression Id. */
+ int UNKNOWN = 114;
+
+ /** Lexical state. */
+ int DEFAULT = 0;
+ /** Lexical state. */
+ int IN_SINGLE_LINE_COMMENT = 1;
+ /** Lexical state. */
+ int IN_FORMAL_COMMENT = 2;
+ /** Lexical state. */
+ int IN_MULTI_LINE_COMMENT = 3;
+
+ /** Literal token values. */
+ String[] tokenImage = {
+ "<EOF>",
+ "<S>",
+ "\"//\"",
+ "<token of kind 3>",
+ "<token of kind 4>",
+ "<token of kind 5>",
+ "\"/*\"",
+ "\"*/\"",
+ "\"*/\"",
+ "<token of kind 9>",
+ "\"<!--\"",
+ "\"-->\"",
+ "\"{\"",
+ "\"}\"",
+ "\"|=\"",
+ "\"^=\"",
+ "\"$=\"",
+ "\"*=\"",
+ "\"~=\"",
+ "\"=\"",
+ "\"+\"",
+ "\"-\"",
+ "\",\"",
+ "\";\"",
+ "\">\"",
+ "\"<\"",
+ "\"/\"",
+ "\"[\"",
+ "\"]\"",
+ "\"*\"",
+ "\"&\"",
+ "\".\"",
+ "\"(\"",
+ "\")\"",
+ "\"==\"",
+ "\"||\"",
+ "\"&&\"",
+ "\"!=\"",
+ "\":\"",
+ "<INTERPOLATION>",
+ "<NONASCII>",
+ "<H>",
+ "<UNICODE>",
+ "<ESCAPE>",
+ "<NMSTART>",
+ "<NMCHAR>",
+ "<STRINGCHAR>",
+ "<D>",
+ "<NAME>",
+ "\"to\"",
+ "\"through\"",
+ "\"in\"",
+ "\"@mixin\"",
+ "\"@include\"",
+ "\"@function\"",
+ "\"@return\"",
+ "\"@debug\"",
+ "\"@warn\"",
+ "\"@for\"",
+ "\"@each\"",
+ "\"@while\"",
+ "\"@if\"",
+ "\"@else\"",
+ "\"@extend\"",
+ "\"@-moz-document\"",
+ "\"@supports\"",
+ "<MICROSOFT_RULE>",
+ "\"if\"",
+ "<GUARDED_SYM>",
+ "<STRING>",
+ "<IDENT>",
+ "<NUMBER>",
+ "<_URL>",
+ "<URL>",
+ "<VARIABLE>",
+ "<PERCENTAGE>",
+ "<PT>",
+ "<MM>",
+ "<CM>",
+ "<PC>",
+ "<IN>",
+ "<PX>",
+ "<EMS>",
+ "<EXS>",
+ "<DEG>",
+ "<RAD>",
+ "<GRAD>",
+ "<MS>",
+ "<SECOND>",
+ "<HZ>",
+ "<KHZ>",
+ "<DIMEN>",
+ "<HASH>",
+ "\"@import\"",
+ "\"@media\"",
+ "\"@charset\"",
+ "\"@page\"",
+ "\"@font-face\"",
+ "<ATKEYWORD>",
+ "<IMPORTANT_SYM>",
+ "<RANGE0>",
+ "<RANGE1>",
+ "<RANGE2>",
+ "<RANGE3>",
+ "<RANGE4>",
+ "<RANGE5>",
+ "<RANGE6>",
+ "<RANGE>",
+ "<UNI>",
+ "<UNICODERANGE>",
+ "<REMOVE>",
+ "<APPEND>",
+ "<CONTAINS>",
+ "<FUNCTION>",
+ "<UNKNOWN>",
+ };
+
+}
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */
+package com.vaadin.sass.internal.parser;
+import java.io.*;
+import java.net.*;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.Map;
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.ErrorHandler;
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.Locator;
+import org.w3c.css.sac.LexicalUnit;
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+import org.w3c.flute.util.Encoding;
+import com.vaadin.sass.internal.handler.*;
+import com.vaadin.sass.internal.tree.*;
+
+/** Token Manager. */
+public class ParserTokenManager implements ParserConstants
+{
+
+ /** Debug output. */
+ public java.io.PrintStream debugStream = System.out;
+ /** Set debug output. */
+ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0xfff0000000000000L) != 0L || (active1 & 0x3e0000003L) != 0L)
+ return 111;
+ if ((active0 & 0x10000L) != 0L)
+ return 79;
+ if ((active0 & 0xe000000000000L) != 0L || (active1 & 0x8L) != 0L)
+ {
+ jjmatchedKind = 70;
+ return 441;
+ }
+ if ((active0 & 0x80000000L) != 0L)
+ return 442;
+ if ((active0 & 0x2000000000L) != 0L)
+ return 443;
+ if ((active0 & 0x4000044L) != 0L)
+ return 3;
+ if ((active0 & 0x200800L) != 0L)
+ return 42;
+ return -1;
+ case 1:
+ if ((active0 & 0x4000000000000L) != 0L)
+ {
+ jjmatchedKind = 70;
+ jjmatchedPos = 1;
+ return 441;
+ }
+ if ((active1 & 0x1L) != 0L)
+ return 112;
+ if ((active0 & 0xa000000000000L) != 0L || (active1 & 0x8L) != 0L)
+ return 441;
+ if ((active0 & 0xfff0000000000000L) != 0L || (active1 & 0x3e0000002L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 1;
+ return 444;
+ }
+ if ((active0 & 0x40L) != 0L)
+ return 1;
+ return -1;
+ case 2:
+ if ((active0 & 0xdff0000000000000L) != 0L || (active1 & 0x3e0000003L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 2;
+ return 444;
+ }
+ if ((active0 & 0x2000000000000000L) != 0L)
+ return 444;
+ if ((active0 & 0x4000000000000L) != 0L)
+ {
+ jjmatchedKind = 70;
+ jjmatchedPos = 2;
+ return 441;
+ }
+ return -1;
+ case 3:
+ if ((active0 & 0x4000000000000L) != 0L)
+ {
+ jjmatchedKind = 70;
+ jjmatchedPos = 3;
+ return 441;
+ }
+ if ((active0 & 0xdbf0000000000000L) != 0L || (active1 & 0x3e0000003L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 3;
+ return 444;
+ }
+ if ((active0 & 0x400000000000000L) != 0L)
+ return 444;
+ return -1;
+ case 4:
+ if ((active0 & 0x91f0000000000000L) != 0L || (active1 & 0x2e0000003L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 4;
+ return 444;
+ }
+ if ((active0 & 0x4a00000000000000L) != 0L || (active1 & 0x100000000L) != 0L)
+ return 444;
+ if ((active0 & 0x4000000000000L) != 0L)
+ {
+ jjmatchedKind = 70;
+ jjmatchedPos = 4;
+ return 441;
+ }
+ return -1;
+ case 5:
+ if ((active0 & 0x1110000000000000L) != 0L || (active1 & 0x40000000L) != 0L)
+ return 444;
+ if ((active0 & 0x80e0000000000000L) != 0L || (active1 & 0x2a0000003L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 5;
+ return 444;
+ }
+ if ((active0 & 0x4000000000000L) != 0L)
+ {
+ jjmatchedKind = 70;
+ jjmatchedPos = 5;
+ return 441;
+ }
+ return -1;
+ case 6:
+ if ((active0 & 0x4000000000000L) != 0L)
+ return 441;
+ if ((active0 & 0x8080000000000000L) != 0L || (active1 & 0x20000000L) != 0L)
+ return 444;
+ if ((active0 & 0x60000000000000L) != 0L || (active1 & 0x280000003L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 6;
+ return 444;
+ }
+ return -1;
+ case 7:
+ if ((active0 & 0x20000000000000L) != 0L || (active1 & 0x80000000L) != 0L)
+ return 444;
+ if ((active0 & 0x40000000000000L) != 0L || (active1 & 0x200000003L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 7;
+ return 444;
+ }
+ return -1;
+ case 8:
+ if ((active1 & 0x200000001L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 8;
+ return 444;
+ }
+ if ((active0 & 0x40000000000000L) != 0L || (active1 & 0x2L) != 0L)
+ return 444;
+ return -1;
+ case 9:
+ if ((active1 & 0x1L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 9;
+ return 444;
+ }
+ if ((active1 & 0x200000000L) != 0L)
+ return 444;
+ return -1;
+ case 10:
+ if ((active1 & 0x1L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 10;
+ return 444;
+ }
+ return -1;
+ case 11:
+ if ((active1 & 0x1L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 11;
+ return 444;
+ }
+ return -1;
+ case 12:
+ if ((active1 & 0x1L) != 0L)
+ {
+ jjmatchedKind = 98;
+ jjmatchedPos = 12;
+ return 444;
+ }
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0, long active1)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1);
+}
+private int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 33:
+ return jjMoveStringLiteralDfa1_0(0x2000000000L, 0x0L);
+ case 36:
+ return jjMoveStringLiteralDfa1_0(0x10000L, 0x0L);
+ case 38:
+ jjmatchedKind = 30;
+ return jjMoveStringLiteralDfa1_0(0x1000000000L, 0x0L);
+ case 40:
+ return jjStopAtPos(0, 32);
+ case 41:
+ return jjStopAtPos(0, 33);
+ case 42:
+ jjmatchedKind = 29;
+ return jjMoveStringLiteralDfa1_0(0x20000L, 0x0L);
+ case 43:
+ return jjStopAtPos(0, 20);
+ case 44:
+ return jjStopAtPos(0, 22);
+ case 45:
+ jjmatchedKind = 21;
+ return jjMoveStringLiteralDfa1_0(0x800L, 0x0L);
+ case 46:
+ return jjStartNfaWithStates_0(0, 31, 442);
+ case 47:
+ jjmatchedKind = 26;
+ return jjMoveStringLiteralDfa1_0(0x44L, 0x0L);
+ case 58:
+ return jjStopAtPos(0, 38);
+ case 59:
+ return jjStopAtPos(0, 23);
+ case 60:
+ jjmatchedKind = 25;
+ return jjMoveStringLiteralDfa1_0(0x400L, 0x0L);
+ case 61:
+ jjmatchedKind = 19;
+ return jjMoveStringLiteralDfa1_0(0x400000000L, 0x0L);
+ case 62:
+ return jjStopAtPos(0, 24);
+ case 64:
+ return jjMoveStringLiteralDfa1_0(0xfff0000000000000L, 0x3e0000003L);
+ case 91:
+ return jjStopAtPos(0, 27);
+ case 93:
+ return jjStopAtPos(0, 28);
+ case 94:
+ return jjMoveStringLiteralDfa1_0(0x8000L, 0x0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa1_0(0x8000000000000L, 0x8L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x6000000000000L, 0x0L);
+ case 123:
+ return jjStopAtPos(0, 12);
+ case 124:
+ return jjMoveStringLiteralDfa1_0(0x800004000L, 0x0L);
+ case 125:
+ return jjStopAtPos(0, 13);
+ case 126:
+ return jjMoveStringLiteralDfa1_0(0x40000L, 0x0L);
+ default :
+ return jjMoveNfa_0(4, 0);
+ }
+}
+private int jjMoveStringLiteralDfa1_0(long active0, long active1)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0, active1);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 33:
+ return jjMoveStringLiteralDfa2_0(active0, 0x400L, active1, 0L);
+ case 38:
+ if ((active0 & 0x1000000000L) != 0L)
+ return jjStopAtPos(1, 36);
+ break;
+ case 42:
+ if ((active0 & 0x40L) != 0L)
+ return jjStartNfaWithStates_0(1, 6, 1);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800L, active1, 0x1L);
+ case 47:
+ if ((active0 & 0x4L) != 0L)
+ return jjStopAtPos(1, 2);
+ break;
+ case 61:
+ if ((active0 & 0x4000L) != 0L)
+ return jjStopAtPos(1, 14);
+ else if ((active0 & 0x8000L) != 0L)
+ return jjStopAtPos(1, 15);
+ else if ((active0 & 0x10000L) != 0L)
+ return jjStopAtPos(1, 16);
+ else if ((active0 & 0x20000L) != 0L)
+ return jjStopAtPos(1, 17);
+ else if ((active0 & 0x40000L) != 0L)
+ return jjStopAtPos(1, 18);
+ else if ((active0 & 0x400000000L) != 0L)
+ return jjStopAtPos(1, 34);
+ else if ((active0 & 0x2000000000L) != 0L)
+ return jjStopAtPos(1, 37);
+ break;
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa2_0(active0, 0x100000000000000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa2_0(active0, 0xc800000000000000L, active1, 0L);
+ case 70:
+ case 102:
+ if ((active1 & 0x8L) != 0L)
+ return jjStartNfaWithStates_0(1, 67, 441);
+ return jjMoveStringLiteralDfa2_0(active0, 0x440000000000000L, active1, 0x200000000L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2020000000000000L, active1, 0x20000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x40000000L);
+ case 78:
+ case 110:
+ if ((active0 & 0x8000000000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 51, 441);
+ break;
+ case 79:
+ case 111:
+ if ((active0 & 0x2000000000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 49, 441);
+ break;
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x100000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L, active1, 0L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L);
+ case 87:
+ case 119:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1200000000000000L, active1, 0L);
+ case 124:
+ if ((active0 & 0x800000000L) != 0L)
+ return jjStopAtPos(1, 35);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0, active1);
+}
+private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(0, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0, active1);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400L, active1, 0L);
+ case 62:
+ if ((active0 & 0x800L) != 0L)
+ return jjStopAtPos(2, 11);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0xa00000000000000L, active1, 0x100000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa3_0(active0, 0x180000000000000L, active1, 0x40000000L);
+ case 70:
+ case 102:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 61, 444);
+ break;
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x80000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000000L, active1, 0L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x20000001L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0x200000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L, active1, 0x2L);
+ case 88:
+ case 120:
+ return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0, active1);
+}
+private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(1, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0, active1);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 45:
+ if ((active0 & 0x400L) != 0L)
+ return jjStopAtPos(3, 10);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active0, 0x100000000000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa4_0(active0, 0x820000000000000L, active1, 0L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x100000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000000000L, active1, 0x200000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L, active1, 0x1L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000002L);
+ case 82:
+ case 114:
+ if ((active0 & 0x400000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 58, 444);
+ return jjMoveStringLiteralDfa4_0(active0, 0x200000000000000L, active1, 0L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active0, 0x8080000000000000L, active1, 0L);
+ case 88:
+ case 120:
+ return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0, active1);
+}
+private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(2, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0, active1);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L, active1, 0L);
+ case 69:
+ case 101:
+ if ((active0 & 0x4000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 62, 444);
+ else if ((active1 & 0x100000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 96, 444);
+ return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000000L, active1, 0L);
+ case 72:
+ case 104:
+ if ((active0 & 0x800000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 59, 444);
+ break;
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x10000000000000L, active1, 0x40000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa5_0(active0, 0x1020000000000000L, active1, 0L);
+ case 78:
+ case 110:
+ if ((active0 & 0x200000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 57, 444);
+ break;
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x20000000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200000000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa5_0(active0, 0x184000000000000L, active1, 0L);
+ case 90:
+ case 122:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0, active1);
+}
+private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(3, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0, active1);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x200000001L);
+ case 65:
+ case 97:
+ if ((active1 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 94, 444);
+ break;
+ case 69:
+ case 101:
+ if ((active0 & 0x1000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 60, 444);
+ break;
+ case 71:
+ case 103:
+ if ((active0 & 0x100000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 56, 444);
+ return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L, active1, 0L);
+ case 78:
+ case 110:
+ if ((active0 & 0x10000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 52, 444);
+ return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa6_0(active0, 0x80000000000000L, active1, 0x20000000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa6_0(active0, 0x40000000000000L, active1, 0L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa6_0(active0, 0x20000000000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0, active1);
+}
+private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(4, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0, active1);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 68:
+ case 100:
+ if ((active0 & 0x8000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 63, 444);
+ return jjMoveStringLiteralDfa7_0(active0, 0x20000000000000L, active1, 0x1L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200000000L);
+ case 72:
+ case 104:
+ if ((active0 & 0x4000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 50, 441);
+ break;
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa7_0(active0, 0x40000000000000L, active1, 0L);
+ case 78:
+ case 110:
+ if ((active0 & 0x80000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 55, 444);
+ break;
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2L);
+ case 84:
+ case 116:
+ if ((active1 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 93, 444);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0, active1);
+}
+private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(5, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0, active1);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000000L);
+ case 69:
+ case 101:
+ if ((active0 & 0x20000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 53, 444);
+ break;
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa8_0(active0, 0x40000000000000L, active1, 0x1L);
+ case 84:
+ case 116:
+ if ((active1 & 0x80000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 95, 444);
+ return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x2L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0, active1);
+}
+private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(6, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0, active1);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x200000001L);
+ case 78:
+ case 110:
+ if ((active0 & 0x40000000000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 54, 444);
+ break;
+ case 83:
+ case 115:
+ if ((active1 & 0x2L) != 0L)
+ return jjStartNfaWithStates_0(8, 65, 444);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, active0, active1);
+}
+private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(7, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, 0L, active1);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ if ((active1 & 0x200000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 97, 444);
+ break;
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa10_0(active1, 0x1L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, 0L, active1);
+}
+private int jjMoveStringLiteralDfa10_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(8, 0L, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(9, 0L, active1);
+ return 10;
+ }
+ switch(curChar)
+ {
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa11_0(active1, 0x1L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(9, 0L, active1);
+}
+private int jjMoveStringLiteralDfa11_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(9, 0L, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(10, 0L, active1);
+ return 11;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa12_0(active1, 0x1L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(10, 0L, active1);
+}
+private int jjMoveStringLiteralDfa12_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(10, 0L, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(11, 0L, active1);
+ return 12;
+ }
+ switch(curChar)
+ {
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa13_0(active1, 0x1L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(11, 0L, active1);
+}
+private int jjMoveStringLiteralDfa13_0(long old1, long active1)
+{
+ if (((active1 &= old1)) == 0L)
+ return jjStartNfa_0(11, 0L, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(12, 0L, active1);
+ return 13;
+ }
+ switch(curChar)
+ {
+ case 84:
+ case 116:
+ if ((active1 & 0x1L) != 0L)
+ return jjStartNfaWithStates_0(13, 64, 444);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(12, 0L, active1);
+}
+private int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private int jjMoveNfa_0(int startState, int curPos)
+{
+ int startsAt = 0;
+ jjnewStateCnt = 441;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 442:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 4);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(252, 255);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(249, 251);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(247, 248);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(244, 246);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(239, 243);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(235, 238);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(231, 234);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(228, 230);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(225, 227);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(222, 224);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(219, 221);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(216, 218);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(213, 215);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(210, 212);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(207, 209);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(205, 206);
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 71)
+ kind = 71;
+ jjCheckNAdd(204);
+ }
+ break;
+ case 79:
+ if (curChar == 45)
+ jjCheckNAdd(80);
+ break;
+ case 443:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(189, 198);
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(181, 188);
+ break;
+ case 444:
+ case 113:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 441:
+ if ((0x3ff200000000000L & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ else if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(169, 170);
+ else if (curChar == 40)
+ {
+ if (kind > 113)
+ kind = 113;
+ }
+ if ((0x3ff200000000000L & l) != 0L)
+ {
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ }
+ break;
+ case 111:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 112;
+ break;
+ case 4:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 71)
+ kind = 71;
+ jjCheckNAddStates(9, 82);
+ }
+ else if ((0x100003600L & l) != 0L)
+ {
+ if (kind > 1)
+ kind = 1;
+ jjCheckNAdd(0);
+ }
+ else if (curChar == 46)
+ jjCheckNAddStates(83, 100);
+ else if (curChar == 45)
+ jjAddStates(101, 102);
+ else if (curChar == 33)
+ jjCheckNAddStates(103, 106);
+ else if (curChar == 35)
+ jjCheckNAddTwoStates(100, 101);
+ else if (curChar == 36)
+ jjCheckNAddStates(107, 110);
+ else if (curChar == 39)
+ jjCheckNAddStates(111, 114);
+ else if (curChar == 34)
+ jjCheckNAddStates(115, 118);
+ else if (curChar == 47)
+ jjstateSet[jjnewStateCnt++] = 3;
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 42;
+ else if (curChar == 35)
+ jjstateSet[jjnewStateCnt++] = 5;
+ break;
+ case 0:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 1)
+ kind = 1;
+ jjCheckNAdd(0);
+ break;
+ case 1:
+ if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 2;
+ break;
+ case 2:
+ if ((0xffff7fffffffffffL & l) != 0L && kind > 5)
+ kind = 5;
+ break;
+ case 3:
+ if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 6:
+ if (curChar == 36)
+ jjCheckNAddStates(119, 122);
+ break;
+ case 7:
+ if (curChar == 45)
+ jjCheckNAdd(8);
+ break;
+ case 9:
+ if ((0x3ff200000000000L & l) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 12:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 13:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(126, 130);
+ break;
+ case 14:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 15:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(131, 138);
+ break;
+ case 16:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(139, 142);
+ break;
+ case 17:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(143, 147);
+ break;
+ case 18:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(148, 153);
+ break;
+ case 19:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(154, 160);
+ break;
+ case 22:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(161, 165);
+ break;
+ case 23:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(166, 173);
+ break;
+ case 24:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(174, 177);
+ break;
+ case 25:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(178, 182);
+ break;
+ case 26:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(183, 188);
+ break;
+ case 27:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(189, 195);
+ break;
+ case 28:
+ if (curChar == 35)
+ jjstateSet[jjnewStateCnt++] = 5;
+ break;
+ case 40:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 39;
+ break;
+ case 43:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 42;
+ break;
+ case 44:
+ if (curChar == 34)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 45:
+ if ((0xfffffffb00000200L & l) != 0L)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 46:
+ if (curChar == 34 && kind > 69)
+ kind = 69;
+ break;
+ case 48:
+ if (curChar == 12)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 50:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 51:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(196, 201);
+ break;
+ case 52:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 53:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(202, 210);
+ break;
+ case 54:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(211, 215);
+ break;
+ case 55:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(216, 221);
+ break;
+ case 56:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(222, 228);
+ break;
+ case 57:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(229, 236);
+ break;
+ case 58:
+ if (curChar == 13)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 59:
+ if (curChar == 10)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 60:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 59;
+ break;
+ case 61:
+ if (curChar == 39)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 62:
+ if ((0xffffff7f00000200L & l) != 0L)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 63:
+ if (curChar == 39 && kind > 69)
+ kind = 69;
+ break;
+ case 65:
+ if (curChar == 12)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 67:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 68:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(237, 242);
+ break;
+ case 69:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 70:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(243, 251);
+ break;
+ case 71:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(252, 256);
+ break;
+ case 72:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(257, 262);
+ break;
+ case 73:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(263, 269);
+ break;
+ case 74:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(270, 277);
+ break;
+ case 75:
+ if (curChar == 13)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 76:
+ if (curChar == 10)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 77:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 76;
+ break;
+ case 78:
+ if (curChar == 36)
+ jjCheckNAddStates(107, 110);
+ break;
+ case 81:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 83:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 84:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(278, 281);
+ break;
+ case 85:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 86:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(282, 288);
+ break;
+ case 87:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(289, 291);
+ break;
+ case 88:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(292, 295);
+ break;
+ case 89:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(296, 300);
+ break;
+ case 90:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(301, 306);
+ break;
+ case 93:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(307, 310);
+ break;
+ case 94:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(311, 317);
+ break;
+ case 95:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(318, 320);
+ break;
+ case 96:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(321, 324);
+ break;
+ case 97:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(325, 329);
+ break;
+ case 98:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(330, 335);
+ break;
+ case 99:
+ if (curChar == 35)
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 100:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 102:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 103:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(336, 339);
+ break;
+ case 104:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 105:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(340, 346);
+ break;
+ case 106:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(347, 349);
+ break;
+ case 107:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(350, 353);
+ break;
+ case 108:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(354, 358);
+ break;
+ case 109:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(359, 364);
+ break;
+ case 115:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 116:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(365, 368);
+ break;
+ case 117:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 118:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(369, 375);
+ break;
+ case 119:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(376, 378);
+ break;
+ case 120:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(379, 382);
+ break;
+ case 121:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(383, 387);
+ break;
+ case 122:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(388, 393);
+ break;
+ case 125:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(394, 397);
+ break;
+ case 126:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(398, 404);
+ break;
+ case 127:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(405, 407);
+ break;
+ case 128:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(408, 411);
+ break;
+ case 129:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(412, 416);
+ break;
+ case 130:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(417, 422);
+ break;
+ case 132:
+ if ((0x100003600L & l) != 0L)
+ jjAddStates(423, 424);
+ break;
+ case 133:
+ if (curChar == 40 && kind > 110)
+ kind = 110;
+ break;
+ case 140:
+ if ((0x100003600L & l) != 0L)
+ jjAddStates(425, 426);
+ break;
+ case 141:
+ if (curChar == 40 && kind > 111)
+ kind = 111;
+ break;
+ case 148:
+ if ((0x100003600L & l) != 0L)
+ jjAddStates(427, 428);
+ break;
+ case 149:
+ if (curChar == 40 && kind > 112)
+ kind = 112;
+ break;
+ case 158:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 160:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 161:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(429, 432);
+ break;
+ case 162:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 163:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(433, 439);
+ break;
+ case 164:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(440, 442);
+ break;
+ case 165:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(443, 446);
+ break;
+ case 166:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(447, 451);
+ break;
+ case 167:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(452, 457);
+ break;
+ case 168:
+ if ((0x3ff200000000000L & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 169:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(169, 170);
+ break;
+ case 170:
+ if (curChar == 40 && kind > 113)
+ kind = 113;
+ break;
+ case 172:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 173:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(458, 462);
+ break;
+ case 174:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 175:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(463, 470);
+ break;
+ case 176:
+ case 382:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(471, 474);
+ break;
+ case 177:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(475, 479);
+ break;
+ case 178:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(480, 485);
+ break;
+ case 179:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(486, 492);
+ break;
+ case 180:
+ if (curChar == 33)
+ jjCheckNAddStates(103, 106);
+ break;
+ case 181:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(181, 188);
+ break;
+ case 189:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(189, 198);
+ break;
+ case 199:
+ if (curChar == 45)
+ jjAddStates(101, 102);
+ break;
+ case 203:
+ if (curChar == 46)
+ jjCheckNAddStates(83, 100);
+ break;
+ case 204:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 71)
+ kind = 71;
+ jjCheckNAdd(204);
+ break;
+ case 205:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(205, 206);
+ break;
+ case 206:
+ if (curChar == 37 && kind > 75)
+ kind = 75;
+ break;
+ case 207:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(207, 209);
+ break;
+ case 210:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(210, 212);
+ break;
+ case 213:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(213, 215);
+ break;
+ case 216:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(216, 218);
+ break;
+ case 219:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(219, 221);
+ break;
+ case 222:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(222, 224);
+ break;
+ case 225:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(225, 227);
+ break;
+ case 228:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(228, 230);
+ break;
+ case 231:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(231, 234);
+ break;
+ case 235:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(235, 238);
+ break;
+ case 239:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(239, 243);
+ break;
+ case 244:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(244, 246);
+ break;
+ case 247:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(247, 248);
+ break;
+ case 249:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(249, 251);
+ break;
+ case 252:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(252, 255);
+ break;
+ case 256:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 4);
+ break;
+ case 257:
+ if (curChar == 45)
+ jjCheckNAdd(258);
+ break;
+ case 259:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 261:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 262:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(493, 496);
+ break;
+ case 263:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 264:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(497, 503);
+ break;
+ case 265:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(504, 506);
+ break;
+ case 266:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(507, 510);
+ break;
+ case 267:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(511, 515);
+ break;
+ case 268:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(516, 521);
+ break;
+ case 271:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(522, 525);
+ break;
+ case 272:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(526, 532);
+ break;
+ case 273:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(533, 535);
+ break;
+ case 274:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(536, 539);
+ break;
+ case 275:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(540, 544);
+ break;
+ case 276:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(545, 550);
+ break;
+ case 278:
+ if (curChar == 40)
+ jjCheckNAddStates(551, 556);
+ break;
+ case 279:
+ if ((0xfffffc7a00000000L & l) != 0L)
+ jjCheckNAddStates(557, 560);
+ break;
+ case 280:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(280, 281);
+ break;
+ case 281:
+ if (curChar == 41 && kind > 73)
+ kind = 73;
+ break;
+ case 283:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(557, 560);
+ break;
+ case 284:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(561, 565);
+ break;
+ case 285:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(557, 560);
+ break;
+ case 286:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(566, 573);
+ break;
+ case 287:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(574, 577);
+ break;
+ case 288:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(578, 582);
+ break;
+ case 289:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(583, 588);
+ break;
+ case 290:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(589, 595);
+ break;
+ case 291:
+ if (curChar == 39)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 292:
+ if ((0xffffff7f00000200L & l) != 0L)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 293:
+ if (curChar == 39)
+ jjCheckNAddTwoStates(280, 281);
+ break;
+ case 295:
+ if (curChar == 12)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 297:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 298:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(600, 605);
+ break;
+ case 299:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 300:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(606, 614);
+ break;
+ case 301:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(615, 619);
+ break;
+ case 302:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(620, 625);
+ break;
+ case 303:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(626, 632);
+ break;
+ case 304:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(633, 640);
+ break;
+ case 305:
+ if (curChar == 13)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 306:
+ if (curChar == 10)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 307:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 306;
+ break;
+ case 308:
+ if (curChar == 34)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 309:
+ if ((0xfffffffb00000200L & l) != 0L)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 310:
+ if (curChar == 34)
+ jjCheckNAddTwoStates(280, 281);
+ break;
+ case 312:
+ if (curChar == 12)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 314:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 315:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(645, 650);
+ break;
+ case 316:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 317:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(651, 659);
+ break;
+ case 318:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(660, 664);
+ break;
+ case 319:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(665, 670);
+ break;
+ case 320:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(671, 677);
+ break;
+ case 321:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(678, 685);
+ break;
+ case 322:
+ if (curChar == 13)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 323:
+ if (curChar == 10)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 324:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 323;
+ break;
+ case 325:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(686, 692);
+ break;
+ case 328:
+ if (curChar == 43)
+ jjAddStates(693, 694);
+ break;
+ case 329:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 330;
+ break;
+ case 330:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(695, 698);
+ break;
+ case 331:
+ if (curChar == 63 && kind > 109)
+ kind = 109;
+ break;
+ case 332:
+ case 347:
+ case 351:
+ case 354:
+ case 357:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAdd(331);
+ break;
+ case 333:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddTwoStates(331, 332);
+ break;
+ case 334:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(699, 701);
+ break;
+ case 335:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjAddStates(702, 707);
+ break;
+ case 336:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 337;
+ break;
+ case 337:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 338;
+ break;
+ case 338:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(339);
+ break;
+ case 339:
+ if ((0x3ff000000000000L & l) != 0L && kind > 109)
+ kind = 109;
+ break;
+ case 340:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 341;
+ break;
+ case 341:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 342;
+ break;
+ case 342:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 343;
+ break;
+ case 343:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAdd(331);
+ break;
+ case 344:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 345;
+ break;
+ case 345:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 346;
+ break;
+ case 346:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 347;
+ break;
+ case 348:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 349;
+ break;
+ case 349:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 350;
+ break;
+ case 350:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddTwoStates(331, 351);
+ break;
+ case 352:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 353;
+ break;
+ case 353:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(708, 710);
+ break;
+ case 355:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddTwoStates(331, 354);
+ break;
+ case 356:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(711, 714);
+ break;
+ case 358:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddTwoStates(331, 357);
+ break;
+ case 359:
+ if (curChar != 63)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(715, 717);
+ break;
+ case 360:
+ if (curChar == 43)
+ jjstateSet[jjnewStateCnt++] = 361;
+ break;
+ case 361:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(362, 368);
+ break;
+ case 362:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 363;
+ break;
+ case 363:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 364;
+ break;
+ case 364:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(718, 721);
+ break;
+ case 365:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAdd(339);
+ break;
+ case 366:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddTwoStates(339, 365);
+ break;
+ case 367:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(722, 724);
+ break;
+ case 368:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(725, 729);
+ break;
+ case 369:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(362);
+ break;
+ case 370:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(369, 362);
+ break;
+ case 371:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(730, 732);
+ break;
+ case 372:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(733, 736);
+ break;
+ case 374:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(737, 740);
+ break;
+ case 375:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(741, 747);
+ break;
+ case 376:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(748, 750);
+ break;
+ case 377:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(751, 754);
+ break;
+ case 378:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(755, 759);
+ break;
+ case 379:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(760, 765);
+ break;
+ case 380:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(766, 770);
+ break;
+ case 381:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(771, 778);
+ break;
+ case 383:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(779, 783);
+ break;
+ case 384:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(784, 789);
+ break;
+ case 385:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(790, 796);
+ break;
+ case 386:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 71)
+ kind = 71;
+ jjCheckNAddStates(9, 82);
+ break;
+ case 387:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 71)
+ kind = 71;
+ jjCheckNAdd(387);
+ break;
+ case 388:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(388, 389);
+ break;
+ case 389:
+ if (curChar == 46)
+ jjCheckNAdd(204);
+ break;
+ case 390:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(390, 206);
+ break;
+ case 391:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(391, 392);
+ break;
+ case 392:
+ if (curChar == 46)
+ jjCheckNAdd(205);
+ break;
+ case 393:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(393, 209);
+ break;
+ case 394:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(394, 395);
+ break;
+ case 395:
+ if (curChar == 46)
+ jjCheckNAdd(207);
+ break;
+ case 396:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(396, 212);
+ break;
+ case 397:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(397, 398);
+ break;
+ case 398:
+ if (curChar == 46)
+ jjCheckNAdd(210);
+ break;
+ case 399:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(399, 215);
+ break;
+ case 400:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(400, 401);
+ break;
+ case 401:
+ if (curChar == 46)
+ jjCheckNAdd(213);
+ break;
+ case 402:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(402, 218);
+ break;
+ case 403:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(403, 404);
+ break;
+ case 404:
+ if (curChar == 46)
+ jjCheckNAdd(216);
+ break;
+ case 405:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(405, 221);
+ break;
+ case 406:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(406, 407);
+ break;
+ case 407:
+ if (curChar == 46)
+ jjCheckNAdd(219);
+ break;
+ case 408:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(408, 224);
+ break;
+ case 409:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(409, 410);
+ break;
+ case 410:
+ if (curChar == 46)
+ jjCheckNAdd(222);
+ break;
+ case 411:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(411, 227);
+ break;
+ case 412:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(412, 413);
+ break;
+ case 413:
+ if (curChar == 46)
+ jjCheckNAdd(225);
+ break;
+ case 414:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(414, 230);
+ break;
+ case 415:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(415, 416);
+ break;
+ case 416:
+ if (curChar == 46)
+ jjCheckNAdd(228);
+ break;
+ case 417:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(417, 234);
+ break;
+ case 418:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(418, 419);
+ break;
+ case 419:
+ if (curChar == 46)
+ jjCheckNAdd(231);
+ break;
+ case 420:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(420, 238);
+ break;
+ case 421:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(421, 422);
+ break;
+ case 422:
+ if (curChar == 46)
+ jjCheckNAdd(235);
+ break;
+ case 423:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(423, 243);
+ break;
+ case 424:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(424, 425);
+ break;
+ case 425:
+ if (curChar == 46)
+ jjCheckNAdd(239);
+ break;
+ case 426:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(426, 246);
+ break;
+ case 427:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(427, 428);
+ break;
+ case 428:
+ if (curChar == 46)
+ jjCheckNAdd(244);
+ break;
+ case 429:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(429, 248);
+ break;
+ case 430:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(430, 431);
+ break;
+ case 431:
+ if (curChar == 46)
+ jjCheckNAdd(247);
+ break;
+ case 432:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(432, 251);
+ break;
+ case 433:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(433, 434);
+ break;
+ case 434:
+ if (curChar == 46)
+ jjCheckNAdd(249);
+ break;
+ case 435:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(435, 255);
+ break;
+ case 436:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(436, 437);
+ break;
+ case 437:
+ if (curChar == 46)
+ jjCheckNAdd(252);
+ break;
+ case 438:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(797, 801);
+ break;
+ case 439:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(439, 440);
+ break;
+ case 440:
+ if (curChar == 46)
+ jjCheckNAdd(256);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 42:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ }
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 41;
+ break;
+ case 79:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(83, 93);
+ break;
+ case 443:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 197;
+ else if ((0x1000000010L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 187;
+ break;
+ case 444:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ {
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(115, 116);
+ break;
+ case 441:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(160, 161);
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ {
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(172, 173);
+ break;
+ case 111:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(115, 125);
+ break;
+ case 4:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(802, 807);
+ }
+ else if (curChar == 92)
+ jjCheckNAddStates(808, 811);
+ else if (curChar == 64)
+ jjAddStates(812, 815);
+ if ((0x20000000200000L & l) != 0L)
+ jjAddStates(816, 818);
+ else if ((0x800000008L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 155;
+ else if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 145;
+ else if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 137;
+ else if ((0x4000000040L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 33;
+ break;
+ case 2:
+ if (kind > 5)
+ kind = 5;
+ break;
+ case 5:
+ if (curChar == 123)
+ jjstateSet[jjnewStateCnt++] = 6;
+ break;
+ case 8:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 9:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 10:
+ if (curChar == 125 && kind > 39)
+ kind = 39;
+ break;
+ case 11:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(12, 13);
+ break;
+ case 12:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 13:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(126, 130);
+ break;
+ case 15:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(131, 138);
+ break;
+ case 16:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(139, 142);
+ break;
+ case 17:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(143, 147);
+ break;
+ case 18:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(148, 153);
+ break;
+ case 19:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(154, 160);
+ break;
+ case 21:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(12, 22);
+ break;
+ case 22:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(161, 165);
+ break;
+ case 23:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(166, 173);
+ break;
+ case 24:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(174, 177);
+ break;
+ case 25:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(178, 182);
+ break;
+ case 26:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(183, 188);
+ break;
+ case 27:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(189, 195);
+ break;
+ case 29:
+ if ((0x4000000040000L & l) != 0L && kind > 66)
+ kind = 66;
+ break;
+ case 30:
+ case 35:
+ if ((0x2000000020L & l) != 0L)
+ jjCheckNAdd(29);
+ break;
+ case 31:
+ if ((0x10000000100000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 30;
+ break;
+ case 32:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 31;
+ break;
+ case 33:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 32;
+ break;
+ case 34:
+ if ((0x4000000040L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 33;
+ break;
+ case 36:
+ if ((0x10000000100000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 35;
+ break;
+ case 37:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 36;
+ break;
+ case 38:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 37;
+ break;
+ case 39:
+ if ((0x4000000040L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 38;
+ break;
+ case 41:
+ if ((0x8000000080000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 40;
+ break;
+ case 45:
+ case 50:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 47:
+ if (curChar == 92)
+ jjAddStates(819, 822);
+ break;
+ case 49:
+ if (curChar == 92)
+ jjAddStates(823, 824);
+ break;
+ case 51:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(196, 201);
+ break;
+ case 53:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(202, 210);
+ break;
+ case 54:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(211, 215);
+ break;
+ case 55:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(216, 221);
+ break;
+ case 56:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(222, 228);
+ break;
+ case 57:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(229, 236);
+ break;
+ case 62:
+ case 67:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 64:
+ if (curChar == 92)
+ jjAddStates(825, 828);
+ break;
+ case 66:
+ if (curChar == 92)
+ jjAddStates(829, 830);
+ break;
+ case 68:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(237, 242);
+ break;
+ case 70:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(243, 251);
+ break;
+ case 71:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(252, 256);
+ break;
+ case 72:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(257, 262);
+ break;
+ case 73:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(263, 269);
+ break;
+ case 74:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(270, 277);
+ break;
+ case 80:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 81:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 82:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(83, 84);
+ break;
+ case 83:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 84:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(278, 281);
+ break;
+ case 86:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(282, 288);
+ break;
+ case 87:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(289, 291);
+ break;
+ case 88:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(292, 295);
+ break;
+ case 89:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(296, 300);
+ break;
+ case 90:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(301, 306);
+ break;
+ case 92:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(83, 93);
+ break;
+ case 93:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(307, 310);
+ break;
+ case 94:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(311, 317);
+ break;
+ case 95:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(318, 320);
+ break;
+ case 96:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(321, 324);
+ break;
+ case 97:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(325, 329);
+ break;
+ case 98:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddStates(330, 335);
+ break;
+ case 100:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 101:
+ if (curChar == 92)
+ jjAddStates(831, 832);
+ break;
+ case 102:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 103:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(336, 339);
+ break;
+ case 105:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(340, 346);
+ break;
+ case 106:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(347, 349);
+ break;
+ case 107:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(350, 353);
+ break;
+ case 108:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(354, 358);
+ break;
+ case 109:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddStates(359, 364);
+ break;
+ case 110:
+ if (curChar == 64)
+ jjAddStates(812, 815);
+ break;
+ case 112:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 113:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 114:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(115, 116);
+ break;
+ case 115:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 116:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(365, 368);
+ break;
+ case 118:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(369, 375);
+ break;
+ case 119:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(376, 378);
+ break;
+ case 120:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(379, 382);
+ break;
+ case 121:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(383, 387);
+ break;
+ case 122:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(388, 393);
+ break;
+ case 124:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(115, 125);
+ break;
+ case 125:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(394, 397);
+ break;
+ case 126:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(398, 404);
+ break;
+ case 127:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(405, 407);
+ break;
+ case 128:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(408, 411);
+ break;
+ case 129:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(412, 416);
+ break;
+ case 130:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddStates(417, 422);
+ break;
+ case 131:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(423, 424);
+ break;
+ case 134:
+ if ((0x40000000400000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 131;
+ break;
+ case 135:
+ if ((0x800000008000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 134;
+ break;
+ case 136:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 135;
+ break;
+ case 137:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 136;
+ break;
+ case 138:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 137;
+ break;
+ case 139:
+ if ((0x1000000010L & l) != 0L)
+ jjAddStates(425, 426);
+ break;
+ case 142:
+ if ((0x400000004000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 139;
+ break;
+ case 143:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 142;
+ break;
+ case 144:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 143;
+ break;
+ case 145:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 144;
+ break;
+ case 146:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 145;
+ break;
+ case 147:
+ if ((0x8000000080000L & l) != 0L)
+ jjAddStates(427, 428);
+ break;
+ case 150:
+ if ((0x400000004000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 147;
+ break;
+ case 151:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 150;
+ break;
+ case 152:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 151;
+ break;
+ case 153:
+ if ((0x10000000100000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 152;
+ break;
+ case 154:
+ if ((0x400000004000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 153;
+ break;
+ case 155:
+ if ((0x800000008000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 154;
+ break;
+ case 156:
+ if ((0x800000008L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 155;
+ break;
+ case 158:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 159:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(160, 161);
+ break;
+ case 160:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 161:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(429, 432);
+ break;
+ case 163:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(433, 439);
+ break;
+ case 164:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(440, 442);
+ break;
+ case 165:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(443, 446);
+ break;
+ case 166:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(447, 451);
+ break;
+ case 167:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(452, 457);
+ break;
+ case 168:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 171:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(172, 173);
+ break;
+ case 172:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 173:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(458, 462);
+ break;
+ case 175:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(463, 470);
+ break;
+ case 176:
+ case 382:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(471, 474);
+ break;
+ case 177:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(475, 479);
+ break;
+ case 178:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(480, 485);
+ break;
+ case 179:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(486, 492);
+ break;
+ case 182:
+ if ((0x10000000100000L & l) != 0L && kind > 68)
+ kind = 68;
+ break;
+ case 183:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 182;
+ break;
+ case 184:
+ if ((0x20000000200000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 183;
+ break;
+ case 185:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 184;
+ break;
+ case 186:
+ if ((0x4000000040L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 185;
+ break;
+ case 187:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 186;
+ break;
+ case 188:
+ if ((0x1000000010L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 187;
+ break;
+ case 190:
+ if ((0x10000000100000L & l) != 0L && kind > 99)
+ kind = 99;
+ break;
+ case 191:
+ if ((0x400000004000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 190;
+ break;
+ case 192:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 191;
+ break;
+ case 193:
+ if ((0x10000000100000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 192;
+ break;
+ case 194:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 193;
+ break;
+ case 195:
+ if ((0x800000008000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 194;
+ break;
+ case 196:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 195;
+ break;
+ case 197:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 196;
+ break;
+ case 198:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 197;
+ break;
+ case 200:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 201:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 202:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(802, 807);
+ break;
+ case 208:
+ if ((0x10000000100000L & l) != 0L && kind > 76)
+ kind = 76;
+ break;
+ case 209:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 208;
+ break;
+ case 211:
+ if ((0x200000002000L & l) != 0L && kind > 77)
+ kind = 77;
+ break;
+ case 212:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 211;
+ break;
+ case 214:
+ if ((0x200000002000L & l) != 0L && kind > 78)
+ kind = 78;
+ break;
+ case 215:
+ if ((0x800000008L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 214;
+ break;
+ case 217:
+ if ((0x800000008L & l) != 0L && kind > 79)
+ kind = 79;
+ break;
+ case 218:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 217;
+ break;
+ case 220:
+ if ((0x400000004000L & l) != 0L && kind > 80)
+ kind = 80;
+ break;
+ case 221:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 220;
+ break;
+ case 223:
+ if ((0x100000001000000L & l) != 0L && kind > 81)
+ kind = 81;
+ break;
+ case 224:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 223;
+ break;
+ case 226:
+ if ((0x200000002000L & l) != 0L && kind > 82)
+ kind = 82;
+ break;
+ case 227:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 226;
+ break;
+ case 229:
+ if ((0x100000001000000L & l) != 0L && kind > 83)
+ kind = 83;
+ break;
+ case 230:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 229;
+ break;
+ case 232:
+ if ((0x8000000080L & l) != 0L && kind > 84)
+ kind = 84;
+ break;
+ case 233:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 232;
+ break;
+ case 234:
+ if ((0x1000000010L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 233;
+ break;
+ case 236:
+ if ((0x1000000010L & l) != 0L && kind > 85)
+ kind = 85;
+ break;
+ case 237:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 236;
+ break;
+ case 238:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 237;
+ break;
+ case 240:
+ if ((0x1000000010L & l) != 0L && kind > 86)
+ kind = 86;
+ break;
+ case 241:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 240;
+ break;
+ case 242:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 241;
+ break;
+ case 243:
+ if ((0x8000000080L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 242;
+ break;
+ case 245:
+ if ((0x8000000080000L & l) != 0L && kind > 87)
+ kind = 87;
+ break;
+ case 246:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 245;
+ break;
+ case 248:
+ if ((0x8000000080000L & l) != 0L && kind > 88)
+ kind = 88;
+ break;
+ case 250:
+ if ((0x400000004000000L & l) != 0L && kind > 89)
+ kind = 89;
+ break;
+ case 251:
+ if ((0x10000000100L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 250;
+ break;
+ case 253:
+ if ((0x400000004000000L & l) != 0L && kind > 90)
+ kind = 90;
+ break;
+ case 254:
+ if ((0x10000000100L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 253;
+ break;
+ case 255:
+ if ((0x80000000800L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 254;
+ break;
+ case 258:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 259:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 260:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(261, 262);
+ break;
+ case 261:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 262:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(493, 496);
+ break;
+ case 264:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(497, 503);
+ break;
+ case 265:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(504, 506);
+ break;
+ case 266:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(507, 510);
+ break;
+ case 267:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(511, 515);
+ break;
+ case 268:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(516, 521);
+ break;
+ case 270:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(261, 271);
+ break;
+ case 271:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(522, 525);
+ break;
+ case 272:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(526, 532);
+ break;
+ case 273:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(533, 535);
+ break;
+ case 274:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(536, 539);
+ break;
+ case 275:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(540, 544);
+ break;
+ case 276:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddStates(545, 550);
+ break;
+ case 277:
+ if ((0x20000000200000L & l) != 0L)
+ jjAddStates(816, 818);
+ break;
+ case 279:
+ case 283:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(557, 560);
+ break;
+ case 282:
+ if (curChar == 92)
+ jjAddStates(833, 834);
+ break;
+ case 284:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(561, 565);
+ break;
+ case 286:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(566, 573);
+ break;
+ case 287:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(574, 577);
+ break;
+ case 288:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(578, 582);
+ break;
+ case 289:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(583, 588);
+ break;
+ case 290:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(589, 595);
+ break;
+ case 292:
+ case 297:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 294:
+ if (curChar == 92)
+ jjAddStates(835, 838);
+ break;
+ case 296:
+ if (curChar == 92)
+ jjAddStates(839, 840);
+ break;
+ case 298:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(600, 605);
+ break;
+ case 300:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(606, 614);
+ break;
+ case 301:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(615, 619);
+ break;
+ case 302:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(620, 625);
+ break;
+ case 303:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(626, 632);
+ break;
+ case 304:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(633, 640);
+ break;
+ case 309:
+ case 314:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(641, 644);
+ break;
+ case 311:
+ if (curChar == 92)
+ jjAddStates(841, 844);
+ break;
+ case 313:
+ if (curChar == 92)
+ jjAddStates(845, 846);
+ break;
+ case 315:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(645, 650);
+ break;
+ case 317:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(651, 659);
+ break;
+ case 318:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(660, 664);
+ break;
+ case 319:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(665, 670);
+ break;
+ case 320:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(671, 677);
+ break;
+ case 321:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(678, 685);
+ break;
+ case 326:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 278;
+ break;
+ case 327:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 326;
+ break;
+ case 335:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjAddStates(702, 707);
+ break;
+ case 336:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 337;
+ break;
+ case 337:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 338;
+ break;
+ case 338:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAdd(339);
+ break;
+ case 339:
+ if ((0x7e0000007eL & l) != 0L && kind > 109)
+ kind = 109;
+ break;
+ case 340:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 341;
+ break;
+ case 341:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 342;
+ break;
+ case 342:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 343;
+ break;
+ case 343:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 331;
+ break;
+ case 344:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 345;
+ break;
+ case 345:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 346;
+ break;
+ case 346:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 347;
+ break;
+ case 348:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 349;
+ break;
+ case 349:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 350;
+ break;
+ case 352:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 353;
+ break;
+ case 361:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(362, 368);
+ break;
+ case 363:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjstateSet[jjnewStateCnt++] = 364;
+ break;
+ case 364:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(718, 721);
+ break;
+ case 365:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAdd(339);
+ break;
+ case 366:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddTwoStates(339, 365);
+ break;
+ case 367:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 109)
+ kind = 109;
+ jjCheckNAddStates(722, 724);
+ break;
+ case 368:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(725, 729);
+ break;
+ case 369:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAdd(362);
+ break;
+ case 370:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(369, 362);
+ break;
+ case 371:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(730, 732);
+ break;
+ case 372:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(733, 736);
+ break;
+ case 373:
+ if (curChar == 92)
+ jjCheckNAddStates(808, 811);
+ break;
+ case 374:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(737, 740);
+ break;
+ case 375:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(741, 747);
+ break;
+ case 376:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(748, 750);
+ break;
+ case 377:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(751, 754);
+ break;
+ case 378:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(755, 759);
+ break;
+ case 379:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddStates(760, 765);
+ break;
+ case 380:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(766, 770);
+ break;
+ case 381:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(771, 778);
+ break;
+ case 383:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(779, 783);
+ break;
+ case 384:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(784, 789);
+ break;
+ case 385:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(790, 796);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 79:
+ case 81:
+ case 83:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 74)
+ kind = 74;
+ jjCheckNAddTwoStates(81, 82);
+ break;
+ case 444:
+ case 113:
+ case 115:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 441:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ {
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ }
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 111:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 98)
+ kind = 98;
+ jjCheckNAddTwoStates(113, 114);
+ break;
+ case 4:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 40)
+ kind = 40;
+ jjCheckNAddStates(802, 807);
+ break;
+ case 2:
+ if ((jjbitVec0[i2] & l2) != 0L && kind > 5)
+ kind = 5;
+ break;
+ case 9:
+ case 12:
+ case 20:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(123, 125);
+ break;
+ case 45:
+ case 50:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(115, 118);
+ break;
+ case 62:
+ case 67:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(111, 114);
+ break;
+ case 100:
+ case 102:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 92)
+ kind = 92;
+ jjCheckNAddTwoStates(100, 101);
+ break;
+ case 158:
+ case 160:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 70)
+ kind = 70;
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 168:
+ case 172:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 259:
+ case 261:
+ case 269:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 91)
+ kind = 91;
+ jjCheckNAddTwoStates(259, 260);
+ break;
+ case 279:
+ case 283:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(557, 560);
+ break;
+ case 292:
+ case 297:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(596, 599);
+ break;
+ case 309:
+ case 314:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(641, 644);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 441 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+private int jjMoveStringLiteralDfa0_3()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjMoveStringLiteralDfa1_3(0x100L);
+ default :
+ return 1;
+ }
+}
+private int jjMoveStringLiteralDfa1_3(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 47:
+ if ((active0 & 0x100L) != 0L)
+ return jjStopAtPos(1, 8);
+ break;
+ default :
+ return 2;
+ }
+ return 2;
+}
+private int jjMoveStringLiteralDfa0_1()
+{
+ return jjMoveNfa_1(0, 0);
+}
+private int jjMoveNfa_1(int startState, int curPos)
+{
+ int startsAt = 0;
+ jjnewStateCnt = 4;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0xffffffffffffdbffL & l) != 0L)
+ {
+ if (kind > 3)
+ kind = 3;
+ }
+ else if ((0x2400L & l) != 0L)
+ {
+ if (kind > 4)
+ kind = 4;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 2;
+ break;
+ case 1:
+ if ((0x2400L & l) != 0L && kind > 4)
+ kind = 4;
+ break;
+ case 2:
+ if (curChar == 10 && kind > 4)
+ kind = 4;
+ break;
+ case 3:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 2;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ kind = 3;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((jjbitVec0[i2] & l2) != 0L && kind > 3)
+ kind = 3;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+private int jjMoveStringLiteralDfa0_2()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjMoveStringLiteralDfa1_2(0x80L);
+ default :
+ return 1;
+ }
+}
+private int jjMoveStringLiteralDfa1_2(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 47:
+ if ((active0 & 0x80L) != 0L)
+ return jjStopAtPos(1, 7);
+ break;
+ default :
+ return 2;
+ }
+ return 2;
+}
+static final int[] jjnextStates = {
+ 256, 257, 258, 269, 270, 168, 169, 170, 171, 387, 388, 389, 390, 391, 392, 206,
+ 393, 394, 395, 209, 396, 397, 398, 212, 399, 400, 401, 215, 402, 403, 404, 218,
+ 405, 406, 407, 221, 408, 409, 410, 224, 411, 412, 413, 227, 414, 415, 416, 230,
+ 417, 418, 419, 234, 420, 421, 422, 238, 423, 424, 425, 243, 426, 427, 428, 246,
+ 429, 430, 431, 248, 432, 433, 434, 251, 435, 436, 437, 255, 438, 439, 440, 257,
+ 258, 269, 270, 204, 205, 207, 210, 213, 216, 219, 222, 225, 228, 231, 235, 239,
+ 244, 247, 249, 252, 256, 200, 201, 181, 188, 189, 198, 79, 80, 91, 92, 62,
+ 63, 64, 66, 45, 46, 47, 49, 7, 8, 20, 21, 9, 10, 11, 9, 14,
+ 10, 11, 15, 9, 16, 14, 10, 11, 17, 18, 19, 9, 14, 10, 11, 9,
+ 16, 14, 10, 11, 9, 16, 14, 10, 11, 17, 9, 16, 14, 10, 11, 17,
+ 18, 14, 9, 10, 11, 23, 24, 14, 9, 10, 11, 25, 26, 27, 14, 9,
+ 10, 11, 24, 14, 9, 10, 11, 24, 14, 9, 10, 11, 25, 24, 14, 9,
+ 10, 11, 25, 26, 45, 52, 46, 47, 49, 53, 45, 54, 52, 46, 47, 49,
+ 55, 56, 57, 45, 52, 46, 47, 49, 45, 54, 52, 46, 47, 49, 45, 54,
+ 52, 46, 47, 49, 55, 45, 54, 52, 46, 47, 49, 55, 56, 62, 69, 63,
+ 64, 66, 70, 62, 71, 69, 63, 64, 66, 72, 73, 74, 62, 69, 63, 64,
+ 66, 62, 71, 69, 63, 64, 66, 62, 71, 69, 63, 64, 66, 72, 62, 71,
+ 69, 63, 64, 66, 72, 73, 81, 85, 82, 86, 81, 87, 85, 82, 88, 89,
+ 90, 81, 85, 82, 81, 87, 85, 82, 81, 87, 85, 82, 88, 81, 87, 85,
+ 82, 88, 89, 85, 81, 82, 94, 95, 85, 81, 82, 96, 97, 98, 85, 81,
+ 82, 95, 85, 81, 82, 95, 85, 81, 82, 96, 95, 85, 81, 82, 96, 97,
+ 100, 104, 101, 105, 100, 106, 104, 101, 107, 108, 109, 100, 104, 101, 100, 106,
+ 104, 101, 100, 106, 104, 101, 107, 100, 106, 104, 101, 107, 108, 113, 117, 114,
+ 118, 113, 119, 117, 114, 120, 121, 122, 113, 117, 114, 113, 119, 117, 114, 113,
+ 119, 117, 114, 120, 113, 119, 117, 114, 120, 121, 117, 113, 114, 126, 127, 117,
+ 113, 114, 128, 129, 130, 117, 113, 114, 127, 117, 113, 114, 127, 117, 113, 114,
+ 128, 127, 117, 113, 114, 128, 129, 132, 133, 140, 141, 148, 149, 158, 162, 159,
+ 163, 158, 164, 162, 159, 165, 166, 167, 158, 162, 159, 158, 164, 162, 159, 158,
+ 164, 162, 159, 165, 158, 164, 162, 159, 165, 166, 168, 170, 171, 174, 175, 168,
+ 176, 170, 171, 174, 177, 178, 179, 168, 170, 171, 174, 168, 176, 170, 171, 174,
+ 168, 176, 170, 171, 174, 177, 168, 176, 170, 171, 174, 177, 178, 259, 263, 260,
+ 264, 259, 265, 263, 260, 266, 267, 268, 259, 263, 260, 259, 265, 263, 260, 259,
+ 265, 263, 260, 266, 259, 265, 263, 260, 266, 267, 263, 259, 260, 272, 273, 263,
+ 259, 260, 274, 275, 276, 263, 259, 260, 273, 263, 259, 260, 273, 263, 259, 260,
+ 274, 273, 263, 259, 260, 274, 275, 279, 291, 308, 281, 282, 325, 279, 280, 281,
+ 282, 279, 281, 282, 285, 286, 279, 287, 281, 282, 285, 288, 289, 290, 279, 281,
+ 282, 285, 279, 287, 281, 282, 285, 279, 287, 281, 282, 285, 288, 279, 287, 281,
+ 282, 285, 288, 289, 292, 293, 294, 296, 292, 299, 293, 294, 296, 300, 292, 301,
+ 299, 293, 294, 296, 302, 303, 304, 292, 299, 293, 294, 296, 292, 301, 299, 293,
+ 294, 296, 292, 301, 299, 293, 294, 296, 302, 292, 301, 299, 293, 294, 296, 302,
+ 303, 309, 310, 311, 313, 309, 316, 310, 311, 313, 317, 309, 318, 316, 310, 311,
+ 313, 319, 320, 321, 309, 316, 310, 311, 313, 309, 318, 316, 310, 311, 313, 309,
+ 318, 316, 310, 311, 313, 319, 309, 318, 316, 310, 311, 313, 319, 320, 279, 291,
+ 308, 280, 281, 282, 325, 329, 335, 331, 332, 333, 334, 331, 332, 333, 336, 340,
+ 344, 348, 352, 356, 331, 354, 355, 331, 357, 358, 359, 331, 357, 358, 339, 365,
+ 366, 367, 339, 365, 366, 369, 362, 370, 371, 372, 369, 362, 370, 369, 362, 370,
+ 371, 162, 158, 159, 375, 376, 162, 158, 159, 377, 378, 379, 162, 158, 159, 376,
+ 162, 158, 159, 376, 162, 158, 159, 377, 376, 162, 158, 159, 377, 378, 168, 170,
+ 171, 174, 381, 382, 168, 170, 171, 174, 383, 384, 385, 382, 168, 170, 171, 174,
+ 382, 168, 170, 171, 174, 383, 382, 168, 170, 171, 174, 383, 384, 438, 257, 258,
+ 269, 270, 158, 168, 169, 170, 171, 159, 160, 374, 172, 380, 111, 112, 123, 124,
+ 327, 328, 360, 48, 58, 60, 59, 50, 51, 65, 75, 77, 76, 67, 68, 102,
+ 103, 283, 284, 295, 305, 307, 306, 297, 298, 312, 322, 324, 323, 314, 315,
+};
+
+/** Token literal values. */
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, null, null, null, "\74\41\55\55",
+"\55\55\76", "\173", "\175", "\174\75", "\136\75", "\44\75", "\52\75", "\176\75", "\75",
+"\53", "\55", "\54", "\73", "\76", "\74", "\57", "\133", "\135", "\52", "\46", "\56",
+"\50", "\51", "\75\75", "\174\174", "\46\46", "\41\75", "\72", null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, };
+
+/** Lexer state names. */
+public static final String[] lexStateNames = {
+ "DEFAULT",
+ "IN_SINGLE_LINE_COMMENT",
+ "IN_FORMAL_COMMENT",
+ "IN_MULTI_LINE_COMMENT",
+};
+
+/** Lex State array. */
+public static final int[] jjnewLexState = {
+ -1, -1, 1, -1, 0, 2, 3, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+};
+static final long[] jjtoToken = {
+ 0xfffe01fffffffc03L, 0x7e00ffffffeffL,
+};
+static final long[] jjtoSkip = {
+ 0x190L, 0x0L,
+};
+static final long[] jjtoSpecial = {
+ 0x80L, 0x0L,
+};
+static final long[] jjtoMore = {
+ 0x26cL, 0x0L,
+};
+protected CharStream input_stream;
+private final int[] jjrounds = new int[441];
+private final int[] jjstateSet = new int[882];
+private final StringBuilder jjimage = new StringBuilder();
+private StringBuilder image = jjimage;
+private int jjimageLen;
+private int lengthOfMatch;
+protected char curChar;
+/** Constructor. */
+public ParserTokenManager(CharStream stream){
+ input_stream = stream;
+}
+
+/** Constructor. */
+public ParserTokenManager(CharStream stream, int lexState){
+ this(stream);
+ SwitchTo(lexState);
+}
+
+/** Reinitialise parser. */
+public void ReInit(CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 441; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+
+/** Reinitialise parser. */
+public void ReInit(CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+
+/** Switch to specified lex state. */
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 4 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+protected Token jjFillToken()
+{
+ final Token t;
+ final String curTokenImage;
+ final int beginLine;
+ final int endLine;
+ final int beginColumn;
+ final int endColumn;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ curTokenImage = (im == null) ? input_stream.GetImage() : im;
+ beginLine = input_stream.getBeginLine();
+ beginColumn = input_stream.getBeginColumn();
+ endLine = input_stream.getEndLine();
+ endColumn = input_stream.getEndColumn();
+ t = Token.newToken(jjmatchedKind, curTokenImage);
+
+ t.beginLine = beginLine;
+ t.endLine = endLine;
+ t.beginColumn = beginColumn;
+ t.endColumn = endColumn;
+
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+/** Get the next Token. */
+public Token getNextToken()
+{
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ matchedToken.specialToken = specialToken;
+ return matchedToken;
+ }
+ image = jjimage;
+ image.setLength(0);
+ jjimageLen = 0;
+
+ for (;;)
+ {
+ switch(curLexState)
+ {
+ case 0:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedPos == 0 && jjmatchedKind > 114)
+ {
+ jjmatchedKind = 114;
+ }
+ break;
+ case 1:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ break;
+ case 2:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_2();
+ if (jjmatchedPos == 0 && jjmatchedKind > 9)
+ {
+ jjmatchedKind = 9;
+ }
+ break;
+ case 3:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_3();
+ if (jjmatchedPos == 0 && jjmatchedKind > 9)
+ {
+ jjmatchedKind = 9;
+ }
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ matchedToken.specialToken = specialToken;
+ TokenLexicalActions(matchedToken);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ }
+ else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ if (specialToken == null)
+ specialToken = matchedToken;
+ else
+ {
+ matchedToken.specialToken = specialToken;
+ specialToken = (specialToken.next = matchedToken);
+ }
+ SkipLexicalActions(matchedToken);
+ }
+ else
+ SkipLexicalActions(null);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ continue EOFLoop;
+ }
+ MoreLexicalActions();
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ curPos = 0;
+ jjmatchedKind = 0x7fffffff;
+ try {
+ curChar = input_stream.readChar();
+ continue;
+ }
+ catch (java.io.IOException e1) { }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+ }
+}
+
+void SkipLexicalActions(Token matchedToken)
+{
+ switch(jjmatchedKind)
+ {
+ default :
+ break;
+ }
+}
+void MoreLexicalActions()
+{
+ jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
+ switch(jjmatchedKind)
+ {
+ case 5 :
+ image.append(input_stream.GetSuffix(jjimageLen));
+ jjimageLen = 0;
+ input_stream.backup(1);
+ break;
+ default :
+ break;
+ }
+}
+void TokenLexicalActions(Token matchedToken)
+{
+ switch(jjmatchedKind)
+ {
+ case 1 :
+ image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
+ image = Parser.SPACE;
+ break;
+ default :
+ break;
+ }
+}
+private void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+
+private void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+
+}
--- /dev/null
+package com.vaadin.sass.internal.parser;
+
+import org.w3c.css.sac.LexicalUnit;
+
+public interface SCSSLexicalUnit extends LexicalUnit {
+ static final short SCSS_VARIABLE = 100;
+
+ LexicalUnitImpl divide(LexicalUnitImpl denominator);
+
+ LexicalUnitImpl add(LexicalUnitImpl another);
+
+ LexicalUnitImpl minus(LexicalUnitImpl another);
+
+ LexicalUnitImpl multiply(LexicalUnitImpl another);
+
+}
--- /dev/null
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: SelectorListImpl.java,v 1.1 2000/08/07 01:16:21 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SelectorList;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class SelectorListImpl implements SelectorList {
+
+ Selector[] selectors = new Selector[5];
+ int current;
+
+ @Override
+ public Selector item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public Selector itemSelector(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ @Override
+ public int getLength() {
+ return current;
+ }
+
+ public void addSelector(Selector selector) {
+ if (current == selectors.length) {
+ Selector[] old = selectors;
+ selectors = new Selector[old.length + old.length];
+ System.arraycopy(old, 0, selectors, 0, old.length);
+ }
+ selectors[current++] = selector;
+ }
+
+ public void replaceSelector(int index, Selector selector) {
+ if ((index >= 0) && (index < current)) {
+ selectors[index] = selector;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: Selectors.java,v 1.1 2000/02/14 16:58:31 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class Selectors implements SelectorList {
+
+ Selector[] selectors = new Selector[5];
+ int current;
+
+ public Selector item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public Selector itemSelector(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public int getLength() {
+ return current;
+ }
+
+ void addSelector(Selector selector) {
+ if (current == selectors.length) {
+ Selector[] old = selectors;
+ selectors = new Selector[old.length + old.length];
+ System.arraycopy(old, 0, selectors, 0, old.length);
+ }
+ selectors[current++] = selector;
+ }
+}
--- /dev/null
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: ThrowedParseException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
+ */
+package com.vaadin.sass.internal.parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class ThrowedParseException extends RuntimeException {
+ private static final long serialVersionUID = -7926371344505913546L;
+
+ ParseException e;
+
+ /**
+ * Creates a new ThrowedParseException
+ */
+ ThrowedParseException(ParseException e) {
+ this.e = e;
+ }
+}
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package com.vaadin.sass.internal.parser;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token implements java.io.Serializable {
+
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /** The line number of the first character of this Token. */
+ public int beginLine;
+ /** The column number of the first character of this Token. */
+ public int beginColumn;
+ /** The line number of the last character of this Token. */
+ public int endLine;
+ /** The column number of the last character of this Token. */
+ public int endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * An optional attribute value of the Token.
+ * Tokens which are not used as syntactic sugar will often contain
+ * meaningful values that will be used later on by the compiler or
+ * interpreter. This attribute value is often different from the image.
+ * Any subclass of Token that actually wants to return a non-null value can
+ * override this method as appropriate.
+ */
+ public Object getValue() {
+ return null;
+ }
+
+ /**
+ * No-argument constructor
+ */
+ public Token() {}
+
+ /**
+ * Constructs a new token for the specified Image.
+ */
+ public Token(int kind)
+ {
+ this(kind, null);
+ }
+
+ /**
+ * Constructs a new token for the specified Image and Kind.
+ */
+ public Token(int kind, String image)
+ {
+ this.kind = kind;
+ this.image = image;
+ }
+
+ /**
+ * Returns the image.
+ */
+ public String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simply add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken(ofKind, image);
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use sit in your lexical actions.
+ */
+ public static Token newToken(int ofKind, String image)
+ {
+ switch(ofKind)
+ {
+ default : return new Token(ofKind, image);
+ }
+ }
+
+ public static Token newToken(int ofKind)
+ {
+ return newToken(ofKind, null);
+ }
+
+}
+/* JavaCC - OriginalChecksum=fd921a11cd37e391729b9460c71d3ad6 (do not edit this line) */
--- /dev/null
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
+/* JavaCCOptions: */
+package com.vaadin.sass.internal.parser;
+
+/** Token Manager Error. */
+public class TokenMgrError extends Error
+{
+
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their escaped (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexical error
+ * curLexState : lexical state in which this error occurred
+ * errorLine : line number when the error occurred
+ * errorColumn : column number when the error occurred
+ * errorAfter : prefix that was seen before this error occurred
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** Constructor with message and reason. */
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ /** Full Constructor. */
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
+/* JavaCC - OriginalChecksum=7d5524d89510a94f7c2ac022e99c24c3 (do not edit this line) */
--- /dev/null
+package com.vaadin.sass.internal.resolver;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.w3c.css.sac.InputSource;
+
+public class ClassloaderResolver implements ScssStylesheetResolver {
+
+ @Override
+ public InputSource resolve(String identifier) {
+ // identifier should not have .scss, fileName should
+ String ext = ".scss";
+ if (identifier.endsWith(".css")) {
+ ext = ".css";
+ }
+ String fileName = identifier;
+ if (identifier.endsWith(ext)) {
+ identifier = identifier.substring(0,
+ identifier.length() - ext.length());
+ } else {
+ fileName = fileName + ext;
+ }
+
+ // Ensure only "/" is used, also in Windows
+ fileName = fileName.replace(File.separatorChar, '/');
+
+ // Can the classloader find it?
+ InputStream is = getClass().getClassLoader().getResourceAsStream(
+ fileName);
+ if (is != null) {
+ InputSource source = new InputSource();
+ source.setByteStream(is);
+ source.setURI(fileName);
+ return source;
+
+ } else {
+ return null;
+ }
+
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.resolver;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+import org.w3c.css.sac.InputSource;
+
+public class FilesystemResolver implements ScssStylesheetResolver {
+
+ @Override
+ public InputSource resolve(String identifier) {
+ // identifier should not have .scss, fileName should
+ String ext = ".scss";
+ if (identifier.endsWith(".css")) {
+ ext = ".css";
+ }
+ String fileName = identifier;
+ if (identifier.endsWith(ext)) {
+ identifier = identifier.substring(0,
+ identifier.length() - ext.length());
+ } else {
+ fileName = fileName + ext;
+ }
+
+ try {
+ InputStream is = new FileInputStream(fileName);
+ InputSource source = new InputSource();
+ source.setByteStream(is);
+ source.setURI(fileName);
+ return source;
+
+ } catch (FileNotFoundException e) {
+ // not found, try something else
+ return null;
+ }
+
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.resolver;
+
+import org.w3c.css.sac.InputSource;
+
+public interface ScssStylesheetResolver {
+ /**
+ * Called with the "identifier" of a stylesheet that the resolver should try
+ * to find. The identifier is basically a filename, like "runo.scss" or
+ * "addon/styles.scss", but might exclude ".scss". The resolver must
+ * {@link InputSource#setURI(String)} to the final location where the
+ * stylesheet was found, e.g "runo.scss" might result in a URI like
+ * "VAADIN/themes/runo/runo.scss".
+ *
+ * @param identifier
+ * used fo find stylesheet
+ * @return InputSource for stylesheet (with URI set) or null if not found
+ */
+ public InputSource resolve(String identifier);
+}
\ No newline at end of file
--- /dev/null
+package com.vaadin.sass.internal.resolver;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.w3c.css.sac.InputSource;
+
+public class VaadinResolver implements ScssStylesheetResolver {
+
+ @Override
+ public InputSource resolve(String identifier) {
+ if (identifier.endsWith(".css")) {
+ // CSS support mainly for testing, don't load from classpath etc
+ ScssStylesheetResolver resolver = new FilesystemResolver();
+ return resolver.resolve(identifier);
+ }
+
+ InputSource source = null;
+
+ Pattern pattern = Pattern
+ .compile("\\.\\.\\/([^\\/]+)\\/([^\\/]+\\.scss)");
+ Matcher matcher = pattern.matcher(identifier);
+
+ if (matcher.find()) {
+ // theme include
+ ScssStylesheetResolver resolver = new FilesystemResolver();
+ source = resolver.resolve(identifier);
+
+ if (source == null) {
+ String themeName = matcher.group(1);
+ String fileName = matcher.group(2);
+ resolver = new ClassloaderResolver();
+ String id = "VAADIN/themes/" + themeName + "/" + fileName;
+ source = resolver.resolve(id);
+ }
+
+ } else {
+ ScssStylesheetResolver resolver = new FilesystemResolver();
+ source = resolver.resolve(identifier);
+
+ if (source == null) {
+ resolver = new ClassloaderResolver();
+ source = resolver.resolve(identifier);
+ }
+ }
+
+ return source;
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.selector;
+
+import org.w3c.css.sac.Selector;
+
+public class CompositeSelector implements Selector {
+ public static final short SCSS_COMPOSITE_SELECTOR = 100;
+ private Selector first;
+ private Selector second;
+
+ public CompositeSelector(Selector first, Selector second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ public Selector getFirst() {
+ return first;
+ }
+
+ public Selector getSecond() {
+ return second;
+ }
+
+ @Override
+ public short getSelectorType() {
+ return SCSS_COMPOSITE_SELECTOR;
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.selector;
+
+import org.w3c.css.sac.CombinatorCondition;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.ConditionalSelector;
+import org.w3c.css.sac.DescendantSelector;
+import org.w3c.css.sac.ElementSelector;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.SiblingSelector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.flute.parser.selectors.AndConditionImpl;
+import org.w3c.flute.parser.selectors.AttributeConditionImpl;
+import org.w3c.flute.parser.selectors.ChildSelectorImpl;
+import org.w3c.flute.parser.selectors.ClassConditionImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+import org.w3c.flute.parser.selectors.DirectAdjacentSelectorImpl;
+import org.w3c.flute.parser.selectors.ElementSelectorImpl;
+import org.w3c.flute.parser.selectors.IdConditionImpl;
+import org.w3c.flute.parser.selectors.PseudoClassConditionImpl;
+import org.w3c.flute.parser.selectors.PseudoElementSelectorImpl;
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+
+import com.vaadin.sass.internal.parser.SelectorListImpl;
+
+public class SelectorUtil {
+
+ public static String toString(CompositeSelector compositeSelector) {
+ StringBuilder builder = new StringBuilder();
+ if (compositeSelector != null) {
+ if (compositeSelector.getFirst() != null) {
+ builder.append(toString(compositeSelector.getFirst())).append(
+ " ");
+ }
+ if (compositeSelector.getSecond() != null) {
+ builder.append(toString(compositeSelector.getSecond()));
+ }
+ }
+ return builder.toString();
+ }
+
+ public static String toString(SelectorList selectorList) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < selectorList.getLength(); i++) {
+ String selectorString = toString(selectorList.item(i));
+ stringBuilder.append(selectorString);
+ if (selectorList.getLength() > i + 1) {
+ stringBuilder.append(", ");
+ }
+ }
+ return stringBuilder.toString();
+ }
+
+ public static String toString(Selector selector) {
+ if (selector == null) {
+ return "";
+ }
+ if (selector.getSelectorType() == Selector.SAC_CONDITIONAL_SELECTOR) {
+ StringBuilder stringBuilder = new StringBuilder();
+ ConditionalSelector conditionalSelector = (ConditionalSelector) selector;
+ String simpleSelectorString = toString(conditionalSelector
+ .getSimpleSelector());
+ if (simpleSelectorString != null) {
+ stringBuilder.append(simpleSelectorString);
+ }
+ String conditionString = getConditionString(conditionalSelector
+ .getCondition());
+ stringBuilder.append(conditionString);
+ return stringBuilder.toString();
+ } else if (selector.getSelectorType() == Selector.SAC_DESCENDANT_SELECTOR) {
+ return getDecendantSelectorString((DescendantSelector) selector,
+ " ");
+ } else if (selector.getSelectorType() == Selector.SAC_CHILD_SELECTOR) {
+ DescendantSelector childSelector = (DescendantSelector) selector;
+ String seperator = " > ";
+ if (childSelector.getSimpleSelector() instanceof PseudoElementSelectorImpl) {
+ seperator = "::";
+ }
+ return getDecendantSelectorString((DescendantSelector) selector,
+ seperator);
+ } else if (selector.getSelectorType() == Selector.SAC_ELEMENT_NODE_SELECTOR) {
+ ElementSelectorImpl elementSelector = (ElementSelectorImpl) selector;
+ return elementSelector.getLocalName() == null ? ""
+ : elementSelector.getLocalName();
+ } else if (selector.getSelectorType() == Selector.SAC_DIRECT_ADJACENT_SELECTOR) {
+ DirectAdjacentSelectorImpl directAdjacentSelector = (DirectAdjacentSelectorImpl) selector;
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder
+ .append(toString(directAdjacentSelector.getSelector()));
+ stringBuilder.append(" + ");
+ stringBuilder.append(toString(directAdjacentSelector
+ .getSiblingSelector()));
+ return stringBuilder.toString();
+ } else if (selector.getSelectorType() == Selector.SAC_PSEUDO_ELEMENT_SELECTOR) {
+ PseudoElementSelectorImpl pseudoElementSelectorImpl = (PseudoElementSelectorImpl) selector;
+ return pseudoElementSelectorImpl.getLocalName();
+ } else if (selector.getSelectorType() == CompositeSelector.SCSS_COMPOSITE_SELECTOR) {
+ return toString((CompositeSelector) selector);
+ } else {
+ System.out.println("SU !Unknown selector type, type: "
+ + selector.getSelectorType() + ", " + selector.toString());
+ }
+ return "";
+ }
+
+ private static String getDecendantSelectorString(
+ DescendantSelector selector, String separator) {
+ StringBuilder stringBuilder = new StringBuilder();
+ String ancestor = toString(selector.getAncestorSelector());
+ String simpleSelector = toString(selector.getSimpleSelector());
+ stringBuilder.append(ancestor);
+ stringBuilder.append(separator);
+ stringBuilder.append(simpleSelector);
+ return stringBuilder.toString();
+ }
+
+ private static String getConditionString(Condition condition) {
+ short conditionType = condition.getConditionType();
+ if (conditionType == Condition.SAC_CLASS_CONDITION) {
+ ClassConditionImpl classCondition = (ClassConditionImpl) condition;
+ return "." + classCondition.getValue();
+ } else if (conditionType == Condition.SAC_ID_CONDITION) {
+ IdConditionImpl idCondition = (IdConditionImpl) condition;
+ return "#" + idCondition.getValue();
+ } else if (conditionType == Condition.SAC_AND_CONDITION) {
+ AndConditionImpl andCondition = (AndConditionImpl) condition;
+ return getConditionString(andCondition.getFirstCondition())
+ + getConditionString(andCondition.getSecondCondition());
+ } else if (conditionType == Condition.SAC_ATTRIBUTE_CONDITION) {
+ AttributeConditionImpl attributeCondition = (AttributeConditionImpl) condition;
+ StringBuilder string = new StringBuilder();
+ string.append('[');
+ string.append(attributeCondition.getLocalName());
+ String value = attributeCondition.getValue();
+ if ("true".equals(value) || "false".equals(value)) {
+ string.append("=").append(value).append(']');
+ } else {
+ string.append("=\"");
+ string.append(attributeCondition.getValue());
+ string.append("\"]");
+ }
+ return string.toString();
+ } else if (conditionType == Condition.SAC_PSEUDO_CLASS_CONDITION) {
+ PseudoClassConditionImpl pseudoClassCondition = (PseudoClassConditionImpl) condition;
+ return ":" + pseudoClassCondition.getValue();
+ } else {
+ System.out.println("CU !condition type not identified, type: "
+ + conditionType + ", " + condition.toString());
+ return "";
+ }
+ }
+
+ public static boolean hasParentSelector(SelectorList selectorList) {
+ String selectorString = toString(selectorList);
+ return selectorString.contains("&");
+ }
+
+ public static SelectorList createNewSelectorListFromAnOldOneWithSomPartReplaced(
+ SelectorList oldList, String toBeReplacedSelectorName,
+ SelectorList candidateSelectorList) throws Exception {
+ if (candidateSelectorList.getLength() != 1) {
+ throw new Exception("Candidate selector should not be a list");
+ }
+ if (!(candidateSelectorList.item(0) instanceof SimpleSelector)) {
+ throw new Exception(
+ "Candidate selector should only be a SimpleSelector");
+ }
+ SelectorListImpl newSelectorList = new SelectorListImpl();
+ SimpleSelector candidateSelector = (SimpleSelector) candidateSelectorList
+ .item(0);
+ for (int i = 0; i < oldList.getLength(); i++) {
+ Selector selector = oldList.item(i);
+ newSelectorList.addSelector(createSelectorWithSomePartReplaced(
+ selector, toBeReplacedSelectorName, candidateSelector));
+ }
+ return newSelectorList;
+ }
+
+ private static Selector createSelectorWithSomePartReplaced(
+ Selector selector, String toBeReplacedSelectorName,
+ SimpleSelector candidateSelector) {
+ if (!toString(selector).contains(toBeReplacedSelectorName)) {
+ return selector;
+ }
+ SelectorFactory factory = new SelectorFactoryImpl();
+ if (selector instanceof SimpleSelector) {
+ return createSimpleSelectorWithSomePartReplaced(
+ (SimpleSelector) selector, toBeReplacedSelectorName,
+ candidateSelector);
+ } else if (selector instanceof DescendantSelector) {
+ DescendantSelector descendantSelector = (DescendantSelector) selector;
+ Selector ancestor = descendantSelector.getAncestorSelector();
+ SimpleSelector simpleSelector = descendantSelector
+ .getSimpleSelector();
+ return factory.createDescendantSelector(
+ createSelectorWithSomePartReplaced(ancestor,
+ toBeReplacedSelectorName, candidateSelector),
+ createSimpleSelectorWithSomePartReplaced(simpleSelector,
+ toBeReplacedSelectorName, candidateSelector));
+ } else if (selector instanceof DirectAdjacentSelectorImpl) {
+ SiblingSelector siblingSelector = (SiblingSelector) selector;
+ Selector ancestor = siblingSelector.getSelector();
+ SimpleSelector simpleSelector = siblingSelector
+ .getSiblingSelector();
+ return factory.createDirectAdjacentSelector(
+ Selector.SAC_DIRECT_ADJACENT_SELECTOR, ancestor,
+ simpleSelector);
+ } else if (selector instanceof CompositeSelector) {
+ CompositeSelector compositeSelector = (CompositeSelector) selector;
+ Selector first = compositeSelector.getFirst();
+ Selector second = compositeSelector.getSecond();
+ return new CompositeSelector(createSelectorWithSomePartReplaced(
+ first, toBeReplacedSelectorName, candidateSelector),
+ createSelectorWithSomePartReplaced(second,
+ toBeReplacedSelectorName, candidateSelector));
+ }
+ return null;
+ }
+
+ private static SimpleSelector createSimpleSelectorWithSomePartReplaced(
+ SimpleSelector simpleSelector, String toBeReplacedSelectorName,
+ SimpleSelector candidateSelector) {
+ if (simpleSelector == null
+ || !toString(simpleSelector).contains(toBeReplacedSelectorName)) {
+ return simpleSelector;
+ }
+ if (simpleSelector instanceof ElementSelector
+ && candidateSelector instanceof ElementSelector) {
+ return candidateSelector;
+ }
+ if (simpleSelector instanceof ConditionalSelector) {
+ return createConditionSelectorWithSomePartReplaced(
+ (ConditionalSelector) simpleSelector,
+ toBeReplacedSelectorName, candidateSelector);
+ }
+ return simpleSelector;
+ }
+
+ private static ConditionalSelector createConditionSelectorWithSomePartReplaced(
+ ConditionalSelector oldConditionSelector,
+ String toBeReplacedSelectorName, SimpleSelector candidateSelector) {
+ if (oldConditionSelector == null
+ || !toString(oldConditionSelector).contains(
+ toBeReplacedSelectorName)) {
+ return oldConditionSelector;
+ }
+ SelectorFactory selectorFactory = new SelectorFactoryImpl();
+ if (candidateSelector instanceof ElementSelector) {
+ return selectorFactory.createConditionalSelector(candidateSelector,
+ oldConditionSelector.getCondition());
+ }
+ if (candidateSelector instanceof ConditionalSelector) {
+ // TODO some cases not covered.
+ ConditionalSelector candidateConditionSelector = (ConditionalSelector) candidateSelector;
+ Condition newCondition = createConditionWithSomePartReplaced(
+ oldConditionSelector.getCondition(),
+ toBeReplacedSelectorName,
+ candidateConditionSelector.getCondition());
+ return selectorFactory.createConditionalSelector(
+ oldConditionSelector.getSimpleSelector(), newCondition);
+ }
+ return oldConditionSelector;
+ }
+
+ private static Condition createConditionWithSomePartReplaced(
+ Condition oldCondition, String toBeReplaced, Condition candidate) {
+ if (oldCondition == null
+ || !getConditionString(oldCondition).contains(toBeReplaced)) {
+ return oldCondition;
+ }
+ if (oldCondition.getConditionType() == Condition.SAC_AND_CONDITION) {
+ ConditionFactory conditionFactory = new ConditionFactoryImpl();
+ CombinatorCondition oldCombinatorCondition = (CombinatorCondition) oldCondition;
+ Condition newFirstCondition = createConditionWithSomePartReplaced(
+ oldCombinatorCondition.getFirstCondition(), toBeReplaced,
+ candidate);
+ Condition newSecondCondition = createConditionWithSomePartReplaced(
+ oldCombinatorCondition.getSecondCondition(), toBeReplaced,
+ candidate);
+ return conditionFactory.createAndCondition(newFirstCondition,
+ newSecondCondition);
+ } else {
+ return candidate;
+ }
+ }
+
+ public static boolean equals(Selector one, Selector another) {
+ return one == null ? another == null : toString(one).equals(
+ toString(another));
+ }
+
+ public static Selector createSelectorAndreplaceSelectorVariableWithValue(
+ Selector selector, String variable, String value) throws Exception {
+
+ SelectorFactoryImpl factory = new SelectorFactoryImpl();
+
+ ElementSelector es = factory.createElementSelector(
+ null,
+ ((ElementSelector) selector).getLocalName().replaceAll(
+ variable, value));
+
+ if (selector instanceof ConditionalSelector) {
+ return factory.createConditionalSelector(es,
+ ((ConditionalSelector) selector).getCondition());
+ } else if (selector instanceof DescendantSelector) {
+ return factory.createDescendantSelector(es,
+ ((DescendantSelector) selector).getSimpleSelector());
+ } else if (selector instanceof ChildSelectorImpl) {
+ return factory.createChildSelector(es,
+ ((DescendantSelector) selector).getSimpleSelector());
+ } else {
+ throw new Exception("Invalid selector type");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.visitor.BlockNodeHandler;
+
+public class BlockNode extends Node implements IVariableNode {
+
+ private static final long serialVersionUID = 5742962631468325048L;
+
+ ArrayList<String> selectorList;
+
+ public BlockNode(ArrayList<String> selectorList) {
+ this.selectorList = selectorList;
+ }
+
+ public ArrayList<String> getSelectorList() {
+ return selectorList;
+ }
+
+ public void setSelectorList(ArrayList<String> selectorList) {
+ this.selectorList = selectorList;
+ }
+
+ public String toString(boolean indent) {
+ StringBuilder string = new StringBuilder();
+ int i = 0;
+ for (final String s : selectorList) {
+ string.append(s);
+ if (i != selectorList.size() - 1) {
+ string.append(", ");
+ }
+ i++;
+ }
+ string.append(" {\n");
+ for (Node child : children) {
+ if (indent) {
+ string.append("\t");
+ }
+ string.append("\t" + child.toString() + "\n");
+ }
+ if (indent) {
+ string.append("\t");
+ }
+ string.append("}");
+ return string.toString();
+ }
+
+ @Override
+ public String toString() {
+ return toString(false);
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+
+ if (selectorList == null || selectorList.isEmpty()) {
+ return;
+ }
+
+ for (final VariableNode var : variables) {
+ for (final String selector : new ArrayList<String>(selectorList)) {
+ String interpolation = "#{$" + var.getName() + "}";
+ if (selector.contains(interpolation)) {
+ String replace = selector.replace(interpolation, var
+ .getExpr().toString());
+ selectorList.add(selectorList.indexOf(selector), replace);
+ selectorList.remove(selector);
+ }
+ }
+ }
+ }
+
+ public String getSelectors() {
+ StringBuilder b = new StringBuilder();
+ for (final String s : selectorList) {
+ b.append(s);
+ }
+
+ return b.toString();
+ }
+
+ public void setParentNode(Node node) {
+ parentNode.removeChild(this);
+ node.appendChild(this);
+ }
+
+ @Override
+ public void traverse() {
+ try {
+ BlockNodeHandler.traverse(this);
+ replaceVariables(ScssStylesheet.getVariables());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.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;
+ }
+
+ @Override
+ public void traverse() {
+ // Not used in CommentNode
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.visitor.ExtendNodeHandler;
+
+public class ExtendNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 3301805078983796878L;
+
+ ArrayList<String> list;
+
+ public ExtendNode(ArrayList<String> list) {
+ super();
+ this.list = list;
+ }
+
+ public ArrayList<String> getList() {
+ return list;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+
+ }
+
+ public String getListAsString() {
+ StringBuilder b = new StringBuilder();
+ for (final String s : list) {
+ b.append(s);
+ }
+
+ return b.toString();
+ }
+
+ @Override
+ public void traverse() {
+ try {
+ ExtendNodeHandler.traverse(this);
+ getParentNode().removeChild(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+public class FontFaceNode extends Node {
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("@font-face {\n");
+
+ for (final Node child : children) {
+ builder.append("\t" + child.toString() + "\n");
+ }
+
+ builder.append("}");
+ return builder.toString();
+ }
+
+ @Override
+ public void traverse() {
+ // Not in use for FontFaceNode
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+public class ForNode extends Node {
+ private static final long serialVersionUID = -1159180539216623335L;
+
+ String var;
+ String from;
+ String to;
+ boolean exclusive;
+ String body;
+
+ public ForNode(String var, String from, String to, boolean exclusive,
+ String body) {
+ super();
+ this.var = var;
+ this.from = from;
+ this.to = to;
+ this.exclusive = exclusive;
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ return "For Node: " + "{variable: " + var + ", from:" + from + ", to: "
+ + to + ", exclusive: " + exclusive + ", body" + body;
+ }
+
+ @Override
+ public void traverse() {
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+
+public class FunctionNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = -5383104165955523923L;
+
+ private String name;
+ private String args;
+ private String body;
+
+ public FunctionNode(String name) {
+ super();
+ this.name = name;
+ }
+
+ public FunctionNode(String name, String args, String body) {
+ this.name = name;
+ this.args = args;
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ return "Function Node: {name: " + name + ", args: " + args + ", body: "
+ + body + "}";
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode node : variables) {
+ if (args.contains(node.getName())) {
+ args.replaceAll(node.getName(), node.getExpr().toString());
+ }
+ }
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+public interface IVariableNode {
+
+ public void replaceVariables(ArrayList<VariableNode> variables);
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import org.w3c.css.sac.SACMediaList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.visitor.ImportNodeHandler;
+
+public class ImportNode extends Node {
+ private static final long serialVersionUID = 5671255892282668438L;
+
+ private String uri;
+ private SACMediaList ml;
+ private boolean isURL;
+
+ public ImportNode(String uri, SACMediaList ml, boolean isURL) {
+ super();
+ this.uri = uri;
+ this.ml = ml;
+ this.isURL = isURL;
+ }
+
+ public boolean isPureCssImport() {
+ return (isURL || uri.endsWith(".css") || uri.startsWith("http://") || hasMediaQueries());
+ }
+
+ private boolean hasMediaQueries() {
+ return (ml != null && ml.getLength() >= 1 && !"all".equals(ml.item(0)));
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("@import ");
+ if (isURL) {
+ builder.append("url(").append(uri).append(")");
+ } else {
+ builder.append("\"").append(uri).append("\"");
+ }
+ if (hasMediaQueries()) {
+ for (int i = 0; i < ml.getLength(); i++) {
+ builder.append(" ").append(ml.item(i));
+ }
+ }
+ builder.append(";");
+ return builder.toString();
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public SACMediaList getMl() {
+ return ml;
+ }
+
+ @Override
+ public void traverse() {
+ // TODO shouldn't be reached with current setup, try anyway?
+ ImportNodeHandler.traverse((ScssStylesheet) getParentNode());
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+public class ListAppendNode extends ListModifyNode {
+
+ public ListAppendNode(String variable, String list, String append,
+ String separator) {
+ this.variable = variable;
+ checkSeparator(separator, list);
+ populateList(list, append);
+ }
+
+ @Override
+ protected void modifyList(ArrayList<String> newList) {
+ newList.addAll(modify);
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+
+public class ListContainsNode extends ListModifyNode {
+
+ public ListContainsNode(String variable, String list, String contains,
+ String separator) {
+ this.variable = variable;
+ checkSeparator(separator, list);
+ populateList(list, contains);
+ }
+
+ @Override
+ protected void modifyList(ArrayList<String> newList) {
+ // Does not actually modify the list
+ }
+
+ @Override
+ public VariableNode getModifiedList() {
+
+ String contains = "" + list.containsAll(modify);
+ VariableNode node = new VariableNode(variable.substring(1),
+ LexicalUnitImpl.createString(contains), false);
+ return node;
+
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+
+public abstract class ListModifyNode extends Node implements IVariableNode {
+
+ protected ArrayList<String> list;
+ protected ArrayList<String> modify;
+ protected String separator = " ";
+ protected String variable;
+
+ public String getNewVariable() {
+ return variable;
+ }
+
+ public VariableNode getModifiedList() {
+ final ArrayList<String> newList = new ArrayList<String>(list);
+ modifyList(newList);
+
+ LexicalUnitImpl unit = null;
+ if (newList.size() > 0) {
+ unit = LexicalUnitImpl.createIdent(newList.get(0));
+ LexicalUnitImpl last = unit;
+ for (int i = 1; i < newList.size(); i++) {
+ LexicalUnitImpl current = LexicalUnitImpl.createIdent(newList
+ .get(i));
+ last.setNextLexicalUnit(current);
+ last = current;
+ }
+
+ }
+ VariableNode node = new VariableNode(variable.substring(1), unit, false);
+ return node;
+ }
+
+ protected abstract void modifyList(ArrayList<String> newList);
+
+ protected void checkSeparator(String separator, String list) {
+ String lowerCase = "";
+ if (separator == null
+ || (lowerCase = separator.toLowerCase()).equals("auto")) {
+ if (list.contains(",")) {
+ this.separator = ",";
+ }
+ } else if (lowerCase.equals("comma")) {
+ this.separator = ",";
+ } else if (lowerCase.equals("space")) {
+ this.separator = " ";
+ }
+ }
+
+ protected void populateList(String list, String modify) {
+ this.list = new ArrayList<String>(Arrays.asList(list.split(separator)));
+ this.modify = new ArrayList<String>(Arrays.asList(modify
+ .split(separator)));
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final String listVar : new ArrayList<String>(list)) {
+ replacePossibleVariable(variables, listVar, list);
+ }
+
+ for (final String listVar : new ArrayList<String>(modify)) {
+ replacePossibleVariable(variables, listVar, modify);
+ }
+
+ }
+
+ private void replacePossibleVariable(ArrayList<VariableNode> variables,
+ final String listVar, ArrayList<String> list) {
+ if (listVar.startsWith("$")) {
+
+ for (final VariableNode var : variables) {
+
+ if (var.getName().equals(listVar.substring(1))) {
+
+ String[] split = null;
+ if (var.getExpr().toString().contains(",")) {
+ split = var.getExpr().toString().split(",");
+ } else {
+ split = var.getExpr().toString().split(" ");
+ }
+ int i = list.indexOf(listVar);
+ for (final String s : split) {
+ list.add(i, s.trim());
+ i++;
+ }
+
+ list.remove(listVar);
+ break;
+
+ }
+ }
+
+ }
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ ScssStylesheet.addVariable(getModifiedList());
+ getParentNode().removeChild(this);
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+public class ListRemoveNode extends ListModifyNode {
+
+ public ListRemoveNode(String variable, String list, String remove,
+ String separator) {
+ this.variable = variable;
+ checkSeparator(separator, list);
+ populateList(list, remove);
+
+ }
+
+ @Override
+ protected void modifyList(ArrayList<String> newList) {
+ newList.removeAll(modify);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import org.w3c.css.sac.SACMediaList;
+
+public class MediaNode extends Node {
+ private static final long serialVersionUID = 2502097081457509523L;
+
+ SACMediaList media;
+
+ public MediaNode(SACMediaList media) {
+ super();
+ this.media = media;
+ }
+
+ public SACMediaList getMedia() {
+ return media;
+ }
+
+ public void setMedia(SACMediaList media) {
+ this.media = media;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("@media ");
+ if (media != null) {
+ for (int i = 0; i < media.getLength(); i++) {
+ builder.append(media.item(i));
+ }
+ }
+ builder.append(" {\n");
+ for (Node child : children) {
+ if (child instanceof BlockNode) {
+ builder.append("\t" + ((BlockNode) child).toString(true) + "\n");
+ } else {
+ builder.append("\t" + child.toString() + "\n");
+ }
+
+ }
+ builder.append("}");
+ return builder.toString();
+ }
+
+ @Override
+ public void traverse() {
+
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+
+public class MicrosoftRuleNode extends Node implements IVariableNode {
+
+ private final String name;
+ private String value;
+
+ public MicrosoftRuleNode(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode var : variables) {
+ if (value.contains("$" + var.getName())) {
+ value = value.replaceAll("$" + var.getName(), var.getExpr()
+ .toString());
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return name + ": " + value + ";";
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.util.DeepCopy;
+
+public class MixinDefNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 5469294053247343948L;
+
+ private String name;
+ private ArrayList<VariableNode> arglist;
+ private String body;
+
+ public MixinDefNode(String name, Collection<VariableNode> args) {
+ super();
+ this.name = name;
+ arglist = new ArrayList<VariableNode>();
+ if (args != null && !args.isEmpty()) {
+ arglist.addAll(args);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Mixin Definition Node: {name: " + name + ", args: "
+ + arglist.size() + ", body: " + body + "}";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ArrayList<VariableNode> getArglist() {
+ return arglist;
+ }
+
+ public void setArglist(ArrayList<VariableNode> arglist) {
+ this.arglist = arglist;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode var : variables) {
+ for (final VariableNode arg : new ArrayList<VariableNode>(arglist)) {
+ if (arg.getName().equals(var.getName())
+ && arg.getExpr() == null) {
+ arglist.add(arglist.indexOf(arg),
+ (VariableNode) DeepCopy.copy(var));
+ arglist.remove(arg);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void traverse() {
+ if (!arglist.isEmpty()) {
+ for (final VariableNode arg : arglist) {
+ if (arg.getExpr() != null) {
+ ScssStylesheet.addVariable(arg);
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.visitor.MixinNodeHandler;
+
+public class MixinNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 4725008226813110658L;
+
+ private String name;
+ private ArrayList<LexicalUnitImpl> arglist;
+
+ public MixinNode(String name, Collection<LexicalUnitImpl> args) {
+ super();
+ this.name = name;
+ arglist = new ArrayList<LexicalUnitImpl>();
+ if (args != null && !args.isEmpty()) {
+ arglist.addAll(args);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "name: " + name + " args: " + arglist;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ArrayList<LexicalUnitImpl> getArglist() {
+ return arglist;
+ }
+
+ public void setArglist(ArrayList<LexicalUnitImpl> arglist) {
+ this.arglist = arglist;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode var : variables) {
+ for (final LexicalUnitImpl arg : new ArrayList<LexicalUnitImpl>(
+ arglist)) {
+ if (arg.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
+ && arg.getStringValue().equals(var.getName())) {
+ arg.replaceValue(var.getExpr());
+ }
+ }
+
+ if (name.startsWith("$")) {
+ if (name.equals("$" + var.getName())) {
+ name = var.getExpr().toString();
+ }
+ } else if (name.startsWith("#{") && name.endsWith("}")) {
+ if (name.equals("#{$" + var.getName() + "}")) {
+ name = var.getExpr().toString();
+ }
+ }
+
+ }
+ }
+
+ @Override
+ public void traverse() {
+ try {
+ replaceVariables(ScssStylesheet.getVariables());
+ MixinNodeHandler.traverse(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import com.vaadin.sass.internal.visitor.NestedNodeHandler;
+
+public class NestPropertiesNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 3671253315690598308L;
+
+ public NestPropertiesNode(String name) {
+ super();
+ this.name = name;
+ }
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Collection<RuleNode> unNesting() {
+ List<RuleNode> result = new ArrayList<RuleNode>();
+ for (Node child : children) {
+ RuleNode createNewRuleNodeFromChild = createNewRuleNodeFromChild((RuleNode) child);
+ result.add(createNewRuleNodeFromChild);
+ }
+ return result;
+ }
+
+ public RuleNode createNewRuleNodeFromChild(RuleNode child) {
+ StringBuilder builder = new StringBuilder(name);
+ builder.append("-").append(child.getVariable());
+ RuleNode newRuleNode = new RuleNode(builder.toString(),
+ child.getValue(), child.isImportant(), null);
+ return newRuleNode;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode node : variables) {
+ if (name.contains(node.getName())) {
+ name = name.replaceAll(node.getName(), node.getExpr()
+ .toString());
+ }
+ }
+ }
+
+ @Override
+ public void traverse() {
+ NestedNodeHandler.traverse(this);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+public abstract class Node implements Serializable {
+ private static final long serialVersionUID = 5914711715839294816L;
+
+ protected ArrayList<Node> children;
+
+ protected Node parentNode;
+
+ public Node() {
+ children = new ArrayList<Node>();
+ }
+
+ public void appendAll(Collection<Node> nodes) {
+ if (nodes != null && !nodes.isEmpty()) {
+ children.addAll(nodes);
+
+ for (final Node n : nodes) {
+ if (n.getParentNode() != null) {
+ n.getParentNode().removeChild(n);
+ }
+ n.setParentNode(this);
+ }
+
+ }
+ }
+
+ public void appendChild(Node node) {
+ if (node != null) {
+ children.add(node);
+ if (node.getParentNode() != null) {
+ node.getParentNode().removeChild(node);
+ }
+ node.setParentNode(this);
+ }
+ }
+
+ public void appendChild(Node node, Node after) {
+ if (node != null) {
+ int index = children.indexOf(after);
+ if (index != -1) {
+ children.add(index + 1, node);
+ if (node.getParentNode() != null) {
+ node.getParentNode().removeChild(node);
+ }
+ node.setParentNode(this);
+ } else {
+ throw new NullPointerException("after-node was not found");
+ }
+ }
+ }
+
+ public void removeChild(Node node) {
+ if (node != null) {
+ boolean removed = children.remove(node);
+ if (removed) {
+ node.setParentNode(null);
+ }
+ }
+ }
+
+ public ArrayList<Node> getChildren() {
+ return children;
+ }
+
+ public void setChildren(ArrayList<Node> children) {
+ this.children = children;
+ }
+
+ public boolean hasChildren() {
+ return !children.isEmpty();
+ }
+
+ @Override
+ public String toString() {
+ return "";
+ }
+
+ /**
+ * Method for manipulating the data contained within the {@link Node}.
+ *
+ * Traversing a node is allowed to modify the node, replace it with one or
+ * more nodes at the same or later position in its parent and modify the
+ * children of the node, but not modify or remove preceding nodes in its
+ * parent.
+ */
+ public abstract void traverse();
+
+ public Node getParentNode() {
+ return parentNode;
+ }
+
+ private void setParentNode(Node parentNode) {
+ this.parentNode = parentNode;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+
+public class RuleNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 6653493127869037022L;
+
+ String variable;
+ LexicalUnitImpl value;
+ String comment;
+ private boolean important;
+
+ public RuleNode(String variable, LexicalUnitImpl value, boolean important,
+ String comment) {
+ this.variable = variable;
+ this.value = value;
+ this.important = important;
+ this.comment = comment;
+ }
+
+ public String getVariable() {
+ return variable;
+ }
+
+ public void setVariable(String variable) {
+ this.variable = variable;
+ }
+
+ public LexicalUnitImpl getValue() {
+ return value;
+ }
+
+ public void setValue(LexicalUnitImpl value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(variable).append(": ").append(value.toString());
+ builder.append(important ? " !important;" : ";");
+ if (comment != null) {
+ builder.append(comment);
+ }
+ return builder.toString();
+ }
+
+ public boolean isImportant() {
+ return important;
+ }
+
+ public void setImportant(boolean important) {
+ this.important = important;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode node : variables) {
+
+ String interpolation = "#{$" + node.getName() + "}";
+
+ if (value.getLexicalUnitType() == LexicalUnitImpl.SAC_FUNCTION) {
+
+ if (value.getParameters() != null) {
+ if (value.getParameters().toString()
+ .contains(node.getName())) {
+
+ LexicalUnitImpl param = value.getParameters();
+ while (param != null) {
+ if (param.getValue().toString()
+ .contains(node.getName())) {
+
+ String value = node.getExpr().toString();
+
+ LexicalUnitImpl prev = param
+ .getPreviousLexicalUnit();
+ LexicalUnitImpl next = param
+ .getNextLexicalUnit();
+
+ if (param.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) {
+ param.setStringValue(value);
+ param.setLexicalUnitType(node.getExpr()
+ .getLexicalUnitType());
+ param.setPrevLexicalUnit(prev);
+ param.setNextLexicalUnit(next);
+ }
+ }
+ param = param.getNextLexicalUnit();
+ }
+ }
+ }
+ } else if (value.getStringValue() != null
+ && value.getStringValue().contains(interpolation)) {
+ LexicalUnitImpl current = value;
+ while (current != null) {
+ if (current.getValue().toString().contains(interpolation)) {
+
+ current.setStringValue(current
+ .getValue()
+ .toString()
+ .replaceAll(Pattern.quote(interpolation),
+ node.getExpr().toString()));
+ }
+ current = current.getNextLexicalUnit();
+ }
+ } else {
+ LexicalUnitImpl current = value;
+ while (current != null) {
+ if (current.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
+ && current.getValue().toString()
+ .equals(node.getName())) {
+
+ current.replaceValue(node.getExpr());
+ }
+ current = current.getNextLexicalUnit();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+
+/**
+ * A simple BlockNode where input text equals output. <b>Note : </b> ignores any
+ * possible children so only use it when you are sure no child nodes will be
+ * applied.
+ *
+ * @author Sebastian Nyholm @ Vaadin Ltd
+ *
+ */
+public class SimpleNode extends Node implements IVariableNode {
+
+ private String text;
+
+ public SimpleNode(String text) {
+ this.text = text;
+
+ }
+
+ @Override
+ public String toString() {
+ return text;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode node : variables) {
+ if (text.contains(node.getName())) {
+ text = text.replaceAll(node.getName(), node.getExpr()
+ .toString());
+ }
+ }
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.visitor.VariableNodeHandler;
+
+public class VariableNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 7003372557547748734L;
+
+ private String name;
+ private LexicalUnitImpl expr;
+ private boolean guarded;
+
+ public VariableNode(String name, LexicalUnitImpl expr, boolean guarded) {
+ super();
+ this.name = name;
+ this.expr = expr;
+ this.guarded = guarded;
+ }
+
+ public LexicalUnitImpl getExpr() {
+ return expr;
+ }
+
+ public void setExpr(LexicalUnitImpl expr) {
+ this.expr = expr;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean isGuarded() {
+ return guarded;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("$");
+ builder.append(name).append(": ").append(expr);
+ return builder.toString();
+ }
+
+ public void setGuarded(boolean guarded) {
+ this.guarded = guarded;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode node : variables) {
+ if (!equals(node)) {
+
+ if (expr.toString().contains("$" + node.getName())) {
+ if (expr.getParameters() != null
+ && expr.getParameters().toString()
+ .contains("$" + node.getName())) {
+ replaceValues(expr.getParameters(), node);
+ } else if (expr.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) {
+ replaceValues(expr, node);
+ }
+ }
+ }
+ }
+ }
+
+ private void replaceValues(LexicalUnitImpl unit, VariableNode node) {
+ while (unit != null) {
+
+ if (unit.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
+ && unit.getValue().toString().equals(node.getName())) {
+ LexicalUnitImpl.replaceValues(unit, node.getExpr());
+ }
+
+ unit = unit.getNextLexicalUnit();
+ }
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ VariableNodeHandler.traverse(this);
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree;
+
+public class WhileNode extends Node {
+ private static final long serialVersionUID = 7593896018196027279L;
+
+ private String condition;
+ private String body;
+
+ public WhileNode(String condition, String body) {
+ this.condition = condition;
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ return "While Node: { condition: " + condition + ", body:" + body + "}";
+ }
+
+ @Override
+ public void traverse() {
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.tree.controldirective;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.tree.IVariableNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.VariableNode;
+import com.vaadin.sass.internal.visitor.EachNodeHandler;
+
+public class EachDefNode extends Node implements IVariableNode {
+ private static final long serialVersionUID = 7943948981204906221L;
+
+ private String var;
+ private ArrayList<String> list;
+
+ private String listVariable;
+
+ public EachDefNode(String var, ArrayList<String> list) {
+ super();
+ this.var = var;
+ this.list = list;
+ }
+
+ public EachDefNode(String var, String listVariable) {
+ this.var = var;
+ this.listVariable = listVariable;
+ }
+
+ public List<String> getVariables() {
+ return list;
+ }
+
+ public String getVariableName() {
+ return var;
+ }
+
+ @Override
+ public String toString() {
+ if (hasListVariable()) {
+ return "Each Definition Node: {variable : " + var + ", "
+ + "listVariable : " + listVariable + "}";
+ } else {
+ return "Each Definition Node: {variable : " + var + ", "
+ + "children : " + list.size() + "}";
+ }
+ }
+
+ public boolean hasListVariable() {
+ return listVariable != null;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ if (listVariable != null) {
+ for (final VariableNode var : variables) {
+ if (listVariable.equals(var.getName())) {
+
+ LexicalUnitImpl current = var.getExpr();
+ list = new ArrayList<String>();
+
+ while (current != null) {
+ if (current.getValue() != null
+ && current.getLexicalUnitType() != LexicalUnitImpl.SAC_OPERATOR_COMMA) {
+ list.add(current.getValue().toString());
+ }
+ current = current.getNextLexicalUnit();
+ }
+ listVariable = null;
+ break;
+ }
+ }
+
+ }
+ }
+
+ public String getListVariable() {
+ return listVariable;
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ EachNodeHandler.traverse(this);
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.tree.controldirective;
+
+import com.vaadin.sass.internal.tree.Node;
+
+public class ElseNode extends Node implements IfElseNode {
+
+ @Override
+ public String getExpression() {
+ return null;
+ }
+
+ @Override
+ public void traverse() {
+
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.tree.controldirective;
+
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.visitor.IfElseNodeHandler;
+
+public class IfElseDefNode extends Node {
+
+ @Override
+ public String toString() {
+ StringBuilder b = new StringBuilder();
+ for (final Node child : getChildren()) {
+ b.append(child.toString());
+ b.append("\n");
+ }
+ return b.toString();
+ }
+
+ @Override
+ public void traverse() {
+ try {
+
+ for (final Node child : children) {
+ child.traverse();
+ }
+
+ IfElseNodeHandler.traverse(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+package com.vaadin.sass.internal.tree.controldirective;
+
+public interface IfElseNode {
+
+ String getExpression();
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.sass.internal.tree.controldirective;
+
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.tree.IVariableNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.VariableNode;
+
+public class IfNode extends Node implements IfElseNode, IVariableNode {
+ private String expression;
+
+ public IfNode(String expression) {
+ this.expression = expression;
+ }
+
+ @Override
+ public String getExpression() {
+ if (expression != null) {
+ return expression.trim();
+ } else {
+ return "false";
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "@if" + expression;
+ }
+
+ @Override
+ public void replaceVariables(ArrayList<VariableNode> variables) {
+ for (final VariableNode node : variables) {
+ String variable = "$" + node.getName();
+ if (expression.contains(variable)) {
+ expression = expression.replaceAll(Pattern.quote(variable),
+ node.getExpr().toString());
+ }
+ }
+ }
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package com.vaadin.sass.internal.util;
+
+public interface Clonable {
+
+ public Object clone() throws CloneNotSupportedException;
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.util;
+
+import org.w3c.css.sac.LexicalUnit;
+
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+
+public class ColorUtil {
+ public static LexicalUnitImpl hexColorToHsl(LexicalUnitImpl hexColor) {
+ String s = hexColor.getStringValue().substring(1);
+ int r = 0, g = 0, b = 0;
+ if (s.length() == 3) {
+ String sh = s.substring(0, 1);
+ r = Integer.parseInt(sh + sh, 16);
+ sh = s.substring(1, 2);
+ g = Integer.parseInt(sh + sh, 16);
+ sh = s.substring(2, 3);
+ b = Integer.parseInt(sh + sh, 16);
+ } else if (s.length() == 6) {
+ r = Integer.parseInt(s.substring(0, 2), 16);
+ g = Integer.parseInt(s.substring(2, 4), 16);
+ b = Integer.parseInt(s.substring(4, 6), 16);
+ }
+ int hsl[] = calculateHsl(r, g, b);
+
+ LexicalUnitImpl hslParams = createHslParameters(hsl[0], hsl[1], hsl[2],
+ hexColor.getLineNumber(), hexColor.getColumnNumber(),
+ hexColor.getPreviousLexicalUnit());
+
+ return LexicalUnitImpl.createFunction(hexColor.getLineNumber(),
+ hexColor.getColumnNumber(), hexColor.getPreviousLexicalUnit(),
+ "hsl", hslParams);
+ }
+
+ public static LexicalUnitImpl hslToHexColor(LexicalUnitImpl hsl, int lengh) {
+ int[] rgb = calculateRgb(hsl);
+ StringBuilder builder = new StringBuilder("#");
+ for (int i = 0; i < 3; i++) {
+ String color = Integer.toHexString(rgb[i]);
+ if (lengh == 6) {
+ if (color.length() == 1) {
+ color = "0" + color;
+ }
+ }
+ if (lengh == 3) {
+ color = color.substring(0, 1);
+ }
+ builder.append(color);
+ }
+ return LexicalUnitImpl.createIdent(hsl.getLineNumber(),
+ hsl.getColumnNumber(), hsl.getPreviousLexicalUnit(),
+ builder.toString());
+ }
+
+ private static int[] calculateRgb(LexicalUnitImpl hsl) {
+ LexicalUnitImpl hslParam = hsl.getParameters();
+ LexicalUnitImpl hue = null;
+ LexicalUnitImpl saturation = null;
+ LexicalUnitImpl lightness = null;
+ int i = 0;
+ while (i < 5) {
+ switch (i) {
+ case 0:
+ hue = hslParam;
+ break;
+ case 2:
+ saturation = hslParam;
+ break;
+ case 4:
+ lightness = hslParam;
+ break;
+ case 1:
+ case 3:
+ break;
+ }
+ hslParam = hslParam.getNextLexicalUnit();
+ i++;
+ }
+ float h = ((hue.getIntegerValue() % 360) + 360) % 360 / 360f;
+ float s = saturation.getFloatValue() / 100;
+ float l = lightness.getFloatValue() / 100;
+ float m2, m1;
+ int[] rgb = new int[3];
+ m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
+ m1 = l * 2 - m2;
+ rgb[0] = Math.round(hueToRgb(m1, m2, h + 1f / 3) * 255);
+ rgb[1] = Math.round(hueToRgb(m1, m2, h) * 255);
+ rgb[2] = Math.round(hueToRgb(m1, m2, h - 1f / 3) * 255);
+ return rgb;
+ }
+
+ public static LexicalUnitImpl rgbToHsl(LexicalUnitImpl rgb) {
+ LexicalUnitImpl rgbParam = rgb.getParameters();
+ LexicalUnitImpl red = null;
+ LexicalUnitImpl green = null;
+ LexicalUnitImpl blue = null;
+ int i = 0;
+ while (i < 5) {
+ switch (i) {
+ case 0:
+ red = rgbParam;
+ break;
+ case 2:
+ green = rgbParam;
+ break;
+ case 4:
+ blue = rgbParam;
+ break;
+ case 1:
+ case 3:
+ break;
+ }
+ rgbParam = rgbParam.getNextLexicalUnit();
+ i++;
+ }
+
+ int hsl[] = calculateHsl(red.getIntegerValue(),
+ green.getIntegerValue(), blue.getIntegerValue());
+
+ rgbParam = rgb.getParameters();
+
+ LexicalUnitImpl hslParams = createHslParameters(hsl[0], hsl[1], hsl[2],
+ rgbParam.getLineNumber(), rgbParam.getColumnNumber(),
+ rgbParam.getPreviousLexicalUnit());
+
+ return LexicalUnitImpl.createFunction(rgb.getLineNumber(),
+ rgb.getColumnNumber(), rgb.getPreviousLexicalUnit(), "hsl",
+ hslParams);
+ }
+
+ private static int[] calculateHsl(int red, int green, int blue) {
+ int[] hsl = new int[3];
+
+ float r = red / 255f;
+ float g = green / 255f;
+ float b = blue / 255f;
+
+ float max = Math.max(Math.max(r, g), b);
+ float min = Math.min(Math.min(r, g), b);
+ float d = max - min;
+
+ float h = 0f, s = 0f, l = 0f;
+
+ if (max == min) {
+ h = 0;
+ }
+ if (max == r) {
+ h = 60 * (g - b) / d;
+ } else if (max == g) {
+ h = 60 * (b - r) / d + 120;
+ } else if (max == b) {
+ h = 60 * (r - g) / d + 240;
+ }
+
+ l = (max + min) / 2f;
+
+ if (max == min) {
+ s = 0;
+ } else if (l < 0.5) {
+ s = d / (2 * l);
+ } else {
+ s = d / (2 - 2 * l);
+ }
+
+ hsl[0] = Math.round(h % 360);
+ hsl[1] = Math.round(s * 100);
+ hsl[2] = Math.round(l * 100);
+
+ return hsl;
+ }
+
+ public static LexicalUnitImpl hslToRgb(LexicalUnitImpl hsl) {
+ int[] rgb = calculateRgb(hsl);
+ LexicalUnitImpl hslParam = hsl.getParameters();
+ LexicalUnitImpl rgbParams = createRgbParameters(rgb[0], rgb[1], rgb[2],
+ hslParam.getLineNumber(), hslParam.getColumnNumber(),
+ hslParam.getPreviousLexicalUnit());
+
+ return LexicalUnitImpl.createFunction(hsl.getLineNumber(),
+ hsl.getColumnNumber(), hsl.getPreviousLexicalUnit(), "rgb",
+ rgbParams);
+ }
+
+ private static float hueToRgb(float m1, float m2, float h) {
+ if (h < 0) {
+ h = h + 1;
+ }
+ if (h > 1) {
+ h = h - 1;
+ }
+ if (h * 6 < 1) {
+ return m1 + (m2 - m1) * h * 6;
+ }
+ if (h * 2 < 1) {
+ return m2;
+ }
+ if (h * 3 < 2) {
+ return m1 + (m2 - m1) * (2f / 3 - h) * 6;
+ }
+ return m1;
+ }
+
+ private static LexicalUnitImpl createRgbParameters(int r, int g, int b,
+ int ln, int cn, LexicalUnitImpl prev) {
+ LexicalUnitImpl red = LexicalUnitImpl.createInteger(ln, cn, prev, r);
+ LexicalUnitImpl firstComma = LexicalUnitImpl.createComma(ln, cn, red);
+ LexicalUnitImpl green = LexicalUnitImpl.createInteger(ln, cn,
+ firstComma, g);
+ LexicalUnitImpl secondComma = LexicalUnitImpl
+ .createComma(ln, cn, green);
+ LexicalUnitImpl.createInteger(ln, cn, secondComma, b);
+ return red;
+ }
+
+ private static LexicalUnitImpl createHslParameters(int h, int s, int l,
+ int ln, int cn, LexicalUnitImpl prev) {
+ LexicalUnitImpl hue = LexicalUnitImpl.createInteger(ln, cn, prev, h);
+ LexicalUnitImpl firstComma = LexicalUnitImpl.createComma(ln, cn, hue);
+ LexicalUnitImpl saturation = LexicalUnitImpl.createPercentage(ln, cn,
+ firstComma, s);
+ LexicalUnitImpl secondComma = LexicalUnitImpl.createComma(ln, cn,
+ saturation);
+ LexicalUnitImpl.createPercentage(ln, cn, secondComma, l);
+ return hue;
+ }
+
+ public static LexicalUnitImpl darken(LexicalUnitImpl darkenFunc) {
+ LexicalUnitImpl color = darkenFunc.getParameters();
+ float amount = getAmountValue(color);
+ LexicalUnitImpl pre = darkenFunc.getPreviousLexicalUnit();
+
+ return adjust(color, amount, ColorOperation.Darken, pre);
+ }
+
+ private static LexicalUnitImpl adjust(LexicalUnitImpl color,
+ float amountByPercent, ColorOperation op, LexicalUnitImpl pre) {
+ if (color.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION) {
+ LexicalUnit funcParam = color.getParameters();
+ if ("hsl".equals(color.getFunctionName())) {
+ LexicalUnit lightness = funcParam;
+ for (int index = 0; index < 4; index++) {
+ lightness = lightness.getNextLexicalUnit();
+ }
+ float newValue = 0f;
+ if (op == ColorOperation.Darken) {
+ newValue = lightness.getFloatValue() - amountByPercent;
+ newValue = newValue < 0 ? 0 : newValue;
+ } else if (op == ColorOperation.Lighten) {
+ newValue = lightness.getFloatValue() + amountByPercent;
+ newValue = newValue > 100 ? 100 : newValue;
+ }
+ ((LexicalUnitImpl) lightness).setFloatValue(newValue);
+ return LexicalUnitImpl.createFunction(color.getLineNumber(),
+ color.getColumnNumber(), pre, color.getFunctionName(),
+ funcParam);
+ }
+
+ } else if (color.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
+ if (color.getStringValue().startsWith("#")) {
+ return hslToHexColor(
+ adjust(hexColorToHsl(color), amountByPercent, op, pre),
+ color.getStringValue().substring(1).length());
+ }
+ } else if (color.getLexicalUnitType() == LexicalUnit.SAC_RGBCOLOR) {
+ LexicalUnitImpl hsl = rgbToHsl(color);
+ LexicalUnitImpl hslAfterDarken = adjust(hsl, amountByPercent, op,
+ pre);
+ return hslToRgb(hslAfterDarken);
+ }
+ return color;
+ }
+
+ public static LexicalUnitImpl lighten(LexicalUnitImpl lightenFunc) {
+ LexicalUnitImpl color = lightenFunc.getParameters();
+ float amount = getAmountValue(color);
+ LexicalUnitImpl pre = lightenFunc.getPreviousLexicalUnit();
+
+ return adjust(color, amount, ColorOperation.Lighten, pre);
+ }
+
+ private static float getAmountValue(LexicalUnitImpl color) {
+ LexicalUnit next = color.getNextLexicalUnit();
+ float amount = 10f;
+ if (next != null && next.getNextLexicalUnit() != null) {
+ next = next.getNextLexicalUnit();
+ amount = next.getFloatValue();
+ }
+ return amount;
+ }
+
+ enum ColorOperation {
+ Darken, Lighten
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.util;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * Utility for making deep copies (vs. clone()'s shallow copies) of objects.
+ * Objects are first serialized and then deserialized. Error checking is fairly
+ * minimal in this implementation. If an object is encountered that cannot be
+ * serialized (or that references an object that cannot be serialized) an error
+ * is printed to System.err and null is returned. Depending on your specific
+ * application, it might make more sense to have copy(...) re-throw the
+ * exception.
+ */
+public class DeepCopy {
+
+ /**
+ * Returns a copy of the object, or null if the object cannot be serialized.
+ */
+ public static Object copy(Object orig) {
+
+ Object obj = null;
+ if (!(orig instanceof Clonable)) {
+ try {
+ // Write the object out to a byte array
+ FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(fbos);
+ out.writeObject(orig);
+ out.flush();
+ out.close();
+
+ // Retrieve an input stream from the byte array and read
+ // a copy of the object back in.
+ ObjectInputStream in = new ObjectInputStream(
+ fbos.getInputStream());
+ obj = in.readObject();
+ in.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException cnfe) {
+ cnfe.printStackTrace();
+ }
+ return obj;
+ } else {
+ try {
+ obj = ((Clonable) orig).clone();
+ } catch (ClassCastException e2) {
+ // Can't clone, return obj as null
+ } catch (CloneNotSupportedException e2) {
+ // Can't clone, return obj as null
+ }
+ return obj;
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.util;
+
+import java.io.InputStream;
+
+/**
+ * ByteArrayInputStream implementation that does not synchronize methods.
+ */
+public class FastByteArrayInputStream extends InputStream {
+ /**
+ * Our byte buffer
+ */
+ protected byte[] buf = null;
+
+ /**
+ * Number of bytes that we can read from the buffer
+ */
+ protected int count = 0;
+
+ /**
+ * Number of bytes that have been read from the buffer
+ */
+ protected int pos = 0;
+
+ public FastByteArrayInputStream(byte[] buf, int count) {
+ this.buf = buf;
+ this.count = count;
+ }
+
+ @Override
+ public final int available() {
+ return count - pos;
+ }
+
+ @Override
+ public final int read() {
+ return (pos < count) ? (buf[pos++] & 0xff) : -1;
+ }
+
+ @Override
+ public final int read(byte[] b, int off, int len) {
+ if (pos >= count) {
+ return -1;
+ }
+
+ if ((pos + len) > count) {
+ len = (count - pos);
+ }
+
+ System.arraycopy(buf, pos, b, off, len);
+ pos += len;
+ return len;
+ }
+
+ @Override
+ public final long skip(long n) {
+ if ((pos + n) > count) {
+ n = count - pos;
+ }
+ if (n < 0) {
+ return 0;
+ }
+ pos += n;
+ return n;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.util;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * ByteArrayOutputStream implementation that doesn't synchronize methods and
+ * doesn't copy the data on toByteArray().
+ */
+public class FastByteArrayOutputStream extends OutputStream {
+ /**
+ * Buffer and size
+ */
+ protected byte[] buf = null;
+ protected int size = 0;
+
+ /**
+ * Constructs a stream with buffer capacity size 5K
+ */
+ public FastByteArrayOutputStream() {
+ this(5 * 1024);
+ }
+
+ /**
+ * Constructs a stream with the given initial size
+ */
+ public FastByteArrayOutputStream(int initSize) {
+ size = 0;
+ buf = new byte[initSize];
+ }
+
+ /**
+ * Ensures that we have a large enough buffer for the given size.
+ */
+ private void verifyBufferSize(int sz) {
+ if (sz > buf.length) {
+ byte[] old = buf;
+ buf = new byte[Math.max(sz, 2 * buf.length)];
+ System.arraycopy(old, 0, buf, 0, old.length);
+ old = null;
+ }
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ /**
+ * Returns the byte array containing the written data. Note that this array
+ * will almost always be larger than the amount of data actually written.
+ */
+ public byte[] getByteArray() {
+ return buf;
+ }
+
+ @Override
+ public final void write(byte b[]) {
+ verifyBufferSize(size + b.length);
+ System.arraycopy(b, 0, buf, size, b.length);
+ size += b.length;
+ }
+
+ @Override
+ public final void write(byte b[], int off, int len) {
+ verifyBufferSize(size + len);
+ System.arraycopy(b, off, buf, size, len);
+ size += len;
+ }
+
+ @Override
+ public final void write(int b) {
+ verifyBufferSize(size + 1);
+ buf[size++] = (byte) b;
+ }
+
+ public void reset() {
+ size = 0;
+ }
+
+ /**
+ * Returns a ByteArrayInputStream for reading back the written data
+ */
+ public InputStream getInputStream() {
+ return new FastByteArrayInputStream(buf, size);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+public class StringUtil {
+ private static final String FOLDER_SEPARATOR = "/"; // folder separator
+
+ private static final String WINDOWS_FOLDER_SEPARATOR = "\\"; // Windows
+ // folder
+ // separator
+
+ private static final String TOP_PATH = ".."; // top folder
+
+ private static final String CURRENT_PATH = "."; // current folder
+
+ public static String cleanPath(String path) {
+ String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR,
+ FOLDER_SEPARATOR);
+ String[] pathArray = delimitedListToStringArray(pathToUse,
+ FOLDER_SEPARATOR);
+ List pathElements = new LinkedList();
+ int tops = 0;
+ for (int i = pathArray.length - 1; i >= 0; i--) {
+ if (CURRENT_PATH.equals(pathArray[i])) {
+ // do nothing
+ } else if (TOP_PATH.equals(pathArray[i])) {
+ tops++;
+ } else {
+ if (tops > 0) {
+ tops--;
+ } else {
+ pathElements.add(0, pathArray[i]);
+ }
+ }
+ }
+ for (int i = 0; i < tops; i++) {
+ pathElements.add(0, TOP_PATH);
+ }
+ return collectionToDelimitedString(pathElements, FOLDER_SEPARATOR);
+ }
+
+ public static String replace(String inString, String oldPattern,
+ String newPattern) {
+ if (inString == null) {
+ return null;
+ }
+ if (oldPattern == null || newPattern == null) {
+ return inString;
+ }
+
+ StringBuffer sbuf = new StringBuffer();
+ // output StringBuffer we'll build up
+ int pos = 0; // our position in the old string
+ int index = inString.indexOf(oldPattern);
+ // the index of an occurrence we've found, or -1
+ int patLen = oldPattern.length();
+ while (index >= 0) {
+ sbuf.append(inString.substring(pos, index));
+ sbuf.append(newPattern);
+ pos = index + patLen;
+ index = inString.indexOf(oldPattern, pos);
+ }
+ sbuf.append(inString.substring(pos));
+
+ // remember to append any characters to the right of a match
+ return sbuf.toString();
+ }
+
+ public static String[] delimitedListToStringArray(String str,
+ String delimiter) {
+ if (str == null) {
+ return new String[0];
+ }
+ if (delimiter == null) {
+ return new String[] { str };
+ }
+
+ List result = new ArrayList();
+ int pos = 0;
+ int delPos = 0;
+ while ((delPos = str.indexOf(delimiter, pos)) != -1) {
+ result.add(str.substring(pos, delPos));
+ pos = delPos + delimiter.length();
+ }
+ if (str.length() > 0 && pos <= str.length()) {
+ // Add rest of String, but not in case of empty input.
+ result.add(str.substring(pos));
+ }
+
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ public static String collectionToDelimitedString(Collection coll,
+ String delim, String prefix, String suffix) {
+ if (coll == null) {
+ return "";
+ }
+
+ StringBuffer sb = new StringBuffer();
+ Iterator it = coll.iterator();
+ int i = 0;
+ while (it.hasNext()) {
+ if (i > 0) {
+ sb.append(delim);
+ }
+ sb.append(prefix).append(it.next()).append(suffix);
+ i++;
+ }
+ return sb.toString();
+ }
+
+ public static String collectionToDelimitedString(Collection coll,
+ String delim) {
+ return collectionToDelimitedString(coll, delim, "", "");
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.Node;
+
+/**
+ * Handle nesting of blocks by moving child blocks to their parent, updating
+ * their selector lists while doing so. Also parent selectors (&) are
+ * handled here.
+ *
+ * Sample SASS code (from www.sass-lang.com):
+ *
+ * <pre>
+ * table.hl {
+ * margin: 2em 0;
+ * td.ln {
+ * text-align: right;
+ * }
+ * }
+ * </pre>
+ *
+ * Note that nested properties are handled by {@link NestedNodeHandler}, not
+ * here.
+ */
+public class BlockNodeHandler {
+
+ public static void traverse(BlockNode node) {
+
+ if (node.getChildren().size() == 0) {
+ // empty blocks are removed later
+ return;
+ }
+
+ Node parent = node.getParentNode();
+
+ if (parent instanceof BlockNode) {
+ combineParentSelectorListToChild(node);
+
+ } else if (node.getSelectors().contains("&")) {
+ ScssStylesheet.warning("Base-level rule contains"
+ + " the parent-selector-referencing character '&';"
+ + " the character will be removed:\n" + node);
+ removeParentReference(node);
+ }
+ }
+
+ /**
+ * Goes through the selector list of the given BlockNode and removes the '&'
+ * character from the selectors.
+ *
+ * @param node
+ */
+ private static void removeParentReference(BlockNode node) {
+ ArrayList<String> newList = new ArrayList<String>();
+ for (String childSelector : node.getSelectorList()) {
+ // remove parent selector
+ if (childSelector.contains("&")) {
+ newList.add(childSelector.replace("&", ""));
+ } else {
+ newList.add(childSelector);
+ }
+ }
+ node.setSelectorList(newList);
+ }
+
+ private static void combineParentSelectorListToChild(BlockNode node) {
+ ArrayList<String> newList = new ArrayList<String>();
+ BlockNode parentBlock = (BlockNode) node.getParentNode();
+ for (String parentSelector : parentBlock.getSelectorList()) {
+ for (String childSelector : node.getSelectorList()) {
+ // handle parent selector
+ if (childSelector.contains("&")) {
+ newList.add(childSelector.replace("&", parentSelector));
+ } else {
+ newList.add(parentSelector + " " + childSelector);
+ }
+ }
+ }
+ node.setSelectorList(newList);
+ Node oldParent = node.getParentNode();
+ HashMap<Node, Node> lastNodeAdded = ScssStylesheet.getLastNodeAdded();
+ if (lastNodeAdded.get(oldParent) != null) {
+ oldParent.getParentNode().appendChild(node,
+ lastNodeAdded.get(oldParent));
+ } else {
+ oldParent.getParentNode().appendChild(node, oldParent);
+ }
+
+ lastNodeAdded.put(oldParent, node);
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.visitor;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.tree.IVariableNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.VariableNode;
+import com.vaadin.sass.internal.tree.controldirective.EachDefNode;
+import com.vaadin.sass.internal.util.DeepCopy;
+
+public class EachNodeHandler {
+
+ public static void traverse(EachDefNode node) {
+ replaceEachDefNode(node);
+ }
+
+ private static void replaceEachDefNode(EachDefNode defNode) {
+ Node last = defNode;
+
+ for (final String var : defNode.getVariables()) {
+ VariableNode varNode = new VariableNode(defNode.getVariableName()
+ .substring(1), LexicalUnitImpl.createIdent(var), false);
+ ArrayList<VariableNode> variables = new ArrayList<VariableNode>(
+ ScssStylesheet.getVariables());
+ variables.add(varNode);
+
+ for (final Node child : defNode.getChildren()) {
+
+ Node copy = (Node) DeepCopy.copy(child);
+
+ replaceInterpolation(copy, variables);
+
+ defNode.getParentNode().appendChild(copy, last);
+ last = copy;
+ }
+
+ }
+ defNode.setChildren(new ArrayList<Node>());
+ defNode.getParentNode().removeChild(defNode);
+ }
+
+ private static void replaceInterpolation(Node copy,
+ ArrayList<VariableNode> variables) {
+ if (copy instanceof IVariableNode) {
+ IVariableNode n = (IVariableNode) copy;
+ n.replaceVariables(variables);
+ }
+
+ for (Node c : copy.getChildren()) {
+ replaceInterpolation(c, variables);
+ }
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.ExtendNode;
+import com.vaadin.sass.internal.tree.Node;
+
+public class ExtendNodeHandler {
+ private static Map<String, List<ArrayList<String>>> extendsMap = new HashMap<String, List<ArrayList<String>>>();
+
+ public static void traverse(ExtendNode node) throws Exception {
+ buildExtendsMap(node);
+ modifyTree(ScssStylesheet.get());
+ }
+
+ private static void modifyTree(Node node) throws Exception {
+ for (Node child : node.getChildren()) {
+ if (child instanceof BlockNode) {
+ BlockNode blockNode = (BlockNode) child;
+ String selectorString = blockNode.getSelectors();
+ if (extendsMap.get(selectorString) != null) {
+ for (ArrayList<String> sList : extendsMap
+ .get(selectorString)) {
+ ArrayList<String> clone = (ArrayList<String>) sList
+ .clone();
+ addAdditionalSelectorListToBlockNode(blockNode, clone,
+ null);
+ }
+ } else {
+ for (Entry<String, List<ArrayList<String>>> entry : extendsMap
+ .entrySet()) {
+ if (selectorString.contains(entry.getKey())) {
+ for (ArrayList<String> sList : entry.getValue()) {
+ ArrayList<String> clone = (ArrayList<String>) sList
+ .clone();
+ addAdditionalSelectorListToBlockNode(blockNode,
+ clone, entry.getKey());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private static void buildExtendsMap(ExtendNode node) {
+ String extendedString = node.getListAsString();
+ if (extendsMap.get(extendedString) == null) {
+ extendsMap.put(extendedString, new ArrayList<ArrayList<String>>());
+ }
+ extendsMap.get(extendedString).add(
+ ((BlockNode) node.getParentNode()).getSelectorList());
+ }
+
+ private static void addAdditionalSelectorListToBlockNode(
+ BlockNode blockNode, ArrayList<String> list, String selectorString) {
+ if (list != null) {
+ for (int i = 0; i < list.size(); i++) {
+ if (selectorString == null) {
+ blockNode.getSelectorList().add(list.get(i));
+ } else {
+ ArrayList<String> newTags = new ArrayList<String>();
+ for (final String existing : blockNode.getSelectorList()) {
+ if (existing.contains(selectorString)) {
+ newTags.add(existing.replace(selectorString,
+ list.get(i)));
+ }
+ }
+ blockNode.getSelectorList().addAll(newTags);
+ }
+ }
+ }
+ }
+}
--- /dev/null
+package com.vaadin.sass.internal.visitor;
+
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.jexl2.Expression;
+import org.apache.commons.jexl2.JexlEngine;
+import org.apache.commons.jexl2.JexlException;
+import org.w3c.flute.parser.ParseException;
+
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.controldirective.ElseNode;
+import com.vaadin.sass.internal.tree.controldirective.IfElseDefNode;
+import com.vaadin.sass.internal.tree.controldirective.IfElseNode;
+import com.vaadin.sass.internal.tree.controldirective.IfNode;
+
+public class IfElseNodeHandler {
+
+ private static final JexlEngine evaluator = new JexlEngine();
+ private static final Pattern pattern = Pattern
+ .compile("[a-zA-Z0-9]*[a-zA-Z]+[a-zA-Z0-9]*");
+
+ public static void traverse(IfElseDefNode node) throws Exception {
+
+ for (final Node child : node.getChildren()) {
+ if (child instanceof IfNode) {
+ try {
+ String expression = ((IfElseNode) child).getExpression();
+ // We need to add ' ' for strings in the expression for
+ // jexl to understand that is should do a string
+ // comparison
+ expression = replaceStrings(expression);
+ Expression e = evaluator.createExpression(expression);
+ try {
+ Object eval = e.evaluate(null);
+
+ Boolean result = false;
+ if (eval instanceof Boolean) {
+ result = (Boolean) eval;
+ } else if (eval instanceof String) {
+ result = Boolean.valueOf((String) eval);
+ }
+
+ if (result) {
+ replaceDefNodeWithCorrectChild(node,
+ node.getParentNode(), child);
+ break;
+ }
+ } catch (ClassCastException ex) {
+ throw new ParseException(
+ "Invalid @if/@else in scss file, not a boolean expression : "
+ + child.toString());
+ } catch (NullPointerException ex) {
+ throw new ParseException(
+ "Invalid @if/@else in scss file, not a boolean expression : "
+ + child.toString());
+ }
+ } catch (JexlException e) {
+ throw new ParseException(
+ "Invalid @if/@else in scss file for "
+ + child.toString());
+ }
+ } else {
+ if (!(child instanceof ElseNode)
+ && node.getChildren().indexOf(child) == node
+ .getChildren().size() - 1) {
+ throw new ParseException(
+ "Invalid @if/@else in scss file for " + node);
+ } else {
+ replaceDefNodeWithCorrectChild(node, node.getParentNode(),
+ child);
+ break;
+ }
+ }
+ }
+
+ node.getParentNode().removeChild(node);
+ }
+
+ private static String replaceStrings(String expression) {
+ expression = expression.replaceAll("\"", "");
+ Matcher m = pattern.matcher(expression);
+ StringBuffer b = new StringBuffer();
+ while (m.find()) {
+ String group = m.group();
+ m.appendReplacement(b, "'" + group + "'");
+ }
+ m.appendTail(b);
+ if (b.length() != 0) {
+ return b.toString();
+ }
+ return expression;
+ }
+
+ private static void replaceDefNodeWithCorrectChild(IfElseDefNode defNode,
+ Node parent, final Node child) {
+ for (final Node n : new ArrayList<Node>(child.getChildren())) {
+ parent.appendChild(n, defNode);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.LexicalUnit;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.tree.ImportNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.RuleNode;
+import com.vaadin.sass.internal.util.StringUtil;
+
+public class ImportNodeHandler {
+
+ public static void traverse(ScssStylesheet node) {
+ ArrayList<Node> c = new ArrayList<Node>(node.getChildren());
+ for (Node n : c) {
+ if (n instanceof ImportNode) {
+ ImportNode importNode = (ImportNode) n;
+ if (!importNode.isPureCssImport()) {
+ try {
+ StringBuilder filePathBuilder = new StringBuilder(
+ node.getFileName());
+ filePathBuilder.append(File.separatorChar).append(
+ importNode.getUri());
+ if (!filePathBuilder.toString().endsWith(".scss")) {
+ filePathBuilder.append(".scss");
+ }
+
+ ScssStylesheet imported = ScssStylesheet
+ .get(filePathBuilder.toString());
+ if (imported == null) {
+ imported = ScssStylesheet.get(importNode.getUri());
+ }
+ if (imported == null) {
+ throw new FileNotFoundException(importNode.getUri()
+ + " (parent: "
+ + ScssStylesheet.get().getFileName() + ")");
+ }
+
+ traverse(imported);
+
+ String prefix = getUrlPrefix(importNode.getUri());
+ if (prefix != null) {
+ updateUrlInImportedSheet(imported, prefix);
+ }
+
+ Node pre = importNode;
+ for (Node importedChild : new ArrayList<Node>(
+ imported.getChildren())) {
+ node.appendChild(importedChild, pre);
+ pre = importedChild;
+ }
+ node.removeChild(importNode);
+ } catch (CSSException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ private static String getUrlPrefix(String url) {
+ if (url == null) {
+ return null;
+ }
+ int pos = url.lastIndexOf('/');
+ if (pos == -1) {
+ return null;
+ }
+ return url.substring(0, pos + 1);
+ }
+
+ private static void updateUrlInImportedSheet(Node node, String prefix) {
+ for (Node child : node.getChildren()) {
+ if (child instanceof RuleNode) {
+ LexicalUnit value = ((RuleNode) child).getValue();
+ while (value != null) {
+ if (value.getLexicalUnitType() == LexicalUnit.SAC_URI) {
+ String path = value.getStringValue();
+ if (!path.startsWith("/") && !path.contains(":")) {
+ path = prefix + path;
+ path = StringUtil.cleanPath(path);
+ ((LexicalUnitImpl) value).setStringValue(path);
+ }
+ }
+ value = value.getNextLexicalUnit();
+ }
+
+ }
+ updateUrlInImportedSheet(child, prefix);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import java.util.ArrayList;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.tree.IVariableNode;
+import com.vaadin.sass.internal.tree.MixinDefNode;
+import com.vaadin.sass.internal.tree.MixinNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.VariableNode;
+import com.vaadin.sass.internal.util.DeepCopy;
+
+public class MixinNodeHandler {
+
+ public static void traverse(MixinNode node) throws Exception {
+ replaceMixins(node);
+ }
+
+ private static void replaceMixins(MixinNode node) throws Exception {
+ MixinDefNode mixinDef = ScssStylesheet.getMixinDefinition(node
+ .getName());
+ if (mixinDef == null) {
+ throw new Exception("Mixin Definition: " + node.getName()
+ + " not found");
+ }
+ replaceMixinNode(node, mixinDef);
+ }
+
+ private static void replaceMixinNode(MixinNode mixinNode,
+ MixinDefNode mixinDef) {
+ Node pre = mixinNode;
+
+ MixinDefNode defClone = (MixinDefNode) DeepCopy.copy(mixinDef);
+ defClone.traverse();
+
+ if (mixinDef.getArglist().isEmpty()) {
+ for (Node child : new ArrayList<Node>(defClone.getChildren())) {
+ mixinNode.getParentNode().appendChild(child, pre);
+ pre = child;
+ }
+ } else {
+
+ replacePossibleArguments(mixinNode, defClone);
+
+ Node previous = mixinNode;
+ for (final Node child : defClone.getChildren()) {
+
+ Node clone = (Node) DeepCopy.copy(child);
+
+ replaceChildVariables(defClone, clone);
+
+ mixinNode.getParentNode().appendChild(clone, previous);
+
+ previous = clone;
+
+ }
+
+ }
+
+ mixinNode.getParentNode().removeChild(mixinNode);
+ }
+
+ /**
+ * We have to replace all the mixin parameters. This is done in two phases.
+ * First phase replaces all the named parameters while the second replaces
+ * in order of remaining unmodified parameters.
+ *
+ * @param mixinNode
+ * @param def
+ */
+ private static void replacePossibleArguments(MixinNode mixinNode,
+ MixinDefNode def) {
+
+ if (mixinNode.getArglist().size() > 0) {
+ ArrayList<VariableNode> remainingNodes = new ArrayList<VariableNode>(
+ def.getArglist());
+ ArrayList<LexicalUnitImpl> remainingUnits = new ArrayList<LexicalUnitImpl>(
+ mixinNode.getArglist());
+
+ for (final LexicalUnitImpl unit : mixinNode.getArglist()) {
+ if (unit.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
+ && unit.getNextLexicalUnit() != null) {
+ for (final VariableNode node : def.getArglist()) {
+ if (node.getName().equals(unit.getValue().toString())) {
+ node.setExpr((LexicalUnitImpl) DeepCopy.copy(unit
+ .getNextLexicalUnit()));
+ remainingNodes.remove(node);
+ remainingUnits.remove(unit);
+ break;
+ }
+ }
+ }
+ }
+
+ int i = 0;
+ for (final LexicalUnitImpl unit : remainingUnits) {
+ remainingNodes.get(i).setExpr(
+ (LexicalUnitImpl) DeepCopy.copy(unit));
+ i++;
+ }
+
+ }
+
+ }
+
+ private static void replaceChildVariables(MixinDefNode mixinDef, Node node) {
+ for (final Node child : node.getChildren()) {
+ replaceChildVariables(mixinDef, child);
+ }
+ if (node instanceof IVariableNode) {
+ ((IVariableNode) node).replaceVariables(mixinDef.getArglist());
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import com.vaadin.sass.internal.tree.NestPropertiesNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.RuleNode;
+
+/**
+ * Handle nested properties nodes (e.g. "font: { family: serif; }" to
+ * "font-family: serif;").
+ *
+ * Sample SASS code (from www.sass-lang.com):
+ *
+ * <pre>
+ * li {
+ * font: {
+ * family: serif;
+ * weight: bold;
+ * size: 1.2em;
+ * }
+ * }
+ * </pre>
+ *
+ * Note that this does not apply to nested blocks, which are handled by
+ * {@link BlockNodeHandler}.
+ */
+public class NestedNodeHandler {
+
+ public static void traverse(NestPropertiesNode node) {
+ Node previous = node;
+ for (RuleNode unNested : node.unNesting()) {
+ node.getParentNode().appendChild(unNested, previous);
+ previous = unNested;
+ }
+ node.getParentNode().removeChild(node);
+ }
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.tree.VariableNode;
+
+public class VariableNodeHandler {
+
+ public static void traverse(VariableNode node) {
+ if (ScssStylesheet.getVariable(node.getName()) == null
+ || !node.isGuarded()) {
+ ScssStylesheet.addVariable(node);
+ }
+ node.getParentNode().removeChild(node);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.sass.internal.visitor;
+
+import com.vaadin.sass.internal.tree.Node;
+
+public interface Visitor {
+
+ public void traverse(Node node) throws Exception;
+}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */
-/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package com.vaadin.sass.parser;
-
-/**
- * This interface describes a character stream that maintains line and
- * column number positions of the characters. It also has the capability
- * to backup the stream to some extent. An implementation of this
- * interface is used in the TokenManager implementation generated by
- * JavaCCParser.
- *
- * All the methods except backup can be implemented in any fashion. backup
- * needs to be implemented correctly for the correct operation of the lexer.
- * Rest of the methods are all used to get information like line number,
- * column number and the String that constitutes a token and are not used
- * by the lexer. Hence their implementation won't affect the generated lexer's
- * operation.
- */
-
-public
-interface CharStream {
-
- /**
- * Returns the next character from the selected input. The method
- * of selecting the input is the responsibility of the class
- * implementing this interface. Can throw any java.io.IOException.
- */
- char readChar() throws java.io.IOException;
-
- @Deprecated
- /**
- * Returns the column position of the character last read.
- * @deprecated
- * @see #getEndColumn
- */
- int getColumn();
-
- @Deprecated
- /**
- * Returns the line number of the character last read.
- * @deprecated
- * @see #getEndLine
- */
- int getLine();
-
- /**
- * Returns the column number of the last character for current token (being
- * matched after the last call to BeginTOken).
- */
- int getEndColumn();
-
- /**
- * Returns the line number of the last character for current token (being
- * matched after the last call to BeginTOken).
- */
- int getEndLine();
-
- /**
- * Returns the column number of the first character for current token (being
- * matched after the last call to BeginTOken).
- */
- int getBeginColumn();
-
- /**
- * Returns the line number of the first character for current token (being
- * matched after the last call to BeginTOken).
- */
- int getBeginLine();
-
- /**
- * Backs up the input stream by amount steps. Lexer calls this method if it
- * had already read some characters, but could not use them to match a
- * (longer) token. So, they will be used again as the prefix of the next
- * token and it is the implemetation's responsibility to do this right.
- */
- void backup(int amount);
-
- /**
- * Returns the next character that marks the beginning of the next token.
- * All characters must remain in the buffer between two successive calls
- * to this method to implement backup correctly.
- */
- char BeginToken() throws java.io.IOException;
-
- /**
- * Returns a string made up of characters from the marked token beginning
- * to the current buffer position. Implementations have the choice of returning
- * anything that they want to. For example, for efficiency, one might decide
- * to just return null, which is a valid implementation.
- */
- String GetImage();
-
- /**
- * Returns an array of characters that make up the suffix of length 'len' for
- * the currently matched token. This is used to build up the matched string
- * for use in actions in the case of MORE. A simple and inefficient
- * implementation of this is as follows :
- *
- * {
- * String t = GetImage();
- * return t.substring(t.length() - len, t.length()).toCharArray();
- * }
- */
- char[] GetSuffix(int len);
-
- /**
- * The lexer calls this function to indicate that it is done with the stream
- * and hence implementations can free any resources held by this class.
- * Again, the body of this function can be just empty and it will not
- * affect the lexer's operation.
- */
- void Done();
-
-}
-/* JavaCC - OriginalChecksum=28e31651bf0ffe57018eaaa3310c55ac (do not edit this line) */
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. Generic_CharStream.java Version 0.7pre6 */
-package com.vaadin.sass.parser;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public final class Generic_CharStream implements CharStream
-{
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
- public int bufpos = -1;
- private int bufline[];
- private int bufcolumn[];
-
- private int column = 0;
- private int line = 1;
-
- private boolean prevCharIsCR = false;
- private boolean prevCharIsLF = false;
-
- private java.io.Reader reader;
-
- private char[] buffer;
- private int maxNextCharInd = 0;
- private int inBuf = 0;
-
- private final void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- private final void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i;
- try {
- if ((i = reader.read(buffer, maxNextCharInd,
- available - maxNextCharInd)) == -1)
- {
- reader.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
- public final char BeginToken() throws java.io.IOException
- {
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- private final void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public final char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
- return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
- }
-
- if (++bufpos >= maxNextCharInd)
- FillBuff();
-
- char c = (char)((char)0xff & buffer[bufpos]);
-
- UpdateLineColumn(c);
- return (c);
- }
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public final int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public final int getLine() {
- return bufline[bufpos];
- }
-
- public final int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- public final int getEndLine() {
- return bufline[bufpos];
- }
-
- public final int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- public final int getBeginLine() {
- return bufline[tokenBegin];
- }
-
- public final void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public Generic_CharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- reader = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- public Generic_CharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- reader = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- }
-
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- public final String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- public final char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
- return ret;
- }
-
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.<BR>
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
+++ /dev/null
-/*
- * (c) COPYRIGHT 1999 World Wide Web Consortium
- * (Massachusetts Institute of Technology, Institut National de Recherche
- * en Informatique et en Automatique, Keio University).
- * All Rights Reserved. http://www.w3.org/Consortium/Legal/
- *
- * $Id: JumpException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-/**
- * @version $Revision: 1.1 $
- * @author Philippe Le Hegaret
- */
-public class JumpException extends RuntimeException {
- private static final long serialVersionUID = -2010286909393046205L;
-
- /**
- * Creates a new JumpException
- */
- public JumpException() {
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 World Wide Web Consortium
- * (Massachusetts Institute of Technology, Institut National de Recherche
- * en Informatique et en Automatique, Keio University).
- * All Rights Reserved. http://www.w3.org/Consortium/Legal/
- *
- * $Id: LexicalUnitImpl.java,v 1.3 2000/02/15 02:08:19 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-import java.io.Serializable;
-
-import org.w3c.css.sac.LexicalUnit;
-
-import com.vaadin.sass.util.ColorUtil;
-
-/**
- * @version $Revision: 1.3 $
- * @author Philippe Le Hegaret
- *
- * @modified Sebastian Nyholm @ Vaadin Ltd
- */
-public class LexicalUnitImpl implements LexicalUnit, SCSSLexicalUnit,
- Serializable {
- private static final long serialVersionUID = -6649833716809789399L;
-
- LexicalUnitImpl prev;
- LexicalUnitImpl next;
-
- short type;
- int line;
- int column;
-
- int i;
- float f;
- short dimension;
- String sdimension;
- String s;
- String fname;
- LexicalUnitImpl params;
-
- LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl p) {
- if (p != null) {
- prev = p;
- p.next = this;
- }
- this.line = line;
- this.column = column - 1;
- this.type = type;
- }
-
- LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, int i) {
- this(SAC_INTEGER, line, column, previous);
- this.i = i;
- }
-
- LexicalUnitImpl(int line, int column, LexicalUnitImpl previous,
- short dimension, String sdimension, float f) {
- this(dimension, line, column, previous);
- this.f = f;
- this.dimension = dimension;
- this.sdimension = sdimension;
- }
-
- LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, short type,
- String s) {
- this(type, line, column, previous);
- this.s = s;
- }
-
- LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl previous,
- String fname, LexicalUnitImpl params) {
- this(type, line, column, previous);
- this.fname = fname;
- this.params = params;
- }
-
- public int getLineNumber() {
- return line;
- }
-
- public int getColumnNumber() {
- return column;
- }
-
- @Override
- public short getLexicalUnitType() {
- return type;
- }
-
- public void setLexicalUnitType(short type) {
- this.type = type;
- }
-
- public void getLexicalUnitType(short type) {
- this.type = type;
- }
-
- @Override
- public LexicalUnitImpl getNextLexicalUnit() {
- return next;
- }
-
- public void setNextLexicalUnit(LexicalUnitImpl n) {
- next = n;
- }
-
- @Override
- public LexicalUnitImpl getPreviousLexicalUnit() {
- return prev;
- }
-
- public void setPrevLexicalUnit(LexicalUnitImpl n) {
- prev = n;
- }
-
- @Override
- public int getIntegerValue() {
- return i;
- }
-
- void setIntegerValue(int i) {
- this.i = i;
- }
-
- @Override
- public float getFloatValue() {
- return f;
- }
-
- public void setFloatValue(float f) {
- this.f = f;
- }
-
- @Override
- public String getDimensionUnitText() {
- switch (type) {
- case SAC_PERCENTAGE:
- return "%";
- case SAC_EM:
- return "em";
- case SAC_EX:
- return "ex";
- case SAC_PIXEL:
- return "px";
- case SAC_CENTIMETER:
- return "cm";
- case SAC_MILLIMETER:
- return "mm";
- case SAC_INCH:
- return "in";
- case SAC_POINT:
- return "pt";
- case SAC_PICA:
- return "pc";
- case SAC_DEGREE:
- return "deg";
- case SAC_RADIAN:
- return "rad";
- case SAC_GRADIAN:
- return "grad";
- case SAC_MILLISECOND:
- return "ms";
- case SAC_SECOND:
- return "s";
- case SAC_HERTZ:
- return "Hz";
- case SAC_KILOHERTZ:
- return "kHz";
- case SAC_DIMENSION:
- return sdimension;
- default:
- throw new IllegalStateException("invalid dimension " + type);
- }
- }
-
- @Override
- public String getStringValue() {
- return s;
- }
-
- public void setStringValue(String str) {
- s = str;
- }
-
- @Override
- public String getFunctionName() {
- return fname;
- }
-
- @Override
- public LexicalUnitImpl getParameters() {
- return params;
- }
-
- @Override
- public LexicalUnitImpl getSubValues() {
- return params;
- }
-
- @Override
- public String toString() {
- short type = getLexicalUnitType();
- String text = null;
- switch (type) {
- case SCSS_VARIABLE:
- text = "$" + s;
- break;
- case LexicalUnit.SAC_OPERATOR_COMMA:
- text = ",";
- break;
- case LexicalUnit.SAC_OPERATOR_PLUS:
- text = "+";
- break;
- case LexicalUnit.SAC_OPERATOR_MINUS:
- text = "-";
- break;
- case LexicalUnit.SAC_OPERATOR_MULTIPLY:
- text = "*";
- break;
- case LexicalUnit.SAC_OPERATOR_SLASH:
- text = "/";
- break;
- case LexicalUnit.SAC_OPERATOR_MOD:
- text = "%";
- break;
- case LexicalUnit.SAC_OPERATOR_EXP:
- text = "^";
- break;
- case LexicalUnit.SAC_OPERATOR_LT:
- text = "<";
- break;
- case LexicalUnit.SAC_OPERATOR_GT:
- text = ">";
- break;
- case LexicalUnit.SAC_OPERATOR_LE:
- text = "<=";
- break;
- case LexicalUnit.SAC_OPERATOR_GE:
- text = "=>";
- break;
- case LexicalUnit.SAC_OPERATOR_TILDE:
- text = "~";
- break;
- case LexicalUnit.SAC_INHERIT:
- text = "inherit";
- break;
- case LexicalUnit.SAC_INTEGER:
- text = Integer.toString(getIntegerValue(), 10);
- break;
- case LexicalUnit.SAC_REAL:
- text = getFloatValue() + "";
- break;
- case LexicalUnit.SAC_EM:
- case LexicalUnit.SAC_EX:
- case LexicalUnit.SAC_PIXEL:
- case LexicalUnit.SAC_INCH:
- case LexicalUnit.SAC_CENTIMETER:
- case LexicalUnit.SAC_MILLIMETER:
- case LexicalUnit.SAC_POINT:
- case LexicalUnit.SAC_PICA:
- case LexicalUnit.SAC_PERCENTAGE:
- case LexicalUnit.SAC_DEGREE:
- case LexicalUnit.SAC_GRADIAN:
- case LexicalUnit.SAC_RADIAN:
- case LexicalUnit.SAC_MILLISECOND:
- case LexicalUnit.SAC_SECOND:
- case LexicalUnit.SAC_HERTZ:
- case LexicalUnit.SAC_KILOHERTZ:
- case LexicalUnit.SAC_DIMENSION:
- float f = getFloatValue();
- int i = (int) f;
- if ((i) == f) {
- text = i + getDimensionUnitText();
- } else {
- text = f + getDimensionUnitText();
- }
- break;
- case LexicalUnit.SAC_URI:
- text = "url(" + getStringValue() + ")";
- break;
- case LexicalUnit.SAC_RGBCOLOR:
- case LexicalUnit.SAC_COUNTER_FUNCTION:
- case LexicalUnit.SAC_COUNTERS_FUNCTION:
- case LexicalUnit.SAC_RECT_FUNCTION:
- case LexicalUnit.SAC_FUNCTION:
- String funcName = getFunctionName();
- LexicalUnitImpl firstParam = getParameters();
- if ("round".equals(funcName)) {
- firstParam
- .setFloatValue(Math.round(firstParam.getFloatValue()));
- text = firstParam.toString();
- } else if ("ceil".equals(funcName)) {
- firstParam.setFloatValue((float) Math.ceil(firstParam
- .getFloatValue()));
- text = firstParam.toString();
- } else if ("floor".equals(funcName)) {
- firstParam.setFloatValue((float) Math.floor(firstParam
- .getFloatValue()));
- text = firstParam.toString();
- } else if ("abs".equals(funcName)) {
- firstParam.setFloatValue(Math.abs(firstParam.getFloatValue()));
- text = firstParam.toString();
- } else if ("darken".equals(funcName)) {
- LexicalUnitImpl dark = ColorUtil.darken(this);
- text = dark.toString();
- } else if ("lighten".equals(funcName)) {
- text = ColorUtil.lighten(this).toString();
- } else {
- text = getFunctionName() + "(" + getParameters() + ")";
- }
- break;
- case LexicalUnit.SAC_IDENT:
- text = getStringValue();
- break;
- case LexicalUnit.SAC_STRING_VALUE:
- // @@SEEME. not exact
- text = "\"" + getStringValue() + "\"";
- break;
- case LexicalUnit.SAC_ATTR:
- text = "attr(" + getStringValue() + ")";
- break;
- case LexicalUnit.SAC_UNICODERANGE:
- text = "@@TODO";
- break;
- case LexicalUnit.SAC_SUB_EXPRESSION:
- text = getSubValues().toString();
- break;
- default:
- text = "@unknown";
- break;
- }
- if (getNextLexicalUnit() != null) {
- if (getNextLexicalUnit().getLexicalUnitType() == SAC_OPERATOR_COMMA) {
- return text + getNextLexicalUnit();
- }
- return text + ' ' + getNextLexicalUnit();
- } else {
- return text;
- }
- }
-
- @Override
- public LexicalUnitImpl divide(LexicalUnitImpl denominator) {
- setFloatValue(getFloatValue() / denominator.getIntegerValue());
- return this;
- }
-
- @Override
- public LexicalUnitImpl add(LexicalUnitImpl another) {
- setFloatValue(getFloatValue() + another.getFloatValue());
- return this;
- }
-
- @Override
- public LexicalUnitImpl minus(LexicalUnitImpl another) {
- setFloatValue(getFloatValue() - another.getFloatValue());
- return this;
- }
-
- @Override
- public LexicalUnitImpl multiply(LexicalUnitImpl another) {
- setFloatValue(getFloatValue() * another.getIntegerValue());
- return this;
- }
-
- public void replaceValue(LexicalUnitImpl another) {
- type = another.getLexicalUnitType();
- i = another.getIntegerValue();
- f = another.getFloatValue();
- s = another.getStringValue();
- fname = another.getFunctionName();
- prev = another.getPreviousLexicalUnit();
- dimension = another.getDimension();
- sdimension = another.getSdimension();
- params = another.getParameters();
-
- LexicalUnitImpl finalNextInAnother = another;
- while (finalNextInAnother.getNextLexicalUnit() != null) {
- finalNextInAnother = finalNextInAnother.getNextLexicalUnit();
- }
-
- finalNextInAnother.setNextLexicalUnit(next);
- next = another.next;
- }
-
- public void setParameters(LexicalUnitImpl params) {
- this.params = params;
- }
-
- public short getDimension() {
- return dimension;
- }
-
- public String getSdimension() {
- return sdimension;
- }
-
- // here some useful function for creation
- public static LexicalUnitImpl createVariable(int line, int column,
- LexicalUnitImpl previous, String name) {
- return new LexicalUnitImpl(line, column, previous, SCSS_VARIABLE, name);
- }
-
- public static LexicalUnitImpl createNumber(int line, int column,
- LexicalUnitImpl previous, float v) {
- int i = (int) v;
- if (v == i) {
- return new LexicalUnitImpl(line, column, previous, i);
- } else {
- return new LexicalUnitImpl(line, column, previous, SAC_REAL, "", v);
- }
- }
-
- public static LexicalUnitImpl createInteger(int line, int column,
- LexicalUnitImpl previous, int i) {
- return new LexicalUnitImpl(line, column, previous, i);
- }
-
- public static LexicalUnitImpl createPercentage(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_PERCENTAGE,
- null, v);
- }
-
- static LexicalUnitImpl createEMS(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_EM, null, v);
- }
-
- static LexicalUnitImpl createEXS(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_EX, null, v);
- }
-
- public static LexicalUnitImpl createPixel(float p) {
- return new LexicalUnitImpl(0, 0, null, SAC_PIXEL, null, p);
- }
-
- static LexicalUnitImpl createPX(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_PIXEL, null, v);
- }
-
- static LexicalUnitImpl createCM(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_CENTIMETER,
- null, v);
- }
-
- static LexicalUnitImpl createMM(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_MILLIMETER,
- null, v);
- }
-
- static LexicalUnitImpl createIN(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_INCH, null, v);
- }
-
- static LexicalUnitImpl createPT(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_POINT, null, v);
- }
-
- static LexicalUnitImpl createPC(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_PICA, null, v);
- }
-
- static LexicalUnitImpl createDEG(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_DEGREE, null, v);
- }
-
- static LexicalUnitImpl createRAD(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_RADIAN, null, v);
- }
-
- static LexicalUnitImpl createGRAD(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_GRADIAN, null, v);
- }
-
- static LexicalUnitImpl createMS(int line, int column,
- LexicalUnitImpl previous, float v) {
- if (v < 0) {
- throw new ParseException("Time values may not be negative");
- }
- return new LexicalUnitImpl(line, column, previous, SAC_MILLISECOND,
- null, v);
- }
-
- static LexicalUnitImpl createS(int line, int column,
- LexicalUnitImpl previous, float v) {
- if (v < 0) {
- throw new ParseException("Time values may not be negative");
- }
- return new LexicalUnitImpl(line, column, previous, SAC_SECOND, null, v);
- }
-
- static LexicalUnitImpl createHZ(int line, int column,
- LexicalUnitImpl previous, float v) {
- if (v < 0) {
- throw new ParseException("Frequency values may not be negative");
- }
- return new LexicalUnitImpl(line, column, previous, SAC_HERTZ, null, v);
- }
-
- static LexicalUnitImpl createKHZ(int line, int column,
- LexicalUnitImpl previous, float v) {
- if (v < 0) {
- throw new ParseException("Frequency values may not be negative");
- }
- return new LexicalUnitImpl(line, column, previous, SAC_KILOHERTZ, null,
- v);
- }
-
- static LexicalUnitImpl createDimen(int line, int column,
- LexicalUnitImpl previous, float v, String s) {
- return new LexicalUnitImpl(line, column, previous, SAC_DIMENSION, s, v);
- }
-
- static LexicalUnitImpl createInherit(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(line, column, previous, SAC_INHERIT,
- "inherit");
- }
-
- public static LexicalUnitImpl createIdent(int line, int column,
- LexicalUnitImpl previous, String s) {
- return new LexicalUnitImpl(line, column, previous, SAC_IDENT, s);
- }
-
- public static LexicalUnitImpl createString(String s) {
- return new LexicalUnitImpl(0, 0, null, SAC_STRING_VALUE, s);
- }
-
- static LexicalUnitImpl createString(int line, int column,
- LexicalUnitImpl previous, String s) {
- return new LexicalUnitImpl(line, column, previous, SAC_STRING_VALUE, s);
- }
-
- static LexicalUnitImpl createURL(int line, int column,
- LexicalUnitImpl previous, String s) {
- return new LexicalUnitImpl(line, column, previous, SAC_URI, s);
- }
-
- static LexicalUnitImpl createAttr(int line, int column,
- LexicalUnitImpl previous, String s) {
- return new LexicalUnitImpl(line, column, previous, SAC_ATTR, s);
- }
-
- static LexicalUnitImpl createCounter(int line, int column,
- LexicalUnitImpl previous, LexicalUnit params) {
- return new LexicalUnitImpl(SAC_COUNTER_FUNCTION, line, column,
- previous, "counter", (LexicalUnitImpl) params);
- }
-
- public static LexicalUnitImpl createCounters(int line, int column,
- LexicalUnitImpl previous, LexicalUnit params) {
- return new LexicalUnitImpl(SAC_COUNTERS_FUNCTION, line, column,
- previous, "counters", (LexicalUnitImpl) params);
- }
-
- public static LexicalUnitImpl createRGBColor(int line, int column,
- LexicalUnitImpl previous, LexicalUnit params) {
- return new LexicalUnitImpl(SAC_RGBCOLOR, line, column, previous, "rgb",
- (LexicalUnitImpl) params);
- }
-
- public static LexicalUnitImpl createRect(int line, int column,
- LexicalUnitImpl previous, LexicalUnit params) {
- return new LexicalUnitImpl(SAC_RECT_FUNCTION, line, column, previous,
- "rect", (LexicalUnitImpl) params);
- }
-
- public static LexicalUnitImpl createFunction(int line, int column,
- LexicalUnitImpl previous, String fname, LexicalUnit params) {
- return new LexicalUnitImpl(SAC_FUNCTION, line, column, previous, fname,
- (LexicalUnitImpl) params);
- }
-
- public static LexicalUnitImpl createUnicodeRange(int line, int column,
- LexicalUnit previous, LexicalUnit params) {
- // @@ return new LexicalUnitImpl(line, column, previous, null,
- // SAC_UNICODERANGE, params);
- return null;
- }
-
- public static LexicalUnitImpl createComma(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SAC_OPERATOR_COMMA, line, column, previous);
- }
-
- public static LexicalUnitImpl createSlash(int line, int column,
- LexicalUnitImpl previous) {
- 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;
- }
-
- /**
- * Tries to return the value for this {@link LexicalUnitImpl} without
- * considering any related units.
- *
- * @return
- */
- public Object getValue() {
- if (s != null) {
- return s;
- } else if (i != -1) {
- return i;
- } else if (f != -1) {
- return f;
- } else
- return null;
- }
-
- public void setFunctionName(String functionName) {
- fname = functionName;
- }
-
- public static LexicalUnitImpl createIdent(String s) {
- return new LexicalUnitImpl(0, 0, null, SAC_IDENT, s);
- }
-
- public static void replaceValues(LexicalUnitImpl unit,
- LexicalUnitImpl replaceWith) {
- unit.setLexicalUnitType(replaceWith.getLexicalUnitType());
- unit.setStringValue(replaceWith.getStringValue());
- unit.setFloatValue(replaceWith.getFloatValue());
- unit.setIntegerValue(replaceWith.getIntegerValue());
- unit.setFunctionName(replaceWith.getFunctionName());
-
- if (replaceWith.getParameters() != null) {
- unit.setParameters(replaceWith.getParameters());
- }
-
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 World Wide Web Consortium
- * (Massachusetts Institute of Technology, Institut National de Recherche
- * en Informatique et en Automatique, Keio University).
- * All Rights Reserved. http://www.w3.org/Consortium/Legal/
- *
- * $Id: LocatorImpl.java,v 1.2 2000/02/14 16:59:06 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-import org.w3c.css.sac.Locator;
-
-/**
- * @version $Revision: 1.2 $
- * @author Philippe Le Hegaret
- */
-public class LocatorImpl implements Locator {
-
- // W3C DEBUG mode
- private static boolean W3CDebug;
- static {
- try {
- W3CDebug = (Boolean.getBoolean("debug")
- || Boolean
- .getBoolean("org.w3c.flute.parser.LocatorImpl.debug")
- || Boolean.getBoolean("org.w3c.flute.parser.debug")
- || Boolean.getBoolean("org.w3c.flute.debug")
- || Boolean.getBoolean("org.w3c.debug") || Boolean
- .getBoolean("org.debug"));
- } catch (Exception e) {
- // nothing
- }
- }
-
- String uri;
- int line;
- int column;
-
- public String getURI() {
- return uri;
- }
-
- public int getLineNumber() {
- return line;
- }
-
- public int getColumnNumber() {
- return column;
- }
-
- /**
- * Creates a new LocatorImpl
- */
- public LocatorImpl(Parser p) {
- if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ");");
- }
- uri = p.source.getURI();
- line = p.token.beginLine;
- column = p.token.beginColumn;
- }
-
- /**
- * Reinitializes a LocatorImpl
- */
- public LocatorImpl(Parser p, Token tok) {
- if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ", " + tok
- + ");");
- }
- uri = p.source.getURI();
- line = tok.beginLine;
- column = tok.beginColumn;
- }
-
- /**
- * Reinitializes a LocatorImpl
- */
- public LocatorImpl(Parser p, int line, int column) {
- if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ", " + line
- + ", " + column + ");");
- }
- uri = p.source.getURI();
- this.line = line;
- this.column = column;
- }
-
- /**
- * Reinitializes a LocatorImpl
- */
- public LocatorImpl reInit(Parser p) {
- if (W3CDebug) {
- System.err.println("LocatorImpl::reInit(" + p + ");");
- }
- uri = p.source.getURI();
- line = p.token.beginLine;
- column = p.token.beginColumn;
- return this;
- }
-
- /**
- * Reinitializes a LocatorImpl
- */
- public LocatorImpl reInit(Parser p, Token tok) {
- if (W3CDebug) {
- System.err.println("LocatorImpl::reInit(" + p + ", " + tok + ");");
- }
- uri = p.source.getURI();
- line = tok.beginLine;
- column = tok.beginColumn;
- return this;
- }
-
- /**
- * Reinitializes a LocatorImpl
- */
- public LocatorImpl reInit(Parser p, int line, int column) {
- if (W3CDebug) {
- System.err.println("LocatorImpl::reInit(" + p + ", " + line + ", "
- + column + ");");
- }
- uri = p.source.getURI();
- this.line = line;
- this.column = column;
- return this;
- }
-}
+++ /dev/null
-/*
- * (c) COPYRIGHT 1999 World Wide Web Consortium
- * (Massachusetts Institute of Technology, Institut National de Recherche
- * en Informatique et en Automatique, Keio University).
- * All Rights Reserved. http://www.w3.org/Consortium/Legal/
- *
- * $Id: MediaListImpl.java,v 1.4 2000/04/26 13:40:19 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-import java.io.Serializable;
-
-import org.w3c.css.sac.SACMediaList;
-
-/**
- * @version $Revision: 1.4 $
- * @author Philippe Le Hegaret
- */
-public class MediaListImpl implements SACMediaList, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String[] array = new String[10];
- int current;
-
- @Override
- public int getLength() {
- return current;
- }
-
- @Override
- public String item(int index) {
- if ((index < 0) || (index >= current)) {
- return null;
- }
- return array[index];
- }
-
- void addItem(String medium) {
- if (medium.equals("all")) {
- array[0] = "all";
- current = 1;
- return;
- }
- for (int i = 0; i < current; i++) {
- if (medium.equals(array[i])) {
- return;
- }
- }
- if (current == array.length) {
- String[] old = array;
- array = new String[current + current];
- System.arraycopy(old, 0, array, 0, current);
- }
- array[current++] = medium;
- }
-
- /**
- * Returns a string representation of this object.
- */
- @Override
- public String toString() {
- switch (current) {
- case 0:
- return "";
- case 1:
- return array[0];
- default:
- boolean not_done = true;
- int i = 0;
- StringBuffer buf = new StringBuffer(50);
- do {
- buf.append(array[i++]);
- if (i == current) {
- not_done = false;
- } else {
- buf.append(", ");
- }
- } while (not_done);
- return buf.toString();
- }
- }
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
-package com.vaadin.sass.parser;
-
-import org.w3c.css.sac.CSSException;
-
-/**
- * This exception is thrown when parse errors are encountered. You can
- * explicitly create objects of this exception type by calling the method
- * generateParseException in the generated parser.
- *
- * You can modify this class to customize your error reporting mechanisms so
- * long as you retain the public fields.
- */
-public class ParseException extends CSSException {
- private static final long serialVersionUID = -8556588037264585977L;
-
- /**
- * This constructor is used by the method "generateParseException" in the
- * generated parser. Calling this constructor generates a new object of this
- * type with the fields "currentToken", "expectedTokenSequences", and
- * "tokenImage" set. The boolean flag "specialConstructor" is also set to
- * true to indicate that this constructor was used to create this object.
- * This constructor calls its super class with the empty string to force the
- * "toString" method of parent class "Throwable" to print the error message
- * in the form: ParseException: <result of getMessage>
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
- super("");
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever purpose you
- * can think of. Constructing the exception in this manner makes the
- * exception behave in the normal way - i.e., as documented in the class
- * "Throwable". The fields "errorToken", "expectedTokenSequences", and
- * "tokenImage" do not contain relevant information. The JavaCC generated
- * code does not use these constructors.
- */
-
- public ParseException() {
- super();
- specialConstructor = false;
- }
-
- public ParseException(String message) {
- super(message);
- specialConstructor = false;
- }
-
- /**
- * This variable determines which constructor was used to create this object
- * and thereby affects the semantics of the "getMessage" method (see below).
- */
- protected boolean specialConstructor;
-
- /**
- * This is the last token that has been consumed successfully. If this
- * object has been created due to a parse error, the token followng this
- * token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array of integers
- * represents a sequence of tokens (by their ordinal values) that is
- * expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated parser
- * within which the parse error occurred. This array is defined in the
- * generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * This method has the standard behavior when this object has been created
- * using the standard constructors. Otherwise, it uses "currentToken" and
- * "expectedTokenSequences" to generate a parse error message and returns
- * it. If this object has been created due to a parse error, and you do not
- * catch it (it gets thrown from the parser), then this method is called
- * during the printing of the final stack trace, and hence the correct error
- * message gets displayed.
- */
- @Override
- public String getMessage() {
- if (!specialConstructor) {
- return super.getMessage();
- }
- String expected = "";
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected += tokenImage[expectedTokenSequences[i][j]] + " ";
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected += "...";
- }
- expected += eol + " ";
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) {
- retval += " ";
- }
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += add_escapes(tok.image);
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column "
- + currentToken.next.beginColumn + "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected;
- return retval;
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version when these raw
- * version cannot be used as part of an ASCII string literal.
- */
- protected String add_escapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i)) {
- case 0:
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u"
- + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. Parser.java */
-package com.vaadin.sass.parser;
-
-import java.io.*;
-import java.net.*;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.Map;
-
-import org.w3c.css.sac.ConditionFactory;
-import org.w3c.css.sac.Condition;
-import org.w3c.css.sac.SelectorFactory;
-import org.w3c.css.sac.SelectorList;
-import org.w3c.css.sac.Selector;
-import org.w3c.css.sac.SimpleSelector;
-import org.w3c.css.sac.DocumentHandler;
-import org.w3c.css.sac.InputSource;
-import org.w3c.css.sac.ErrorHandler;
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.CSSParseException;
-import org.w3c.css.sac.Locator;
-import org.w3c.css.sac.LexicalUnit;
-
-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.*;
-
-/**
- * A CSS2 parser
- *
- * @author Philippe Le H�garet
- * @version $Revision: 1.15 $
- */
-public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
-
- // replaces all \t, \n, etc with this StringBuffer.
- static final StringBuilder SPACE = new StringBuilder(" ");
-
- // the document handler for the parser
- protected SCSSDocumentHandlerImpl documentHandler;
- // the error handler for the parser
- protected ErrorHandler errorHandler;
- // the input source for the parser
- protected InputSource source;
-
- protected ConditionFactory conditionFactory;
- protected SelectorFactory selectorFactory;
-
- // temporary place holder for pseudo-element ...
- private String pseudoElt;
-
- /**
- * Creates a new Parser
- */
- public Parser() {
- this((CharStream) null);
- }
-
- /**
- * @@TODO
- * @exception CSSException Not yet implemented
- */
- public void setLocale(Locale locale) throws CSSException {
- throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
- }
-
- /**
- * Set the document handler for this parser
- */
- public void setDocumentHandler(DocumentHandler handler) {
- this.documentHandler = (SCSSDocumentHandlerImpl) handler;
- }
-
- public void setSelectorFactory(SelectorFactory selectorFactory) {
- this.selectorFactory = selectorFactory;
- }
-
- public void setConditionFactory(ConditionFactory conditionFactory) {
- this.conditionFactory = conditionFactory;
- }
-
- /**
- * Set the error handler for this parser
- */
- public void setErrorHandler(ErrorHandler error) {
- this.errorHandler = error;
- }
-
- /**
- * Main parse methods
- *
- * @param source the source of the style sheet.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseStyleSheet(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
-
- parserUnit();
- }
-
- /**
- * Convenient method for URIs.
- *
- * @param systemId the fully resolved URI of the style sheet.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseStyleSheet(String systemId)
- throws CSSException, IOException {
- parseStyleSheet(new InputSource(systemId));
- }
-
- /**
- * This method parses only one rule (style rule or at-rule, except @charset).
- *
- * @param source the source of the rule.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseRule(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseRule();
- }
-
- /**
- * This method parses a style declaration (including the surrounding curly
- * braces).
- *
- * @param source the source of the style declaration.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseStyleDeclaration(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseDeclarationBlock();
- }
-
- /**
- * This methods returns "http://www.w3.org/TR/REC-CSS2".
- * @return the string "http://www.w3.org/TR/REC-CSS2".
- */
- public String getParserVersion() {
- return "http://www.w3.org/TR/REC-CSS2";
- }
-
- /**
- * Parse methods used by DOM Level 2 implementation.
- */
- public void parseImportRule(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseImportRule();
- }
-
- public void parseMediaRule(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseMediaRule();
- }
-
- public SelectorList parseSelectors(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- return null;
- }
-
- public LexicalUnit parsePropertyValue(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- return expr();
- }
-
- public boolean parsePriority(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- return prio();
- }
-
- /**
- * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
- */
- private Reader getReader(InputSource source) throws IOException {
- if (source.getCharacterStream() != null) {
- return source.getCharacterStream();
- } else if (source.getByteStream() != null) {
- // My DOM level 2 implementation doesn't use this case.
- if (source.getEncoding() == null) {
- // unknown encoding, use ASCII as default.
- return new InputStreamReader(source.getByteStream(), "ASCII");
- } else {
- return new InputStreamReader(source.getByteStream(),
- source.getEncoding());
- }
- } else {
- // systemId
- // @@TODO
- throw new CSSException("not yet implemented");
- }
- }
-
- /**
- * Convert the source into a CharStream with encoding informations.
- * The encoding can be found in the InputSource or in the CSS document.
- * Since this method marks the reader and make a reset after looking for
- * the charset declaration, you'll find the charset declaration into the
- * stream.
- */
- private CharStream getCharStreamWithLurk(InputSource source)
- throws CSSException, IOException {
- if (source.getCharacterStream() != null) {
- // all encoding are supposed to be resolved by the user
- // return the reader
- return new Generic_CharStream(source.getCharacterStream(), 1, 1);
- } else if (source.getByteStream() == null) {
- // @@CONTINUE ME. see also getReader() with systemId
- try {
- source.setByteStream(new URL(source.getURI()).openStream());
- } catch (Exception e) {
- try {
- source.setByteStream(new FileInputStream(source.getURI()));
- } catch (IOException ex) {
- throw new CSSException("invalid url ?");
- }
- }
- }
- String encoding = "ASCII";
- InputStream input = source.getByteStream();
- char c = ' ';
-
- if (!input.markSupported()) {
- input = new BufferedInputStream(input);
- source.setByteStream(input);
- }
- input.mark(100);
- c = (char) input.read();
-
- if (c == '@') {
- // hum, is it a charset ?
- int size = 100;
- byte[] buf = new byte[size];
- input.read(buf, 0, 7);
- String keyword = new String(buf, 0, 7);
- if (keyword.equals("charset")) {
- // Yes, this is the charset declaration !
-
- // here I don't use the right declaration : white space are ' '.
- while ((c = (char) input.read()) == ' ') {
- // find the first quote
- }
- char endChar = c;
- int i = 0;
-
- if ((endChar != '"') && (endChar != '\u005c'')) {
- // hum this is not a quote.
- throw new CSSException("invalid charset declaration");
- }
-
- while ((c = (char) input.read()) != endChar) {
- buf[i++] = (byte) c;
- if (i == size) {
- byte[] old = buf;
- buf = new byte[size + 100];
- System.arraycopy(old, 0, buf, 0, size);
- size += 100;
- }
- }
- while ((c = (char) input.read()) == ' ') {
- // find the next relevant character
- }
- if (c != ';') {
- // no semi colon at the end ?
- throw new CSSException("invalid charset declaration: "
- + "missing semi colon");
- }
- encoding = new String(buf, 0, i);
- if (source.getEncoding() != null) {
- // compare the two encoding informations.
- // For example, I don't accept to have ASCII and after UTF-8.
- // Is it really good ? That is the question.
- if (!encoding.equals(source.getEncoding())) {
- throw new CSSException("invalid encoding information.");
- }
- }
- } // else no charset declaration available
- }
- // ok set the real encoding of this source.
- source.setEncoding(encoding);
- // set the real reader of this source.
- source.setCharacterStream(new InputStreamReader(source.getByteStream(),
- Encoding.getJavaEncoding(encoding)));
- // reset the stream (leave the charset declaration in the stream).
- input.reset();
-
- return new Generic_CharStream(source.getCharacterStream(), 1, 1);
- }
-
- private LocatorImpl currentLocator;
- private Locator getLocator() {
- if (currentLocator == null) {
- currentLocator = new LocatorImpl(this);
- return currentLocator;
- }
- return currentLocator.reInit(this);
- }
- private LocatorImpl getLocator(Token save) {
- if (currentLocator == null) {
- currentLocator = new LocatorImpl(this, save);
- return currentLocator;
- }
- return currentLocator.reInit(this, save);
- }
-
- private void reportError(Locator l, Exception e) {
- if (errorHandler != null) {
- if (e instanceof ParseException) {
- // construct a clean error message.
- ParseException pe = (ParseException) e;
- if (pe.specialConstructor) {
- StringBuffer errorM = new StringBuffer();
- if (pe.currentToken != null) {
- errorM.append("encountered \u005c"")
- .append(pe.currentToken.next);
- }
- errorM.append('"');
- if (pe.expectedTokenSequences.length != 0) {
- errorM.append(". Was expecting one of: ");
- for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
- for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
- int kind = pe.expectedTokenSequences[i][j];
- if (kind != S) {
- errorM.append(pe.tokenImage[kind]);
- errorM.append(' ');
- }
- }
- }
- }
- errorHandler.error(new CSSParseException(errorM.toString(),
- l, e));
- } else {
- errorHandler.error(new CSSParseException(e.getMessage(),
- l, e));
- }
- } else if (e == null) {
- errorHandler.error(new CSSParseException("error", l, null));
- } else {
- errorHandler.error(new CSSParseException(e.getMessage(), l, e));
- }
- }
- }
-
- private void reportWarningSkipText(Locator l, String text) {
- if (errorHandler != null && text != null) {
- errorHandler.warning(new CSSParseException("Skipping: " + text, l));
- }
- }
-
-/*
- * The grammar of CSS2
- */
-
-/**
- * The main entry for the parser.
- *
- * @exception ParseException exception during the parse
- */
- final public void parserUnit() throws ParseException {
- try {
- documentHandler.startDocument(source);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CHARSET_SYM:
- charset();
- break;
- default:
- jj_la1[0] = jj_gen;
- ;
- }
- label_1:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[1] = jj_gen;
- break label_1;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- jj_consume_token(S);
- comments();
- break;
- case CDO:
- case CDC:
- case ATKEYWORD:
- ignoreStatement();
- break;
- default:
- jj_la1[2] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IMPORT_SYM:
- ;
- break;
- default:
- jj_la1[3] = jj_gen;
- break label_2;
- }
- importDeclaration();
- label_3:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[4] = jj_gen;
- break label_3;
- }
- ignoreStatement();
- label_4:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[5] = jj_gen;
- break label_4;
- }
- jj_consume_token(S);
- }
- }
- }
- afterImportDeclaration();
- jj_consume_token(0);
- } finally {
- documentHandler.endDocument(source);
- }
- }
-
- final public void charset() throws ParseException {
- Token n;
- try {
- jj_consume_token(CHARSET_SYM);
- label_5:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[6] = jj_gen;
- break label_5;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(STRING);
- label_6:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[7] = jj_gen;
- break label_6;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- reportError(getLocator(e.currentToken.next), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } catch (Exception e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- }
- }
-
- final public void afterImportDeclaration() throws ParseException {
- String ret;
- Locator l;
- label_7:
- while (true) {
- ;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- if (jj_2_1(5)) {
- listModifyDirective();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[8] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- case IF_SYM:
- ifDirective();
- break;
- case MIXIN_SYM:
- mixinDirective();
- break;
- case EACH_SYM:
- eachDirective();
- break;
- case INCLUDE_SYM:
- includeDirective();
- break;
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- case MEDIA_SYM:
- media();
- break;
- case PAGE_SYM:
- page();
- break;
- case FONT_FACE_SYM:
- fontFace();
- break;
- default:
- jj_la1[9] = jj_gen;
- l = getLocator();
- ret = skipStatement();
- if ((ret == null) || (ret.length() == 0)) {
- {if (true) return;}
- }
- reportWarningSkipText(l, ret);
- if (ret.charAt(0) == '@') {
- documentHandler.ignorableAtRule(ret);
- }
- }
- label_8:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[10] = jj_gen;
- break label_8;
- }
- ignoreStatement();
- label_9:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[11] = jj_gen;
- break label_9;
- }
- jj_consume_token(S);
- }
- }
- }
- }
-
- final public void ignoreStatement() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CDO:
- jj_consume_token(CDO);
- break;
- case CDC:
- jj_consume_token(CDC);
- break;
- case ATKEYWORD:
- atRuleDeclaration();
- break;
- default:
- jj_la1[12] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
-/**
- * The import statement
- *
- * @exception ParseException exception during the parse
- */
- final public void importDeclaration() throws ParseException {
- Token n;
- String uri;
- MediaListImpl ml = new MediaListImpl();
- boolean isURL = false;
- try {
- jj_consume_token(IMPORT_SYM);
- label_10:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[13] = jj_gen;
- break label_10;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING:
- n = jj_consume_token(STRING);
- uri = convertStringIndex(n.image, 1,
- n.image.length() -1);
- break;
- case URL:
- n = jj_consume_token(URL);
- isURL=true;
- uri = n.image.substring(4, n.image.length()-1).trim();
- if ((uri.charAt(0) == '"')
- || (uri.charAt(0) == '\u005c'')) {
- uri = uri.substring(1, uri.length()-1);
- }
- break;
- default:
- jj_la1[14] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_11:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[15] = jj_gen;
- break label_11;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- mediaStatement(ml);
- break;
- default:
- jj_la1[16] = jj_gen;
- ;
- }
- jj_consume_token(SEMICOLON);
- label_12:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[17] = jj_gen;
- break label_12;
- }
- jj_consume_token(S);
- }
- if (ml.getLength() == 0) {
- // see section 6.3 of the CSS2 recommandation.
- ml.addItem("all");
- }
- documentHandler.importStyle(uri, ml, isURL);
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void media() throws ParseException {
- boolean start = false;
- String ret;
- MediaListImpl ml = new MediaListImpl();
- try {
- jj_consume_token(MEDIA_SYM);
- label_13:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[18] = jj_gen;
- break label_13;
- }
- jj_consume_token(S);
- }
- mediaStatement(ml);
- start = true; documentHandler.startMedia(ml);
- jj_consume_token(LBRACE);
- label_14:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[19] = jj_gen;
- break label_14;
- }
- jj_consume_token(S);
- }
- label_15:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CDO:
- case LBRACE:
- case DASHMATCH:
- case INCLUDES:
- case PLUS:
- case MINUS:
- case COMMA:
- case SEMICOLON:
- case PRECEDES:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case NONASCII:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case PERCENTAGE:
- case HASH:
- case IMPORT_SYM:
- case MEDIA_SYM:
- case CHARSET_SYM:
- case PAGE_SYM:
- case FONT_FACE_SYM:
- case ATKEYWORD:
- case IMPORTANT_SYM:
- case UNICODERANGE:
- case FUNCTION:
- case UNKNOWN:
- ;
- break;
- default:
- jj_la1[20] = jj_gen;
- break label_15;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- case CDO:
- case LBRACE:
- case DASHMATCH:
- case INCLUDES:
- case PLUS:
- case MINUS:
- case COMMA:
- case SEMICOLON:
- case PRECEDES:
- case NONASCII:
- case STRING:
- case NUMBER:
- case URL:
- case PERCENTAGE:
- case IMPORT_SYM:
- case MEDIA_SYM:
- case CHARSET_SYM:
- case PAGE_SYM:
- case FONT_FACE_SYM:
- case ATKEYWORD:
- case IMPORTANT_SYM:
- case UNICODERANGE:
- case FUNCTION:
- case UNKNOWN:
- skipUnknownRule();
- break;
- default:
- jj_la1[21] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_16:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[22] = jj_gen;
- break label_16;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } finally {
- if (start) {
- documentHandler.endMedia(ml);
- }
- }
- }
-
- final public void mediaStatement(MediaListImpl ml) throws ParseException {
- String m;
- m = medium();
- label_17:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[23] = jj_gen;
- break label_17;
- }
- jj_consume_token(COMMA);
- label_18:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[24] = jj_gen;
- break label_18;
- }
- jj_consume_token(S);
- }
- ml.addItem(m);
- m = medium();
- }
- ml.addItem(m);
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String medium() throws ParseException {
- Token n;
- n = jj_consume_token(IDENT);
- label_19:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[25] = jj_gen;
- break label_19;
- }
- jj_consume_token(S);
- }
- {if (true) return convertIdent(n.image);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void page() throws ParseException {
- boolean start = false;
- Token n = null;
- String page = null;
- String pseudo = null;
- try {
- jj_consume_token(PAGE_SYM);
- label_20:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[26] = jj_gen;
- break label_20;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- label_21:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[27] = jj_gen;
- break label_21;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[28] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- pseudo = pseudo_page();
- break;
- default:
- jj_la1[29] = jj_gen;
- ;
- }
- if (n != null) {
- page = convertIdent(n.image);
- }
- jj_consume_token(LBRACE);
- label_22:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[30] = jj_gen;
- break label_22;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startPage(page, pseudo);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[31] = jj_gen;
- ;
- }
- label_23:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[32] = jj_gen;
- break label_23;
- }
- jj_consume_token(SEMICOLON);
- label_24:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[33] = jj_gen;
- break label_24;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[34] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_25:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[35] = jj_gen;
- break label_25;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- if (errorHandler != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- skipStatement();
- // reportWarningSkipText(li, skipStatement());
- } else {
- skipStatement();
- }
- } finally {
- if (start) {
- documentHandler.endPage(page, pseudo);
- }
- }
- }
-
- final public String pseudo_page() throws ParseException {
- Token n;
- jj_consume_token(COLON);
- n = jj_consume_token(IDENT);
- label_26:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[36] = jj_gen;
- break label_26;
- }
- jj_consume_token(S);
- }
- {if (true) return convertIdent(n.image);}
- throw new Error("Missing return statement in function");
- }
-
- final public void fontFace() throws ParseException {
- boolean start = false;
- try {
- jj_consume_token(FONT_FACE_SYM);
- label_27:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[37] = jj_gen;
- break label_27;
- }
- jj_consume_token(S);
- }
- jj_consume_token(LBRACE);
- label_28:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[38] = jj_gen;
- break label_28;
- }
- jj_consume_token(S);
- }
- start = true; documentHandler.startFontFace();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[39] = jj_gen;
- ;
- }
- label_29:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[40] = jj_gen;
- break label_29;
- }
- jj_consume_token(SEMICOLON);
- label_30:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[41] = jj_gen;
- break label_30;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[42] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_31:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[43] = jj_gen;
- break label_31;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } finally {
- if (start) {
- documentHandler.endFontFace();
- }
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void atRuleDeclaration() throws ParseException {
- Token n;
- String ret;
- n = jj_consume_token(ATKEYWORD);
- ret=skipStatement();
- reportWarningSkipText(getLocator(), ret);
- if ((ret != null) && (ret.charAt(0) == '@')) {
- documentHandler.ignorableAtRule(ret);
- }
- }
-
- final public void skipUnknownRule() throws ParseException {
- Token n;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ATKEYWORD:
- n = jj_consume_token(ATKEYWORD);
- break;
- case CDO:
- n = jj_consume_token(CDO);
- break;
- case CHARSET_SYM:
- n = jj_consume_token(CHARSET_SYM);
- break;
- case COMMA:
- n = jj_consume_token(COMMA);
- break;
- case DASHMATCH:
- n = jj_consume_token(DASHMATCH);
- break;
- case FONT_FACE_SYM:
- n = jj_consume_token(FONT_FACE_SYM);
- break;
- case FUNCTION:
- n = jj_consume_token(FUNCTION);
- break;
- case IMPORTANT_SYM:
- n = jj_consume_token(IMPORTANT_SYM);
- break;
- case IMPORT_SYM:
- n = jj_consume_token(IMPORT_SYM);
- break;
- case INCLUDES:
- n = jj_consume_token(INCLUDES);
- break;
- case LBRACE:
- n = jj_consume_token(LBRACE);
- break;
- case MEDIA_SYM:
- n = jj_consume_token(MEDIA_SYM);
- break;
- case NONASCII:
- n = jj_consume_token(NONASCII);
- break;
- case NUMBER:
- n = jj_consume_token(NUMBER);
- break;
- case PAGE_SYM:
- n = jj_consume_token(PAGE_SYM);
- break;
- case PERCENTAGE:
- n = jj_consume_token(PERCENTAGE);
- break;
- case STRING:
- n = jj_consume_token(STRING);
- break;
- case UNICODERANGE:
- n = jj_consume_token(UNICODERANGE);
- break;
- case URL:
- n = jj_consume_token(URL);
- break;
- case SEMICOLON:
- n = jj_consume_token(SEMICOLON);
- break;
- case PLUS:
- n = jj_consume_token(PLUS);
- break;
- case PRECEDES:
- n = jj_consume_token(PRECEDES);
- break;
- case MINUS:
- n = jj_consume_token(MINUS);
- break;
- case UNKNOWN:
- n = jj_consume_token(UNKNOWN);
- break;
- default:
- jj_la1[44] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- String ret;
- Locator loc = getLocator();
- ret=skipStatement();
- reportWarningSkipText(loc, ret);
- if ((ret != null) && (n.image.charAt(0) == '@')) {
- documentHandler.ignorableAtRule(ret);
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public char combinator() throws ParseException {
-char connector = ' ';
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- jj_consume_token(PLUS);
- label_32:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[45] = jj_gen;
- break label_32;
- }
- jj_consume_token(S);
- }
- {if (true) return '+';}
- break;
- case PRECEDES:
- jj_consume_token(PRECEDES);
- label_33:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[46] = jj_gen;
- break label_33;
- }
- jj_consume_token(S);
- }
- {if (true) return '>';}
- break;
- case S:
- jj_consume_token(S);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- jj_consume_token(PLUS);
- connector = '+';
- break;
- case PRECEDES:
- jj_consume_token(PRECEDES);
- connector = '>';
- break;
- default:
- jj_la1[47] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_34:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[48] = jj_gen;
- break label_34;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[49] = jj_gen;
- ;
- }
- {if (true) return connector;}
- break;
- default:
- jj_la1[50] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void microsoftExtension() throws ParseException {
- Token n;
- String name = "";
- String value = "";
- n = jj_consume_token(MICROSOFT_RULE);
- label_35:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[51] = jj_gen;
- break label_35;
- }
- jj_consume_token(S);
- }
- name = n.image;
- jj_consume_token(COLON);
- label_36:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- value += n.image;
- break;
- case NUMBER:
- n = jj_consume_token(NUMBER);
- value += n.image;
- break;
- case INTERPOLATION:
- n = jj_consume_token(INTERPOLATION);
- value += n.image;
- break;
- case COLON:
- n = jj_consume_token(COLON);
- value += n.image;
- break;
- case FUNCTION:
- n = jj_consume_token(FUNCTION);
- value += n.image;
- break;
- case RPARAN:
- n = jj_consume_token(RPARAN);
- value += n.image;
- break;
- case EQ:
- n = jj_consume_token(EQ);
- value += n.image;
- break;
- case DOT:
- n = jj_consume_token(DOT);
- value += n.image;
- break;
- case S:
- n = jj_consume_token(S);
- if(value.lastIndexOf(' ') != value.length()-1)
- { value += n.image; }
- break;
- default:
- jj_la1[52] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- case EQ:
- case DOT:
- case RPARAN:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case NUMBER:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[53] = jj_gen;
- break label_36;
- }
- }
- jj_consume_token(SEMICOLON);
- label_37:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[54] = jj_gen;
- break label_37;
- }
- jj_consume_token(S);
- }
- documentHandler.microsoftDirective(name, value);
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String property() throws ParseException {
- Token n;
- n = jj_consume_token(IDENT);
- label_38:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[55] = jj_gen;
- break label_38;
- }
- jj_consume_token(S);
- }
- {if (true) return convertIdent(n.image);}
- throw new Error("Missing return statement in function");
- }
-
- final public String variableName() throws ParseException {
- Token n;
- n = jj_consume_token(VARIABLE);
- label_39:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[56] = jj_gen;
- break label_39;
- }
- jj_consume_token(S);
- }
- {if (true) return convertIdent(n.image.substring(1));}
- throw new Error("Missing return statement in function");
- }
-
- final public String functionName() throws ParseException {
- Token n;
- n = jj_consume_token(FUNCTION);
- label_40:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[57] = jj_gen;
- break label_40;
- }
- jj_consume_token(S);
- }
- {if (true) return convertIdent(n.image.substring(0, n.image.length()-1));}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void styleRule() throws ParseException {
- boolean start = false;
- ArrayList<String> l = null;
- Token save;
- Locator loc;
- try {
- l = selectorList();
- save = token;
- jj_consume_token(LBRACE);
- label_41:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[58] = jj_gen;
- break label_41;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startSelector(l);
- label_42:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case MICROSOFT_RULE:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[59] = jj_gen;
- break label_42;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF_SYM:
- ifDirective();
- break;
- default:
- jj_la1[61] = jj_gen;
- if (jj_2_2(5)) {
- listModifyDirective();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case EACH_SYM:
- eachDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[62] = jj_gen;
- if (jj_2_3(3)) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case MICROSOFT_RULE:
- microsoftExtension();
- break;
- case IDENT:
- declarationOrNestedProperties();
- break;
- default:
- jj_la1[60] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[63] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_43:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[64] = jj_gen;
- break label_43;
- }
- jj_consume_token(S);
- }
- } catch (ThrowedParseException e) {
- if (errorHandler != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.e.currentToken.next.beginLine,
- e.e.currentToken.next.beginColumn-1);
- reportError(li, e.e);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } catch (TokenMgrError e) {
- reportWarningSkipText(getLocator(), skipStatement());
- } finally {
- if (start) {
- documentHandler.endSelector();
- }
- }
- }
-
- final public ArrayList<String> selectorList() throws ParseException {
- ArrayList<String> selectors = new ArrayList<String>();
- String selector;
- selector = selector();
- label_44:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[65] = jj_gen;
- break label_44;
- }
- jj_consume_token(COMMA);
- label_45:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[66] = jj_gen;
- break label_45;
- }
- jj_consume_token(S);
- }
- selectors.add(selector);
- selector = selector();
- }
- selectors.add(selector);
- {if (true) return selectors;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String selector() throws ParseException {
- String selector;
- char comb;
- try {
- selector = simple_selector(null, ' ');
- label_46:
- while (true) {
- if (jj_2_4(2)) {
- ;
- } else {
- break label_46;
- }
- comb = combinator();
- selector = simple_selector(selector, comb);
- }
- label_47:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[67] = jj_gen;
- break label_47;
- }
- jj_consume_token(S);
- }
- {if (true) return selector;}
- } catch (ParseException e) {
- /*
- Token t = getToken(1);
- StringBuffer s = new StringBuffer();
- s.append(getToken(0).image);
- while ((t.kind != COMMA) && (t.kind != SEMICOLON)
- && (t.kind != LBRACE) && (t.kind != EOF)) {
- s.append(t.image);
- getNextToken();
- t = getToken(1);
- }
- reportWarningSkipText(getLocator(), s.toString());
- */
- Token t = getToken(1);
- while ((t.kind != COMMA) && (t.kind != SEMICOLON)
- && (t.kind != LBRACE) && (t.kind != EOF)) {
- getNextToken();
- t = getToken(1);
- }
-
- {if (true) throw new ThrowedParseException(e);}
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String simple_selector(String selector, char comb) throws ParseException {
- String simple_current = null;
- String cond = null;
-
- pseudoElt = null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ANY:
- case PARENT:
- case INTERPOLATION:
- case IDENT:
- simple_current = element_name();
- label_48:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[68] = jj_gen;
- break label_48;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[69] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- case HASH:
- cond = hash(cond);
- label_49:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- ;
- break;
- default:
- jj_la1[70] = jj_gen;
- break label_49;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[71] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- case DOT:
- cond = _class(cond);
- label_50:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[72] = jj_gen;
- break label_50;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[73] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- case COLON:
- cond = pseudo(cond);
- label_51:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[74] = jj_gen;
- break label_51;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[75] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- case LBRACKET:
- cond = attrib(cond);
- label_52:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[76] = jj_gen;
- break label_52;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[77] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- default:
- jj_la1[78] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- if (simple_current == null) {
- simple_current = "";
- }
- if (cond != null) {
- simple_current = simple_current + cond;
- }
- if (selector != null) {
- switch (comb) {
- case ' ':
- selector = selector + comb + simple_current;
- break;
- case '+':
- selector = selector + " " + comb + " " + simple_current;
- break;
- case '>':
- selector = selector + " " + comb + " " + simple_current;
- break;
- default:
- {if (true) throw new ParseException("invalid state. send a bug report");}
- }
- } else {
- selector= simple_current;
- }
- if (pseudoElt != null) {
- selector = selector + pseudoElt;
- }
- {if (true) return selector;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String _class(String pred) throws ParseException {
- Token t;
-String s = ".";
- jj_consume_token(DOT);
- label_53:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- t = jj_consume_token(IDENT);
- s += t.image;
- break;
- case INTERPOLATION:
- t = jj_consume_token(INTERPOLATION);
- s += t.image;
- break;
- default:
- jj_la1[79] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- ;
- break;
- default:
- jj_la1[80] = jj_gen;
- break label_53;
- }
- }
- if (pred == null) {
- {if (true) return s;}
- } else {
- {if (true) return pred + s;}
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String element_name() throws ParseException {
- Token t; String s = "";
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- label_54:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- t = jj_consume_token(IDENT);
- s += t.image;
- break;
- case INTERPOLATION:
- t = jj_consume_token(INTERPOLATION);
- s += t.image;
- break;
- default:
- jj_la1[81] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- ;
- break;
- default:
- jj_la1[82] = jj_gen;
- break label_54;
- }
- }
- {if (true) return s;}
- break;
- case ANY:
- jj_consume_token(ANY);
- {if (true) return "*";}
- break;
- case PARENT:
- jj_consume_token(PARENT);
- {if (true) return "&";}
- break;
- default:
- jj_la1[83] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String attrib(String pred) throws ParseException {
- int cases = 0;
- Token att = null;
- Token val = null;
- String attValue = null;
- jj_consume_token(LBRACKET);
- label_55:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[84] = jj_gen;
- break label_55;
- }
- jj_consume_token(S);
- }
- att = jj_consume_token(IDENT);
- label_56:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[85] = jj_gen;
- break label_56;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DASHMATCH:
- case CARETMATCH:
- case DOLLARMATCH:
- case STARMATCH:
- case INCLUDES:
- case EQ:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EQ:
- jj_consume_token(EQ);
- cases = 1;
- break;
- case INCLUDES:
- jj_consume_token(INCLUDES);
- cases = 2;
- break;
- case DASHMATCH:
- jj_consume_token(DASHMATCH);
- cases = 3;
- break;
- case CARETMATCH:
- jj_consume_token(CARETMATCH);
- cases = 4;
- break;
- case DOLLARMATCH:
- jj_consume_token(DOLLARMATCH);
- cases = 5;
- break;
- case STARMATCH:
- jj_consume_token(STARMATCH);
- cases = 6;
- break;
- default:
- jj_la1[86] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_57:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[87] = jj_gen;
- break label_57;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- val = jj_consume_token(IDENT);
- attValue = val.image;
- break;
- case STRING:
- val = jj_consume_token(STRING);
- attValue = val.image;
- break;
- default:
- jj_la1[88] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_58:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[89] = jj_gen;
- break label_58;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[90] = jj_gen;
- ;
- }
- jj_consume_token(RBRACKET);
- String name = convertIdent(att.image);
- String c;
- switch (cases) {
- case 0:
- c = name;
- break;
- case 1:
- c = name + "=" + attValue;
- break;
- case 2:
- c = name + "~=" + attValue;
- break;
- case 3:
- c = name + "|=" +attValue;
- break;
- case 4:
- c = name + "^=" +attValue;
- break;
- case 5:
- c = name + "$=" +attValue;
- break;
- case 6:
- c = name + "*=" +attValue;
- break;
- default:
- // never reached.
- c = null;
- }
- c = "[" + c + "]";
- if (pred == null) {
- {if (true) return c;}
- } else {
- {if (true) return pred + c;}
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String pseudo(String pred) throws ParseException {
- Token n;
-Token language;
-boolean isPseudoElement = false;
- jj_consume_token(COLON);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- isPseudoElement=true;
- break;
- default:
- jj_la1[91] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- String s = ":" + convertIdent(n.image);
- if (isPseudoElement) {
- if (pseudoElt != null) {
- {if (true) throw new CSSParseException("duplicate pseudo element definition "
- + s, getLocator());}
- } else {
- pseudoElt = ":"+s;
- {if (true) return pred;}
- }
- } else {
- String c = s;
- if (pred == null) {
- {if (true) return c;}
- } else {
- {if (true) return pred + c;}
- }
- }
- break;
- case FUNCTION:
- n = jj_consume_token(FUNCTION);
- label_59:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[92] = jj_gen;
- break label_59;
- }
- jj_consume_token(S);
- }
- language = jj_consume_token(IDENT);
- label_60:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[93] = jj_gen;
- break label_60;
- }
- jj_consume_token(S);
- }
- jj_consume_token(RPARAN);
- String f = convertIdent(n.image);
- if (f.equals("lang(")) {
- String d = convertIdent(language.image);
- if (pred == null) {
- {if (true) return d;}
- } else {
- {if (true) return pred + d;}
- }
- } else {
- {if (true) throw new CSSParseException("invalid pseudo function name "
- + f, getLocator());}
- }
- break;
- default:
- jj_la1[94] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String hash(String pred) throws ParseException {
- Token n;
- n = jj_consume_token(HASH);
- String d = n.image;
- if (pred == null) {
- {if (true) return d;}
- } else {
- {if (true) return pred + d;}
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void variable() throws ParseException {
- String name;
- LexicalUnitImpl exp = null;
- boolean guarded = false;
- String raw;
- try {
- name = variableName();
- jj_consume_token(COLON);
- label_61:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[95] = jj_gen;
- break label_61;
- }
- jj_consume_token(S);
- }
- exp = expr();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case GUARDED_SYM:
- guarded = guarded();
- break;
- default:
- jj_la1[96] = jj_gen;
- ;
- }
- label_62:
- while (true) {
- jj_consume_token(SEMICOLON);
- label_63:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[97] = jj_gen;
- break label_63;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[98] = jj_gen;
- break label_62;
- }
- }
- documentHandler.variable(name, exp, guarded);
- } catch (JumpException e) {
- skipAfterExpression();
- } catch (NumberFormatException e) {
- if (errorHandler != null) {
- errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(),
- getLocator(),
- e));
- }
- reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
- if (errorHandler != null) {
- if (e.currentToken != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- } else {
- reportError(getLocator(), e);
- }
- skipAfterExpression();
- } else {
- skipAfterExpression();
- }
- }
- }
-
- final public void ifDirective() throws ParseException {
- Token n = null;
- String evaluator = "";
- jj_consume_token(IF_SYM);
- label_64:
- while (true) {
- n = booleanExpressionToken();
- evaluator += n.image;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- case EQ:
- case PLUS:
- case MINUS:
- case PRECEDES:
- case SUCCEEDS:
- case DIV:
- case ANY:
- case LPARAN:
- case RPARAN:
- case COMPARE:
- case OR:
- case AND:
- case NOT_EQ:
- case IDENT:
- case NUMBER:
- case VARIABLE:
- ;
- break;
- default:
- jj_la1[99] = jj_gen;
- break label_64;
- }
- }
- jj_consume_token(LBRACE);
- label_65:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[100] = jj_gen;
- break label_65;
- }
- jj_consume_token(S);
- }
- documentHandler.startIfElseDirective();
- documentHandler.ifDirective(evaluator);
- label_66:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[101] = jj_gen;
- break label_66;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[102] = jj_gen;
- if (jj_2_5(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[103] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_67:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[104] = jj_gen;
- break label_67;
- }
- jj_consume_token(S);
- }
- label_68:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ELSE_SYM:
- ;
- break;
- default:
- jj_la1[105] = jj_gen;
- break label_68;
- }
- elseDirective();
- }
- documentHandler.endIfElseDirective();
- }
-
- final public void elseDirective() throws ParseException {
- String evaluator = "";
- Token n = null;
- jj_consume_token(ELSE_SYM);
- label_69:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[106] = jj_gen;
- break label_69;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- jj_consume_token(IF);
- label_70:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- case EQ:
- case PLUS:
- case MINUS:
- case PRECEDES:
- case SUCCEEDS:
- case DIV:
- case ANY:
- case LPARAN:
- case RPARAN:
- case COMPARE:
- case OR:
- case AND:
- case NOT_EQ:
- case IDENT:
- case NUMBER:
- case VARIABLE:
- ;
- break;
- default:
- jj_la1[107] = jj_gen;
- break label_70;
- }
- n = booleanExpressionToken();
- if(n != null) evaluator += n.image;
- }
- break;
- default:
- jj_la1[108] = jj_gen;
- ;
- }
- jj_consume_token(LBRACE);
- label_71:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[109] = jj_gen;
- break label_71;
- }
- jj_consume_token(S);
- }
- if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); }
- else{ documentHandler.elseDirective(); }
- label_72:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[110] = jj_gen;
- break label_72;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[111] = jj_gen;
- if (jj_2_6(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[112] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_73:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[113] = jj_gen;
- break label_73;
- }
- jj_consume_token(S);
- }
- }
-
- final public Token booleanExpressionToken() throws ParseException {
- Token n = null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- n = jj_consume_token(VARIABLE);
- break;
- case IDENT:
- n = jj_consume_token(IDENT);
- break;
- case NUMBER:
- n = jj_consume_token(NUMBER);
- break;
- case LPARAN:
- n = jj_consume_token(LPARAN);
- break;
- case RPARAN:
- n = jj_consume_token(RPARAN);
- break;
- case PLUS:
- n = jj_consume_token(PLUS);
- break;
- case MINUS:
- n = jj_consume_token(MINUS);
- break;
- case DIV:
- n = jj_consume_token(DIV);
- break;
- case ANY:
- n = jj_consume_token(ANY);
- break;
- case COMPARE:
- n = jj_consume_token(COMPARE);
- break;
- case EQ:
- n = jj_consume_token(EQ);
- break;
- case PRECEDES:
- n = jj_consume_token(PRECEDES);
- break;
- case SUCCEEDS:
- n = jj_consume_token(SUCCEEDS);
- break;
- case OR:
- n = jj_consume_token(OR);
- break;
- case AND:
- n = jj_consume_token(AND);
- break;
- case S:
- n = jj_consume_token(S);
- break;
- case NOT_EQ:
- n = jj_consume_token(NOT_EQ);
- break;
- default:
- jj_la1[114] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return n;}
- throw new Error("Missing return statement in function");
- }
-
- final public void eachDirective() throws ParseException {
- Token var;
- ArrayList<String> list = null;
- String listVariable = null;
- jj_consume_token(EACH_SYM);
- label_74:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[115] = jj_gen;
- break label_74;
- }
- jj_consume_token(S);
- }
- var = jj_consume_token(VARIABLE);
- label_75:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[116] = jj_gen;
- break label_75;
- }
- jj_consume_token(S);
- }
- jj_consume_token(EACH_IN);
- label_76:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[117] = jj_gen;
- break label_76;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- list = stringList();
- documentHandler.startEachDirective(var.image, list);
- break;
- case VARIABLE:
- listVariable = variableName();
- documentHandler.startEachDirective(var.image, listVariable);
- break;
- default:
- jj_la1[118] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- jj_consume_token(LBRACE);
- label_77:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[119] = jj_gen;
- break label_77;
- }
- jj_consume_token(S);
- }
- label_78:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[120] = jj_gen;
- break label_78;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- default:
- jj_la1[121] = jj_gen;
- if (jj_2_7(5)) {
- listModifyDirective();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[122] = jj_gen;
- if (jj_2_8(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[123] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_79:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[124] = jj_gen;
- break label_79;
- }
- jj_consume_token(S);
- }
- documentHandler.endEachDirective();
- }
-
- final public ArrayList<String > stringList() throws ParseException {
- ArrayList<String > strings = new ArrayList<String >();
- Token input;
- input = jj_consume_token(IDENT);
- label_80:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[125] = jj_gen;
- break label_80;
- }
- jj_consume_token(S);
- }
- strings.add(input.image);
- label_81:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[126] = jj_gen;
- break label_81;
- }
- jj_consume_token(COMMA);
- label_82:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[127] = jj_gen;
- break label_82;
- }
- jj_consume_token(S);
- }
- input = jj_consume_token(IDENT);
- strings.add(input.image);
- label_83:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[128] = jj_gen;
- break label_83;
- }
- jj_consume_token(S);
- }
- }
- {if (true) return strings;}
- throw new Error("Missing return statement in function");
- }
-
- final public void mixinDirective() throws ParseException {
- String name;
- ArrayList<VariableNode> args = null;
- String body;
- jj_consume_token(MIXIN_SYM);
- label_84:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[129] = jj_gen;
- break label_84;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- name = property();
- break;
- case FUNCTION:
- name = functionName();
- args = arglist();
- jj_consume_token(RPARAN);
- label_85:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[130] = jj_gen;
- break label_85;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[131] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- jj_consume_token(LBRACE);
- label_86:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[132] = jj_gen;
- break label_86;
- }
- jj_consume_token(S);
- }
- documentHandler.startMixinDirective(name, args);
- label_87:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case EACH_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[133] = jj_gen;
- break label_87;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- default:
- jj_la1[134] = jj_gen;
- if (jj_2_9(5)) {
- listModifyDirective();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EACH_SYM:
- eachDirective();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[135] = jj_gen;
- if (jj_2_10(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[136] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_88:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[137] = jj_gen;
- break label_88;
- }
- jj_consume_token(S);
- }
- documentHandler.endMixinDirective(name, args);
- }
-
- final public ArrayList<VariableNode> arglist() throws ParseException {
- ArrayList<VariableNode> args = new ArrayList<VariableNode>();
- VariableNode arg;
- boolean hasNonOptionalArgument = false;
- arg = mixinArg();
- label_89:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[138] = jj_gen;
- break label_89;
- }
- jj_consume_token(COMMA);
- label_90:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[139] = jj_gen;
- break label_90;
- }
- jj_consume_token(S);
- }
- hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
- arg = mixinArg();
- }
- hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
- {if (true) return args;}
- throw new Error("Missing return statement in function");
- }
-
- boolean checkMixinForNonOptionalArguments(VariableNode arg, boolean hasNonOptionalArguments) throws ParseException {
- boolean currentArgHasArguments = arg.getExpr() != null && arg.getExpr().getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE && arg.getExpr().getNextLexicalUnit() != null;
-
- if(currentArgHasArguments)
- {
- if(hasNonOptionalArguments)
- {
- throw new ParseException("Sass Error: Required argument $"+ arg.getName() +" must come before any optional arguments.");
- }
- return hasNonOptionalArguments;
- }else
- {
- return true;
- }
- }
-
- final public VariableNode mixinArg() throws ParseException {
- String name;
- Token variable = null;
- LexicalUnitImpl first = null;
- LexicalUnitImpl prev = null;
- LexicalUnitImpl next = null;
- name = variableName();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- case VARIABLE:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_91:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[140] = jj_gen;
- break label_91;
- }
- jj_consume_token(S);
- }
- first = nonVariableTerm(null);
- prev = first;
- label_92:
- while (true) {
- if (jj_2_11(3)) {
- ;
- } else {
- break label_92;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_93:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[141] = jj_gen;
- break label_93;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[142] = jj_gen;
- ;
- }
- prev = nonVariableTerm(prev);
- }
- break;
- case VARIABLE:
- variable = jj_consume_token(VARIABLE);
- first = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
- prev, variable.image);
- break;
- default:
- jj_la1[143] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[144] = jj_gen;
- ;
- }
- VariableNode arg = new VariableNode(name, first, false);
- {if (true) return arg;}
- throw new Error("Missing return statement in function");
- }
-
- final public ArrayList<LexicalUnitImpl> argValuelist() throws ParseException {
- ArrayList<LexicalUnitImpl> args = new ArrayList<LexicalUnitImpl>();
- LexicalUnitImpl first = null;
- LexicalUnitImpl next = null;
- LexicalUnitImpl prev = null;
- first = term(null);
- args.add(first); prev = first;
- label_94:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case COLON:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[145] = jj_gen;
- break label_94;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_95:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[146] = jj_gen;
- break label_95;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[147] = jj_gen;
- ;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next); prev = next;
- }
- label_96:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[148] = jj_gen;
- break label_96;
- }
- jj_consume_token(COMMA);
- label_97:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[149] = jj_gen;
- break label_97;
- }
- jj_consume_token(S);
- }
- first = term(null);
- args.add(first); prev = first;
- label_98:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case COLON:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[150] = jj_gen;
- break label_98;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_99:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[151] = jj_gen;
- break label_99;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[152] = jj_gen;
- ;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next); prev = next;
- }
- }
- {if (true) return args;}
- throw new Error("Missing return statement in function");
- }
-
- final public void includeDirective() throws ParseException {
- String name;
- ArrayList<LexicalUnitImpl> args=null;
- jj_consume_token(INCLUDE_SYM);
- label_100:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[153] = jj_gen;
- break label_100;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- name = property();
- break;
- case VARIABLE:
- name = variableName();
- name = "$"+name;
- break;
- case INTERPOLATION:
- name = interpolation();
- break;
- case FUNCTION:
- name = functionName();
- args = argValuelist();
- jj_consume_token(RPARAN);
- break;
- default:
- jj_la1[154] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_101:
- while (true) {
- jj_consume_token(SEMICOLON);
- label_102:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[155] = jj_gen;
- break label_102;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[156] = jj_gen;
- break label_101;
- }
- }
- documentHandler.includeDirective(name, args);
- }
-
- final public String interpolation() throws ParseException {
- Token n;
- n = jj_consume_token(INTERPOLATION);
- {if (true) return n.image;}
- throw new Error("Missing return statement in function");
- }
-
- final public void listModifyDirective() throws ParseException {
- if (jj_2_12(5)) {
- removeDirective();
- } else if (jj_2_13(5)) {
- appendDirective();
- } else if (jj_2_14(5)) {
- containsDirective();
- } else {
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void appendDirective() throws ParseException {
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
- n = jj_consume_token(VARIABLE);
- variable = n.image;
- label_103:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[157] = jj_gen;
- break label_103;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_104:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[158] = jj_gen;
- break label_104;
- }
- jj_consume_token(S);
- }
- jj_consume_token(APPEND);
- label_105:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[159] = jj_gen;
- break label_105;
- }
- jj_consume_token(S);
- }
- list = listModifyDirectiveArgs(0);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case RPARAN:
- jj_consume_token(RPARAN);
- break;
- default:
- jj_la1[160] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_106:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[161] = jj_gen;
- break label_106;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_107:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[162] = jj_gen;
- break label_107;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_108:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[163] = jj_gen;
- break label_108;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[164] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- label_109:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[165] = jj_gen;
- break label_109;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- label_110:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[166] = jj_gen;
- break label_110;
- }
- jj_consume_token(S);
- }
- documentHandler.appendDirective(variable,list,remove,separator);
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void removeDirective() throws ParseException {
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
- n = jj_consume_token(VARIABLE);
- variable = n.image;
- label_111:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[167] = jj_gen;
- break label_111;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_112:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[168] = jj_gen;
- break label_112;
- }
- jj_consume_token(S);
- }
- jj_consume_token(REMOVE);
- label_113:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[169] = jj_gen;
- break label_113;
- }
- jj_consume_token(S);
- }
- list = listModifyDirectiveArgs(0);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case RPARAN:
- jj_consume_token(RPARAN);
- break;
- default:
- jj_la1[170] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_114:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[171] = jj_gen;
- break label_114;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_115:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[172] = jj_gen;
- break label_115;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_116:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[173] = jj_gen;
- break label_116;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[174] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- label_117:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[175] = jj_gen;
- break label_117;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- label_118:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[176] = jj_gen;
- break label_118;
- }
- jj_consume_token(S);
- }
- documentHandler.removeDirective(variable,list,remove,separator);
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void containsDirective() throws ParseException {
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
- n = jj_consume_token(VARIABLE);
- variable = n.image;
- label_119:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[177] = jj_gen;
- break label_119;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_120:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[178] = jj_gen;
- break label_120;
- }
- jj_consume_token(S);
- }
- jj_consume_token(CONTAINS);
- label_121:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[179] = jj_gen;
- break label_121;
- }
- jj_consume_token(S);
- }
- list = listModifyDirectiveArgs(0);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case RPARAN:
- jj_consume_token(RPARAN);
- break;
- default:
- jj_la1[180] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_122:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[181] = jj_gen;
- break label_122;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_123:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[182] = jj_gen;
- break label_123;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_124:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[183] = jj_gen;
- break label_124;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[184] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- label_125:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[185] = jj_gen;
- break label_125;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- label_126:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[186] = jj_gen;
- break label_126;
- }
- jj_consume_token(S);
- }
- documentHandler.containsDirective(variable,list,remove,separator);
- }
-
- String listModifyDirectiveArgs(int nest) throws ParseException {
- String list = "";
- int nesting = nest;
- Token t = null;
-
- while(true)
- {
- t = getToken(1);
- String s = t.image;
- if(t.kind == VARIABLE||t.kind == IDENT)
- {
- list += s;
- }else if(s.toLowerCase().equals("auto")||s.toLowerCase().equals("space")||s.toLowerCase().equals("comma"))
- {
- int i = 2;
- Token temp = getToken(i);
- boolean isLast = true;
- while(temp.kind != SEMICOLON)
- {
- if(temp.kind != RPARAN || temp.kind != S)
- {
- isLast = false;
- }
- i++;
- temp = getToken(i);
- }
-
- if(isLast)
- {
- return list;
- }
- }
- else if(t.kind == STRING)
- {
- list += s.substring(1,s.length()).substring(0,s.length()-2);
-
- }else if(t.kind == LPARAN)
- {
- nesting++;
- if(nesting > nest+1)
- {
- throw new CSSParseException("Only one ( ) pair per parameter allowed", getLocator());
- }
- }else if(t.kind == RPARAN)
- {
- nesting--;
- if(nesting == 0)
- {
- return list;
- }
- } else if(t.kind == COMMA)
- {
- if(nesting == nest)
- {
- return list;
- }else
- {
- list += ",";
- }
-
- }else if(t.kind == S)
- {
- list += " ";
- } else if(t.kind == LBRACE)
- {
- throw new CSSParseException("Invalid token,'{' found", getLocator());
- }
-
- getNextToken();
- }
- }
-
- final public Node returnDirective() throws ParseException {
- String raw;
- raw = skipStatement();
- {if (true) return null;}
- throw new Error("Missing return statement in function");
- }
-
- void debugDirective() throws ParseException {
- }
-
- void warnDirective() throws ParseException {
- }
-
- final public Node forDirective() throws ParseException {
- String var;
- String from;
- String to;
- boolean exclusive;
- String body;
- Token tok;
- var = variableName();
- int[] toThrough = {TO, THROUGH};
- from = skipStatementUntil(toThrough);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case TO:
- tok = jj_consume_token(TO);
- exclusive = true;
- break;
- case THROUGH:
- tok = jj_consume_token(THROUGH);
- exclusive = false;
- break;
- default:
- jj_la1[187] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- to = skipStatementUntilLeftBrace();
- label_127:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[188] = jj_gen;
- break label_127;
- }
- jj_consume_token(S);
- }
- body = skipStatement();
- {if (true) return documentHandler.forDirective(var, from, to, exclusive, body);}
- throw new Error("Missing return statement in function");
- }
-
- final public Node whileDirective() throws ParseException {
- String condition;
- String body;
- condition = skipStatementUntilLeftBrace();
- body = skipStatement();
- {if (true) return documentHandler.whileDirective(condition, body);}
- throw new Error("Missing return statement in function");
- }
-
- final public void extendDirective() throws ParseException {
- ArrayList<String> list;
- jj_consume_token(EXTEND_SYM);
- label_128:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[189] = jj_gen;
- break label_128;
- }
- jj_consume_token(S);
- }
- list = selectorList();
- label_129:
- while (true) {
- jj_consume_token(SEMICOLON);
- label_130:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[190] = jj_gen;
- break label_130;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[191] = jj_gen;
- break label_129;
- }
- }
- documentHandler.extendDirective(list);
- }
-
- Node importDirective() throws ParseException {
- return null;
- }
-
- Node charsetDirective() throws ParseException {
- return null;
- }
-
- Node mozDocumentDirective() throws ParseException {
- return null;
- }
-
- Node supportsDirective() throws ParseException {
- return null;
- }
-
- final public void nestedProperties() throws ParseException {
- String name;
-LexicalUnit exp;
- name = property();
- jj_consume_token(COLON);
- label_131:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[192] = jj_gen;
- break label_131;
- }
- jj_consume_token(S);
- }
- jj_consume_token(LBRACE);
- label_132:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[193] = jj_gen;
- break label_132;
- }
- jj_consume_token(S);
- }
- documentHandler.startNestedProperties(name);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[194] = jj_gen;
- ;
- }
- label_133:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[195] = jj_gen;
- break label_133;
- }
- jj_consume_token(SEMICOLON);
- label_134:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[196] = jj_gen;
- break label_134;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[197] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- documentHandler.endNestedProperties(name);
- label_135:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[198] = jj_gen;
- break label_135;
- }
- jj_consume_token(S);
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void declarationOrNestedProperties() throws ParseException {
- boolean important = false;
- String name;
- LexicalUnitImpl exp;
- Token save;
- String comment = null;
- try {
- name = property();
- save = token;
- jj_consume_token(COLON);
- label_136:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[199] = jj_gen;
- break label_136;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- exp = expr();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IMPORTANT_SYM:
- important = prio();
- break;
- default:
- jj_la1[200] = jj_gen;
- ;
- }
- Token next = getToken(1);
- if(next.kind == SEMICOLON || next.kind == RBRACE){
- while(next.kind == SEMICOLON){
- skipStatement();
- next = getToken(1);
- }
- if(token.specialToken!=null){
- documentHandler.property(name, exp, important, token.specialToken.image);
- }else{
- documentHandler.property(name, exp, important, null);
- }
- }
- break;
- case LBRACE:
- jj_consume_token(LBRACE);
- label_137:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[201] = jj_gen;
- break label_137;
- }
- jj_consume_token(S);
- }
- documentHandler.startNestedProperties(name);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[202] = jj_gen;
- ;
- }
- label_138:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[203] = jj_gen;
- break label_138;
- }
- jj_consume_token(SEMICOLON);
- label_139:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[204] = jj_gen;
- break label_139;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[205] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_140:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[206] = jj_gen;
- break label_140;
- }
- jj_consume_token(S);
- }
- documentHandler.endNestedProperties(name);
- break;
- default:
- jj_la1[207] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- } catch (JumpException e) {
- skipAfterExpression();
- // reportWarningSkipText(getLocator(), skipAfterExpression());
-
- } catch (NumberFormatException e) {
- if (errorHandler != null) {
- errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(),
- getLocator(),
- e));
- }
- reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
- if (errorHandler != null) {
- if (e.currentToken != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- } else {
- reportError(getLocator(), e);
- }
- skipAfterExpression();
- /*
- LocatorImpl loc = (LocatorImpl) getLocator();
- loc.column--;
- reportWarningSkipText(loc, skipAfterExpression());
- */
- } else {
- skipAfterExpression();
- }
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void declaration() throws ParseException {
- boolean important = false;
- String name;
- LexicalUnit exp;
- Token save;
- try {
- name = property();
- save = token;
- jj_consume_token(COLON);
- label_141:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[208] = jj_gen;
- break label_141;
- }
- jj_consume_token(S);
- }
- exp = expr();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IMPORTANT_SYM:
- important = prio();
- break;
- default:
- jj_la1[209] = jj_gen;
- ;
- }
- documentHandler.property(name, exp, important);
- } catch (JumpException e) {
- skipAfterExpression();
- // reportWarningSkipText(getLocator(), skipAfterExpression());
-
- } catch (NumberFormatException e) {
- if (errorHandler != null) {
- errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(),
- getLocator(),
- e));
- }
- reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
- if (errorHandler != null) {
- if (e.currentToken != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- } else {
- reportError(getLocator(), e);
- }
- skipAfterExpression();
- /*
- LocatorImpl loc = (LocatorImpl) getLocator();
- loc.column--;
- reportWarningSkipText(loc, skipAfterExpression());
- */
- } else {
- skipAfterExpression();
- }
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public boolean prio() throws ParseException {
- jj_consume_token(IMPORTANT_SYM);
- label_142:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[210] = jj_gen;
- break label_142;
- }
- jj_consume_token(S);
- }
- {if (true) return true;}
- throw new Error("Missing return statement in function");
- }
-
- final public boolean guarded() throws ParseException {
- jj_consume_token(GUARDED_SYM);
- label_143:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[211] = jj_gen;
- break label_143;
- }
- jj_consume_token(S);
- }
- {if (true) return true;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public LexicalUnitImpl operator(LexicalUnitImpl prev) throws ParseException {
- Token n;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DIV:
- n = jj_consume_token(DIV);
- label_144:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[212] = jj_gen;
- break label_144;
- }
- jj_consume_token(S);
- }
- {if (true) return LexicalUnitImpl.createSlash(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- case COMMA:
- n = jj_consume_token(COMMA);
- label_145:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[213] = jj_gen;
- break label_145;
- }
- jj_consume_token(S);
- }
- {if (true) return LexicalUnitImpl.createComma(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- default:
- jj_la1[214] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public LexicalUnitImpl expr() throws ParseException {
- LexicalUnitImpl first, res;
- char op;
- first = term(null);
- res = first;
- label_146:
- while (true) {
- if (jj_2_15(2)) {
- ;
- } else {
- break label_146;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- case DIV:
- res = operator(res);
- break;
- default:
- jj_la1[215] = jj_gen;
- ;
- }
- res = term(res);
- }
- {if (true) return first;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public char unaryOperator() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case MINUS:
- jj_consume_token(MINUS);
- {if (true) return '-';}
- break;
- case PLUS:
- jj_consume_token(PLUS);
- {if (true) return '+';}
- break;
- default:
- jj_la1[216] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public LexicalUnitImpl term(LexicalUnitImpl prev) throws ParseException {
- LexicalUnitImpl result = null;
- Token n = null;
- char op = ' ';
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- result = nonVariableTerm(prev);
- break;
- case VARIABLE:
- result = variableTerm(prev);
- break;
- default:
- jj_la1[217] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return result;}
- throw new Error("Missing return statement in function");
- }
-
- final public LexicalUnitImpl variableTerm(LexicalUnitImpl prev) throws ParseException {
- LexicalUnitImpl result = null;
- String varName = "";
- varName = variableName();
- result = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
- prev, varName); {if (true) return result;}
- throw new Error("Missing return statement in function");
- }
-
- final public LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev) throws ParseException {
-LexicalUnitImpl result = null;
- Token n = null;
- char op = ' ';
- String varName;
- String s = "";
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case NUMBER:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case FUNCTION:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- op = unaryOperator();
- break;
- default:
- jj_la1[218] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case NUMBER:
- n = jj_consume_token(NUMBER);
- result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
- prev, number(op, n, 0));
- break;
- case PERCENTAGE:
- n = jj_consume_token(PERCENTAGE);
- result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
- prev, number(op, n, 1));
- break;
- case PT:
- n = jj_consume_token(PT);
- result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case CM:
- n = jj_consume_token(CM);
- result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case MM:
- n = jj_consume_token(MM);
- result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case PC:
- n = jj_consume_token(PC);
- result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case IN:
- n = jj_consume_token(IN);
- result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case PX:
- n = jj_consume_token(PX);
- result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case EMS:
- n = jj_consume_token(EMS);
- result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case EXS:
- n = jj_consume_token(EXS);
- result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case DEG:
- n = jj_consume_token(DEG);
- result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
- prev, number(op, n, 3));
- break;
- case RAD:
- n = jj_consume_token(RAD);
- result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
- prev, number(op, n, 3));
- break;
- case GRAD:
- n = jj_consume_token(GRAD);
- result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
- prev, number(op, n, 3));
- break;
- case SECOND:
- n = jj_consume_token(SECOND);
- result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
- prev, number(op, n, 1));
- break;
- case MS:
- n = jj_consume_token(MS);
- result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case HZ:
- n = jj_consume_token(HZ);
- result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
- prev, number(op, n, 2));
- break;
- case KHZ:
- n = jj_consume_token(KHZ);
- result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
- prev, number(op, n, 3));
- break;
- case DIMEN:
- n = jj_consume_token(DIMEN);
- s = n.image;
- int i = 0;
- while (i < s.length()
- && (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));
- break;
- case FUNCTION:
- result = function(op, prev);
- break;
- default:
- jj_la1[219] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- case DOT:
- case STRING:
- case IDENT:
- case URL:
- case HASH:
- case UNICODERANGE:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING:
- n = jj_consume_token(STRING);
- result =
- LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
- convertStringIndex(n.image, 1,
- n.image.length() -1));
- break;
- case DOT:
- case IDENT:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- jj_consume_token(DOT);
- s+=".";
- break;
- default:
- jj_la1[220] = jj_gen;
- ;
- }
- n = jj_consume_token(IDENT);
- s += convertIdent(n.image);
- if ("inherit".equals(s)) {
- result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
- prev);
- } else {
- result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- prev, convertIdent(n.image));
- }
-
- /* /
- Auto correction code used in the CSS Validator but must not
- be used by a conformant CSS2 parser.
- * Common error :
- * H1 {
- * color : black
- * background : white
- * }
- *
- Token t = getToken(1);
- Token semicolon = new Token();
- semicolon.kind = SEMICOLON;
- semicolon.image = ";";
- if (t.kind == COLON) {
- // @@SEEME. (generate a warning?)
- // @@SEEME if expression is a single ident,
- generate an error ?
- rejectToken(semicolon);
-
- result = prev;
- }
- / */
-
- break;
- case HASH:
- result = hexcolor(prev);
- break;
- case URL:
- result = url(prev);
- break;
- case UNICODERANGE:
- result = unicode(prev);
- break;
- default:
- jj_la1[221] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[222] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_147:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[223] = jj_gen;
- break label_147;
- }
- jj_consume_token(S);
- }
- {if (true) return result;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * Handle all CSS2 functions.
- * @exception ParseException exception during the parse
- */
- final public LexicalUnitImpl function(char operator, LexicalUnitImpl prev) throws ParseException {
- Token n;
- LexicalUnit params = null;
- n = jj_consume_token(FUNCTION);
- label_148:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[224] = jj_gen;
- break label_148;
- }
- jj_consume_token(S);
- }
- String fname = convertIdent(n.image);
- if("alpha(".equals(fname)){
- String body = skipStatementUntilSemiColon();
- {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- null, "alpha("+body);}
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- params = expr();
- break;
- default:
- jj_la1[225] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- if (operator != ' ') {
- {if (true) throw new CSSParseException("invalid operator before a function.",
- getLocator());}
- }
- String f = convertIdent(n.image);
- LexicalUnitImpl l = (LexicalUnitImpl) params;
- boolean loop = true;
- if ("rgb(".equals(f)) {
- // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
- int i = 0;
- while (loop && l != null && i < 5) {
- switch (i) {
- case 0:
- case 2:
- case 4:
- if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
- && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
- loop = false;
- }
- break;
- case 1:
- case 3:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- {if (true) throw new ParseException("implementation error");}
- }
- if (loop) {
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- }
- if ((i == 5) && loop && (l == null)) {
- {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine,
- n.beginColumn,
- prev, params);}
- } else {
- if (errorHandler != null) {
- String errorText;
- Locator loc;
- if (i < 5) {
- if (params == null) {
- loc = new LocatorImpl(this, n.beginLine,
- n.beginColumn-1);
- errorText = "not enough parameters.";
- } else if (l == null) {
- loc = new LocatorImpl(this, n.beginLine,
- n.beginColumn-1);
- errorText = "not enough parameters: "
- + params.toString();
- } else {
- loc = new LocatorImpl(this, l.getLineNumber(),
- l.getColumnNumber());
- errorText = "invalid parameter: "
- + l.toString();
- }
- } else {
- loc = new LocatorImpl(this, l.getLineNumber(),
- l.getColumnNumber());
- errorText = "too many parameters: "
- + l.toString();
- }
- errorHandler.error(new CSSParseException(errorText, loc));
- }
-
- {if (true) throw new JumpException();}
- }
- } else if ("counter".equals(f)) {
- int i = 0;
- while (loop && l != null && i < 3) {
- switch (i) {
- case 0:
- case 2:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
- loop = false;
- }
- break;
- case 1:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- {if (true) throw new ParseException("implementation error");}
- }
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- if (((i == 1) || (i == 3)) && loop && (l == null)) {
- {if (true) return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
- prev, params);}
- }
-
- } else if ("counters(".equals(f)) {
-
- int i = 0;
- while (loop && l != null && i < 5) {
- switch (i) {
- case 0:
- case 4:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
- loop = false;
- }
- break;
- case 2:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
- loop = false;
- }
- break;
- case 1:
- case 3:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- {if (true) throw new ParseException("implementation error");}
- }
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- if (((i == 3) || (i == 5)) && loop && (l == null)) {
- {if (true) return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
- prev, params);}
- }
- } else if ("attr(".equals(f)) {
- if ((l != null)
- && (l.getNextLexicalUnit() == null)
- && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
- {if (true) return LexicalUnitImpl.createAttr(l.getLineNumber(),
- l.getColumnNumber(),
- prev, l.getStringValue());}
- }
- } else if ("rect(".equals(f)) {
- int i = 0;
- while (loop && l != null && i < 7) {
- switch (i) {
- case 0:
- case 2:
- case 4:
- case 6:
- switch (l.getLexicalUnitType()) {
- case LexicalUnit.SAC_INTEGER:
- if (l.getIntegerValue() != 0) {
- loop = false;
- }
- break;
- case LexicalUnit.SAC_IDENT:
- if (!l.getStringValue().equals("auto")) {
- loop = false;
- }
- break;
- case LexicalUnit.SAC_EM:
- case LexicalUnit.SAC_EX:
- case LexicalUnit.SAC_PIXEL:
- case LexicalUnit.SAC_CENTIMETER:
- case LexicalUnit.SAC_MILLIMETER:
- case LexicalUnit.SAC_INCH:
- case LexicalUnit.SAC_POINT:
- case LexicalUnit.SAC_PICA:
- // nothing
- break;
- default:
- loop = false;
- }
- break;
- case 1:
- case 3:
- case 5:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- {if (true) throw new ParseException("implementation error");}
- }
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- if ((i == 7) && loop && (l == null)) {
- {if (true) return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
- prev, params);}
- }
- }
- {if (true) return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
- f.substring(0,
- f.length() -1),
- params);}
- throw new Error("Missing return statement in function");
- }
-
- final public LexicalUnitImpl unicode(LexicalUnitImpl prev) throws ParseException {
- Token n;
- n = jj_consume_token(UNICODERANGE);
- LexicalUnitImpl params = null;
- String s = n.image.substring(2);
- int index = s.indexOf('-');
- if (index == -1) {
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s, 16));
- } else {
- String s1 = s.substring(0, index);
- String s2 = s.substring(index);
-
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s1, 16));
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s2, 16));
- }
-
- {if (true) return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
- prev, params);}
- throw new Error("Missing return statement in function");
- }
-
- final public LexicalUnitImpl url(LexicalUnitImpl prev) throws ParseException {
- Token n;
- n = jj_consume_token(URL);
- String urlname = n.image.substring(4, n.image.length()-1).trim();
- {if (true) return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException {
- Token n;
- n = jj_consume_token(HASH);
- int r;
- LexicalUnitImpl first, params = null;
- String s = n.image.substring(1);
-
- if(s.length()!=3 && s.length()!=6) {
- first = null;
- {if (true) throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
- getLocator());}
- }
- {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- prev, n.image);}
- throw new Error("Missing return statement in function");
- }
-
- float number(char operator, Token n, int lengthUnit) throws ParseException {
- String image = n.image;
- float f = 0;
-
- if (lengthUnit != 0) {
- image = image.substring(0, image.length() - lengthUnit);
- }
- f = Float.valueOf(image).floatValue();
- return (operator == '-')? -f: f;
- }
-
- String skipStatementUntilSemiColon() throws ParseException {
- int[] semicolon = {SEMICOLON};
- return skipStatementUntil(semicolon);
- }
-
- String skipStatementUntilLeftBrace() throws ParseException {
- int[] lBrace = {LBRACE};
- return skipStatementUntil(lBrace);
- }
-
- String skipStatementUntilRightParan() throws ParseException {
- int[] rParan = {RPARAN};
- return skipStatementUntil(rParan);
- }
-
- String skipStatementUntil(int[] symbols) throws ParseException {
- StringBuffer s = new StringBuffer();
- boolean stop = false;
- Token tok;
- while(!stop){
- tok = getToken(1);
- if(tok.kind == EOF) {
- return null;
- }
- for(int sym : symbols){
- if(tok.kind == sym){
- stop = true;
- break;
- }
- }
- if(!stop){
- if (tok.image != null) {
- s.append(tok.image);
- }
- getNextToken();
- }
- }
- return s.toString().trim();
- }
-
- String skipStatement() throws ParseException {
- StringBuffer s = new StringBuffer();
- Token tok = getToken(0);
- if (tok.image != null) {
- s.append(tok.image);
- }
- while (true) {
- tok = getToken(1);
- if (tok.kind == EOF) {
- return null;
- }
- s.append(tok.image);
- if (tok.kind == LBRACE) {
- getNextToken();
- s.append(skip_to_matching_brace());
- getNextToken();
- tok = getToken(1);
- break;
- } else if (tok.kind == RBRACE) {
- getNextToken();
- tok = getToken(1);
- break;
- } else if (tok.kind == SEMICOLON) {
- getNextToken();
- tok = getToken(1);
- break;
- }
- getNextToken();
- }
-
- // skip white space
- while (true) {
- if (tok.kind != S) {
- break;
- }
- tok = getNextToken();
- tok = getToken(1);
- }
-
- return s.toString().trim();
- }
-
- String skip_to_matching_brace() throws ParseException {
- StringBuffer s = new StringBuffer();
- Token tok;
- int nesting = 1;
- while (true) {
- tok = getToken(1);
- if (tok.kind == EOF) {
- break;
- }
- s.append(tok.image);
- if (tok.kind == LBRACE) {
- nesting++;
- } else if (tok.kind == RBRACE) {
- nesting--;
- if (nesting == 0) {
- break;
- }
- }
- getNextToken();
- }
- return s.toString();
- }
-
- String convertStringIndex(String s, int start, int len) throws ParseException {
- StringBuffer buf = new StringBuffer(len);
- int index = start;
-
- while (index < len) {
- char c = s.charAt(index);
- if (c == '\u005c\u005c') {
- if (++index < len) {
- c = s.charAt(index);
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- int numValue = Character.digit(c, 16);
- int count = 0;
- int p = 16;
-
- while (index + 1 < len && count < 6) {
- c = s.charAt(index+1);
-
- if (Character.digit(c, 16) != -1) {
- numValue = (numValue * 16) + Character.digit(c, 16);
- p *= 16;
- index++;
- } else {
- if (c == ' ') {
- // skip the latest white space
- index++;
- }
- break;
- }
- }
- buf.append((char) numValue);
- break;
- case '\u005cn':
- case '\u005cf':
- break;
- case '\u005cr':
- if (index + 1 < len) {
- if (s.charAt(index + 1) == '\u005cn') {
- index ++;
- }
- }
- break;
- default:
- buf.append(c);
- }
- } else {
- throw new CSSParseException("invalid string " + s, getLocator());
- }
- } else {
- buf.append(c);
- }
- index++;
- }
-
- return buf.toString();
- }
-
- String convertIdent(String s) throws ParseException {
- return convertStringIndex(s, 0, s.length());
- }
-
- String convertString(String s) throws ParseException {
- return convertStringIndex(s, 0, s.length());
- }
-
- void comments() throws ParseException {
- 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;
- }
- }
- }
-
- void rejectToken(Token t) throws ParseException {
- Token fakeToken = new Token();
- t.next = token;
- fakeToken.next = t;
- token = fakeToken;
- }
-
- String skipAfterExpression() throws ParseException {
- Token t = getToken(1);
- StringBuffer s = new StringBuffer();
- s.append(getToken(0).image);
-
- while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
- s.append(t.image);
- getNextToken();
- t = getToken(1);
- }
-
- return s.toString();
- }
-
-/**
- * The following functions are useful for a DOM CSS implementation only and are
- * not part of the general CSS2 parser.
- */
- final public void _parseRule() throws ParseException {
- String ret = null;
- label_149:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[226] = jj_gen;
- break label_149;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IMPORT_SYM:
- importDeclaration();
- break;
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- case MEDIA_SYM:
- media();
- break;
- case PAGE_SYM:
- page();
- break;
- case FONT_FACE_SYM:
- fontFace();
- break;
- default:
- jj_la1[227] = jj_gen;
- ret = skipStatement();
- if ((ret == null) || (ret.length() == 0)) {
- {if (true) return;}
- }
- if (ret.charAt(0) == '@') {
- documentHandler.ignorableAtRule(ret);
- } else {
- {if (true) throw new CSSParseException("unrecognize rule: " + ret,
- getLocator());}
- }
- }
- }
-
- final public void _parseImportRule() throws ParseException {
- label_150:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[228] = jj_gen;
- break label_150;
- }
- jj_consume_token(S);
- }
- importDeclaration();
- }
-
- final public void _parseMediaRule() throws ParseException {
- label_151:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[229] = jj_gen;
- break label_151;
- }
- jj_consume_token(S);
- }
- media();
- }
-
- final public void _parseDeclarationBlock() throws ParseException {
- label_152:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[230] = jj_gen;
- break label_152;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[231] = jj_gen;
- ;
- }
- label_153:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[232] = jj_gen;
- break label_153;
- }
- jj_consume_token(SEMICOLON);
- label_154:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[233] = jj_gen;
- break label_154;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[234] = jj_gen;
- ;
- }
- }
- }
-
- final public ArrayList<String> _parseSelectors() throws ParseException {
- ArrayList<String> p = null;
- try {
- label_155:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[235] = jj_gen;
- break label_155;
- }
- jj_consume_token(S);
- }
- p = selectorList();
- {if (true) return p;}
- } catch (ThrowedParseException e) {
- {if (true) throw (ParseException) e.e.fillInStackTrace();}
- }
- throw new Error("Missing return statement in function");
- }
-
- private boolean jj_2_1(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_1(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(0, xla); }
- }
-
- private boolean jj_2_2(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_2(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(1, xla); }
- }
-
- private boolean jj_2_3(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_3(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(2, xla); }
- }
-
- private boolean jj_2_4(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_4(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(3, xla); }
- }
-
- private boolean jj_2_5(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_5(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(4, xla); }
- }
-
- private boolean jj_2_6(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_6(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(5, xla); }
- }
-
- private boolean jj_2_7(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_7(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(6, xla); }
- }
-
- private boolean jj_2_8(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_8(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(7, xla); }
- }
-
- private boolean jj_2_9(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_9(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(8, xla); }
- }
-
- private boolean jj_2_10(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_10(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(9, xla); }
- }
-
- private boolean jj_2_11(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_11(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(10, xla); }
- }
-
- private boolean jj_2_12(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_12(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(11, xla); }
- }
-
- private boolean jj_2_13(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_13(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(12, xla); }
- }
-
- private boolean jj_2_14(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_14(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(13, xla); }
- }
-
- private boolean jj_2_15(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_15(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(14, xla); }
- }
-
- private boolean jj_3R_202() {
- if (jj_scan_token(PX)) return true;
- return false;
- }
-
- private boolean jj_3R_201() {
- if (jj_scan_token(IN)) return true;
- return false;
- }
-
- private boolean jj_3R_200() {
- if (jj_scan_token(PC)) return true;
- return false;
- }
-
- private boolean jj_3_1() {
- if (jj_3R_156()) return true;
- return false;
- }
-
- private boolean jj_3R_199() {
- if (jj_scan_token(MM)) return true;
- return false;
- }
-
- private boolean jj_3R_198() {
- if (jj_scan_token(CM)) return true;
- return false;
- }
-
- private boolean jj_3R_180() {
- if (jj_scan_token(LBRACE)) return true;
- return false;
- }
-
- private boolean jj_3R_197() {
- if (jj_scan_token(PT)) return true;
- return false;
- }
-
- private boolean jj_3R_196() {
- if (jj_scan_token(PERCENTAGE)) return true;
- return false;
- }
-
- private boolean jj_3R_185() {
- if (jj_3R_221()) return true;
- return false;
- }
-
- private boolean jj_3R_195() {
- if (jj_scan_token(NUMBER)) return true;
- return false;
- }
-
- private boolean jj_3R_194() {
- if (jj_3R_236()) return true;
- return false;
- }
-
- private boolean jj_3R_181() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_194()) jj_scanpos = xsp;
- xsp = jj_scanpos;
- if (jj_3R_195()) {
- jj_scanpos = xsp;
- if (jj_3R_196()) {
- jj_scanpos = xsp;
- if (jj_3R_197()) {
- jj_scanpos = xsp;
- if (jj_3R_198()) {
- jj_scanpos = xsp;
- if (jj_3R_199()) {
- jj_scanpos = xsp;
- if (jj_3R_200()) {
- jj_scanpos = xsp;
- if (jj_3R_201()) {
- jj_scanpos = xsp;
- if (jj_3R_202()) {
- jj_scanpos = xsp;
- if (jj_3R_203()) {
- jj_scanpos = xsp;
- if (jj_3R_204()) {
- jj_scanpos = xsp;
- if (jj_3R_205()) {
- jj_scanpos = xsp;
- if (jj_3R_206()) {
- jj_scanpos = xsp;
- if (jj_3R_207()) {
- jj_scanpos = xsp;
- if (jj_3R_208()) {
- jj_scanpos = xsp;
- if (jj_3R_209()) {
- jj_scanpos = xsp;
- if (jj_3R_210()) {
- jj_scanpos = xsp;
- if (jj_3R_211()) {
- jj_scanpos = xsp;
- if (jj_3R_212()) {
- jj_scanpos = xsp;
- if (jj_3R_213()) return true;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3_4() {
- if (jj_3R_159()) return true;
- if (jj_3R_160()) return true;
- return false;
- }
-
- private boolean jj_3R_179() {
- if (jj_3R_193()) return true;
- return false;
- }
-
- private boolean jj_3R_163() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_181()) {
- jj_scanpos = xsp;
- if (jj_3R_182()) return true;
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3_7() {
- if (jj_3R_156()) return true;
- return false;
- }
-
- private boolean jj_3R_191() {
- if (jj_scan_token(COLON)) return true;
- return false;
- }
-
- private boolean jj_3_6() {
- if (jj_3R_161()) return true;
- return false;
- }
-
- private boolean jj_3R_161() {
- if (jj_3R_178()) return true;
- if (jj_scan_token(COLON)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- xsp = jj_scanpos;
- if (jj_3R_179()) {
- jj_scanpos = xsp;
- if (jj_3R_180()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_239() {
- if (jj_scan_token(HASH)) return true;
- return false;
- }
-
- private boolean jj_3R_221() {
- if (jj_3R_242()) return true;
- return false;
- }
-
- private boolean jj_3R_166() {
- if (jj_scan_token(VARIABLE)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(COLON)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(CONTAINS)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
- return false;
- }
-
- private boolean jj_3_14() {
- if (jj_3R_166()) return true;
- return false;
- }
-
- private boolean jj_3R_240() {
- if (jj_scan_token(URL)) return true;
- return false;
- }
-
- private boolean jj_3R_184() {
- if (jj_3R_163()) return true;
- return false;
- }
-
- private boolean jj_3R_168() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_184()) {
- jj_scanpos = xsp;
- if (jj_3R_185()) return true;
- }
- return false;
- }
-
- private boolean jj_3_5() {
- if (jj_3R_161()) return true;
- return false;
- }
-
- private boolean jj_3R_167() {
- if (jj_3R_183()) return true;
- return false;
- }
-
- private boolean jj_3_2() {
- if (jj_3R_156()) return true;
- return false;
- }
-
- private boolean jj_3R_164() {
- if (jj_scan_token(VARIABLE)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(COLON)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(REMOVE)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
- return false;
- }
-
- private boolean jj_3R_245() {
- if (jj_scan_token(PLUS)) return true;
- return false;
- }
-
- private boolean jj_3R_244() {
- if (jj_scan_token(MINUS)) return true;
- return false;
- }
-
- private boolean jj_3R_236() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_244()) {
- jj_scanpos = xsp;
- if (jj_3R_245()) return true;
- }
- return false;
- }
-
- private boolean jj_3_15() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_167()) jj_scanpos = xsp;
- if (jj_3R_168()) return true;
- return false;
- }
-
- private boolean jj_3_13() {
- if (jj_3R_165()) return true;
- return false;
- }
-
- private boolean jj_3R_193() {
- if (jj_3R_168()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3_15()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_241() {
- if (jj_scan_token(UNICODERANGE)) return true;
- return false;
- }
-
- private boolean jj_3R_246() {
- if (jj_3R_193()) return true;
- return false;
- }
-
- private boolean jj_3R_165() {
- if (jj_scan_token(VARIABLE)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(COLON)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(APPEND)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
- return false;
- }
-
- private boolean jj_3R_248() {
- if (jj_scan_token(INTERPOLATION)) return true;
- return false;
- }
-
- private boolean jj_3R_220() {
- 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_237() {
- 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_246()) jj_scanpos = xsp;
- if (jj_scan_token(RPARAN)) return true;
- return false;
- }
-
- private boolean jj_3_10() {
- if (jj_3R_161()) return true;
- return false;
- }
-
- private boolean jj_3R_219() {
- 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_183() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_219()) {
- jj_scanpos = xsp;
- if (jj_3R_220()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_192() {
- if (jj_scan_token(LBRACKET)) return true;
- return false;
- }
-
- private boolean jj_3R_158() {
- if (jj_3R_161()) return true;
- return false;
- }
-
- private boolean jj_3R_178() {
- if (jj_scan_token(IDENT)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_218() {
- if (jj_3R_241()) return true;
- return false;
- }
-
- private boolean jj_3R_242() {
- if (jj_scan_token(VARIABLE)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_217() {
- if (jj_3R_240()) return true;
- return false;
- }
-
- private boolean jj_3_12() {
- if (jj_3R_164()) return true;
- return false;
- }
-
- private boolean jj_3R_156() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3_12()) {
- jj_scanpos = xsp;
- if (jj_3_13()) {
- jj_scanpos = xsp;
- if (jj_3_14()) return true;
- }
- }
- return false;
- }
-
- private boolean jj_3R_216() {
- if (jj_3R_239()) return true;
- return false;
- }
-
- private boolean jj_3R_235() {
- if (jj_scan_token(PARENT)) return true;
- return false;
- }
-
- private boolean jj_3R_234() {
- if (jj_scan_token(ANY)) return true;
- return false;
- }
-
- private boolean jj_3R_247() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_243() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_247()) {
- jj_scanpos = xsp;
- if (jj_3R_248()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_233() {
- Token xsp;
- if (jj_3R_243()) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_243()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_188() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_233()) {
- jj_scanpos = xsp;
- if (jj_3R_234()) {
- jj_scanpos = xsp;
- if (jj_3R_235()) return true;
- }
- }
- return false;
- }
-
- private boolean jj_3R_230() {
- if (jj_scan_token(S)) return true;
- return false;
- }
-
- private boolean jj_3R_229() {
- if (jj_scan_token(DOT)) return true;
- return false;
- }
-
- private boolean jj_3R_157() {
- if (jj_3R_169()) return true;
- return false;
- }
-
- private boolean jj_3R_228() {
- if (jj_scan_token(EQ)) return true;
- return false;
- }
-
- private boolean jj_3R_227() {
- if (jj_scan_token(RPARAN)) return true;
- return false;
- }
-
- private boolean jj_3R_226() {
- if (jj_scan_token(FUNCTION)) return true;
- return false;
- }
-
- private boolean jj_3R_225() {
- if (jj_scan_token(COLON)) return true;
- return false;
- }
-
- private boolean jj_3R_224() {
- if (jj_scan_token(INTERPOLATION)) return true;
- return false;
- }
-
- private boolean jj_3R_223() {
- if (jj_scan_token(NUMBER)) return true;
- return false;
- }
-
- private boolean jj_3R_222() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_186() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_222()) {
- jj_scanpos = xsp;
- if (jj_3R_223()) {
- jj_scanpos = xsp;
- if (jj_3R_224()) {
- jj_scanpos = xsp;
- if (jj_3R_225()) {
- jj_scanpos = xsp;
- if (jj_3R_226()) {
- jj_scanpos = xsp;
- if (jj_3R_227()) {
- jj_scanpos = xsp;
- if (jj_3R_228()) {
- jj_scanpos = xsp;
- if (jj_3R_229()) {
- jj_scanpos = xsp;
- if (jj_3R_230()) return true;
- }
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3_3() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_157()) {
- jj_scanpos = xsp;
- if (jj_3R_158()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_190() {
- if (jj_scan_token(DOT)) return true;
- return false;
- }
-
- private boolean jj_3R_169() {
- if (jj_scan_token(MICROSOFT_RULE)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(COLON)) return true;
- if (jj_3R_186()) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_186()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_162() {
- 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_238() {
- if (jj_scan_token(DOT)) return true;
- return false;
- }
-
- private boolean jj_3R_232() {
- if (jj_scan_token(PRECEDES)) return true;
- return false;
- }
-
- private boolean jj_3R_215() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_238()) jj_scanpos = xsp;
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_231() {
- if (jj_scan_token(PLUS)) return true;
- return false;
- }
-
- private boolean jj_3R_187() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_231()) {
- jj_scanpos = xsp;
- if (jj_3R_232()) return true;
- }
- return false;
- }
-
- private boolean jj_3_8() {
- if (jj_3R_161()) return true;
- return false;
- }
-
- private boolean jj_3R_214() {
- if (jj_scan_token(STRING)) return true;
- return false;
- }
-
- private boolean jj_3R_171() {
- if (jj_scan_token(PRECEDES)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_213() {
- if (jj_3R_237()) return true;
- return false;
- }
-
- private boolean jj_3R_182() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_214()) {
- jj_scanpos = xsp;
- if (jj_3R_215()) {
- jj_scanpos = xsp;
- if (jj_3R_216()) {
- jj_scanpos = xsp;
- if (jj_3R_217()) {
- jj_scanpos = xsp;
- if (jj_3R_218()) return true;
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_172() {
- if (jj_scan_token(S)) return true;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_187()) jj_scanpos = xsp;
- return false;
- }
-
- private boolean jj_3R_170() {
- if (jj_scan_token(PLUS)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_159() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_170()) {
- jj_scanpos = xsp;
- if (jj_3R_171()) {
- jj_scanpos = xsp;
- if (jj_3R_172()) return true;
- }
- }
- return false;
- }
-
- private boolean jj_3_11() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_162()) jj_scanpos = xsp;
- if (jj_3R_163()) return true;
- return false;
- }
-
- private boolean jj_3R_212() {
- if (jj_scan_token(DIMEN)) return true;
- return false;
- }
-
- private boolean jj_3R_211() {
- if (jj_scan_token(KHZ)) return true;
- return false;
- }
-
- private boolean jj_3R_210() {
- if (jj_scan_token(HZ)) return true;
- return false;
- }
-
- private boolean jj_3R_209() {
- if (jj_scan_token(MS)) return true;
- return false;
- }
-
- private boolean jj_3R_177() {
- if (jj_3R_192()) return true;
- return false;
- }
-
- private boolean jj_3R_208() {
- if (jj_scan_token(SECOND)) return true;
- return false;
- }
-
- private boolean jj_3R_176() {
- if (jj_3R_191()) return true;
- return false;
- }
-
- private boolean jj_3R_175() {
- if (jj_3R_190()) return true;
- return false;
- }
-
- private boolean jj_3R_207() {
- if (jj_scan_token(GRAD)) return true;
- return false;
- }
-
- private boolean jj_3R_174() {
- if (jj_3R_189()) return true;
- return false;
- }
-
- private boolean jj_3_9() {
- if (jj_3R_156()) return true;
- return false;
- }
-
- private boolean jj_3R_206() {
- if (jj_scan_token(RAD)) return true;
- return false;
- }
-
- private boolean jj_3R_205() {
- if (jj_scan_token(DEG)) return true;
- return false;
- }
-
- private boolean jj_3R_173() {
- if (jj_3R_188()) return true;
- return false;
- }
-
- private boolean jj_3R_160() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_173()) {
- jj_scanpos = xsp;
- if (jj_3R_174()) {
- jj_scanpos = xsp;
- if (jj_3R_175()) {
- jj_scanpos = xsp;
- if (jj_3R_176()) {
- jj_scanpos = xsp;
- if (jj_3R_177()) return true;
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_189() {
- if (jj_scan_token(HASH)) return true;
- return false;
- }
-
- private boolean jj_3R_204() {
- if (jj_scan_token(EXS)) return true;
- return false;
- }
-
- private boolean jj_3R_203() {
- if (jj_scan_token(EMS)) return true;
- return false;
- }
-
- /** Generated Token Manager. */
- public ParserTokenManager token_source;
- /** Current token. */
- public Token token;
- /** Next token. */
- public Token jj_nt;
- private int jj_ntk;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
- private int jj_gen;
- final private int[] jj_la1 = new int[236];
- static private int[] jj_la1_0;
- static private int[] jj_la1_1;
- static private int[] jj_la1_2;
- static private int[] jj_la1_3;
- static {
- jj_la1_init_0();
- jj_la1_init_1();
- jj_la1_init_2();
- jj_la1_init_3();
- }
- private static void jj_la1_init_0() {
- jj_la1_0 = new int[] {0x0,0xc02,0xc02,0x0,0xc00,0x2,0x2,0x2,0x0,0xe8000000,0xc00,0x2,0xc00,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0xe9f45400,0xe9f45400,0x2,0x400000,0x2,0x2,0x2,0x2,0x0,0x0,0x2,0x0,0x800000,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x800000,0x2,0x0,0x2,0x1f45400,0x2,0x2,0x1100000,0x2,0x1100000,0x1100002,0x2,0x80080002,0x80080002,0x2,0x2,0x2,0x2,0x2,0xe8000000,0x0,0x0,0x0,0xe8000000,0x2,0x400000,0x2,0x2,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000000,0xe8000000,0x0,0x0,0x0,0x0,0x60000000,0x2,0x2,0xfc000,0x2,0x0,0x2,0xfc000,0x0,0x2,0x2,0x0,0x2,0x0,0x2,0x800000,0x27380002,0x2,0xe8000000,0x0,0xe8000000,0x2,0x0,0x2,0x27380002,0x0,0x2,0xe8000000,0x0,0xe8000000,0x2,0x27380002,0x2,0x2,0x2,0x0,0x2,0xe8000000,0x0,0x0,0xe8000000,0x2,0x2,0x400000,0x2,0x2,0x2,0x2,0x0,0x2,0xe8000000,0x0,0x0,0xe8000000,0x2,0x400000,0x2,0x2,0x2,0x400000,0x0,0x0,0x80300000,0x2,0x0,0x400000,0x2,0x80300000,0x2,0x0,0x2,0x0,0x2,0x800000,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x400000,0x2,0x2,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x400000,0x2,0x2,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x400000,0x2,0x2,0x0,0x2,0x2,0x2,0x800000,0x2,0x2,0x0,0x800000,0x2,0x0,0x2,0x2,0x0,0x2,0x0,0x800000,0x2,0x0,0x2,0x80301000,0x2,0x0,0x2,0x2,0x2,0x2,0x4400000,0x4400000,0x300000,0x80300000,0x300000,0x0,0x80000000,0x80000000,0x80300000,0x2,0x2,0x80300000,0x2,0xe8000000,0x2,0x2,0x2,0x0,0x800000,0x2,0x0,0x2,};
- }
- private static void jj_la1_init_1() {
- jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x283000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c0,0x1c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc2,0xc2,0x0,0x0,0x0,0x0,0x0,0xa82000c0,0x0,0x20000000,0x88200000,0xc0,0x0,0x0,0x0,0x0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xc0,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0x0,0x802000c0,0x80200000,0xc0,0x0,0x40000000,0x0,0x3f,0x0,0x0,0x802000c0,0x80200000,0xc0,0x0,0x3f,0x0,0x0,0x0,0x0,0x0,0x802000c0,0x200000,0x80000000,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x882000c0,0x200000,0x88000000,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x40,0x40,0x0,0x40,0x0,0x0,0x40,0x0,0x40,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x60000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
- }
- private static void jj_la1_init_2() {
- jj_la1_2 = new int[] {0x80000000,0x0,0x0,0x20000000,0x0,0x0,0x0,0x0,0x400,0x50000440,0x0,0x0,0x0,0x0,0x220,0x0,0x40,0x0,0x0,0x0,0xf0000ae0,0xf0000ae0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0xe0000aa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0xc0,0x0,0x0,0x0,0x0,0x0,0x50000444,0x44,0x0,0x40000400,0x10000040,0x0,0x0,0x0,0x0,0x10000000,0x10000000,0x0,0x0,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000040,0x40,0x40,0x40,0x40,0x40,0x0,0x0,0x0,0x0,0x60,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x10,0x0,0x0,0x4c0,0x0,0x50000440,0x40000400,0x10000040,0x0,0x0,0x0,0x4c0,0x8,0x0,0x50000440,0x40000400,0x10000040,0x0,0x4c0,0x0,0x0,0x0,0x440,0x0,0x50000440,0x0,0x40000400,0x10000040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x50000440,0x40000000,0x400,0x10000040,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x400,0x1ffffee0,0x0,0x0,0x0,0x0,0x1ffffee0,0x0,0x0,0x0,0x440,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,0x1ffffee0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1ffffee0,0x0,0xffff880,0x0,0x10000260,0x1ffffae0,0x0,0x0,0x1ffffee0,0x0,0x70000040,0x0,0x0,0x0,0x40,0x0,0x0,0x40,0x0,};
- }
- private static void jj_la1_init_3() {
- jj_la1_3 = new int[] {0x0,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x3,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6200f,0x6200f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6200f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x22000,0x0,0x0,0x0,0x0,0x22000,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x22000,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x22000,0x0,0x20000,0x0,0x2000,0x22000,0x0,0x0,0x22000,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
- }
- final private JJCalls[] jj_2_rtns = new JJCalls[15];
- private boolean jj_rescan = false;
- private int jj_gc = 0;
-
- /** Constructor with user supplied CharStream. */
- public Parser(CharStream stream) {
- token_source = new ParserTokenManager(stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 236; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- /** Reinitialise. */
- public void ReInit(CharStream stream) {
- token_source.ReInit(stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 236; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- /** Constructor with generated Token Manager. */
- public Parser(ParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 236; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- /** Reinitialise. */
- public void ReInit(ParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 236; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- if (++jj_gc > 100) {
- jj_gc = 0;
- for (int i = 0; i < jj_2_rtns.length; i++) {
- JJCalls c = jj_2_rtns[i];
- while (c != null) {
- if (c.gen < jj_gen) c.first = null;
- c = c.next;
- }
- }
- }
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
- static private final class LookaheadSuccess extends java.lang.Error { }
- final private LookaheadSuccess jj_ls = new LookaheadSuccess();
- private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- if (jj_rescan) {
- int i = 0; Token tok = token;
- while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
- if (tok != null) jj_add_error_token(kind, i);
- }
- if (jj_scanpos.kind != kind) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
- return false;
- }
-
-
-/** Get the next Token. */
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
-/** Get the specific Token. */
- final public Token getToken(int index) {
- Token t = token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
- private int[] jj_expentry;
- private int jj_kind = -1;
- private int[] jj_lasttokens = new int[100];
- private int jj_endpos;
-
- private void jj_add_error_token(int kind, int pos) {
- if (pos >= 100) return;
- if (pos == jj_endpos + 1) {
- jj_lasttokens[jj_endpos++] = kind;
- } else if (jj_endpos != 0) {
- jj_expentry = new int[jj_endpos];
- for (int i = 0; i < jj_endpos; i++) {
- jj_expentry[i] = jj_lasttokens[i];
- }
- jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
- int[] oldentry = (int[])(it.next());
- if (oldentry.length == jj_expentry.length) {
- for (int i = 0; i < jj_expentry.length; i++) {
- if (oldentry[i] != jj_expentry[i]) {
- continue jj_entries_loop;
- }
- }
- jj_expentries.add(jj_expentry);
- break jj_entries_loop;
- }
- }
- if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
- }
- }
-
- /** Generate ParseException. */
- public ParseException generateParseException() {
- jj_expentries.clear();
- boolean[] la1tokens = new boolean[115];
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 236; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1<<j)) != 0) {
- la1tokens[j] = true;
- }
- if ((jj_la1_1[i] & (1<<j)) != 0) {
- la1tokens[32+j] = true;
- }
- if ((jj_la1_2[i] & (1<<j)) != 0) {
- la1tokens[64+j] = true;
- }
- if ((jj_la1_3[i] & (1<<j)) != 0) {
- la1tokens[96+j] = true;
- }
- }
- }
- }
- for (int i = 0; i < 115; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.add(jj_expentry);
- }
- }
- jj_endpos = 0;
- jj_rescan_token();
- jj_add_error_token(0, 0);
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = jj_expentries.get(i);
- }
- return new ParseException(token, exptokseq, tokenImage);
- }
-
- /** Enable tracing. */
- final public void enable_tracing() {
- }
-
- /** Disable tracing. */
- final public void disable_tracing() {
- }
-
- private void jj_rescan_token() {
- jj_rescan = true;
- for (int i = 0; i < 15; i++) {
- try {
- JJCalls p = jj_2_rtns[i];
- do {
- if (p.gen > jj_gen) {
- jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
- switch (i) {
- case 0: jj_3_1(); break;
- case 1: jj_3_2(); break;
- case 2: jj_3_3(); break;
- case 3: jj_3_4(); break;
- case 4: jj_3_5(); break;
- case 5: jj_3_6(); break;
- case 6: jj_3_7(); break;
- case 7: jj_3_8(); break;
- case 8: jj_3_9(); break;
- case 9: jj_3_10(); break;
- case 10: jj_3_11(); break;
- case 11: jj_3_12(); break;
- case 12: jj_3_13(); break;
- case 13: jj_3_14(); break;
- case 14: jj_3_15(); break;
- }
- }
- p = p.next;
- } while (p != null);
- } catch(LookaheadSuccess ls) { }
- }
- jj_rescan = false;
- }
-
- private void jj_save(int index, int xla) {
- JJCalls p = jj_2_rtns[index];
- while (p.gen > jj_gen) {
- if (p.next == null) { p = p.next = new JJCalls(); break; }
- p = p.next;
- }
- p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
- }
-
- static final class JJCalls {
- int gen;
- Token first;
- int arg;
- JJCalls next;
- }
-
-}
+++ /dev/null
-/* -*-java-extended-*-
- * Copyright (c) 1999 World Wide Web Consortium
- * (Massachusetts Institute of Technology, Institut National de Recherche
- * en Informatique et en Automatique, Keio University).
- * All Rights Reserved. http://www.w3.org/Consortium/Legal/
- *
- * $Id: Parser.jj,v 1.15 2000/10/27 21:09:37 plehegar Exp $
- */
-
-options {
- IGNORE_CASE = true;
- STATIC = false;
- USER_CHAR_STREAM = true;
- /* DEBUG_TOKEN_MANAGER = true;
- DEBUG_PARSER = true; */
-}
-
-PARSER_BEGIN(Parser)
-
-package com.vaadin.sass.parser;
-
-import java.io.*;
-import java.net.*;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.Map;
-
-import org.w3c.css.sac.ConditionFactory;
-import org.w3c.css.sac.Condition;
-import org.w3c.css.sac.SelectorFactory;
-import org.w3c.css.sac.SelectorList;
-import org.w3c.css.sac.Selector;
-import org.w3c.css.sac.SimpleSelector;
-import org.w3c.css.sac.DocumentHandler;
-import org.w3c.css.sac.InputSource;
-import org.w3c.css.sac.ErrorHandler;
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.CSSParseException;
-import org.w3c.css.sac.Locator;
-import org.w3c.css.sac.LexicalUnit;
-
-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.*;
-
-/**
- * A CSS2 parser
- *
- * @author Philippe Le H�garet
- * @version $Revision: 1.15 $
- */
-public class Parser implements org.w3c.css.sac.Parser {
-
- // replaces all \t, \n, etc with this StringBuffer.
- static final StringBuilder SPACE = new StringBuilder(" ");
-
- // the document handler for the parser
- protected SCSSDocumentHandlerImpl documentHandler;
- // the error handler for the parser
- protected ErrorHandler errorHandler;
- // the input source for the parser
- protected InputSource source;
-
- protected ConditionFactory conditionFactory;
- protected SelectorFactory selectorFactory;
-
- // temporary place holder for pseudo-element ...
- private String pseudoElt;
-
- /**
- * Creates a new Parser
- */
- public Parser() {
- this((CharStream) null);
- }
-
- /**
- * @@TODO
- * @exception CSSException Not yet implemented
- */
- public void setLocale(Locale locale) throws CSSException {
- throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
- }
-
- /**
- * Set the document handler for this parser
- */
- public void setDocumentHandler(DocumentHandler handler) {
- this.documentHandler = (SCSSDocumentHandlerImpl) handler;
- }
-
- public void setSelectorFactory(SelectorFactory selectorFactory) {
- this.selectorFactory = selectorFactory;
- }
-
- public void setConditionFactory(ConditionFactory conditionFactory) {
- this.conditionFactory = conditionFactory;
- }
-
- /**
- * Set the error handler for this parser
- */
- public void setErrorHandler(ErrorHandler error) {
- this.errorHandler = error;
- }
-
- /**
- * Main parse methods
- *
- * @param source the source of the style sheet.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseStyleSheet(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
-
- parserUnit();
- }
-
- /**
- * Convenient method for URIs.
- *
- * @param systemId the fully resolved URI of the style sheet.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseStyleSheet(String systemId)
- throws CSSException, IOException {
- parseStyleSheet(new InputSource(systemId));
- }
-
- /**
- * This method parses only one rule (style rule or at-rule, except @charset).
- *
- * @param source the source of the rule.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseRule(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseRule();
- }
-
- /**
- * This method parses a style declaration (including the surrounding curly
- * braces).
- *
- * @param source the source of the style declaration.
- * @exception IOException the source can't be parsed.
- * @exception CSSException the source is not CSS valid.
- */
- public void parseStyleDeclaration(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseDeclarationBlock();
- }
-
- /**
- * This methods returns "http://www.w3.org/TR/REC-CSS2".
- * @return the string "http://www.w3.org/TR/REC-CSS2".
- */
- public String getParserVersion() {
- return "http://www.w3.org/TR/REC-CSS2";
- }
-
- /**
- * Parse methods used by DOM Level 2 implementation.
- */
- public void parseImportRule(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseImportRule();
- }
-
- public void parseMediaRule(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- if (selectorFactory == null) {
- selectorFactory = new SelectorFactoryImpl();
- }
- if (conditionFactory == null) {
- conditionFactory = new ConditionFactoryImpl();
- }
- _parseMediaRule();
- }
-
- public SelectorList parseSelectors(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- return null;
- }
-
- public LexicalUnit parsePropertyValue(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- return expr();
- }
-
- public boolean parsePriority(InputSource source)
- throws CSSException, IOException {
- this.source = source;
- ReInit(getCharStreamWithLurk(source));
-
- return prio();
- }
-
- /**
- * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
- */
- private Reader getReader(InputSource source) throws IOException {
- if (source.getCharacterStream() != null) {
- return source.getCharacterStream();
- } else if (source.getByteStream() != null) {
- // My DOM level 2 implementation doesn't use this case.
- if (source.getEncoding() == null) {
- // unknown encoding, use ASCII as default.
- return new InputStreamReader(source.getByteStream(), "ASCII");
- } else {
- return new InputStreamReader(source.getByteStream(),
- source.getEncoding());
- }
- } else {
- // systemId
- // @@TODO
- throw new CSSException("not yet implemented");
- }
- }
-
- /**
- * Convert the source into a CharStream with encoding informations.
- * The encoding can be found in the InputSource or in the CSS document.
- * Since this method marks the reader and make a reset after looking for
- * the charset declaration, you'll find the charset declaration into the
- * stream.
- */
- private CharStream getCharStreamWithLurk(InputSource source)
- throws CSSException, IOException {
- if (source.getCharacterStream() != null) {
- // all encoding are supposed to be resolved by the user
- // return the reader
- return new Generic_CharStream(source.getCharacterStream(), 1, 1);
- } else if (source.getByteStream() == null) {
- // @@CONTINUE ME. see also getReader() with systemId
- try {
- source.setByteStream(new URL(source.getURI()).openStream());
- } catch (Exception e) {
- try {
- source.setByteStream(new FileInputStream(source.getURI()));
- } catch (IOException ex) {
- throw new CSSException("invalid url ?");
- }
- }
- }
- String encoding = "ASCII";
- InputStream input = source.getByteStream();
- char c = ' ';
-
- if (!input.markSupported()) {
- input = new BufferedInputStream(input);
- source.setByteStream(input);
- }
- input.mark(100);
- c = (char) input.read();
-
- if (c == '@') {
- // hum, is it a charset ?
- int size = 100;
- byte[] buf = new byte[size];
- input.read(buf, 0, 7);
- String keyword = new String(buf, 0, 7);
- if (keyword.equals("charset")) {
- // Yes, this is the charset declaration !
-
- // here I don't use the right declaration : white space are ' '.
- while ((c = (char) input.read()) == ' ') {
- // find the first quote
- }
- char endChar = c;
- int i = 0;
-
- if ((endChar != '"') && (endChar != '\'')) {
- // hum this is not a quote.
- throw new CSSException("invalid charset declaration");
- }
-
- while ((c = (char) input.read()) != endChar) {
- buf[i++] = (byte) c;
- if (i == size) {
- byte[] old = buf;
- buf = new byte[size + 100];
- System.arraycopy(old, 0, buf, 0, size);
- size += 100;
- }
- }
- while ((c = (char) input.read()) == ' ') {
- // find the next relevant character
- }
- if (c != ';') {
- // no semi colon at the end ?
- throw new CSSException("invalid charset declaration: "
- + "missing semi colon");
- }
- encoding = new String(buf, 0, i);
- if (source.getEncoding() != null) {
- // compare the two encoding informations.
- // For example, I don't accept to have ASCII and after UTF-8.
- // Is it really good ? That is the question.
- if (!encoding.equals(source.getEncoding())) {
- throw new CSSException("invalid encoding information.");
- }
- }
- } // else no charset declaration available
- }
- // ok set the real encoding of this source.
- source.setEncoding(encoding);
- // set the real reader of this source.
- source.setCharacterStream(new InputStreamReader(source.getByteStream(),
- Encoding.getJavaEncoding(encoding)));
- // reset the stream (leave the charset declaration in the stream).
- input.reset();
-
- return new Generic_CharStream(source.getCharacterStream(), 1, 1);
- }
-
- private LocatorImpl currentLocator;
- private Locator getLocator() {
- if (currentLocator == null) {
- currentLocator = new LocatorImpl(this);
- return currentLocator;
- }
- return currentLocator.reInit(this);
- }
- private LocatorImpl getLocator(Token save) {
- if (currentLocator == null) {
- currentLocator = new LocatorImpl(this, save);
- return currentLocator;
- }
- return currentLocator.reInit(this, save);
- }
-
- private void reportError(Locator l, Exception e) {
- if (errorHandler != null) {
- if (e instanceof ParseException) {
- // construct a clean error message.
- ParseException pe = (ParseException) e;
- if (pe.specialConstructor) {
- StringBuffer errorM = new StringBuffer();
- if (pe.currentToken != null) {
- errorM.append("encountered \"")
- .append(pe.currentToken.next);
- }
- errorM.append('"');
- if (pe.expectedTokenSequences.length != 0) {
- errorM.append(". Was expecting one of: ");
- for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
- for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
- int kind = pe.expectedTokenSequences[i][j];
- if (kind != S) {
- errorM.append(pe.tokenImage[kind]);
- errorM.append(' ');
- }
- }
- }
- }
- errorHandler.error(new CSSParseException(errorM.toString(),
- l, e));
- } else {
- errorHandler.error(new CSSParseException(e.getMessage(),
- l, e));
- }
- } else if (e == null) {
- errorHandler.error(new CSSParseException("error", l, null));
- } else {
- errorHandler.error(new CSSParseException(e.getMessage(), l, e));
- }
- }
- }
-
- private void reportWarningSkipText(Locator l, String text) {
- if (errorHandler != null && text != null) {
- errorHandler.warning(new CSSParseException("Skipping: " + text, l));
- }
- }
-}
-
-PARSER_END(Parser)
-
-/*
- * The tokenizer
- */
-
-<DEFAULT>
-TOKEN :
-{
- < S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ >
- { image = Parser.SPACE; }
-}
-
-<DEFAULT>
-MORE :
-{
- "//" : IN_SINGLE_LINE_COMMENT
-}
-
-<IN_SINGLE_LINE_COMMENT>
-MORE :
-{
- < ~["\n","\r"] > : IN_SINGLE_LINE_COMMENT
-}
-
-<IN_SINGLE_LINE_COMMENT>
-SKIP :
-{
- < "\n"|"\r"|"\r\n" > : DEFAULT
-}
-
-<DEFAULT>
-MORE :
-{
- <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
-|
- "/*" : IN_MULTI_LINE_COMMENT
-}
-<IN_FORMAL_COMMENT>
-SPECIAL_TOKEN :
-{
- <FORMAL_COMMENT: "*/" > : DEFAULT
-}
-
-<IN_MULTI_LINE_COMMENT>
-SKIP :
-{
- <MULTI_LINE_COMMENT: "*/" > : DEFAULT
-}
-
-<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
-MORE :
-{
- < ~[] >
-}
-
-<DEFAULT>
-TOKEN :
-{
- < CDO : "<!--" >
- | < CDC : "-->" >
- | < LBRACE : "{" >
- | < RBRACE : "}">
- | < DASHMATCH : "|=" >
- | < CARETMATCH : "^=" >
- | < DOLLARMATCH : "$=" >
- | < STARMATCH : "*=" >
- | < INCLUDES : "~=" >
- | < EQ : "=" >
- | < PLUS : "+" >
- | < MINUS : "-" >
- | < COMMA : "," >
- | < SEMICOLON : ";" >
- | < PRECEDES : ">" >
- | < SUCCEEDS : "<" >
- | < DIV : "/" >
- | < LBRACKET : "[" >
- | < RBRACKET : "]" >
- | < ANY : "*" >
- | < PARENT : "&" >
- | < DOT : "." >
- | < LPARAN : "(" >
- | < RPARAN : ")">
- | < COMPARE : "==" >
- | < OR : "||" >
- | < AND : "&&" >
- | < NOT_EQ : "!=" >
-}
-
-<DEFAULT>
-TOKEN :
-{
- < COLON : ":" >
-}
-
-< DEFAULT >
-TOKEN :
-{
- < INTERPOLATION : "#{"< VARIABLE > "}">
-}
-
-<DEFAULT>
-TOKEN : /* basic tokens */
-{
- < NONASCII : ["\200"-"\377"] >
- | < #H : ["0"-"9", "a"-"f"] >
- | < #UNICODE : "\\" <H> ( <H> )? /* I can't say {1,6} */
- ( <H> )? ( <H> )?
- ( <H> )? ( <H> )?
- ( [ " ", "\t" , "\n" , "\r", "\f" ] )? >
- | < #ESCAPE : <UNICODE> | ( "\\" [ " "-"~","\200"-"\377" ] ) >
- | < #NMSTART : ("-")?[ "a"-"z"] | <NONASCII> | <ESCAPE> >
- | < #NMCHAR : ["a"-"z", "0"-"9", "-", "_"] | <NONASCII> | <ESCAPE> >
- | < #STRINGCHAR : [ "\t"," ","!","#","$","%","&","("-"~" ]
- | "\\\n" | "\\\r\n" | "\\\r" | "\\\f"
- | <NONASCII> | <ESCAPE> >
- | < #D : ["0"-"9"] >
- | < #NAME : ( <NMCHAR> )+ >
-
-}
-
-<DEFAULT>
-TOKEN :
-{
- <TO : "to">
- |<THROUGH : "through">
- |<EACH_IN : "in">
-}
-
-/* DERECTIVES */
-<DEFAULT>
-TOKEN :
-{
- <MIXIN_SYM : "@mixin">
- | <INCLUDE_SYM : "@include">
- | <FUNCTION_SYM : "@function">
- | <RETURN_SYM : "@return">
- | <DEBUG_SYM : "@debug">
- | <WARN_SYM : "@warn">
- | <FOR_SYM : "@for">
- | <EACH_SYM : "@each">
- | <WHILE_SYM : "@while">
- | <IF_SYM : "@if">
- | <ELSE_SYM : "@else">
- | <EXTEND_SYM : "@extend">
- | <MOZ_DOCUMENT_SYM : "@-moz-document">
- | <SUPPORTS_SYM : "@supports">
-}
-
-< DEFAULT >
-TOKEN:
-{
- < MICROSOFT_RULE : "filter"|"-ms-filter" >
-}
-
-< DEFAULT >
-TOKEN:
-{
- < IF : "if" >
-}
-
-<DEFAULT>
-TOKEN:
-{
- < GUARDED_SYM : "!" ( <S> )? "default">
-}
-
-<DEFAULT>
-TOKEN :
-{
- < STRING : ( "\"" ( <STRINGCHAR> | "'" )* "\"" ) |
- ( "'" ( <STRINGCHAR> | "\"" )* "'" ) >
- | < IDENT : <NMSTART> ( <NMCHAR> )* >
- | < NUMBER : ( <D> )+ | ( <D> )* "." ( <D> )+ >
- | < #_URL : [ "!","#","$","%","&","*"-"~" ] | <NONASCII> | <ESCAPE> >
- | < URL : "url(" ( <S> )*
- ( <STRING> | ( <_URL> )* ) ( <S> )* ")" >
-}
-
-<DEFAULT>
-TOKEN:
-{
- < VARIABLE : "$" <IDENT>>
-}
-
-<DEFAULT>
-TOKEN :
-{
- < PERCENTAGE : <NUMBER> "%" >
- | < PT : <NUMBER> "pt" >
- | < MM : <NUMBER> "mm" >
- | < CM : <NUMBER> "cm" >
- | < PC : <NUMBER> "pc" >
- | < IN : <NUMBER> "in" >
- | < PX : <NUMBER> "px" >
- | < EMS : <NUMBER> "em" >
- | < EXS : <NUMBER> "ex" >
- | < DEG : <NUMBER> "deg" >
- | < RAD : <NUMBER> "rad" >
- | < GRAD : <NUMBER> "grad" >
- | < MS : <NUMBER> "ms" >
- | < SECOND : <NUMBER> "s" >
- | < HZ : <NUMBER> "Hz" >
- | < KHZ : <NUMBER> "kHz" >
- | < DIMEN : <NUMBER> <IDENT> >
-}
-
-<DEFAULT>
-TOKEN :
-{
- < HASH : "#" <NAME> >
-}
-
-/* RESERVED ATRULE WORDS */
-<DEFAULT>
-TOKEN :
-{
- < IMPORT_SYM : "@import">
- | < MEDIA_SYM : "@media" >
- | < CHARSET_SYM : "@charset" >
- | < PAGE_SYM : "@page" >
- | < FONT_FACE_SYM: "@font-face" >
- | < ATKEYWORD : "@" <IDENT> >
-}
-
-<DEFAULT>
-TOKEN :
-{
- < IMPORTANT_SYM : "!" ( <S> )? "important" >
-}
-
-<DEFAULT>
-TOKEN :
-{
- < #RANGE0 : <H> <H> <H> <H> <H> >
- | < #RANGE1 : <H> <H> <H> <H> <H> ( "?" )? >
- | < #RANGE2 : <H> <H> <H> <H> ( "?" )? ( "?" )? >
- | < #RANGE3 : <H> <H> <H> ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE4 : <H> <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE5 : <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE6 : "?" ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE : <RANGE0> | <RANGE1> | <RANGE2>
- | <RANGE3> | <RANGE4> | <RANGE5> | <RANGE6> >
- | < #UNI : <H> ( <H> )? ( <H> )? ( <H> )? ( <H> )? ( <H> )? >
- | < UNICODERANGE : "U+" <RANGE>
- | "U+" <UNI> "-" <UNI> >
-}
-
-< DEFAULT >
-TOKEN :
-{
- < REMOVE : "remove" (< S >)? "(" >
- | < APPEND : "append" (< S >)? "(" >
- | < CONTAINS : "contains" (< S >)? "(" >
-}
-
-<DEFAULT>
-TOKEN :
-{
- < FUNCTION : <IDENT>(< S >)* "(" >
-}
-
-<DEFAULT, IN_MULTI_LINE_COMMENT>
-TOKEN :
-{ /* avoid token manager error */
- < UNKNOWN : ~[] >
-}
-
-/*
- * The grammar of CSS2
- */
-
-/**
- * The main entry for the parser.
- *
- * @exception ParseException exception during the parse
- */
-void parserUnit() :
-{}
-{
- try {
- { documentHandler.startDocument(source); }
- ( charset() )?
- ( <S> comments()
- | ignoreStatement() )*
- ( importDeclaration() ( ignoreStatement() ( <S> )* )* )*
- afterImportDeclaration()
- <EOF>
- } finally {
- documentHandler.endDocument(source);
- }
-}
-
-void charset() :
-{ Token n; }
-{
- try {
- <CHARSET_SYM> ( <S> )* n=<STRING> ( <S> )* ";"
- } catch (ParseException e) {
- reportError(getLocator(e.currentToken.next), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- } catch (Exception e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- }
-}
-
-void afterImportDeclaration() :
-{String ret;
- Locator l;
-}
-{
- (
- ( (LOOKAHEAD(5)listModifyDirective()|variable()) | ifDirective()|mixinDirective()| eachDirective() | includeDirective() | styleRule() | media()| page() | fontFace()
- | { l = getLocator(); } ret=skipStatement()
- {
- if ((ret == null) || (ret.length() == 0)) {
- return;
- }
- reportWarningSkipText(l, ret);
- if (ret.charAt(0) == '@') {
- documentHandler.ignorableAtRule(ret);
- }
- }
- )
- ( ignoreStatement() ( <S> )* )* )*
-}
-
-void ignoreStatement() :
-{}
-{
- <CDO> | <CDC> | atRuleDeclaration()
-}
-
-/**
- * The import statement
- *
- * @exception ParseException exception during the parse
- */
-void importDeclaration() :
-{Token n;
- String uri;
- MediaListImpl ml = new MediaListImpl();
- boolean isURL = false;
-}
-{
- try {
- <IMPORT_SYM>
- ( <S> )* ( n=<STRING> { uri = convertStringIndex(n.image, 1,
- n.image.length() -1); }
- | n=<URL>
- {
- isURL=true;
- uri = n.image.substring(4, n.image.length()-1).trim();
- if ((uri.charAt(0) == '"')
- || (uri.charAt(0) == '\'')) {
- uri = uri.substring(1, uri.length()-1);
- }
- }
- )
- ( <S> )* ( mediaStatement(ml) )? ";"
- ( <S> )*
- {
- if (ml.getLength() == 0) {
- // see section 6.3 of the CSS2 recommandation.
- ml.addItem("all");
- }
- documentHandler.importStyle(uri, ml, isURL);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-void media() :
-{
- boolean start = false;
- String ret;
- MediaListImpl ml = new MediaListImpl();
-}
-{
- try {
- <MEDIA_SYM> ( <S> )*
- mediaStatement(ml)
- { start = true; documentHandler.startMedia(ml); }
- <LBRACE> ( <S> )* ( styleRule() | skipUnknownRule() )* <RBRACE> ( <S> )*
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- } finally {
- if (start) {
- documentHandler.endMedia(ml);
- }
- }
-}
-
-void mediaStatement(MediaListImpl ml) :
-{
- String m;
-}
-{
- m=medium() ( <COMMA> ( <S> )* { ml.addItem(m); } m=medium() )*
- { ml.addItem(m); }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String medium() : /* tv, projection, screen, ... */
-{Token n;}
-{
- n=<IDENT> ( <S> )* { return convertIdent(n.image); }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-void page() :
-{
- boolean start = false;
- Token n = null;
- String page = null;
- String pseudo = null;
-}
-{
- try {
- <PAGE_SYM> ( <S> )* ( n=<IDENT> ( <S> )* )?
- ( pseudo=pseudo_page() )?
- {
- if (n != null) {
- page = convertIdent(n.image);
- }
- }
- <LBRACE> (<S>)*
- {
- start = true;
- documentHandler.startPage(page, pseudo);
- }
- ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
- <RBRACE> (<S>)*
- } catch (ParseException e) {
- if (errorHandler != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- skipStatement();
- // reportWarningSkipText(li, skipStatement());
- } else {
- skipStatement();
- }
- } finally {
- if (start) {
- documentHandler.endPage(page, pseudo);
- }
- }
-}
-
-String pseudo_page() :
-{ Token n; }
-{
- ":" n=<IDENT> ( <S> )* { return convertIdent(n.image); }
-}
-
-void fontFace() :
-{
- boolean start = false;
-}
-{
- try {
- <FONT_FACE_SYM> ( <S> )*
- <LBRACE> (<S>)*
- { start = true; documentHandler.startFontFace(); }
- ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
- <RBRACE> (<S>)*
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- } finally {
- if (start) {
- documentHandler.endFontFace();
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-void atRuleDeclaration() :
-{Token n;
- String ret;
-}
-{
- n=<ATKEYWORD>
- {
- ret=skipStatement();
- reportWarningSkipText(getLocator(), ret);
- if ((ret != null) && (ret.charAt(0) == '@')) {
- documentHandler.ignorableAtRule(ret);
- }
- }
-}
-
-void skipUnknownRule() :
-{ Token n;}
-{
- ( n=<ATKEYWORD>
-| n=<CDO>
-| n=<CHARSET_SYM>
-| n=<COMMA>
-| n=<DASHMATCH>
-| n=<FONT_FACE_SYM>
-| n=<FUNCTION>
-| n=<IMPORTANT_SYM>
-| n=<IMPORT_SYM>
-| n=<INCLUDES>
-| n=<LBRACE>
-| n=<MEDIA_SYM>
-| n=<NONASCII>
-| n=<NUMBER>
-| n=<PAGE_SYM>
-| n=<PERCENTAGE>
-| n=<STRING>
-| n=<UNICODERANGE>
-| n=<URL>
-| n=";"
-| n="+"
-| n=">"
-| n="-"
-| n=<UNKNOWN>
- ) {
- String ret;
- Locator loc = getLocator();
- ret=skipStatement();
- reportWarningSkipText(loc, ret);
- if ((ret != null) && (n.image.charAt(0) == '@')) {
- documentHandler.ignorableAtRule(ret);
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-char combinator() :
-{
-char connector = ' ';
-}
-{
- "+" ( <S> )* { return '+'; }
- | ">" ( <S> )* { return '>'; }
-| <S> ( ( "+" { connector = '+'; }
- | ">" { connector = '>'; } )
- ( <S> )* )? { return connector; }
-}
-
-void microsoftExtension() :
-{
- Token n;
- String name = "";
- String value = "";
-}
-
-{
- n = < MICROSOFT_RULE > (< S >)* { name = n.image; }
- < COLON >
- ((n = < IDENT > { value += n.image; })
- | (n = < NUMBER > { value += n.image; })
- | (n = < INTERPOLATION > { value += n.image; })
- | (n = < COLON > { value += n.image; })
- | (n = < FUNCTION > { value += n.image; })
- | (n = < RPARAN > { value += n.image; })
- | (n = < EQ > { value += n.image; })
- | (n = < DOT > { value += n.image; })
- | (n = < S > { if(value.lastIndexOf(' ') != value.length()-1)
- { value += n.image; } }
- ) )+
- < SEMICOLON >
- (< S >)*
- { documentHandler.microsoftDirective(name, value); }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String property() :
-{Token n;
-}
-{
- n=<IDENT> ( <S> )* { return convertIdent(n.image); }
-}
-
-String variableName() :
-{Token n;}
-{
- n=<VARIABLE> (<S>)* {return convertIdent(n.image.substring(1));}
-}
-
-String functionName() :
-{Token n;}
-{
- n=<FUNCTION> ( <S> )* {return convertIdent(n.image.substring(0, n.image.length()-1));}
-}
-/**
- * @exception ParseException exception during the parse
- */
-void styleRule() :
-{
- boolean start = false;
- ArrayList<String> l = null;
- Token save;
- Locator loc;
-}
-{
- try {
- l=selectorList() { save = token; } <LBRACE> (<S>)*
- {
- start = true;
- documentHandler.startSelector(l);
- }
- ( ifDirective() | LOOKAHEAD(5)listModifyDirective() | includeDirective() | media() | extendDirective()| eachDirective() | variable() | LOOKAHEAD(3) (microsoftExtension()|declarationOrNestedProperties()) | styleRule())*
- <RBRACE> (<S>)*
- } catch (ThrowedParseException e) {
- if (errorHandler != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.e.currentToken.next.beginLine,
- e.e.currentToken.next.beginColumn-1);
- reportError(li, e.e);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- } catch (TokenMgrError e) {
- reportWarningSkipText(getLocator(), skipStatement());
- } finally {
- if (start) {
- documentHandler.endSelector();
- }
- }
-}
-
- ArrayList<String> selectorList() :
-{
- ArrayList<String> selectors = new ArrayList<String>();
- String selector;
-}
-{
- selector=selector() ( <COMMA> (<S>)* { selectors.add(selector); }
- selector=selector() )*
- { selectors.add(selector);
- return selectors;
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String selector() :
-{
- String selector;
- char comb;
-}
-{
- try {
- selector=simple_selector(null, ' ')
- ( LOOKAHEAD(2) comb=combinator()
- selector=simple_selector(selector, comb) )* (<S>)*
- {
- return selector;
- }
- } catch (ParseException e) {
- /*
- Token t = getToken(1);
- StringBuffer s = new StringBuffer();
- s.append(getToken(0).image);
- while ((t.kind != COMMA) && (t.kind != SEMICOLON)
- && (t.kind != LBRACE) && (t.kind != EOF)) {
- s.append(t.image);
- getNextToken();
- t = getToken(1);
- }
- reportWarningSkipText(getLocator(), s.toString());
- */
- Token t = getToken(1);
- while ((t.kind != COMMA) && (t.kind != SEMICOLON)
- && (t.kind != LBRACE) && (t.kind != EOF)) {
- getNextToken();
- t = getToken(1);
- }
-
- throw new ThrowedParseException(e);
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String simple_selector(String selector, char comb) :
-{
- String simple_current = null;
- String cond = null;
-
- pseudoElt = null;
-}
-{
- ( simple_current=element_name()
- ( cond=hash(cond) | cond=_class(cond)
- | cond=attrib(cond) | cond=pseudo(cond) )*
- | cond=hash(cond) ( cond=_class(cond)
- | cond=attrib(cond) | cond=pseudo(cond) )*
- | cond=_class(cond) ( cond=hash(cond) | cond=_class(cond)
- | cond=attrib(cond) | cond=pseudo(cond) )*
- | cond=pseudo(cond) ( cond=hash(cond) | cond=_class(cond)
- | cond=attrib(cond) | cond=pseudo(cond) )*
- | cond=attrib(cond) ( cond=hash(cond) | cond=_class(cond)
- | cond=attrib(cond) | cond=pseudo(cond) )*
- )
- {
- if (simple_current == null) {
- simple_current = "";
- }
- if (cond != null) {
- simple_current = simple_current + cond;
- }
- if (selector != null) {
- switch (comb) {
- case ' ':
- selector = selector + comb + simple_current;
- break;
- case '+':
- selector = selector + " " + comb + " " + simple_current;
- break;
- case '>':
- selector = selector + " " + comb + " " + simple_current;
- break;
- default:
- throw new ParseException("invalid state. send a bug report");
- }
- } else {
- selector= simple_current;
- }
- if (pseudoElt != null) {
- selector = selector + pseudoElt;
- }
- return selector;
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String _class(String pred) :
-{Token t;
-String s = ".";
-}
-{
- "." (t = <IDENT>{s += t.image; }|t = < INTERPOLATION >{ s += t.image; })+
- {
-
- if (pred == null) {
- return s;
- } else {
- return pred + s;
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String element_name() :
-{Token t; String s = "";}
-{
- (t = <IDENT>{s += t.image; }|t = < INTERPOLATION >{ s += t.image; })+
- {
- return s;
- }
- | "*"
- { return "*"; }
- | "&"
- { return "&"; }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String attrib(String pred) :
-{
- int cases = 0;
- Token att = null;
- Token val = null;
- String attValue = null;
-}
-{
- "[" ( <S> )* att=<IDENT> ( <S> )*
- ( ( "=" { cases = 1; }
- | <INCLUDES> { cases = 2; }
- | <DASHMATCH> { cases = 3; }
- | <CARETMATCH> { cases = 4; }
- | <DOLLARMATCH> { cases = 5; }
- | <STARMATCH> { cases = 6; } ) ( <S> )*
- ( val=<IDENT> { attValue = val.image; }
- | val=<STRING> { attValue = val.image; }
- )
- ( <S> )* )?
- "]"
- {
- String name = convertIdent(att.image);
- String c;
- switch (cases) {
- case 0:
- c = name;
- break;
- case 1:
- c = name + "=" + attValue;
- break;
- case 2:
- c = name + "~=" + attValue;
- break;
- case 3:
- c = name + "|=" +attValue;
- break;
- case 4:
- c = name + "^=" +attValue;
- break;
- case 5:
- c = name + "$=" +attValue;
- break;
- case 6:
- c = name + "*=" +attValue;
- break;
- default:
- // never reached.
- c = null;
- }
- c = "[" + c + "]";
- if (pred == null) {
- return c;
- } else {
- return pred + c;
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String pseudo(String pred) :
-{Token n;
-Token language;
-boolean isPseudoElement = false;
-}
-{
- ":" (":"{isPseudoElement=true;})?( n=<IDENT>
- {
- String s = ":" + convertIdent(n.image);
- if (isPseudoElement) {
- if (pseudoElt != null) {
- throw new CSSParseException("duplicate pseudo element definition "
- + s, getLocator());
- } else {
- pseudoElt = ":"+s;
- return pred;
- }
- } else {
- String c = s;
- if (pred == null) {
- return c;
- } else {
- return pred + c;
- }
- }
- }
- | ( n=<FUNCTION> ( <S> )* language=<IDENT> ( <S> )* ")"
- {
- String f = convertIdent(n.image);
- if (f.equals("lang(")) {
- String d = convertIdent(language.image);
- if (pred == null) {
- return d;
- } else {
- return pred + d;
- }
- } else {
- throw new CSSParseException("invalid pseudo function name "
- + f, getLocator());
- }
- }
- )
- )
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String hash(String pred) :
-{Token n; }
-{
- n=<HASH>
- {
- String d = n.image;
- if (pred == null) {
- return d;
- } else {
- return pred + d;
- }
- }
-}
-
-void variable() :
-{
- String name;
- LexicalUnitImpl exp = null;
- boolean guarded = false;
- String raw;
-}
-{
- try{
- name = variableName()
- ":" ( <S> )* exp=expr() ( guarded=guarded() )?(";"(<S>)*)+
- //raw=skipStatementUntilSemiColon()
- {
- documentHandler.variable(name, exp, guarded);
- }
- }catch (JumpException e) {
- skipAfterExpression();
- } catch (NumberFormatException e) {
- if (errorHandler != null) {
- errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(),
- getLocator(),
- e));
- }
- reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
- if (errorHandler != null) {
- if (e.currentToken != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- } else {
- reportError(getLocator(), e);
- }
- skipAfterExpression();
- } else {
- skipAfterExpression();
- }
- }
-}
-
-void ifDirective() :
-{
- Token n = null;
- String evaluator = "";
-}
-{
- < IF_SYM >
- ( n = booleanExpressionToken() { evaluator += n.image; } )+
- < LBRACE >(< S >)*
- { documentHandler.startIfElseDirective();
- documentHandler.ifDirective(evaluator);
- }
- ( includeDirective() | media() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
- < RBRACE >(< S >)*
- (elseDirective())*
- { documentHandler.endIfElseDirective(); }
-}
-
-void elseDirective() :
-{
- String evaluator = "";
- Token n = null;
-}
-{
- < ELSE_SYM >(< S >)*
- ( < IF > (n = booleanExpressionToken() { if(n != null) evaluator += n.image; })*)?
- < LBRACE >(< S >)*
- { if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); }
- else{ documentHandler.elseDirective(); }
- }
- ( includeDirective() | media() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
- < RBRACE >(< S >)*
-}
-
-Token booleanExpressionToken() :
-{
- Token n = null;
-}
-{
- (
- n = < VARIABLE >
- |n = < IDENT >
- |n = < NUMBER >
- |n = < LPARAN >
- |n = < RPARAN >
- |n = < PLUS >
- |n = < MINUS >
- |n = < DIV >
- |n = < ANY >
- |n = < COMPARE >
- |n = < EQ >
- |n = < PRECEDES >
- |n = < SUCCEEDS >
- |n = < OR >
- |n = < AND >
- |n = < S >
- |n = < NOT_EQ >
-){
- return n;
- }
-}
-
-void eachDirective() :
-{
- Token var;
- ArrayList<String> list = null;
- String listVariable = null;
-}
-{
- < EACH_SYM >
- (< S >)*
- var = < VARIABLE > (< S >)* < EACH_IN > (< S >)*
- (list = stringList()
- {documentHandler.startEachDirective(var.image, list);}
- |listVariable = variableName()
- {documentHandler.startEachDirective(var.image, listVariable);}
- )
- < LBRACE >(< S >)*
- ( includeDirective() | LOOKAHEAD(5)listModifyDirective() | media() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
- < RBRACE >(< S >)*
- { documentHandler.endEachDirective();}
-}
-
-ArrayList<String > stringList():
-{
- ArrayList<String > strings = new ArrayList<String >();
- Token input;
-}
-{
- (input = < IDENT > (< S >)*)
- { strings.add(input.image); }
-
- (< COMMA >(< S >)* input = < IDENT > { strings.add(input.image); } (< S >)*)*
- { return strings; }
-
-}
-
-void mixinDirective() :
-{
- String name;
- ArrayList<VariableNode> args = null;
- String body;
-}
-{
- <MIXIN_SYM>
- (<S>)*
- (name = property()
- |(name = functionName()
- args = arglist()) <RPARAN> (<S>)*) <LBRACE> (<S>)*
- {documentHandler.startMixinDirective(name, args);}
- ( includeDirective() | media() | LOOKAHEAD(5)listModifyDirective()|eachDirective() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
- <RBRACE>(<S>)*
- {documentHandler.endMixinDirective(name, args);}
-}
-
-ArrayList<VariableNode> arglist() :
-{
- ArrayList<VariableNode> args = new ArrayList<VariableNode>();
- VariableNode arg;
- boolean hasNonOptionalArgument = false;
-}
-{
- arg=mixinArg() ( <COMMA> (<S>)* { hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg); }
- arg=mixinArg() )*
- { hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
- return args;
- }
-}
-
-JAVACODE
-boolean checkMixinForNonOptionalArguments(VariableNode arg, boolean hasNonOptionalArguments)\r{
- boolean currentArgHasArguments = arg.getExpr() != null && arg.getExpr().getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE && arg.getExpr().getNextLexicalUnit() != null;
- \r if(currentArgHasArguments)\r {
- if(hasNonOptionalArguments)\r {\r throw new ParseException("Sass Error: Required argument $"+ arg.getName() +" must come before any optional arguments.");
- }
- return hasNonOptionalArguments;
- }else\r {\r return true;
- }
-}
-
-VariableNode mixinArg() :
-{
- String name;
- Token variable = null;
- LexicalUnitImpl first = null;
- LexicalUnitImpl prev = null;
- LexicalUnitImpl next = null;
-}
-{
- name=variableName() (< COLON > (< S >)*
-
- (\r first = nonVariableTerm(null)\r {
- prev = first;\r }
- (LOOKAHEAD(3)(< COMMA >(< S >)*)? prev = nonVariableTerm(prev))*\r )
- | (variable = < VARIABLE >{ first = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
- prev, variable.image);}
-
- )
- )?
- {
- VariableNode arg = new VariableNode(name, first, false);
- return arg;
- }
-}
-
-ArrayList<LexicalUnitImpl> argValuelist() :
-{
- ArrayList<LexicalUnitImpl> args = new ArrayList<LexicalUnitImpl>();
- LexicalUnitImpl first = null;
- LexicalUnitImpl next = null;
- LexicalUnitImpl prev = null;
-}
-{
- first = term(null) { args.add(first); prev = first;}((< COLON > (< S >)*)?next=term(prev){prev.setNextLexicalUnit(next); prev = next;})*
- ( <COMMA> (<S>)*
- first = term(null) { args.add(first); prev = first;}((< COLON > (< S >)*)?next=term(prev){prev.setNextLexicalUnit(next); prev = next;})*
- )*
- {return args;}
-}
-
-void includeDirective() :
-{
- String name;
- ArrayList<LexicalUnitImpl> args=null;
-}
-{
- <INCLUDE_SYM>
- (<S>)*
- (name = property()|name = variableName(){ name = "$"+name;}|name = interpolation()
- |(name = functionName()
- args = argValuelist()) <RPARAN>)(";"(<S>)*)+
- {documentHandler.includeDirective(name, args);}
-}
-
-String interpolation() :
-{
- Token n;\r}\r{
- n = < INTERPOLATION >
- {
- return n.image;\r }\r}
-
-void listModifyDirective() :\r{
-}
-{
-LOOKAHEAD(5)removeDirective()|LOOKAHEAD(5)appendDirective()|LOOKAHEAD(5)containsDirective()
-}
-
-
-/**
- * @exception ParseException exception during the parse
- */
-void appendDirective() :
-{
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
-}
-{
- n = < VARIABLE >{ variable = n.image; }(< S >)* ":" (< S >)*
- < APPEND >(< S >)*
- (list = listModifyDirectiveArgs(0))
- (< RPARAN >)? < COMMA >(< S >)*
- (remove = listModifyDirectiveArgs(1))
- ( < COMMA >(< S >)* n = < IDENT >{ separator = n.image; } (< S >)*)?
- < RPARAN >(< S >)* < SEMICOLON >(< S >)*
-
- { documentHandler.appendDirective(variable,list,remove,separator); }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-void removeDirective() :\r{\r String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
-}
-{
- n = < VARIABLE >{ variable = n.image; }(< S >)* ":" (< S >)*
- < REMOVE >(< S >)*
- (list = listModifyDirectiveArgs(0))
- (< RPARAN >)? < COMMA >(< S >)*
- (remove = listModifyDirectiveArgs(1))
- ( < COMMA >(< S >)* n = < IDENT >{ separator = n.image; } (< S >)*)?
- < RPARAN >(< S >)* < SEMICOLON >(< S >)*
-
- { documentHandler.removeDirective(variable,list,remove,separator); }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-void containsDirective() :
-{
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
-}
-{
- n = < VARIABLE >{ variable = n.image; }(< S >)* ":" (< S >)*
- < CONTAINS >(< S >)*
- (list = listModifyDirectiveArgs(0))
- (< RPARAN >)? < COMMA >(< S >)*
- (remove = listModifyDirectiveArgs(1))
- ( < COMMA >(< S >)* n = < IDENT >{ separator = n.image; } (< S >)*)?
- < RPARAN >(< S >)* < SEMICOLON >(< S >)*
-
- { documentHandler.containsDirective(variable,list,remove,separator); }
-}
-
-JAVACODE
-String listModifyDirectiveArgs(int nest)\r{
- String list = "";
- int nesting = nest;
- Token t = null;
-
- while(true)\r {\r t = getToken(1);
- String s = t.image;
- if(t.kind == VARIABLE||t.kind == IDENT)\r {
- list += s;
- }else if(s.toLowerCase().equals("auto")||s.toLowerCase().equals("space")||s.toLowerCase().equals("comma"))\r {
- int i = 2;
- Token temp = getToken(i);
- boolean isLast = true;
- while(temp.kind != SEMICOLON)
- {\r if(temp.kind != RPARAN || temp.kind != S)
- {\r isLast = false;\r }
- i++;
- temp = getToken(i);
- }
-
- if(isLast)\r {\r return list;
- }
- }\r else if(t.kind == STRING)\r {\r list += s.substring(1,s.length()).substring(0,s.length()-2);
-
- }else if(t.kind == LPARAN)\r {\r nesting++;
- if(nesting > nest+1)\r {\r throw new CSSParseException("Only one ( ) pair per parameter allowed", getLocator());
- }
- }else if(t.kind == RPARAN)\r {\r nesting--;
- if(nesting == 0)\r {
- return list;
- }
- } else if(t.kind == COMMA)\r {
- if(nesting == nest)\r {
- return list;\r }else\r {
- list += ",";\r }
-
- }else if(t.kind == S)\r {
- list += " ";\r } else if(t.kind == LBRACE)\r {
- throw new CSSParseException("Invalid token,'{' found", getLocator());\r }
- \r getNextToken();
- }
-}
-
-Node returnDirective() :
-{
- String raw;
-}
-{
- raw = skipStatement()
- {return null;}
-}
-
-JAVACODE
-void debugDirective(){
-}
-
-JAVACODE
-void warnDirective(){
-}
-
-Node forDirective() :
-{
- String var;
- String from;
- String to;
- boolean exclusive;
- String body;
- Token tok;
-}
-{
- var = variableName()
- {
- int[] toThrough = {TO, THROUGH};
- from = skipStatementUntil(toThrough);
- }
- (tok = <TO> {exclusive = true;}
- | tok = <THROUGH> {exclusive = false;})
- to = skipStatementUntilLeftBrace()
- (<S>)*
- body = skipStatement()
- {return documentHandler.forDirective(var, from, to, exclusive, body);}
-}
-
-Node whileDirective() :
-{
- String condition;
- String body;
-}
-{
- condition = skipStatementUntilLeftBrace()
- body = skipStatement()
- { return documentHandler.whileDirective(condition, body);}
-}
-
-void extendDirective() :
-{ArrayList<String> list;}
-{
- <EXTEND_SYM>
- (<S>)*
- list = selectorList()
- (";"(<S>)*)+
- {documentHandler.extendDirective(list);}
-}
-
-JAVACODE
-Node importDirective(){
- return null;
-}
-
-JAVACODE
-Node charsetDirective(){
- return null;
-}
-
-JAVACODE
-Node mozDocumentDirective(){
- return null;
-}
-
-JAVACODE
-Node supportsDirective(){
- return null;
-}
-
-
-void nestedProperties():
-{String name;
-LexicalUnit exp;}
-{
- name=property()
- ":" ( <S> )*
- <LBRACE> (<S>)*
- {
- documentHandler.startNestedProperties(name);
- }
- ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
- <RBRACE>
- {
- documentHandler.endNestedProperties(name);
- }
- (<S>)*
-}
-/**
- * @exception ParseException exception during the parse
- */
-void declarationOrNestedProperties() :
-{ boolean important = false;
- String name;
- LexicalUnitImpl exp;
- Token save;
- String comment = null;
-}
-{
- try {
- name=property()
- { save = token; }
- ":" ( <S> )*
- (exp=expr() ( important=prio() )?
- {
- Token next = getToken(1);
- if(next.kind == SEMICOLON || next.kind == RBRACE){
- while(next.kind == SEMICOLON){
- skipStatement();
- next = getToken(1);
- }
- if(token.specialToken!=null){
- documentHandler.property(name, exp, important, token.specialToken.image);
- }else{
- documentHandler.property(name, exp, important, null);
- }
- }
- }
- |<LBRACE> (<S>)*
- {
- documentHandler.startNestedProperties(name);
- }
- ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
- <RBRACE>(<S>)*
- {
- documentHandler.endNestedProperties(name);
- }
- )
-
- } catch (JumpException e) {
- skipAfterExpression();
- // reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (NumberFormatException e) {
- if (errorHandler != null) {
- errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(),
- getLocator(),
- e));
- }
- reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
- if (errorHandler != null) {
- if (e.currentToken != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- } else {
- reportError(getLocator(), e);
- }
- skipAfterExpression();
- /*
- LocatorImpl loc = (LocatorImpl) getLocator();
- loc.column--;
- reportWarningSkipText(loc, skipAfterExpression());
- */
- } else {
- skipAfterExpression();
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-void declaration() :
-{ boolean important = false;
- String name;
- LexicalUnit exp;
- Token save;
-}
-{
- try {
- name=property()
- { save = token; }
- ":" ( <S> )* exp=expr() ( important=prio() )?
- {
- documentHandler.property(name, exp, important);
- }
- } catch (JumpException e) {
- skipAfterExpression();
- // reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (NumberFormatException e) {
- if (errorHandler != null) {
- errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(),
- getLocator(),
- e));
- }
- reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
- if (errorHandler != null) {
- if (e.currentToken != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn-1);
- reportError(li, e);
- } else {
- reportError(getLocator(), e);
- }
- skipAfterExpression();
- /*
- LocatorImpl loc = (LocatorImpl) getLocator();
- loc.column--;
- reportWarningSkipText(loc, skipAfterExpression());
- */
- } else {
- skipAfterExpression();
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-boolean prio() :
-{}
-{
- <IMPORTANT_SYM> ( <S> )* { return true; }
-}
-
-boolean guarded() :
-{}
-{
- <GUARDED_SYM> (<S>)* {return true;}
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-LexicalUnitImpl operator(LexicalUnitImpl prev) :
-{Token n;}
-{
-n="/" ( <S> )* { return LexicalUnitImpl.createSlash(n.beginLine,
- n.beginColumn,
- prev); }
-| n="," ( <S> )* { return LexicalUnitImpl.createComma(n.beginLine,
- n.beginColumn,
- prev); }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-LexicalUnitImpl expr() :
-{
- LexicalUnitImpl first, res;
- char op;
-}
-{
- first=term(null){ res = first; }
- ( LOOKAHEAD(2) ( res=operator(res) )? res=term(res))*
- { return first; }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-char unaryOperator() :
-{}
-{
- "-" { return '-'; }
-| "+" { return '+'; }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-LexicalUnitImpl term(LexicalUnitImpl prev) :
-{ LexicalUnitImpl result = null;
- Token n = null;
- char op = ' ';
-}
-{
- (result = nonVariableTerm(prev)| result = variableTerm(prev))
- {
- return result;
- }
-}
-
-LexicalUnitImpl variableTerm(LexicalUnitImpl prev) :\r{
- LexicalUnitImpl result = null;
- String varName = "";\r}\r{
- varName = variableName()
- {result = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
- prev, varName); return result;}\r}
-
-LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev) :\r{\rLexicalUnitImpl result = null;
- Token n = null;
- char op = ' ';
- String varName;
- String s = "";
-}
-{
-( ( ( op=unaryOperator() )?
- (
- n=<NUMBER>
- { result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
- prev, number(op, n, 0)); }
- | n=<PERCENTAGE>
- { result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
- prev, number(op, n, 1)); }
- | n=<PT>
- { result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<CM>
- { result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<MM>
- { result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<PC>
- { result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<IN>
- { result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<PX>
- { result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<EMS>
- { result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<EXS>
- { result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<DEG>
- { result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
- prev, number(op, n, 3)); }
- | n=<RAD>
- { result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
- prev, number(op, n, 3)); }
- | n=<GRAD>
- { result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
- prev, number(op, n, 3)); }
- | n=<SECOND>
- { result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
- prev, number(op, n, 1)); }
- | n=<MS>
- { result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<HZ>
- { result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
- prev, number(op, n, 2)); }
- | n=<KHZ>
- { result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
- prev, number(op, n, 3)); }
- | n=<DIMEN>
- {
- s = n.image;
- int i = 0;
- while (i < s.length()
- && (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=function(op, prev) ) )
- | ( n=<STRING>
- { result =
- LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
- convertStringIndex(n.image, 1,
- n.image.length() -1));}
- | (< DOT >{ s+="."; })?n=<IDENT>
- { s += convertIdent(n.image);
- if ("inherit".equals(s)) {
- result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
- prev);
- } else {
- result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- prev, convertIdent(n.image));
- }
-
- /* /
- Auto correction code used in the CSS Validator but must not
- be used by a conformant CSS2 parser.
- * Common error :
- * H1 {
- * color : black
- * background : white
- * }
- *
- Token t = getToken(1);
- Token semicolon = new Token();
- semicolon.kind = SEMICOLON;
- semicolon.image = ";";
- if (t.kind == COLON) {
- // @@SEEME. (generate a warning?)
- // @@SEEME if expression is a single ident,
- generate an error ?
- rejectToken(semicolon);
-
- result = prev;
- }
- / */
- }
- | result=hexcolor(prev)
- | result=url(prev)
- | result=unicode(prev)
- ) ) ( <S> )*
- {
- return result;\r }\r}
-
-/**
- * Handle all CSS2 functions.
- * @exception ParseException exception during the parse
- */
-LexicalUnitImpl function(char operator, LexicalUnitImpl prev) :
-{Token n;
- LexicalUnit params = null;
-}
-{
- n=<FUNCTION> ( <S> )*
- {
- String fname = convertIdent(n.image);
- if("alpha(".equals(fname)){
- String body = skipStatementUntilSemiColon();
- return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- null, "alpha("+body);
- }
- }
- ( params=expr() )? ")"
- {
- if (operator != ' ') {
- throw new CSSParseException("invalid operator before a function.",
- getLocator());
- }
- String f = convertIdent(n.image);
- LexicalUnitImpl l = (LexicalUnitImpl) params;
- boolean loop = true;
- if ("rgb(".equals(f)) {
- // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
- int i = 0;
- while (loop && l != null && i < 5) {
- switch (i) {
- case 0:
- case 2:
- case 4:
- if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
- && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
- loop = false;
- }
- break;
- case 1:
- case 3:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- throw new ParseException("implementation error");
- }
- if (loop) {
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- }
- if ((i == 5) && loop && (l == null)) {
- return LexicalUnitImpl.createRGBColor(n.beginLine,
- n.beginColumn,
- prev, params);
- } else {
- if (errorHandler != null) {
- String errorText;
- Locator loc;
- if (i < 5) {
- if (params == null) {
- loc = new LocatorImpl(this, n.beginLine,
- n.beginColumn-1);
- errorText = "not enough parameters.";
- } else if (l == null) {
- loc = new LocatorImpl(this, n.beginLine,
- n.beginColumn-1);
- errorText = "not enough parameters: "
- + params.toString();
- } else {
- loc = new LocatorImpl(this, l.getLineNumber(),
- l.getColumnNumber());
- errorText = "invalid parameter: "
- + l.toString();
- }
- } else {
- loc = new LocatorImpl(this, l.getLineNumber(),
- l.getColumnNumber());
- errorText = "too many parameters: "
- + l.toString();
- }
- errorHandler.error(new CSSParseException(errorText, loc));
- }
-
- throw new JumpException();
- }
- } else if ("counter".equals(f)) {
- int i = 0;
- while (loop && l != null && i < 3) {
- switch (i) {
- case 0:
- case 2:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
- loop = false;
- }
- break;
- case 1:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- throw new ParseException("implementation error");
- }
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- if (((i == 1) || (i == 3)) && loop && (l == null)) {
- return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
- prev, params);
- }
-
- } else if ("counters(".equals(f)) {
-
- int i = 0;
- while (loop && l != null && i < 5) {
- switch (i) {
- case 0:
- case 4:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
- loop = false;
- }
- break;
- case 2:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
- loop = false;
- }
- break;
- case 1:
- case 3:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- throw new ParseException("implementation error");
- }
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- if (((i == 3) || (i == 5)) && loop && (l == null)) {
- return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
- prev, params);
- }
- } else if ("attr(".equals(f)) {
- if ((l != null)
- && (l.getNextLexicalUnit() == null)
- && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
- return LexicalUnitImpl.createAttr(l.getLineNumber(),
- l.getColumnNumber(),
- prev, l.getStringValue());
- }
- } else if ("rect(".equals(f)) {
- int i = 0;
- while (loop && l != null && i < 7) {
- switch (i) {
- case 0:
- case 2:
- case 4:
- case 6:
- switch (l.getLexicalUnitType()) {
- case LexicalUnit.SAC_INTEGER:
- if (l.getIntegerValue() != 0) {
- loop = false;
- }
- break;
- case LexicalUnit.SAC_IDENT:
- if (!l.getStringValue().equals("auto")) {
- loop = false;
- }
- break;
- case LexicalUnit.SAC_EM:
- case LexicalUnit.SAC_EX:
- case LexicalUnit.SAC_PIXEL:
- case LexicalUnit.SAC_CENTIMETER:
- case LexicalUnit.SAC_MILLIMETER:
- case LexicalUnit.SAC_INCH:
- case LexicalUnit.SAC_POINT:
- case LexicalUnit.SAC_PICA:
- // nothing
- break;
- default:
- loop = false;
- }
- break;
- case 1:
- case 3:
- case 5:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default:
- throw new ParseException("implementation error");
- }
- l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i ++;
- }
- if ((i == 7) && loop && (l == null)) {
- return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
- prev, params);
- }
- }
- return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
- f.substring(0,
- f.length() -1),
- params);
- }
-}
-
-LexicalUnitImpl unicode(LexicalUnitImpl prev) :
-{ Token n;
-}
-{
- n=<UNICODERANGE>
- {
- LexicalUnitImpl params = null;
- String s = n.image.substring(2);
- int index = s.indexOf('-');
- if (index == -1) {
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s, 16));
- } else {
- String s1 = s.substring(0, index);
- String s2 = s.substring(index);
-
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s1, 16));
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s2, 16));
- }
-
- return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
- prev, params);
- }
-}
-
-LexicalUnitImpl url(LexicalUnitImpl prev) :
-{ Token n;
-}
-{
- n=<URL>
- {
- String urlname = n.image.substring(4, n.image.length()-1).trim();
- return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname);
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-LexicalUnitImpl hexcolor(LexicalUnitImpl prev) :
-{Token n;
-}
-{
- n=<HASH>
- {
- int r;
- LexicalUnitImpl first, params = null;
- String s = n.image.substring(1);
-
- if(s.length()!=3 && s.length()!=6) {
- first = null;
- throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
- getLocator());
- }
- return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- prev, n.image);
- }
-}
-
-JAVACODE
-float number(char operator, Token n, int lengthUnit) {
- String image = n.image;
- float f = 0;
-
- if (lengthUnit != 0) {
- image = image.substring(0, image.length() - lengthUnit);
- }
- f = Float.valueOf(image).floatValue();
- return (operator == '-')? -f: f;
-}
-
-JAVACODE
-String skipStatementUntilSemiColon(){
- int[] semicolon = {SEMICOLON};
- return skipStatementUntil(semicolon);
-}
-
-JAVACODE
-String skipStatementUntilLeftBrace(){
- int[] lBrace = {LBRACE};
- return skipStatementUntil(lBrace);
-}
-
-JAVACODE
-String skipStatementUntilRightParan(){
- int[] rParan = {RPARAN};
- return skipStatementUntil(rParan);
-}
-
-JAVACODE
-String skipStatementUntil(int[] symbols){
- StringBuffer s = new StringBuffer();
- boolean stop = false;
- Token tok;
- while(!stop){
- tok = getToken(1);
- if(tok.kind == EOF) {
- return null;
- }
- for(int sym : symbols){
- if(tok.kind == sym){
- stop = true;
- break;
- }
- }
- if(!stop){
- if (tok.image != null) {
- s.append(tok.image);
- }
- getNextToken();
- }
- }
- return s.toString().trim();
-}
-
-
-JAVACODE
-String skipStatement() {
- StringBuffer s = new StringBuffer();
- Token tok = getToken(0);
- if (tok.image != null) {
- s.append(tok.image);
- }
- while (true) {
- tok = getToken(1);
- if (tok.kind == EOF) {
- return null;
- }
- s.append(tok.image);
- if (tok.kind == LBRACE) {
- getNextToken();
- s.append(skip_to_matching_brace());
- getNextToken();
- tok = getToken(1);
- break;
- } else if (tok.kind == RBRACE) {
- getNextToken();
- tok = getToken(1);
- break;
- } else if (tok.kind == SEMICOLON) {
- getNextToken();
- tok = getToken(1);
- break;
- }
- getNextToken();
- }
-
- // skip white space
- while (true) {
- if (tok.kind != S) {
- break;
- }
- tok = getNextToken();
- tok = getToken(1);
- }
-
- return s.toString().trim();
-}
-
-JAVACODE
-String skip_to_matching_brace() {
- StringBuffer s = new StringBuffer();
- Token tok;
- int nesting = 1;
- while (true) {
- tok = getToken(1);
- if (tok.kind == EOF) {
- break;
- }
- s.append(tok.image);
- if (tok.kind == LBRACE) {
- nesting++;
- } else if (tok.kind == RBRACE) {
- nesting--;
- if (nesting == 0) {
- break;
- }
- }
- getNextToken();
- }
- return s.toString();
-}
-
-/*
- * Here I handle all CSS2 unicode character stuffs.
- * I convert all \XXXXXX character into a single character.
- * Don't forget that the parser has recognize the token before.
- * (So IDENT won't contain newline and stuffs like this).
- */
-JAVACODE
-String convertStringIndex(String s, int start, int len) {
- StringBuffer buf = new StringBuffer(len);
- int index = start;
-
- while (index < len) {
- char c = s.charAt(index);
- if (c == '\\') {
- if (++index < len) {
- c = s.charAt(index);
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- int numValue = Character.digit(c, 16);
- int count = 0;
- int p = 16;
-
- while (index + 1 < len && count < 6) {
- c = s.charAt(index+1);
-
- if (Character.digit(c, 16) != -1) {
- numValue = (numValue * 16) + Character.digit(c, 16);
- p *= 16;
- index++;
- } else {
- if (c == ' ') {
- // skip the latest white space
- index++;
- }
- break;
- }
- }
- buf.append((char) numValue);
- break;
- case '\n':
- case '\f':
- break;
- case '\r':
- if (index + 1 < len) {
- if (s.charAt(index + 1) == '\n') {
- index ++;
- }
- }
- break;
- default:
- buf.append(c);
- }
- } else {
- throw new CSSParseException("invalid string " + s, getLocator());
- }
- } else {
- buf.append(c);
- }
- index++;
- }
-
- return buf.toString();
-}
-
-JAVACODE
-String convertIdent(String s) {
- return convertStringIndex(s, 0, s.length());
-}
-
-JAVACODE
-String convertString(String s) {
- return convertStringIndex(s, 0, s.length());
-}
-
-JAVACODE
-void comments(){
- 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;
- }
- }
-}
-
-/*
- * @@HACK
- * I can't insert a token into the tokens flow.
- * It's jj_consume_token implementation dependant! :-(
- */
-JAVACODE
-void rejectToken(Token t) {
- Token fakeToken = new Token();
- t.next = token;
- fakeToken.next = t;
- token = fakeToken;
-}
-
-/**
- * skip after an expression
- */
-JAVACODE
-String skipAfterExpression() {
- Token t = getToken(1);
- StringBuffer s = new StringBuffer();
- s.append(getToken(0).image);
-
- while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
- s.append(t.image);
- getNextToken();
- t = getToken(1);
- }
-
- return s.toString();
-}
-
-/**
- * The following functions are useful for a DOM CSS implementation only and are
- * not part of the general CSS2 parser.
- */
-
-void _parseRule() :
-{String ret = null;
-}
-{
- ( <S> )*
- ( importDeclaration() | styleRule() | media() | page()
- | fontFace() | ret=skipStatement()
- {
- if ((ret == null) || (ret.length() == 0)) {
- return;
- }
- if (ret.charAt(0) == '@') {
- documentHandler.ignorableAtRule(ret);
- } else {
- throw new CSSParseException("unrecognize rule: " + ret,
- getLocator());
- }
- }
- )
-}
-
-void _parseImportRule() :
-{
-}
-{
- ( <S> )* importDeclaration()
-}
-
-void _parseMediaRule() :
-{
-}
-{
- ( <S> )* media()
-}
-
-void _parseDeclarationBlock() :
-{
-}
-{
- ( <S> )*
- ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
- }
-
-ArrayList<String> _parseSelectors() :
-{ ArrayList<String> p = null;
-}
-{
- try {
- ( <S> )* p = selectorList()
- { return p; }
- } catch (ThrowedParseException e) {
- throw (ParseException) e.e.fillInStackTrace();
- }
-}
-
-/*
- * Local Variables:
- * compile-command: javacc Parser.jj & javac Parser.java
- * End:
- */
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */
-package com.vaadin.sass.parser;
-
-
-/**
- * Token literal values and constants.
- * Generated by org.javacc.parser.OtherFilesGen#start()
- */
-public interface ParserConstants {
-
- /** End of File. */
- int EOF = 0;
- /** RegularExpression Id. */
- int S = 1;
- /** RegularExpression Id. */
- int FORMAL_COMMENT = 7;
- /** RegularExpression Id. */
- int MULTI_LINE_COMMENT = 8;
- /** RegularExpression Id. */
- int CDO = 10;
- /** RegularExpression Id. */
- int CDC = 11;
- /** RegularExpression Id. */
- int LBRACE = 12;
- /** RegularExpression Id. */
- int RBRACE = 13;
- /** RegularExpression Id. */
- int DASHMATCH = 14;
- /** RegularExpression Id. */
- int CARETMATCH = 15;
- /** RegularExpression Id. */
- int DOLLARMATCH = 16;
- /** RegularExpression Id. */
- int STARMATCH = 17;
- /** RegularExpression Id. */
- int INCLUDES = 18;
- /** RegularExpression Id. */
- int EQ = 19;
- /** RegularExpression Id. */
- int PLUS = 20;
- /** RegularExpression Id. */
- int MINUS = 21;
- /** RegularExpression Id. */
- int COMMA = 22;
- /** RegularExpression Id. */
- int SEMICOLON = 23;
- /** RegularExpression Id. */
- int PRECEDES = 24;
- /** RegularExpression Id. */
- int SUCCEEDS = 25;
- /** RegularExpression Id. */
- int DIV = 26;
- /** RegularExpression Id. */
- int LBRACKET = 27;
- /** RegularExpression Id. */
- int RBRACKET = 28;
- /** RegularExpression Id. */
- int ANY = 29;
- /** RegularExpression Id. */
- int PARENT = 30;
- /** RegularExpression Id. */
- int DOT = 31;
- /** RegularExpression Id. */
- int LPARAN = 32;
- /** RegularExpression Id. */
- int RPARAN = 33;
- /** RegularExpression Id. */
- int COMPARE = 34;
- /** RegularExpression Id. */
- int OR = 35;
- /** RegularExpression Id. */
- int AND = 36;
- /** RegularExpression Id. */
- int NOT_EQ = 37;
- /** RegularExpression Id. */
- int COLON = 38;
- /** RegularExpression Id. */
- int INTERPOLATION = 39;
- /** RegularExpression Id. */
- int NONASCII = 40;
- /** RegularExpression Id. */
- int H = 41;
- /** RegularExpression Id. */
- int UNICODE = 42;
- /** RegularExpression Id. */
- int ESCAPE = 43;
- /** RegularExpression Id. */
- int NMSTART = 44;
- /** RegularExpression Id. */
- int NMCHAR = 45;
- /** RegularExpression Id. */
- int STRINGCHAR = 46;
- /** RegularExpression Id. */
- int D = 47;
- /** RegularExpression Id. */
- int NAME = 48;
- /** RegularExpression Id. */
- int TO = 49;
- /** RegularExpression Id. */
- int THROUGH = 50;
- /** RegularExpression Id. */
- int EACH_IN = 51;
- /** RegularExpression Id. */
- int MIXIN_SYM = 52;
- /** RegularExpression Id. */
- int INCLUDE_SYM = 53;
- /** RegularExpression Id. */
- int FUNCTION_SYM = 54;
- /** RegularExpression Id. */
- int RETURN_SYM = 55;
- /** RegularExpression Id. */
- int DEBUG_SYM = 56;
- /** RegularExpression Id. */
- int WARN_SYM = 57;
- /** RegularExpression Id. */
- int FOR_SYM = 58;
- /** RegularExpression Id. */
- int EACH_SYM = 59;
- /** RegularExpression Id. */
- int WHILE_SYM = 60;
- /** RegularExpression Id. */
- int IF_SYM = 61;
- /** RegularExpression Id. */
- int ELSE_SYM = 62;
- /** RegularExpression Id. */
- int EXTEND_SYM = 63;
- /** RegularExpression Id. */
- int MOZ_DOCUMENT_SYM = 64;
- /** RegularExpression Id. */
- int SUPPORTS_SYM = 65;
- /** RegularExpression Id. */
- int MICROSOFT_RULE = 66;
- /** RegularExpression Id. */
- int IF = 67;
- /** RegularExpression Id. */
- int GUARDED_SYM = 68;
- /** RegularExpression Id. */
- int STRING = 69;
- /** RegularExpression Id. */
- int IDENT = 70;
- /** RegularExpression Id. */
- int NUMBER = 71;
- /** RegularExpression Id. */
- int _URL = 72;
- /** RegularExpression Id. */
- int URL = 73;
- /** RegularExpression Id. */
- int VARIABLE = 74;
- /** RegularExpression Id. */
- int PERCENTAGE = 75;
- /** RegularExpression Id. */
- int PT = 76;
- /** RegularExpression Id. */
- int MM = 77;
- /** RegularExpression Id. */
- int CM = 78;
- /** RegularExpression Id. */
- int PC = 79;
- /** RegularExpression Id. */
- int IN = 80;
- /** RegularExpression Id. */
- int PX = 81;
- /** RegularExpression Id. */
- int EMS = 82;
- /** RegularExpression Id. */
- int EXS = 83;
- /** RegularExpression Id. */
- int DEG = 84;
- /** RegularExpression Id. */
- int RAD = 85;
- /** RegularExpression Id. */
- int GRAD = 86;
- /** RegularExpression Id. */
- int MS = 87;
- /** RegularExpression Id. */
- int SECOND = 88;
- /** RegularExpression Id. */
- int HZ = 89;
- /** RegularExpression Id. */
- int KHZ = 90;
- /** RegularExpression Id. */
- int DIMEN = 91;
- /** RegularExpression Id. */
- int HASH = 92;
- /** RegularExpression Id. */
- int IMPORT_SYM = 93;
- /** RegularExpression Id. */
- int MEDIA_SYM = 94;
- /** RegularExpression Id. */
- int CHARSET_SYM = 95;
- /** RegularExpression Id. */
- int PAGE_SYM = 96;
- /** RegularExpression Id. */
- int FONT_FACE_SYM = 97;
- /** RegularExpression Id. */
- int ATKEYWORD = 98;
- /** RegularExpression Id. */
- int IMPORTANT_SYM = 99;
- /** RegularExpression Id. */
- int RANGE0 = 100;
- /** RegularExpression Id. */
- int RANGE1 = 101;
- /** RegularExpression Id. */
- int RANGE2 = 102;
- /** RegularExpression Id. */
- int RANGE3 = 103;
- /** RegularExpression Id. */
- int RANGE4 = 104;
- /** RegularExpression Id. */
- int RANGE5 = 105;
- /** RegularExpression Id. */
- int RANGE6 = 106;
- /** RegularExpression Id. */
- int RANGE = 107;
- /** RegularExpression Id. */
- int UNI = 108;
- /** RegularExpression Id. */
- int UNICODERANGE = 109;
- /** RegularExpression Id. */
- int REMOVE = 110;
- /** RegularExpression Id. */
- int APPEND = 111;
- /** RegularExpression Id. */
- int CONTAINS = 112;
- /** RegularExpression Id. */
- int FUNCTION = 113;
- /** RegularExpression Id. */
- int UNKNOWN = 114;
-
- /** Lexical state. */
- int DEFAULT = 0;
- /** Lexical state. */
- int IN_SINGLE_LINE_COMMENT = 1;
- /** Lexical state. */
- int IN_FORMAL_COMMENT = 2;
- /** Lexical state. */
- int IN_MULTI_LINE_COMMENT = 3;
-
- /** Literal token values. */
- String[] tokenImage = {
- "<EOF>",
- "<S>",
- "\"//\"",
- "<token of kind 3>",
- "<token of kind 4>",
- "<token of kind 5>",
- "\"/*\"",
- "\"*/\"",
- "\"*/\"",
- "<token of kind 9>",
- "\"<!--\"",
- "\"-->\"",
- "\"{\"",
- "\"}\"",
- "\"|=\"",
- "\"^=\"",
- "\"$=\"",
- "\"*=\"",
- "\"~=\"",
- "\"=\"",
- "\"+\"",
- "\"-\"",
- "\",\"",
- "\";\"",
- "\">\"",
- "\"<\"",
- "\"/\"",
- "\"[\"",
- "\"]\"",
- "\"*\"",
- "\"&\"",
- "\".\"",
- "\"(\"",
- "\")\"",
- "\"==\"",
- "\"||\"",
- "\"&&\"",
- "\"!=\"",
- "\":\"",
- "<INTERPOLATION>",
- "<NONASCII>",
- "<H>",
- "<UNICODE>",
- "<ESCAPE>",
- "<NMSTART>",
- "<NMCHAR>",
- "<STRINGCHAR>",
- "<D>",
- "<NAME>",
- "\"to\"",
- "\"through\"",
- "\"in\"",
- "\"@mixin\"",
- "\"@include\"",
- "\"@function\"",
- "\"@return\"",
- "\"@debug\"",
- "\"@warn\"",
- "\"@for\"",
- "\"@each\"",
- "\"@while\"",
- "\"@if\"",
- "\"@else\"",
- "\"@extend\"",
- "\"@-moz-document\"",
- "\"@supports\"",
- "<MICROSOFT_RULE>",
- "\"if\"",
- "<GUARDED_SYM>",
- "<STRING>",
- "<IDENT>",
- "<NUMBER>",
- "<_URL>",
- "<URL>",
- "<VARIABLE>",
- "<PERCENTAGE>",
- "<PT>",
- "<MM>",
- "<CM>",
- "<PC>",
- "<IN>",
- "<PX>",
- "<EMS>",
- "<EXS>",
- "<DEG>",
- "<RAD>",
- "<GRAD>",
- "<MS>",
- "<SECOND>",
- "<HZ>",
- "<KHZ>",
- "<DIMEN>",
- "<HASH>",
- "\"@import\"",
- "\"@media\"",
- "\"@charset\"",
- "\"@page\"",
- "\"@font-face\"",
- "<ATKEYWORD>",
- "<IMPORTANT_SYM>",
- "<RANGE0>",
- "<RANGE1>",
- "<RANGE2>",
- "<RANGE3>",
- "<RANGE4>",
- "<RANGE5>",
- "<RANGE6>",
- "<RANGE>",
- "<UNI>",
- "<UNICODERANGE>",
- "<REMOVE>",
- "<APPEND>",
- "<CONTAINS>",
- "<FUNCTION>",
- "<UNKNOWN>",
- };
-
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */
-package com.vaadin.sass.parser;
-import java.io.*;
-import java.net.*;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.Map;
-import org.w3c.css.sac.ConditionFactory;
-import org.w3c.css.sac.Condition;
-import org.w3c.css.sac.SelectorFactory;
-import org.w3c.css.sac.SelectorList;
-import org.w3c.css.sac.Selector;
-import org.w3c.css.sac.SimpleSelector;
-import org.w3c.css.sac.DocumentHandler;
-import org.w3c.css.sac.InputSource;
-import org.w3c.css.sac.ErrorHandler;
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.CSSParseException;
-import org.w3c.css.sac.Locator;
-import org.w3c.css.sac.LexicalUnit;
-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.*;
-
-/** Token Manager. */
-public class ParserTokenManager implements ParserConstants
-{
-
- /** Debug output. */
- public java.io.PrintStream debugStream = System.out;
- /** Set debug output. */
- public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
-{
- switch (pos)
- {
- case 0:
- if ((active0 & 0xfff0000000000000L) != 0L || (active1 & 0x3e0000003L) != 0L)
- return 111;
- if ((active0 & 0x10000L) != 0L)
- return 79;
- if ((active0 & 0xe000000000000L) != 0L || (active1 & 0x8L) != 0L)
- {
- jjmatchedKind = 70;
- return 441;
- }
- if ((active0 & 0x80000000L) != 0L)
- return 442;
- if ((active0 & 0x2000000000L) != 0L)
- return 443;
- if ((active0 & 0x4000044L) != 0L)
- return 3;
- if ((active0 & 0x200800L) != 0L)
- return 42;
- return -1;
- case 1:
- if ((active0 & 0x4000000000000L) != 0L)
- {
- jjmatchedKind = 70;
- jjmatchedPos = 1;
- return 441;
- }
- if ((active1 & 0x1L) != 0L)
- return 112;
- if ((active0 & 0xa000000000000L) != 0L || (active1 & 0x8L) != 0L)
- return 441;
- if ((active0 & 0xfff0000000000000L) != 0L || (active1 & 0x3e0000002L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 1;
- return 444;
- }
- if ((active0 & 0x40L) != 0L)
- return 1;
- return -1;
- case 2:
- if ((active0 & 0xdff0000000000000L) != 0L || (active1 & 0x3e0000003L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 2;
- return 444;
- }
- if ((active0 & 0x2000000000000000L) != 0L)
- return 444;
- if ((active0 & 0x4000000000000L) != 0L)
- {
- jjmatchedKind = 70;
- jjmatchedPos = 2;
- return 441;
- }
- return -1;
- case 3:
- if ((active0 & 0x4000000000000L) != 0L)
- {
- jjmatchedKind = 70;
- jjmatchedPos = 3;
- return 441;
- }
- if ((active0 & 0xdbf0000000000000L) != 0L || (active1 & 0x3e0000003L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 3;
- return 444;
- }
- if ((active0 & 0x400000000000000L) != 0L)
- return 444;
- return -1;
- case 4:
- if ((active0 & 0x91f0000000000000L) != 0L || (active1 & 0x2e0000003L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 4;
- return 444;
- }
- if ((active0 & 0x4a00000000000000L) != 0L || (active1 & 0x100000000L) != 0L)
- return 444;
- if ((active0 & 0x4000000000000L) != 0L)
- {
- jjmatchedKind = 70;
- jjmatchedPos = 4;
- return 441;
- }
- return -1;
- case 5:
- if ((active0 & 0x1110000000000000L) != 0L || (active1 & 0x40000000L) != 0L)
- return 444;
- if ((active0 & 0x80e0000000000000L) != 0L || (active1 & 0x2a0000003L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 5;
- return 444;
- }
- if ((active0 & 0x4000000000000L) != 0L)
- {
- jjmatchedKind = 70;
- jjmatchedPos = 5;
- return 441;
- }
- return -1;
- case 6:
- if ((active0 & 0x4000000000000L) != 0L)
- return 441;
- if ((active0 & 0x8080000000000000L) != 0L || (active1 & 0x20000000L) != 0L)
- return 444;
- if ((active0 & 0x60000000000000L) != 0L || (active1 & 0x280000003L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 6;
- return 444;
- }
- return -1;
- case 7:
- if ((active0 & 0x20000000000000L) != 0L || (active1 & 0x80000000L) != 0L)
- return 444;
- if ((active0 & 0x40000000000000L) != 0L || (active1 & 0x200000003L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 7;
- return 444;
- }
- return -1;
- case 8:
- if ((active1 & 0x200000001L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 8;
- return 444;
- }
- if ((active0 & 0x40000000000000L) != 0L || (active1 & 0x2L) != 0L)
- return 444;
- return -1;
- case 9:
- if ((active1 & 0x1L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 9;
- return 444;
- }
- if ((active1 & 0x200000000L) != 0L)
- return 444;
- return -1;
- case 10:
- if ((active1 & 0x1L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 10;
- return 444;
- }
- return -1;
- case 11:
- if ((active1 & 0x1L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 11;
- return 444;
- }
- return -1;
- case 12:
- if ((active1 & 0x1L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 12;
- return 444;
- }
- return -1;
- default :
- return -1;
- }
-}
-private final int jjStartNfa_0(int pos, long active0, long active1)
-{
- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1);
-}
-private int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 33:
- return jjMoveStringLiteralDfa1_0(0x2000000000L, 0x0L);
- case 36:
- return jjMoveStringLiteralDfa1_0(0x10000L, 0x0L);
- case 38:
- jjmatchedKind = 30;
- return jjMoveStringLiteralDfa1_0(0x1000000000L, 0x0L);
- case 40:
- return jjStopAtPos(0, 32);
- case 41:
- return jjStopAtPos(0, 33);
- case 42:
- jjmatchedKind = 29;
- return jjMoveStringLiteralDfa1_0(0x20000L, 0x0L);
- case 43:
- return jjStopAtPos(0, 20);
- case 44:
- return jjStopAtPos(0, 22);
- case 45:
- jjmatchedKind = 21;
- return jjMoveStringLiteralDfa1_0(0x800L, 0x0L);
- case 46:
- return jjStartNfaWithStates_0(0, 31, 442);
- case 47:
- jjmatchedKind = 26;
- return jjMoveStringLiteralDfa1_0(0x44L, 0x0L);
- case 58:
- return jjStopAtPos(0, 38);
- case 59:
- return jjStopAtPos(0, 23);
- case 60:
- jjmatchedKind = 25;
- return jjMoveStringLiteralDfa1_0(0x400L, 0x0L);
- case 61:
- jjmatchedKind = 19;
- return jjMoveStringLiteralDfa1_0(0x400000000L, 0x0L);
- case 62:
- return jjStopAtPos(0, 24);
- case 64:
- return jjMoveStringLiteralDfa1_0(0xfff0000000000000L, 0x3e0000003L);
- case 91:
- return jjStopAtPos(0, 27);
- case 93:
- return jjStopAtPos(0, 28);
- case 94:
- return jjMoveStringLiteralDfa1_0(0x8000L, 0x0L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa1_0(0x8000000000000L, 0x8L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa1_0(0x6000000000000L, 0x0L);
- case 123:
- return jjStopAtPos(0, 12);
- case 124:
- return jjMoveStringLiteralDfa1_0(0x800004000L, 0x0L);
- case 125:
- return jjStopAtPos(0, 13);
- case 126:
- return jjMoveStringLiteralDfa1_0(0x40000L, 0x0L);
- default :
- return jjMoveNfa_0(4, 0);
- }
-}
-private int jjMoveStringLiteralDfa1_0(long active0, long active1)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(0, active0, active1);
- return 1;
- }
- switch(curChar)
- {
- case 33:
- return jjMoveStringLiteralDfa2_0(active0, 0x400L, active1, 0L);
- case 38:
- if ((active0 & 0x1000000000L) != 0L)
- return jjStopAtPos(1, 36);
- break;
- case 42:
- if ((active0 & 0x40L) != 0L)
- return jjStartNfaWithStates_0(1, 6, 1);
- break;
- case 45:
- return jjMoveStringLiteralDfa2_0(active0, 0x800L, active1, 0x1L);
- case 47:
- if ((active0 & 0x4L) != 0L)
- return jjStopAtPos(1, 2);
- break;
- case 61:
- if ((active0 & 0x4000L) != 0L)
- return jjStopAtPos(1, 14);
- else if ((active0 & 0x8000L) != 0L)
- return jjStopAtPos(1, 15);
- else if ((active0 & 0x10000L) != 0L)
- return jjStopAtPos(1, 16);
- else if ((active0 & 0x20000L) != 0L)
- return jjStopAtPos(1, 17);
- else if ((active0 & 0x40000L) != 0L)
- return jjStopAtPos(1, 18);
- else if ((active0 & 0x400000000L) != 0L)
- return jjStopAtPos(1, 34);
- else if ((active0 & 0x2000000000L) != 0L)
- return jjStopAtPos(1, 37);
- break;
- case 67:
- case 99:
- return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000L);
- case 68:
- case 100:
- return jjMoveStringLiteralDfa2_0(active0, 0x100000000000000L, active1, 0L);
- case 69:
- case 101:
- return jjMoveStringLiteralDfa2_0(active0, 0xc800000000000000L, active1, 0L);
- case 70:
- case 102:
- if ((active1 & 0x8L) != 0L)
- return jjStartNfaWithStates_0(1, 67, 441);
- return jjMoveStringLiteralDfa2_0(active0, 0x440000000000000L, active1, 0x200000000L);
- case 72:
- case 104:
- return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa2_0(active0, 0x2020000000000000L, active1, 0x20000000L);
- case 77:
- case 109:
- return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x40000000L);
- case 78:
- case 110:
- if ((active0 & 0x8000000000000L) != 0L)
- return jjStartNfaWithStates_0(1, 51, 441);
- break;
- case 79:
- case 111:
- if ((active0 & 0x2000000000000L) != 0L)
- return jjStartNfaWithStates_0(1, 49, 441);
- break;
- case 80:
- case 112:
- return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x100000000L);
- case 82:
- case 114:
- return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L, active1, 0L);
- case 83:
- case 115:
- return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L);
- case 87:
- case 119:
- return jjMoveStringLiteralDfa2_0(active0, 0x1200000000000000L, active1, 0L);
- case 124:
- if ((active0 & 0x800000000L) != 0L)
- return jjStopAtPos(1, 35);
- break;
- default :
- break;
- }
- return jjStartNfa_0(0, active0, active1);
-}
-private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(0, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(1, active0, active1);
- return 2;
- }
- switch(curChar)
- {
- case 45:
- return jjMoveStringLiteralDfa3_0(active0, 0x400L, active1, 0L);
- case 62:
- if ((active0 & 0x800L) != 0L)
- return jjStopAtPos(2, 11);
- break;
- case 65:
- case 97:
- return jjMoveStringLiteralDfa3_0(active0, 0xa00000000000000L, active1, 0x100000000L);
- case 69:
- case 101:
- return jjMoveStringLiteralDfa3_0(active0, 0x180000000000000L, active1, 0x40000000L);
- case 70:
- case 102:
- if ((active0 & 0x2000000000000000L) != 0L)
- return jjStartNfaWithStates_0(2, 61, 444);
- break;
- case 72:
- case 104:
- return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x80000000L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0L);
- case 76:
- case 108:
- return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000000L, active1, 0L);
- case 77:
- case 109:
- return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x20000001L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0x200000000L);
- case 82:
- case 114:
- return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L, active1, 0x2L);
- case 88:
- case 120:
- return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000000L, active1, 0L);
- default :
- break;
- }
- return jjStartNfa_0(1, active0, active1);
-}
-private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(1, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(2, active0, active1);
- return 3;
- }
- switch(curChar)
- {
- case 45:
- if ((active0 & 0x400L) != 0L)
- return jjStopAtPos(3, 10);
- break;
- case 65:
- case 97:
- return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L);
- case 66:
- case 98:
- return jjMoveStringLiteralDfa4_0(active0, 0x100000000000000L, active1, 0L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa4_0(active0, 0x820000000000000L, active1, 0L);
- case 68:
- case 100:
- return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000L);
- case 71:
- case 103:
- return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x100000000L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa4_0(active0, 0x40000000000000L, active1, 0x200000000L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L, active1, 0x1L);
- case 80:
- case 112:
- return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000002L);
- case 82:
- case 114:
- if ((active0 & 0x400000000000000L) != 0L)
- return jjStartNfaWithStates_0(3, 58, 444);
- return jjMoveStringLiteralDfa4_0(active0, 0x200000000000000L, active1, 0L);
- case 83:
- case 115:
- return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa4_0(active0, 0x8080000000000000L, active1, 0L);
- case 88:
- case 120:
- return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0L);
- default :
- break;
- }
- return jjStartNfa_0(2, active0, active1);
-}
-private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(2, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(3, active0, active1);
- return 4;
- }
- switch(curChar)
- {
- case 67:
- case 99:
- return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L, active1, 0L);
- case 69:
- case 101:
- if ((active0 & 0x4000000000000000L) != 0L)
- return jjStartNfaWithStates_0(4, 62, 444);
- else if ((active1 & 0x100000000L) != 0L)
- return jjStartNfaWithStates_0(4, 96, 444);
- return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000000L, active1, 0L);
- case 72:
- case 104:
- if ((active0 & 0x800000000000000L) != 0L)
- return jjStartNfaWithStates_0(4, 59, 444);
- break;
- case 73:
- case 105:
- return jjMoveStringLiteralDfa5_0(active0, 0x10000000000000L, active1, 0x40000000L);
- case 76:
- case 108:
- return jjMoveStringLiteralDfa5_0(active0, 0x1020000000000000L, active1, 0L);
- case 78:
- case 110:
- if ((active0 & 0x200000000000000L) != 0L)
- return jjStartNfaWithStates_0(4, 57, 444);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x20000000L);
- case 80:
- case 112:
- return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2L);
- case 82:
- case 114:
- return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200000000L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa5_0(active0, 0x184000000000000L, active1, 0L);
- case 90:
- case 122:
- return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1L);
- default :
- break;
- }
- return jjStartNfa_0(3, active0, active1);
-}
-private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(3, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(4, active0, active1);
- return 5;
- }
- switch(curChar)
- {
- case 45:
- return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x200000001L);
- case 65:
- case 97:
- if ((active1 & 0x40000000L) != 0L)
- return jjStartNfaWithStates_0(5, 94, 444);
- break;
- case 69:
- case 101:
- if ((active0 & 0x1000000000000000L) != 0L)
- return jjStartNfaWithStates_0(5, 60, 444);
- break;
- case 71:
- case 103:
- if ((active0 & 0x100000000000000L) != 0L)
- return jjStartNfaWithStates_0(5, 56, 444);
- return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L, active1, 0L);
- case 78:
- case 110:
- if ((active0 & 0x10000000000000L) != 0L)
- return jjStartNfaWithStates_0(5, 52, 444);
- return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000000L, active1, 0L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2L);
- case 82:
- case 114:
- return jjMoveStringLiteralDfa6_0(active0, 0x80000000000000L, active1, 0x20000000L);
- case 83:
- case 115:
- return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa6_0(active0, 0x40000000000000L, active1, 0L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa6_0(active0, 0x20000000000000L, active1, 0L);
- default :
- break;
- }
- return jjStartNfa_0(4, active0, active1);
-}
-private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(4, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(5, active0, active1);
- return 6;
- }
- switch(curChar)
- {
- case 68:
- case 100:
- if ((active0 & 0x8000000000000000L) != 0L)
- return jjStartNfaWithStates_0(6, 63, 444);
- return jjMoveStringLiteralDfa7_0(active0, 0x20000000000000L, active1, 0x1L);
- case 69:
- case 101:
- return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000L);
- case 70:
- case 102:
- return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200000000L);
- case 72:
- case 104:
- if ((active0 & 0x4000000000000L) != 0L)
- return jjStartNfaWithStates_0(6, 50, 441);
- break;
- case 73:
- case 105:
- return jjMoveStringLiteralDfa7_0(active0, 0x40000000000000L, active1, 0L);
- case 78:
- case 110:
- if ((active0 & 0x80000000000000L) != 0L)
- return jjStartNfaWithStates_0(6, 55, 444);
- break;
- case 82:
- case 114:
- return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2L);
- case 84:
- case 116:
- if ((active1 & 0x20000000L) != 0L)
- return jjStartNfaWithStates_0(6, 93, 444);
- break;
- default :
- break;
- }
- return jjStartNfa_0(5, active0, active1);
-}
-private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(5, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(6, active0, active1);
- return 7;
- }
- switch(curChar)
- {
- case 65:
- case 97:
- return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000000L);
- case 69:
- case 101:
- if ((active0 & 0x20000000000000L) != 0L)
- return jjStartNfaWithStates_0(7, 53, 444);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa8_0(active0, 0x40000000000000L, active1, 0x1L);
- case 84:
- case 116:
- if ((active1 & 0x80000000L) != 0L)
- return jjStartNfaWithStates_0(7, 95, 444);
- return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x2L);
- default :
- break;
- }
- return jjStartNfa_0(6, active0, active1);
-}
-private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(6, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(7, active0, active1);
- return 8;
- }
- switch(curChar)
- {
- case 67:
- case 99:
- return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x200000001L);
- case 78:
- case 110:
- if ((active0 & 0x40000000000000L) != 0L)
- return jjStartNfaWithStates_0(8, 54, 444);
- break;
- case 83:
- case 115:
- if ((active1 & 0x2L) != 0L)
- return jjStartNfaWithStates_0(8, 65, 444);
- break;
- default :
- break;
- }
- return jjStartNfa_0(7, active0, active1);
-}
-private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(7, old0, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(8, 0L, active1);
- return 9;
- }
- switch(curChar)
- {
- case 69:
- case 101:
- if ((active1 & 0x200000000L) != 0L)
- return jjStartNfaWithStates_0(9, 97, 444);
- break;
- case 85:
- case 117:
- return jjMoveStringLiteralDfa10_0(active1, 0x1L);
- default :
- break;
- }
- return jjStartNfa_0(8, 0L, active1);
-}
-private int jjMoveStringLiteralDfa10_0(long old1, long active1)
-{
- if (((active1 &= old1)) == 0L)
- return jjStartNfa_0(8, 0L, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(9, 0L, active1);
- return 10;
- }
- switch(curChar)
- {
- case 77:
- case 109:
- return jjMoveStringLiteralDfa11_0(active1, 0x1L);
- default :
- break;
- }
- return jjStartNfa_0(9, 0L, active1);
-}
-private int jjMoveStringLiteralDfa11_0(long old1, long active1)
-{
- if (((active1 &= old1)) == 0L)
- return jjStartNfa_0(9, 0L, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(10, 0L, active1);
- return 11;
- }
- switch(curChar)
- {
- case 69:
- case 101:
- return jjMoveStringLiteralDfa12_0(active1, 0x1L);
- default :
- break;
- }
- return jjStartNfa_0(10, 0L, active1);
-}
-private int jjMoveStringLiteralDfa12_0(long old1, long active1)
-{
- if (((active1 &= old1)) == 0L)
- return jjStartNfa_0(10, 0L, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(11, 0L, active1);
- return 12;
- }
- switch(curChar)
- {
- case 78:
- case 110:
- return jjMoveStringLiteralDfa13_0(active1, 0x1L);
- default :
- break;
- }
- return jjStartNfa_0(11, 0L, active1);
-}
-private int jjMoveStringLiteralDfa13_0(long old1, long active1)
-{
- if (((active1 &= old1)) == 0L)
- return jjStartNfa_0(11, 0L, old1);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(12, 0L, active1);
- return 13;
- }
- switch(curChar)
- {
- case 84:
- case 116:
- if ((active1 & 0x1L) != 0L)
- return jjStartNfaWithStates_0(13, 64, 444);
- break;
- default :
- break;
- }
- return jjStartNfa_0(12, 0L, active1);
-}
-private int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_0(state, pos + 1);
-}
-static final long[] jjbitVec0 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private int jjMoveNfa_0(int startState, int curPos)
-{
- int startsAt = 0;
- jjnewStateCnt = 441;
- int i = 1;
- jjstateSet[0] = startState;
- int kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- do
- {
- switch(jjstateSet[--i])
- {
- case 442:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(0, 4);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(252, 255);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(249, 251);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(247, 248);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(244, 246);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(239, 243);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(235, 238);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(231, 234);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(228, 230);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(225, 227);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(222, 224);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(219, 221);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(216, 218);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(213, 215);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(210, 212);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(207, 209);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(205, 206);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 71)
- kind = 71;
- jjCheckNAdd(204);
- }
- break;
- case 79:
- if (curChar == 45)
- jjCheckNAdd(80);
- break;
- case 443:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(189, 198);
- if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(181, 188);
- break;
- case 444:
- case 113:
- if ((0x3ff200000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 441:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddStates(5, 8);
- else if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(169, 170);
- else if (curChar == 40)
- {
- if (kind > 113)
- kind = 113;
- }
- if ((0x3ff200000000000L & l) != 0L)
- {
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- }
- break;
- case 111:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 112;
- break;
- case 4:
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 71)
- kind = 71;
- jjCheckNAddStates(9, 82);
- }
- else if ((0x100003600L & l) != 0L)
- {
- if (kind > 1)
- kind = 1;
- jjCheckNAdd(0);
- }
- else if (curChar == 46)
- jjCheckNAddStates(83, 100);
- else if (curChar == 45)
- jjAddStates(101, 102);
- else if (curChar == 33)
- jjCheckNAddStates(103, 106);
- else if (curChar == 35)
- jjCheckNAddTwoStates(100, 101);
- else if (curChar == 36)
- jjCheckNAddStates(107, 110);
- else if (curChar == 39)
- jjCheckNAddStates(111, 114);
- else if (curChar == 34)
- jjCheckNAddStates(115, 118);
- else if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 3;
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 42;
- else if (curChar == 35)
- jjstateSet[jjnewStateCnt++] = 5;
- break;
- case 0:
- if ((0x100003600L & l) == 0L)
- break;
- if (kind > 1)
- kind = 1;
- jjCheckNAdd(0);
- break;
- case 1:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- case 2:
- if ((0xffff7fffffffffffL & l) != 0L && kind > 5)
- kind = 5;
- break;
- case 3:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- case 6:
- if (curChar == 36)
- jjCheckNAddStates(119, 122);
- break;
- case 7:
- if (curChar == 45)
- jjCheckNAdd(8);
- break;
- case 9:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 12:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 13:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(126, 130);
- break;
- case 14:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 15:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(131, 138);
- break;
- case 16:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(139, 142);
- break;
- case 17:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(143, 147);
- break;
- case 18:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(148, 153);
- break;
- case 19:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(154, 160);
- break;
- case 22:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(161, 165);
- break;
- case 23:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(166, 173);
- break;
- case 24:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(174, 177);
- break;
- case 25:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(178, 182);
- break;
- case 26:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(183, 188);
- break;
- case 27:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(189, 195);
- break;
- case 28:
- if (curChar == 35)
- jjstateSet[jjnewStateCnt++] = 5;
- break;
- case 40:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 39;
- break;
- case 43:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 42;
- break;
- case 44:
- if (curChar == 34)
- jjCheckNAddStates(115, 118);
- break;
- case 45:
- if ((0xfffffffb00000200L & l) != 0L)
- jjCheckNAddStates(115, 118);
- break;
- case 46:
- if (curChar == 34 && kind > 69)
- kind = 69;
- break;
- case 48:
- if (curChar == 12)
- jjCheckNAddStates(115, 118);
- break;
- case 50:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(115, 118);
- break;
- case 51:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(196, 201);
- break;
- case 52:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(115, 118);
- break;
- case 53:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(202, 210);
- break;
- case 54:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(211, 215);
- break;
- case 55:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(216, 221);
- break;
- case 56:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(222, 228);
- break;
- case 57:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(229, 236);
- break;
- case 58:
- if (curChar == 13)
- jjCheckNAddStates(115, 118);
- break;
- case 59:
- if (curChar == 10)
- jjCheckNAddStates(115, 118);
- break;
- case 60:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 59;
- break;
- case 61:
- if (curChar == 39)
- jjCheckNAddStates(111, 114);
- break;
- case 62:
- if ((0xffffff7f00000200L & l) != 0L)
- jjCheckNAddStates(111, 114);
- break;
- case 63:
- if (curChar == 39 && kind > 69)
- kind = 69;
- break;
- case 65:
- if (curChar == 12)
- jjCheckNAddStates(111, 114);
- break;
- case 67:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(111, 114);
- break;
- case 68:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(237, 242);
- break;
- case 69:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(111, 114);
- break;
- case 70:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(243, 251);
- break;
- case 71:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(252, 256);
- break;
- case 72:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(257, 262);
- break;
- case 73:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(263, 269);
- break;
- case 74:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(270, 277);
- break;
- case 75:
- if (curChar == 13)
- jjCheckNAddStates(111, 114);
- break;
- case 76:
- if (curChar == 10)
- jjCheckNAddStates(111, 114);
- break;
- case 77:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 76;
- break;
- case 78:
- if (curChar == 36)
- jjCheckNAddStates(107, 110);
- break;
- case 81:
- if ((0x3ff200000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 83:
- if ((0xffffffff00000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 84:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(278, 281);
- break;
- case 85:
- if ((0x100003600L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 86:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(282, 288);
- break;
- case 87:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(289, 291);
- break;
- case 88:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(292, 295);
- break;
- case 89:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(296, 300);
- break;
- case 90:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(301, 306);
- break;
- case 93:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(307, 310);
- break;
- case 94:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(311, 317);
- break;
- case 95:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(318, 320);
- break;
- case 96:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(321, 324);
- break;
- case 97:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(325, 329);
- break;
- case 98:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(330, 335);
- break;
- case 99:
- if (curChar == 35)
- jjCheckNAddTwoStates(100, 101);
- break;
- case 100:
- if ((0x3ff200000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddTwoStates(100, 101);
- break;
- case 102:
- if ((0xffffffff00000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddTwoStates(100, 101);
- break;
- case 103:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(336, 339);
- break;
- case 104:
- if ((0x100003600L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddTwoStates(100, 101);
- break;
- case 105:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(340, 346);
- break;
- case 106:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(347, 349);
- break;
- case 107:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(350, 353);
- break;
- case 108:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(354, 358);
- break;
- case 109:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(359, 364);
- break;
- case 115:
- if ((0xffffffff00000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 116:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(365, 368);
- break;
- case 117:
- if ((0x100003600L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 118:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(369, 375);
- break;
- case 119:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(376, 378);
- break;
- case 120:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(379, 382);
- break;
- case 121:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(383, 387);
- break;
- case 122:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(388, 393);
- break;
- case 125:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(394, 397);
- break;
- case 126:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(398, 404);
- break;
- case 127:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(405, 407);
- break;
- case 128:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(408, 411);
- break;
- case 129:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(412, 416);
- break;
- case 130:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(417, 422);
- break;
- case 132:
- if ((0x100003600L & l) != 0L)
- jjAddStates(423, 424);
- break;
- case 133:
- if (curChar == 40 && kind > 110)
- kind = 110;
- break;
- case 140:
- if ((0x100003600L & l) != 0L)
- jjAddStates(425, 426);
- break;
- case 141:
- if (curChar == 40 && kind > 111)
- kind = 111;
- break;
- case 148:
- if ((0x100003600L & l) != 0L)
- jjAddStates(427, 428);
- break;
- case 149:
- if (curChar == 40 && kind > 112)
- kind = 112;
- break;
- case 158:
- if ((0x3ff200000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 160:
- if ((0xffffffff00000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 161:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(429, 432);
- break;
- case 162:
- if ((0x100003600L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 163:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(433, 439);
- break;
- case 164:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(440, 442);
- break;
- case 165:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(443, 446);
- break;
- case 166:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(447, 451);
- break;
- case 167:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(452, 457);
- break;
- case 168:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 169:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(169, 170);
- break;
- case 170:
- if (curChar == 40 && kind > 113)
- kind = 113;
- break;
- case 172:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 173:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(458, 462);
- break;
- case 174:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 175:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(463, 470);
- break;
- case 176:
- case 382:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(471, 474);
- break;
- case 177:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(475, 479);
- break;
- case 178:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(480, 485);
- break;
- case 179:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(486, 492);
- break;
- case 180:
- if (curChar == 33)
- jjCheckNAddStates(103, 106);
- break;
- case 181:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(181, 188);
- break;
- case 189:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(189, 198);
- break;
- case 199:
- if (curChar == 45)
- jjAddStates(101, 102);
- break;
- case 203:
- if (curChar == 46)
- jjCheckNAddStates(83, 100);
- break;
- case 204:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 71)
- kind = 71;
- jjCheckNAdd(204);
- break;
- case 205:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(205, 206);
- break;
- case 206:
- if (curChar == 37 && kind > 75)
- kind = 75;
- break;
- case 207:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(207, 209);
- break;
- case 210:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(210, 212);
- break;
- case 213:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(213, 215);
- break;
- case 216:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(216, 218);
- break;
- case 219:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(219, 221);
- break;
- case 222:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(222, 224);
- break;
- case 225:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(225, 227);
- break;
- case 228:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(228, 230);
- break;
- case 231:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(231, 234);
- break;
- case 235:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(235, 238);
- break;
- case 239:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(239, 243);
- break;
- case 244:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(244, 246);
- break;
- case 247:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(247, 248);
- break;
- case 249:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(249, 251);
- break;
- case 252:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(252, 255);
- break;
- case 256:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(0, 4);
- break;
- case 257:
- if (curChar == 45)
- jjCheckNAdd(258);
- break;
- case 259:
- if ((0x3ff200000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 261:
- if ((0xffffffff00000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 262:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(493, 496);
- break;
- case 263:
- if ((0x100003600L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 264:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(497, 503);
- break;
- case 265:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(504, 506);
- break;
- case 266:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(507, 510);
- break;
- case 267:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(511, 515);
- break;
- case 268:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(516, 521);
- break;
- case 271:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(522, 525);
- break;
- case 272:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(526, 532);
- break;
- case 273:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(533, 535);
- break;
- case 274:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(536, 539);
- break;
- case 275:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(540, 544);
- break;
- case 276:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(545, 550);
- break;
- case 278:
- if (curChar == 40)
- jjCheckNAddStates(551, 556);
- break;
- case 279:
- if ((0xfffffc7a00000000L & l) != 0L)
- jjCheckNAddStates(557, 560);
- break;
- case 280:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddTwoStates(280, 281);
- break;
- case 281:
- if (curChar == 41 && kind > 73)
- kind = 73;
- break;
- case 283:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(557, 560);
- break;
- case 284:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(561, 565);
- break;
- case 285:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(557, 560);
- break;
- case 286:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(566, 573);
- break;
- case 287:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(574, 577);
- break;
- case 288:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(578, 582);
- break;
- case 289:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(583, 588);
- break;
- case 290:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(589, 595);
- break;
- case 291:
- if (curChar == 39)
- jjCheckNAddStates(596, 599);
- break;
- case 292:
- if ((0xffffff7f00000200L & l) != 0L)
- jjCheckNAddStates(596, 599);
- break;
- case 293:
- if (curChar == 39)
- jjCheckNAddTwoStates(280, 281);
- break;
- case 295:
- if (curChar == 12)
- jjCheckNAddStates(596, 599);
- break;
- case 297:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(596, 599);
- break;
- case 298:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(600, 605);
- break;
- case 299:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(596, 599);
- break;
- case 300:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(606, 614);
- break;
- case 301:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(615, 619);
- break;
- case 302:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(620, 625);
- break;
- case 303:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(626, 632);
- break;
- case 304:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(633, 640);
- break;
- case 305:
- if (curChar == 13)
- jjCheckNAddStates(596, 599);
- break;
- case 306:
- if (curChar == 10)
- jjCheckNAddStates(596, 599);
- break;
- case 307:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 306;
- break;
- case 308:
- if (curChar == 34)
- jjCheckNAddStates(641, 644);
- break;
- case 309:
- if ((0xfffffffb00000200L & l) != 0L)
- jjCheckNAddStates(641, 644);
- break;
- case 310:
- if (curChar == 34)
- jjCheckNAddTwoStates(280, 281);
- break;
- case 312:
- if (curChar == 12)
- jjCheckNAddStates(641, 644);
- break;
- case 314:
- if ((0xffffffff00000000L & l) != 0L)
- jjCheckNAddStates(641, 644);
- break;
- case 315:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(645, 650);
- break;
- case 316:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(641, 644);
- break;
- case 317:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(651, 659);
- break;
- case 318:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(660, 664);
- break;
- case 319:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(665, 670);
- break;
- case 320:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(671, 677);
- break;
- case 321:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(678, 685);
- break;
- case 322:
- if (curChar == 13)
- jjCheckNAddStates(641, 644);
- break;
- case 323:
- if (curChar == 10)
- jjCheckNAddStates(641, 644);
- break;
- case 324:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 323;
- break;
- case 325:
- if ((0x100003600L & l) != 0L)
- jjCheckNAddStates(686, 692);
- break;
- case 328:
- if (curChar == 43)
- jjAddStates(693, 694);
- break;
- case 329:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 330;
- break;
- case 330:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(695, 698);
- break;
- case 331:
- if (curChar == 63 && kind > 109)
- kind = 109;
- break;
- case 332:
- case 347:
- case 351:
- case 354:
- case 357:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAdd(331);
- break;
- case 333:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddTwoStates(331, 332);
- break;
- case 334:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(699, 701);
- break;
- case 335:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjAddStates(702, 707);
- break;
- case 336:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 337;
- break;
- case 337:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 338;
- break;
- case 338:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAdd(339);
- break;
- case 339:
- if ((0x3ff000000000000L & l) != 0L && kind > 109)
- kind = 109;
- break;
- case 340:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 341;
- break;
- case 341:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 342;
- break;
- case 342:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 343;
- break;
- case 343:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAdd(331);
- break;
- case 344:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 345;
- break;
- case 345:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 346;
- break;
- case 346:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 347;
- break;
- case 348:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 349;
- break;
- case 349:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 350;
- break;
- case 350:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddTwoStates(331, 351);
- break;
- case 352:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 353;
- break;
- case 353:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(708, 710);
- break;
- case 355:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddTwoStates(331, 354);
- break;
- case 356:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(711, 714);
- break;
- case 358:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddTwoStates(331, 357);
- break;
- case 359:
- if (curChar != 63)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(715, 717);
- break;
- case 360:
- if (curChar == 43)
- jjstateSet[jjnewStateCnt++] = 361;
- break;
- case 361:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(362, 368);
- break;
- case 362:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 363;
- break;
- case 363:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 364;
- break;
- case 364:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(718, 721);
- break;
- case 365:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAdd(339);
- break;
- case 366:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddTwoStates(339, 365);
- break;
- case 367:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(722, 724);
- break;
- case 368:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(725, 729);
- break;
- case 369:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAdd(362);
- break;
- case 370:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(369, 362);
- break;
- case 371:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(730, 732);
- break;
- case 372:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(733, 736);
- break;
- case 374:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(737, 740);
- break;
- case 375:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(741, 747);
- break;
- case 376:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(748, 750);
- break;
- case 377:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(751, 754);
- break;
- case 378:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(755, 759);
- break;
- case 379:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(760, 765);
- break;
- case 380:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(766, 770);
- break;
- case 381:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(771, 778);
- break;
- case 383:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(779, 783);
- break;
- case 384:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(784, 789);
- break;
- case 385:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(790, 796);
- break;
- case 386:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 71)
- kind = 71;
- jjCheckNAddStates(9, 82);
- break;
- case 387:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 71)
- kind = 71;
- jjCheckNAdd(387);
- break;
- case 388:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(388, 389);
- break;
- case 389:
- if (curChar == 46)
- jjCheckNAdd(204);
- break;
- case 390:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(390, 206);
- break;
- case 391:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(391, 392);
- break;
- case 392:
- if (curChar == 46)
- jjCheckNAdd(205);
- break;
- case 393:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(393, 209);
- break;
- case 394:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(394, 395);
- break;
- case 395:
- if (curChar == 46)
- jjCheckNAdd(207);
- break;
- case 396:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(396, 212);
- break;
- case 397:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(397, 398);
- break;
- case 398:
- if (curChar == 46)
- jjCheckNAdd(210);
- break;
- case 399:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(399, 215);
- break;
- case 400:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(400, 401);
- break;
- case 401:
- if (curChar == 46)
- jjCheckNAdd(213);
- break;
- case 402:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(402, 218);
- break;
- case 403:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(403, 404);
- break;
- case 404:
- if (curChar == 46)
- jjCheckNAdd(216);
- break;
- case 405:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(405, 221);
- break;
- case 406:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(406, 407);
- break;
- case 407:
- if (curChar == 46)
- jjCheckNAdd(219);
- break;
- case 408:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(408, 224);
- break;
- case 409:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(409, 410);
- break;
- case 410:
- if (curChar == 46)
- jjCheckNAdd(222);
- break;
- case 411:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(411, 227);
- break;
- case 412:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(412, 413);
- break;
- case 413:
- if (curChar == 46)
- jjCheckNAdd(225);
- break;
- case 414:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(414, 230);
- break;
- case 415:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(415, 416);
- break;
- case 416:
- if (curChar == 46)
- jjCheckNAdd(228);
- break;
- case 417:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(417, 234);
- break;
- case 418:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(418, 419);
- break;
- case 419:
- if (curChar == 46)
- jjCheckNAdd(231);
- break;
- case 420:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(420, 238);
- break;
- case 421:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(421, 422);
- break;
- case 422:
- if (curChar == 46)
- jjCheckNAdd(235);
- break;
- case 423:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(423, 243);
- break;
- case 424:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(424, 425);
- break;
- case 425:
- if (curChar == 46)
- jjCheckNAdd(239);
- break;
- case 426:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(426, 246);
- break;
- case 427:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(427, 428);
- break;
- case 428:
- if (curChar == 46)
- jjCheckNAdd(244);
- break;
- case 429:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(429, 248);
- break;
- case 430:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(430, 431);
- break;
- case 431:
- if (curChar == 46)
- jjCheckNAdd(247);
- break;
- case 432:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(432, 251);
- break;
- case 433:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(433, 434);
- break;
- case 434:
- if (curChar == 46)
- jjCheckNAdd(249);
- break;
- case 435:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(435, 255);
- break;
- case 436:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(436, 437);
- break;
- case 437:
- if (curChar == 46)
- jjCheckNAdd(252);
- break;
- case 438:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(797, 801);
- break;
- case 439:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(439, 440);
- break;
- case 440:
- if (curChar == 46)
- jjCheckNAdd(256);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 42:
- if ((0x7fffffe07fffffeL & l) != 0L)
- jjCheckNAddStates(5, 8);
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- }
- if ((0x200000002000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 41;
- break;
- case 79:
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- }
- else if (curChar == 92)
- jjCheckNAddTwoStates(83, 93);
- break;
- case 443:
- if ((0x20000000200L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 197;
- else if ((0x1000000010L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 187;
- break;
- case 444:
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- }
- else if (curChar == 92)
- jjCheckNAddTwoStates(115, 116);
- break;
- case 441:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddStates(5, 8);
- else if (curChar == 92)
- jjCheckNAddTwoStates(160, 161);
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- }
- else if (curChar == 92)
- jjCheckNAddTwoStates(172, 173);
- break;
- case 111:
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- }
- else if (curChar == 92)
- jjCheckNAddTwoStates(115, 125);
- break;
- case 4:
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(802, 807);
- }
- else if (curChar == 92)
- jjCheckNAddStates(808, 811);
- else if (curChar == 64)
- jjAddStates(812, 815);
- if ((0x20000000200000L & l) != 0L)
- jjAddStates(816, 818);
- else if ((0x800000008L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 155;
- else if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 145;
- else if ((0x4000000040000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 137;
- else if ((0x4000000040L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 33;
- break;
- case 2:
- if (kind > 5)
- kind = 5;
- break;
- case 5:
- if (curChar == 123)
- jjstateSet[jjnewStateCnt++] = 6;
- break;
- case 8:
- if ((0x7fffffe07fffffeL & l) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 9:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 10:
- if (curChar == 125 && kind > 39)
- kind = 39;
- break;
- case 11:
- if (curChar == 92)
- jjCheckNAddTwoStates(12, 13);
- break;
- case 12:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 13:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(126, 130);
- break;
- case 15:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(131, 138);
- break;
- case 16:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(139, 142);
- break;
- case 17:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(143, 147);
- break;
- case 18:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(148, 153);
- break;
- case 19:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(154, 160);
- break;
- case 21:
- if (curChar == 92)
- jjCheckNAddTwoStates(12, 22);
- break;
- case 22:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(161, 165);
- break;
- case 23:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(166, 173);
- break;
- case 24:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(174, 177);
- break;
- case 25:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(178, 182);
- break;
- case 26:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(183, 188);
- break;
- case 27:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(189, 195);
- break;
- case 29:
- if ((0x4000000040000L & l) != 0L && kind > 66)
- kind = 66;
- break;
- case 30:
- case 35:
- if ((0x2000000020L & l) != 0L)
- jjCheckNAdd(29);
- break;
- case 31:
- if ((0x10000000100000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 30;
- break;
- case 32:
- if ((0x100000001000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 31;
- break;
- case 33:
- if ((0x20000000200L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 32;
- break;
- case 34:
- if ((0x4000000040L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 33;
- break;
- case 36:
- if ((0x10000000100000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 35;
- break;
- case 37:
- if ((0x100000001000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 36;
- break;
- case 38:
- if ((0x20000000200L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 37;
- break;
- case 39:
- if ((0x4000000040L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 38;
- break;
- case 41:
- if ((0x8000000080000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 40;
- break;
- case 45:
- case 50:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(115, 118);
- break;
- case 47:
- if (curChar == 92)
- jjAddStates(819, 822);
- break;
- case 49:
- if (curChar == 92)
- jjAddStates(823, 824);
- break;
- case 51:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(196, 201);
- break;
- case 53:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(202, 210);
- break;
- case 54:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(211, 215);
- break;
- case 55:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(216, 221);
- break;
- case 56:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(222, 228);
- break;
- case 57:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(229, 236);
- break;
- case 62:
- case 67:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(111, 114);
- break;
- case 64:
- if (curChar == 92)
- jjAddStates(825, 828);
- break;
- case 66:
- if (curChar == 92)
- jjAddStates(829, 830);
- break;
- case 68:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(237, 242);
- break;
- case 70:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(243, 251);
- break;
- case 71:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(252, 256);
- break;
- case 72:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(257, 262);
- break;
- case 73:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(263, 269);
- break;
- case 74:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(270, 277);
- break;
- case 80:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 81:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 82:
- if (curChar == 92)
- jjCheckNAddTwoStates(83, 84);
- break;
- case 83:
- if ((0x7fffffffffffffffL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 84:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(278, 281);
- break;
- case 86:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(282, 288);
- break;
- case 87:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(289, 291);
- break;
- case 88:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(292, 295);
- break;
- case 89:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(296, 300);
- break;
- case 90:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(301, 306);
- break;
- case 92:
- if (curChar == 92)
- jjCheckNAddTwoStates(83, 93);
- break;
- case 93:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(307, 310);
- break;
- case 94:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(311, 317);
- break;
- case 95:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(318, 320);
- break;
- case 96:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(321, 324);
- break;
- case 97:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(325, 329);
- break;
- case 98:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddStates(330, 335);
- break;
- case 100:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddTwoStates(100, 101);
- break;
- case 101:
- if (curChar == 92)
- jjAddStates(831, 832);
- break;
- case 102:
- if ((0x7fffffffffffffffL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddTwoStates(100, 101);
- break;
- case 103:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(336, 339);
- break;
- case 105:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(340, 346);
- break;
- case 106:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(347, 349);
- break;
- case 107:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(350, 353);
- break;
- case 108:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(354, 358);
- break;
- case 109:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddStates(359, 364);
- break;
- case 110:
- if (curChar == 64)
- jjAddStates(812, 815);
- break;
- case 112:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 113:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 114:
- if (curChar == 92)
- jjCheckNAddTwoStates(115, 116);
- break;
- case 115:
- if ((0x7fffffffffffffffL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 116:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(365, 368);
- break;
- case 118:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(369, 375);
- break;
- case 119:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(376, 378);
- break;
- case 120:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(379, 382);
- break;
- case 121:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(383, 387);
- break;
- case 122:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(388, 393);
- break;
- case 124:
- if (curChar == 92)
- jjCheckNAddTwoStates(115, 125);
- break;
- case 125:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(394, 397);
- break;
- case 126:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(398, 404);
- break;
- case 127:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(405, 407);
- break;
- case 128:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(408, 411);
- break;
- case 129:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(412, 416);
- break;
- case 130:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddStates(417, 422);
- break;
- case 131:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(423, 424);
- break;
- case 134:
- if ((0x40000000400000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 131;
- break;
- case 135:
- if ((0x800000008000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 134;
- break;
- case 136:
- if ((0x200000002000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 135;
- break;
- case 137:
- if ((0x2000000020L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 136;
- break;
- case 138:
- if ((0x4000000040000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 137;
- break;
- case 139:
- if ((0x1000000010L & l) != 0L)
- jjAddStates(425, 426);
- break;
- case 142:
- if ((0x400000004000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 139;
- break;
- case 143:
- if ((0x2000000020L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 142;
- break;
- case 144:
- if ((0x1000000010000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 143;
- break;
- case 145:
- if ((0x1000000010000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 144;
- break;
- case 146:
- if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 145;
- break;
- case 147:
- if ((0x8000000080000L & l) != 0L)
- jjAddStates(427, 428);
- break;
- case 150:
- if ((0x400000004000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 147;
- break;
- case 151:
- if ((0x20000000200L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 150;
- break;
- case 152:
- if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 151;
- break;
- case 153:
- if ((0x10000000100000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 152;
- break;
- case 154:
- if ((0x400000004000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 153;
- break;
- case 155:
- if ((0x800000008000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 154;
- break;
- case 156:
- if ((0x800000008L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 155;
- break;
- case 158:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 159:
- if (curChar == 92)
- jjCheckNAddTwoStates(160, 161);
- break;
- case 160:
- if ((0x7fffffffffffffffL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 161:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(429, 432);
- break;
- case 163:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(433, 439);
- break;
- case 164:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(440, 442);
- break;
- case 165:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(443, 446);
- break;
- case 166:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(447, 451);
- break;
- case 167:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(452, 457);
- break;
- case 168:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 171:
- if (curChar == 92)
- jjCheckNAddTwoStates(172, 173);
- break;
- case 172:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 173:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(458, 462);
- break;
- case 175:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(463, 470);
- break;
- case 176:
- case 382:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(471, 474);
- break;
- case 177:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(475, 479);
- break;
- case 178:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(480, 485);
- break;
- case 179:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(486, 492);
- break;
- case 182:
- if ((0x10000000100000L & l) != 0L && kind > 68)
- kind = 68;
- break;
- case 183:
- if ((0x100000001000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 182;
- break;
- case 184:
- if ((0x20000000200000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 183;
- break;
- case 185:
- if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 184;
- break;
- case 186:
- if ((0x4000000040L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 185;
- break;
- case 187:
- if ((0x2000000020L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 186;
- break;
- case 188:
- if ((0x1000000010L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 187;
- break;
- case 190:
- if ((0x10000000100000L & l) != 0L && kind > 99)
- kind = 99;
- break;
- case 191:
- if ((0x400000004000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 190;
- break;
- case 192:
- if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 191;
- break;
- case 193:
- if ((0x10000000100000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 192;
- break;
- case 194:
- if ((0x4000000040000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 193;
- break;
- case 195:
- if ((0x800000008000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 194;
- break;
- case 196:
- if ((0x1000000010000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 195;
- break;
- case 197:
- if ((0x200000002000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 196;
- break;
- case 198:
- if ((0x20000000200L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 197;
- break;
- case 200:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 201:
- if ((0x7fffffe07fffffeL & l) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 202:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(802, 807);
- break;
- case 208:
- if ((0x10000000100000L & l) != 0L && kind > 76)
- kind = 76;
- break;
- case 209:
- if ((0x1000000010000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 208;
- break;
- case 211:
- if ((0x200000002000L & l) != 0L && kind > 77)
- kind = 77;
- break;
- case 212:
- if ((0x200000002000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 211;
- break;
- case 214:
- if ((0x200000002000L & l) != 0L && kind > 78)
- kind = 78;
- break;
- case 215:
- if ((0x800000008L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 214;
- break;
- case 217:
- if ((0x800000008L & l) != 0L && kind > 79)
- kind = 79;
- break;
- case 218:
- if ((0x1000000010000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 217;
- break;
- case 220:
- if ((0x400000004000L & l) != 0L && kind > 80)
- kind = 80;
- break;
- case 221:
- if ((0x20000000200L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 220;
- break;
- case 223:
- if ((0x100000001000000L & l) != 0L && kind > 81)
- kind = 81;
- break;
- case 224:
- if ((0x1000000010000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 223;
- break;
- case 226:
- if ((0x200000002000L & l) != 0L && kind > 82)
- kind = 82;
- break;
- case 227:
- if ((0x2000000020L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 226;
- break;
- case 229:
- if ((0x100000001000000L & l) != 0L && kind > 83)
- kind = 83;
- break;
- case 230:
- if ((0x2000000020L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 229;
- break;
- case 232:
- if ((0x8000000080L & l) != 0L && kind > 84)
- kind = 84;
- break;
- case 233:
- if ((0x2000000020L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 232;
- break;
- case 234:
- if ((0x1000000010L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 233;
- break;
- case 236:
- if ((0x1000000010L & l) != 0L && kind > 85)
- kind = 85;
- break;
- case 237:
- if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 236;
- break;
- case 238:
- if ((0x4000000040000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 237;
- break;
- case 240:
- if ((0x1000000010L & l) != 0L && kind > 86)
- kind = 86;
- break;
- case 241:
- if ((0x200000002L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 240;
- break;
- case 242:
- if ((0x4000000040000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 241;
- break;
- case 243:
- if ((0x8000000080L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 242;
- break;
- case 245:
- if ((0x8000000080000L & l) != 0L && kind > 87)
- kind = 87;
- break;
- case 246:
- if ((0x200000002000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 245;
- break;
- case 248:
- if ((0x8000000080000L & l) != 0L && kind > 88)
- kind = 88;
- break;
- case 250:
- if ((0x400000004000000L & l) != 0L && kind > 89)
- kind = 89;
- break;
- case 251:
- if ((0x10000000100L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 250;
- break;
- case 253:
- if ((0x400000004000000L & l) != 0L && kind > 90)
- kind = 90;
- break;
- case 254:
- if ((0x10000000100L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 253;
- break;
- case 255:
- if ((0x80000000800L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 254;
- break;
- case 258:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 259:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 260:
- if (curChar == 92)
- jjCheckNAddTwoStates(261, 262);
- break;
- case 261:
- if ((0x7fffffffffffffffL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 262:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(493, 496);
- break;
- case 264:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(497, 503);
- break;
- case 265:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(504, 506);
- break;
- case 266:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(507, 510);
- break;
- case 267:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(511, 515);
- break;
- case 268:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(516, 521);
- break;
- case 270:
- if (curChar == 92)
- jjCheckNAddTwoStates(261, 271);
- break;
- case 271:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(522, 525);
- break;
- case 272:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(526, 532);
- break;
- case 273:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(533, 535);
- break;
- case 274:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(536, 539);
- break;
- case 275:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(540, 544);
- break;
- case 276:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddStates(545, 550);
- break;
- case 277:
- if ((0x20000000200000L & l) != 0L)
- jjAddStates(816, 818);
- break;
- case 279:
- case 283:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(557, 560);
- break;
- case 282:
- if (curChar == 92)
- jjAddStates(833, 834);
- break;
- case 284:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(561, 565);
- break;
- case 286:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(566, 573);
- break;
- case 287:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(574, 577);
- break;
- case 288:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(578, 582);
- break;
- case 289:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(583, 588);
- break;
- case 290:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(589, 595);
- break;
- case 292:
- case 297:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(596, 599);
- break;
- case 294:
- if (curChar == 92)
- jjAddStates(835, 838);
- break;
- case 296:
- if (curChar == 92)
- jjAddStates(839, 840);
- break;
- case 298:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(600, 605);
- break;
- case 300:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(606, 614);
- break;
- case 301:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(615, 619);
- break;
- case 302:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(620, 625);
- break;
- case 303:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(626, 632);
- break;
- case 304:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(633, 640);
- break;
- case 309:
- case 314:
- if ((0x7fffffffffffffffL & l) != 0L)
- jjCheckNAddStates(641, 644);
- break;
- case 311:
- if (curChar == 92)
- jjAddStates(841, 844);
- break;
- case 313:
- if (curChar == 92)
- jjAddStates(845, 846);
- break;
- case 315:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(645, 650);
- break;
- case 317:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(651, 659);
- break;
- case 318:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(660, 664);
- break;
- case 319:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(665, 670);
- break;
- case 320:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(671, 677);
- break;
- case 321:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(678, 685);
- break;
- case 326:
- if ((0x100000001000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 278;
- break;
- case 327:
- if ((0x4000000040000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 326;
- break;
- case 335:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjAddStates(702, 707);
- break;
- case 336:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 337;
- break;
- case 337:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 338;
- break;
- case 338:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAdd(339);
- break;
- case 339:
- if ((0x7e0000007eL & l) != 0L && kind > 109)
- kind = 109;
- break;
- case 340:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 341;
- break;
- case 341:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 342;
- break;
- case 342:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 343;
- break;
- case 343:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 331;
- break;
- case 344:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 345;
- break;
- case 345:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 346;
- break;
- case 346:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 347;
- break;
- case 348:
- if ((0x7e0000007eL & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 349;
- break;
- case 349:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 350;
- break;
- case 352:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 353;
- break;
- case 361:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(362, 368);
- break;
- case 363:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjstateSet[jjnewStateCnt++] = 364;
- break;
- case 364:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(718, 721);
- break;
- case 365:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAdd(339);
- break;
- case 366:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddTwoStates(339, 365);
- break;
- case 367:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 109)
- kind = 109;
- jjCheckNAddStates(722, 724);
- break;
- case 368:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(725, 729);
- break;
- case 369:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAdd(362);
- break;
- case 370:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(369, 362);
- break;
- case 371:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(730, 732);
- break;
- case 372:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(733, 736);
- break;
- case 373:
- if (curChar == 92)
- jjCheckNAddStates(808, 811);
- break;
- case 374:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(737, 740);
- break;
- case 375:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(741, 747);
- break;
- case 376:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(748, 750);
- break;
- case 377:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(751, 754);
- break;
- case 378:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(755, 759);
- break;
- case 379:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddStates(760, 765);
- break;
- case 380:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(766, 770);
- break;
- case 381:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(771, 778);
- break;
- case 383:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(779, 783);
- break;
- case 384:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(784, 789);
- break;
- case 385:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(790, 796);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 79:
- case 81:
- case 83:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 74)
- kind = 74;
- jjCheckNAddTwoStates(81, 82);
- break;
- case 444:
- case 113:
- case 115:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 441:
- if ((jjbitVec0[i2] & l2) != 0L)
- {
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- }
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 111:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 98)
- kind = 98;
- jjCheckNAddTwoStates(113, 114);
- break;
- case 4:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 40)
- kind = 40;
- jjCheckNAddStates(802, 807);
- break;
- case 2:
- if ((jjbitVec0[i2] & l2) != 0L && kind > 5)
- kind = 5;
- break;
- case 9:
- case 12:
- case 20:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(123, 125);
- break;
- case 45:
- case 50:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(115, 118);
- break;
- case 62:
- case 67:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(111, 114);
- break;
- case 100:
- case 102:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 92)
- kind = 92;
- jjCheckNAddTwoStates(100, 101);
- break;
- case 158:
- case 160:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 70)
- kind = 70;
- jjCheckNAddTwoStates(158, 159);
- break;
- case 168:
- case 172:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(5, 8);
- break;
- case 259:
- case 261:
- case 269:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 91)
- kind = 91;
- jjCheckNAddTwoStates(259, 260);
- break;
- case 279:
- case 283:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(557, 560);
- break;
- case 292:
- case 297:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(596, 599);
- break;
- case 309:
- case 314:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(641, 644);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 441 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private int jjMoveStringLiteralDfa0_3()
-{
- switch(curChar)
- {
- case 42:
- return jjMoveStringLiteralDfa1_3(0x100L);
- default :
- return 1;
- }
-}
-private int jjMoveStringLiteralDfa1_3(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 1;
- }
- switch(curChar)
- {
- case 47:
- if ((active0 & 0x100L) != 0L)
- return jjStopAtPos(1, 8);
- break;
- default :
- return 2;
- }
- return 2;
-}
-private int jjMoveStringLiteralDfa0_1()
-{
- return jjMoveNfa_1(0, 0);
-}
-private int jjMoveNfa_1(int startState, int curPos)
-{
- int startsAt = 0;
- jjnewStateCnt = 4;
- int i = 1;
- jjstateSet[0] = startState;
- int kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0xffffffffffffdbffL & l) != 0L)
- {
- if (kind > 3)
- kind = 3;
- }
- else if ((0x2400L & l) != 0L)
- {
- if (kind > 4)
- kind = 4;
- }
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- case 1:
- if ((0x2400L & l) != 0L && kind > 4)
- kind = 4;
- break;
- case 2:
- if (curChar == 10 && kind > 4)
- kind = 4;
- break;
- case 3:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- kind = 3;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((jjbitVec0[i2] & l2) != 0L && kind > 3)
- kind = 3;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private int jjMoveStringLiteralDfa0_2()
-{
- switch(curChar)
- {
- case 42:
- return jjMoveStringLiteralDfa1_2(0x80L);
- default :
- return 1;
- }
-}
-private int jjMoveStringLiteralDfa1_2(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 1;
- }
- switch(curChar)
- {
- case 47:
- if ((active0 & 0x80L) != 0L)
- return jjStopAtPos(1, 7);
- break;
- default :
- return 2;
- }
- return 2;
-}
-static final int[] jjnextStates = {
- 256, 257, 258, 269, 270, 168, 169, 170, 171, 387, 388, 389, 390, 391, 392, 206,
- 393, 394, 395, 209, 396, 397, 398, 212, 399, 400, 401, 215, 402, 403, 404, 218,
- 405, 406, 407, 221, 408, 409, 410, 224, 411, 412, 413, 227, 414, 415, 416, 230,
- 417, 418, 419, 234, 420, 421, 422, 238, 423, 424, 425, 243, 426, 427, 428, 246,
- 429, 430, 431, 248, 432, 433, 434, 251, 435, 436, 437, 255, 438, 439, 440, 257,
- 258, 269, 270, 204, 205, 207, 210, 213, 216, 219, 222, 225, 228, 231, 235, 239,
- 244, 247, 249, 252, 256, 200, 201, 181, 188, 189, 198, 79, 80, 91, 92, 62,
- 63, 64, 66, 45, 46, 47, 49, 7, 8, 20, 21, 9, 10, 11, 9, 14,
- 10, 11, 15, 9, 16, 14, 10, 11, 17, 18, 19, 9, 14, 10, 11, 9,
- 16, 14, 10, 11, 9, 16, 14, 10, 11, 17, 9, 16, 14, 10, 11, 17,
- 18, 14, 9, 10, 11, 23, 24, 14, 9, 10, 11, 25, 26, 27, 14, 9,
- 10, 11, 24, 14, 9, 10, 11, 24, 14, 9, 10, 11, 25, 24, 14, 9,
- 10, 11, 25, 26, 45, 52, 46, 47, 49, 53, 45, 54, 52, 46, 47, 49,
- 55, 56, 57, 45, 52, 46, 47, 49, 45, 54, 52, 46, 47, 49, 45, 54,
- 52, 46, 47, 49, 55, 45, 54, 52, 46, 47, 49, 55, 56, 62, 69, 63,
- 64, 66, 70, 62, 71, 69, 63, 64, 66, 72, 73, 74, 62, 69, 63, 64,
- 66, 62, 71, 69, 63, 64, 66, 62, 71, 69, 63, 64, 66, 72, 62, 71,
- 69, 63, 64, 66, 72, 73, 81, 85, 82, 86, 81, 87, 85, 82, 88, 89,
- 90, 81, 85, 82, 81, 87, 85, 82, 81, 87, 85, 82, 88, 81, 87, 85,
- 82, 88, 89, 85, 81, 82, 94, 95, 85, 81, 82, 96, 97, 98, 85, 81,
- 82, 95, 85, 81, 82, 95, 85, 81, 82, 96, 95, 85, 81, 82, 96, 97,
- 100, 104, 101, 105, 100, 106, 104, 101, 107, 108, 109, 100, 104, 101, 100, 106,
- 104, 101, 100, 106, 104, 101, 107, 100, 106, 104, 101, 107, 108, 113, 117, 114,
- 118, 113, 119, 117, 114, 120, 121, 122, 113, 117, 114, 113, 119, 117, 114, 113,
- 119, 117, 114, 120, 113, 119, 117, 114, 120, 121, 117, 113, 114, 126, 127, 117,
- 113, 114, 128, 129, 130, 117, 113, 114, 127, 117, 113, 114, 127, 117, 113, 114,
- 128, 127, 117, 113, 114, 128, 129, 132, 133, 140, 141, 148, 149, 158, 162, 159,
- 163, 158, 164, 162, 159, 165, 166, 167, 158, 162, 159, 158, 164, 162, 159, 158,
- 164, 162, 159, 165, 158, 164, 162, 159, 165, 166, 168, 170, 171, 174, 175, 168,
- 176, 170, 171, 174, 177, 178, 179, 168, 170, 171, 174, 168, 176, 170, 171, 174,
- 168, 176, 170, 171, 174, 177, 168, 176, 170, 171, 174, 177, 178, 259, 263, 260,
- 264, 259, 265, 263, 260, 266, 267, 268, 259, 263, 260, 259, 265, 263, 260, 259,
- 265, 263, 260, 266, 259, 265, 263, 260, 266, 267, 263, 259, 260, 272, 273, 263,
- 259, 260, 274, 275, 276, 263, 259, 260, 273, 263, 259, 260, 273, 263, 259, 260,
- 274, 273, 263, 259, 260, 274, 275, 279, 291, 308, 281, 282, 325, 279, 280, 281,
- 282, 279, 281, 282, 285, 286, 279, 287, 281, 282, 285, 288, 289, 290, 279, 281,
- 282, 285, 279, 287, 281, 282, 285, 279, 287, 281, 282, 285, 288, 279, 287, 281,
- 282, 285, 288, 289, 292, 293, 294, 296, 292, 299, 293, 294, 296, 300, 292, 301,
- 299, 293, 294, 296, 302, 303, 304, 292, 299, 293, 294, 296, 292, 301, 299, 293,
- 294, 296, 292, 301, 299, 293, 294, 296, 302, 292, 301, 299, 293, 294, 296, 302,
- 303, 309, 310, 311, 313, 309, 316, 310, 311, 313, 317, 309, 318, 316, 310, 311,
- 313, 319, 320, 321, 309, 316, 310, 311, 313, 309, 318, 316, 310, 311, 313, 309,
- 318, 316, 310, 311, 313, 319, 309, 318, 316, 310, 311, 313, 319, 320, 279, 291,
- 308, 280, 281, 282, 325, 329, 335, 331, 332, 333, 334, 331, 332, 333, 336, 340,
- 344, 348, 352, 356, 331, 354, 355, 331, 357, 358, 359, 331, 357, 358, 339, 365,
- 366, 367, 339, 365, 366, 369, 362, 370, 371, 372, 369, 362, 370, 369, 362, 370,
- 371, 162, 158, 159, 375, 376, 162, 158, 159, 377, 378, 379, 162, 158, 159, 376,
- 162, 158, 159, 376, 162, 158, 159, 377, 376, 162, 158, 159, 377, 378, 168, 170,
- 171, 174, 381, 382, 168, 170, 171, 174, 383, 384, 385, 382, 168, 170, 171, 174,
- 382, 168, 170, 171, 174, 383, 382, 168, 170, 171, 174, 383, 384, 438, 257, 258,
- 269, 270, 158, 168, 169, 170, 171, 159, 160, 374, 172, 380, 111, 112, 123, 124,
- 327, 328, 360, 48, 58, 60, 59, 50, 51, 65, 75, 77, 76, 67, 68, 102,
- 103, 283, 284, 295, 305, 307, 306, 297, 298, 312, 322, 324, 323, 314, 315,
-};
-
-/** Token literal values. */
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, null, null, null, "\74\41\55\55",
-"\55\55\76", "\173", "\175", "\174\75", "\136\75", "\44\75", "\52\75", "\176\75", "\75",
-"\53", "\55", "\54", "\73", "\76", "\74", "\57", "\133", "\135", "\52", "\46", "\56",
-"\50", "\51", "\75\75", "\174\174", "\46\46", "\41\75", "\72", null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, };
-
-/** Lexer state names. */
-public static final String[] lexStateNames = {
- "DEFAULT",
- "IN_SINGLE_LINE_COMMENT",
- "IN_FORMAL_COMMENT",
- "IN_MULTI_LINE_COMMENT",
-};
-
-/** Lex State array. */
-public static final int[] jjnewLexState = {
- -1, -1, 1, -1, 0, 2, 3, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-};
-static final long[] jjtoToken = {
- 0xfffe01fffffffc03L, 0x7e00ffffffeffL,
-};
-static final long[] jjtoSkip = {
- 0x190L, 0x0L,
-};
-static final long[] jjtoSpecial = {
- 0x80L, 0x0L,
-};
-static final long[] jjtoMore = {
- 0x26cL, 0x0L,
-};
-protected CharStream input_stream;
-private final int[] jjrounds = new int[441];
-private final int[] jjstateSet = new int[882];
-private final StringBuilder jjimage = new StringBuilder();
-private StringBuilder image = jjimage;
-private int jjimageLen;
-private int lengthOfMatch;
-protected char curChar;
-/** Constructor. */
-public ParserTokenManager(CharStream stream){
- input_stream = stream;
-}
-
-/** Constructor. */
-public ParserTokenManager(CharStream stream, int lexState){
- this(stream);
- SwitchTo(lexState);
-}
-
-/** Reinitialise parser. */
-public void ReInit(CharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 441; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
-
-/** Reinitialise parser. */
-public void ReInit(CharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-
-/** Switch to specified lex state. */
-public void SwitchTo(int lexState)
-{
- if (lexState >= 4 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
-
-protected Token jjFillToken()
-{
- final Token t;
- final String curTokenImage;
- final int beginLine;
- final int endLine;
- final int beginColumn;
- final int endColumn;
- String im = jjstrLiteralImages[jjmatchedKind];
- curTokenImage = (im == null) ? input_stream.GetImage() : im;
- beginLine = input_stream.getBeginLine();
- beginColumn = input_stream.getBeginColumn();
- endLine = input_stream.getEndLine();
- endColumn = input_stream.getEndColumn();
- t = Token.newToken(jjmatchedKind, curTokenImage);
-
- t.beginLine = beginLine;
- t.endLine = endLine;
- t.beginColumn = beginColumn;
- t.endColumn = endColumn;
-
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-/** Get the next Token. */
-public Token getNextToken()
-{
- Token specialToken = null;
- Token matchedToken;
- int curPos = 0;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- matchedToken.specialToken = specialToken;
- return matchedToken;
- }
- image = jjimage;
- image.setLength(0);
- jjimageLen = 0;
-
- for (;;)
- {
- switch(curLexState)
- {
- case 0:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedPos == 0 && jjmatchedKind > 114)
- {
- jjmatchedKind = 114;
- }
- break;
- case 1:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_1();
- break;
- case 2:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_2();
- if (jjmatchedPos == 0 && jjmatchedKind > 9)
- {
- jjmatchedKind = 9;
- }
- break;
- case 3:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_3();
- if (jjmatchedPos == 0 && jjmatchedKind > 9)
- {
- jjmatchedKind = 9;
- }
- break;
- }
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- matchedToken.specialToken = specialToken;
- TokenLexicalActions(matchedToken);
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- return matchedToken;
- }
- else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- if (specialToken == null)
- specialToken = matchedToken;
- else
- {
- matchedToken.specialToken = specialToken;
- specialToken = (specialToken.next = matchedToken);
- }
- SkipLexicalActions(matchedToken);
- }
- else
- SkipLexicalActions(null);
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- continue EOFLoop;
- }
- MoreLexicalActions();
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- curPos = 0;
- jjmatchedKind = 0x7fffffff;
- try {
- curChar = input_stream.readChar();
- continue;
- }
- catch (java.io.IOException e1) { }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
- }
-}
-
-void SkipLexicalActions(Token matchedToken)
-{
- switch(jjmatchedKind)
- {
- default :
- break;
- }
-}
-void MoreLexicalActions()
-{
- jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
- switch(jjmatchedKind)
- {
- case 5 :
- image.append(input_stream.GetSuffix(jjimageLen));
- jjimageLen = 0;
- input_stream.backup(1);
- break;
- default :
- break;
- }
-}
-void TokenLexicalActions(Token matchedToken)
-{
- switch(jjmatchedKind)
- {
- case 1 :
- image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
- image = Parser.SPACE;
- break;
- default :
- break;
- }
-}
-private void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-
-private void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-
-}
+++ /dev/null
-package com.vaadin.sass.parser;
-
-import org.w3c.css.sac.LexicalUnit;
-
-public interface SCSSLexicalUnit extends LexicalUnit {
- static final short SCSS_VARIABLE = 100;
-
- LexicalUnitImpl divide(LexicalUnitImpl denominator);
-
- LexicalUnitImpl add(LexicalUnitImpl another);
-
- LexicalUnitImpl minus(LexicalUnitImpl another);
-
- LexicalUnitImpl multiply(LexicalUnitImpl another);
-
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- *
- * $Id: SelectorListImpl.java,v 1.1 2000/08/07 01:16:21 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-import org.w3c.css.sac.Selector;
-import org.w3c.css.sac.SelectorList;
-
-/**
- * @version $Revision: 1.1 $
- * @author Philippe Le Hegaret
- */
-public class SelectorListImpl implements SelectorList {
-
- Selector[] selectors = new Selector[5];
- int current;
-
- @Override
- public Selector item(int index) {
- if ((index < 0) || (index >= current)) {
- return null;
- }
- return selectors[index];
- }
-
- public Selector itemSelector(int index) {
- if ((index < 0) || (index >= current)) {
- return null;
- }
- return selectors[index];
- }
-
- @Override
- public int getLength() {
- return current;
- }
-
- public void addSelector(Selector selector) {
- if (current == selectors.length) {
- Selector[] old = selectors;
- selectors = new Selector[old.length + old.length];
- System.arraycopy(old, 0, selectors, 0, old.length);
- }
- selectors[current++] = selector;
- }
-
- public void replaceSelector(int index, Selector selector) {
- if ((index >= 0) && (index < current)) {
- selectors[index] = selector;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- *
- * $Id: Selectors.java,v 1.1 2000/02/14 16:58:31 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-import org.w3c.css.sac.SelectorList;
-import org.w3c.css.sac.Selector;
-
-/**
- * @version $Revision: 1.1 $
- * @author Philippe Le Hegaret
- */
-class Selectors implements SelectorList {
-
- Selector[] selectors = new Selector[5];
- int current;
-
- public Selector item(int index) {
- if ((index < 0) || (index >= current)) {
- return null;
- }
- return selectors[index];
- }
-
- public Selector itemSelector(int index) {
- if ((index < 0) || (index >= current)) {
- return null;
- }
- return selectors[index];
- }
-
- public int getLength() {
- return current;
- }
-
- void addSelector(Selector selector) {
- if (current == selectors.length) {
- Selector[] old = selectors;
- selectors = new Selector[old.length + old.length];
- System.arraycopy(old, 0, selectors, 0, old.length);
- }
- selectors[current++] = selector;
- }
-}
+++ /dev/null
-/*
- * (c) COPYRIGHT 1999 World Wide Web Consortium
- * (Massachusetts Institute of Technology, Institut National de Recherche
- * en Informatique et en Automatique, Keio University).
- * All Rights Reserved. http://www.w3.org/Consortium/Legal/
- *
- * $Id: ThrowedParseException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
- */
-package com.vaadin.sass.parser;
-
-/**
- * @version $Revision: 1.1 $
- * @author Philippe Le Hegaret
- */
-class ThrowedParseException extends RuntimeException {
- private static final long serialVersionUID = -7926371344505913546L;
-
- ParseException e;
-
- /**
- * Creates a new ThrowedParseException
- */
- ThrowedParseException(ParseException e) {
- this.e = e;
- }
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package com.vaadin.sass.parser;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token implements java.io.Serializable {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /** The line number of the first character of this Token. */
- public int beginLine;
- /** The column number of the first character of this Token. */
- public int beginColumn;
- /** The line number of the last character of this Token. */
- public int endLine;
- /** The column number of the last character of this Token. */
- public int endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * An optional attribute value of the Token.
- * Tokens which are not used as syntactic sugar will often contain
- * meaningful values that will be used later on by the compiler or
- * interpreter. This attribute value is often different from the image.
- * Any subclass of Token that actually wants to return a non-null value can
- * override this method as appropriate.
- */
- public Object getValue() {
- return null;
- }
-
- /**
- * No-argument constructor
- */
- public Token() {}
-
- /**
- * Constructs a new token for the specified Image.
- */
- public Token(int kind)
- {
- this(kind, null);
- }
-
- /**
- * Constructs a new token for the specified Image and Kind.
- */
- public Token(int kind, String image)
- {
- this.kind = kind;
- this.image = image;
- }
-
- /**
- * Returns the image.
- */
- public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simply add something like :
- *
- * case MyParserConstants.ID : return new IDToken(ofKind, image);
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use sit in your lexical actions.
- */
- public static Token newToken(int ofKind, String image)
- {
- switch(ofKind)
- {
- default : return new Token(ofKind, image);
- }
- }
-
- public static Token newToken(int ofKind)
- {
- return newToken(ofKind, null);
- }
-
-}
-/* JavaCC - OriginalChecksum=fd921a11cd37e391729b9460c71d3ad6 (do not edit this line) */
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
-/* JavaCCOptions: */
-package com.vaadin.sass.parser;
-
-/** Token Manager Error. */
-public class TokenMgrError extends Error
-{
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their escaped (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexical error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- /** Full Constructor. */
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-/* JavaCC - OriginalChecksum=7d5524d89510a94f7c2ac022e99c24c3 (do not edit this line) */
+++ /dev/null
-package com.vaadin.sass.resolver;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.w3c.css.sac.InputSource;
-
-public class ClassloaderResolver implements ScssStylesheetResolver {
-
- @Override
- public InputSource resolve(String identifier) {
- // identifier should not have .scss, fileName should
- String ext = ".scss";
- if (identifier.endsWith(".css")) {
- ext = ".css";
- }
- String fileName = identifier;
- if (identifier.endsWith(ext)) {
- identifier = identifier.substring(0,
- identifier.length() - ext.length());
- } else {
- fileName = fileName + ext;
- }
-
- // Ensure only "/" is used, also in Windows
- fileName = fileName.replace(File.separatorChar, '/');
-
- // Can the classloader find it?
- InputStream is = getClass().getClassLoader().getResourceAsStream(
- fileName);
- if (is != null) {
- InputSource source = new InputSource();
- source.setByteStream(is);
- source.setURI(fileName);
- return source;
-
- } else {
- return null;
- }
-
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.resolver;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import org.w3c.css.sac.InputSource;
-
-public class FilesystemResolver implements ScssStylesheetResolver {
-
- @Override
- public InputSource resolve(String identifier) {
- // identifier should not have .scss, fileName should
- String ext = ".scss";
- if (identifier.endsWith(".css")) {
- ext = ".css";
- }
- String fileName = identifier;
- if (identifier.endsWith(ext)) {
- identifier = identifier.substring(0,
- identifier.length() - ext.length());
- } else {
- fileName = fileName + ext;
- }
-
- try {
- InputStream is = new FileInputStream(fileName);
- InputSource source = new InputSource();
- source.setByteStream(is);
- source.setURI(fileName);
- return source;
-
- } catch (FileNotFoundException e) {
- // not found, try something else
- return null;
- }
-
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.resolver;
-
-import org.w3c.css.sac.InputSource;
-
-public interface ScssStylesheetResolver {
- /**
- * Called with the "identifier" of a stylesheet that the resolver should try
- * to find. The identifier is basically a filename, like "runo.scss" or
- * "addon/styles.scss", but might exclude ".scss". The resolver must
- * {@link InputSource#setURI(String)} to the final location where the
- * stylesheet was found, e.g "runo.scss" might result in a URI like
- * "VAADIN/themes/runo/runo.scss".
- *
- * @param identifier
- * used fo find stylesheet
- * @return InputSource for stylesheet (with URI set) or null if not found
- */
- public InputSource resolve(String identifier);
-}
\ No newline at end of file
+++ /dev/null
-package com.vaadin.sass.resolver;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.w3c.css.sac.InputSource;
-
-public class VaadinResolver implements ScssStylesheetResolver {
-
- @Override
- public InputSource resolve(String identifier) {
- if (identifier.endsWith(".css")) {
- // CSS support mainly for testing, don't load from classpath etc
- ScssStylesheetResolver resolver = new FilesystemResolver();
- return resolver.resolve(identifier);
- }
-
- InputSource source = null;
-
- Pattern pattern = Pattern
- .compile("\\.\\.\\/([^\\/]+)\\/([^\\/]+\\.scss)");
- Matcher matcher = pattern.matcher(identifier);
-
- if (matcher.find()) {
- // theme include
- ScssStylesheetResolver resolver = new FilesystemResolver();
- source = resolver.resolve(identifier);
-
- if (source == null) {
- String themeName = matcher.group(1);
- String fileName = matcher.group(2);
- resolver = new ClassloaderResolver();
- String id = "VAADIN/themes/" + themeName + "/" + fileName;
- source = resolver.resolve(id);
- }
-
- } else {
- ScssStylesheetResolver resolver = new FilesystemResolver();
- source = resolver.resolve(identifier);
-
- if (source == null) {
- resolver = new ClassloaderResolver();
- source = resolver.resolve(identifier);
- }
- }
-
- return source;
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.selector;
-
-import org.w3c.css.sac.Selector;
-
-public class CompositeSelector implements Selector {
- public static final short SCSS_COMPOSITE_SELECTOR = 100;
- private Selector first;
- private Selector second;
-
- public CompositeSelector(Selector first, Selector second) {
- this.first = first;
- this.second = second;
- }
-
- public Selector getFirst() {
- return first;
- }
-
- public Selector getSecond() {
- return second;
- }
-
- @Override
- public short getSelectorType() {
- return SCSS_COMPOSITE_SELECTOR;
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.selector;
-
-import org.w3c.css.sac.CombinatorCondition;
-import org.w3c.css.sac.Condition;
-import org.w3c.css.sac.ConditionFactory;
-import org.w3c.css.sac.ConditionalSelector;
-import org.w3c.css.sac.DescendantSelector;
-import org.w3c.css.sac.ElementSelector;
-import org.w3c.css.sac.Selector;
-import org.w3c.css.sac.SelectorFactory;
-import org.w3c.css.sac.SelectorList;
-import org.w3c.css.sac.SiblingSelector;
-import org.w3c.css.sac.SimpleSelector;
-import org.w3c.flute.parser.selectors.AndConditionImpl;
-import org.w3c.flute.parser.selectors.AttributeConditionImpl;
-import org.w3c.flute.parser.selectors.ChildSelectorImpl;
-import org.w3c.flute.parser.selectors.ClassConditionImpl;
-import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
-import org.w3c.flute.parser.selectors.DirectAdjacentSelectorImpl;
-import org.w3c.flute.parser.selectors.ElementSelectorImpl;
-import org.w3c.flute.parser.selectors.IdConditionImpl;
-import org.w3c.flute.parser.selectors.PseudoClassConditionImpl;
-import org.w3c.flute.parser.selectors.PseudoElementSelectorImpl;
-import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
-
-import com.vaadin.sass.parser.SelectorListImpl;
-
-public class SelectorUtil {
-
- public static String toString(CompositeSelector compositeSelector) {
- StringBuilder builder = new StringBuilder();
- if (compositeSelector != null) {
- if (compositeSelector.getFirst() != null) {
- builder.append(toString(compositeSelector.getFirst())).append(
- " ");
- }
- if (compositeSelector.getSecond() != null) {
- builder.append(toString(compositeSelector.getSecond()));
- }
- }
- return builder.toString();
- }
-
- public static String toString(SelectorList selectorList) {
- StringBuilder stringBuilder = new StringBuilder();
- for (int i = 0; i < selectorList.getLength(); i++) {
- String selectorString = toString(selectorList.item(i));
- stringBuilder.append(selectorString);
- if (selectorList.getLength() > i + 1) {
- stringBuilder.append(", ");
- }
- }
- return stringBuilder.toString();
- }
-
- public static String toString(Selector selector) {
- if (selector == null) {
- return "";
- }
- if (selector.getSelectorType() == Selector.SAC_CONDITIONAL_SELECTOR) {
- StringBuilder stringBuilder = new StringBuilder();
- ConditionalSelector conditionalSelector = (ConditionalSelector) selector;
- String simpleSelectorString = toString(conditionalSelector
- .getSimpleSelector());
- if (simpleSelectorString != null) {
- stringBuilder.append(simpleSelectorString);
- }
- String conditionString = getConditionString(conditionalSelector
- .getCondition());
- stringBuilder.append(conditionString);
- return stringBuilder.toString();
- } else if (selector.getSelectorType() == Selector.SAC_DESCENDANT_SELECTOR) {
- return getDecendantSelectorString((DescendantSelector) selector,
- " ");
- } else if (selector.getSelectorType() == Selector.SAC_CHILD_SELECTOR) {
- DescendantSelector childSelector = (DescendantSelector) selector;
- String seperator = " > ";
- if (childSelector.getSimpleSelector() instanceof PseudoElementSelectorImpl) {
- seperator = "::";
- }
- return getDecendantSelectorString((DescendantSelector) selector,
- seperator);
- } else if (selector.getSelectorType() == Selector.SAC_ELEMENT_NODE_SELECTOR) {
- ElementSelectorImpl elementSelector = (ElementSelectorImpl) selector;
- return elementSelector.getLocalName() == null ? ""
- : elementSelector.getLocalName();
- } else if (selector.getSelectorType() == Selector.SAC_DIRECT_ADJACENT_SELECTOR) {
- DirectAdjacentSelectorImpl directAdjacentSelector = (DirectAdjacentSelectorImpl) selector;
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder
- .append(toString(directAdjacentSelector.getSelector()));
- stringBuilder.append(" + ");
- stringBuilder.append(toString(directAdjacentSelector
- .getSiblingSelector()));
- return stringBuilder.toString();
- } else if (selector.getSelectorType() == Selector.SAC_PSEUDO_ELEMENT_SELECTOR) {
- PseudoElementSelectorImpl pseudoElementSelectorImpl = (PseudoElementSelectorImpl) selector;
- return pseudoElementSelectorImpl.getLocalName();
- } else if (selector.getSelectorType() == CompositeSelector.SCSS_COMPOSITE_SELECTOR) {
- return toString((CompositeSelector) selector);
- } else {
- System.out.println("SU !Unknown selector type, type: "
- + selector.getSelectorType() + ", " + selector.toString());
- }
- return "";
- }
-
- private static String getDecendantSelectorString(
- DescendantSelector selector, String separator) {
- StringBuilder stringBuilder = new StringBuilder();
- String ancestor = toString(selector.getAncestorSelector());
- String simpleSelector = toString(selector.getSimpleSelector());
- stringBuilder.append(ancestor);
- stringBuilder.append(separator);
- stringBuilder.append(simpleSelector);
- return stringBuilder.toString();
- }
-
- private static String getConditionString(Condition condition) {
- short conditionType = condition.getConditionType();
- if (conditionType == Condition.SAC_CLASS_CONDITION) {
- ClassConditionImpl classCondition = (ClassConditionImpl) condition;
- return "." + classCondition.getValue();
- } else if (conditionType == Condition.SAC_ID_CONDITION) {
- IdConditionImpl idCondition = (IdConditionImpl) condition;
- return "#" + idCondition.getValue();
- } else if (conditionType == Condition.SAC_AND_CONDITION) {
- AndConditionImpl andCondition = (AndConditionImpl) condition;
- return getConditionString(andCondition.getFirstCondition())
- + getConditionString(andCondition.getSecondCondition());
- } else if (conditionType == Condition.SAC_ATTRIBUTE_CONDITION) {
- AttributeConditionImpl attributeCondition = (AttributeConditionImpl) condition;
- StringBuilder string = new StringBuilder();
- string.append('[');
- string.append(attributeCondition.getLocalName());
- String value = attributeCondition.getValue();
- if ("true".equals(value) || "false".equals(value)) {
- string.append("=").append(value).append(']');
- } else {
- string.append("=\"");
- string.append(attributeCondition.getValue());
- string.append("\"]");
- }
- return string.toString();
- } else if (conditionType == Condition.SAC_PSEUDO_CLASS_CONDITION) {
- PseudoClassConditionImpl pseudoClassCondition = (PseudoClassConditionImpl) condition;
- return ":" + pseudoClassCondition.getValue();
- } else {
- System.out.println("CU !condition type not identified, type: "
- + conditionType + ", " + condition.toString());
- return "";
- }
- }
-
- public static boolean hasParentSelector(SelectorList selectorList) {
- String selectorString = toString(selectorList);
- return selectorString.contains("&");
- }
-
- public static SelectorList createNewSelectorListFromAnOldOneWithSomPartReplaced(
- SelectorList oldList, String toBeReplacedSelectorName,
- SelectorList candidateSelectorList) throws Exception {
- if (candidateSelectorList.getLength() != 1) {
- throw new Exception("Candidate selector should not be a list");
- }
- if (!(candidateSelectorList.item(0) instanceof SimpleSelector)) {
- throw new Exception(
- "Candidate selector should only be a SimpleSelector");
- }
- SelectorListImpl newSelectorList = new SelectorListImpl();
- SimpleSelector candidateSelector = (SimpleSelector) candidateSelectorList
- .item(0);
- for (int i = 0; i < oldList.getLength(); i++) {
- Selector selector = oldList.item(i);
- newSelectorList.addSelector(createSelectorWithSomePartReplaced(
- selector, toBeReplacedSelectorName, candidateSelector));
- }
- return newSelectorList;
- }
-
- private static Selector createSelectorWithSomePartReplaced(
- Selector selector, String toBeReplacedSelectorName,
- SimpleSelector candidateSelector) {
- if (!toString(selector).contains(toBeReplacedSelectorName)) {
- return selector;
- }
- SelectorFactory factory = new SelectorFactoryImpl();
- if (selector instanceof SimpleSelector) {
- return createSimpleSelectorWithSomePartReplaced(
- (SimpleSelector) selector, toBeReplacedSelectorName,
- candidateSelector);
- } else if (selector instanceof DescendantSelector) {
- DescendantSelector descendantSelector = (DescendantSelector) selector;
- Selector ancestor = descendantSelector.getAncestorSelector();
- SimpleSelector simpleSelector = descendantSelector
- .getSimpleSelector();
- return factory.createDescendantSelector(
- createSelectorWithSomePartReplaced(ancestor,
- toBeReplacedSelectorName, candidateSelector),
- createSimpleSelectorWithSomePartReplaced(simpleSelector,
- toBeReplacedSelectorName, candidateSelector));
- } else if (selector instanceof DirectAdjacentSelectorImpl) {
- SiblingSelector siblingSelector = (SiblingSelector) selector;
- Selector ancestor = siblingSelector.getSelector();
- SimpleSelector simpleSelector = siblingSelector
- .getSiblingSelector();
- return factory.createDirectAdjacentSelector(
- Selector.SAC_DIRECT_ADJACENT_SELECTOR, ancestor,
- simpleSelector);
- } else if (selector instanceof CompositeSelector) {
- CompositeSelector compositeSelector = (CompositeSelector) selector;
- Selector first = compositeSelector.getFirst();
- Selector second = compositeSelector.getSecond();
- return new CompositeSelector(createSelectorWithSomePartReplaced(
- first, toBeReplacedSelectorName, candidateSelector),
- createSelectorWithSomePartReplaced(second,
- toBeReplacedSelectorName, candidateSelector));
- }
- return null;
- }
-
- private static SimpleSelector createSimpleSelectorWithSomePartReplaced(
- SimpleSelector simpleSelector, String toBeReplacedSelectorName,
- SimpleSelector candidateSelector) {
- if (simpleSelector == null
- || !toString(simpleSelector).contains(toBeReplacedSelectorName)) {
- return simpleSelector;
- }
- if (simpleSelector instanceof ElementSelector
- && candidateSelector instanceof ElementSelector) {
- return candidateSelector;
- }
- if (simpleSelector instanceof ConditionalSelector) {
- return createConditionSelectorWithSomePartReplaced(
- (ConditionalSelector) simpleSelector,
- toBeReplacedSelectorName, candidateSelector);
- }
- return simpleSelector;
- }
-
- private static ConditionalSelector createConditionSelectorWithSomePartReplaced(
- ConditionalSelector oldConditionSelector,
- String toBeReplacedSelectorName, SimpleSelector candidateSelector) {
- if (oldConditionSelector == null
- || !toString(oldConditionSelector).contains(
- toBeReplacedSelectorName)) {
- return oldConditionSelector;
- }
- SelectorFactory selectorFactory = new SelectorFactoryImpl();
- if (candidateSelector instanceof ElementSelector) {
- return selectorFactory.createConditionalSelector(candidateSelector,
- oldConditionSelector.getCondition());
- }
- if (candidateSelector instanceof ConditionalSelector) {
- // TODO some cases not covered.
- ConditionalSelector candidateConditionSelector = (ConditionalSelector) candidateSelector;
- Condition newCondition = createConditionWithSomePartReplaced(
- oldConditionSelector.getCondition(),
- toBeReplacedSelectorName,
- candidateConditionSelector.getCondition());
- return selectorFactory.createConditionalSelector(
- oldConditionSelector.getSimpleSelector(), newCondition);
- }
- return oldConditionSelector;
- }
-
- private static Condition createConditionWithSomePartReplaced(
- Condition oldCondition, String toBeReplaced, Condition candidate) {
- if (oldCondition == null
- || !getConditionString(oldCondition).contains(toBeReplaced)) {
- return oldCondition;
- }
- if (oldCondition.getConditionType() == Condition.SAC_AND_CONDITION) {
- ConditionFactory conditionFactory = new ConditionFactoryImpl();
- CombinatorCondition oldCombinatorCondition = (CombinatorCondition) oldCondition;
- Condition newFirstCondition = createConditionWithSomePartReplaced(
- oldCombinatorCondition.getFirstCondition(), toBeReplaced,
- candidate);
- Condition newSecondCondition = createConditionWithSomePartReplaced(
- oldCombinatorCondition.getSecondCondition(), toBeReplaced,
- candidate);
- return conditionFactory.createAndCondition(newFirstCondition,
- newSecondCondition);
- } else {
- return candidate;
- }
- }
-
- public static boolean equals(Selector one, Selector another) {
- return one == null ? another == null : toString(one).equals(
- toString(another));
- }
-
- public static Selector createSelectorAndreplaceSelectorVariableWithValue(
- Selector selector, String variable, String value) throws Exception {
-
- SelectorFactoryImpl factory = new SelectorFactoryImpl();
-
- ElementSelector es = factory.createElementSelector(
- null,
- ((ElementSelector) selector).getLocalName().replaceAll(
- variable, value));
-
- if (selector instanceof ConditionalSelector) {
- return factory.createConditionalSelector(es,
- ((ConditionalSelector) selector).getCondition());
- } else if (selector instanceof DescendantSelector) {
- return factory.createDescendantSelector(es,
- ((DescendantSelector) selector).getSimpleSelector());
- } else if (selector instanceof ChildSelectorImpl) {
- return factory.createChildSelector(es,
- ((DescendantSelector) selector).getSimpleSelector());
- } else {
- throw new Exception("Invalid selector type");
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.visitor.BlockNodeHandler;
-
-public class BlockNode extends Node implements IVariableNode {
-
- private static final long serialVersionUID = 5742962631468325048L;
-
- ArrayList<String> selectorList;
-
- public BlockNode(ArrayList<String> selectorList) {
- this.selectorList = selectorList;
- }
-
- public ArrayList<String> getSelectorList() {
- return selectorList;
- }
-
- public void setSelectorList(ArrayList<String> selectorList) {
- this.selectorList = selectorList;
- }
-
- public String toString(boolean indent) {
- StringBuilder string = new StringBuilder();
- int i = 0;
- for (final String s : selectorList) {
- string.append(s);
- if (i != selectorList.size() - 1) {
- string.append(", ");
- }
- i++;
- }
- string.append(" {\n");
- for (Node child : children) {
- if (indent) {
- string.append("\t");
- }
- string.append("\t" + child.toString() + "\n");
- }
- if (indent) {
- string.append("\t");
- }
- string.append("}");
- return string.toString();
- }
-
- @Override
- public String toString() {
- return toString(false);
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
-
- if (selectorList == null || selectorList.isEmpty()) {
- return;
- }
-
- for (final VariableNode var : variables) {
- for (final String selector : new ArrayList<String>(selectorList)) {
- String interpolation = "#{$" + var.getName() + "}";
- if (selector.contains(interpolation)) {
- String replace = selector.replace(interpolation, var
- .getExpr().toString());
- selectorList.add(selectorList.indexOf(selector), replace);
- selectorList.remove(selector);
- }
- }
- }
- }
-
- public String getSelectors() {
- StringBuilder b = new StringBuilder();
- for (final String s : selectorList) {
- b.append(s);
- }
-
- return b.toString();
- }
-
- public void setParentNode(Node node) {
- parentNode.removeChild(this);
- node.appendChild(this);
- }
-
- @Override
- public void traverse() {
- try {
- BlockNodeHandler.traverse(this);
- replaceVariables(ScssStylesheet.getVariables());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-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;
- }
-
- @Override
- public void traverse() {
- // Not used in CommentNode
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.visitor.ExtendNodeHandler;
-
-public class ExtendNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 3301805078983796878L;
-
- ArrayList<String> list;
-
- public ExtendNode(ArrayList<String> list) {
- super();
- this.list = list;
- }
-
- public ArrayList<String> getList() {
- return list;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
-
- }
-
- public String getListAsString() {
- StringBuilder b = new StringBuilder();
- for (final String s : list) {
- b.append(s);
- }
-
- return b.toString();
- }
-
- @Override
- public void traverse() {
- try {
- ExtendNodeHandler.traverse(this);
- getParentNode().removeChild(this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-public class FontFaceNode extends Node {
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("@font-face {\n");
-
- for (final Node child : children) {
- builder.append("\t" + child.toString() + "\n");
- }
-
- builder.append("}");
- return builder.toString();
- }
-
- @Override
- public void traverse() {
- // Not in use for FontFaceNode
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-public class ForNode extends Node {
- private static final long serialVersionUID = -1159180539216623335L;
-
- String var;
- String from;
- String to;
- boolean exclusive;
- String body;
-
- public ForNode(String var, String from, String to, boolean exclusive,
- String body) {
- super();
- this.var = var;
- this.from = from;
- this.to = to;
- this.exclusive = exclusive;
- this.body = body;
- }
-
- @Override
- public String toString() {
- return "For Node: " + "{variable: " + var + ", from:" + from + ", to: "
- + to + ", exclusive: " + exclusive + ", body" + body;
- }
-
- @Override
- public void traverse() {
-
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-
-public class FunctionNode extends Node implements IVariableNode {
- private static final long serialVersionUID = -5383104165955523923L;
-
- private String name;
- private String args;
- private String body;
-
- public FunctionNode(String name) {
- super();
- this.name = name;
- }
-
- public FunctionNode(String name, String args, String body) {
- this.name = name;
- this.args = args;
- this.body = body;
- }
-
- @Override
- public String toString() {
- return "Function Node: {name: " + name + ", args: " + args + ", body: "
- + body + "}";
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode node : variables) {
- if (args.contains(node.getName())) {
- args.replaceAll(node.getName(), node.getExpr().toString());
- }
- }
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- }
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-public interface IVariableNode {
-
- public void replaceVariables(ArrayList<VariableNode> variables);
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import org.w3c.css.sac.SACMediaList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.visitor.ImportNodeHandler;
-
-public class ImportNode extends Node {
- private static final long serialVersionUID = 5671255892282668438L;
-
- private String uri;
- private SACMediaList ml;
- private boolean isURL;
-
- public ImportNode(String uri, SACMediaList ml, boolean isURL) {
- super();
- this.uri = uri;
- this.ml = ml;
- this.isURL = isURL;
- }
-
- public boolean isPureCssImport() {
- return (isURL || uri.endsWith(".css") || uri.startsWith("http://") || hasMediaQueries());
- }
-
- private boolean hasMediaQueries() {
- return (ml != null && ml.getLength() >= 1 && !"all".equals(ml.item(0)));
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("@import ");
- if (isURL) {
- builder.append("url(").append(uri).append(")");
- } else {
- builder.append("\"").append(uri).append("\"");
- }
- if (hasMediaQueries()) {
- for (int i = 0; i < ml.getLength(); i++) {
- builder.append(" ").append(ml.item(i));
- }
- }
- builder.append(";");
- return builder.toString();
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public SACMediaList getMl() {
- return ml;
- }
-
- @Override
- public void traverse() {
- // TODO shouldn't be reached with current setup, try anyway?
- ImportNodeHandler.traverse((ScssStylesheet) getParentNode());
- }
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-public class ListAppendNode extends ListModifyNode {
-
- public ListAppendNode(String variable, String list, String append,
- String separator) {
- this.variable = variable;
- checkSeparator(separator, list);
- populateList(list, append);
- }
-
- @Override
- protected void modifyList(ArrayList<String> newList) {
- newList.addAll(modify);
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.parser.LexicalUnitImpl;
-
-public class ListContainsNode extends ListModifyNode {
-
- public ListContainsNode(String variable, String list, String contains,
- String separator) {
- this.variable = variable;
- checkSeparator(separator, list);
- populateList(list, contains);
- }
-
- @Override
- protected void modifyList(ArrayList<String> newList) {
- // Does not actually modify the list
- }
-
- @Override
- public VariableNode getModifiedList() {
-
- String contains = "" + list.containsAll(modify);
- VariableNode node = new VariableNode(variable.substring(1),
- LexicalUnitImpl.createString(contains), false);
- return node;
-
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-
-public abstract class ListModifyNode extends Node implements IVariableNode {
-
- protected ArrayList<String> list;
- protected ArrayList<String> modify;
- protected String separator = " ";
- protected String variable;
-
- public String getNewVariable() {
- return variable;
- }
-
- public VariableNode getModifiedList() {
- final ArrayList<String> newList = new ArrayList<String>(list);
- modifyList(newList);
-
- LexicalUnitImpl unit = null;
- if (newList.size() > 0) {
- unit = LexicalUnitImpl.createIdent(newList.get(0));
- LexicalUnitImpl last = unit;
- for (int i = 1; i < newList.size(); i++) {
- LexicalUnitImpl current = LexicalUnitImpl.createIdent(newList
- .get(i));
- last.setNextLexicalUnit(current);
- last = current;
- }
-
- }
- VariableNode node = new VariableNode(variable.substring(1), unit, false);
- return node;
- }
-
- protected abstract void modifyList(ArrayList<String> newList);
-
- protected void checkSeparator(String separator, String list) {
- String lowerCase = "";
- if (separator == null
- || (lowerCase = separator.toLowerCase()).equals("auto")) {
- if (list.contains(",")) {
- this.separator = ",";
- }
- } else if (lowerCase.equals("comma")) {
- this.separator = ",";
- } else if (lowerCase.equals("space")) {
- this.separator = " ";
- }
- }
-
- protected void populateList(String list, String modify) {
- this.list = new ArrayList<String>(Arrays.asList(list.split(separator)));
- this.modify = new ArrayList<String>(Arrays.asList(modify
- .split(separator)));
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final String listVar : new ArrayList<String>(list)) {
- replacePossibleVariable(variables, listVar, list);
- }
-
- for (final String listVar : new ArrayList<String>(modify)) {
- replacePossibleVariable(variables, listVar, modify);
- }
-
- }
-
- private void replacePossibleVariable(ArrayList<VariableNode> variables,
- final String listVar, ArrayList<String> list) {
- if (listVar.startsWith("$")) {
-
- for (final VariableNode var : variables) {
-
- if (var.getName().equals(listVar.substring(1))) {
-
- String[] split = null;
- if (var.getExpr().toString().contains(",")) {
- split = var.getExpr().toString().split(",");
- } else {
- split = var.getExpr().toString().split(" ");
- }
- int i = list.indexOf(listVar);
- for (final String s : split) {
- list.add(i, s.trim());
- i++;
- }
-
- list.remove(listVar);
- break;
-
- }
- }
-
- }
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- ScssStylesheet.addVariable(getModifiedList());
- getParentNode().removeChild(this);
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-public class ListRemoveNode extends ListModifyNode {
-
- public ListRemoveNode(String variable, String list, String remove,
- String separator) {
- this.variable = variable;
- checkSeparator(separator, list);
- populateList(list, remove);
-
- }
-
- @Override
- protected void modifyList(ArrayList<String> newList) {
- newList.removeAll(modify);
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import org.w3c.css.sac.SACMediaList;
-
-public class MediaNode extends Node {
- private static final long serialVersionUID = 2502097081457509523L;
-
- SACMediaList media;
-
- public MediaNode(SACMediaList media) {
- super();
- this.media = media;
- }
-
- public SACMediaList getMedia() {
- return media;
- }
-
- public void setMedia(SACMediaList media) {
- this.media = media;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("@media ");
- if (media != null) {
- for (int i = 0; i < media.getLength(); i++) {
- builder.append(media.item(i));
- }
- }
- builder.append(" {\n");
- for (Node child : children) {
- if (child instanceof BlockNode) {
- builder.append("\t" + ((BlockNode) child).toString(true) + "\n");
- } else {
- builder.append("\t" + child.toString() + "\n");
- }
-
- }
- builder.append("}");
- return builder.toString();
- }
-
- @Override
- public void traverse() {
-
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-
-public class MicrosoftRuleNode extends Node implements IVariableNode {
-
- private final String name;
- private String value;
-
- public MicrosoftRuleNode(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode var : variables) {
- if (value.contains("$" + var.getName())) {
- value = value.replaceAll("$" + var.getName(), var.getExpr()
- .toString());
- }
- }
- }
-
- @Override
- public String toString() {
- return name + ": " + value + ";";
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.util.DeepCopy;
-
-public class MixinDefNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 5469294053247343948L;
-
- private String name;
- private ArrayList<VariableNode> arglist;
- private String body;
-
- public MixinDefNode(String name, Collection<VariableNode> args) {
- super();
- this.name = name;
- arglist = new ArrayList<VariableNode>();
- if (args != null && !args.isEmpty()) {
- arglist.addAll(args);
- }
- }
-
- @Override
- public String toString() {
- return "Mixin Definition Node: {name: " + name + ", args: "
- + arglist.size() + ", body: " + body + "}";
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public ArrayList<VariableNode> getArglist() {
- return arglist;
- }
-
- public void setArglist(ArrayList<VariableNode> arglist) {
- this.arglist = arglist;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode var : variables) {
- for (final VariableNode arg : new ArrayList<VariableNode>(arglist)) {
- if (arg.getName().equals(var.getName())
- && arg.getExpr() == null) {
- arglist.add(arglist.indexOf(arg),
- (VariableNode) DeepCopy.copy(var));
- arglist.remove(arg);
- }
- }
- }
- }
-
- @Override
- public void traverse() {
- if (!arglist.isEmpty()) {
- for (final VariableNode arg : arglist) {
- if (arg.getExpr() != null) {
- ScssStylesheet.addVariable(arg);
- }
- }
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.visitor.MixinNodeHandler;
-
-public class MixinNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 4725008226813110658L;
-
- private String name;
- private ArrayList<LexicalUnitImpl> arglist;
-
- public MixinNode(String name, Collection<LexicalUnitImpl> args) {
- super();
- this.name = name;
- arglist = new ArrayList<LexicalUnitImpl>();
- if (args != null && !args.isEmpty()) {
- arglist.addAll(args);
- }
- }
-
- @Override
- public String toString() {
- return "name: " + name + " args: " + arglist;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public ArrayList<LexicalUnitImpl> getArglist() {
- return arglist;
- }
-
- public void setArglist(ArrayList<LexicalUnitImpl> arglist) {
- this.arglist = arglist;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode var : variables) {
- for (final LexicalUnitImpl arg : new ArrayList<LexicalUnitImpl>(
- arglist)) {
- if (arg.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
- && arg.getStringValue().equals(var.getName())) {
- arg.replaceValue(var.getExpr());
- }
- }
-
- if (name.startsWith("$")) {
- if (name.equals("$" + var.getName())) {
- name = var.getExpr().toString();
- }
- } else if (name.startsWith("#{") && name.endsWith("}")) {
- if (name.equals("#{$" + var.getName() + "}")) {
- name = var.getExpr().toString();
- }
- }
-
- }
- }
-
- @Override
- public void traverse() {
- try {
- replaceVariables(ScssStylesheet.getVariables());
- MixinNodeHandler.traverse(this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import com.vaadin.sass.visitor.NestedNodeHandler;
-
-public class NestPropertiesNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 3671253315690598308L;
-
- public NestPropertiesNode(String name) {
- super();
- this.name = name;
- }
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Collection<RuleNode> unNesting() {
- List<RuleNode> result = new ArrayList<RuleNode>();
- for (Node child : children) {
- RuleNode createNewRuleNodeFromChild = createNewRuleNodeFromChild((RuleNode) child);
- result.add(createNewRuleNodeFromChild);
- }
- return result;
- }
-
- public RuleNode createNewRuleNodeFromChild(RuleNode child) {
- StringBuilder builder = new StringBuilder(name);
- builder.append("-").append(child.getVariable());
- RuleNode newRuleNode = new RuleNode(builder.toString(),
- child.getValue(), child.isImportant(), null);
- return newRuleNode;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode node : variables) {
- if (name.contains(node.getName())) {
- name = name.replaceAll(node.getName(), node.getExpr()
- .toString());
- }
- }
- }
-
- @Override
- public void traverse() {
- NestedNodeHandler.traverse(this);
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-
-public abstract class Node implements Serializable {
- private static final long serialVersionUID = 5914711715839294816L;
-
- protected ArrayList<Node> children;
-
- protected Node parentNode;
-
- public Node() {
- children = new ArrayList<Node>();
- }
-
- public void appendAll(Collection<Node> nodes) {
- if (nodes != null && !nodes.isEmpty()) {
- children.addAll(nodes);
-
- for (final Node n : nodes) {
- if (n.getParentNode() != null) {
- n.getParentNode().removeChild(n);
- }
- n.setParentNode(this);
- }
-
- }
- }
-
- public void appendChild(Node node) {
- if (node != null) {
- children.add(node);
- if (node.getParentNode() != null) {
- node.getParentNode().removeChild(node);
- }
- node.setParentNode(this);
- }
- }
-
- public void appendChild(Node node, Node after) {
- if (node != null) {
- int index = children.indexOf(after);
- if (index != -1) {
- children.add(index + 1, node);
- if (node.getParentNode() != null) {
- node.getParentNode().removeChild(node);
- }
- node.setParentNode(this);
- } else {
- throw new NullPointerException("after-node was not found");
- }
- }
- }
-
- public void removeChild(Node node) {
- if (node != null) {
- boolean removed = children.remove(node);
- if (removed) {
- node.setParentNode(null);
- }
- }
- }
-
- public ArrayList<Node> getChildren() {
- return children;
- }
-
- public void setChildren(ArrayList<Node> children) {
- this.children = children;
- }
-
- public boolean hasChildren() {
- return !children.isEmpty();
- }
-
- @Override
- public String toString() {
- return "";
- }
-
- /**
- * Method for manipulating the data contained within the {@link Node}.
- *
- * Traversing a node is allowed to modify the node, replace it with one or
- * more nodes at the same or later position in its parent and modify the
- * children of the node, but not modify or remove preceding nodes in its
- * parent.
- */
- public abstract void traverse();
-
- public Node getParentNode() {
- return parentNode;
- }
-
- private void setParentNode(Node parentNode) {
- this.parentNode = parentNode;
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-
-public class RuleNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 6653493127869037022L;
-
- String variable;
- LexicalUnitImpl value;
- String comment;
- private boolean important;
-
- public RuleNode(String variable, LexicalUnitImpl value, boolean important,
- String comment) {
- this.variable = variable;
- this.value = value;
- this.important = important;
- this.comment = comment;
- }
-
- public String getVariable() {
- return variable;
- }
-
- public void setVariable(String variable) {
- this.variable = variable;
- }
-
- public LexicalUnitImpl getValue() {
- return value;
- }
-
- public void setValue(LexicalUnitImpl value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append(variable).append(": ").append(value.toString());
- builder.append(important ? " !important;" : ";");
- if (comment != null) {
- builder.append(comment);
- }
- return builder.toString();
- }
-
- public boolean isImportant() {
- return important;
- }
-
- public void setImportant(boolean important) {
- this.important = important;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode node : variables) {
-
- String interpolation = "#{$" + node.getName() + "}";
-
- if (value.getLexicalUnitType() == LexicalUnitImpl.SAC_FUNCTION) {
-
- if (value.getParameters() != null) {
- if (value.getParameters().toString()
- .contains(node.getName())) {
-
- LexicalUnitImpl param = value.getParameters();
- while (param != null) {
- if (param.getValue().toString()
- .contains(node.getName())) {
-
- String value = node.getExpr().toString();
-
- LexicalUnitImpl prev = param
- .getPreviousLexicalUnit();
- LexicalUnitImpl next = param
- .getNextLexicalUnit();
-
- if (param.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) {
- param.setStringValue(value);
- param.setLexicalUnitType(node.getExpr()
- .getLexicalUnitType());
- param.setPrevLexicalUnit(prev);
- param.setNextLexicalUnit(next);
- }
- }
- param = param.getNextLexicalUnit();
- }
- }
- }
- } else if (value.getStringValue() != null
- && value.getStringValue().contains(interpolation)) {
- LexicalUnitImpl current = value;
- while (current != null) {
- if (current.getValue().toString().contains(interpolation)) {
-
- current.setStringValue(current
- .getValue()
- .toString()
- .replaceAll(Pattern.quote(interpolation),
- node.getExpr().toString()));
- }
- current = current.getNextLexicalUnit();
- }
- } else {
- LexicalUnitImpl current = value;
- while (current != null) {
- if (current.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
- && current.getValue().toString()
- .equals(node.getName())) {
-
- current.replaceValue(node.getExpr());
- }
- current = current.getNextLexicalUnit();
- }
- }
- }
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- }
-}
+++ /dev/null
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-
-/**
- * A simple BlockNode where input text equals output. <b>Note : </b> ignores any
- * possible children so only use it when you are sure no child nodes will be
- * applied.
- *
- * @author Sebastian Nyholm @ Vaadin Ltd
- *
- */
-public class SimpleNode extends Node implements IVariableNode {
-
- private String text;
-
- public SimpleNode(String text) {
- this.text = text;
-
- }
-
- @Override
- public String toString() {
- return text;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode node : variables) {
- if (text.contains(node.getName())) {
- text = text.replaceAll(node.getName(), node.getExpr()
- .toString());
- }
- }
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.visitor.VariableNodeHandler;
-
-public class VariableNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 7003372557547748734L;
-
- private String name;
- private LexicalUnitImpl expr;
- private boolean guarded;
-
- public VariableNode(String name, LexicalUnitImpl expr, boolean guarded) {
- super();
- this.name = name;
- this.expr = expr;
- this.guarded = guarded;
- }
-
- public LexicalUnitImpl getExpr() {
- return expr;
- }
-
- public void setExpr(LexicalUnitImpl expr) {
- this.expr = expr;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isGuarded() {
- return guarded;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("$");
- builder.append(name).append(": ").append(expr);
- return builder.toString();
- }
-
- public void setGuarded(boolean guarded) {
- this.guarded = guarded;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode node : variables) {
- if (!equals(node)) {
-
- if (expr.toString().contains("$" + node.getName())) {
- if (expr.getParameters() != null
- && expr.getParameters().toString()
- .contains("$" + node.getName())) {
- replaceValues(expr.getParameters(), node);
- } else if (expr.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) {
- replaceValues(expr, node);
- }
- }
- }
- }
- }
-
- private void replaceValues(LexicalUnitImpl unit, VariableNode node) {
- while (unit != null) {
-
- if (unit.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
- && unit.getValue().toString().equals(node.getName())) {
- LexicalUnitImpl.replaceValues(unit, node.getExpr());
- }
-
- unit = unit.getNextLexicalUnit();
- }
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- VariableNodeHandler.traverse(this);
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree;
-
-public class WhileNode extends Node {
- private static final long serialVersionUID = 7593896018196027279L;
-
- private String condition;
- private String body;
-
- public WhileNode(String condition, String body) {
- this.condition = condition;
- this.body = body;
- }
-
- @Override
- public String toString() {
- return "While Node: { condition: " + condition + ", body:" + body + "}";
- }
-
- @Override
- public void traverse() {
-
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.tree.controldirective;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.tree.IVariableNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.VariableNode;
-import com.vaadin.sass.visitor.EachNodeHandler;
-
-public class EachDefNode extends Node implements IVariableNode {
- private static final long serialVersionUID = 7943948981204906221L;
-
- private String var;
- private ArrayList<String> list;
-
- private String listVariable;
-
- public EachDefNode(String var, ArrayList<String> list) {
- super();
- this.var = var;
- this.list = list;
- }
-
- public EachDefNode(String var, String listVariable) {
- this.var = var;
- this.listVariable = listVariable;
- }
-
- public List<String> getVariables() {
- return list;
- }
-
- public String getVariableName() {
- return var;
- }
-
- @Override
- public String toString() {
- if (hasListVariable()) {
- return "Each Definition Node: {variable : " + var + ", "
- + "listVariable : " + listVariable + "}";
- } else {
- return "Each Definition Node: {variable : " + var + ", "
- + "children : " + list.size() + "}";
- }
- }
-
- public boolean hasListVariable() {
- return listVariable != null;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- if (listVariable != null) {
- for (final VariableNode var : variables) {
- if (listVariable.equals(var.getName())) {
-
- LexicalUnitImpl current = var.getExpr();
- list = new ArrayList<String>();
-
- while (current != null) {
- if (current.getValue() != null
- && current.getLexicalUnitType() != LexicalUnitImpl.SAC_OPERATOR_COMMA) {
- list.add(current.getValue().toString());
- }
- current = current.getNextLexicalUnit();
- }
- listVariable = null;
- break;
- }
- }
-
- }
- }
-
- public String getListVariable() {
- return listVariable;
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- EachNodeHandler.traverse(this);
- }
-}
+++ /dev/null
-package com.vaadin.sass.tree.controldirective;
-
-import com.vaadin.sass.tree.Node;
-
-public class ElseNode extends Node implements IfElseNode {
-
- @Override
- public String getExpression() {
- return null;
- }
-
- @Override
- public void traverse() {
-
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.tree.controldirective;
-
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.visitor.IfElseNodeHandler;
-
-public class IfElseDefNode extends Node {
-
- @Override
- public String toString() {
- StringBuilder b = new StringBuilder();
- for (final Node child : getChildren()) {
- b.append(child.toString());
- b.append("\n");
- }
- return b.toString();
- }
-
- @Override
- public void traverse() {
- try {
-
- for (final Node child : children) {
- child.traverse();
- }
-
- IfElseNodeHandler.traverse(this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
+++ /dev/null
-package com.vaadin.sass.tree.controldirective;
-
-public interface IfElseNode {
-
- String getExpression();
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.sass.tree.controldirective;
-
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.tree.IVariableNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.VariableNode;
-
-public class IfNode extends Node implements IfElseNode, IVariableNode {
- private String expression;
-
- public IfNode(String expression) {
- this.expression = expression;
- }
-
- @Override
- public String getExpression() {
- if (expression != null) {
- return expression.trim();
- } else {
- return "false";
- }
- }
-
- @Override
- public String toString() {
- return "@if" + expression;
- }
-
- @Override
- public void replaceVariables(ArrayList<VariableNode> variables) {
- for (final VariableNode node : variables) {
- String variable = "$" + node.getName();
- if (expression.contains(variable)) {
- expression = expression.replaceAll(Pattern.quote(variable),
- node.getExpr().toString());
- }
- }
- }
-
- @Override
- public void traverse() {
- replaceVariables(ScssStylesheet.getVariables());
- }
-
-}
\ No newline at end of file
+++ /dev/null
-package com.vaadin.sass.util;
-
-public interface Clonable {
-
- public Object clone() throws CloneNotSupportedException;
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.util;
-
-import org.w3c.css.sac.LexicalUnit;
-
-import com.vaadin.sass.parser.LexicalUnitImpl;
-
-public class ColorUtil {
- public static LexicalUnitImpl hexColorToHsl(LexicalUnitImpl hexColor) {
- String s = hexColor.getStringValue().substring(1);
- int r = 0, g = 0, b = 0;
- if (s.length() == 3) {
- String sh = s.substring(0, 1);
- r = Integer.parseInt(sh + sh, 16);
- sh = s.substring(1, 2);
- g = Integer.parseInt(sh + sh, 16);
- sh = s.substring(2, 3);
- b = Integer.parseInt(sh + sh, 16);
- } else if (s.length() == 6) {
- r = Integer.parseInt(s.substring(0, 2), 16);
- g = Integer.parseInt(s.substring(2, 4), 16);
- b = Integer.parseInt(s.substring(4, 6), 16);
- }
- int hsl[] = calculateHsl(r, g, b);
-
- LexicalUnitImpl hslParams = createHslParameters(hsl[0], hsl[1], hsl[2],
- hexColor.getLineNumber(), hexColor.getColumnNumber(),
- hexColor.getPreviousLexicalUnit());
-
- return LexicalUnitImpl.createFunction(hexColor.getLineNumber(),
- hexColor.getColumnNumber(), hexColor.getPreviousLexicalUnit(),
- "hsl", hslParams);
- }
-
- public static LexicalUnitImpl hslToHexColor(LexicalUnitImpl hsl, int lengh) {
- int[] rgb = calculateRgb(hsl);
- StringBuilder builder = new StringBuilder("#");
- for (int i = 0; i < 3; i++) {
- String color = Integer.toHexString(rgb[i]);
- if (lengh == 6) {
- if (color.length() == 1) {
- color = "0" + color;
- }
- }
- if (lengh == 3) {
- color = color.substring(0, 1);
- }
- builder.append(color);
- }
- return LexicalUnitImpl.createIdent(hsl.getLineNumber(),
- hsl.getColumnNumber(), hsl.getPreviousLexicalUnit(),
- builder.toString());
- }
-
- private static int[] calculateRgb(LexicalUnitImpl hsl) {
- LexicalUnitImpl hslParam = hsl.getParameters();
- LexicalUnitImpl hue = null;
- LexicalUnitImpl saturation = null;
- LexicalUnitImpl lightness = null;
- int i = 0;
- while (i < 5) {
- switch (i) {
- case 0:
- hue = hslParam;
- break;
- case 2:
- saturation = hslParam;
- break;
- case 4:
- lightness = hslParam;
- break;
- case 1:
- case 3:
- break;
- }
- hslParam = hslParam.getNextLexicalUnit();
- i++;
- }
- float h = ((hue.getIntegerValue() % 360) + 360) % 360 / 360f;
- float s = saturation.getFloatValue() / 100;
- float l = lightness.getFloatValue() / 100;
- float m2, m1;
- int[] rgb = new int[3];
- m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
- m1 = l * 2 - m2;
- rgb[0] = Math.round(hueToRgb(m1, m2, h + 1f / 3) * 255);
- rgb[1] = Math.round(hueToRgb(m1, m2, h) * 255);
- rgb[2] = Math.round(hueToRgb(m1, m2, h - 1f / 3) * 255);
- return rgb;
- }
-
- public static LexicalUnitImpl rgbToHsl(LexicalUnitImpl rgb) {
- LexicalUnitImpl rgbParam = rgb.getParameters();
- LexicalUnitImpl red = null;
- LexicalUnitImpl green = null;
- LexicalUnitImpl blue = null;
- int i = 0;
- while (i < 5) {
- switch (i) {
- case 0:
- red = rgbParam;
- break;
- case 2:
- green = rgbParam;
- break;
- case 4:
- blue = rgbParam;
- break;
- case 1:
- case 3:
- break;
- }
- rgbParam = rgbParam.getNextLexicalUnit();
- i++;
- }
-
- int hsl[] = calculateHsl(red.getIntegerValue(),
- green.getIntegerValue(), blue.getIntegerValue());
-
- rgbParam = rgb.getParameters();
-
- LexicalUnitImpl hslParams = createHslParameters(hsl[0], hsl[1], hsl[2],
- rgbParam.getLineNumber(), rgbParam.getColumnNumber(),
- rgbParam.getPreviousLexicalUnit());
-
- return LexicalUnitImpl.createFunction(rgb.getLineNumber(),
- rgb.getColumnNumber(), rgb.getPreviousLexicalUnit(), "hsl",
- hslParams);
- }
-
- private static int[] calculateHsl(int red, int green, int blue) {
- int[] hsl = new int[3];
-
- float r = red / 255f;
- float g = green / 255f;
- float b = blue / 255f;
-
- float max = Math.max(Math.max(r, g), b);
- float min = Math.min(Math.min(r, g), b);
- float d = max - min;
-
- float h = 0f, s = 0f, l = 0f;
-
- if (max == min) {
- h = 0;
- }
- if (max == r) {
- h = 60 * (g - b) / d;
- } else if (max == g) {
- h = 60 * (b - r) / d + 120;
- } else if (max == b) {
- h = 60 * (r - g) / d + 240;
- }
-
- l = (max + min) / 2f;
-
- if (max == min) {
- s = 0;
- } else if (l < 0.5) {
- s = d / (2 * l);
- } else {
- s = d / (2 - 2 * l);
- }
-
- hsl[0] = Math.round(h % 360);
- hsl[1] = Math.round(s * 100);
- hsl[2] = Math.round(l * 100);
-
- return hsl;
- }
-
- public static LexicalUnitImpl hslToRgb(LexicalUnitImpl hsl) {
- int[] rgb = calculateRgb(hsl);
- LexicalUnitImpl hslParam = hsl.getParameters();
- LexicalUnitImpl rgbParams = createRgbParameters(rgb[0], rgb[1], rgb[2],
- hslParam.getLineNumber(), hslParam.getColumnNumber(),
- hslParam.getPreviousLexicalUnit());
-
- return LexicalUnitImpl.createFunction(hsl.getLineNumber(),
- hsl.getColumnNumber(), hsl.getPreviousLexicalUnit(), "rgb",
- rgbParams);
- }
-
- private static float hueToRgb(float m1, float m2, float h) {
- if (h < 0) {
- h = h + 1;
- }
- if (h > 1) {
- h = h - 1;
- }
- if (h * 6 < 1) {
- return m1 + (m2 - m1) * h * 6;
- }
- if (h * 2 < 1) {
- return m2;
- }
- if (h * 3 < 2) {
- return m1 + (m2 - m1) * (2f / 3 - h) * 6;
- }
- return m1;
- }
-
- private static LexicalUnitImpl createRgbParameters(int r, int g, int b,
- int ln, int cn, LexicalUnitImpl prev) {
- LexicalUnitImpl red = LexicalUnitImpl.createInteger(ln, cn, prev, r);
- LexicalUnitImpl firstComma = LexicalUnitImpl.createComma(ln, cn, red);
- LexicalUnitImpl green = LexicalUnitImpl.createInteger(ln, cn,
- firstComma, g);
- LexicalUnitImpl secondComma = LexicalUnitImpl
- .createComma(ln, cn, green);
- LexicalUnitImpl.createInteger(ln, cn, secondComma, b);
- return red;
- }
-
- private static LexicalUnitImpl createHslParameters(int h, int s, int l,
- int ln, int cn, LexicalUnitImpl prev) {
- LexicalUnitImpl hue = LexicalUnitImpl.createInteger(ln, cn, prev, h);
- LexicalUnitImpl firstComma = LexicalUnitImpl.createComma(ln, cn, hue);
- LexicalUnitImpl saturation = LexicalUnitImpl.createPercentage(ln, cn,
- firstComma, s);
- LexicalUnitImpl secondComma = LexicalUnitImpl.createComma(ln, cn,
- saturation);
- LexicalUnitImpl.createPercentage(ln, cn, secondComma, l);
- return hue;
- }
-
- public static LexicalUnitImpl darken(LexicalUnitImpl darkenFunc) {
- LexicalUnitImpl color = darkenFunc.getParameters();
- float amount = getAmountValue(color);
- LexicalUnitImpl pre = darkenFunc.getPreviousLexicalUnit();
-
- return adjust(color, amount, ColorOperation.Darken, pre);
- }
-
- private static LexicalUnitImpl adjust(LexicalUnitImpl color,
- float amountByPercent, ColorOperation op, LexicalUnitImpl pre) {
- if (color.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION) {
- LexicalUnit funcParam = color.getParameters();
- if ("hsl".equals(color.getFunctionName())) {
- LexicalUnit lightness = funcParam;
- for (int index = 0; index < 4; index++) {
- lightness = lightness.getNextLexicalUnit();
- }
- float newValue = 0f;
- if (op == ColorOperation.Darken) {
- newValue = lightness.getFloatValue() - amountByPercent;
- newValue = newValue < 0 ? 0 : newValue;
- } else if (op == ColorOperation.Lighten) {
- newValue = lightness.getFloatValue() + amountByPercent;
- newValue = newValue > 100 ? 100 : newValue;
- }
- ((LexicalUnitImpl) lightness).setFloatValue(newValue);
- return LexicalUnitImpl.createFunction(color.getLineNumber(),
- color.getColumnNumber(), pre, color.getFunctionName(),
- funcParam);
- }
-
- } else if (color.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
- if (color.getStringValue().startsWith("#")) {
- return hslToHexColor(
- adjust(hexColorToHsl(color), amountByPercent, op, pre),
- color.getStringValue().substring(1).length());
- }
- } else if (color.getLexicalUnitType() == LexicalUnit.SAC_RGBCOLOR) {
- LexicalUnitImpl hsl = rgbToHsl(color);
- LexicalUnitImpl hslAfterDarken = adjust(hsl, amountByPercent, op,
- pre);
- return hslToRgb(hslAfterDarken);
- }
- return color;
- }
-
- public static LexicalUnitImpl lighten(LexicalUnitImpl lightenFunc) {
- LexicalUnitImpl color = lightenFunc.getParameters();
- float amount = getAmountValue(color);
- LexicalUnitImpl pre = lightenFunc.getPreviousLexicalUnit();
-
- return adjust(color, amount, ColorOperation.Lighten, pre);
- }
-
- private static float getAmountValue(LexicalUnitImpl color) {
- LexicalUnit next = color.getNextLexicalUnit();
- float amount = 10f;
- if (next != null && next.getNextLexicalUnit() != null) {
- next = next.getNextLexicalUnit();
- amount = next.getFloatValue();
- }
- return amount;
- }
-
- enum ColorOperation {
- Darken, Lighten
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.util;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- * Utility for making deep copies (vs. clone()'s shallow copies) of objects.
- * Objects are first serialized and then deserialized. Error checking is fairly
- * minimal in this implementation. If an object is encountered that cannot be
- * serialized (or that references an object that cannot be serialized) an error
- * is printed to System.err and null is returned. Depending on your specific
- * application, it might make more sense to have copy(...) re-throw the
- * exception.
- */
-public class DeepCopy {
-
- /**
- * Returns a copy of the object, or null if the object cannot be serialized.
- */
- public static Object copy(Object orig) {
-
- Object obj = null;
- if (!(orig instanceof Clonable)) {
- try {
- // Write the object out to a byte array
- FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(fbos);
- out.writeObject(orig);
- out.flush();
- out.close();
-
- // Retrieve an input stream from the byte array and read
- // a copy of the object back in.
- ObjectInputStream in = new ObjectInputStream(
- fbos.getInputStream());
- obj = in.readObject();
- in.close();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException cnfe) {
- cnfe.printStackTrace();
- }
- return obj;
- } else {
- try {
- obj = ((Clonable) orig).clone();
- } catch (ClassCastException e2) {
- // Can't clone, return obj as null
- } catch (CloneNotSupportedException e2) {
- // Can't clone, return obj as null
- }
- return obj;
- }
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.util;
-
-import java.io.InputStream;
-
-/**
- * ByteArrayInputStream implementation that does not synchronize methods.
- */
-public class FastByteArrayInputStream extends InputStream {
- /**
- * Our byte buffer
- */
- protected byte[] buf = null;
-
- /**
- * Number of bytes that we can read from the buffer
- */
- protected int count = 0;
-
- /**
- * Number of bytes that have been read from the buffer
- */
- protected int pos = 0;
-
- public FastByteArrayInputStream(byte[] buf, int count) {
- this.buf = buf;
- this.count = count;
- }
-
- @Override
- public final int available() {
- return count - pos;
- }
-
- @Override
- public final int read() {
- return (pos < count) ? (buf[pos++] & 0xff) : -1;
- }
-
- @Override
- public final int read(byte[] b, int off, int len) {
- if (pos >= count) {
- return -1;
- }
-
- if ((pos + len) > count) {
- len = (count - pos);
- }
-
- System.arraycopy(buf, pos, b, off, len);
- pos += len;
- return len;
- }
-
- @Override
- public final long skip(long n) {
- if ((pos + n) > count) {
- n = count - pos;
- }
- if (n < 0) {
- return 0;
- }
- pos += n;
- return n;
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.util;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * ByteArrayOutputStream implementation that doesn't synchronize methods and
- * doesn't copy the data on toByteArray().
- */
-public class FastByteArrayOutputStream extends OutputStream {
- /**
- * Buffer and size
- */
- protected byte[] buf = null;
- protected int size = 0;
-
- /**
- * Constructs a stream with buffer capacity size 5K
- */
- public FastByteArrayOutputStream() {
- this(5 * 1024);
- }
-
- /**
- * Constructs a stream with the given initial size
- */
- public FastByteArrayOutputStream(int initSize) {
- size = 0;
- buf = new byte[initSize];
- }
-
- /**
- * Ensures that we have a large enough buffer for the given size.
- */
- private void verifyBufferSize(int sz) {
- if (sz > buf.length) {
- byte[] old = buf;
- buf = new byte[Math.max(sz, 2 * buf.length)];
- System.arraycopy(old, 0, buf, 0, old.length);
- old = null;
- }
- }
-
- public int getSize() {
- return size;
- }
-
- /**
- * Returns the byte array containing the written data. Note that this array
- * will almost always be larger than the amount of data actually written.
- */
- public byte[] getByteArray() {
- return buf;
- }
-
- @Override
- public final void write(byte b[]) {
- verifyBufferSize(size + b.length);
- System.arraycopy(b, 0, buf, size, b.length);
- size += b.length;
- }
-
- @Override
- public final void write(byte b[], int off, int len) {
- verifyBufferSize(size + len);
- System.arraycopy(b, off, buf, size, len);
- size += len;
- }
-
- @Override
- public final void write(int b) {
- verifyBufferSize(size + 1);
- buf[size++] = (byte) b;
- }
-
- public void reset() {
- size = 0;
- }
-
- /**
- * Returns a ByteArrayInputStream for reading back the written data
- */
- public InputStream getInputStream() {
- return new FastByteArrayInputStream(buf, size);
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-public class StringUtil {
- private static final String FOLDER_SEPARATOR = "/"; // folder separator
-
- private static final String WINDOWS_FOLDER_SEPARATOR = "\\"; // Windows
- // folder
- // separator
-
- private static final String TOP_PATH = ".."; // top folder
-
- private static final String CURRENT_PATH = "."; // current folder
-
- public static String cleanPath(String path) {
- String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR,
- FOLDER_SEPARATOR);
- String[] pathArray = delimitedListToStringArray(pathToUse,
- FOLDER_SEPARATOR);
- List pathElements = new LinkedList();
- int tops = 0;
- for (int i = pathArray.length - 1; i >= 0; i--) {
- if (CURRENT_PATH.equals(pathArray[i])) {
- // do nothing
- } else if (TOP_PATH.equals(pathArray[i])) {
- tops++;
- } else {
- if (tops > 0) {
- tops--;
- } else {
- pathElements.add(0, pathArray[i]);
- }
- }
- }
- for (int i = 0; i < tops; i++) {
- pathElements.add(0, TOP_PATH);
- }
- return collectionToDelimitedString(pathElements, FOLDER_SEPARATOR);
- }
-
- public static String replace(String inString, String oldPattern,
- String newPattern) {
- if (inString == null) {
- return null;
- }
- if (oldPattern == null || newPattern == null) {
- return inString;
- }
-
- StringBuffer sbuf = new StringBuffer();
- // output StringBuffer we'll build up
- int pos = 0; // our position in the old string
- int index = inString.indexOf(oldPattern);
- // the index of an occurrence we've found, or -1
- int patLen = oldPattern.length();
- while (index >= 0) {
- sbuf.append(inString.substring(pos, index));
- sbuf.append(newPattern);
- pos = index + patLen;
- index = inString.indexOf(oldPattern, pos);
- }
- sbuf.append(inString.substring(pos));
-
- // remember to append any characters to the right of a match
- return sbuf.toString();
- }
-
- public static String[] delimitedListToStringArray(String str,
- String delimiter) {
- if (str == null) {
- return new String[0];
- }
- if (delimiter == null) {
- return new String[] { str };
- }
-
- List result = new ArrayList();
- int pos = 0;
- int delPos = 0;
- while ((delPos = str.indexOf(delimiter, pos)) != -1) {
- result.add(str.substring(pos, delPos));
- pos = delPos + delimiter.length();
- }
- if (str.length() > 0 && pos <= str.length()) {
- // Add rest of String, but not in case of empty input.
- result.add(str.substring(pos));
- }
-
- return (String[]) result.toArray(new String[result.size()]);
- }
-
- public static String collectionToDelimitedString(Collection coll,
- String delim, String prefix, String suffix) {
- if (coll == null) {
- return "";
- }
-
- StringBuffer sb = new StringBuffer();
- Iterator it = coll.iterator();
- int i = 0;
- while (it.hasNext()) {
- if (i > 0) {
- sb.append(delim);
- }
- sb.append(prefix).append(it.next()).append(suffix);
- i++;
- }
- return sb.toString();
- }
-
- public static String collectionToDelimitedString(Collection coll,
- String delim) {
- return collectionToDelimitedString(coll, delim, "", "");
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.Node;
-
-/**
- * Handle nesting of blocks by moving child blocks to their parent, updating
- * their selector lists while doing so. Also parent selectors (&) are
- * handled here.
- *
- * Sample SASS code (from www.sass-lang.com):
- *
- * <pre>
- * table.hl {
- * margin: 2em 0;
- * td.ln {
- * text-align: right;
- * }
- * }
- * </pre>
- *
- * Note that nested properties are handled by {@link NestedNodeHandler}, not
- * here.
- */
-public class BlockNodeHandler {
-
- public static void traverse(BlockNode node) {
-
- if (node.getChildren().size() == 0) {
- // empty blocks are removed later
- return;
- }
-
- Node parent = node.getParentNode();
-
- if (parent instanceof BlockNode) {
- combineParentSelectorListToChild(node);
-
- } else if (node.getSelectors().contains("&")) {
- ScssStylesheet.warning("Base-level rule contains"
- + " the parent-selector-referencing character '&';"
- + " the character will be removed:\n" + node);
- removeParentReference(node);
- }
- }
-
- /**
- * Goes through the selector list of the given BlockNode and removes the '&'
- * character from the selectors.
- *
- * @param node
- */
- private static void removeParentReference(BlockNode node) {
- ArrayList<String> newList = new ArrayList<String>();
- for (String childSelector : node.getSelectorList()) {
- // remove parent selector
- if (childSelector.contains("&")) {
- newList.add(childSelector.replace("&", ""));
- } else {
- newList.add(childSelector);
- }
- }
- node.setSelectorList(newList);
- }
-
- private static void combineParentSelectorListToChild(BlockNode node) {
- ArrayList<String> newList = new ArrayList<String>();
- BlockNode parentBlock = (BlockNode) node.getParentNode();
- for (String parentSelector : parentBlock.getSelectorList()) {
- for (String childSelector : node.getSelectorList()) {
- // handle parent selector
- if (childSelector.contains("&")) {
- newList.add(childSelector.replace("&", parentSelector));
- } else {
- newList.add(parentSelector + " " + childSelector);
- }
- }
- }
- node.setSelectorList(newList);
- Node oldParent = node.getParentNode();
- HashMap<Node, Node> lastNodeAdded = ScssStylesheet.getLastNodeAdded();
- if (lastNodeAdded.get(oldParent) != null) {
- oldParent.getParentNode().appendChild(node,
- lastNodeAdded.get(oldParent));
- } else {
- oldParent.getParentNode().appendChild(node, oldParent);
- }
-
- lastNodeAdded.put(oldParent, node);
- }
-}
+++ /dev/null
-package com.vaadin.sass.visitor;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.tree.IVariableNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.VariableNode;
-import com.vaadin.sass.tree.controldirective.EachDefNode;
-import com.vaadin.sass.util.DeepCopy;
-
-public class EachNodeHandler {
-
- public static void traverse(EachDefNode node) {
- replaceEachDefNode(node);
- }
-
- private static void replaceEachDefNode(EachDefNode defNode) {
- Node last = defNode;
-
- for (final String var : defNode.getVariables()) {
- VariableNode varNode = new VariableNode(defNode.getVariableName()
- .substring(1), LexicalUnitImpl.createIdent(var), false);
- ArrayList<VariableNode> variables = new ArrayList<VariableNode>(
- ScssStylesheet.getVariables());
- variables.add(varNode);
-
- for (final Node child : defNode.getChildren()) {
-
- Node copy = (Node) DeepCopy.copy(child);
-
- replaceInterpolation(copy, variables);
-
- defNode.getParentNode().appendChild(copy, last);
- last = copy;
- }
-
- }
- defNode.setChildren(new ArrayList<Node>());
- defNode.getParentNode().removeChild(defNode);
- }
-
- private static void replaceInterpolation(Node copy,
- ArrayList<VariableNode> variables) {
- if (copy instanceof IVariableNode) {
- IVariableNode n = (IVariableNode) copy;
- n.replaceVariables(variables);
- }
-
- for (Node c : copy.getChildren()) {
- replaceInterpolation(c, variables);
- }
-
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.ExtendNode;
-import com.vaadin.sass.tree.Node;
-
-public class ExtendNodeHandler {
- private static Map<String, List<ArrayList<String>>> extendsMap = new HashMap<String, List<ArrayList<String>>>();
-
- public static void traverse(ExtendNode node) throws Exception {
- buildExtendsMap(node);
- modifyTree(ScssStylesheet.get());
- }
-
- private static void modifyTree(Node node) throws Exception {
- for (Node child : node.getChildren()) {
- if (child instanceof BlockNode) {
- BlockNode blockNode = (BlockNode) child;
- String selectorString = blockNode.getSelectors();
- if (extendsMap.get(selectorString) != null) {
- for (ArrayList<String> sList : extendsMap
- .get(selectorString)) {
- ArrayList<String> clone = (ArrayList<String>) sList
- .clone();
- addAdditionalSelectorListToBlockNode(blockNode, clone,
- null);
- }
- } else {
- for (Entry<String, List<ArrayList<String>>> entry : extendsMap
- .entrySet()) {
- if (selectorString.contains(entry.getKey())) {
- for (ArrayList<String> sList : entry.getValue()) {
- ArrayList<String> clone = (ArrayList<String>) sList
- .clone();
- addAdditionalSelectorListToBlockNode(blockNode,
- clone, entry.getKey());
- }
- }
- }
- }
- }
- }
-
- }
-
- private static void buildExtendsMap(ExtendNode node) {
- String extendedString = node.getListAsString();
- if (extendsMap.get(extendedString) == null) {
- extendsMap.put(extendedString, new ArrayList<ArrayList<String>>());
- }
- extendsMap.get(extendedString).add(
- ((BlockNode) node.getParentNode()).getSelectorList());
- }
-
- private static void addAdditionalSelectorListToBlockNode(
- BlockNode blockNode, ArrayList<String> list, String selectorString) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- if (selectorString == null) {
- blockNode.getSelectorList().add(list.get(i));
- } else {
- ArrayList<String> newTags = new ArrayList<String>();
- for (final String existing : blockNode.getSelectorList()) {
- if (existing.contains(selectorString)) {
- newTags.add(existing.replace(selectorString,
- list.get(i)));
- }
- }
- blockNode.getSelectorList().addAll(newTags);
- }
- }
- }
- }
-}
+++ /dev/null
-package com.vaadin.sass.visitor;
-
-import java.util.ArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.jexl2.Expression;
-import org.apache.commons.jexl2.JexlEngine;
-import org.apache.commons.jexl2.JexlException;
-import org.w3c.flute.parser.ParseException;
-
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.controldirective.ElseNode;
-import com.vaadin.sass.tree.controldirective.IfElseDefNode;
-import com.vaadin.sass.tree.controldirective.IfElseNode;
-import com.vaadin.sass.tree.controldirective.IfNode;
-
-public class IfElseNodeHandler {
-
- private static final JexlEngine evaluator = new JexlEngine();
- private static final Pattern pattern = Pattern
- .compile("[a-zA-Z0-9]*[a-zA-Z]+[a-zA-Z0-9]*");
-
- public static void traverse(IfElseDefNode node) throws Exception {
-
- for (final Node child : node.getChildren()) {
- if (child instanceof IfNode) {
- try {
- String expression = ((IfElseNode) child).getExpression();
- // We need to add ' ' for strings in the expression for
- // jexl to understand that is should do a string
- // comparison
- expression = replaceStrings(expression);
- Expression e = evaluator.createExpression(expression);
- try {
- Object eval = e.evaluate(null);
-
- Boolean result = false;
- if (eval instanceof Boolean) {
- result = (Boolean) eval;
- } else if (eval instanceof String) {
- result = Boolean.valueOf((String) eval);
- }
-
- if (result) {
- replaceDefNodeWithCorrectChild(node,
- node.getParentNode(), child);
- break;
- }
- } catch (ClassCastException ex) {
- throw new ParseException(
- "Invalid @if/@else in scss file, not a boolean expression : "
- + child.toString());
- } catch (NullPointerException ex) {
- throw new ParseException(
- "Invalid @if/@else in scss file, not a boolean expression : "
- + child.toString());
- }
- } catch (JexlException e) {
- throw new ParseException(
- "Invalid @if/@else in scss file for "
- + child.toString());
- }
- } else {
- if (!(child instanceof ElseNode)
- && node.getChildren().indexOf(child) == node
- .getChildren().size() - 1) {
- throw new ParseException(
- "Invalid @if/@else in scss file for " + node);
- } else {
- replaceDefNodeWithCorrectChild(node, node.getParentNode(),
- child);
- break;
- }
- }
- }
-
- node.getParentNode().removeChild(node);
- }
-
- private static String replaceStrings(String expression) {
- expression = expression.replaceAll("\"", "");
- Matcher m = pattern.matcher(expression);
- StringBuffer b = new StringBuffer();
- while (m.find()) {
- String group = m.group();
- m.appendReplacement(b, "'" + group + "'");
- }
- m.appendTail(b);
- if (b.length() != 0) {
- return b.toString();
- }
- return expression;
- }
-
- private static void replaceDefNodeWithCorrectChild(IfElseDefNode defNode,
- Node parent, final Node child) {
- for (final Node n : new ArrayList<Node>(child.getChildren())) {
- parent.appendChild(n, defNode);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.LexicalUnit;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.tree.ImportNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.RuleNode;
-import com.vaadin.sass.util.StringUtil;
-
-public class ImportNodeHandler {
-
- public static void traverse(ScssStylesheet node) {
- ArrayList<Node> c = new ArrayList<Node>(node.getChildren());
- for (Node n : c) {
- if (n instanceof ImportNode) {
- ImportNode importNode = (ImportNode) n;
- if (!importNode.isPureCssImport()) {
- try {
- StringBuilder filePathBuilder = new StringBuilder(
- node.getFileName());
- filePathBuilder.append(File.separatorChar).append(
- importNode.getUri());
- if (!filePathBuilder.toString().endsWith(".scss")) {
- filePathBuilder.append(".scss");
- }
-
- ScssStylesheet imported = ScssStylesheet
- .get(filePathBuilder.toString());
- if (imported == null) {
- imported = ScssStylesheet.get(importNode.getUri());
- }
- if (imported == null) {
- throw new FileNotFoundException(importNode.getUri()
- + " (parent: "
- + ScssStylesheet.get().getFileName() + ")");
- }
-
- traverse(imported);
-
- String prefix = getUrlPrefix(importNode.getUri());
- if (prefix != null) {
- updateUrlInImportedSheet(imported, prefix);
- }
-
- Node pre = importNode;
- for (Node importedChild : new ArrayList<Node>(
- imported.getChildren())) {
- node.appendChild(importedChild, pre);
- pre = importedChild;
- }
- node.removeChild(importNode);
- } catch (CSSException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- private static String getUrlPrefix(String url) {
- if (url == null) {
- return null;
- }
- int pos = url.lastIndexOf('/');
- if (pos == -1) {
- return null;
- }
- return url.substring(0, pos + 1);
- }
-
- private static void updateUrlInImportedSheet(Node node, String prefix) {
- for (Node child : node.getChildren()) {
- if (child instanceof RuleNode) {
- LexicalUnit value = ((RuleNode) child).getValue();
- while (value != null) {
- if (value.getLexicalUnitType() == LexicalUnit.SAC_URI) {
- String path = value.getStringValue();
- if (!path.startsWith("/") && !path.contains(":")) {
- path = prefix + path;
- path = StringUtil.cleanPath(path);
- ((LexicalUnitImpl) value).setStringValue(path);
- }
- }
- value = value.getNextLexicalUnit();
- }
-
- }
- updateUrlInImportedSheet(child, prefix);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import java.util.ArrayList;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.tree.IVariableNode;
-import com.vaadin.sass.tree.MixinDefNode;
-import com.vaadin.sass.tree.MixinNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.VariableNode;
-import com.vaadin.sass.util.DeepCopy;
-
-public class MixinNodeHandler {
-
- public static void traverse(MixinNode node) throws Exception {
- replaceMixins(node);
- }
-
- private static void replaceMixins(MixinNode node) throws Exception {
- MixinDefNode mixinDef = ScssStylesheet.getMixinDefinition(node
- .getName());
- if (mixinDef == null) {
- throw new Exception("Mixin Definition: " + node.getName()
- + " not found");
- }
- replaceMixinNode(node, mixinDef);
- }
-
- private static void replaceMixinNode(MixinNode mixinNode,
- MixinDefNode mixinDef) {
- Node pre = mixinNode;
-
- MixinDefNode defClone = (MixinDefNode) DeepCopy.copy(mixinDef);
- defClone.traverse();
-
- if (mixinDef.getArglist().isEmpty()) {
- for (Node child : new ArrayList<Node>(defClone.getChildren())) {
- mixinNode.getParentNode().appendChild(child, pre);
- pre = child;
- }
- } else {
-
- replacePossibleArguments(mixinNode, defClone);
-
- Node previous = mixinNode;
- for (final Node child : defClone.getChildren()) {
-
- Node clone = (Node) DeepCopy.copy(child);
-
- replaceChildVariables(defClone, clone);
-
- mixinNode.getParentNode().appendChild(clone, previous);
-
- previous = clone;
-
- }
-
- }
-
- mixinNode.getParentNode().removeChild(mixinNode);
- }
-
- /**
- * We have to replace all the mixin parameters. This is done in two phases.
- * First phase replaces all the named parameters while the second replaces
- * in order of remaining unmodified parameters.
- *
- * @param mixinNode
- * @param def
- */
- private static void replacePossibleArguments(MixinNode mixinNode,
- MixinDefNode def) {
-
- if (mixinNode.getArglist().size() > 0) {
- ArrayList<VariableNode> remainingNodes = new ArrayList<VariableNode>(
- def.getArglist());
- ArrayList<LexicalUnitImpl> remainingUnits = new ArrayList<LexicalUnitImpl>(
- mixinNode.getArglist());
-
- for (final LexicalUnitImpl unit : mixinNode.getArglist()) {
- if (unit.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
- && unit.getNextLexicalUnit() != null) {
- for (final VariableNode node : def.getArglist()) {
- if (node.getName().equals(unit.getValue().toString())) {
- node.setExpr((LexicalUnitImpl) DeepCopy.copy(unit
- .getNextLexicalUnit()));
- remainingNodes.remove(node);
- remainingUnits.remove(unit);
- break;
- }
- }
- }
- }
-
- int i = 0;
- for (final LexicalUnitImpl unit : remainingUnits) {
- remainingNodes.get(i).setExpr(
- (LexicalUnitImpl) DeepCopy.copy(unit));
- i++;
- }
-
- }
-
- }
-
- private static void replaceChildVariables(MixinDefNode mixinDef, Node node) {
- for (final Node child : node.getChildren()) {
- replaceChildVariables(mixinDef, child);
- }
- if (node instanceof IVariableNode) {
- ((IVariableNode) node).replaceVariables(mixinDef.getArglist());
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import com.vaadin.sass.tree.NestPropertiesNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.RuleNode;
-
-/**
- * Handle nested properties nodes (e.g. "font: { family: serif; }" to
- * "font-family: serif;").
- *
- * Sample SASS code (from www.sass-lang.com):
- *
- * <pre>
- * li {
- * font: {
- * family: serif;
- * weight: bold;
- * size: 1.2em;
- * }
- * }
- * </pre>
- *
- * Note that this does not apply to nested blocks, which are handled by
- * {@link BlockNodeHandler}.
- */
-public class NestedNodeHandler {
-
- public static void traverse(NestPropertiesNode node) {
- Node previous = node;
- for (RuleNode unNested : node.unNesting()) {
- node.getParentNode().appendChild(unNested, previous);
- previous = unNested;
- }
- node.getParentNode().removeChild(node);
- }
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.tree.VariableNode;
-
-public class VariableNodeHandler {
-
- public static void traverse(VariableNode node) {
- if (ScssStylesheet.getVariable(node.getName()) == null
- || !node.isGuarded()) {
- ScssStylesheet.addVariable(node);
- }
- node.getParentNode().removeChild(node);
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.sass.visitor;
-
-import com.vaadin.sass.tree.Node;
-
-public interface Visitor {
-
- public void traverse(Node node) throws Exception;
-}
import org.apache.commons.io.IOUtils;
import org.w3c.css.sac.CSSException;
+import com.vaadin.sass.internal.ScssStylesheet;
+
public abstract class AbstractTestBase {
protected ScssStylesheet stylesheet;
import org.w3c.css.sac.InputSource;
import org.w3c.css.sac.LexicalUnit;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.parser.SCSSLexicalUnit;
public class ParserTest {
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
public class Interpolation extends AbstractTestBase {
String scss = "/scss/interpolation.scss";
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.CommentNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.CommentNode;
public class Comments extends AbstractTestBase {
String scss = "/scss/comments.scss";
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.MixinDefNode;
-import com.vaadin.sass.tree.MixinNode;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.controldirective.EachDefNode;
-import com.vaadin.sass.tree.controldirective.IfElseDefNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.MixinDefNode;
+import com.vaadin.sass.internal.tree.MixinNode;
+import com.vaadin.sass.internal.tree.Node;
+import com.vaadin.sass.internal.tree.controldirective.EachDefNode;
+import com.vaadin.sass.internal.tree.controldirective.IfElseDefNode;
public class ControlDirectives extends AbstractTestBase {
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.ExtendNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.ExtendNode;
public class Extends extends AbstractTestBase {
String scss = "/scss/extends.scss";
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
public class Functions extends AbstractTestBase {
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.ImportNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.ImportNode;
public class Imports extends AbstractTestBase {
import org.w3c.css.sac.LexicalUnit;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.LexicalUnitImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.MixinDefNode;
-import com.vaadin.sass.tree.MixinNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.MixinDefNode;
+import com.vaadin.sass.internal.tree.MixinNode;
public class Mixins extends AbstractTestBase {
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.NestPropertiesNode;
-import com.vaadin.sass.tree.RuleNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.NestPropertiesNode;
+import com.vaadin.sass.internal.tree.RuleNode;
public class NestedProperties extends AbstractTestBase {
String scss = "/scss/nested-properties.scss";
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
public class Nesting extends AbstractTestBase {
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.ImportNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.ImportNode;
public class ParentImports extends AbstractTestBase {
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.tree.BlockNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.tree.BlockNode;
public class ParentSelector extends AbstractTestBase {
String scss = "/scss/parent-selector.scss";
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
public class VariableGuarded extends AbstractTestBase {
String scss = "/scss/var-guarded.scss";
import org.w3c.css.sac.CSSException;
import com.vaadin.sass.AbstractTestBase;
-import com.vaadin.sass.ScssStylesheet;
-import com.vaadin.sass.handler.SCSSDocumentHandler;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.parser.Parser;
-import com.vaadin.sass.parser.SCSSLexicalUnit;
-import com.vaadin.sass.tree.BlockNode;
-import com.vaadin.sass.tree.RuleNode;
-import com.vaadin.sass.tree.VariableNode;
+import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.internal.parser.Parser;
+import com.vaadin.sass.internal.parser.SCSSLexicalUnit;
+import com.vaadin.sass.internal.tree.BlockNode;
+import com.vaadin.sass.internal.tree.RuleNode;
+import com.vaadin.sass.internal.tree.VariableNode;
public class Variables extends AbstractTestBase {
import org.junit.Test;
import com.steadystate.css.parser.SACMediaListImpl;
+import com.vaadin.sass.internal.tree.ImportNode;
public class ImportNodeTest {
@Test