Dependency libraries provided under the lib/
folder
@@ -322,8 +321,6 @@
vaadin-client-compiled
,
vaadin-shared
- ,
- vaadin-theme-compiler
, and
vaadin-themes
from the main folder and the dependencies from the
@@ -337,6 +334,13 @@
components.)
+ Updates to the Packaging
+
+ Since Vaadin 7.2.0, the old vaadin-theme-compiler has been moved into
+ a separate project and renamed to vaadin-sass-compiler. It is now included
+ along with the other 3rd party dependencies in the ZIP package.
+
+
For pure client-side development, you only need the
vaadin-client
diff --git a/all/ivy.xml b/all/ivy.xml
index 3c49e9a884..81768555fa 100644
--- a/all/ivy.xml
+++ b/all/ivy.xml
@@ -26,8 +26,6 @@
rev="${vaadin.version}" />
-
-
-
+
+
@@ -36,12 +36,11 @@
-
-
+
@@ -76,6 +75,8 @@
+
+
diff --git a/buildhelpers/ivy.xml b/buildhelpers/ivy.xml
index 21c2a808cc..df25cc84e5 100644
--- a/buildhelpers/ivy.xml
+++ b/buildhelpers/ivy.xml
@@ -29,6 +29,13 @@
+
+
+
+
+
diff --git a/buildhelpers/src/com/vaadin/buildhelpers/CompileTheme.java b/buildhelpers/src/com/vaadin/buildhelpers/CompileTheme.java
new file mode 100644
index 0000000000..06b941f522
--- /dev/null
+++ b/buildhelpers/src/com/vaadin/buildhelpers/CompileTheme.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2000-2013 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.buildhelpers;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+
+import com.vaadin.sass.internal.ScssStylesheet;
+
+/**
+ * Helper to combine css divided into separate per component dirs into one to
+ * optimize http requests.
+ */
+public class CompileTheme {
+
+ /**
+ * @param args
+ * @throws IOException
+ * @throws ParseException
+ */
+ public static void main(String[] args) throws IOException, ParseException {
+ Options options = new Options();
+ options.addOption("t", "theme", true, "the theme to compile");
+ options.addOption("f", "theme-folder", true,
+ "the folder containing the theme");
+ options.addOption("v", "version", true,
+ "the Vaadin version to compile for");
+ CommandLineParser parser = new PosixParser();
+ CommandLine params = parser.parse(options, args);
+ if (!params.hasOption("theme") || !params.hasOption("theme-folder")
+ || !params.hasOption("version")) {
+ // automatically generate the help statement
+ HelpFormatter formatter = new HelpFormatter();
+ formatter.printHelp(CompileTheme.class.getName(), options);
+ return;
+ }
+ String themeName = params.getOptionValue("theme");
+ String themeFolder = params.getOptionValue("theme-folder");
+ String version = params.getOptionValue("version");
+
+ // Regular theme
+ try {
+ processSassTheme(themeFolder, themeName, "styles", version);
+ System.out.println("Compiling theme " + themeName
+ + " styles successful");
+ } catch (Exception e) {
+ System.err.println("Compiling theme " + themeName
+ + " styles failed");
+ e.printStackTrace();
+ }
+ // Legacy theme w/o .themename{} wrapping
+ try {
+ processSassTheme(themeFolder, themeName, "legacy-styles", version);
+ System.out.println("Compiling theme " + themeName
+ + " legacy-styles successful");
+ } catch (Exception e) {
+ System.err.println("Compiling theme " + themeName
+ + " legacy-styles failed");
+ e.printStackTrace();
+ }
+ }
+
+ private static void processSassTheme(String themeFolder, String themeName,
+ String variant, String version) throws Exception {
+
+ StringBuffer cssHeader = new StringBuffer();
+
+ String stylesCssDir = themeFolder + File.separator + themeName
+ + File.separator;
+
+ String stylesCssName = stylesCssDir + variant + ".css";
+
+ // Process as SASS file
+ String sassFile = stylesCssDir + variant + ".scss";
+
+ ScssStylesheet scss = ScssStylesheet.get(sassFile);
+ if (scss == null) {
+ throw new IllegalArgumentException("SASS file: " + sassFile
+ + " not found");
+ }
+ scss.compile();
+ String filteredScss = scss.printState().replace("@version@", version);
+
+ BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName));
+ out.write(cssHeader.toString());
+ out.write(filteredScss);
+ out.close();
+
+ System.out.println("Compiled CSS to " + stylesCssName + " ("
+ + filteredScss.length() + " bytes)");
+
+ createSprites(themeFolder, themeName);
+ File oldCss = new File(stylesCssName);
+ File newCss = new File(stylesCssDir + variant + "-sprite.css");
+
+ if (newCss.exists()) {
+ // Theme contained sprites. Renamed "styles-sprite.css" ->
+ // "styles.css"
+ oldCss.delete();
+
+ boolean ok = newCss.renameTo(oldCss);
+ if (!ok) {
+ throw new RuntimeException("Rename " + newCss + " -> " + oldCss
+ + " failed");
+ }
+ }
+
+ }
+
+ private static void createSprites(String themeFolder, String themeName)
+ throws FileNotFoundException, IOException {
+ try {
+ // Try loading the class separately from using it to avoid
+ // hiding other classpath issues
+ Class> smartSpritesClass = org.carrot2.labs.smartsprites.SmartSprites.class;
+ } catch (NoClassDefFoundError e) {
+ System.err
+ .println("Could not find smartsprites. No sprites were generated. The theme should still work.");
+ return;
+ }
+
+ String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
+ "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8",
+ "--root-dir-path", themeFolder + File.separator + themeName,
+ "--log-level", "WARN" };
+
+ org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
+ System.out.println("Generated sprites");
+
+ }
+}
diff --git a/client-compiler/ivy.xml b/client-compiler/ivy.xml
index f0fa5a49b0..09dce744f1 100644
--- a/client-compiler/ivy.xml
+++ b/client-compiler/ivy.xml
@@ -25,8 +25,8 @@
rev="${vaadin.version}" conf="build" />
-
+
diff --git a/common.xml b/common.xml
index 59e32136b4..17537899de 100644
--- a/common.xml
+++ b/common.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/ivysettings.xml b/ivysettings.xml
index 7112bbf217..981ef2006d 100644
--- a/ivysettings.xml
+++ b/ivysettings.xml
@@ -39,8 +39,6 @@
resolver="build-temp" />
-
+
+
+
+
+
-
-
-
diff --git a/theme-compiler/README b/theme-compiler/README
deleted file mode 100644
index 4d9482763f..0000000000
--- a/theme-compiler/README
+++ /dev/null
@@ -1,11 +0,0 @@
-This project compiles SCSS into CSS.
-It parses the SCSS into a tree.
-
-Classes
-=======
-SassCompiler: This is the main class that can be run from command line. First parameter is for a scss file to be compiled. Second parameter is optional and is a reference to a file where you want the compiled css. If file doesn't exist, it will be deleted. If file exists, it will be deleted and recreated. If second argument is left out, the css will be printed into standard out.
-ScssStylesheet: When Scss/Css is parsed in, it will be represented in memory as this file. Reference is got through static get(File file) where file is input.
-Parser: A JavaCC compiled java class that parses the input and notifies the DocumentHandler on what nodes it encounters.
-Parser.jj: Source for the Parser class.
-SCSSDocumentHandlerImpl: Class that takes in calls from parser and creates nodes into ScssStylesheet based on those calls.
-Node package: All the nodes representing the Scss/Css in tree format
\ No newline at end of file
diff --git a/theme-compiler/apache2header.txt b/theme-compiler/apache2header.txt
deleted file mode 100644
index 5e94497098..0000000000
--- a/theme-compiler/apache2header.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml
deleted file mode 100644
index dbdc7e3e80..0000000000
--- a/theme-compiler/build.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
-
- Compiles build helpers used when building other modules.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme-compiler/ivy.xml b/theme-compiler/ivy.xml
deleted file mode 100644
index ccd00a29d9..0000000000
--- a/theme-compiler/ivy.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java
deleted file mode 100644
index 11e3b91800..0000000000
--- a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright 2000-2013 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.buildhelpers;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.PosixParser;
-
-import com.vaadin.sass.internal.ScssStylesheet;
-import com.vaadin.shared.Version;
-
-/**
- * Helper to combine css divided into separate per component dirs into one to
- * optimize http requests.
- */
-public class CompileTheme {
-
- /**
- * @param args
- * @throws IOException
- * @throws ParseException
- */
- public static void main(String[] args) throws IOException, ParseException {
- Options options = new Options();
- options.addOption("t", "theme", true, "the theme to compile");
- options.addOption("f", "theme-folder", true,
- "the folder containing the theme");
- CommandLineParser parser = new PosixParser();
- CommandLine params = parser.parse(options, args);
- if (!params.hasOption("theme") || !params.hasOption("theme-folder")) {
- // automatically generate the help statement
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp(CompileTheme.class.getName(), options);
- return;
- }
- String themeName = params.getOptionValue("theme");
- String themeFolder = params.getOptionValue("theme-folder");
-
- // Regular theme
- try {
- processSassTheme(themeFolder, themeName, "styles",
- Version.getFullVersion());
- System.out.println("Compiling theme " + themeName
- + " styles successful");
- } catch (Exception e) {
- System.err.println("Compiling theme " + themeName
- + " styles failed");
- e.printStackTrace();
- }
- // Legacy theme w/o .themename{} wrapping
- try {
- processSassTheme(themeFolder, themeName, "legacy-styles",
- Version.getFullVersion());
- System.out.println("Compiling theme " + themeName
- + " legacy-styles successful");
- } catch (Exception e) {
- System.err.println("Compiling theme " + themeName
- + " legacy-styles failed");
- e.printStackTrace();
- }
- }
-
- private static void processSassTheme(String themeFolder, String themeName,
- String variant, String version) throws Exception {
-
- StringBuffer cssHeader = new StringBuffer();
-
- String stylesCssDir = themeFolder + File.separator + themeName
- + File.separator;
-
- String stylesCssName = stylesCssDir + variant + ".css";
-
- // Process as SASS file
- String sassFile = stylesCssDir + variant + ".scss";
-
- ScssStylesheet scss = ScssStylesheet.get(sassFile);
- if (scss == null) {
- throw new IllegalArgumentException("SASS file: " + sassFile
- + " not found");
- }
- scss.compile();
- BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName));
- out.write(cssHeader.toString());
- out.write(scss.printState().replace("@version@", version));
- out.close();
-
- System.out.println("Compiled CSS to " + stylesCssName + " ("
- + scss.printState().length() + " bytes)");
-
- createSprites(themeFolder, themeName);
- File oldCss = new File(stylesCssName);
- File newCss = new File(stylesCssDir + variant + "-sprite.css");
-
- if (newCss.exists()) {
- // Theme contained sprites. Renamed "styles-sprite.css" ->
- // "styles.css"
- oldCss.delete();
-
- boolean ok = newCss.renameTo(oldCss);
- if (!ok) {
- throw new RuntimeException("Rename " + newCss + " -> " + oldCss
- + " failed");
- }
- }
-
- }
-
- private static void createSprites(String themeFolder, String themeName)
- throws FileNotFoundException, IOException {
- try {
- // Try loading the class separately from using it to avoid
- // hiding other classpath issues
- Class> smartSpritesClass = org.carrot2.labs.smartsprites.SmartSprites.class;
- } catch (NoClassDefFoundError e) {
- System.err
- .println("Could not find smartsprites. No sprites were generated. The theme should still work.");
- return;
- }
-
- String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
- "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8",
- "--root-dir-path", themeFolder + File.separator + themeName,
- "--log-level", "WARN" };
-
- org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
- System.out.println("Generated sprites");
-
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java b/theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java
deleted file mode 100644
index 44c9e345db..0000000000
--- a/theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2000-2013 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.PrintStream;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-/**
- *
- * @since
- * @author Vaadin Ltd
- */
-public class CustomConsoleHandler extends ConsoleHandler {
-
- private ConsoleHandler stdoutHandler;
-
- public CustomConsoleHandler() {
- PrintStream err = System.err;
- /*
- * ConsoleHandler uses System.err to output all messages. Replace
- * System.err temporary to construct ConsoleHandler and set it back
- * after construction.
- */
- System.setErr(System.out);
- stdoutHandler = new ConsoleHandler();
- System.setErr(err);
- }
-
- @Override
- public void publish(LogRecord record) {
- if (!Level.SEVERE.equals(record.getLevel())) {
- stdoutHandler.publish(record);
- } else {
- super.publish(record);
- }
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/SassCompiler.java b/theme-compiler/src/com/vaadin/sass/SassCompiler.java
deleted file mode 100644
index b554ce2b01..0000000000
--- a/theme-compiler/src/com/vaadin/sass/SassCompiler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2000-2013 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.FileWriter;
-import java.io.IOException;
-
-import com.vaadin.sass.internal.ScssStylesheet;
-
-public class SassCompiler {
-
- public static void main(String[] args) throws Exception {
- String input = null;
- String output = null;
- if (args.length < 1 || args.length > 2) {
- System.out
- .println("usage: SassCompile ");
- return;
- }
-
- File in = new File(args[0]);
- if (!in.canRead()) {
- System.err.println(in.getCanonicalPath() + " could not be read!");
- return;
- }
- input = in.getCanonicalPath();
-
- if (args.length == 2) {
- output = args[1];
- }
-
- // You can set the resolver; if none is set, VaadinResolver will be used
- // ScssStylesheet.setStylesheetResolvers(new VaadinResolver());
-
- ScssStylesheet scss = ScssStylesheet.get(input);
- if (scss == null) {
- System.err.println("The scss file " + input
- + " could not be found.");
- return;
- }
-
- scss.compile();
- if (output == null) {
- System.out.println(scss.printState());
- } else {
- writeFile(output, scss.printState());
- }
- }
-
- public static void writeFile(String filename, String output)
- throws IOException {
- File file = new File(filename);
- FileWriter writer = new FileWriter(file);
- writer.write(output);
- writer.close();
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
deleted file mode 100644
index 42325fde29..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright 2000-2013 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.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.InputSource;
-
-import com.vaadin.buildhelpers.CompileTheme;
-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.ParseException;
-import com.vaadin.sass.internal.parser.Parser;
-import com.vaadin.sass.internal.parser.SCSSParseException;
-import com.vaadin.sass.internal.resolver.ClassloaderResolver;
-import com.vaadin.sass.internal.resolver.FilesystemResolver;
-import com.vaadin.sass.internal.resolver.ScssStylesheetResolver;
-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.ExtendNodeHandler;
-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 variables = new HashMap();
-
- private static final Map mixinDefs = new HashMap();
-
- private static final HashSet ifElseDefNodes = new HashSet();
-
- private static HashMap lastNodeAdded = new HashMap();
-
- private File file;
-
- private String charset;
-
- private List resolvers = new ArrayList();
-
- /**
- * 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 up a
- * ScssStylesheet tree out of it. Calling compile() on it will transform
- * SASS into CSS. Calling printState() will print out the SCSS/CSS.
- *
- * @param identifier
- * The file path. If null then null is returned.
- * @return
- * @throws CSSException
- * @throws IOException
- */
- public static ScssStylesheet get(String identifier) throws CSSException,
- IOException {
- return get(identifier, null);
- }
-
- /**
- * Main entry point for the SASS compiler. Takes in a file and an optional
- * parent style sheet, then builds up a ScssStylesheet tree out of it.
- * Calling compile() on it will transform SASS into CSS. Calling
- * printState() will print out the SCSS/CSS.
- *
- * @param identifier
- * The file path. If null then null is returned.
- * @param parentStylesheet
- * Style sheet from which to inherit resolvers and encoding. May
- * be null.
- * @return
- * @throws CSSException
- * @throws IOException
- */
- public static ScssStylesheet get(String identifier,
- ScssStylesheet parentStylesheet) throws CSSException, IOException {
- return get(identifier, parentStylesheet, new SCSSDocumentHandlerImpl(),
- new SCSSErrorHandler());
- }
-
- /**
- * Main entry point for the SASS compiler. Takes in a file, an optional
- * parent stylesheet, and document and error handlers. Then builds up a
- * ScssStylesheet tree out of it. Calling compile() on it will transform
- * SASS into CSS. Calling printState() will print out the SCSS/CSS.
- *
- * @param identifier
- * The file path. If null then null is returned.
- * @param parentStylesheet
- * Style sheet from which to inherit resolvers and encoding. May
- * be null.
- * @param documentHandler
- * Instance of document handler. May not be null.
- * @param errorHandler
- * Instance of error handler. May not be null.
- * @return
- * @throws CSSException
- * @throws IOException
- */
- public static ScssStylesheet get(String identifier,
- ScssStylesheet parentStylesheet,
- SCSSDocumentHandler documentHandler, SCSSErrorHandler errorHandler)
- throws CSSException, IOException {
- /*
- * The encoding to be used is passed through "encoding" parameter. the
- * imported children scss node will have the same encoding as their
- * parent, ultimately the root scss file. The root scss node has this
- * "encoding" parameter to be null. Its encoding is determined by the
- *
- * @charset declaration, the default one is ASCII.
- */
-
- if (identifier == null) {
- return null;
- }
-
- // FIXME Is this actually intended? /John 1.3.2013
- File file = new File(identifier);
- file = file.getCanonicalFile();
-
- ScssStylesheet stylesheet = documentHandler.getStyleSheet();
- if (parentStylesheet == null) {
- // Use default resolvers
- stylesheet.addResolver(new FilesystemResolver());
- stylesheet.addResolver(new ClassloaderResolver());
- } else {
- // Use parent resolvers
- stylesheet.setResolvers(parentStylesheet.getResolvers());
- }
- InputSource source = stylesheet.resolveStylesheet(identifier,
- parentStylesheet);
- if (source == null) {
- return null;
- }
- if (parentStylesheet != null) {
- source.setEncoding(parentStylesheet.getCharset());
- }
-
- Parser parser = new Parser();
- parser.setErrorHandler(errorHandler);
- parser.setDocumentHandler(documentHandler);
-
- try {
- parser.parseStyleSheet(source);
- } catch (ParseException e) {
- // catch ParseException, re-throw a SCSSParseException which has
- // file name info.
- throw new SCSSParseException(e, identifier);
- }
-
- stylesheet.setCharset(parser.getInputSource().getEncoding());
- return stylesheet;
- }
-
- public InputSource resolveStylesheet(String identifier,
- ScssStylesheet parentStylesheet) {
- for (ScssStylesheetResolver resolver : getResolvers()) {
- InputSource source = resolver.resolve(parentStylesheet, identifier);
- if (source != null) {
- File f = new File(source.getURI());
- setFile(f);
- return source;
- }
- }
-
- return null;
- }
-
- /**
- * Retrieves a list of resolvers to use when resolving imports
- *
- * @since 7.2
- * @return the resolvers used to resolving imports
- */
- public List getResolvers() {
- return Collections.unmodifiableList(resolvers);
- }
-
- /**
- * Sets the list of resolvers to use when resolving imports
- *
- * @since 7.2
- * @param resolvers
- * the resolvers to set
- */
- public void setResolvers(List resolvers) {
- this.resolvers = new ArrayList(resolvers);
- }
-
- /**
- * Adds the given resolver to the resolver list
- *
- * @since 7.2
- * @param resolver
- * The resolver to add
- */
- public void addResolver(ScssStylesheetResolver resolver) {
- resolvers.add(resolver);
- }
-
- /**
- * 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();
- ExtendNodeHandler.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.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 printState() {
- return buildString(PRINT_STRATEGY);
- }
-
- @Override
- public String toString() {
- return "Stylesheet node [" + buildString(TO_STRING_STRATEGY) + "]";
- }
-
- 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();
-
- Map variableScope = openVariableScope();
-
- // 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;
- }
- }
-
- closeVariableScope(variableScope);
-
- // clean up insert point so that processing of the next block will
- // insert after that block
- lastNodeAdded.remove(originalParent);
-
- // has the node been removed from its parent?
- if (originalParent != null) {
- boolean removed = !originalParent.getChildren().contains(node);
- return removed;
- } else {
- return false;
- }
- }
-
- /**
- * Start a new scope for variables. Any variables set or modified after
- * opening a new scope are only valid until the scope is closed, at which
- * time they are replaced with their old values.
- *
- * @return old scope to give to a paired {@link #closeVariableScope(Map)}
- * call at the end of the scope (unmodifiable map).
- */
- public static Map openVariableScope() {
- @SuppressWarnings("unchecked")
- HashMap variableScope = (HashMap) variables
- .clone();
- return Collections.unmodifiableMap(variableScope);
- }
-
- /**
- * End a scope for variables, replacing all active variables with those from
- * the original scope (obtained from {@link #openVariableScope()}).
- *
- * @param originalScope
- * original scope
- */
- public static void closeVariableScope(
- Map originalScope) {
- variables.clear();
- variables.putAll(originalScope);
- }
-
- public void removeEmptyBlocks(Node node) {
- // depth first for avoiding re-checking parents of removed nodes
- for (Node child : new ArrayList(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 getVariables() {
- return new ArrayList(variables.values());
- }
-
- public static MixinDefNode getMixinDefinition(String name) {
- return mixinDefs.get(name);
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- /**
- * Returns the directory containing this style sheet
- *
- * @since 7.2
- * @return The directory containing this style sheet
- */
- public String getDirectory() {
- return file.getParent();
- }
-
- /**
- * Returns the full file name for this style sheet
- *
- * @since 7.2
- * @return The full file name for this style sheet
- */
- public String getFileName() {
- return file.getPath();
- }
-
- public static HashMap getLastNodeAdded() {
- return lastNodeAdded;
- }
-
- public static final void warning(String msg) {
- Logger.getLogger(ScssStylesheet.class.getName()).warning(msg);
- }
-
- public String getCharset() {
- return charset;
- }
-
- public void setCharset(String charset) {
- this.charset = charset;
- }
-
- private String buildString(BuildStringStrategy strategy) {
- StringBuilder string = new StringBuilder("");
- String delimeter = "\n\n";
- // add charset declaration, if it is not default "ASCII".
- if (!"ASCII".equals(getCharset())) {
- string.append("@charset \"").append(getCharset()).append("\";")
- .append(delimeter);
- }
- if (children.size() > 0) {
- string.append(strategy.build(children.get(0)));
- }
- if (children.size() > 1) {
- for (int i = 1; i < children.size(); i++) {
- String childString = strategy.build(children.get(i));
- if (childString != null) {
- string.append(delimeter).append(childString);
- }
- }
- }
- String output = string.toString();
- return output;
- }
-
- static {
- String logFile = System.getProperty("java.util.logging.config.file");
- if (logFile == null) {
- try {
- LogManager.getLogManager().readConfiguration(
- CompileTheme.class
- .getResourceAsStream("/logging.properties"));
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java b/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java
deleted file mode 100644
index 552b464941..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2000-2013 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.expression;
-
-import static com.vaadin.sass.internal.parser.SCSSLexicalUnit.SCSS_VARIABLE;
-
-import java.util.Stack;
-
-import com.vaadin.sass.internal.expression.exception.ArithmeticException;
-import com.vaadin.sass.internal.parser.LexicalUnitImpl;
-import com.vaadin.sass.internal.parser.SCSSLexicalUnit;
-
-public class ArithmeticExpressionEvaluator {
- private static ArithmeticExpressionEvaluator instance;
-
- public static ArithmeticExpressionEvaluator get() {
- if (instance == null) {
- instance = new ArithmeticExpressionEvaluator();
- }
- return instance;
- }
-
- private void createNewOperand(BinaryOperator operator,
- Stack operands) {
- Object rightOperand = operands.pop();
- operands.push(new BinaryExpression(operands.pop(), operator,
- rightOperand));
- }
-
- public boolean containsArithmeticalOperator(LexicalUnitImpl term) {
- LexicalUnitImpl current = term;
- while (current != null) {
- for (BinaryOperator operator : BinaryOperator.values()) {
- /*
- * '/' is treated as an arithmetical operator when one of its
- * operands is Variable, or there is another binary operator.
- * Otherwise, '/' is treated as a CSS operator.
- */
- if (current.getLexicalUnitType() == operator.type) {
- if (current.getLexicalUnitType() != BinaryOperator.DIV.type) {
- return true;
- } else {
- if (current.getPreviousLexicalUnit()
- .getLexicalUnitType() == SCSS_VARIABLE
- || current.getNextLexicalUnit()
- .getLexicalUnitType() == SCSS_VARIABLE) {
- return true;
- }
- }
- }
- }
- current = current.getNextLexicalUnit();
- }
- return false;
- }
-
- private Object createExpression(LexicalUnitImpl term) {
- LexicalUnitImpl current = term;
- boolean afterOperand = false;
- Stack operands = new Stack();
- Stack operators = new Stack();
- inputTermLoop: while (current != null) {
- if (afterOperand) {
- if (current.getLexicalUnitType() == SCSSLexicalUnit.SCSS_OPERATOR_RIGHT_PAREN) {
- Object operator = null;
- while (!operators.isEmpty()
- && ((operator = operators.pop()) != Parentheses.LEFT)) {
- createNewOperand((BinaryOperator) operator, operands);
- }
- current = current.getNextLexicalUnit();
- continue;
- }
- afterOperand = false;
- for (BinaryOperator operator : BinaryOperator.values()) {
- if (current.getLexicalUnitType() == operator.type) {
- while (!operators.isEmpty()
- && (operators.peek() != Parentheses.LEFT)
- && (((BinaryOperator) operators.peek()).precedence >= operator.precedence)) {
- createNewOperand((BinaryOperator) operators.pop(),
- operands);
- }
- operators.push(operator);
-
- current = current.getNextLexicalUnit();
- continue inputTermLoop;
- }
- }
- throw new ArithmeticException("Illegal arithmetic expression",
- term);
- }
- if (current.getLexicalUnitType() == SCSSLexicalUnit.SCSS_OPERATOR_LEFT_PAREN) {
- operators.push(Parentheses.LEFT);
- current = current.getNextLexicalUnit();
- continue;
- }
- afterOperand = true;
-
- operands.push(current);
- current = current.getNextLexicalUnit();
- }
-
- while (!operators.isEmpty()) {
- Object operator = operators.pop();
- if (operator == Parentheses.LEFT) {
- throw new ArithmeticException("Unexpected \"(\" found", term);
- }
- createNewOperand((BinaryOperator) operator, operands);
- }
- Object expression = operands.pop();
- if (!operands.isEmpty()) {
- LexicalUnitImpl operand = (LexicalUnitImpl) operands.peek();
- throw new ArithmeticException("Unexpected operand "
- + operand.toString() + " found", term);
- }
- return expression;
- }
-
- public LexicalUnitImpl evaluate(LexicalUnitImpl term) {
- Object result = ArithmeticExpressionEvaluator.get().createExpression(
- term);
- if (result instanceof BinaryExpression) {
- return ((BinaryExpression) result).eval();
- }
- return term;
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/BinaryExpression.java b/theme-compiler/src/com/vaadin/sass/internal/expression/BinaryExpression.java
deleted file mode 100644
index bfcdf6f506..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/BinaryExpression.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2000-2013 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.expression;
-
-import com.vaadin.sass.internal.parser.LexicalUnitImpl;
-
-public class BinaryExpression {
- public Object leftOperand = null;
- public BinaryOperator operator = null;
- public Object rightOperand = null;
-
- public BinaryExpression(Object leftOperand, BinaryOperator operator,
- Object rightOperand) {
- this.leftOperand = leftOperand;
- this.operator = operator;
- this.rightOperand = rightOperand;
- }
-
- public LexicalUnitImpl eval() {
- LexicalUnitImpl leftValue = (leftOperand instanceof BinaryExpression) ? ((BinaryExpression) leftOperand)
- .eval() : (LexicalUnitImpl) leftOperand;
- LexicalUnitImpl rightValue = (rightOperand instanceof BinaryExpression) ? ((BinaryExpression) rightOperand)
- .eval() : (LexicalUnitImpl) rightOperand;
- return operator.eval(leftValue, rightValue);
- }
-
- @Override
- public String toString() {
- return "(" + leftOperand + " " + operator.type + " " + rightOperand
- + ")";
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/BinaryOperator.java b/theme-compiler/src/com/vaadin/sass/internal/expression/BinaryOperator.java
deleted file mode 100644
index 15d3da797f..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/BinaryOperator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2000-2013 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.expression;
-
-import org.w3c.css.sac.LexicalUnit;
-
-import com.vaadin.sass.internal.parser.LexicalUnitImpl;
-
-public enum BinaryOperator {
- ADD(LexicalUnit.SAC_OPERATOR_PLUS, 1) {
- @Override
- public LexicalUnitImpl eval(LexicalUnitImpl leftValue,
- LexicalUnitImpl rightValue) {
- return leftValue.add(rightValue);
- }
- },
- MINUS(LexicalUnit.SAC_OPERATOR_MINUS, 1) {
- @Override
- public LexicalUnitImpl eval(LexicalUnitImpl leftValue,
- LexicalUnitImpl rightValue) {
- return leftValue.minus(rightValue);
- }
- },
- MUL(LexicalUnit.SAC_OPERATOR_MULTIPLY, 2) {
- @Override
- public LexicalUnitImpl eval(LexicalUnitImpl leftValue,
- LexicalUnitImpl rightValue) {
- return leftValue.multiply(rightValue);
- }
- },
- DIV(LexicalUnit.SAC_OPERATOR_SLASH, 2) {
- @Override
- public LexicalUnitImpl eval(LexicalUnitImpl leftValue,
- LexicalUnitImpl rightValue) {
- return leftValue.divide(rightValue);
- }
- },
- MOD(LexicalUnit.SAC_OPERATOR_MOD, 2) {
- @Override
- public LexicalUnitImpl eval(LexicalUnitImpl leftValue,
- LexicalUnitImpl rightValue) {
- return leftValue.modulo(rightValue);
- }
- };
-
- public final short type;
- public final int precedence;
-
- BinaryOperator(short type, int precedence) {
- this.type = type;
- this.precedence = precedence;
- }
-
- public abstract LexicalUnitImpl eval(LexicalUnitImpl leftValue,
- LexicalUnitImpl rightValue);
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/Parentheses.java b/theme-compiler/src/com/vaadin/sass/internal/expression/Parentheses.java
deleted file mode 100644
index 5df8607aaf..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/Parentheses.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2000-2013 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.expression;
-
-public enum Parentheses {
- LEFT, RIGHT
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java b/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java
deleted file mode 100644
index f9ab90fc32..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2000-2013 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.expression.exception;
-
-import com.vaadin.sass.internal.parser.LexicalUnitImpl;
-
-public class ArithmeticException extends RuntimeException {
- public ArithmeticException(String errorMsg) {
- super(errorMsg);
- }
-
- public ArithmeticException(String error, LexicalUnitImpl term) {
- super(buildMessage(error, term));
- }
-
- private static String buildMessage(String message, LexicalUnitImpl term) {
- StringBuilder builder = new StringBuilder(message);
-
- builder.append(": \"");
- builder.append(term.toString());
- builder.append("\" [");
- builder.append(term.getLineNumber());
- builder.append(",");
- builder.append(term.getColumnNumber());
- builder.append("]");
-
- return builder.toString();
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/exception/IncompatibleUnitsException.java b/theme-compiler/src/com/vaadin/sass/internal/expression/exception/IncompatibleUnitsException.java
deleted file mode 100644
index bbeb0140f2..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/exception/IncompatibleUnitsException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2013 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.expression.exception;
-
-public class IncompatibleUnitsException extends ArithmeticException {
- public IncompatibleUnitsException(String errorExpr) {
- super(getErrorMsg(errorExpr));
- }
-
- private static String getErrorMsg(String errorExpr) {
- StringBuilder builder = new StringBuilder();
- builder.append("Incompatible units found in: ");
- builder.append("'").append(errorExpr).append("'");
- return builder.toString();
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandler.java b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandler.java
deleted file mode 100644
index 3bf6c056c4..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2000-2013 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.List;
-
-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 args);
-
- void endMixinDirective(String name, Collection 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 importStyle(String uri, SACMediaList media, boolean isURL);
-
- void property(String name, LexicalUnitImpl value, boolean important,
- String comment);
-
- EachDefNode startEachDirective(String variable, ArrayList list);
-
- void endEachDirective();
-
- void startIfElseDirective();
-
- void endIfElseDirective();
-
- void ifDirective(String evaluator);
-
- void elseDirective();
-
- void startSelector(ArrayList selectors) throws CSSException;
-
- void endSelector() throws CSSException;
-
- void extendDirective(ArrayList 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);
-
- void startKeyFrames(String keyframeName, String animationname);
-
- void endKeyFrames();
-
- void startKeyframeSelector(String selector);
-
- void endKeyframeSelector();
-
- void contentDirective();
-
- void startInclude(String name, List args);
-
- void endInclude();
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java
deleted file mode 100644
index 8c09e44f7c..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Copyright 2000-2013 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.List;
-import java.util.Stack;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-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.ContentNode;
-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.KeyframeSelectorNode;
-import com.vaadin.sass.internal.tree.KeyframesNode;
-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.SimpleNode;
-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 nodeStack = new Stack();
-
- 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);
- log(node);
- return node;
- }
-
- @Override
- public EachDefNode startEachDirective(String var, ArrayList 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);
- log(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 {
- log("ignorableAtRule(String atRule): " + atRule);
- }
-
- @Override
- public void namespaceDeclaration(String prefix, String uri)
- throws CSSException {
- log("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 {
- log("startPage(String name, String pseudo_page): " + name + ", "
- + pseudo_page);
- }
-
- @Override
- public void endPage(String name, String pseudo_page) throws CSSException {
- log("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 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 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 args) {
- MixinDefNode node = new MixinDefNode(name.trim(), args);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
- }
-
- @Override
- public void endMixinDirective(String name, Collection args) {
- nodeStack.pop();
- }
-
- @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);
- }
-
- // rule that is passed to the output as-is (except variable value
- // substitution) - no children
- public void unrecognizedRule(String text) {
- SimpleNode node = new SimpleNode(text);
- 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);
- }
-
- @Override
- public void startKeyFrames(String keyframeName, String animationName) {
- KeyframesNode node = new KeyframesNode(keyframeName, animationName);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
-
- }
-
- @Override
- public void endKeyFrames() {
- nodeStack.pop();
-
- }
-
- @Override
- public void startKeyframeSelector(String selector) {
- KeyframeSelectorNode node = new KeyframeSelectorNode(selector);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
-
- }
-
- @Override
- public void endKeyframeSelector() {
- nodeStack.pop();
- }
-
- @Override
- public void contentDirective() {
- ContentNode node = new ContentNode();
- nodeStack.peek().appendChild(node);
- }
-
- @Override
- public void startInclude(String name, List args) {
- MixinNode node = new MixinNode(name, args);
- nodeStack.peek().appendChild(node);
- nodeStack.push(node);
-
- }
-
- @Override
- public void endInclude() {
- nodeStack.pop();
- }
-
- private void log(Object object) {
- if (object != null) {
- log(object.toString());
- } else {
- log(null);
- }
- }
-
- private void log(String msg) {
- Logger.getLogger(SCSSDocumentHandlerImpl.class.getName()).log(
- Level.INFO, msg);
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java
deleted file mode 100644
index a7c65073ee..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2000-2013 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.logging.Level;
-import java.util.logging.Logger;
-
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.CSSParseException;
-import org.w3c.css.sac.ErrorHandler;
-
-public class SCSSErrorHandler implements ErrorHandler {
-
- public SCSSErrorHandler() {
- }
-
- @Override
- public void error(CSSParseException arg0) throws CSSException {
- log("Error when parsing file \n" + arg0.getURI() + " on line "
- + arg0.getLineNumber() + ", column " + arg0.getColumnNumber());
- log(arg0.getMessage() + "\n");
- }
-
- @Override
- public void fatalError(CSSParseException arg0) throws CSSException {
- log("FATAL Error when parsing file \n" + arg0.getURI() + " on line "
- + arg0.getLineNumber() + ", column " + arg0.getColumnNumber());
- log(arg0.getMessage() + "\n");
- }
-
- @Override
- public void warning(CSSParseException arg0) throws CSSException {
- log("Warning when parsing file \n" + arg0.getURI() + " on line "
- + arg0.getLineNumber() + ", column " + arg0.getColumnNumber());
- log(arg0.getMessage() + "\n");
- }
-
- private void log(String msg) {
- Logger.getLogger(SCSSDocumentHandlerImpl.class.getName()).log(
- Level.SEVERE, msg);
- }
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/CharStream.java b/theme-compiler/src/com/vaadin/sass/internal/parser/CharStream.java
deleted file mode 100644
index e43320453c..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/CharStream.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/* 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=18aae0a549695f0fec96a11297b442bb (do not edit this line) */
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Generic_CharStream.java b/theme-compiler/src/com/vaadin/sass/internal/parser/Generic_CharStream.java
deleted file mode 100644
index 7bc2973311..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/Generic_CharStream.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/* 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.
- */
- 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];
- }
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/JumpException.java b/theme-compiler/src/com/vaadin/sass/internal/parser/JumpException.java
deleted file mode 100644
index 0060169bf4..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/JumpException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/*
- * (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() {
- }
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/LexicalUnitImpl.java b/theme-compiler/src/com/vaadin/sass/internal/parser/LexicalUnitImpl.java
deleted file mode 100644
index 97314c6e8c..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/LexicalUnitImpl.java
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/*
- * 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 java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.w3c.css.sac.LexicalUnit;
-
-import com.vaadin.sass.internal.expression.exception.IncompatibleUnitsException;
-import com.vaadin.sass.internal.parser.function.AbsFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.CeilFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.DarkenFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.DefaultFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.FloorFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.LightenFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.RoundFunctionGenerator;
-import com.vaadin.sass.internal.parser.function.SCSSFunctionGenerator;
-import com.vaadin.sass.internal.tree.Node;
-import com.vaadin.sass.internal.tree.Node.BuildStringStrategy;
-import com.vaadin.sass.internal.util.DeepCopy;
-
-/**
- * @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;
-
- private static int PRECISION = 100000;
- private static int PERC_PRECISION_FACTOR = 100 * PRECISION;
-
- 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;
- f = i;
- }
-
- LexicalUnitImpl(int line, int column, LexicalUnitImpl previous,
- short dimension, String sdimension, float f) {
- this(dimension, line, column, previous);
- this.f = f;
- i = (int) 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;
- f = i;
- }
-
- @Override
- public float getFloatValue() {
- return f;
- }
-
- /**
- * Returns the float value as a string unless the value is an integer. In
- * that case returns the integer value as a string.
- *
- * @return a string representing the value, either with or without decimals
- */
- public String getFloatOrInteger() {
- float f = getFloatValue();
- int i = (int) f;
- if ((i) == f) {
- return i + "";
- } else {
- return f + "";
- }
- }
-
- public void setFloatValue(float f) {
- this.f = f;
- i = (int) f;
- }
-
- @Override
- public String getDimensionUnitText() {
- switch (type) {
- case SAC_PERCENTAGE:
- return "%";
- case SAC_EM:
- return "em";
- case SCSSLexicalUnit.SAC_LEM:
- return "lem";
- case SCSSLexicalUnit.SAC_REM:
- return "rem";
- 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;
- }
-
- /**
- * Prints out the current state of the node tree. Will return SCSS before
- * compile and CSS after.
- *
- * Result value could be null.
- *
- * @since 7.2
- * @return State as a string
- */
- public String printState() {
- return buildString(Node.PRINT_STRATEGY);
- }
-
- @Override
- public String toString() {
- String result = simpleAsString();
- if (result == null) {
- return "Lexical unit node [" + buildString(Node.TO_STRING_STRATEGY)
- + "]";
- } else {
- return result;
- }
- }
-
- // A helper method for sass interpolation
- public String unquotedString() {
- String result = printState();
- if (result.length() >= 2
- && ((result.charAt(0) == '"' && result
- .charAt(result.length() - 1) == '"') || (result
- .charAt(0) == '\'' && result
- .charAt(result.length() - 1) == '\''))) {
- result = result.substring(1, result.length() - 1);
- }
- return result;
- }
-
- @Override
- public LexicalUnitImpl divide(LexicalUnitImpl denominator) {
- if (denominator.getLexicalUnitType() != SAC_INTEGER
- && denominator.getLexicalUnitType() != SAC_REAL
- && getLexicalUnitType() != denominator.getLexicalUnitType()) {
- throw new IncompatibleUnitsException(printState());
- }
- setFloatValue(getFloatValue() / denominator.getFloatValue());
- if (getLexicalUnitType() == denominator.getLexicalUnitType()) {
- setLexicalUnitType(SAC_REAL);
- }
- setNextLexicalUnit(denominator.getNextLexicalUnit());
- return this;
- }
-
- @Override
- public LexicalUnitImpl add(LexicalUnitImpl another) {
- checkAndSetUnit(another);
- setFloatValue(getFloatValue() + another.getFloatValue());
- return this;
- }
-
- @Override
- public LexicalUnitImpl minus(LexicalUnitImpl another) {
- checkAndSetUnit(another);
- setFloatValue(getFloatValue() - another.getFloatValue());
- return this;
- }
-
- @Override
- public LexicalUnitImpl multiply(LexicalUnitImpl another) {
- checkAndSetUnit(another);
- setFloatValue(getFloatValue() * another.getIntegerValue());
- return this;
- }
-
- protected void checkAndSetUnit(LexicalUnitImpl another) {
- if (getLexicalUnitType() != SAC_INTEGER
- && getLexicalUnitType() != SAC_REAL
- && another.getLexicalUnitType() != SAC_INTEGER
- && another.getLexicalUnitType() != SAC_REAL
- && getLexicalUnitType() != another.getLexicalUnitType()) {
- throw new IncompatibleUnitsException(printState());
- }
- if (another.getLexicalUnitType() != SAC_INTEGER
- && another.getLexicalUnitType() != SAC_REAL) {
- setLexicalUnitType(another.getLexicalUnitType());
- }
- setNextLexicalUnit(another.getNextLexicalUnit());
- }
-
- @Override
- public LexicalUnitImpl modulo(LexicalUnitImpl another) {
- if (getLexicalUnitType() != another.getLexicalUnitType()) {
- throw new IncompatibleUnitsException(printState());
- }
- setIntegerValue(getIntegerValue() % another.getIntegerValue());
- setNextLexicalUnit(another.getNextLexicalUnit());
- return this;
- }
-
- public void replaceValue(LexicalUnitImpl another) {
- // shouldn't modify 'another' directly, should only modify its copy.
- LexicalUnitImpl deepCopyAnother = (LexicalUnitImpl) DeepCopy
- .copy(another);
- type = deepCopyAnother.getLexicalUnitType();
- i = deepCopyAnother.getIntegerValue();
- f = deepCopyAnother.getFloatValue();
- s = deepCopyAnother.getStringValue();
- fname = deepCopyAnother.getFunctionName();
- prev = deepCopyAnother.getPreviousLexicalUnit();
- dimension = deepCopyAnother.getDimension();
- sdimension = deepCopyAnother.getSdimension();
- params = deepCopyAnother.getParameters();
-
- LexicalUnitImpl finalNextInAnother = deepCopyAnother;
- while (finalNextInAnother.getNextLexicalUnit() != null) {
- finalNextInAnother = finalNextInAnother.getNextLexicalUnit();
- }
-
- finalNextInAnother.setNextLexicalUnit(next);
- next = deepCopyAnother.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 createNull(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(line, column, previous, SCSS_NULL, "null");
- }
-
- 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 createLEM(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous,
- SCSSLexicalUnit.SAC_LEM, null, v);
- }
-
- static LexicalUnitImpl createREM(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous,
- SCSSLexicalUnit.SAC_REM, 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 createPX(int line, int column,
- LexicalUnitImpl previous, float v) {
- return new LexicalUnitImpl(line, column, previous, SAC_PIXEL, null, v);
- }
-
- public 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);
- }
-
- public static LexicalUnitImpl createAdd(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SAC_OPERATOR_PLUS, line, column, previous);
- }
-
- public static LexicalUnitImpl createMinus(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SAC_OPERATOR_MINUS, line, column, previous);
- }
-
- public static LexicalUnitImpl createMultiply(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SAC_OPERATOR_MULTIPLY, line, column,
- previous);
- }
-
- public static LexicalUnitImpl createModulo(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SAC_OPERATOR_MOD, line, column, previous);
- }
-
- public static LexicalUnitImpl createLeftParenthesis(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SCSS_OPERATOR_LEFT_PAREN, line, column,
- previous);
- }
-
- public static LexicalUnitImpl createRightParenthesis(int line, int column,
- LexicalUnitImpl previous) {
- return new LexicalUnitImpl(SCSS_OPERATOR_LEFT_PAREN, line, column,
- previous);
- }
-
- /**
- * 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 String getValueAsString() {
- Object value = getValue();
- if (value == null) {
- return null;
- } else {
- return value.toString();
- }
- }
-
- 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());
- }
-
- }
-
- private static SCSSFunctionGenerator getGenerator(String funcName) {
- SCSSFunctionGenerator serializer = SERIALIZERS.get(funcName);
- if (serializer == null) {
- return DEFAULT_SERIALIZER;
- } else {
- return serializer;
- }
- }
-
- private static List initSerializers() {
- List list = new LinkedList();
- list.add(new AbsFunctionGenerator());
- list.add(new CeilFunctionGenerator());
- list.add(new DarkenFunctionGenerator());
- list.add(new FloorFunctionGenerator());
- list.add(new LightenFunctionGenerator());
- list.add(new RoundFunctionGenerator());
- list.add(new PercentageFunctionGenerator());
- return list;
- }
-
- private static class PercentageFunctionGenerator implements
- SCSSFunctionGenerator {
-
- @Override
- public String getFunctionName() {
- return "percentage";
- }
-
- @Override
- public String printState(LexicalUnitImpl function,
- BuildStringStrategy strategy) {
- StringBuilder builder = new StringBuilder();
- LexicalUnitImpl firstParam = function.getParameters();
- float value = firstParam.getFloatValue();
- value *= PERC_PRECISION_FACTOR;
- int intValue = Math.round(value);
- value = ((float) intValue) / PRECISION;
-
- int resultIntValue = (int) value;
-
- firstParam.type = SAC_PERCENTAGE;
-
- if (intValue == resultIntValue * PRECISION) {
- builder.append(resultIntValue);
- firstParam.setIntegerValue(resultIntValue);
- } else {
- builder.append(value);
- firstParam.setFloatValue(value);
- }
-
- firstParam.setStringValue(builder.append('%').toString());
-
- return strategy.build(firstParam);
- }
-
- }
-
- private static final Map SERIALIZERS = new HashMap();
-
- private static final SCSSFunctionGenerator DEFAULT_SERIALIZER = new DefaultFunctionGenerator();
-
- private String simpleAsString() {
- short type = getLexicalUnitType();
- String text = null;
- switch (type) {
- case SCSS_VARIABLE:
- text = "$" + s;
- break;
- case SCSS_NULL:
- text = "";
- 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 = getFloatOrInteger();
- break;
- case LexicalUnit.SAC_EM:
- case SCSSLexicalUnit.SAC_LEM:
- case SCSSLexicalUnit.SAC_REM:
- 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:
- text = getFloatOrInteger() + getDimensionUnitText();
- break;
- }
- return text;
- }
-
- private String buildString(BuildStringStrategy strategy) {
- short type = getLexicalUnitType();
- String text = simpleAsString();
- if (text == null) {
- switch (type) {
- 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:
- text = buildFunctionString(strategy);
- 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 = strategy.build(getSubValues());
- break;
- default:
- text = "@unknown";
- break;
- }
- }
- if (getNextLexicalUnit() != null) {
- if (getNextLexicalUnit().getLexicalUnitType() == SAC_OPERATOR_COMMA) {
- return text + strategy.build(getNextLexicalUnit());
- }
- return text + ' ' + strategy.build(getNextLexicalUnit());
- } else {
- return text;
- }
- }
-
- private String buildFunctionString(BuildStringStrategy strategy) {
- SCSSFunctionGenerator generator = getGenerator(getFunctionName());
- return generator.printState(this, strategy);
- }
-
- static {
- for (SCSSFunctionGenerator serializer : initSerializers()) {
- SERIALIZERS.put(serializer.getFunctionName(), serializer);
- }
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java b/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java
deleted file mode 100644
index 35589e0a94..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/*
- * 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 java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.w3c.css.sac.Locator;
-
-import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
-
-/**
- * @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;
-
- @Override
- public String getURI() {
- return uri;
- }
-
- @Override
- public int getLineNumber() {
- return line;
- }
-
- @Override
- public int getColumnNumber() {
- return column;
- }
-
- /**
- * Creates a new LocatorImpl
- */
- public LocatorImpl(Parser p) {
- if (W3CDebug) {
- log("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) {
- log("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) {
- log("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) {
- log("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) {
- log("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) {
- log("LocatorImpl::reInit(" + p + ", " + line + ", " + column + ");");
- }
- uri = p.source.getURI();
- this.line = line;
- this.column = column;
- return this;
- }
-
- private void log(String msg) {
- Logger.getLogger(SCSSDocumentHandlerImpl.class.getName()).log(
- Level.SEVERE, msg);
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/MediaListImpl.java b/theme-compiler/src/com/vaadin/sass/internal/parser/MediaListImpl.java
deleted file mode 100644
index 1cc4cf351d..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/MediaListImpl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/*
- * (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();
- }
- }
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/ParseException.java b/theme-compiler/src/com/vaadin/sass/internal/parser/ParseException.java
deleted file mode 100644
index 392d71e767..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/ParseException.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/* 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:
- */
- 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();
- }
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
deleted file mode 100644
index d1460ea2fc..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
+++ /dev/null
@@ -1,7887 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/* 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.Arrays;
-import java.util.Locale;
-import java.util.Map;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-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);
- }
-
- public InputSource getInputSource(){
- return source;
- }
-
- /**
- * 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.
- */
- // TODO required by original parser but not used by Vaadin?
- 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 ?");
- }
- }
- }
- //use UTF-8 as the default encoding.
- String encoding = source.getEncoding();
- InputStream input = source.getByteStream();
- if (!input.markSupported()) {
- // If mark is not supported, wrap it in a stream which supports mark
- input = new BufferedInputStream(input);
- source.setByteStream(input);
- }
- // Mark either the original stream or the wrapped stream
- input.mark(100);
- if(encoding == null){
- encoding = "ASCII";
-
- char c = ' ';
-
- 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);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- jj_consume_token(SEMICOLON);
- break;
- default:
- jj_la1[8] = jj_gen;
- acceptMissingSemicolon(EOF);
- }
- } 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 DEBUG_SYM:
- case WARN_SYM:
- debuggingDirective();
- break;
- case MIXIN_SYM:
- mixinDirective();
- break;
- case EACH_SYM:
- case IF_SYM:
- controlDirective();
- break;
- case INCLUDE_SYM:
- includeDirective();
- break;
- case PLUS:
- case PRECEDES:
- case SIBLING:
- 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;
- case KEY_FRAME_SYM:
- keyframes();
- break;
- default:
- jj_la1[9] = jj_gen;
- if (jj_2_1(2147483647)) {
- variable();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- listModifyDirective();
- break;
- default:
- jj_la1[10] = jj_gen;
- l = getLocator();
- ret = skipStatement();
- if ((ret == null) || (ret.length() == 0)) {
- {if (true) return;}
- }
- if (ret.charAt(0) == '@') {
- documentHandler.unrecognizedRule(ret);
- } else {
- reportWarningSkipText(l, ret);
- }
- }
- }
- }
- label_8:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[11] = jj_gen;
- break label_8;
- }
- ignoreStatement();
- label_9:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[12] = 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[13] = 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[14] = 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[15] = 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[16] = jj_gen;
- break label_11;
- }
- jj_consume_token(S);
- }
- mediaStatement(ml);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- jj_consume_token(SEMICOLON);
- break;
- default:
- jj_la1[17] = jj_gen;
- acceptMissingSemicolon(RBRACE, EOF);
- }
- label_12:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[18] = 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 keyframes() throws ParseException {
- Token n;
- boolean start = false;
- String keyframeName = null;
- String animationname = "";
- try {
- n = jj_consume_token(KEY_FRAME_SYM);
- label_13:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[19] = jj_gen;
- break label_13;
- }
- jj_consume_token(S);
- }
- keyframeName = n.image;
- label_14:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- animationname += n.image;
- break;
- case INTERPOLATION:
- n = jj_consume_token(INTERPOLATION);
- animationname += n.image;
- break;
- default:
- jj_la1[20] = 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[21] = jj_gen;
- break label_14;
- }
- }
- label_15:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[22] = jj_gen;
- break label_15;
- }
- jj_consume_token(S);
- }
- start = true; documentHandler.startKeyFrames(keyframeName, animationname);
- jj_consume_token(LBRACE);
- label_16:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[23] = jj_gen;
- break label_16;
- }
- jj_consume_token(S);
- }
- label_17:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case TO:
- case FROM:
- case CONTENT_SYM:
- case PERCENTAGE:
- ;
- break;
- default:
- jj_la1[24] = jj_gen;
- break label_17;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case TO:
- case FROM:
- case PERCENTAGE:
- keyframeSelector();
- break;
- case CONTENT_SYM:
- contentDirective();
- break;
- default:
- jj_la1[25] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_18:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[26] = jj_gen;
- break label_18;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- } finally {
- if (start) {
- documentHandler.endKeyFrames();
- }
- }
- }
-
- final public void keyframeSelector() throws ParseException {
- Token n;
- String selector = "";
- boolean start = false;
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case FROM:
- n = jj_consume_token(FROM);
- break;
- case TO:
- n = jj_consume_token(TO);
- break;
- case PERCENTAGE:
- n = jj_consume_token(PERCENTAGE);
- break;
- default:
- jj_la1[27] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- selector += n.image;
- label_19:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[28] = jj_gen;
- break label_19;
- }
- jj_consume_token(S);
- }
- label_20:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[29] = jj_gen;
- break label_20;
- }
- jj_consume_token(COMMA);
- label_21:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[30] = jj_gen;
- break label_21;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case FROM:
- n = jj_consume_token(FROM);
- break;
- case TO:
- n = jj_consume_token(TO);
- break;
- case PERCENTAGE:
- n = jj_consume_token(PERCENTAGE);
- break;
- default:
- jj_la1[31] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- selector += (", " + n.image);
- label_22:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[32] = jj_gen;
- break label_22;
- }
- jj_consume_token(S);
- }
- }
- jj_consume_token(LBRACE);
- label_23:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[33] = jj_gen;
- break label_23;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startKeyframeSelector(selector);
- label_24:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case MICROSOFT_RULE:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[34] = jj_gen;
- break label_24;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ifContentStatement();
- break;
- case MICROSOFT_RULE:
- microsoftExtension();
- break;
- default:
- jj_la1[35] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_25:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[36] = jj_gen;
- break label_25;
- }
- 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.endKeyframeSelector();
- }
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
-/* see http://www.w3.org/TR/css3-mediaqueries/ */
- final public void media() throws ParseException {
- boolean start = false;
- String ret;
- MediaListImpl ml = new MediaListImpl();
- try {
- jj_consume_token(MEDIA_SYM);
- label_26:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[37] = jj_gen;
- break label_26;
- }
- jj_consume_token(S);
- }
- mediaStatement(ml);
- start = true; documentHandler.startMedia(ml);
- jj_consume_token(LBRACE);
- label_27:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[38] = jj_gen;
- break label_27;
- }
- jj_consume_token(S);
- }
- label_28:
- 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 SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case NONASCII:
- case DEBUG_SYM:
- case WARN_SYM:
- case CONTENT_SYM:
- 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[39] = jj_gen;
- break label_28;
- }
- mediaDirective();
- }
- jj_consume_token(RBRACE);
- label_29:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[40] = jj_gen;
- break label_29;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } finally {
- if (start) {
- documentHandler.endMedia(ml);
- }
- }
- }
-
- final public void mediaDirective() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DEBUG_SYM:
- case WARN_SYM:
- debuggingDirective();
- break;
- case PLUS:
- case PRECEDES:
- case SIBLING:
- 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 MINUS:
- case COMMA:
- case SEMICOLON:
- 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;
- case CONTENT_SYM:
- contentDirective();
- break;
- default:
- jj_la1[41] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
- final public void mediaStatement(MediaListImpl ml) throws ParseException {
- Token t;
- t = getToken(1);
- // loop over comma separated parts, add each to ml
- while ((t.kind != LBRACE) && (t.kind != EOF) && (t.kind != SEMICOLON)) {
- StringBuffer s = new StringBuffer();
- s.append(getToken(0).image);
- while ((t.kind != COMMA) && (t.kind != LBRACE) && (t.kind != EOF) && (t.kind != SEMICOLON)) {
- s.append(t.image);
- getNextToken();
- t = getToken(1);
- }
- if (t.kind == COMMA) {
- // skip the comma and the token before it that is still the active token
- getNextToken();
- getNextToken();
- t = getToken(1);
- }
- String str = s.toString().trim();
- if (str.length() > 0) {
- ml.addItem(str);
- }
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String medium() throws ParseException {
- Token n;
- n = jj_consume_token(IDENT);
- {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_30:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[42] = jj_gen;
- break label_30;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- 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);
- }
- break;
- default:
- jj_la1[44] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- pseudo = pseudo_page();
- break;
- default:
- jj_la1[45] = jj_gen;
- ;
- }
- if (n != null) {
- page = convertIdent(n.image);
- }
- jj_consume_token(LBRACE);
- label_32:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[46] = jj_gen;
- break label_32;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startPage(page, pseudo);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[47] = jj_gen;
- ;
- }
- label_33:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[48] = jj_gen;
- break label_33;
- }
- jj_consume_token(SEMICOLON);
- label_34:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[49] = jj_gen;
- break label_34;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[50] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- 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);
- }
- } 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_36:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[52] = jj_gen;
- break label_36;
- }
- 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_37:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[53] = jj_gen;
- break label_37;
- }
- jj_consume_token(S);
- }
- jj_consume_token(LBRACE);
- label_38:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[54] = jj_gen;
- break label_38;
- }
- jj_consume_token(S);
- }
- start = true; documentHandler.startFontFace();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[55] = jj_gen;
- ;
- }
- label_39:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[56] = jj_gen;
- break label_39;
- }
- jj_consume_token(SEMICOLON);
- 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);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[58] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_41:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[59] = jj_gen;
- break label_41;
- }
- 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();
- if ((ret != null) && (ret.charAt(0) == '@')) {
- documentHandler.unrecognizedRule(ret);
- } else {
- reportWarningSkipText(getLocator(), 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 MINUS:
- n = jj_consume_token(MINUS);
- break;
- case UNKNOWN:
- n = jj_consume_token(UNKNOWN);
- break;
- default:
- jj_la1[60] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- String ret;
- Locator loc = getLocator();
- ret=skipStatement();
- if ((ret != null) && (n.image.charAt(0) == '@')) {
- documentHandler.unrecognizedRule(ret);
- } else {
- reportWarningSkipText(loc, 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:
- case PRECEDES:
- case SIBLING:
- connector = combinatorChar();
- break;
- case S:
- jj_consume_token(S);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- connector = combinatorChar();
- break;
- default:
- jj_la1[61] = jj_gen;
- ;
- }
- break;
- default:
- jj_la1[62] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return connector;}
- throw new Error("Missing return statement in function");
- }
-
-/**to refactor combinator and reuse in selector().*/
- final public char combinatorChar() throws ParseException {
- Token t;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- t = jj_consume_token(PLUS);
- break;
- case PRECEDES:
- t = jj_consume_token(PRECEDES);
- break;
- case SIBLING:
- t = jj_consume_token(SIBLING);
- break;
- default:
- jj_la1[63] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_42:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[64] = jj_gen;
- break label_42;
- }
- jj_consume_token(S);
- }
- {if (true) return t.image.charAt(0);}
- throw new Error("Missing return statement in function");
- }
-
- final public void microsoftExtension() throws ParseException {
- Token n;
- String name = "";
- String value = "";
- // This is not really taking the syntax of filter rules into account
- n = jj_consume_token(MICROSOFT_RULE);
- label_43:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[65] = jj_gen;
- break label_43;
- }
- jj_consume_token(S);
- }
- name = n.image;
- jj_consume_token(COLON);
- label_44:
- 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 STRING:
- n = jj_consume_token(STRING);
- value += n.image;
- break;
- case COMMA:
- n = jj_consume_token(COMMA);
- 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[66] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- case EQ:
- case COMMA:
- case DOT:
- case RPARAN:
- case COLON:
- case INTERPOLATION:
- case STRING:
- case IDENT:
- case NUMBER:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[67] = jj_gen;
- break label_44;
- }
- }
- jj_consume_token(SEMICOLON);
- label_45:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[68] = jj_gen;
- break label_45;
- }
- jj_consume_token(S);
- }
- documentHandler.microsoftDirective(name, value);
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String property() throws ParseException {
- Token t;String s = "";
- label_46:
- 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[69] = 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[70] = jj_gen;
- break label_46;
- }
- }
- label_47:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[71] = jj_gen;
- break label_47;
- }
- jj_consume_token(S);
- }
- {if (true) return s;}
- throw new Error("Missing return statement in function");
- }
-
- final public String variableName() throws ParseException {
- Token n;
- n = jj_consume_token(VARIABLE);
- label_48:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[72] = jj_gen;
- break label_48;
- }
- 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_49:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[73] = jj_gen;
- break label_49;
- }
- 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 l = null;
- Token save;
- Locator loc;
- try {
- l = selectorList();
- save = token;
- jj_consume_token(LBRACE);
- label_50:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[74] = jj_gen;
- break label_50;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startSelector(l);
- label_51:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case MICROSOFT_RULE:
- case IDENT:
- case VARIABLE:
- case HASH:
- case IMPORT_SYM:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[75] = jj_gen;
- break label_51;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ifContentStatement();
- break;
- case MICROSOFT_RULE:
- microsoftExtension();
- break;
- case IMPORT_SYM:
- importDeclaration();
- break;
- default:
- jj_la1[76] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_52:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[77] = jj_gen;
- break label_52;
- }
- 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 selectorList() throws ParseException {
- ArrayList selectors = new ArrayList();
- String selector;
- selector = selector();
- label_53:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[78] = jj_gen;
- break label_53;
- }
- jj_consume_token(COMMA);
- label_54:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[79] = jj_gen;
- break label_54;
- }
- 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 = null;
- char comb;
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- selector = simple_selector(null, ' ');
- break;
- case PLUS:
- case PRECEDES:
- case SIBLING:
- comb = combinatorChar();
- selector = simple_selector(selector, comb);
- break;
- default:
- jj_la1[80] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_55:
- while (true) {
- if (jj_2_2(2)) {
- ;
- } else {
- break label_55;
- }
- comb = combinator();
- selector = simple_selector(selector, comb);
- }
- label_56:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[81] = jj_gen;
- break label_56;
- }
- 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_57:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[82] = jj_gen;
- break label_57;
- }
- 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[83] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- label_58:
- while (true) {
- 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[84] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[85] = jj_gen;
- break label_58;
- }
- }
- break;
- default:
- jj_la1[86] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- if (simple_current == null) {
- simple_current = "";
- }
- if (cond != null) {
- simple_current = simple_current + cond;
- }
- StringBuilder builder = new StringBuilder();
- switch (comb) {
- case ' ':
- if(selector!=null){
- builder.append(selector).append(" ");
- }
- break;
- case '+':
- case '>':
- case '~':
- if(selector!=null){
- builder.append(selector).append(" ");
- }
- builder.append(comb).append(" ");
- break;
- default:
- {if (true) throw new ParseException("invalid state. send a bug report");}
- }
- builder.append(simple_current);
- selector = builder.toString();
-
- 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_59:
- 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[87] = 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[88] = jj_gen;
- break label_59;
- }
- }
- 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_60:
- 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[89] = 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[90] = jj_gen;
- break label_60;
- }
- }
- {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[91] = 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_61:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[92] = jj_gen;
- break label_61;
- }
- jj_consume_token(S);
- }
- att = jj_consume_token(IDENT);
- label_62:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[93] = jj_gen;
- break label_62;
- }
- 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[94] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_63:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[95] = jj_gen;
- break label_63;
- }
- 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[96] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_64:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[97] = jj_gen;
- break label_64;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[98] = 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 param;
-String d;
-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[99] = 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_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);
- }
- d = skipStatementUntilMatchingRightParan();
- jj_consume_token(RPARAN);
- // accept anything between function and a right parenthesis
- String f = convertIdent(n.image);
- String colons = isPseudoElement ? "::" : ":";
- String pseudofn = colons + f + d + ")";
- if (pred == null) {
- {if (true) return pseudofn;}
- } else {
- {if (true) return pred + pseudofn;}
- }
- break;
- default:
- jj_la1[101] = 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_66:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[102] = jj_gen;
- break label_66;
- }
- jj_consume_token(S);
- }
- exp = expr();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case GUARDED_SYM:
- guarded = guarded();
- break;
- default:
- jj_la1[103] = jj_gen;
- ;
- }
- semicolonTerminator();
- exp = replaceNullValues(exp);
- 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();
- }
- }
- }
-
- LexicalUnitImpl replaceNullValues(LexicalUnitImpl unit) throws ParseException {
- if(unit == null){
- return null;
- }
- if (unit.getNextLexicalUnit() != null) {
- unit.setNextLexicalUnit(replaceNullValues(unit.getNextLexicalUnit()));
- }
- if (unit.getLexicalUnitType() == SCSSLexicalUnit.SAC_IDENT
- && "null".equals(unit.getStringValue())) {
- LexicalUnitImpl next = unit.getNextLexicalUnit();
- unit = LexicalUnitImpl.createNull(unit.getLineNumber(), unit.getColumnNumber(),
- unit.getPreviousLexicalUnit());
- unit.setNextLexicalUnit(next);
- }
- return unit;
- }
-
- final public void controlDirective() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF_SYM:
- ifDirective();
- break;
- case EACH_SYM:
- eachDirective();
- break;
- default:
- jj_la1[104] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
- final public void ifContentStatement() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CONTENT_SYM:
- contentDirective();
- break;
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case DEBUG_SYM:
- case WARN_SYM:
- case IDENT:
- case HASH:
- styleRuleOrDeclarationOrNestedProperties();
- break;
- case KEY_FRAME_SYM:
- keyframes();
- break;
- default:
- jj_la1[105] = jj_gen;
- if (jj_2_3(2147483647)) {
- variable();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- listModifyDirective();
- break;
- case EACH_SYM:
- case IF_SYM:
- controlDirective();
- break;
- case ATKEYWORD:
- atRuleDeclaration();
- break;
- default:
- jj_la1[106] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
-
- final public void ifDirective() throws ParseException {
- Token n = null;
- String s = null;
- String evaluator = "";
- jj_consume_token(IF_SYM);
- label_67:
- while (true) {
- s = booleanExpressionToken();
- evaluator += s;
- 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:
- case CONTAINS:
- ;
- break;
- default:
- jj_la1[107] = jj_gen;
- break label_67;
- }
- }
- jj_consume_token(LBRACE);
- label_68:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[108] = jj_gen;
- break label_68;
- }
- jj_consume_token(S);
- }
- documentHandler.startIfElseDirective();
- documentHandler.ifDirective(evaluator);
- label_69:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case FONT_FACE_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[109] = jj_gen;
- break label_69;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ifContentStatement();
- break;
- case FONT_FACE_SYM:
- fontFace();
- break;
- default:
- jj_la1[110] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_70:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[111] = jj_gen;
- break label_70;
- }
- jj_consume_token(S);
- }
- label_71:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ELSE_SYM:
- ;
- break;
- default:
- jj_la1[112] = jj_gen;
- break label_71;
- }
- elseDirective();
- }
- documentHandler.endIfElseDirective();
- }
-
- final public void elseDirective() throws ParseException {
- String evaluator = "";
- Token n = null;
- String s = null;
- jj_consume_token(ELSE_SYM);
- label_72:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[113] = jj_gen;
- break label_72;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- jj_consume_token(IF);
- label_73:
- while (true) {
- s = booleanExpressionToken();
- evaluator += s;
- 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:
- case CONTAINS:
- ;
- break;
- default:
- jj_la1[114] = jj_gen;
- break label_73;
- }
- }
- break;
- default:
- jj_la1[115] = jj_gen;
- ;
- }
- jj_consume_token(LBRACE);
- label_74:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[116] = jj_gen;
- break label_74;
- }
- jj_consume_token(S);
- }
- if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); }
- else{ documentHandler.elseDirective(); }
- label_75:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case FONT_FACE_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[117] = jj_gen;
- break label_75;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ifContentStatement();
- break;
- case FONT_FACE_SYM:
- fontFace();
- break;
- default:
- jj_la1[118] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_76:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[119] = jj_gen;
- break label_76;
- }
- jj_consume_token(S);
- }
- }
-
- final public String booleanExpressionToken() throws ParseException {
- Token n = null;
- String s = null;
- if (jj_2_4(2147483647)) {
- s = containsDirective();
- } else {
- 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[120] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- if(n!=null){{if (true) return n.image;}}
- else{{if (true) return s;}}
- throw new Error("Missing return statement in function");
- }
-
- final public void eachDirective() throws ParseException {
- Token var;
- ArrayList list = null;
- String listVariable = null;
- jj_consume_token(EACH_SYM);
- label_77:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[121] = jj_gen;
- break label_77;
- }
- jj_consume_token(S);
- }
- var = jj_consume_token(VARIABLE);
- label_78:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[122] = jj_gen;
- break label_78;
- }
- jj_consume_token(S);
- }
- jj_consume_token(EACH_IN);
- label_79:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[123] = jj_gen;
- break label_79;
- }
- 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[124] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- jj_consume_token(LBRACE);
- 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);
- }
- label_81:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[126] = jj_gen;
- break label_81;
- }
- ifContentStatement();
- }
- jj_consume_token(RBRACE);
- 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);
- }
- documentHandler.endEachDirective();
- }
-
- final public ArrayList stringList() throws ParseException {
- ArrayList strings = new ArrayList();
- Token input;
- input = jj_consume_token(IDENT);
- 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);
- }
- strings.add(input.image);
- label_84:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[129] = jj_gen;
- break label_84;
- }
- jj_consume_token(COMMA);
- 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);
- }
- input = jj_consume_token(IDENT);
- strings.add(input.image);
- label_86:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[131] = jj_gen;
- break label_86;
- }
- 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 args = null;
- String body;
- jj_consume_token(MIXIN_SYM);
- label_87:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[132] = jj_gen;
- break label_87;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- name = property();
- break;
- case FUNCTION:
- name = functionName();
- args = arglist();
- jj_consume_token(RPARAN);
- label_88:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[133] = jj_gen;
- break label_88;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[134] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- jj_consume_token(LBRACE);
- label_89:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[135] = jj_gen;
- break label_89;
- }
- jj_consume_token(S);
- }
- documentHandler.startMixinDirective(name, args);
- label_90:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case PAGE_SYM:
- case FONT_FACE_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[136] = jj_gen;
- break label_90;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case INCLUDE_SYM:
- case DEBUG_SYM:
- case WARN_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case CONTENT_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case KEY_FRAME_SYM:
- case ATKEYWORD:
- ifContentStatement();
- break;
- case FONT_FACE_SYM:
- fontFace();
- break;
- case PAGE_SYM:
- page();
- break;
- default:
- jj_la1[137] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_91:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[138] = jj_gen;
- break label_91;
- }
- jj_consume_token(S);
- }
- documentHandler.endMixinDirective(name, args);
- }
-
- final public ArrayList arglist() throws ParseException {
- ArrayList args = new ArrayList();
- VariableNode arg;
- boolean hasNonOptionalArgument = false;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- arg = mixinArg();
- label_92:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[139] = jj_gen;
- break label_92;
- }
- jj_consume_token(COMMA);
- label_93:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[140] = jj_gen;
- break label_93;
- }
- jj_consume_token(S);
- }
- hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
- arg = mixinArg();
- }
- hasNonOptionalArgument = checkMixinForNonOptionalArguments(arg, hasNonOptionalArgument); args.add(arg);
- break;
- default:
- jj_la1[141] = jj_gen;
- ;
- }
- {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_94:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[142] = jj_gen;
- break label_94;
- }
- jj_consume_token(S);
- }
- first = nonVariableTerm(null);
- prev = first;
- label_95:
- while (true) {
- if (jj_2_5(3)) {
- ;
- } else {
- break label_95;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_96:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[143] = jj_gen;
- break label_96;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[144] = 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[145] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[146] = jj_gen;
- ;
- }
- VariableNode arg = new VariableNode(name, first, false);
- {if (true) return arg;}
- throw new Error("Missing return statement in function");
- }
-
- final public ArrayList argValuelist() throws ParseException {
- ArrayList args = new ArrayList();
- LexicalUnitImpl first = null;
- LexicalUnitImpl next = null;
- LexicalUnitImpl prev = null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case TO:
- case THROUGH:
- case FROM:
- 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 LEM:
- case REM:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- first = term(null);
- args.add(first); prev = first;
- label_97:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case COLON:
- case TO:
- case THROUGH:
- case FROM:
- 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 LEM:
- case REM:
- 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[147] = jj_gen;
- break label_97;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_98:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[148] = jj_gen;
- break label_98;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[149] = jj_gen;
- ;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next); prev = next;
- }
- label_99:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[150] = jj_gen;
- break label_99;
- }
- jj_consume_token(COMMA);
- label_100:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[151] = jj_gen;
- break label_100;
- }
- jj_consume_token(S);
- }
- first = term(null);
- args.add(first); prev = first;
- label_101:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case COLON:
- case TO:
- case THROUGH:
- case FROM:
- 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 LEM:
- case REM:
- 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[152] = jj_gen;
- break label_101;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_102:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[153] = jj_gen;
- break label_102;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[154] = jj_gen;
- ;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next); prev = next;
- }
- }
- break;
- default:
- jj_la1[155] = jj_gen;
- ;
- }
- {if (true) return args;}
- throw new Error("Missing return statement in function");
- }
-
- final public void includeDirective() throws ParseException {
- String name;
- ArrayList args=null;
- jj_consume_token(INCLUDE_SYM);
- label_103:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[156] = jj_gen;
- break label_103;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- name = property();
- break;
- case VARIABLE:
- name = variableName();
- name = "$"+name;
- break;
- case FUNCTION:
- name = functionName();
- args = argValuelist();
- jj_consume_token(RPARAN);
- label_104:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[157] = jj_gen;
- break label_104;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[158] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- documentHandler.startInclude(name, args);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- includeDirectiveBlockContents();
- break;
- default:
- jj_la1[159] = jj_gen;
- semicolonTerminator();
- }
- documentHandler.endInclude();
- }
-
- final public void semicolonTerminator() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- label_105:
- while (true) {
- jj_consume_token(SEMICOLON);
- label_106:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[160] = jj_gen;
- break label_106;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[161] = jj_gen;
- break label_105;
- }
- }
- break;
- default:
- jj_la1[162] = jj_gen;
- acceptMissingSemicolon(RBRACE, EOF);
- }
- }
-
- void acceptMissingSemicolon(Integer... acceptedTerminators) throws ParseException, ParseException {
- Token next = getToken(1);
- ArrayList terminators = new ArrayList(Arrays.asList(acceptedTerminators));
- if (!terminators.contains(next.kind)){
- String message = "encountered \u005c"" + next.image + "\u005c". Was expecting one of \u005c";\u005c"";
- for(int term : acceptedTerminators){
- message += ", " + tokenImage[term];
- }
- ParseException e = new ParseException(message);
- throw e;
- }
- }
-
- final public void includeDirectiveBlockContents() throws ParseException {
- jj_consume_token(LBRACE);
- label_107:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[163] = jj_gen;
- break label_107;
- }
- jj_consume_token(S);
- }
- label_108:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case TO:
- case FROM:
- case DEBUG_SYM:
- case WARN_SYM:
- case IDENT:
- case PERCENTAGE:
- case HASH:
- ;
- break;
- default:
- jj_la1[164] = jj_gen;
- break label_108;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case DEBUG_SYM:
- case WARN_SYM:
- case IDENT:
- case HASH:
- styleRuleOrDeclarationOrNestedProperties();
- break;
- case TO:
- case FROM:
- case PERCENTAGE:
- keyframeSelector();
- break;
- default:
- jj_la1[165] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_109:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[166] = jj_gen;
- break label_109;
- }
- jj_consume_token(S);
- }
- }
-
- 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 {
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
- Token type = null;
- //refactor, remove those 3 LOOKAHEAD(5).
- n = jj_consume_token(VARIABLE);
- variable = n.image;
- label_110:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[167] = jj_gen;
- break label_110;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_111:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[168] = jj_gen;
- break label_111;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case APPEND:
- type = jj_consume_token(APPEND);
- break;
- case REMOVE:
- type = jj_consume_token(REMOVE);
- break;
- case CONTAINS:
- type = jj_consume_token(CONTAINS);
- break;
- default:
- jj_la1[169] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_112:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[170] = jj_gen;
- break label_112;
- }
- 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[171] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_113:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[172] = jj_gen;
- break label_113;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_114:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[173] = jj_gen;
- break label_114;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_115:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[174] = jj_gen;
- break label_115;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[175] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- switch (type.kind) {
- case APPEND:
- documentHandler.appendDirective(variable,list,remove,separator);
- break;
- case REMOVE:
- documentHandler.removeDirective(variable,list,remove,separator);
- break;
- case CONTAINS:
- if(variable == null){
- variable = "$var_"+UUID.randomUUID();
- }
- documentHandler.containsDirective(variable,list,remove,separator);
- break;
- default:
- break;
- }
- label_116:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[176] = jj_gen;
- break label_116;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- label_117:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[177] = jj_gen;
- break label_117;
- }
- jj_consume_token(S);
- }
- }
-
-/**
- * @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_118:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[178] = jj_gen;
- break label_118;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_119:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[179] = jj_gen;
- break label_119;
- }
- jj_consume_token(S);
- }
- jj_consume_token(APPEND);
- label_120:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[180] = jj_gen;
- break label_120;
- }
- 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[181] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_121:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[182] = jj_gen;
- break label_121;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_122:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[183] = jj_gen;
- break label_122;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_123:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[184] = jj_gen;
- break label_123;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[185] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- 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_124:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[186] = jj_gen;
- break label_124;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_125:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[187] = jj_gen;
- break label_125;
- }
- jj_consume_token(S);
- }
- jj_consume_token(REMOVE);
- label_126:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[188] = jj_gen;
- break label_126;
- }
- 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[189] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_127:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[190] = jj_gen;
- break label_127;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_128:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[191] = jj_gen;
- break label_128;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_129:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[192] = jj_gen;
- break label_129;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[193] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- documentHandler.removeDirective(variable,list,remove,separator);
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public String containsDirective() throws ParseException {
- String list = null;
- String remove = null;
- String separator = null;
- String variable = null;
- Token n = null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case VARIABLE:
- n = jj_consume_token(VARIABLE);
- variable = n.image;
- label_130:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[194] = jj_gen;
- break label_130;
- }
- jj_consume_token(S);
- }
- jj_consume_token(COLON);
- label_131:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[195] = jj_gen;
- break label_131;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[196] = jj_gen;
- ;
- }
- jj_consume_token(CONTAINS);
- label_132:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[197] = jj_gen;
- break label_132;
- }
- 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[198] = jj_gen;
- ;
- }
- jj_consume_token(COMMA);
- label_133:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[199] = jj_gen;
- break label_133;
- }
- jj_consume_token(S);
- }
- remove = listModifyDirectiveArgs(1);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_134:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[200] = jj_gen;
- break label_134;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_135:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[201] = jj_gen;
- break label_135;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[202] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- /*
- *if it is not in the form like "$contains : contains($items, .v-button);"
- *for example in @if, like "@if (contains(a b c, b))", then create a temp
- *variable for contains(a b c, b);
- */
- if(variable == null){
- variable = "$var_"+UUID.randomUUID();
- }
- documentHandler.containsDirective(variable,list,remove,separator);
- {if (true) return variable;}
- throw new Error("Missing return statement in function");
- }
-
- 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");
- }
-
- final public void debuggingDirective() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DEBUG_SYM:
- debugDirective();
- break;
- case WARN_SYM:
- warnDirective();
- break;
- default:
- jj_la1[203] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
- final public void debugDirective() throws ParseException {
- jj_consume_token(DEBUG_SYM);
- String content = skipStatementUntil(new int[] {SEMICOLON,RBRACE,EOF});
- // TODO should evaluate the content expression, call documentHandler.debugDirective() etc.
- Logger.getLogger(Parser.class.getName()).log(Level.INFO, content);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- jj_consume_token(SEMICOLON);
- label_136:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[204] = jj_gen;
- break label_136;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[205] = jj_gen;
- acceptMissingSemicolon(RBRACE, EOF);
- }
- }
-
- final public void warnDirective() throws ParseException {
- jj_consume_token(WARN_SYM);
- String content = skipStatementUntil(new int[] {SEMICOLON,RBRACE,EOF});
- // TODO should evaluate the content expression, call documentHandler.warnDirective() etc.
- Logger.getLogger(Parser.class.getName()).log(Level.SEVERE, content);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- jj_consume_token(SEMICOLON);
- label_137:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[206] = jj_gen;
- break label_137;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[207] = jj_gen;
- acceptMissingSemicolon(RBRACE, EOF);
- }
- }
-
- 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[208] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- to = skipStatementUntilLeftBrace();
- label_138:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[209] = jj_gen;
- break label_138;
- }
- 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 list;
- jj_consume_token(EXTEND_SYM);
- label_139:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[210] = jj_gen;
- break label_139;
- }
- jj_consume_token(S);
- }
- list = selectorList();
- documentHandler.extendDirective(list);
- semicolonTerminator();
- }
-
- final public void contentDirective() throws ParseException {
- jj_consume_token(CONTENT_SYM);
- label_140:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[211] = jj_gen;
- break label_140;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- jj_consume_token(SEMICOLON);
- label_141:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[212] = jj_gen;
- break label_141;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[213] = jj_gen;
- acceptMissingSemicolon(RBRACE, EOF);
- }
- documentHandler.contentDirective();
- }
-
- 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_142:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[214] = jj_gen;
- break label_142;
- }
- jj_consume_token(S);
- }
- jj_consume_token(LBRACE);
- label_143:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[215] = jj_gen;
- break label_143;
- }
- jj_consume_token(S);
- }
- documentHandler.startNestedProperties(name);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[216] = jj_gen;
- ;
- }
- label_144:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[217] = jj_gen;
- break label_144;
- }
- jj_consume_token(SEMICOLON);
- label_145:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[218] = jj_gen;
- break label_145;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[219] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- documentHandler.endNestedProperties(name);
- label_146:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[220] = jj_gen;
- break label_146;
- }
- jj_consume_token(S);
- }
- }
-
-/**
- * @exception ParseException exception during the parse
- */
- final public void styleRuleOrDeclarationOrNestedProperties() throws ParseException {
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DEBUG_SYM:
- case WARN_SYM:
- debuggingDirective();
- break;
- default:
- jj_la1[221] = jj_gen;
- if (jj_2_6(2147483647)) {
- styleRule();
- } else if (jj_2_7(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case PRECEDES:
- case SIBLING:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case INTERPOLATION:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[222] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- } catch (JumpException e) {
- skipAfterExpression();
- // 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 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_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);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case TO:
- case THROUGH:
- case FROM:
- 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 LEM:
- case REM:
- 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[224] = jj_gen;
- ;
- }
- Token next = getToken(1);
- if(next.kind == SEMICOLON || next.kind == RBRACE){
- while(next.kind == SEMICOLON){
- skipStatement();
- next = getToken(1);
- }
- //only add special token kept for sprites '/**'
- if(token.specialToken!=null && token.specialToken!=null && token.specialToken.image.startsWith("/**")){
- documentHandler.property(name, exp, important, token.specialToken.image);
- }else{
- documentHandler.property(name, exp, important, null);
- }
- }
- break;
- case LBRACE:
- jj_consume_token(LBRACE);
- label_148:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[225] = jj_gen;
- break label_148;
- }
- jj_consume_token(S);
- }
- documentHandler.startNestedProperties(name);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[226] = jj_gen;
- ;
- }
- label_149:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[227] = jj_gen;
- break label_149;
- }
- jj_consume_token(SEMICOLON);
- 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);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[229] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_151:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[230] = jj_gen;
- break label_151;
- }
- jj_consume_token(S);
- }
- documentHandler.endNestedProperties(name);
- break;
- default:
- jj_la1[231] = 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_152:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[232] = jj_gen;
- break label_152;
- }
- jj_consume_token(S);
- }
- exp = expr();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IMPORTANT_SYM:
- important = prio();
- break;
- default:
- jj_la1[233] = 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_153:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[234] = jj_gen;
- break label_153;
- }
- 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_154:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[235] = jj_gen;
- break label_154;
- }
- 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 COMMA:
- /* (comments copied from basic_arithmetics.scss)
- *supports:
- * 1. standard arithmetic operations (+, -, *, /, %)
- * 2. / is treated as css operator, unless one of its operands is variable or there is another binary arithmetic operator
- *limits:
- * 1. cannot mix arithmetic and css operations, e.g. "margin: 1px + 3px 2px" will fail
- * 2. space between add and minus operator and their following operand is mandatory. e.g. "1 + 2" is valid, "1+2" is not
- * 3. parenthesis is not supported now.
- */
- n = jj_consume_token(COMMA);
- label_155:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[236] = jj_gen;
- break label_155;
- }
- jj_consume_token(S);
- }
- {if (true) return LexicalUnitImpl.createComma(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- case DIV:
- n = jj_consume_token(DIV);
- label_156:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[237] = jj_gen;
- break label_156;
- }
- jj_consume_token(S);
- }
- {if (true) return LexicalUnitImpl.createSlash(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- case ANY:
- n = jj_consume_token(ANY);
- label_157:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[238] = jj_gen;
- break label_157;
- }
- jj_consume_token(S);
- }
- {if (true) return LexicalUnitImpl.createMultiply(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- case MOD:
- n = jj_consume_token(MOD);
- label_158:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[239] = jj_gen;
- break label_158;
- }
- jj_consume_token(S);
- }
- {if (true) return LexicalUnitImpl.createModulo(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- case PLUS:
- n = jj_consume_token(PLUS);
- label_159:
- while (true) {
- jj_consume_token(S);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[240] = jj_gen;
- break label_159;
- }
- }
- {if (true) return LexicalUnitImpl.createAdd(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- case MINUS:
- n = jj_consume_token(MINUS);
- label_160:
- while (true) {
- jj_consume_token(S);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[241] = jj_gen;
- break label_160;
- }
- }
- {if (true) return LexicalUnitImpl.createMinus(n.beginLine,
- n.beginColumn,
- prev);}
- break;
- default:
- jj_la1[242] = 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_161:
- while (true) {
- if (jj_2_8(2)) {
- ;
- } else {
- break label_161;
- }
- if (jj_2_9(2)) {
- res = operator(res);
- } else {
- ;
- }
- 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[243] = 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 TO:
- case THROUGH:
- case FROM:
- 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 LEM:
- case REM:
- 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[244] = 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 LEM:
- case REM:
- 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[245] = 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 LEM:
- n = jj_consume_token(LEM);
- result = LexicalUnitImpl.createLEM(n.beginLine, n.beginColumn,
- prev, number(op, n, 3));
- break;
- case REM:
- n = jj_consume_token(REM);
- result = LexicalUnitImpl.createREM(n.beginLine, n.beginColumn,
- prev, number(op, n, 3));
- 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,
- number(op,n,s.length()-i),
- s.substring(i));
- break;
- case FUNCTION:
- result = function(op, prev);
- break;
- default:
- jj_la1[246] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- case DOT:
- case TO:
- case THROUGH:
- case FROM:
- 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 TO:
- case THROUGH:
- case FROM:
- case IDENT:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- jj_consume_token(DOT);
- s+=".";
- break;
- default:
- jj_la1[247] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- break;
- case TO:
- n = jj_consume_token(TO);
- break;
- case THROUGH:
- n = jj_consume_token(THROUGH);
- break;
- case FROM:
- n = jj_consume_token(FROM);
- break;
- default:
- jj_la1[248] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- 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[249] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[250] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_162:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[251] = jj_gen;
- break label_162;
- }
- 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_163:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[252] = jj_gen;
- break label_163;
- }
- 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);}
- }else if("expression(".equals(fname)){
- String body = skipStatementUntilSemiColon();
- {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- null, "expression("+body);}
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- case DOT:
- case TO:
- case THROUGH:
- case FROM:
- 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 LEM:
- case REM:
- 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[253] = 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;
- boolean hasVariables = false;
- while (loop && l != null && i < 5) {
- switch (i) {
- case 0:
- case 2:
- case 4:
- if (l.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) {
- hasVariables = true;
- } else 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 (hasVariables) {
- {if (true) return LexicalUnitImpl.createFunction(n.beginLine,
- n.beginColumn, prev,
- f.substring(0, f.length() - 1), params);}
- } else {
- {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine,
- n.beginColumn,
- prev, params);}
- }
- } else {
- if (errorHandler != null) {
- String errorText;
- 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 skipStatementUntilMatchingRightParan() throws ParseException {
- int[] leftTokens = {LPARAN, FUNCTION}; // a FUNCTION also contains "("
- int[] rightTokens = {RPARAN};
- StringBuffer s = new StringBuffer();
- int difference = 1;
- Token tok;
- while(difference != 0){
- tok = getToken(1);
- if(tok.kind == EOF) {
- return null;
- }
- for(int sym : leftTokens){
- if(tok.kind == sym){
- difference++;
- }
- }
- for(int sym : rightTokens){
- if(tok.kind == sym){
- difference--;
- }
- }
- if(difference != 0){
- if (tok.image != null) {
- s.append(tok.image);
- }
- getNextToken();
- }
- }
- return s.toString().trim();
- }
-
- String skipStatementUntil(int[] symbols) throws ParseException {
- StringBuffer s = new StringBuffer();
- boolean found = false;
- Token tok;
- while(!found){
- tok = getToken(1);
- for(int sym : symbols){
- if(tok.kind == sym){
- found = true;
- break;
- }
- }
- if(tok.kind == EOF) {
- break;
- }
- if(!found){
- if (tok.image != null) {
- s.append(tok.image);
- }
- getNextToken();
- }
- }
- return found ? s.toString().trim() : null;
- }
-
- 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':
- buf.append('\u005c\u005c');
- while (index < len) {
- buf.append(s.charAt(index++));
- }
- 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 {
- /*keeps only the multiple line comments, single line comments are skipped*/
- if (token.specialToken != null && token.specialToken.image!=null && token.specialToken.image.startsWith("/*")){
- 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.
- */
-// TODO required by original parser but not used by Vaadin?
- final public void _parseRule() throws ParseException {
- String ret = null;
- label_164:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[254] = jj_gen;
- break label_164;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IMPORT_SYM:
- importDeclaration();
- break;
- case DEBUG_SYM:
- case WARN_SYM:
- debuggingDirective();
- break;
- case PLUS:
- case PRECEDES:
- case SIBLING:
- 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[255] = jj_gen;
- ret = skipStatement();
- if ((ret == null) || (ret.length() == 0)) {
- {if (true) return;}
- }
- if (ret.charAt(0) == '@') {
- documentHandler.unrecognizedRule(ret);
- } else {
- {if (true) throw new CSSParseException("unrecognize rule: " + ret,
- getLocator());}
- }
- }
- }
-
- final public void _parseImportRule() throws ParseException {
- label_165:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[256] = jj_gen;
- break label_165;
- }
- jj_consume_token(S);
- }
- importDeclaration();
- }
-
- final public void _parseMediaRule() throws ParseException {
- label_166:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[257] = jj_gen;
- break label_166;
- }
- jj_consume_token(S);
- }
- media();
- }
-
- final public void _parseDeclarationBlock() throws ParseException {
- label_167:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[258] = jj_gen;
- break label_167;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[259] = jj_gen;
- ;
- }
- label_168:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[260] = jj_gen;
- break label_168;
- }
- jj_consume_token(SEMICOLON);
- label_169:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[261] = jj_gen;
- break label_169;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTERPOLATION:
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[262] = jj_gen;
- ;
- }
- }
- }
-
- final public ArrayList _parseSelectors() throws ParseException {
- ArrayList p = null;
- try {
- label_170:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[263] = jj_gen;
- break label_170;
- }
- 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_3R_174() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_189()) jj_scanpos = xsp;
- 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_3R_209() {
- if (jj_3R_208()) return true;
- return false;
- }
-
- private boolean jj_3R_208() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_scan_token(18)) {
- jj_scanpos = xsp;
- if (jj_scan_token(22)) {
- jj_scanpos = xsp;
- if (jj_scan_token(23)) return true;
- }
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_186() {
- if (jj_scan_token(S)) return true;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_209()) jj_scanpos = xsp;
- return false;
- }
-
- private boolean jj_3R_171() {
- if (jj_3R_181()) 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; }
- }
- if (jj_3R_182()) return true;
- xsp = jj_scanpos;
- if (jj_3R_183()) jj_scanpos = xsp;
- if (jj_3R_184()) return true;
- return false;
- }
-
- private boolean jj_3R_185() {
- if (jj_3R_208()) return true;
- return false;
- }
-
- private boolean jj_3R_172() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_185()) {
- jj_scanpos = xsp;
- if (jj_3R_186()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_260() {
- if (jj_scan_token(HASH)) return true;
- return false;
- }
-
- private boolean jj_3R_277() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_278() {
- if (jj_scan_token(FUNCTION)) return true;
- Token xsp;
- 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_7() {
- if (jj_3R_178()) return true;
- return false;
- }
-
- private boolean jj_3R_196() {
- if (jj_scan_token(LBRACE)) return true;
- return false;
- }
-
- private boolean jj_3R_276() {
- if (jj_scan_token(COLON)) return true;
- return false;
- }
-
- private boolean jj_3R_263() {
- if (jj_scan_token(COLON)) return true;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_276()) jj_scanpos = xsp;
- xsp = jj_scanpos;
- if (jj_3R_277()) {
- jj_scanpos = xsp;
- if (jj_3R_278()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_195() {
- if (jj_3R_182()) return true;
- return false;
- }
-
- private boolean jj_3_6() {
- if (jj_3R_177()) return true;
- if (jj_scan_token(LBRACE)) return true;
- return false;
- }
-
- private boolean jj_3R_178() {
- if (jj_3R_194()) 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_195()) {
- jj_scanpos = xsp;
- if (jj_3R_196()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_266() {
- if (jj_3R_182()) return true;
- return false;
- }
-
- private boolean jj_3R_207() {
- if (true) { jj_la = 0; jj_scanpos = jj_lastpos; return false;}
- return false;
- }
-
- private boolean jj_3R_243() {
- if (jj_scan_token(SEMICOLON)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_252() {
- if (jj_scan_token(FUNCTION)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- xsp = jj_scanpos;
- if (jj_3R_266()) jj_scanpos = xsp;
- if (jj_scan_token(RPARAN)) return true;
- return false;
- }
-
- private boolean jj_3R_206() {
- 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_184() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_206()) {
- jj_scanpos = xsp;
- if (jj_3R_207()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_288() {
- if (jj_scan_token(STRING)) return true;
- return false;
- }
-
- private boolean jj_3R_286() {
- if (jj_scan_token(STARMATCH)) return true;
- return false;
- }
-
- private boolean jj_3R_287() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_285() {
- if (jj_scan_token(DOLLARMATCH)) return true;
- return false;
- }
-
- private boolean jj_3R_238() {
- if (jj_3R_256()) return true;
- return false;
- }
-
- private boolean jj_3R_284() {
- if (jj_scan_token(CARETMATCH)) return true;
- return false;
- }
-
- private boolean jj_3R_237() {
- if (jj_3R_255()) return true;
- return false;
- }
-
- private boolean jj_3R_283() {
- if (jj_scan_token(DASHMATCH)) return true;
- return false;
- }
-
- private boolean jj_3R_236() {
- if (jj_3R_254()) return true;
- return false;
- }
-
- private boolean jj_3R_282() {
- if (jj_scan_token(INCLUDES)) return true;
- return false;
- }
-
- private boolean jj_3R_268() {
- if (jj_scan_token(INTERPOLATION)) return true;
- return false;
- }
-
- private boolean jj_3R_281() {
- if (jj_scan_token(EQ)) return true;
- return false;
- }
-
- private boolean jj_3R_275() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_281()) {
- jj_scanpos = xsp;
- if (jj_3R_282()) {
- jj_scanpos = xsp;
- if (jj_3R_283()) {
- jj_scanpos = xsp;
- if (jj_3R_284()) {
- jj_scanpos = xsp;
- if (jj_3R_285()) {
- jj_scanpos = xsp;
- if (jj_3R_286()) return true;
- }
- }
- }
- }
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- xsp = jj_scanpos;
- if (jj_3R_287()) {
- jj_scanpos = xsp;
- if (jj_3R_288()) return true;
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_262() {
- if (jj_scan_token(LBRACKET)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(IDENT)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- xsp = jj_scanpos;
- if (jj_3R_275()) jj_scanpos = xsp;
- if (jj_scan_token(RBRACKET)) return true;
- return false;
- }
-
- private boolean jj_3R_175() {
- 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_280() {
- if (jj_scan_token(INTERPOLATION)) return true;
- return false;
- }
-
- private boolean jj_3R_246() {
- if (jj_scan_token(PARENT)) return true;
- return false;
- }
-
- private boolean jj_3R_245() {
- if (jj_scan_token(ANY)) return true;
- return false;
- }
-
- private boolean jj_3_5() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_175()) jj_scanpos = xsp;
- if (jj_3R_176()) return true;
- return false;
- }
-
- private boolean jj_3R_259() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_267()) {
- jj_scanpos = xsp;
- if (jj_3R_268()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_267() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_210() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_244()) {
- jj_scanpos = xsp;
- if (jj_3R_245()) {
- jj_scanpos = xsp;
- if (jj_3R_246()) return true;
- }
- }
- return false;
- }
-
- private boolean jj_3R_244() {
- Token xsp;
- if (jj_3R_259()) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_259()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_253() {
- if (jj_scan_token(DOT)) return true;
- return false;
- }
-
- private boolean jj_3R_235() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_253()) jj_scanpos = xsp;
- xsp = jj_scanpos;
- if (jj_scan_token(72)) {
- jj_scanpos = xsp;
- if (jj_scan_token(49)) {
- jj_scanpos = xsp;
- if (jj_scan_token(50)) {
- jj_scanpos = xsp;
- if (jj_scan_token(52)) return true;
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_234() {
- if (jj_scan_token(STRING)) return true;
- return false;
- }
-
- private boolean jj_3R_233() {
- if (jj_3R_252()) return true;
- return false;
- }
-
- private boolean jj_3R_191() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_234()) {
- jj_scanpos = xsp;
- if (jj_3R_235()) {
- jj_scanpos = xsp;
- if (jj_3R_236()) {
- jj_scanpos = xsp;
- if (jj_3R_237()) {
- jj_scanpos = xsp;
- if (jj_3R_238()) return true;
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_274() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_279()) {
- jj_scanpos = xsp;
- if (jj_3R_280()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_279() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_261() {
- if (jj_scan_token(DOT)) return true;
- Token xsp;
- if (jj_3R_274()) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_274()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_232() {
- if (jj_scan_token(DIMEN)) return true;
- return false;
- }
-
- private boolean jj_3R_231() {
- if (jj_scan_token(KHZ)) return true;
- return false;
- }
-
- private boolean jj_3R_230() {
- if (jj_scan_token(HZ)) return true;
- return false;
- }
-
- private boolean jj_3R_250() {
- if (jj_3R_263()) return true;
- return false;
- }
-
- private boolean jj_3R_273() {
- if (jj_3R_263()) return true;
- return false;
- }
-
- private boolean jj_3R_229() {
- if (jj_scan_token(MS)) return true;
- return false;
- }
-
- private boolean jj_3R_271() {
- if (jj_3R_261()) return true;
- return false;
- }
-
- private boolean jj_3R_228() {
- if (jj_scan_token(SECOND)) return true;
- return false;
- }
-
- private boolean jj_3R_248() {
- if (jj_3R_261()) return true;
- return false;
- }
-
- private boolean jj_3R_227() {
- if (jj_scan_token(GRAD)) return true;
- return false;
- }
-
- private boolean jj_3R_226() {
- if (jj_scan_token(RAD)) return true;
- return false;
- }
-
- private boolean jj_3R_225() {
- if (jj_scan_token(DEG)) return true;
- return false;
- }
-
- private boolean jj_3R_224() {
- if (jj_scan_token(EXS)) return true;
- return false;
- }
-
- private boolean jj_3R_249() {
- if (jj_3R_262()) return true;
- return false;
- }
-
- private boolean jj_3R_272() {
- if (jj_3R_262()) return true;
- return false;
- }
-
- private boolean jj_3R_223() {
- if (jj_scan_token(REM)) return true;
- return false;
- }
-
- private boolean jj_3R_269() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_270()) {
- jj_scanpos = xsp;
- if (jj_3R_271()) {
- jj_scanpos = xsp;
- if (jj_3R_272()) {
- jj_scanpos = xsp;
- if (jj_3R_273()) return true;
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_270() {
- if (jj_3R_260()) return true;
- return false;
- }
-
- private boolean jj_3R_222() {
- if (jj_scan_token(LEM)) return true;
- return false;
- }
-
- private boolean jj_3R_221() {
- if (jj_scan_token(EMS)) return true;
- return false;
- }
-
- private boolean jj_3R_211() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_247()) {
- jj_scanpos = xsp;
- if (jj_3R_248()) {
- jj_scanpos = xsp;
- if (jj_3R_249()) {
- jj_scanpos = xsp;
- if (jj_3R_250()) return true;
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_247() {
- if (jj_3R_260()) return true;
- return false;
- }
-
- private boolean jj_3R_188() {
- Token xsp;
- if (jj_3R_211()) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_211()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_220() {
- if (jj_scan_token(PX)) return true;
- return false;
- }
-
- private boolean jj_3R_187() {
- if (jj_3R_210()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_269()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_219() {
- if (jj_scan_token(IN)) return true;
- return false;
- }
-
- private boolean jj_3R_173() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_187()) {
- jj_scanpos = xsp;
- if (jj_3R_188()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_218() {
- if (jj_scan_token(PC)) return true;
- return false;
- }
-
- private boolean jj_3R_240() {
- if (jj_3R_208()) return true;
- if (jj_3R_173()) return true;
- return false;
- }
-
- private boolean jj_3R_217() {
- if (jj_scan_token(MM)) return true;
- return false;
- }
-
- private boolean jj_3R_216() {
- if (jj_scan_token(CM)) return true;
- return false;
- }
-
- private boolean jj_3R_215() {
- if (jj_scan_token(PT)) return true;
- return false;
- }
-
- private boolean jj_3R_214() {
- if (jj_scan_token(PERCENTAGE)) return true;
- return false;
- }
-
- private boolean jj_3R_198() {
- if (jj_3R_242()) return true;
- return false;
- }
-
- private boolean jj_3R_254() {
- if (jj_scan_token(HASH)) return true;
- return false;
- }
-
- private boolean jj_3R_213() {
- if (jj_scan_token(NUMBER)) return true;
- return false;
- }
-
- private boolean jj_3R_212() {
- if (jj_3R_251()) return true;
- return false;
- }
-
- private boolean jj_3R_190() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_212()) jj_scanpos = xsp;
- xsp = jj_scanpos;
- if (jj_3R_213()) {
- jj_scanpos = xsp;
- 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()) {
- jj_scanpos = xsp;
- if (jj_3R_219()) {
- jj_scanpos = xsp;
- if (jj_3R_220()) {
- jj_scanpos = xsp;
- if (jj_3R_221()) {
- jj_scanpos = xsp;
- 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()) {
- jj_scanpos = xsp;
- if (jj_3R_231()) {
- jj_scanpos = xsp;
- if (jj_3R_232()) {
- jj_scanpos = xsp;
- if (jj_3R_233()) return true;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_176() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_190()) {
- jj_scanpos = xsp;
- if (jj_3R_191()) return true;
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_255() {
- if (jj_scan_token(URL)) return true;
- return false;
- }
-
- private boolean jj_3_2() {
- if (jj_3R_172()) return true;
- if (jj_3R_173()) return true;
- return false;
- }
-
- private boolean jj_3R_242() {
- if (jj_3R_181()) return true;
- return false;
- }
-
- private boolean jj_3R_193() {
- if (jj_scan_token(COMMA)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- if (jj_3R_192()) return true;
- return false;
- }
-
- private boolean jj_3R_239() {
- if (jj_3R_173()) return true;
- return false;
- }
-
- private boolean jj_3R_197() {
- if (jj_3R_176()) return true;
- return false;
- }
-
- private boolean jj_3R_192() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_239()) {
- jj_scanpos = xsp;
- if (jj_3R_240()) return true;
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_3_2()) { jj_scanpos = xsp; break; }
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_179() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_197()) {
- jj_scanpos = xsp;
- if (jj_3R_198()) return true;
- }
- return false;
- }
-
- private boolean jj_3_9() {
- if (jj_3R_180()) return true;
- return false;
- }
-
- private boolean jj_3R_256() {
- if (jj_scan_token(UNICODERANGE)) return true;
- return false;
- }
-
- private boolean jj_3_4() {
- if (jj_3R_174()) return true;
- return false;
- }
-
- private boolean jj_3R_265() {
- if (jj_scan_token(PLUS)) return true;
- return false;
- }
-
- private boolean jj_3R_251() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_264()) {
- jj_scanpos = xsp;
- if (jj_3R_265()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_264() {
- if (jj_scan_token(MINUS)) return true;
- return false;
- }
-
- private boolean jj_3R_177() {
- if (jj_3R_192()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_193()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3_8() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3_9()) jj_scanpos = xsp;
- if (jj_3R_179()) return true;
- return false;
- }
-
- private boolean jj_3_1() {
- if (jj_3R_171()) return true;
- return false;
- }
-
- private boolean jj_3R_182() {
- if (jj_3R_179()) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3_8()) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_204() {
- if (jj_scan_token(MINUS)) return true;
- Token xsp;
- if (jj_scan_token(1)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3_3() {
- if (jj_3R_171()) return true;
- return false;
- }
-
- private boolean jj_3R_203() {
- if (jj_scan_token(PLUS)) return true;
- Token xsp;
- if (jj_scan_token(1)) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_258() {
- if (jj_scan_token(INTERPOLATION)) return true;
- return false;
- }
-
- private boolean jj_3R_202() {
- if (jj_scan_token(MOD)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_201() {
- if (jj_scan_token(ANY)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_200() {
- 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_199() {
- 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_180() {
- Token xsp;
- xsp = jj_scanpos;
- 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()) return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_181() {
- 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_241() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_257()) {
- jj_scanpos = xsp;
- if (jj_3R_258()) return true;
- }
- return false;
- }
-
- private boolean jj_3R_257() {
- if (jj_scan_token(IDENT)) return true;
- return false;
- }
-
- private boolean jj_3R_194() {
- Token xsp;
- if (jj_3R_241()) return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_241()) { jj_scanpos = xsp; break; }
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
- }
- return false;
- }
-
- private boolean jj_3R_205() {
- if (jj_scan_token(GUARDED_SYM)) 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() {
- if (jj_3R_205()) return true;
- return false;
- }
-
- private boolean jj_3R_189() {
- 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; }
- }
- 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[264];
- 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,0x302,0x302,0x0,0x300,0x2,0x2,0x2,0x200000,0xd4c40000,0x0,0x300,0x2,0x300,0x2,0x0,0x2,0x200000,0x2,0x2,0x0,0x0,0x2,0x2,0x0,0x0,0x2,0x0,0x2,0x100000,0x2,0x0,0x2,0x2,0xd4c40000,0xd4c40000,0x2,0x2,0x2,0xd4fd1500,0x2,0xd4fd1500,0x2,0x2,0x0,0x0,0x2,0x0,0x200000,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x200000,0x2,0x0,0x2,0x391500,0xc40000,0xc40002,0xc40000,0x2,0x2,0x80120002,0x80120002,0x2,0x0,0x0,0x2,0x2,0x2,0x2,0xd4c40000,0xd4c40000,0x2,0x100000,0x2,0xd4c40000,0x2,0x84000000,0x84000000,0x84000000,0x84000000,0xd4000000,0x0,0x0,0x0,0x0,0x50000000,0x2,0x2,0x3f000,0x2,0x0,0x2,0x3f000,0x0,0x2,0x0,0x2,0x0,0x0,0xd4c40000,0x0,0x134e0002,0x2,0xd4c40000,0xd4c40000,0x2,0x0,0x2,0x134e0002,0x0,0x2,0xd4c40000,0xd4c40000,0x2,0x134e0002,0x2,0x2,0x2,0x0,0x2,0xd4c40000,0x2,0x2,0x100000,0x2,0x2,0x2,0x2,0x0,0x2,0xd4c40000,0xd4c40000,0x2,0x100000,0x2,0x0,0x2,0x2,0x100000,0x0,0x0,0x800c0000,0x2,0x0,0x100000,0x2,0x800c0000,0x2,0x0,0x800c0000,0x2,0x2,0x0,0x400,0x2,0x200000,0x200000,0x2,0xd4c40000,0xd4c40000,0x2,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x100000,0x2,0x2,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x100000,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x100000,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x100000,0x0,0x2,0x200000,0x2,0x200000,0x0,0x2,0x2,0x2,0x2,0x200000,0x2,0x2,0x0,0x200000,0x2,0x0,0x2,0x0,0xd4c40000,0x2,0x0,0x2,0x0,0x200000,0x2,0x0,0x2,0x800c0400,0x2,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x321c0000,0xc0000,0x800c0000,0xc0000,0x0,0x80000000,0x0,0x80000000,0x800c0000,0x2,0x2,0x800c0000,0x2,0xd4c40000,0x2,0x2,0x2,0x0,0x200000,0x2,0x0,0x2,};
- }
- private static void jj_la1_init_1() {
- jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x566000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x80,0x0,0x0,0x120000,0x120000,0x0,0x120000,0x0,0x0,0x0,0x120000,0x0,0x0,0x564000c0,0x564000c0,0x0,0x0,0x0,0x60001c0,0x0,0x60001c0,0x0,0x0,0x0,0x40,0x0,0x80,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x80,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0xc2,0xc2,0x0,0x80,0x80,0x0,0x0,0x0,0x0,0x564000c0,0x564000c0,0x0,0x0,0x0,0xc0,0x0,0x40,0x40,0x40,0x40,0xc0,0x80,0x80,0x80,0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x50000000,0x64000c0,0x50000000,0x3f,0x0,0x564000c0,0x564000c0,0x0,0x80000000,0x0,0x3f,0x0,0x0,0x564000c0,0x564000c0,0x0,0x3f,0x0,0x0,0x0,0x0,0x0,0x564000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x564000c0,0x564000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x40,0x160040,0x0,0x40,0x0,0x0,0x160040,0x0,0x40,0x160000,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x61200c0,0x61200c0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x60000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x80,0x0,0x6000000,0xc0,0x0,0x0,0x0,0x80,0x0,0x0,0x80,0x0,0x160000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x160000,0x0,0x0,0x0,0x160000,0x160000,0x160000,0x0,0x0,0x160000,0x0,0x60000c0,0x0,0x0,0x0,0x80,0x0,0x0,0x80,0x0,};
- }
- private static void jj_la1_init_2() {
- jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x1000,0x0,0x0,0x0,0x0,0x880,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x0,0x2008,0x2008,0x0,0x2000,0x0,0x0,0x0,0x2000,0x0,0x0,0x1119,0x1119,0x0,0x0,0x0,0x2b88,0x0,0x2b88,0x0,0x0,0x100,0x0,0x0,0x100,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x0,0x2a80,0x0,0x0,0x0,0x0,0x0,0x380,0x380,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x1119,0x1119,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x100,0x100,0x100,0x100,0x100,0x100,0x0,0x0,0x0,0x0,0x180,0x0,0x0,0x0,0x0,0x100,0x0,0x40,0x0,0x109,0x1000,0x1300,0x0,0x1109,0x1109,0x0,0x0,0x0,0x1300,0x20,0x0,0x1109,0x1109,0x0,0x1300,0x0,0x0,0x0,0x1100,0x0,0x1109,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x1109,0x1109,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x1000,0x1000,0xfffffb80,0x0,0x0,0x0,0x0,0xfffffb80,0x0,0x0,0xfffffb80,0x0,0x0,0x1100,0x0,0x0,0x0,0x0,0x0,0x2100,0x2100,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,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x0,0x0,0x100,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x0,0xfffffb80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfffffb80,0x0,0xffffe200,0x0,0x100,0x980,0xffffeb80,0x0,0x0,0xfffffb80,0x0,0x100,0x0,0x0,0x0,0x100,0x0,0x0,0x100,0x0,};
- }
- private static void jj_la1_init_3() {
- jj_la1_3 = new int[] {0x8,0x80,0x80,0x2,0x80,0x0,0x0,0x0,0x0,0x75,0x0,0x80,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc5,0xc5,0x0,0x0,0x0,0xc401bf,0x0,0xc401bf,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc401be,0x0,0x0,0x0,0x0,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc7,0xc7,0x0,0x0,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x45,0x80,0x200000,0x0,0xe5,0xe5,0x0,0x0,0x0,0x200000,0x0,0x0,0xe5,0xe5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0xf5,0xf5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x440001,0x0,0x0,0x0,0x0,0x440001,0x0,0x0,0x440001,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x380000,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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x440001,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x440001,0x0,0x400000,0x0,0x0,0x40001,0x440001,0x0,0x0,0x440001,0x0,0x37,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
- }
- final private JJCalls[] jj_2_rtns = new JJCalls[9];
- 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 < 264; 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 < 264; 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 < 264; 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 < 264; 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 jj_expentries = new java.util.ArrayList();
- 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[120];
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 264; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1< 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;
- }
- }
- 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;
- }
-
-}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj
deleted file mode 100644
index e52ad18223..0000000000
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj
+++ /dev/null
@@ -1,3139 +0,0 @@
-/*
- * Copyright 2000-2013 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.
- */
-/* -*-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.Arrays;
-import java.util.Locale;
-import java.util.Map;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-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);
- }
-
- public InputSource getInputSource(){
- return source;
- }
-
- /**
- * 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.
- */
- // TODO required by original parser but not used by Vaadin?
- 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 ?");
- }
- }
- }
- //use UTF-8 as the default encoding.
- String encoding = source.getEncoding();
- InputStream input = source.getByteStream();
- if (!input.markSupported()) {
- // If mark is not supported, wrap it in a stream which supports mark
- input = new BufferedInputStream(input);
- source.setByteStream(input);
- }
- // Mark either the original stream or the wrapped stream
- input.mark(100);
- if(encoding == null){
- encoding = "ASCII";
-
- char c = ' ';
-
- 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
- */
-
-
-TOKEN :
-{
- < S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ >
- { image = Parser.SPACE; }
-}
-
-/*
- * for fixing #11638: Ending an imported SCSS file with a comment causes an error in the Sass.
- * now the single line comment is parsed as special token, before, they were simply skipped.
- * solution got from http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-moz.htm#tth_sEc3.15
- */
-
-SPECIAL_TOKEN : {
-< SINGLE_LINE_COMMENT: "//"(~["\n","\r"])* ("\n"|"\r"|"\r\n")? > }
-
-
-MORE :
-{
- <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
-|
- "/*" : IN_MULTI_LINE_COMMENT
-}
-
-SPECIAL_TOKEN :
-{
- : DEFAULT
-}
-
-
-SKIP :
-{
- : DEFAULT
-}
-
-
-MORE :
-{
- < ~[] >
-}
-
-
-TOKEN :
-{
- < CDO : "" >
- | < LBRACE : "{" >
- | < RBRACE : "}">
- | < DASHMATCH : "|=" >
- | < CARETMATCH : "^=" >
- | < DOLLARMATCH : "$=" >
- | < STARMATCH : "*=" >
- | < INCLUDES : "~=" >
- | < EQ : "=" >
- | < PLUS : "+" >
- | < MINUS : "-" >
- | < COMMA : "," >
- | < SEMICOLON : ";" >
- | < PRECEDES : ">" >
- | < SIBLING : "~" >
- | < SUCCEEDS : "<" >
- | < DIV : "/" >
- | < LBRACKET : "[" >
- | < RBRACKET : "]" >
- | < ANY : "*" >
- | < MOD : "%" >
- | < PARENT : "&" >
- | < DOT : "." >
- | < LPARAN : "(" >
- | < RPARAN : ")">
- | < COMPARE : "==" >
- | < OR : "||" >
- | < AND : "&&" >
- | < NOT_EQ : "!=" >
-}
-
-
-TOKEN :
-{
- < COLON : ":" >
-}
-
-< DEFAULT >
-TOKEN :
-{
- < INTERPOLATION : "#{"< VARIABLE > "}">
-}
-
-
-TOKEN : /* basic tokens */
-{
- < NONASCII : ["\200"-"\377"] >
- | < #H : ["0"-"9", "a"-"f"] >
- | < #UNICODE : "\\" ( )? /* I can't say {1,6} */
- ( )? ( )?
- ( )? ( )?
- ( [ " ", "\t" , "\n" , "\r", "\f" ] )? >
- | < #ESCAPE : | ( "\\" [ " "-"~","\200"-"\377" ] ) >
- | < #NMSTART : ("-")?[ "a"-"z","_"] | | >
- | < #NMCHAR : ["a"-"z", "0"-"9", "-", "_"] | | >
- | < #STRINGCHAR : [ "\t"," ","!","#","$","%","&","("-"~" ]
- | "\\\n" | "\\\r\n" | "\\\r" | "\\\f"
- | | >
- | < #D : ["0"-"9"] >
- | < #NAME : ( )+ >
-
-}
-
-
-TOKEN :
-{
-
- |
- |
- |
-}
-
-/* DERECTIVES */
-
-TOKEN :
-{
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-}
-
-< DEFAULT >
-TOKEN:
-{
- < MICROSOFT_RULE : "filter"|"-ms-filter" >
-}
-
-< DEFAULT >
-TOKEN:
-{
- < IF : "if" >
-}
-
-
-TOKEN:
-{
- < GUARDED_SYM : "!" ( )? "default">
-}
-
-
-TOKEN :
-{
- < STRING : ( "\"" ( | "'" )* "\"" ) |
- ( "'" ( | "\"" )* "'" ) >
- | < IDENT : ( )* >
- | < NUMBER : ( )+ | ( )* "." ( )+ >
- | < #_URL : [ "!","#","$","%","&","*"-"~" ] | | >
- | < URL : "url(" ( )*
- ( | ( <_URL> )* ) ( )* ")" >
-}
-
-
-TOKEN:
-{
- < VARIABLE : "$" >
-}
-
-
-TOKEN :
-{
- < PERCENTAGE : "%" >
- | < PT : "pt" >
- | < MM : "mm" >
- | < CM : "cm" >
- | < PC : "pc" >
- | < IN : "in" >
- | < PX : "px" >
- | < EMS : "em" >
- | < LEM : "lem" >
- | < REM : "rem" >
- | < EXS : "ex" >
- | < DEG : "deg" >
- | < RAD : "rad" >
- | < GRAD : "grad" >
- | < MS : "ms" >
- | < SECOND : "s" >
- | < HZ : "Hz" >
- | < KHZ : "kHz" >
- | < DIMEN : >
-}
-
-
-TOKEN :
-{
- < HASH : "#" >
-}
-
-/* RESERVED ATRULE WORDS */
-
-TOKEN :
-{
- < IMPORT_SYM : "@import">
- | < MEDIA_SYM : "@media" >
- | < CHARSET_SYM : "@charset" >
- | < PAGE_SYM : "@page" >
- | < FONT_FACE_SYM: "@font-face" >
- | < KEY_FRAME_SYM: "@keyframes" | "@-moz-keyframes" | "@-o-keyframes" | "@-webkit-keyframes" | "@-ms-keyframes">
- | < ATKEYWORD : "@" >
-}
-
-
-TOKEN :
-{
- < IMPORTANT_SYM : "!" ( )? "important" >
-}
-
-
-TOKEN :
-{
- < #RANGE0 : >
- | < #RANGE1 : ( "?" )? >
- | < #RANGE2 : ( "?" )? ( "?" )? >
- | < #RANGE3 : ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE4 : ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE5 : ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE6 : "?" ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
- | < #RANGE : | |
- | | | | >
- | < #UNI : ( )? ( )? ( )? ( )? ( )? >
- | < UNICODERANGE : "U+"
- | "U+" "-" >
-}
-
-< DEFAULT >
-TOKEN :
-{
- < REMOVE : "remove" (< S >)? "(" >
- | < APPEND : "append" (< S >)? "(" >
- | < CONTAINS : "contains" (< S >)? "(" >
-}
-
-
-TOKEN :
-{
- < FUNCTION : (< S >)* "(" >
-}
-
-
-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() )?
- ( comments()
- | ignoreStatement() )*
- ( importDeclaration() ( ignoreStatement() ( )* )* )*
- afterImportDeclaration()
-
- } finally {
- documentHandler.endDocument(source);
- }
-}
-
-void charset() :
-{ Token n; }
-{
- try {
- ( )* n= ( )* (";" | acceptMissingSemicolon(EOF))
- } 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;
-}
-{
- (
- ( debuggingDirective() | mixinDirective() | controlDirective() | includeDirective() | styleRule() | media()
- | page() | fontFace() | keyframes() | LOOKAHEAD(variable()) variable() | listModifyDirective()
- | { l = getLocator(); } ret=skipStatement()
- {
- if ((ret == null) || (ret.length() == 0)) {
- return;
- }
- if (ret.charAt(0) == '@') {
- documentHandler.unrecognizedRule(ret);
- } else {
- reportWarningSkipText(l, ret);
- }
- }
- )
- ( ignoreStatement() ( )* )* )*
-}
-
-void ignoreStatement() :
-{}
-{
- | | atRuleDeclaration()
-}
-
-/**
- * The import statement
- *
- * @exception ParseException exception during the parse
- */
-void importDeclaration() :
-{Token n;
- String uri;
- MediaListImpl ml = new MediaListImpl();
- boolean isURL = false;
-}
-{
- try {
-
- ( )* ( n= { uri = convertStringIndex(n.image, 1,
- n.image.length() -1); }
- | n=
- {
- 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);
- }
- }
- )
- ( )* mediaStatement(ml) (";" | acceptMissingSemicolon(RBRACE, EOF))
- ( )*
- {
- 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 keyframes() :
-{
- Token n;
- boolean start = false;
- String keyframeName = null;
- String animationname = "";
-}
-{
- try {
- n= ( )* {keyframeName = n.image;}
- (n = {animationname += n.image; }|n = < INTERPOLATION >{ animationname += n.image; })+()*
- {start = true; documentHandler.startKeyFrames(keyframeName, animationname); }
- ( )* ( keyframeSelector() | contentDirective() )* ( )*
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- } finally {
- if (start) {
- documentHandler.endKeyFrames();
- }
- }
-}
-
-void keyframeSelector():
-{
- Token n;
- String selector = "";
- boolean start = false;
-}
-{
- try{
- (n = | n = | n = ){selector += n.image;} ()*
- ( ()* (n = | n = | n = ) {selector += (", " + n.image);} ()* )*
- ()*
- {
- start = true;
- documentHandler.startKeyframeSelector(selector);
- }
- (ifContentStatement() | microsoftExtension() )*
- ()*
- }
- 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.endKeyframeSelector();
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-/* see http://www.w3.org/TR/css3-mediaqueries/ */
-void media() :
-{
- boolean start = false;
- String ret;
- MediaListImpl ml = new MediaListImpl();
-}
-{
- try {
- ( )*
- mediaStatement(ml)
- { start = true; documentHandler.startMedia(ml); }
- ( )* ( mediaDirective() )* ( )*
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
- } finally {
- if (start) {
- documentHandler.endMedia(ml);
- }
- }
-}
-
-void mediaDirective() :
-{}
-{
- debuggingDirective() | styleRule() | skipUnknownRule() | contentDirective()
-}
-
-void mediaStatement(MediaListImpl ml) :
-{
- Token t;
-}
-{
- {
- t = getToken(1);
- // loop over comma separated parts, add each to ml
- while ((t.kind != LBRACE) && (t.kind != EOF) && (t.kind != SEMICOLON)) {
- StringBuffer s = new StringBuffer();
- s.append(getToken(0).image);
- while ((t.kind != COMMA) && (t.kind != LBRACE) && (t.kind != EOF) && (t.kind != SEMICOLON)) {
- s.append(t.image);
- getNextToken();
- t = getToken(1);
- }
- if (t.kind == COMMA) {
- // skip the comma and the token before it that is still the active token
- getNextToken();
- getNextToken();
- t = getToken(1);
- }
- String str = s.toString().trim();
- if (str.length() > 0) {
- ml.addItem(str);
- }
- }
- }
-}
-
-/**
- * @exception ParseException exception during the parse
- */
-String medium() : /* tv, projection, screen, ... */
-{Token n;}
-{
- n= { 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 {
- (