summaryrefslogtreecommitdiffstats
path: root/theme-compiler/src
diff options
context:
space:
mode:
authorMarc Englund <marc@vaadin.com>2012-09-27 09:56:49 +0300
committerMarc Englund <marc@vaadin.com>2012-09-27 09:56:49 +0300
commitabea9d1ce0fdcad2e344cfa2417a09c29d903648 (patch)
treefaa69c865e4e9a859c82a6b54046cecc618906cf /theme-compiler/src
parentaf67b3056eabb6428aa2a5e736d5a19e6cca9564 (diff)
downloadvaadin-framework-abea9d1ce0fdcad2e344cfa2417a09c29d903648.tar.gz
vaadin-framework-abea9d1ce0fdcad2e344cfa2417a09c29d903648.zip
Fixes #9492 so that interpolation of mixin parameters works as expected
Diffstat (limited to 'theme-compiler/src')
-rw-r--r--theme-compiler/src/com/vaadin/sass/parser/Parser.java11280
-rw-r--r--theme-compiler/src/com/vaadin/sass/parser/Parser.jj9
-rw-r--r--theme-compiler/src/com/vaadin/sass/parser/ParserConstants.java4
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/BlockNode.java38
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/InterpolationNode.java7
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/RuleNode.java38
-rw-r--r--theme-compiler/src/com/vaadin/sass/visitor/EachVisitor.java60
7 files changed, 5546 insertions, 5890 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/parser/Parser.java b/theme-compiler/src/com/vaadin/sass/parser/Parser.java
index e274195484..3a5c8cca94 100644
--- a/theme-compiler/src/com/vaadin/sass/parser/Parser.java
+++ b/theme-compiler/src/com/vaadin/sass/parser/Parser.java
@@ -1,37 +1,38 @@
/* Generated By:JavaCC: Do not edit this line. Parser.java */
package com.vaadin.sass.parser;
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
+import java.io.*;
+import java.net.*;
import java.util.ArrayList;
import java.util.Locale;
+import java.util.Map;
-import org.w3c.css.sac.CSSException;
-import org.w3c.css.sac.CSSParseException;
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.ErrorHandler;
import org.w3c.css.sac.InputSource;
-import org.w3c.css.sac.LexicalUnit;
+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.SelectorFactory;
-import org.w3c.css.sac.SelectorList;
-import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+import org.w3c.css.sac.LexicalUnit;
+
import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+
import org.w3c.flute.util.Encoding;
-import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
-import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.VariableNode;
+import com.vaadin.sass.handler.*;
+
+import com.vaadin.sass.tree.*;
/**
* A CSS2 parser
- *
+ *
* @author Philippe Le H�garet
* @version $Revision: 1.15 $
*/
@@ -62,8 +63,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
/**
* @@TODO
- * @exception CSSException
- * Not yet implemented
+ * @exception CSSException Not yet implemented
*/
public void setLocale(Locale locale) throws CSSException {
throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
@@ -93,16 +93,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
/**
* 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.
+ *
+ * @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 {
+ public void parseStyleSheet(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
if (selectorFactory == null) {
@@ -117,31 +114,25 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
/**
* 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.
+ *
+ * @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 {
+ 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.
+ * This method parses only one rule (style rule or at-rule, except @charset).
+ *
+ * @param source the source of the rule.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
*/
- public void parseRule(InputSource source) throws CSSException, IOException {
+ public void parseRule(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
@@ -157,16 +148,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
/**
* 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.
+ *
+ * @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 {
+ public void parseStyleDeclaration(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
@@ -181,7 +169,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
/**
* This methods returns "http://www.w3.org/TR/REC-CSS2".
- *
* @return the string "http://www.w3.org/TR/REC-CSS2".
*/
public String getParserVersion() {
@@ -191,8 +178,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
/**
* Parse methods used by DOM Level 2 implementation.
*/
- public void parseImportRule(InputSource source) throws CSSException,
- IOException {
+ public void parseImportRule(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
@@ -205,8 +192,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
_parseImportRule();
}
- public void parseMediaRule(InputSource source) throws CSSException,
- IOException {
+ public void parseMediaRule(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
@@ -219,8 +206,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
_parseMediaRule();
}
- public SelectorList parseSelectors(InputSource source) throws CSSException,
- IOException {
+ public SelectorList parseSelectors(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
@@ -235,8 +222,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
return expr();
}
- public boolean parsePriority(InputSource source) throws CSSException,
- IOException {
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException {
this.source = source;
ReInit(getCharStreamWithLurk(source));
@@ -244,8 +231,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
}
/**
- * Convert the source into a Reader. Used only by DOM Level 2 parser
- * methods.
+ * 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) {
@@ -257,7 +243,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
return new InputStreamReader(source.getByteStream(), "ASCII");
} else {
return new InputStreamReader(source.getByteStream(),
- source.getEncoding());
+ source.getEncoding());
}
} else {
// systemId
@@ -267,10 +253,11 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
}
/**
- * 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.
+ * 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 {
@@ -303,7 +290,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
if (c == '@') {
// hum, is it a charset ?
- int size = 100;
+ int size = 100;
byte[] buf = new byte[size];
input.read(buf, 0, 7);
String keyword = new String(buf, 0, 7);
@@ -337,13 +324,12 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
if (c != ';') {
// no semi colon at the end ?
throw new CSSException("invalid charset declaration: "
- + "missing semi colon");
+ + "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.
+ // 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.");
@@ -355,7 +341,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
source.setEncoding(encoding);
// set the real reader of this source.
source.setCharacterStream(new InputStreamReader(source.getByteStream(),
- Encoding.getJavaEncoding(encoding)));
+ Encoding.getJavaEncoding(encoding)));
// reset the stream (leave the charset declaration in the stream).
input.reset();
@@ -363,7 +349,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
}
private LocatorImpl currentLocator;
-
private Locator getLocator() {
if (currentLocator == null) {
currentLocator = new LocatorImpl(this);
@@ -371,7 +356,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
}
return currentLocator.reInit(this);
}
-
private LocatorImpl getLocator(Token save) {
if (currentLocator == null) {
currentLocator = new LocatorImpl(this, save);
@@ -388,8 +372,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
if (pe.specialConstructor) {
StringBuffer errorM = new StringBuffer();
if (pe.currentToken != null) {
- errorM.append("encountered \u005c"").append(
- pe.currentToken.next);
+ errorM.append("encountered \u005c"")
+ .append(pe.currentToken.next);
}
errorM.append('"');
if (pe.expectedTokenSequences.length != 0) {
@@ -405,10 +389,10 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
}
}
errorHandler.error(new CSSParseException(errorM.toString(),
- l, e));
+ l, e));
} else {
- errorHandler.error(new CSSParseException(e.getMessage(), l,
- e));
+ errorHandler.error(new CSSParseException(e.getMessage(),
+ l, e));
}
} else if (e == null) {
errorHandler.error(new CSSParseException("error", l, null));
@@ -419,3733 +403,2853 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
}
private void reportWarningSkipText(Locator l, String text) {
- if (errorHandler != null && text != null) {
+ if (errorHandler != null && text != null) {
errorHandler.warning(new CSSParseException("Skipping: " + text, l));
}
}
- /*
- * The grammar of CSS2
- */
-
- /**
- * The main entry for the parser.
- *
- * @exception ParseException
- * exception during the parse
- */
- final public void parserUnit() throws ParseException {
- try {
- documentHandler.startDocument(source);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case CHARSET_SYM:
- charset();
- break;
- default:
- jj_la1[0] = jj_gen;
- ;
- }
- label_1: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[1] = jj_gen;
- break label_1;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- jj_consume_token(S);
- comments();
- break;
- case CDO:
- case CDC:
- case ATKEYWORD:
- ignoreStatement();
- break;
- default:
- jj_la1[2] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- label_2: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IMPORT_SYM:
- ;
- break;
- default:
- jj_la1[3] = jj_gen;
- break label_2;
- }
- importDeclaration();
- label_3: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[4] = jj_gen;
- break label_3;
- }
- ignoreStatement();
- label_4: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[5] = jj_gen;
- break label_4;
- }
- jj_consume_token(S);
- }
- }
- }
- afterImportDeclaration();
- jj_consume_token(0);
- } finally {
- documentHandler.endDocument(source);
- }
- }
-
- final public void charset() throws ParseException {
- Token n;
- try {
- jj_consume_token(CHARSET_SYM);
- label_5: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[6] = jj_gen;
- break label_5;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(STRING);
- label_6: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[7] = jj_gen;
- break label_6;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- reportError(getLocator(e.currentToken.next), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } catch (Exception e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- }
- }
-
- final public void afterImportDeclaration() throws ParseException {
- String ret;
- Locator l;
- label_7: while (true) {
- ;
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case VARIABLE:
- variable();
- break;
- case REMOVE:
- removeDirective();
- break;
- case MIXIN_SYM:
- mixinDirective();
- break;
- case EACH_SYM:
- eachDirective();
- break;
- case INCLUDE_SYM:
- includeDirective();
- break;
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- 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[8] = jj_gen;
- l = getLocator();
- ret = skipStatement();
- if ((ret == null) || (ret.length() == 0)) {
- {
- if (true)
- return;
- }
- }
- reportWarningSkipText(l, ret);
- if (ret.charAt(0) == '@') {
- documentHandler.ignorableAtRule(ret);
- }
- }
- label_8: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case CDO:
- case CDC:
- case ATKEYWORD:
- ;
- break;
- default:
- jj_la1[9] = jj_gen;
- break label_8;
- }
- ignoreStatement();
- label_9: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[10] = jj_gen;
- break label_9;
- }
- jj_consume_token(S);
- }
- }
- }
- }
+/*
+ * The grammar of CSS2
+ */
- final public void ignoreStatement() throws ParseException {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+/**
+ * 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:
- jj_consume_token(CDO);
- break;
case CDC:
- jj_consume_token(CDC);
- break;
case ATKEYWORD:
- atRuleDeclaration();
- break;
+ ;
+ break;
default:
- jj_la1[11] = 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[12] = 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[13] = 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[14] = jj_gen;
- break label_11;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- mediaStatement(ml);
- break;
- default:
- jj_la1[15] = jj_gen;
- ;
- }
- jj_consume_token(SEMICOLON);
- label_12: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[16] = 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());
-
+ jj_la1[1] = jj_gen;
+ break label_1;
}
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public void media() throws ParseException {
- boolean start = false;
- String ret;
- MediaListImpl ml = new MediaListImpl();
- try {
- jj_consume_token(MEDIA_SYM);
- label_13: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[17] = jj_gen;
- break label_13;
- }
- jj_consume_token(S);
- }
- mediaStatement(ml);
- start = true;
- documentHandler.startMedia(ml);
- jj_consume_token(LBRACE);
- label_14: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[18] = jj_gen;
- break label_14;
- }
- jj_consume_token(S);
- }
- label_15: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case CDO:
- case LBRACE:
- case DASHMATCH:
- case INCLUDES:
- case PLUS:
- case MINUS:
- case COMMA:
- case SEMICOLON:
- case PRECEDES:
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case NONASCII:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case PERCENTAGE:
- case HASH:
- case IMPORT_SYM:
- case MEDIA_SYM:
- case CHARSET_SYM:
- case PAGE_SYM:
- case FONT_FACE_SYM:
- case ATKEYWORD:
- case IMPORTANT_SYM:
- case UNICODERANGE:
- case FUNCTION:
- case UNKNOWN:
- ;
- break;
- default:
- jj_la1[19] = jj_gen;
- break label_15;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- case CDO:
- case LBRACE:
- case DASHMATCH:
- case INCLUDES:
- case PLUS:
- case MINUS:
- case COMMA:
- case SEMICOLON:
- case PRECEDES:
- case NONASCII:
- case STRING:
- case NUMBER:
- case URL:
- case PERCENTAGE:
- case IMPORT_SYM:
- case MEDIA_SYM:
- case CHARSET_SYM:
- case PAGE_SYM:
- case FONT_FACE_SYM:
- case ATKEYWORD:
- case IMPORTANT_SYM:
- case UNICODERANGE:
- case FUNCTION:
- case UNKNOWN:
- skipUnknownRule();
- break;
- default:
- jj_la1[20] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- jj_consume_token(RBRACE);
- label_16: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[21] = jj_gen;
- break label_16;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } finally {
- if (start) {
- documentHandler.endMedia(ml);
- }
- }
- }
-
- final public void mediaStatement(MediaListImpl ml) throws ParseException {
- String m;
- m = medium();
- label_17: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[22] = jj_gen;
- break label_17;
- }
- jj_consume_token(COMMA);
- label_18: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[23] = jj_gen;
- break label_18;
- }
- jj_consume_token(S);
- }
- ml.addItem(m);
- m = medium();
- }
- ml.addItem(m);
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public String medium() throws ParseException {
- Token n;
- n = jj_consume_token(IDENT);
- label_19: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[24] = jj_gen;
- break label_19;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return convertIdent(n.image);
- }
- throw new Error("Missing return statement in function");
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public void page() throws ParseException {
- boolean start = false;
- Token n = null;
- String page = null;
- String pseudo = null;
- try {
- jj_consume_token(PAGE_SYM);
- label_20: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[25] = jj_gen;
- break label_20;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- label_21: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[26] = jj_gen;
- break label_21;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[27] = jj_gen;
- ;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COLON:
- pseudo = pseudo_page();
- break;
- default:
- jj_la1[28] = jj_gen;
- ;
- }
- if (n != null) {
- page = convertIdent(n.image);
- }
- jj_consume_token(LBRACE);
- label_22: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[29] = jj_gen;
- break label_22;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startPage(page, pseudo);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[30] = jj_gen;
- ;
- }
- label_23: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[31] = jj_gen;
- break label_23;
- }
- jj_consume_token(SEMICOLON);
- label_24: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[32] = jj_gen;
- break label_24;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[33] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_25: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[34] = jj_gen;
- break label_25;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- if (errorHandler != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.currentToken.next.beginLine,
- e.currentToken.next.beginColumn - 1);
- reportError(li, e);
- skipStatement();
- // reportWarningSkipText(li, skipStatement());
- } else {
- skipStatement();
- }
- } finally {
- if (start) {
- documentHandler.endPage(page, pseudo);
- }
+ 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;
}
- }
-
- final public String pseudo_page() throws ParseException {
- Token n;
- jj_consume_token(COLON);
- n = jj_consume_token(IDENT);
- label_26: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ 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;
+ ;
+ break;
default:
- jj_la1[35] = jj_gen;
- break label_26;
+ jj_la1[5] = jj_gen;
+ break label_4;
}
jj_consume_token(S);
+ }
+ }
+ }
+ afterImportDeclaration();
+ jj_consume_token(0);
+ } finally {
+ documentHandler.endDocument(source);
+ }
+ }
+
+ final public void charset() throws ParseException {
+ Token n;
+ try {
+ jj_consume_token(CHARSET_SYM);
+ label_5:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ break label_5;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(STRING);
+ label_6:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ break label_6;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+ final public void afterImportDeclaration() throws ParseException {
+ String ret;
+ Locator l;
+ label_7:
+ while (true) {
+ ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VARIABLE:
+ variable();
+ break;
+ case REMOVE:
+ removeDirective();
+ break;
+ case MIXIN_SYM:
+ mixinDirective();
+ break;
+ case EACH_SYM:
+ eachDirective();
+ break;
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ l = getLocator();
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ label_8:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ break label_8;
}
- {
- if (true)
- return convertIdent(n.image);
- }
- throw new Error("Missing return statement in function");
- }
+ ignoreStatement();
+ label_9:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[10] = 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[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
- final public void fontFace() throws ParseException {
- boolean start = false;
- try {
- jj_consume_token(FONT_FACE_SYM);
- label_27: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[36] = jj_gen;
- break label_27;
- }
- jj_consume_token(S);
- }
- jj_consume_token(LBRACE);
- label_28: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[37] = jj_gen;
- break label_28;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startFontFace();
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[38] = jj_gen;
- ;
- }
- label_29: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[39] = jj_gen;
- break label_29;
- }
- jj_consume_token(SEMICOLON);
- label_30: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[40] = jj_gen;
- break label_30;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[41] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_31: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[42] = jj_gen;
- break label_31;
- }
- jj_consume_token(S);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } finally {
- if (start) {
- documentHandler.endFontFace();
- }
+/**
+ * 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[12] = 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[13] = 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[14] = jj_gen;
+ break label_11;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ mediaStatement(ml);
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ label_12:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[16] = 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 atRuleDeclaration() throws ParseException {
- Token n;
- String ret;
- n = jj_consume_token(ATKEYWORD);
- ret = skipStatement();
- reportWarningSkipText(getLocator(), ret);
- if ((ret != null) && (ret.charAt(0) == '@')) {
- documentHandler.ignorableAtRule(ret);
- }
}
+ }
- final public void skipUnknownRule() throws ParseException {
- Token n;
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case ATKEYWORD:
- n = jj_consume_token(ATKEYWORD);
- break;
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void media() throws ParseException {
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+ try {
+ jj_consume_token(MEDIA_SYM);
+ label_13:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ break label_13;
+ }
+ jj_consume_token(S);
+ }
+ mediaStatement(ml);
+ start = true; documentHandler.startMedia(ml);
+ jj_consume_token(LBRACE);
+ label_14:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ break label_14;
+ }
+ jj_consume_token(S);
+ }
+ label_15:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
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 LBRACE:
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 PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
case NONASCII:
- n = jj_consume_token(NONASCII);
- break;
+ case STRING:
+ case IDENT:
case NUMBER:
- n = jj_consume_token(NUMBER);
- break;
- case PAGE_SYM:
- n = jj_consume_token(PAGE_SYM);
- break;
+ case URL:
case PERCENTAGE:
- n = jj_consume_token(PERCENTAGE);
- break;
- case STRING:
- n = jj_consume_token(STRING);
- break;
+ 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:
- n = jj_consume_token(UNICODERANGE);
- break;
- case URL:
- n = jj_consume_token(URL);
- break;
- case SEMICOLON:
- n = jj_consume_token(SEMICOLON);
- break;
- case PLUS:
- n = jj_consume_token(PLUS);
- break;
- case PRECEDES:
- n = jj_consume_token(PRECEDES);
- break;
- case MINUS:
- n = jj_consume_token(MINUS);
- break;
+ case FUNCTION:
case UNKNOWN:
- n = jj_consume_token(UNKNOWN);
- break;
+ ;
+ break;
default:
- jj_la1[43] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+ jj_la1[19] = jj_gen;
+ break label_15;
}
- String ret;
- Locator loc = getLocator();
- ret = skipStatement();
- reportWarningSkipText(loc, ret);
- if ((ret != null) && (n.image.charAt(0) == '@')) {
- documentHandler.ignorableAtRule(ret);
- }
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public char combinator() throws ParseException {
- char connector = ' ';
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
case PLUS:
- jj_consume_token(PLUS);
- label_32: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[44] = jj_gen;
- break label_32;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return '+';
- }
- break;
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
case PRECEDES:
- jj_consume_token(PRECEDES);
- label_33: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[45] = jj_gen;
- break label_33;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return '>';
- }
- break;
+ case NONASCII:
+ case STRING:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ skipUnknownRule();
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_16:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case S:
- jj_consume_token(S);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case PLUS:
- case PRECEDES:
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case PLUS:
- jj_consume_token(PLUS);
- connector = '+';
- break;
- case PRECEDES:
- jj_consume_token(PRECEDES);
- connector = '>';
- break;
- default:
- jj_la1[46] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_34: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[47] = jj_gen;
- break label_34;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[48] = jj_gen;
- ;
- }
- {
- if (true)
- return connector;
- }
- break;
+ ;
+ break;
default:
- jj_la1[49] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+ jj_la1[21] = jj_gen;
+ break label_16;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+ }
+
+ final public void mediaStatement(MediaListImpl ml) throws ParseException {
+ String m;
+ m = medium();
+ label_17:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ break label_17;
+ }
+ jj_consume_token(COMMA);
+ label_18:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ break label_18;
}
- throw new Error("Missing return statement in function");
+ jj_consume_token(S);
+ }
+ ml.addItem(m);
+ m = medium();
}
+ ml.addItem(m);
+ }
- final public void microsoftExtension() throws ParseException {
- Token n;
- String name = "";
- String value = "";
- n = jj_consume_token(MICROSOFT_RULE);
- label_35: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[50] = jj_gen;
- break label_35;
- }
- jj_consume_token(S);
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String medium() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_19:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ break label_19;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void page() throws ParseException {
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+ try {
+ jj_consume_token(PAGE_SYM);
+ label_20:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_20;
}
- name = n.image;
- jj_consume_token(COLON);
- label_36: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
- value += n.image;
- break;
- case NUMBER:
- n = jj_consume_token(NUMBER);
- value += n.image;
- break;
- case EACH_VAR:
- n = jj_consume_token(EACH_VAR);
- 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[51] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- case EQ:
- case DOT:
- case RPARAN:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case NUMBER:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[52] = jj_gen;
- break label_36;
- }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ label_21:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ break label_21;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[27] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ pseudo = pseudo_page();
+ break;
+ default:
+ jj_la1[28] = jj_gen;
+ ;
+ }
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ jj_consume_token(LBRACE);
+ label_22:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ break label_22;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ ;
+ }
+ label_23:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[31] = jj_gen;
+ break label_23;
}
jj_consume_token(SEMICOLON);
- 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);
- }
- documentHandler.microsoftDirective(name, value);
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public String property() throws ParseException {
- Token n;
- n = jj_consume_token(IDENT);
- label_38: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[54] = jj_gen;
- break label_38;
- }
- jj_consume_token(S);
+ label_24:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[32] = jj_gen;
+ break label_24;
+ }
+ jj_consume_token(S);
}
- {
- if (true)
- return convertIdent(n.image);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[33] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_25:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[34] = jj_gen;
+ break label_25;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+ }
+
+ final public String pseudo_page() throws ParseException {
+ Token n;
+ jj_consume_token(COLON);
+ n = jj_consume_token(IDENT);
+ label_26:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[35] = jj_gen;
+ break label_26;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void fontFace() throws ParseException {
+ boolean start = false;
+ try {
+ jj_consume_token(FONT_FACE_SYM);
+ label_27:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[36] = jj_gen;
+ break label_27;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LBRACE);
+ label_28:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[37] = jj_gen;
+ break label_28;
+ }
+ jj_consume_token(S);
+ }
+ start = true; documentHandler.startFontFace();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[38] = jj_gen;
+ ;
+ }
+ label_29:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[39] = jj_gen;
+ break label_29;
}
- throw new Error("Missing return statement in function");
- }
-
- final public String variableName() throws ParseException {
- Token n;
- n = jj_consume_token(VARIABLE);
- label_39: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[55] = jj_gen;
- break label_39;
- }
- jj_consume_token(S);
+ jj_consume_token(SEMICOLON);
+ label_30:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[40] = jj_gen;
+ break label_30;
+ }
+ jj_consume_token(S);
}
- {
- if (true)
- return convertIdent(n.image.substring(1));
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[41] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_31:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[42] = jj_gen;
+ break label_31;
}
- throw new Error("Missing return statement in function");
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
}
+ }
- final public String functionName() throws ParseException {
- Token n;
- n = jj_consume_token(FUNCTION);
- label_40: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[56] = jj_gen;
- break label_40;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return convertIdent(n.image.substring(0, n.image.length() - 1));
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void atRuleDeclaration() throws ParseException {
+ Token n;
+ String ret;
+ n = jj_consume_token(ATKEYWORD);
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
}
- throw new Error("Missing return statement in function");
- }
+ }
+
+ final public void skipUnknownRule() throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ATKEYWORD:
+ n = jj_consume_token(ATKEYWORD);
+ break;
+ case CDO:
+ n = jj_consume_token(CDO);
+ break;
+ case CHARSET_SYM:
+ n = jj_consume_token(CHARSET_SYM);
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ break;
+ case DASHMATCH:
+ n = jj_consume_token(DASHMATCH);
+ break;
+ case FONT_FACE_SYM:
+ n = jj_consume_token(FONT_FACE_SYM);
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ break;
+ case IMPORTANT_SYM:
+ n = jj_consume_token(IMPORTANT_SYM);
+ break;
+ case IMPORT_SYM:
+ n = jj_consume_token(IMPORT_SYM);
+ break;
+ case INCLUDES:
+ n = jj_consume_token(INCLUDES);
+ break;
+ case LBRACE:
+ n = jj_consume_token(LBRACE);
+ break;
+ case MEDIA_SYM:
+ n = jj_consume_token(MEDIA_SYM);
+ break;
+ case NONASCII:
+ n = jj_consume_token(NONASCII);
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ break;
+ case PAGE_SYM:
+ n = jj_consume_token(PAGE_SYM);
+ break;
+ case PERCENTAGE:
+ n = jj_consume_token(PERCENTAGE);
+ break;
+ case STRING:
+ n = jj_consume_token(STRING);
+ break;
+ case UNICODERANGE:
+ n = jj_consume_token(UNICODERANGE);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ break;
+ case SEMICOLON:
+ n = jj_consume_token(SEMICOLON);
+ break;
+ case PLUS:
+ n = jj_consume_token(PLUS);
+ break;
+ case PRECEDES:
+ n = jj_consume_token(PRECEDES);
+ break;
+ case MINUS:
+ n = jj_consume_token(MINUS);
+ break;
+ case UNKNOWN:
+ n = jj_consume_token(UNKNOWN);
+ break;
+ default:
+ jj_la1[43] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public void styleRule() throws ParseException {
- boolean start = false;
- ArrayList<String> l = null;
- Token save;
- Locator loc;
- try {
- l = selectorList();
- save = token;
- jj_consume_token(LBRACE);
- label_41: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[57] = jj_gen;
- break label_41;
- }
- jj_consume_token(S);
- }
- start = true;
- documentHandler.startSelector(l);
- label_42: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case INCLUDE_SYM:
- case EACH_SYM:
- case IF_SYM:
- case EXTEND_SYM:
- case MICROSOFT_RULE:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case REMOVE:
- ;
- break;
- default:
- jj_la1[58] = jj_gen;
- break label_42;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IF_SYM:
- ifDirective();
- break;
- case REMOVE:
- removeDirective();
- break;
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case EACH_SYM:
- eachDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[60] = jj_gen;
- if (jj_2_1(3)) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case MICROSOFT_RULE:
- microsoftExtension();
- break;
- case IDENT:
- declarationOrNestedProperties();
- break;
- default:
- jj_la1[59] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- } else {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[61] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_43: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[62] = jj_gen;
- break label_43;
- }
- jj_consume_token(S);
- }
- } catch (ThrowedParseException e) {
- if (errorHandler != null) {
- LocatorImpl li = new LocatorImpl(this,
- e.e.currentToken.next.beginLine,
- e.e.currentToken.next.beginColumn - 1);
- reportError(li, e.e);
- }
- } catch (ParseException e) {
- reportError(getLocator(), e);
- skipStatement();
- // reportWarningSkipText(getLocator(), skipStatement());
-
- } catch (TokenMgrError e) {
- reportWarningSkipText(getLocator(), skipStatement());
- } finally {
- if (start) {
- documentHandler.endSelector();
- }
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char combinator() throws ParseException {
+char connector = ' ';
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ label_32:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[44] = jj_gen;
+ break label_32;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '+';}
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ label_33:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[45] = jj_gen;
+ break label_33;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '>';}
+ break;
+ case S:
+ jj_consume_token(S);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case PRECEDES:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ connector = '+';
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ connector = '>';
+ break;
+ default:
+ jj_la1[46] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- }
+ label_34:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[47] = jj_gen;
+ break label_34;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[48] = jj_gen;
+ ;
+ }
+ {if (true) return connector;}
+ break;
+ default:
+ jj_la1[49] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void microsoftExtension() throws ParseException {
+ Token n;
+ String name = "";
+ String value = "";
+ n = jj_consume_token(MICROSOFT_RULE);
+ label_35:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[50] = jj_gen;
+ break label_35;
+ }
+ jj_consume_token(S);
+ }
+ name = n.image;
+ jj_consume_token(COLON);
+ label_36:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ value += n.image;
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ value += n.image;
+ break;
+ case INTERPOLATION:
+ n = jj_consume_token(INTERPOLATION);
+ value += n.image;
+ break;
+ case COLON:
+ n = jj_consume_token(COLON);
+ value += n.image;
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ value += n.image;
+ break;
+ case RPARAN:
+ n = jj_consume_token(RPARAN);
+ value += n.image;
+ break;
+ case EQ:
+ n = jj_consume_token(EQ);
+ value += n.image;
+ break;
+ case DOT:
+ n = jj_consume_token(DOT);
+ value += n.image;
+ break;
+ case S:
+ n = jj_consume_token(S);
+ if(value.lastIndexOf(' ') != value.length()-1)
+ { value += n.image; }
+ break;
+ default:
+ jj_la1[51] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case EQ:
+ case DOT:
+ case RPARAN:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case NUMBER:
+ case FUNCTION:
+ ;
+ break;
+ default:
+ jj_la1[52] = jj_gen;
+ break label_36;
+ }
+ }
+ jj_consume_token(SEMICOLON);
+ label_37:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[53] = jj_gen;
+ break label_37;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.microsoftDirective(name, value);
+ }
- final public ArrayList<String> selectorList() throws ParseException {
- ArrayList<String> selectors = new ArrayList<String>();
- String selector;
- selector = selector();
- label_44: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- ;
- break;
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String property() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_38:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[54] = jj_gen;
+ break label_38;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String variableName() throws ParseException {
+ Token n;
+ n = jj_consume_token(VARIABLE);
+ label_39:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[55] = jj_gen;
+ break label_39;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image.substring(1));}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String functionName() throws ParseException {
+ Token n;
+ n = jj_consume_token(FUNCTION);
+ label_40:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[56] = jj_gen;
+ break label_40;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image.substring(0, n.image.length()-1));}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void styleRule() throws ParseException {
+ boolean start = false;
+ ArrayList<String> l = null;
+ Token save;
+ Locator loc;
+ try {
+ l = selectorList();
+ save = token;
+ jj_consume_token(LBRACE);
+ label_41:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[57] = jj_gen;
+ break label_41;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startSelector(l);
+ label_42:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EACH_SYM:
+ case IF_SYM:
+ case EXTEND_SYM:
+ case MICROSOFT_RULE:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ case REMOVE:
+ ;
+ break;
+ default:
+ jj_la1[58] = jj_gen;
+ break label_42;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IF_SYM:
+ ifDirective();
+ break;
+ case REMOVE:
+ removeDirective();
+ break;
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case EACH_SYM:
+ eachDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[60] = jj_gen;
+ if (jj_2_1(3)) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MICROSOFT_RULE:
+ microsoftExtension();
+ break;
+ case IDENT:
+ declarationOrNestedProperties();
+ break;
default:
- jj_la1[63] = jj_gen;
- break label_44;
+ jj_la1[59] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- jj_consume_token(COMMA);
- label_45: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[64] = jj_gen;
- break label_45;
- }
- jj_consume_token(S);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[61] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- selectors.add(selector);
- selector = selector();
+ }
}
- selectors.add(selector);
- {
- if (true)
- return selectors;
+ }
+ jj_consume_token(RBRACE);
+ label_43:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[62] = jj_gen;
+ break label_43;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ThrowedParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.e.currentToken.next.beginLine,
+ e.e.currentToken.next.beginColumn-1);
+ reportError(li, e.e);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (TokenMgrError e) {
+ reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endSelector();
+ }
+ }
+ }
+
+ final public ArrayList<String> selectorList() throws ParseException {
+ ArrayList<String> selectors = new ArrayList<String>();
+ String selector;
+ selector = selector();
+ label_44:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[63] = jj_gen;
+ break label_44;
+ }
+ jj_consume_token(COMMA);
+ label_45:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[64] = jj_gen;
+ break label_45;
}
- throw new Error("Missing return statement in function");
+ 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
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String selector() throws ParseException {
+ String selector;
+ char comb;
+ try {
+ selector = simple_selector(null, ' ');
+ label_46:
+ while (true) {
+ if (jj_2_2(2)) {
+ ;
+ } else {
+ break label_46;
+ }
+ comb = combinator();
+ selector = simple_selector(selector, comb);
+ }
+ label_47:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[65] = jj_gen;
+ break label_47;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return selector;}
+ } catch (ParseException e) {
+ /*
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+ reportWarningSkipText(getLocator(), s.toString());
*/
- final public String selector() throws ParseException {
- String selector;
- char comb;
- try {
- selector = simple_selector(null, ' ');
- label_46: while (true) {
- if (jj_2_2(2)) {
- ;
- } else {
- break label_46;
- }
- comb = combinator();
- selector = simple_selector(selector, comb);
- }
- label_47: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[65] = jj_gen;
- break label_47;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return selector;
- }
- } catch (ParseException e) {
- /*
- * Token t = getToken(1); StringBuffer s = new StringBuffer();
- * s.append(getToken(0).image); while ((t.kind != COMMA) && (t.kind
- * != SEMICOLON) && (t.kind != LBRACE) && (t.kind != EOF)) {
- * s.append(t.image); getNextToken(); t = getToken(1); }
- * reportWarningSkipText(getLocator(), s.toString());
- */
- Token t = getToken(1);
- while ((t.kind != COMMA) && (t.kind != SEMICOLON)
- && (t.kind != LBRACE) && (t.kind != EOF)) {
- getNextToken();
- t = getToken(1);
- }
+ 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");
+ {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 EACH_VAR:
- case IDENT:
- simple_current = element_name();
- label_48: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[66] = jj_gen;
- break label_48;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[67] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String simple_selector(String selector, char comb) throws ParseException {
+ String simple_current = null;
+ String cond = null;
+
+ pseudoElt = null;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ANY:
+ case PARENT:
+ case INTERPOLATION:
+ case IDENT:
+ simple_current = element_name();
+ label_48:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
case HASH:
- cond = hash(cond);
- label_49: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- ;
- break;
- default:
- jj_la1[68] = jj_gen;
- break label_49;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[69] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
+ ;
+ break;
+ default:
+ jj_la1[66] = jj_gen;
+ break label_48;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
case DOT:
- cond = _class(cond);
- label_50: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[70] = jj_gen;
- break label_50;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[71] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
case COLON:
- cond = pseudo(cond);
- label_51: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[72] = jj_gen;
- break label_51;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[73] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[67] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case HASH:
+ cond = hash(cond);
+ label_49:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACKET:
- cond = attrib(cond);
- label_52: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case DOT:
- case COLON:
- case HASH:
- ;
- break;
- default:
- jj_la1[74] = jj_gen;
- break label_52;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case HASH:
- cond = hash(cond);
- break;
- case DOT:
- cond = _class(cond);
- break;
- case LBRACKET:
- cond = attrib(cond);
- break;
- case COLON:
- cond = pseudo(cond);
- break;
- default:
- jj_la1[75] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- break;
+ case DOT:
+ case COLON:
+ ;
+ break;
default:
- jj_la1[76] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+ jj_la1[68] = jj_gen;
+ break label_49;
}
- if (simple_current == null) {
- simple_current = "";
- }
- if (cond != null) {
- simple_current = simple_current + cond;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[69] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case DOT:
+ cond = _class(cond);
+ label_50:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[70] = jj_gen;
+ break label_50;
}
- if (selector != null) {
- switch (comb) {
- case ' ':
- selector = selector + comb + simple_current;
- break;
- case '+':
- selector = selector + " " + comb + " " + simple_current;
- break;
- case '>':
- selector = selector + " " + comb + " " + simple_current;
- break;
- default: {
- if (true)
- throw new ParseException("invalid state. send a bug report");
- }
- }
- } else {
- selector = simple_current;
+ 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[71] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ label_51:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ break label_51;
}
- if (pseudoElt != null) {
- selector = selector + pseudoElt;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[73] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ label_52:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[74] = jj_gen;
+ break label_52;
}
- {
- if (true)
- return selector;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[75] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- throw new Error("Missing return statement in function");
+ }
+ break;
+ default:
+ jj_la1[76] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public String _class(String pred) throws ParseException {
- Token t;
- String s = ".";
- jj_consume_token(DOT);
- label_53: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- t = jj_consume_token(IDENT);
- s += t.image;
- break;
- case EACH_VAR:
- t = jj_consume_token(EACH_VAR);
- s += t.image;
- break;
- default:
- jj_la1[77] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+ if (simple_current == null) {
+ simple_current = "";
}
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case EACH_VAR:
- case IDENT:
- ;
- break;
- default:
- jj_la1[78] = jj_gen;
- break label_53;
- }
- }
- if (pred == null) {
- {
- if (true)
- return s;
+ if (cond != null) {
+ simple_current = simple_current + cond;
}
- } 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 EACH_VAR:
- case IDENT:
- label_54: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- t = jj_consume_token(IDENT);
- s += t.image;
+ if (selector != null) {
+ switch (comb) {
+ case ' ':
+ selector = selector + comb + simple_current;
break;
- case EACH_VAR:
- t = jj_consume_token(EACH_VAR);
- s += t.image;
+ case '+':
+ selector = selector + " " + comb + " " + simple_current;
break;
- default:
- jj_la1[79] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case EACH_VAR:
- case IDENT:
- ;
+ case '>':
+ selector = selector + " " + comb + " " + simple_current;
break;
default:
- jj_la1[80] = jj_gen;
- break label_54;
+ {if (true) throw new ParseException("invalid state. send a bug report");}
}
+ } else {
+ selector= simple_current;
}
- {
- if (true)
- return s;
- }
- break;
- case ANY:
- jj_consume_token(ANY);
- {
- if (true)
- return "*";
- }
- break;
- case PARENT:
- jj_consume_token(PARENT);
- {
- if (true)
- return "&";
+ if (pseudoElt != null) {
+ selector = selector + pseudoElt;
}
- break;
- default:
- jj_la1[81] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
+ {if (true) return selector;}
+ throw new Error("Missing return statement in function");
+ }
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public String attrib(String pred) throws ParseException {
- int cases = 0;
- Token att = null;
- Token val = null;
- String attValue = null;
- jj_consume_token(LBRACKET);
- label_55: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[82] = jj_gen;
- break label_55;
- }
- jj_consume_token(S);
- }
- att = jj_consume_token(IDENT);
- label_56: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[83] = jj_gen;
- break label_56;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case DASHMATCH:
- 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;
- default:
- jj_la1[84] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_57: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[85] = jj_gen;
- break label_57;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- val = jj_consume_token(IDENT);
- attValue = val.image;
- break;
- case STRING:
- val = jj_consume_token(STRING);
- attValue = val.image;
- break;
- default:
- jj_la1[86] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_58: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[87] = jj_gen;
- break label_58;
- }
- jj_consume_token(S);
- }
- break;
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String _class(String pred) throws ParseException {
+ Token t;
+String s = ".";
+ jj_consume_token(DOT);
+ label_53:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ t = jj_consume_token(IDENT);
+ s += t.image;
+ break;
+ case INTERPOLATION:
+ t = jj_consume_token(INTERPOLATION);
+ s += t.image;
+ break;
+ default:
+ jj_la1[77] = 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[78] = jj_gen;
+ break label_53;
+ }
+ }
+ if (pred == null) {
+ {if (true) return s;}
+ } else {
+ {if (true) return pred + s;}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String element_name() throws ParseException {
+ Token t; String s = "";
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTERPOLATION:
+ case IDENT:
+ label_54:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ t = jj_consume_token(IDENT);
+ s += t.image;
+ break;
+ case INTERPOLATION:
+ t = jj_consume_token(INTERPOLATION);
+ s += t.image;
+ break;
default:
- jj_la1[88] = jj_gen;
- ;
+ jj_la1[79] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- 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;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTERPOLATION:
+ case IDENT:
+ ;
+ 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");
- }
+ jj_la1[80] = jj_gen;
+ break label_54;
+ }
+ }
+ {if (true) return s;}
+ break;
+ case ANY:
+ jj_consume_token(ANY);
+ {if (true) return "*";}
+ break;
+ case PARENT:
+ jj_consume_token(PARENT);
+ {if (true) return "&";}
+ break;
+ default:
+ jj_la1[81] = 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 pseudo(String pred) throws ParseException {
- Token n;
- Token language;
- boolean isPseudoElement = false;
- jj_consume_token(COLON);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- isPseudoElement = true;
- break;
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String attrib(String pred) throws ParseException {
+ int cases = 0;
+ Token att = null;
+ Token val = null;
+ String attValue = null;
+ jj_consume_token(LBRACKET);
+ label_55:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[82] = jj_gen;
+ break label_55;
+ }
+ jj_consume_token(S);
+ }
+ att = jj_consume_token(IDENT);
+ label_56:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[83] = jj_gen;
+ break label_56;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DASHMATCH:
+ 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;
+ default:
+ jj_la1[84] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_57:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[89] = jj_gen;
- ;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- n = jj_consume_token(IDENT);
+ jj_la1[85] = jj_gen;
+ break label_57;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ val = jj_consume_token(IDENT);
+ attValue = val.image;
+ break;
+ case STRING:
+ val = jj_consume_token(STRING);
+ attValue = val.image;
+ break;
+ default:
+ jj_la1[86] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_58:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[87] = jj_gen;
+ break label_58;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[88] = 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;
+ default:
+ // never reached.
+ c = null;
+ }
+ c = "[" + c + "]";
+ if (pred == null) {
+ {if (true) return c;}
+ } else {
+ {if (true) return pred + c;}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String pseudo(String pred) throws ParseException {
+ Token n;
+Token language;
+boolean isPseudoElement = false;
+ jj_consume_token(COLON);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ isPseudoElement=true;
+ break;
+ default:
+ jj_la1[89] = 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());
- }
+ {if (true) throw new CSSParseException("duplicate pseudo element definition "
+ + s, getLocator());}
} else {
- pseudoElt = ":" + s;
- {
- if (true)
- return pred;
- }
+ pseudoElt = ":"+s;
+ {if (true) return pred;}
}
} else {
String c = s;
if (pred == null) {
- {
- if (true)
- return c;
- }
- } else {
- {
- if (true)
- return pred + c;
- }
- }
- }
- break;
- case FUNCTION:
- n = jj_consume_token(FUNCTION);
- label_59: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[90] = jj_gen;
- break label_59;
- }
- jj_consume_token(S);
- }
- language = jj_consume_token(IDENT);
- label_60: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[91] = jj_gen;
- break label_60;
- }
- jj_consume_token(S);
- }
- jj_consume_token(RPARAN);
- String f = convertIdent(n.image);
- if (f.equals("lang(")) {
- String d = convertIdent(language.image);
- if (pred == null) {
- {
- if (true)
- return d;
- }
+ {if (true) return c;}
} else {
- {
- if (true)
- return pred + d;
- }
- }
- } else {
- {
- if (true)
- throw new CSSParseException(
- "invalid pseudo function name " + f,
- getLocator());
+ {if (true) return pred + c;}
}
}
- break;
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ label_59:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[92] = jj_gen;
- 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");
- }
+ jj_la1[90] = jj_gen;
+ break label_59;
+ }
+ jj_consume_token(S);
+ }
+ language = jj_consume_token(IDENT);
+ label_60:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[91] = jj_gen;
+ break label_60;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(RPARAN);
+ String f = convertIdent(n.image);
+ if (f.equals("lang(")) {
+ String d = convertIdent(language.image);
+ if (pred == null) {
+ {if (true) return d;}
+ } else {
+ {if (true) return pred + d;}
+ }
+ } else {
+ {if (true) throw new CSSParseException("invalid pseudo function name "
+ + f, getLocator());}
+ }
+ break;
+ default:
+ jj_la1[92] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
- final public void variable() throws ParseException {
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String hash(String pred) throws ParseException {
+ Token n;
+ n = jj_consume_token(HASH);
+ String d = n.image;
+ if (pred == null) {
+ {if (true) return d;}
+ } else {
+ {if (true) return pred + d;}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void variable() throws ParseException {
String name;
LexicalUnitImpl exp = null;
boolean guarded = false;
String raw;
- try {
- name = variableName();
- jj_consume_token(COLON);
- label_61: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[93] = jj_gen;
- break label_61;
- }
- jj_consume_token(S);
- }
- exp = expr();
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case GUARDED_SYM:
- guarded = guarded();
- break;
- default:
- jj_la1[94] = jj_gen;
- ;
- }
- label_62: while (true) {
- jj_consume_token(SEMICOLON);
- label_63: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[95] = jj_gen;
- break label_63;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[96] = jj_gen;
- break label_62;
- }
- }
- documentHandler.variable(name, exp, guarded);
- } catch (JumpException e) {
+ try {
+ name = variableName();
+ jj_consume_token(COLON);
+ label_61:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[93] = jj_gen;
+ break label_61;
+ }
+ jj_consume_token(S);
+ }
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case GUARDED_SYM:
+ guarded = guarded();
+ break;
+ default:
+ jj_la1[94] = jj_gen;
+ ;
+ }
+ label_62:
+ while (true) {
+ jj_consume_token(SEMICOLON);
+ label_63:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[95] = jj_gen;
+ break label_63;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[96] = jj_gen;
+ break label_62;
+ }
+ }
+ documentHandler.variable(name, exp, guarded);
+ } catch (JumpException e) {
skipAfterExpression();
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException e) {
if (errorHandler != null) {
errorHandler.error(new CSSParseException("Invalid number "
- + e.getMessage(), getLocator(), e));
+ + e.getMessage(),
+ getLocator(),
+ e));
}
reportWarningSkipText(getLocator(), skipAfterExpression());
- } catch (ParseException e) {
+ } 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);
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
} else {
- reportError(getLocator(), e);
- }
+ reportError(getLocator(), e);
+ }
skipAfterExpression();
} else {
skipAfterExpression();
}
- }
- }
-
- final public void ifDirective() throws ParseException {
- Token n = null;
- String evaluator = "";
- jj_consume_token(IF_SYM);
- label_64: while (true) {
- n = booleanExpressionToken();
- evaluator += n.image;
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- case EQ:
- case PLUS:
- case MINUS:
- case PRECEDES:
- case SUCCEEDS:
- case DIV:
- case ANY:
- case LPARAN:
- case RPARAN:
- case COMPARE:
- case OR:
- case AND:
- case NOT_EQ:
- case IDENT:
- case NUMBER:
- case VARIABLE:
- ;
- break;
- default:
- jj_la1[97] = jj_gen;
- break label_64;
- }
- }
- jj_consume_token(LBRACE);
- label_65: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[98] = jj_gen;
- break label_65;
- }
- jj_consume_token(S);
- }
- documentHandler.startIfElseDirective();
- documentHandler.ifDirective(evaluator);
- label_66: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case INCLUDE_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[99] = jj_gen;
- break label_66;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[100] = jj_gen;
- if (jj_2_3(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[101] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_67: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[102] = jj_gen;
- break label_67;
- }
- jj_consume_token(S);
- }
- label_68: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case ELSE_SYM:
- ;
- break;
- default:
- jj_la1[103] = jj_gen;
- break label_68;
- }
- elseDirective();
- }
- documentHandler.endIfElseDirective();
}
-
- final public void elseDirective() throws ParseException {
- String evaluator = "";
- Token n = null;
- jj_consume_token(ELSE_SYM);
- label_69: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[104] = jj_gen;
- break label_69;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IF:
- jj_consume_token(IF);
- label_70: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- case EQ:
- case PLUS:
- case MINUS:
- case PRECEDES:
- case SUCCEEDS:
- case DIV:
- case ANY:
- case LPARAN:
- case RPARAN:
- case COMPARE:
- case OR:
- case AND:
- case NOT_EQ:
- case IDENT:
- case NUMBER:
- case VARIABLE:
- ;
- break;
- default:
- jj_la1[105] = jj_gen;
- break label_70;
- }
- n = booleanExpressionToken();
- if (n != null)
- evaluator += n.image;
- }
- break;
- default:
- jj_la1[106] = jj_gen;
- ;
- }
- jj_consume_token(LBRACE);
- label_71: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[107] = jj_gen;
- break label_71;
- }
- jj_consume_token(S);
- }
- if (!evaluator.trim().equals("")) {
- documentHandler.ifDirective(evaluator);
+ }
+
+ final public void ifDirective() throws ParseException {
+ Token n = null;
+ String evaluator = "";
+ jj_consume_token(IF_SYM);
+ label_64:
+ while (true) {
+ n = booleanExpressionToken();
+ evaluator += n.image;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case EQ:
+ case PLUS:
+ case MINUS:
+ case PRECEDES:
+ case SUCCEEDS:
+ case DIV:
+ case ANY:
+ case LPARAN:
+ case RPARAN:
+ case COMPARE:
+ case OR:
+ case AND:
+ case NOT_EQ:
+ case IDENT:
+ case NUMBER:
+ case VARIABLE:
+ ;
+ break;
+ default:
+ jj_la1[97] = jj_gen;
+ break label_64;
+ }
+ }
+ jj_consume_token(LBRACE);
+ label_65:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[98] = jj_gen;
+ break label_65;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startIfElseDirective();
+ documentHandler.ifDirective(evaluator);
+ label_66:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[99] = jj_gen;
+ break label_66;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[100] = jj_gen;
+ if (jj_2_3(3)) {
+ declarationOrNestedProperties();
} else {
- documentHandler.elseDirective();
- }
- label_72: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case INCLUDE_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[108] = jj_gen;
- break label_72;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[109] = jj_gen;
- if (jj_2_4(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[110] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_73: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[111] = jj_gen;
- break label_73;
- }
- jj_consume_token(S);
- }
- }
-
- final public Token booleanExpressionToken() throws ParseException {
- Token n = null;
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case VARIABLE:
- n = jj_consume_token(VARIABLE);
- break;
- case IDENT:
- n = jj_consume_token(IDENT);
- break;
- case NUMBER:
- n = jj_consume_token(NUMBER);
- break;
- case LPARAN:
- n = jj_consume_token(LPARAN);
- break;
- case RPARAN:
- n = jj_consume_token(RPARAN);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
break;
+ default:
+ jj_la1[101] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_67:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[102] = jj_gen;
+ break label_67;
+ }
+ jj_consume_token(S);
+ }
+ label_68:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ELSE_SYM:
+ ;
+ break;
+ default:
+ jj_la1[103] = jj_gen;
+ break label_68;
+ }
+ elseDirective();
+ }
+ documentHandler.endIfElseDirective();
+ }
+
+ final public void elseDirective() throws ParseException {
+ String evaluator = "";
+ Token n = null;
+ jj_consume_token(ELSE_SYM);
+ label_69:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[104] = jj_gen;
+ break label_69;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IF:
+ jj_consume_token(IF);
+ label_70:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case EQ:
case PLUS:
- n = jj_consume_token(PLUS);
- break;
case MINUS:
- n = jj_consume_token(MINUS);
- break;
+ case PRECEDES:
+ case SUCCEEDS:
case DIV:
- n = jj_consume_token(DIV);
- break;
case ANY:
- n = jj_consume_token(ANY);
- break;
+ case LPARAN:
+ case RPARAN:
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[112] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {
- if (true)
- return n;
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void eachDirective() throws ParseException {
- Token var;
- ArrayList<String> list = null;
- String listVariable = null;
- jj_consume_token(EACH_SYM);
- label_74: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[113] = jj_gen;
- break label_74;
- }
- jj_consume_token(S);
- }
- var = jj_consume_token(VARIABLE);
- label_75: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[114] = jj_gen;
- break label_75;
- }
- jj_consume_token(S);
- }
- jj_consume_token(EACH_IN);
- label_76: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[115] = jj_gen;
- break label_76;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case IDENT:
- list = stringList();
- documentHandler.startEachDirective(var.image, list);
- break;
- case REMOVE:
- documentHandler.startEachDirective(var.image, list);
- removeDirective();
- break;
+ case NUMBER:
case VARIABLE:
- listVariable = variableName();
- documentHandler.startEachDirective(var.image, listVariable);
- break;
+ ;
+ break;
default:
- jj_la1[116] = jj_gen;
+ jj_la1[105] = jj_gen;
+ break label_70;
+ }
+ n = booleanExpressionToken();
+ if(n != null) evaluator += n.image;
+ }
+ break;
+ default:
+ jj_la1[106] = jj_gen;
+ ;
+ }
+ jj_consume_token(LBRACE);
+ label_71:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[107] = jj_gen;
+ break label_71;
+ }
+ jj_consume_token(S);
+ }
+ if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); }
+ else{ documentHandler.elseDirective(); }
+ label_72:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[108] = jj_gen;
+ break label_72;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[109] = jj_gen;
+ if (jj_2_4(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ default:
+ jj_la1[110] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
- }
- jj_consume_token(LBRACE);
- label_77: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[117] = jj_gen;
- break label_77;
- }
- jj_consume_token(S);
- }
- label_78: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case INCLUDE_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- case REMOVE:
- ;
- break;
- default:
- jj_la1[118] = jj_gen;
- break label_78;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case REMOVE:
- removeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[119] = jj_gen;
- if (jj_2_5(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[120] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_79: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[121] = jj_gen;
- break label_79;
- }
- jj_consume_token(S);
- }
- documentHandler.endEachDirective();
- }
-
- final public ArrayList<String> stringList() throws ParseException {
- ArrayList<String> strings = new ArrayList<String>();
- Token input;
- input = jj_consume_token(IDENT);
- label_80: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[122] = jj_gen;
- break label_80;
- }
- jj_consume_token(S);
- }
- strings.add(input.image);
- label_81: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[123] = jj_gen;
- break label_81;
- }
- jj_consume_token(COMMA);
- label_82: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[124] = jj_gen;
- break label_82;
- }
- jj_consume_token(S);
- }
- input = jj_consume_token(IDENT);
- strings.add(input.image);
- label_83: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[125] = jj_gen;
- break label_83;
- }
- jj_consume_token(S);
- }
- }
- {
- if (true)
- return strings;
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void mixinDirective() throws ParseException {
- String name;
- ArrayList<VariableNode> args = null;
- String body;
- jj_consume_token(MIXIN_SYM);
- label_84: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[126] = jj_gen;
- break label_84;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- name = property();
- break;
- case FUNCTION:
- name = functionName();
- args = arglist();
- jj_consume_token(RPARAN);
- label_85: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[127] = jj_gen;
- break label_85;
- }
- jj_consume_token(S);
- }
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_73:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[111] = jj_gen;
+ break label_73;
+ }
+ jj_consume_token(S);
+ }
+ }
+
+ final public Token booleanExpressionToken() throws ParseException {
+ Token n = null;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case VARIABLE:
+ n = jj_consume_token(VARIABLE);
+ break;
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ break;
+ case LPARAN:
+ n = jj_consume_token(LPARAN);
+ break;
+ case RPARAN:
+ n = jj_consume_token(RPARAN);
+ break;
+ case PLUS:
+ n = jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ n = jj_consume_token(MINUS);
+ break;
+ case DIV:
+ n = jj_consume_token(DIV);
+ break;
+ case ANY:
+ n = jj_consume_token(ANY);
+ break;
+ case COMPARE:
+ n = jj_consume_token(COMPARE);
+ break;
+ case EQ:
+ n = jj_consume_token(EQ);
+ break;
+ case PRECEDES:
+ n = jj_consume_token(PRECEDES);
+ break;
+ case SUCCEEDS:
+ n = jj_consume_token(SUCCEEDS);
+ break;
+ case OR:
+ n = jj_consume_token(OR);
+ break;
+ case AND:
+ n = jj_consume_token(AND);
+ break;
+ case S:
+ n = jj_consume_token(S);
+ break;
+ case NOT_EQ:
+ n = jj_consume_token(NOT_EQ);
+ break;
+ default:
+ jj_la1[112] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return n;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void eachDirective() throws ParseException {
+ Token var;
+ ArrayList<String> list = null;
+ String listVariable = null;
+ jj_consume_token(EACH_SYM);
+ label_74:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[113] = jj_gen;
+ break label_74;
+ }
+ jj_consume_token(S);
+ }
+ var = jj_consume_token(VARIABLE);
+ label_75:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[114] = jj_gen;
+ break label_75;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(EACH_IN);
+ label_76:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[115] = jj_gen;
+ break label_76;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ list = stringList();
+ documentHandler.startEachDirective(var.image, list);
+ break;
+ case REMOVE:
+ documentHandler.startEachDirective(var.image, list);
+ removeDirective();
+ break;
+ case VARIABLE:
+ listVariable = variableName();
+ documentHandler.startEachDirective(var.image, listVariable);
+ break;
+ default:
+ jj_la1[116] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(LBRACE);
+ label_77:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[117] = jj_gen;
+ break label_77;
+ }
+ jj_consume_token(S);
+ }
+ label_78:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ case REMOVE:
+ ;
+ break;
+ default:
+ jj_la1[118] = jj_gen;
+ break label_78;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case REMOVE:
+ removeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[119] = jj_gen;
+ if (jj_2_5(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
break;
- default:
- jj_la1[128] = jj_gen;
+ default:
+ jj_la1[120] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
- }
- jj_consume_token(LBRACE);
- label_86: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[129] = jj_gen;
- break label_86;
- }
- jj_consume_token(S);
- }
- documentHandler.startMixinDirective(name, args);
- label_87: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case INCLUDE_SYM:
- case EACH_SYM:
- case EXTEND_SYM:
- case IDENT:
- case VARIABLE:
- case HASH:
- case MEDIA_SYM:
- ;
- break;
- default:
- jj_la1[130] = jj_gen;
- break label_87;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case INCLUDE_SYM:
- includeDirective();
- break;
- case MEDIA_SYM:
- media();
- break;
- case EACH_SYM:
- eachDirective();
- break;
- case EXTEND_SYM:
- extendDirective();
- break;
- case VARIABLE:
- variable();
- break;
- default:
- jj_la1[131] = jj_gen;
- if (jj_2_6(3)) {
- declarationOrNestedProperties();
- } else {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- default:
- jj_la1[132] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- }
- jj_consume_token(RBRACE);
- label_88: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[133] = jj_gen;
- break label_88;
- }
- jj_consume_token(S);
- }
- documentHandler.endMixinDirective(name, args);
- }
-
- final public ArrayList<VariableNode> arglist() throws ParseException {
- ArrayList<VariableNode> args = new ArrayList<VariableNode>();
- VariableNode arg;
- arg = mixinArg();
- label_89: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[134] = jj_gen;
- break label_89;
- }
- jj_consume_token(COMMA);
- label_90: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[135] = jj_gen;
- break label_90;
- }
- jj_consume_token(S);
- }
- args.add(arg);
- arg = mixinArg();
- }
- args.add(arg);
- {
- if (true)
- return args;
- }
- throw new Error("Missing return statement in function");
- }
-
- final public VariableNode mixinArg() throws ParseException {
- String name;
- LexicalUnitImpl first = null;
- LexicalUnitImpl next = null;
- LexicalUnitImpl prev = null;
- name = variableName();
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_91: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[136] = jj_gen;
- break label_91;
- }
- jj_consume_token(S);
- }
- first = term(null);
- prev = first;
- label_92: while (true) {
- if (jj_2_7(2)) {
- ;
- } else {
- break label_92;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_93: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[137] = jj_gen;
- break label_93;
- }
- jj_consume_token(S);
- }
- break;
- default:
- jj_la1[138] = jj_gen;
- ;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next);
- prev = next;
- }
- break;
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_79:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[121] = jj_gen;
+ break label_79;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.endEachDirective();
+ }
+
+ final public ArrayList<String > stringList() throws ParseException {
+ ArrayList<String > strings = new ArrayList<String >();
+ Token input;
+ input = jj_consume_token(IDENT);
+ label_80:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[122] = jj_gen;
+ break label_80;
+ }
+ jj_consume_token(S);
+ }
+ strings.add(input.image);
+ label_81:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[123] = jj_gen;
+ break label_81;
+ }
+ jj_consume_token(COMMA);
+ label_82:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[139] = jj_gen;
- ;
- }
- VariableNode arg = new VariableNode(name, first, false);
- {
- if (true)
- return arg;
- }
- throw new Error("Missing return statement in function");
- }
-
- final public ArrayList<LexicalUnitImpl> argValuelist()
- throws ParseException {
- ArrayList<LexicalUnitImpl> args = new ArrayList<LexicalUnitImpl>();
- LexicalUnitImpl first = null;
- LexicalUnitImpl next = null;
- LexicalUnitImpl prev = null;
- first = term(null);
- args.add(first);
- prev = first;
- label_94: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case PLUS:
- case MINUS:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[140] = jj_gen;
- break label_94;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next);
- prev = next;
- }
- label_95: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[141] = jj_gen;
- break label_95;
- }
- jj_consume_token(COMMA);
- label_96: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[142] = jj_gen;
- break label_96;
- }
- jj_consume_token(S);
- }
- 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 STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- ;
- break;
- default:
- jj_la1[143] = jj_gen;
- break label_97;
- }
- next = term(prev);
- prev.setNextLexicalUnit(next);
- prev = next;
- }
- }
- {
- if (true)
- return args;
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void includeDirective() throws ParseException {
- String name;
- ArrayList<LexicalUnitImpl> args = null;
- jj_consume_token(INCLUDE_SYM);
- label_98: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[144] = jj_gen;
- break label_98;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- name = property();
- break;
- case FUNCTION:
- name = functionName();
- args = argValuelist();
- jj_consume_token(RPARAN);
- break;
+ jj_la1[124] = jj_gen;
+ break label_82;
+ }
+ jj_consume_token(S);
+ }
+ input = jj_consume_token(IDENT);
+ strings.add(input.image);
+ label_83:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[145] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_99: while (true) {
- jj_consume_token(SEMICOLON);
- label_100: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[146] = jj_gen;
- break label_100;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[147] = jj_gen;
- break label_99;
- }
- }
- documentHandler.includeDirective(name, args);
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public void removeDirective() throws ParseException {
- ArrayList<String> list = null;
- ArrayList<String> remove = null;
- String separator = null;
- Token n = null;
- jj_consume_token(REMOVE);
- label_101: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[148] = jj_gen;
- break label_101;
- }
- jj_consume_token(S);
- }
- list = removeDirectiveArgs(0);
- jj_consume_token(COMMA);
- label_102: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[149] = jj_gen;
- break label_102;
- }
- jj_consume_token(S);
- }
- remove = removeDirectiveArgs(1);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- label_103: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[150] = jj_gen;
- break label_103;
- }
- jj_consume_token(S);
- }
- n = jj_consume_token(IDENT);
- separator = n.image;
- label_104: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[151] = jj_gen;
- break label_104;
- }
- jj_consume_token(S);
- }
- break;
+ jj_la1[125] = jj_gen;
+ break label_83;
+ }
+ jj_consume_token(S);
+ }
+ }
+ {if (true) return strings;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void mixinDirective() throws ParseException {
+ String name;
+ ArrayList<VariableNode> args = null;
+ String body;
+ jj_consume_token(MIXIN_SYM);
+ label_84:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[126] = jj_gen;
+ break label_84;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ name = property();
+ break;
+ case FUNCTION:
+ name = functionName();
+ args = arglist();
+ jj_consume_token(RPARAN);
+ label_85:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[152] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
- label_105: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[153] = jj_gen;
- break label_105;
- }
- jj_consume_token(S);
- }
- jj_consume_token(SEMICOLON);
- label_106: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[154] = jj_gen;
- break label_106;
- }
- jj_consume_token(S);
- }
- documentHandler.removeDirective(list, remove, separator);
- }
-
- ArrayList<String> removeDirectiveArgs(int nest) throws ParseException {
- ArrayList<String> list = new ArrayList<String>();
- // Start at one due to "remove(" containing one.
- int nesting = nest;
- Token t = null;
-
- while (true) {
- t = getToken(1);
- if (t.kind == VARIABLE) {
- list.add(t.image);
- } else if (t.kind == STRING) {
- list.add(t.image.substring(1, t.image.length()).substring(0,
- t.image.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) {
- getNextToken();
- return list;
- }
- } else if (t.kind == COMMA) {
- if (nesting == nest) {
- return list;
- }
- }
-
- getNextToken();
- }
- }
-
- final public Node returnDirective() throws ParseException {
- String raw;
- raw = skipStatement();
- {
- if (true)
- return null;
- }
- throw new Error("Missing return statement in function");
- }
-
- void debugDirective() throws ParseException {
- }
-
- void warnDirective() throws ParseException {
- }
-
- final public Node forDirective() throws ParseException {
- String var;
- String from;
- String to;
- boolean exclusive;
- String body;
- Token tok;
- var = variableName();
- int[] toThrough = { TO, THROUGH };
- from = skipStatementUntil(toThrough);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case TO:
- tok = jj_consume_token(TO);
- exclusive = true;
- break;
- case THROUGH:
- tok = jj_consume_token(THROUGH);
- exclusive = false;
+ jj_la1[127] = jj_gen;
+ break label_85;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[128] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(LBRACE);
+ label_86:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[129] = jj_gen;
+ break label_86;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startMixinDirective(name, args);
+ label_87:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case INCLUDE_SYM:
+ case EACH_SYM:
+ case EXTEND_SYM:
+ case IDENT:
+ case VARIABLE:
+ case HASH:
+ case MEDIA_SYM:
+ ;
+ break;
+ default:
+ jj_la1[130] = jj_gen;
+ break label_87;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INCLUDE_SYM:
+ includeDirective();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case EACH_SYM:
+ eachDirective();
+ break;
+ case EXTEND_SYM:
+ extendDirective();
+ break;
+ case VARIABLE:
+ variable();
+ break;
+ default:
+ jj_la1[131] = jj_gen;
+ if (jj_2_6(3)) {
+ declarationOrNestedProperties();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
break;
- default:
- jj_la1[155] = jj_gen;
+ default:
+ jj_la1[132] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
- }
- to = skipStatementUntilLeftBrace();
- label_107: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[156] = jj_gen;
- break label_107;
- }
- jj_consume_token(S);
- }
- body = skipStatement();
- {
- if (true)
- return documentHandler.forDirective(var, from, to, exclusive,
- body);
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Node whileDirective() throws ParseException {
- String condition;
- String body;
- condition = skipStatementUntilLeftBrace();
- body = skipStatement();
- {
- if (true)
- return documentHandler.whileDirective(condition, body);
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void extendDirective() throws ParseException {
- ArrayList<String> list;
- jj_consume_token(EXTEND_SYM);
- label_108: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[157] = jj_gen;
- break label_108;
- }
- jj_consume_token(S);
- }
- list = selectorList();
- label_109: while (true) {
- jj_consume_token(SEMICOLON);
- label_110: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[158] = jj_gen;
- break label_110;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[159] = jj_gen;
- break label_109;
- }
- }
- documentHandler.extendDirective(list);
- }
-
- Node importDirective() throws ParseException {
- return null;
- }
-
- Node charsetDirective() throws ParseException {
- return null;
- }
-
- Node mozDocumentDirective() throws ParseException {
- return null;
- }
-
- Node supportsDirective() throws ParseException {
- return null;
- }
-
- final public void nestedProperties() throws ParseException {
- String name;
- LexicalUnit exp;
- name = property();
- jj_consume_token(COLON);
- label_111: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[160] = jj_gen;
- break label_111;
- }
- jj_consume_token(S);
- }
- jj_consume_token(LBRACE);
- label_112: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[161] = jj_gen;
- break label_112;
- }
- jj_consume_token(S);
- }
- documentHandler.startNestedProperties(name);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
+ }
+ }
+ }
+ }
+ jj_consume_token(RBRACE);
+ 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);
+ }
+ documentHandler.endMixinDirective(name, args);
+ }
+
+ final public ArrayList<VariableNode> arglist() throws ParseException {
+ ArrayList<VariableNode> args = new ArrayList<VariableNode>();
+ VariableNode arg;
+ arg = mixinArg();
+ label_89:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[134] = jj_gen;
+ break label_89;
+ }
+ jj_consume_token(COMMA);
+ label_90:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[162] = jj_gen;
- ;
- }
- label_113: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[163] = jj_gen;
- break label_113;
- }
- jj_consume_token(SEMICOLON);
- label_114: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[164] = jj_gen;
- break label_114;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[165] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- documentHandler.endNestedProperties(name);
- label_115: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[166] = jj_gen;
- break label_115;
- }
- jj_consume_token(S);
- }
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public void declarationOrNestedProperties() throws ParseException {
- boolean important = false;
- String name;
- LexicalUnitImpl exp;
- Token save;
- String comment = null;
- try {
- name = property();
- save = token;
- jj_consume_token(COLON);
- label_116: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[167] = jj_gen;
- break label_116;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case PLUS:
- case MINUS:
- case STRING:
- case IDENT:
- case NUMBER:
- case URL:
- case VARIABLE:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case HASH:
- case UNICODERANGE:
- case FUNCTION:
- exp = expr();
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IMPORTANT_SYM:
- important = prio();
- break;
- default:
- jj_la1[168] = jj_gen;
- ;
- }
- Token next = getToken(1);
- if (next.kind == SEMICOLON || next.kind == RBRACE) {
- while (next.kind == SEMICOLON) {
- skipStatement();
- next = getToken(1);
- }
- if (token.specialToken != null) {
- documentHandler.property(name, exp, important,
- token.specialToken.image);
- } else {
- documentHandler.property(name, exp, important, null);
- }
- }
- break;
- case LBRACE:
- jj_consume_token(LBRACE);
- label_117: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[169] = jj_gen;
- break label_117;
- }
- jj_consume_token(S);
- }
- documentHandler.startNestedProperties(name);
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[170] = jj_gen;
- ;
- }
- label_118: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[171] = jj_gen;
- break label_118;
- }
- jj_consume_token(SEMICOLON);
- label_119: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[172] = jj_gen;
- break label_119;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[173] = jj_gen;
- ;
- }
- }
- jj_consume_token(RBRACE);
- label_120: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[174] = jj_gen;
- break label_120;
- }
- jj_consume_token(S);
- }
- documentHandler.endNestedProperties(name);
- break;
- default:
- jj_la1[175] = 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_121: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[176] = jj_gen;
- break label_121;
- }
- jj_consume_token(S);
- }
- exp = expr();
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IMPORTANT_SYM:
- important = prio();
- break;
- default:
- jj_la1[177] = 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_122: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[178] = jj_gen;
- break label_122;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return true;
+ jj_la1[135] = jj_gen;
+ break label_90;
+ }
+ jj_consume_token(S);
+ }
+ args.add(arg);
+ arg = mixinArg();
+ }
+ args.add(arg);
+ {if (true) return args;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public VariableNode mixinArg() throws ParseException {
+ String name;
+ LexicalUnitImpl first = null;
+ LexicalUnitImpl next = null;
+ LexicalUnitImpl prev = null;
+ name = variableName();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ label_91:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[136] = jj_gen;
+ break label_91;
+ }
+ jj_consume_token(S);
+ }
+ first = term(null);
+ prev = first;
+ label_92:
+ while (true) {
+ if (jj_2_7(2)) {
+ ;
+ } else {
+ break label_92;
}
- throw new Error("Missing return statement in function");
- }
-
- final public boolean guarded() throws ParseException {
- jj_consume_token(GUARDED_SYM);
- label_123: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ label_93:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case S:
- ;
- break;
+ ;
+ break;
default:
- jj_la1[179] = jj_gen;
- break label_123;
+ jj_la1[137] = jj_gen;
+ break label_93;
}
jj_consume_token(S);
- }
- {
- if (true)
- return true;
- }
- throw new Error("Missing return statement in function");
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public LexicalUnitImpl operator(LexicalUnitImpl prev)
- throws ParseException {
- Token n;
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case DIV:
- n = jj_consume_token(DIV);
- label_124: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[180] = jj_gen;
- break label_124;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return LexicalUnitImpl.createSlash(n.beginLine,
- n.beginColumn, prev);
- }
- break;
- case COMMA:
- n = jj_consume_token(COMMA);
- label_125: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[181] = jj_gen;
- break label_125;
- }
- jj_consume_token(S);
- }
- {
- if (true)
- return LexicalUnitImpl.createComma(n.beginLine,
- n.beginColumn, prev);
- }
- break;
+ }
+ break;
default:
- jj_la1[182] = 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_126: while (true) {
- if (jj_2_8(2)) {
- ;
- } else {
- break label_126;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case COMMA:
- case DIV:
- res = operator(res);
- break;
- default:
- jj_la1[183] = jj_gen;
- ;
- }
- res = term(res);
- }
- {
- if (true)
- return first;
+ jj_la1[138] = jj_gen;
+ ;
}
- throw new Error("Missing return statement in function");
+ next = term(prev);
+ prev.setNextLexicalUnit(next); prev = next;
+ }
+ break;
+ default:
+ jj_la1[139] = jj_gen;
+ ;
}
-
- /**
- * @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;
+ VariableNode arg = new VariableNode(name, first, false);
+ {if (true) return arg;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public ArrayList<LexicalUnitImpl> argValuelist() throws ParseException {
+ ArrayList<LexicalUnitImpl> args = new ArrayList<LexicalUnitImpl>();
+ LexicalUnitImpl first = null;
+ LexicalUnitImpl next = null;
+ LexicalUnitImpl prev = null;
+ first = term(null);
+ args.add(first); prev = first;
+ label_94:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ ;
+ break;
+ default:
+ jj_la1[140] = jj_gen;
+ break label_94;
+ }
+ next = term(prev);
+ prev.setNextLexicalUnit(next); prev = next;
+ }
+ label_95:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[141] = jj_gen;
+ break label_95;
+ }
+ jj_consume_token(COMMA);
+ label_96:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
default:
- jj_la1[184] = 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 = ' ';
- String varName;
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ jj_la1[142] = jj_gen;
+ break label_96;
+ }
+ jj_consume_token(S);
+ }
+ 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 STRING:
case IDENT:
case NUMBER:
case URL:
+ case VARIABLE:
case PERCENTAGE:
case PT:
case MM:
@@ -4166,308 +3270,1156 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
case HASH:
case UNICODERANGE:
case FUNCTION:
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case PLUS:
- case MINUS:
- case NUMBER:
- case PERCENTAGE:
- case PT:
- case MM:
- case CM:
- case PC:
- case IN:
- case PX:
- case EMS:
- case EXS:
- case DEG:
- case RAD:
- case GRAD:
- case MS:
- case SECOND:
- case HZ:
- case KHZ:
- case DIMEN:
- case FUNCTION:
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case PLUS:
- case MINUS:
- op = unaryOperator();
- break;
- default:
- jj_la1[185] = jj_gen;
- ;
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case NUMBER:
- n = jj_consume_token(NUMBER);
- result = LexicalUnitImpl.createNumber(n.beginLine,
- n.beginColumn, prev, number(op, n, 0));
- break;
- case PERCENTAGE:
- n = jj_consume_token(PERCENTAGE);
- result = LexicalUnitImpl.createPercentage(n.beginLine,
- n.beginColumn, prev, number(op, n, 1));
- break;
- case PT:
- n = jj_consume_token(PT);
- result = LexicalUnitImpl.createPT(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case CM:
- n = jj_consume_token(CM);
- result = LexicalUnitImpl.createCM(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case MM:
- n = jj_consume_token(MM);
- result = LexicalUnitImpl.createMM(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case PC:
- n = jj_consume_token(PC);
- result = LexicalUnitImpl.createPC(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case IN:
- n = jj_consume_token(IN);
- result = LexicalUnitImpl.createIN(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case PX:
- n = jj_consume_token(PX);
- result = LexicalUnitImpl.createPX(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case EMS:
- n = jj_consume_token(EMS);
- result = LexicalUnitImpl.createEMS(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case EXS:
- n = jj_consume_token(EXS);
- result = LexicalUnitImpl.createEXS(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case DEG:
- n = jj_consume_token(DEG);
- result = LexicalUnitImpl.createDEG(n.beginLine,
- n.beginColumn, prev, number(op, n, 3));
- break;
- case RAD:
- n = jj_consume_token(RAD);
- result = LexicalUnitImpl.createRAD(n.beginLine,
- n.beginColumn, prev, number(op, n, 3));
- break;
- case GRAD:
- n = jj_consume_token(GRAD);
- result = LexicalUnitImpl.createGRAD(n.beginLine,
- n.beginColumn, prev, number(op, n, 3));
- break;
- case SECOND:
- n = jj_consume_token(SECOND);
- result = LexicalUnitImpl.createS(n.beginLine,
- n.beginColumn, prev, number(op, n, 1));
- break;
- case MS:
- n = jj_consume_token(MS);
- result = LexicalUnitImpl.createMS(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case HZ:
- n = jj_consume_token(HZ);
- result = LexicalUnitImpl.createHZ(n.beginLine,
- n.beginColumn, prev, number(op, n, 2));
- break;
- case KHZ:
- n = jj_consume_token(KHZ);
- result = LexicalUnitImpl.createKHZ(n.beginLine,
- n.beginColumn, prev, number(op, n, 3));
- break;
- case DIMEN:
- n = jj_consume_token(DIMEN);
- String s = n.image;
- int i = 0;
- while (i < s.length()
- && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) {
- i++;
- }
- result = LexicalUnitImpl.createDimen(n.beginLine,
- n.beginColumn, prev,
- Float.valueOf(s.substring(0, i)).floatValue(),
- s.substring(i));
- break;
- case FUNCTION:
- result = function(op, prev);
- break;
- default:
- jj_la1[186] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- 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 IDENT:
- n = jj_consume_token(IDENT);
- String 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));
- }
+ ;
+ break;
+ default:
+ jj_la1[143] = jj_gen;
+ break label_97;
+ }
+ next = term(prev);
+ prev.setNextLexicalUnit(next); prev = next;
+ }
+ }
+ {if (true) return args;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void includeDirective() throws ParseException {
+ String name;
+ ArrayList<LexicalUnitImpl> args=null;
+ jj_consume_token(INCLUDE_SYM);
+ label_98:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[144] = jj_gen;
+ break label_98;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ name = property();
+ break;
+ case FUNCTION:
+ name = functionName();
+ args = argValuelist();
+ jj_consume_token(RPARAN);
+ break;
+ default:
+ jj_la1[145] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_99:
+ while (true) {
+ jj_consume_token(SEMICOLON);
+ label_100:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[146] = jj_gen;
+ break label_100;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[147] = jj_gen;
+ break label_99;
+ }
+ }
+ documentHandler.includeDirective(name, args);
+ }
- /*
- * / 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; } /
- */
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void removeDirective() throws ParseException {
+ ArrayList<String> list = null;
+ ArrayList<String> remove = null;
+ String separator = null;
+ Token n = null;
+ jj_consume_token(REMOVE);
+ label_101:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[148] = jj_gen;
+ break label_101;
+ }
+ jj_consume_token(S);
+ }
+ list = removeDirectiveArgs(0);
+ jj_consume_token(COMMA);
+ label_102:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[149] = jj_gen;
+ break label_102;
+ }
+ jj_consume_token(S);
+ }
+ remove = removeDirectiveArgs(1);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ label_103:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[150] = jj_gen;
+ break label_103;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(IDENT);
+ separator = n.image;
+ label_104:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[151] = jj_gen;
+ break label_104;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[152] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPARAN);
+ label_105:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[153] = jj_gen;
+ break label_105;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ label_106:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[154] = jj_gen;
+ break label_106;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.removeDirective(list,remove,separator);
+ }
+
+ ArrayList<String > removeDirectiveArgs(int nest) throws ParseException {
+ ArrayList<String> list = new ArrayList<String>();
+ // Start at one due to "remove(" containing one.
+ int nesting = nest;
+ Token t = null;
- break;
- case HASH:
- result = hexcolor(prev);
- break;
- case URL:
- result = url(prev);
- break;
- case UNICODERANGE:
- result = unicode(prev);
- break;
- default:
- jj_la1[187] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[188] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_127: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[189] = jj_gen;
- break label_127;
+ while(true)
+ {
+ t = getToken(1);
+ if(t.kind == VARIABLE)
+ {
+ list.add(t.image);
+ }else if(t.kind == STRING)
+ {
+ list.add(t.image.substring(1,t.image.length()).substring(0,t.image.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)
+ {
+ getNextToken();
+ return list;
+ }
+ } else if(t.kind == COMMA)
+ {
+ if(nesting == nest)
+ {
+ return list;
+ }
+ } else if(t.kind == LBRACE)
+ {
+ throw new CSSParseException("Invalid token,'{' found", getLocator());
}
- jj_consume_token(S);
- }
- break;
- case VARIABLE:
- varName = variableName();
- result = LexicalUnitImpl.createVariable(token.beginLine,
- token.beginColumn, prev, varName);
+
+ getNextToken();
+ }
+ }
+
+ final public Node returnDirective() throws ParseException {
+ String raw;
+ raw = skipStatement();
+ {if (true) return null;}
+ throw new Error("Missing return statement in function");
+ }
+
+ void debugDirective() throws ParseException {
+ }
+
+ void warnDirective() throws ParseException {
+ }
+
+ final public Node forDirective() throws ParseException {
+ String var;
+ String from;
+ String to;
+ boolean exclusive;
+ String body;
+ Token tok;
+ var = variableName();
+ int[] toThrough = {TO, THROUGH};
+ from = skipStatementUntil(toThrough);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TO:
+ tok = jj_consume_token(TO);
+ exclusive = true;
+ break;
+ case THROUGH:
+ tok = jj_consume_token(THROUGH);
+ exclusive = false;
+ break;
+ default:
+ jj_la1[155] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ to = skipStatementUntilLeftBrace();
+ label_107:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[156] = jj_gen;
+ break label_107;
+ }
+ jj_consume_token(S);
+ }
+ body = skipStatement();
+ {if (true) return documentHandler.forDirective(var, from, to, exclusive, body);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Node whileDirective() throws ParseException {
+ String condition;
+ String body;
+ condition = skipStatementUntilLeftBrace();
+ body = skipStatement();
+ {if (true) return documentHandler.whileDirective(condition, body);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void extendDirective() throws ParseException {
+ ArrayList<String> list;
+ jj_consume_token(EXTEND_SYM);
+ label_108:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[157] = jj_gen;
+ break label_108;
+ }
+ jj_consume_token(S);
+ }
+ list = selectorList();
+ label_109:
+ while (true) {
+ jj_consume_token(SEMICOLON);
+ label_110:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[158] = jj_gen;
+ break label_110;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[159] = jj_gen;
+ break label_109;
+ }
+ }
+ documentHandler.extendDirective(list);
+ }
+
+ Node importDirective() throws ParseException {
+ return null;
+ }
+
+ Node charsetDirective() throws ParseException {
+ return null;
+ }
+
+ Node mozDocumentDirective() throws ParseException {
+ return null;
+ }
+
+ Node supportsDirective() throws ParseException {
+ return null;
+ }
+
+ final public void nestedProperties() throws ParseException {
+ String name;
+LexicalUnit exp;
+ name = property();
+ jj_consume_token(COLON);
+ label_111:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[160] = jj_gen;
+ break label_111;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LBRACE);
+ label_112:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[161] = jj_gen;
+ break label_112;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startNestedProperties(name);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[162] = jj_gen;
+ ;
+ }
+ label_113:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[163] = jj_gen;
+ break label_113;
+ }
+ jj_consume_token(SEMICOLON);
+ label_114:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[164] = jj_gen;
+ break label_114;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[165] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ documentHandler.endNestedProperties(name);
+ label_115:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[166] = jj_gen;
+ break label_115;
+ }
+ jj_consume_token(S);
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void declarationOrNestedProperties() throws ParseException {
+ boolean important = false;
+ String name;
+ LexicalUnitImpl exp;
+ Token save;
+ String comment = null;
+ try {
+ name = property();
+ save = token;
+ jj_consume_token(COLON);
+ label_116:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[167] = jj_gen;
+ break label_116;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ important = prio();
+ break;
+ default:
+ jj_la1[168] = jj_gen;
+ ;
+ }
+ Token next = getToken(1);
+ if(next.kind == SEMICOLON || next.kind == RBRACE){
+ while(next.kind == SEMICOLON){
+ skipStatement();
+ next = getToken(1);
+ }
+ if(token.specialToken!=null){
+ documentHandler.property(name, exp, important, token.specialToken.image);
+ }else{
+ documentHandler.property(name, exp, important, null);
+ }
+ }
+ break;
+ case LBRACE:
+ jj_consume_token(LBRACE);
+ label_117:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
break;
+ default:
+ jj_la1[169] = jj_gen;
+ break label_117;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.startNestedProperties(name);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
default:
- jj_la1[190] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {
- if (true)
- return result;
+ jj_la1[170] = jj_gen;
+ ;
}
- 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_128: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ label_118:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[171] = jj_gen;
+ break label_118;
+ }
+ jj_consume_token(SEMICOLON);
+ label_119:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case S:
- ;
- break;
+ ;
+ break;
default:
- jj_la1[191] = jj_gen;
- break label_128;
+ jj_la1[172] = jj_gen;
+ break label_119;
}
jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[173] = jj_gen;
+ ;
+ }
}
- String fname = convertIdent(n.image);
- if ("alpha(".equals(fname)) {
- String body = skipStatementUntilSemiColon();
- {
- if (true)
- return LexicalUnitImpl.createIdent(n.beginLine,
- n.beginColumn, null, "alpha(" + body);
- }
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ jj_consume_token(RBRACE);
+ label_120:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[174] = jj_gen;
+ break label_120;
+ }
+ jj_consume_token(S);
+ }
+ documentHandler.endNestedProperties(name);
+ break;
+ default:
+ jj_la1[175] = 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_121:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[176] = jj_gen;
+ break label_121;
+ }
+ jj_consume_token(S);
+ }
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ important = prio();
+ break;
+ default:
+ jj_la1[177] = 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_122:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[178] = jj_gen;
+ break label_122;
+ }
+ 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_123:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[179] = jj_gen;
+ break label_123;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return true;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl operator(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DIV:
+ n = jj_consume_token(DIV);
+ label_124:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[180] = jj_gen;
+ break label_124;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ label_125:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[181] = jj_gen;
+ break label_125;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ default:
+ jj_la1[182] = 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_126:
+ while (true) {
+ if (jj_2_8(2)) {
+ ;
+ } else {
+ break label_126;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ case DIV:
+ res = operator(res);
+ break;
+ default:
+ jj_la1[183] = jj_gen;
+ ;
+ }
+ res = term(res);
+ }
+ {if (true) return first;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char unaryOperator() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MINUS:
+ jj_consume_token(MINUS);
+ {if (true) return '-';}
+ break;
+ case PLUS:
+ jj_consume_token(PLUS);
+ {if (true) return '+';}
+ break;
+ default:
+ jj_la1[184] = 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 = ' ';
+ String varName;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case NUMBER:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case FUNCTION:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
case MINUS:
- case STRING:
- case IDENT:
+ op = unaryOperator();
+ break;
+ default:
+ jj_la1[185] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUMBER:
- case URL:
- case VARIABLE:
+ 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:
- case MM:
+ n = jj_consume_token(PT);
+ result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case CM:
+ n = jj_consume_token(CM);
+ result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case MM:
+ n = jj_consume_token(MM);
+ result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case PC:
+ n = jj_consume_token(PC);
+ result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case IN:
+ n = jj_consume_token(IN);
+ result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case PX:
+ n = jj_consume_token(PX);
+ result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case EMS:
+ n = jj_consume_token(EMS);
+ result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case EXS:
+ n = jj_consume_token(EXS);
+ result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
case DEG:
+ n = jj_consume_token(DEG);
+ result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
case RAD:
+ n = jj_consume_token(RAD);
+ result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
case GRAD:
- case MS:
+ 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);
+ String s = n.image;
+ int i = 0;
+ while (i < s.length()
+ && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) {
+ i++;
+ }
+ result = LexicalUnitImpl.createDimen(n.beginLine, n.beginColumn, prev,
+ Float.valueOf(s.substring(0, i)).floatValue(),
+ s.substring(i));
+ break;
+ case FUNCTION:
+ result = function(op, prev);
+ break;
+ default:
+ jj_la1[186] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ 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 IDENT:
+ n = jj_consume_token(IDENT);
+ String 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:
- case FUNCTION:
- params = expr();
- break;
+ result = unicode(prev);
+ break;
default:
- jj_la1[192] = jj_gen;
- ;
- }
- jj_consume_token(RPARAN);
+ jj_la1[187] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[188] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_127:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[189] = jj_gen;
+ break label_127;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ case VARIABLE:
+ varName = variableName();
+ result = LexicalUnitImpl.createVariable(token.beginLine, token.beginColumn,
+ prev, varName);
+ break;
+ default:
+ jj_la1[190] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {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_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);
+ }
+ String fname = convertIdent(n.image);
+ if("alpha(".equals(fname)){
+ String body = skipStatementUntilSemiColon();
+ {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ null, "alpha("+body);}
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case VARIABLE:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ params = expr();
+ break;
+ default:
+ jj_la1[192] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPARAN);
if (operator != ' ') {
- {
- if (true)
- throw new CSSParseException(
- "invalid operator before a function.", getLocator());
- }
+ {if (true) throw new CSSParseException("invalid operator before a function.",
+ getLocator());}
}
String f = convertIdent(n.image);
LexicalUnitImpl l = (LexicalUnitImpl) params;
@@ -4477,36 +4429,32 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
int i = 0;
while (loop && l != null && i < 5) {
switch (i) {
- case 0:
- case 2:
- case 4:
- if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
+ case 0:
+ case 2:
+ case 4:
+ if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
&& (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
- loop = false;
- }
- break;
- case 1:
- case 3:
- if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
- loop = false;
- }
- break;
- default: {
- if (true)
- throw new ParseException("implementation error");
- }
+ 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++;
+ i ++;
}
}
if ((i == 5) && loop && (l == null)) {
- {
- if (true)
- return LexicalUnitImpl.createRGBColor(n.beginLine,
- n.beginColumn, prev, params);
- }
+ {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine,
+ n.beginColumn,
+ prev, params);}
} else {
if (errorHandler != null) {
String errorText;
@@ -4514,60 +4462,54 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
if (i < 5) {
if (params == null) {
loc = new LocatorImpl(this, n.beginLine,
- n.beginColumn - 1);
+ n.beginColumn-1);
errorText = "not enough parameters.";
} else if (l == null) {
loc = new LocatorImpl(this, n.beginLine,
- n.beginColumn - 1);
+ n.beginColumn-1);
errorText = "not enough parameters: "
- + params.toString();
+ + params.toString();
} else {
loc = new LocatorImpl(this, l.getLineNumber(),
- l.getColumnNumber());
- errorText = "invalid parameter: " + l.toString();
+ l.getColumnNumber());
+ errorText = "invalid parameter: "
+ + l.toString();
}
} else {
loc = new LocatorImpl(this, l.getLineNumber(),
- l.getColumnNumber());
- errorText = "too many parameters: " + l.toString();
+ l.getColumnNumber());
+ errorText = "too many parameters: "
+ + l.toString();
}
errorHandler.error(new CSSParseException(errorText, loc));
}
- {
- if (true)
- throw new JumpException();
- }
+ {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");
- }
+ 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++;
+ i ++;
}
if (((i == 1) || (i == 3)) && loop && (l == null)) {
- {
- if (true)
- return LexicalUnitImpl.createCounter(n.beginLine,
- n.beginColumn, prev, params);
- }
+ {if (true) return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
+ prev, params);}
}
} else if ("counters(".equals(f)) {
@@ -4575,1955 +4517,1579 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
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");
- }
+ 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++;
+ i ++;
}
if (((i == 3) || (i == 5)) && loop && (l == null)) {
- {
- if (true)
- return LexicalUnitImpl.createCounters(n.beginLine,
- n.beginColumn, prev, params);
- }
+ {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());
- }
+ 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) {
+ 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 LexicalUnit.SAC_IDENT:
- if (!l.getStringValue().equals("auto")) {
+ case 1:
+ case 3:
+ case 5:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
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");
- }
+ {if (true) throw new ParseException("implementation error");}
}
l = (LexicalUnitImpl) l.getNextLexicalUnit();
- i++;
+ i ++;
}
if ((i == 7) && loop && (l == null)) {
- {
- if (true)
- return LexicalUnitImpl.createRect(n.beginLine,
- n.beginColumn, prev, params);
- }
- }
- }
- {
- if (true)
- return LexicalUnitImpl.createFunction(n.beginLine,
- n.beginColumn, prev, f.substring(0, f.length() - 1),
- params);
- }
- throw new Error("Missing return statement in function");
- }
-
- final public LexicalUnitImpl unicode(LexicalUnitImpl prev)
- throws ParseException {
- Token n;
- n = jj_consume_token(UNICODERANGE);
- LexicalUnitImpl params = null;
- String s = n.image.substring(2);
- int index = s.indexOf('-');
- if (index == -1) {
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s, 16));
- } else {
- String s1 = s.substring(0, index);
- String s2 = s.substring(index);
-
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s1, 16));
- params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
- params, Integer.parseInt(s2, 16));
- }
-
- {
- if (true)
- return LexicalUnitImpl.createUnicodeRange(n.beginLine,
- n.beginColumn, prev, params);
- }
- throw new Error("Missing return statement in function");
- }
-
- final public LexicalUnitImpl url(LexicalUnitImpl prev)
- throws ParseException {
- Token n;
- n = jj_consume_token(URL);
- String urlname = n.image.substring(4, n.image.length() - 1).trim();
- {
- if (true)
- return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn,
- prev, urlname);
- }
- throw new Error("Missing return statement in function");
- }
-
- /**
- * @exception ParseException
- * exception during the parse
- */
- final public LexicalUnitImpl hexcolor(LexicalUnitImpl prev)
- throws ParseException {
- Token n;
- n = jj_consume_token(HASH);
- int r;
- LexicalUnitImpl first, params = null;
- String s = n.image.substring(1);
-
- if (s.length() != 3 && s.length() != 6) {
- first = null;
- {
- if (true)
- throw new CSSParseException(
- "invalid hexadecimal notation for RGB: " + s,
- getLocator());
- }
- }
- {
- if (true)
- return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
- prev, n.image);
- }
- throw new Error("Missing return statement in function");
- }
-
- float number(char operator, Token n, int lengthUnit) throws ParseException {
- String image = n.image;
- float f = 0;
-
- if (lengthUnit != 0) {
- image = image.substring(0, image.length() - lengthUnit);
- }
- f = Float.valueOf(image).floatValue();
- return (operator == '-') ? -f : f;
- }
-
- String skipStatementUntilSemiColon() throws ParseException {
- int[] semicolon = { SEMICOLON };
- return skipStatementUntil(semicolon);
- }
-
- String skipStatementUntilLeftBrace() throws ParseException {
- int[] lBrace = { LBRACE };
- return skipStatementUntil(lBrace);
- }
-
- String skipStatementUntilRightParan() throws ParseException {
- int[] rParan = { RPARAN };
- return skipStatementUntil(rParan);
- }
-
- String skipStatementUntil(int[] symbols) throws ParseException {
- StringBuffer s = new StringBuffer();
- boolean stop = false;
- Token tok;
- while (!stop) {
- tok = getToken(1);
- if (tok.kind == EOF) {
- return null;
- }
- for (int sym : symbols) {
- if (tok.kind == sym) {
- stop = true;
- break;
- }
- }
- if (!stop) {
- if (tok.image != null) {
- s.append(tok.image);
- }
- getNextToken();
- }
- }
- return s.toString().trim();
- }
+ {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");
+ }
- 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;
- }
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(HASH);
+ int r;
+ LexicalUnitImpl first, params = null;
+ String s = n.image.substring(1);
+
+ if(s.length()!=3 && s.length()!=6) {
+ first = null;
+ {if (true) throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
+ getLocator());}
+ }
+ {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ float number(char operator, Token n, int lengthUnit) throws ParseException {
+ String image = n.image;
+ float f = 0;
+
+ if (lengthUnit != 0) {
+ image = image.substring(0, image.length() - lengthUnit);
+ }
+ f = Float.valueOf(image).floatValue();
+ return (operator == '-')? -f: f;
+ }
+
+ String skipStatementUntilSemiColon() throws ParseException {
+ int[] semicolon = {SEMICOLON};
+ return skipStatementUntil(semicolon);
+ }
+
+ String skipStatementUntilLeftBrace() throws ParseException {
+ int[] lBrace = {LBRACE};
+ return skipStatementUntil(lBrace);
+ }
+
+ String skipStatementUntilRightParan() throws ParseException {
+ int[] rParan = {RPARAN};
+ return skipStatementUntil(rParan);
+ }
+
+ String skipStatementUntil(int[] symbols) throws ParseException {
+ StringBuffer s = new StringBuffer();
+ boolean stop = false;
+ Token tok;
+ while(!stop){
+ tok = getToken(1);
+ if(tok.kind == EOF) {
+ return null;
+ }
+ for(int sym : symbols){
+ if(tok.kind == sym){
+ stop = true;
+ break;
+ }
+ }
+ if(!stop){
+ if (tok.image != null) {
+ s.append(tok.image);
}
getNextToken();
}
- return s.toString();
- }
-
- String convertStringIndex(String s, int start, int len)
- throws ParseException {
- StringBuffer buf = new StringBuffer(len);
- int index = start;
-
- while (index < len) {
- char c = s.charAt(index);
- if (c == '\u005c\u005c') {
- if (++index < len) {
- c = s.charAt(index);
- switch (c) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- int numValue = Character.digit(c, 16);
- int count = 0;
- int p = 16;
-
- while (index + 1 < len && count < 6) {
- c = s.charAt(index + 1);
-
- if (Character.digit(c, 16) != -1) {
- numValue = (numValue * 16)
- + Character.digit(c, 16);
- p *= 16;
- index++;
- } else {
- if (c == ' ') {
- // skip the latest white space
- index++;
- }
- break;
- }
- }
- buf.append((char) numValue);
- break;
- case '\u005cn':
- case '\u005cf':
- break;
- case '\u005cr':
- if (index + 1 < len) {
- if (s.charAt(index + 1) == '\u005cn') {
- index++;
- }
- }
- break;
- default:
- buf.append(c);
- }
- } else {
- throw new CSSParseException("invalid string " + s,
- getLocator());
- }
- } else {
- buf.append(c);
- }
- index++;
- }
-
- return buf.toString();
}
+ return s.toString().trim();
+ }
- String convertIdent(String s) throws ParseException {
- return convertStringIndex(s, 0, s.length());
+ String skipStatement() throws ParseException {
+ StringBuffer s = new StringBuffer();
+ Token tok = getToken(0);
+ if (tok.image != null) {
+ s.append(tok.image);
}
-
- String convertString(String s) throws ParseException {
- return convertStringIndex(s, 0, s.length());
- }
-
- void comments() throws ParseException {
- if (token.specialToken != null) {
- Token tmp_t = token.specialToken;
- while (tmp_t.specialToken != null)
- tmp_t = tmp_t.specialToken;
- while (tmp_t != null) {
- documentHandler.comment(tmp_t.image);
- tmp_t = tmp_t.next;
- }
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ return null;
}
- }
-
- 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);
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
getNextToken();
- t = getToken(1);
- }
-
- return s.toString();
- }
-
- /**
- * The following functions are useful for a DOM CSS implementation only and
- * are not part of the general CSS2 parser.
- */
- final public void _parseRule() throws ParseException {
- String ret = null;
- label_129: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[193] = jj_gen;
- break label_129;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IMPORT_SYM:
- importDeclaration();
- break;
- case LBRACKET:
- case ANY:
- case PARENT:
- case DOT:
- case COLON:
- case EACH_VAR:
- case IDENT:
- case HASH:
- styleRule();
- break;
- case MEDIA_SYM:
- media();
+ s.append(skip_to_matching_brace());
+ getNextToken();
+ tok = getToken(1);
break;
- case PAGE_SYM:
- page();
+ } else if (tok.kind == RBRACE) {
+ getNextToken();
+ tok = getToken(1);
break;
- case FONT_FACE_SYM:
- fontFace();
+ } else if (tok.kind == SEMICOLON) {
+ getNextToken();
+ tok = getToken(1);
break;
- default:
- jj_la1[194] = jj_gen;
- ret = skipStatement();
- if ((ret == null) || (ret.length() == 0)) {
- {
- if (true)
- return;
- }
- }
- if (ret.charAt(0) == '@') {
- documentHandler.ignorableAtRule(ret);
- } else {
- {
- if (true)
- throw new CSSParseException("unrecognize rule: " + ret,
- getLocator());
- }
- }
- }
- }
-
- final public void _parseImportRule() throws ParseException {
- label_130: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[195] = jj_gen;
- break label_130;
- }
- jj_consume_token(S);
}
- importDeclaration();
+ getNextToken();
}
- final public void _parseMediaRule() throws ParseException {
- label_131: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[196] = jj_gen;
- break label_131;
- }
- jj_consume_token(S);
- }
- media();
- }
-
- final public void _parseDeclarationBlock() throws ParseException {
- 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);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
+ // skip white space
+ while (true) {
+ if (tok.kind != S) {
break;
- default:
- jj_la1[198] = jj_gen;
- ;
- }
- label_133: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[199] = jj_gen;
- break label_133;
- }
- jj_consume_token(SEMICOLON);
- label_134: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[200] = jj_gen;
- break label_134;
- }
- jj_consume_token(S);
- }
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case IDENT:
- declaration();
- break;
- default:
- jj_la1[201] = jj_gen;
- ;
- }
}
+ tok = getNextToken();
+ tok = getToken(1);
}
- final public ArrayList<String> _parseSelectors() throws ParseException {
- ArrayList<String> p = null;
- try {
- label_135: while (true) {
- switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
- case S:
- ;
- break;
- default:
- jj_la1[202] = jj_gen;
- break label_135;
- }
- 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");
- }
+ return s.toString().trim();
+ }
- 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_3R_139() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_148()) {
- jj_scanpos = xsp;
- if (jj_3R_149()) {
- jj_scanpos = xsp;
- if (jj_3R_150()) {
- jj_scanpos = xsp;
- if (jj_3R_151()) {
- jj_scanpos = xsp;
- if (jj_3R_152())
- return true;
- }
- }
- }
+ 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;
}
- return false;
- }
-
- private boolean jj_3R_167() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_186())
- jj_scanpos = xsp;
- xsp = jj_scanpos;
- if (jj_3R_187()) {
- jj_scanpos = xsp;
- if (jj_3R_188()) {
- jj_scanpos = xsp;
- if (jj_3R_189()) {
- jj_scanpos = xsp;
- if (jj_3R_190()) {
- jj_scanpos = xsp;
- if (jj_3R_191()) {
- jj_scanpos = xsp;
- if (jj_3R_192()) {
- jj_scanpos = xsp;
- if (jj_3R_193()) {
- jj_scanpos = xsp;
- if (jj_3R_194()) {
- jj_scanpos = xsp;
- if (jj_3R_195()) {
- jj_scanpos = xsp;
- if (jj_3R_196()) {
- jj_scanpos = xsp;
- if (jj_3R_197()) {
- jj_scanpos = xsp;
- if (jj_3R_198()) {
- jj_scanpos = xsp;
- if (jj_3R_199()) {
- jj_scanpos = xsp;
- if (jj_3R_200()) {
- jj_scanpos = xsp;
- if (jj_3R_201()) {
- jj_scanpos = xsp;
- if (jj_3R_202()) {
- jj_scanpos = xsp;
- if (jj_3R_203()) {
- jj_scanpos = xsp;
- if (jj_3R_204()) {
- jj_scanpos = xsp;
- if (jj_3R_205())
- return true;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ nesting++;
+ } else if (tok.kind == RBRACE) {
+ nesting--;
+ if (nesting == 0) {
+ break;
+ }
+ }
+ getNextToken();
+ }
+ return s.toString();
+ }
+
+ String convertStringIndex(String s, int start, int len) throws ParseException {
+ StringBuffer buf = new StringBuffer(len);
+ int index = start;
+
+ while (index < len) {
+ char c = s.charAt(index);
+ if (c == '\u005c\u005c') {
+ if (++index < len) {
+ c = s.charAt(index);
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ int numValue = Character.digit(c, 16);
+ int count = 0;
+ int p = 16;
+
+ while (index + 1 < len && count < 6) {
+ c = s.charAt(index+1);
+
+ if (Character.digit(c, 16) != -1) {
+ numValue = (numValue * 16) + Character.digit(c, 16);
+ p *= 16;
+ index++;
+ } else {
+ if (c == ' ') {
+ // skip the latest white space
+ index++;
}
+ break;
}
}
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_156() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_167()) {
- jj_scanpos = xsp;
- if (jj_3R_168())
- return true;
- }
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) {
- jj_scanpos = xsp;
- break;
- }
- }
- return false;
- }
-
- private boolean jj_3R_142() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_156()) {
- jj_scanpos = xsp;
- if (jj_3R_157())
- return true;
- }
- return false;
- }
-
- private boolean jj_3R_143() {
- if (jj_3R_158())
- return true;
- return false;
- }
-
- private boolean jj_3R_162() {
- if (jj_scan_token(HASH))
- return true;
- return false;
- }
-
- private boolean jj_3R_214() {
- if (jj_scan_token(HASH))
- return true;
- return false;
- }
-
- private boolean jj_3R_220() {
- if (jj_scan_token(PLUS))
- return true;
- return false;
- }
-
- private boolean jj_3R_219() {
- if (jj_scan_token(MINUS))
- return true;
- return false;
- }
-
- private boolean jj_3R_212() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_219()) {
- jj_scanpos = xsp;
- if (jj_3R_220())
- return true;
- }
- return false;
- }
-
- private boolean jj_3_8() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_143())
- jj_scanpos = xsp;
- if (jj_3R_142())
- return true;
- return false;
- }
-
- private boolean jj_3R_215() {
- if (jj_scan_token(URL))
- return true;
- return false;
- }
-
- private boolean jj_3R_166() {
- if (jj_3R_142())
- return true;
- return false;
- }
-
- private boolean jj_3_2() {
- if (jj_3R_138())
- return true;
- if (jj_3R_139())
- return true;
- return false;
- }
-
- private boolean jj_3R_171() {
- 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_158() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_170()) {
- jj_scanpos = xsp;
- if (jj_3R_171())
- return true;
- }
- return false;
- }
-
- private boolean jj_3R_170() {
- 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_216() {
- if (jj_scan_token(UNICODERANGE))
- return true;
- return false;
- }
-
- private boolean jj_3R_164() {
- if (jj_scan_token(COLON))
- return true;
- return false;
- }
-
- private boolean jj_3_4() {
- if (jj_3R_140())
- return true;
- return false;
- }
-
- private boolean jj_3R_221() {
- if (jj_3R_166())
- return true;
- return false;
- }
-
- private boolean jj_3R_213() {
- 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_221())
- jj_scanpos = xsp;
- if (jj_scan_token(RPARAN))
- return true;
- return false;
- }
-
- private boolean jj_3_3() {
- if (jj_3R_140())
- return true;
- return false;
- }
-
- private boolean jj_3R_157() {
- if (jj_3R_169())
- return true;
- return false;
- }
-
- private boolean jj_3R_210() {
- if (jj_3R_216())
- return true;
- return false;
- }
-
- private boolean jj_3R_209() {
- if (jj_3R_215())
- return true;
- return false;
- }
-
- private boolean jj_3R_208() {
- if (jj_3R_214())
- return true;
- return false;
- }
-
- private boolean jj_3R_218() {
- if (jj_scan_token(EACH_VAR))
- return true;
- return false;
- }
-
- private boolean jj_3R_165() {
- if (jj_scan_token(LBRACKET))
- return true;
- return false;
- }
-
- private boolean jj_3R_153() {
- if (jj_scan_token(IDENT))
- return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) {
- jj_scanpos = xsp;
- break;
- }
- }
- return false;
- }
-
- private boolean jj_3R_169() {
- 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_185() {
- if (jj_scan_token(PARENT))
- return true;
- return false;
- }
-
- private boolean jj_3R_184() {
- if (jj_scan_token(ANY))
- return true;
- return false;
- }
-
- private boolean jj_3R_207() {
- if (jj_scan_token(IDENT))
- return true;
- return false;
- }
-
- private boolean jj_3R_141() {
- 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_217() {
- if (jj_scan_token(IDENT))
- return true;
- return false;
- }
-
- private boolean jj_3R_211() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_217()) {
- jj_scanpos = xsp;
- if (jj_3R_218())
- return true;
- }
- return false;
- }
-
- private boolean jj_3R_137() {
- if (jj_3R_140())
- return true;
- return false;
- }
-
- private boolean jj_3R_161() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_183()) {
- jj_scanpos = xsp;
- if (jj_3R_184()) {
- jj_scanpos = xsp;
- if (jj_3R_185())
- return true;
- }
- }
- return false;
- }
-
- private boolean jj_3R_183() {
- 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_206() {
- if (jj_scan_token(STRING))
- return true;
- return false;
- }
-
- private boolean jj_3R_205() {
- if (jj_3R_213())
- return true;
- return false;
- }
-
- private boolean jj_3R_180() {
- if (jj_scan_token(S))
- return true;
- return false;
- }
-
- private boolean jj_3R_179() {
- if (jj_scan_token(DOT))
- return true;
- return false;
- }
-
- private boolean jj_3R_168() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_206()) {
- jj_scanpos = xsp;
- if (jj_3R_207()) {
- jj_scanpos = xsp;
- if (jj_3R_208()) {
- jj_scanpos = xsp;
- if (jj_3R_209()) {
- jj_scanpos = xsp;
- if (jj_3R_210())
- return true;
- }
- }
- }
- }
- return false;
- }
-
- private boolean jj_3R_178() {
- if (jj_scan_token(EQ))
- return true;
- return false;
- }
-
- private boolean jj_3R_177() {
- if (jj_scan_token(RPARAN))
- return true;
- return false;
- }
-
- private boolean jj_3R_176() {
- if (jj_scan_token(FUNCTION))
- return true;
- return false;
- }
-
- private boolean jj_3R_175() {
- if (jj_scan_token(COLON))
- return true;
- return false;
- }
-
- private boolean jj_3R_174() {
- if (jj_scan_token(EACH_VAR))
- return true;
- return false;
- }
-
- private boolean jj_3R_173() {
- if (jj_scan_token(NUMBER))
- return true;
- return false;
- }
-
- private boolean jj_3_7() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_141())
- jj_scanpos = xsp;
- if (jj_3R_142())
- return true;
- return false;
- }
-
- private boolean jj_3R_159() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_172()) {
- jj_scanpos = xsp;
- if (jj_3R_173()) {
- jj_scanpos = xsp;
- if (jj_3R_174()) {
- jj_scanpos = xsp;
- if (jj_3R_175()) {
- jj_scanpos = xsp;
- if (jj_3R_176()) {
- jj_scanpos = xsp;
- if (jj_3R_177()) {
- jj_scanpos = xsp;
- if (jj_3R_178()) {
- jj_scanpos = xsp;
- if (jj_3R_179()) {
- jj_scanpos = xsp;
- if (jj_3R_180())
- return true;
- }
- }
- }
+ buf.append((char) numValue);
+ break;
+ case '\u005cn':
+ case '\u005cf':
+ break;
+ case '\u005cr':
+ if (index + 1 < len) {
+ if (s.charAt(index + 1) == '\u005cn') {
+ index ++;
}
}
+ break;
+ default:
+ buf.append(c);
}
+ } else {
+ throw new CSSParseException("invalid string " + s, getLocator());
}
+ } else {
+ buf.append(c);
}
- return false;
- }
-
- private boolean jj_3R_172() {
- if (jj_scan_token(IDENT))
- return true;
- return false;
- }
-
- private boolean jj_3R_204() {
- if (jj_scan_token(DIMEN))
- return true;
- return false;
- }
-
- private boolean jj_3R_203() {
- if (jj_scan_token(KHZ))
- return true;
- return false;
- }
-
- private boolean jj_3R_163() {
- if (jj_scan_token(DOT))
- return true;
- return false;
- }
-
- private boolean jj_3R_136() {
- if (jj_3R_144())
- return true;
- return false;
- }
-
- private boolean jj_3R_202() {
- if (jj_scan_token(HZ))
- return true;
- return false;
- }
-
- private boolean jj_3R_144() {
- if (jj_scan_token(MICROSOFT_RULE))
- return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) {
- jj_scanpos = xsp;
- break;
- }
- }
- if (jj_scan_token(COLON))
- return true;
- if (jj_3R_159())
- return true;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_159()) {
- jj_scanpos = xsp;
- break;
- }
- }
- return false;
- }
-
- private boolean jj_3R_182() {
- if (jj_scan_token(PRECEDES))
- return true;
- return false;
- }
-
- private boolean jj_3_6() {
- if (jj_3R_140())
- return true;
- return false;
- }
-
- private boolean jj_3R_201() {
- if (jj_scan_token(MS))
- return true;
- return false;
- }
-
- private boolean jj_3R_181() {
- if (jj_scan_token(PLUS))
- return true;
- return false;
- }
-
- private boolean jj_3R_200() {
- if (jj_scan_token(SECOND))
- return true;
- return false;
- }
-
- private boolean jj_3R_160() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_181()) {
- jj_scanpos = xsp;
- if (jj_3R_182())
- return true;
- }
- return false;
- }
-
- private boolean jj_3R_199() {
- if (jj_scan_token(GRAD))
- return true;
- return false;
- }
-
- private boolean jj_3R_146() {
- if (jj_scan_token(PRECEDES))
- return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) {
- jj_scanpos = xsp;
- break;
- }
- }
- return false;
+ index++;
}
- private boolean jj_3R_198() {
- if (jj_scan_token(RAD))
- return true;
- return false;
- }
+ return buf.toString();
+ }
- private boolean jj_3R_147() {
- if (jj_scan_token(S))
- return true;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_160())
- jj_scanpos = xsp;
- return false;
- }
+ String convertIdent(String s) throws ParseException {
+ return convertStringIndex(s, 0, s.length());
+ }
- private boolean jj_3R_145() {
- if (jj_scan_token(PLUS))
- return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(1)) {
- jj_scanpos = xsp;
- break;
- }
- }
- return false;
- }
-
- private boolean jj_3R_138() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_145()) {
- jj_scanpos = xsp;
- if (jj_3R_146()) {
- jj_scanpos = xsp;
- if (jj_3R_147())
- return true;
- }
- }
- return false;
- }
+ String convertString(String s) throws ParseException {
+ return convertStringIndex(s, 0, s.length());
+ }
- private boolean jj_3_1() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_136()) {
- jj_scanpos = xsp;
- if (jj_3R_137())
- return true;
+ void comments() throws ParseException {
+ if (token.specialToken != null){
+ Token tmp_t = token.specialToken;
+ while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken;
+ while (tmp_t != null) {
+ documentHandler.comment(tmp_t.image);
+ tmp_t = tmp_t.next;
}
- return false;
- }
-
- private boolean jj_3R_155() {
- if (jj_scan_token(LBRACE))
- return true;
- return false;
- }
-
- private boolean jj_3R_197() {
- if (jj_scan_token(DEG))
- return true;
- return false;
- }
-
- private boolean jj_3R_196() {
- if (jj_scan_token(EXS))
- return true;
- return false;
- }
-
- private boolean jj_3R_195() {
- if (jj_scan_token(EMS))
- return true;
- return false;
- }
-
- private boolean jj_3R_194() {
- if (jj_scan_token(PX))
- return true;
- return false;
- }
-
- private boolean jj_3R_193() {
- if (jj_scan_token(IN))
- return true;
- return false;
- }
-
- private boolean jj_3R_154() {
- if (jj_3R_166())
- return true;
- return false;
- }
-
- private boolean jj_3R_192() {
- if (jj_scan_token(PC))
- return true;
- return false;
- }
-
- private boolean jj_3_5() {
- if (jj_3R_140())
- return true;
- return false;
}
+ }
- private boolean jj_3R_191() {
- if (jj_scan_token(MM))
- return true;
- return false;
- }
+ void rejectToken(Token t) throws ParseException {
+ Token fakeToken = new Token();
+ t.next = token;
+ fakeToken.next = t;
+ token = fakeToken;
+ }
- private boolean jj_3R_152() {
- if (jj_3R_165())
- return true;
- return false;
- }
+ String skipAfterExpression() throws ParseException {
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
- private boolean jj_3R_151() {
- if (jj_3R_164())
- return true;
- return false;
+ while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
}
- private boolean jj_3R_190() {
- if (jj_scan_token(CM))
- return true;
- return false;
- }
+ return s.toString();
+ }
- private boolean jj_3R_140() {
- if (jj_3R_153())
- 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_154()) {
- jj_scanpos = xsp;
- if (jj_3R_155())
- return true;
- }
- return false;
- }
-
- private boolean jj_3R_150() {
- if (jj_3R_163())
- return true;
- return false;
- }
-
- private boolean jj_3R_189() {
- if (jj_scan_token(PT))
- return true;
- return false;
- }
-
- private boolean jj_3R_149() {
- if (jj_3R_162())
- return true;
- return false;
- }
-
- private boolean jj_3R_188() {
- if (jj_scan_token(PERCENTAGE))
- return true;
- return false;
- }
-
- private boolean jj_3R_186() {
- if (jj_3R_212())
- return true;
- return false;
- }
-
- private boolean jj_3R_148() {
- if (jj_3R_161())
- return true;
- return false;
- }
-
- private boolean jj_3R_187() {
- if (jj_scan_token(NUMBER))
- return true;
- return false;
- }
-
- /** Generated Token Manager. */
- public ParserTokenManager token_source;
- /** Current token. */
- public Token token;
- /** Next token. */
- public Token jj_nt;
- private int jj_ntk;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
- private int jj_gen;
- final private int[] jj_la1 = new int[203];
- static private int[] jj_la1_0;
- static private int[] jj_la1_1;
- static private int[] jj_la1_2;
- static private int[] jj_la1_3;
- static {
- jj_la1_init_0();
- jj_la1_init_1();
- jj_la1_init_2();
- jj_la1_init_3();
- }
-
- private static void jj_la1_init_0() {
- jj_la1_0 = new int[] { 0x0, 0xc02, 0xc02, 0x0, 0xc00, 0x2, 0x2, 0x2,
- 0x1d000000, 0xc00, 0x2, 0xc00, 0x2, 0x0, 0x2, 0x0, 0x2, 0x2,
- 0x2, 0x1d3ed400, 0x1d3ed400, 0x2, 0x80000, 0x2, 0x2, 0x2, 0x2,
- 0x0, 0x0, 0x2, 0x0, 0x100000, 0x2, 0x0, 0x2, 0x2, 0x2, 0x2,
- 0x0, 0x100000, 0x2, 0x0, 0x2, 0x3ed400, 0x2, 0x2, 0x220000,
- 0x2, 0x220000, 0x220002, 0x2, 0x50010002, 0x50010002, 0x2, 0x2,
- 0x2, 0x2, 0x2, 0x1d000000, 0x0, 0x0, 0x1d000000, 0x2, 0x80000,
- 0x2, 0x2, 0x11000000, 0x11000000, 0x11000000, 0x11000000,
- 0x11000000, 0x11000000, 0x11000000, 0x11000000, 0x11000000,
- 0x11000000, 0x1d000000, 0x0, 0x0, 0x0, 0x0, 0xc000000, 0x2,
- 0x2, 0x1c000, 0x2, 0x0, 0x2, 0x1c000, 0x0, 0x2, 0x2, 0x0, 0x2,
- 0x0, 0x2, 0x100000, 0xe4e70002, 0x2, 0x1d000000, 0x0,
- 0x1d000000, 0x2, 0x0, 0x2, 0xe4e70002, 0x0, 0x2, 0x1d000000,
- 0x0, 0x1d000000, 0x2, 0xe4e70002, 0x2, 0x2, 0x2, 0x0, 0x2,
- 0x1d000000, 0x0, 0x1d000000, 0x2, 0x2, 0x80000, 0x2, 0x2, 0x2,
- 0x2, 0x0, 0x2, 0x1d000000, 0x0, 0x1d000000, 0x2, 0x80000, 0x2,
- 0x2, 0x2, 0x80000, 0x0, 0x60000, 0x80000, 0x2, 0x60000, 0x2,
- 0x0, 0x2, 0x100000, 0x2, 0x2, 0x2, 0x2, 0x80000, 0x2, 0x2, 0x0,
- 0x2, 0x2, 0x2, 0x100000, 0x2, 0x2, 0x0, 0x100000, 0x2, 0x0,
- 0x2, 0x2, 0x0, 0x2, 0x0, 0x100000, 0x2, 0x0, 0x2, 0x61000, 0x2,
- 0x0, 0x2, 0x2, 0x2, 0x2, 0x880000, 0x880000, 0x60000, 0x60000,
- 0x0, 0x0, 0x60000, 0x2, 0x60000, 0x2, 0x60000, 0x2, 0x1d000000,
- 0x2, 0x2, 0x2, 0x0, 0x100000, 0x2, 0x0, 0x2, };
- }
-
- private static void jj_la1_init_1() {
- jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x1060018, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x38, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x95040018, 0x80000000, 0x15040000, 0x18, 0x0,
- 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
- 0x8, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7,
- 0x0, 0x10040018, 0x10040000, 0x18, 0x0, 0x8000000, 0x0, 0x7,
- 0x0, 0x0, 0x10040018, 0x10040000, 0x18, 0x0, 0x7, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x10040018, 0x10040000, 0x18, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11040018, 0x11040000, 0x18,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000, 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, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
- }
-
- private static void jj_la1_init_2() {
- jj_la1_2 = new int[] { 0x10000000, 0x80000000, 0x80000000, 0x4000000,
- 0x80000000, 0x0, 0x0, 0x0, 0x6a000088, 0x80000000, 0x0,
- 0x80000000, 0x0, 0x44, 0x0, 0x8, 0x0, 0x0, 0x0, 0xfe00015c,
- 0xfe00015c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x8,
- 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x8, 0x0,
- 0xfc000154, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0xa000088, 0x8, 0x8000080, 0x2000008, 0x0,
- 0x0, 0x0, 0x0, 0x2000000, 0x2000000, 0x0, 0x0, 0x2000000,
- 0x2000000, 0x2000000, 0x2000000, 0x2000000, 0x2000000,
- 0x2000008, 0x8, 0x8, 0x8, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xc,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x2, 0x0, 0x0, 0x98, 0x0,
- 0xa000088, 0x8000080, 0x2000008, 0x0, 0x0, 0x0, 0x98, 0x1, 0x0,
- 0xa000088, 0x8000080, 0x2000008, 0x0, 0x98, 0x0, 0x0, 0x0,
- 0x88, 0x0, 0xa000088, 0x8000080, 0x2000008, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x8, 0x0, 0xa000088, 0x8000080, 0x2000008, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ffffdc, 0x0, 0x0, 0x3ffffdc,
- 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x8, 0x0, 0x0,
- 0x0, 0x0, 0x8, 0x0, 0x0, 0x8, 0x0, 0x3ffffdc, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ffff10, 0x200004c,
- 0x3ffff5c, 0x0, 0x3ffffdc, 0x0, 0x3ffffdc, 0x0, 0x6e000008,
- 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x8, 0x0, };
- }
-
- private static void jj_la1_init_3() {
- jj_la1_3 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x800,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3401,
- 0x3401, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3401,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000, 0x1000, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x800, 0x0, 0x800, 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, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x800, 0x0, 0x800, 0x800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x1400, 0x0, 0x0, 0x1400, 0x0, 0x1000, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x1400, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x1000, 0x400, 0x1400, 0x0, 0x1400, 0x0, 0x1400, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
- }
-
- final private JJCalls[] jj_2_rtns = new JJCalls[8];
- 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 < 203; 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 < 203; 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 < 203; 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 < 203; i++)
- jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++)
- jj_2_rtns[i] = new JJCalls();
- }
-
- private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null)
- token = token.next;
- else
- token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- if (++jj_gc > 100) {
- jj_gc = 0;
- for (int i = 0; i < jj_2_rtns.length; i++) {
- JJCalls c = jj_2_rtns[i];
- while (c != null) {
- if (c.gen < jj_gen)
- c.first = null;
- c = c.next;
- }
- }
- }
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
- static private final class LookaheadSuccess extends java.lang.Error {
- }
-
- final private LookaheadSuccess jj_ls = new LookaheadSuccess();
-
- private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source
- .getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- if (jj_rescan) {
- int i = 0;
- Token tok = token;
- while (tok != null && tok != jj_scanpos) {
- i++;
- tok = tok.next;
- }
- if (tok != null)
- jj_add_error_token(kind, i);
- }
- if (jj_scanpos.kind != kind)
- return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos)
- throw jj_ls;
- return false;
- }
-
- /** Get the next Token. */
- final public Token getNextToken() {
- if (token.next != null)
- token = token.next;
- else
- token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
- /** Get the specific Token. */
- final public Token getToken(int index) {
- Token t = token;
- for (int i = 0; i < index; i++) {
- if (t.next != null)
- t = t.next;
- else
- t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- private int jj_ntk() {
- if ((jj_nt = token.next) == null)
- return (jj_ntk = (token.next = token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
- private int[] jj_expentry;
- private int jj_kind = -1;
- private int[] jj_lasttokens = new int[100];
- private int jj_endpos;
-
- private void jj_add_error_token(int kind, int pos) {
- if (pos >= 100)
- return;
- if (pos == jj_endpos + 1) {
- jj_lasttokens[jj_endpos++] = kind;
- } else if (jj_endpos != 0) {
- jj_expentry = new int[jj_endpos];
- for (int i = 0; i < jj_endpos; i++) {
- jj_expentry[i] = jj_lasttokens[i];
- }
- jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries
- .iterator(); it.hasNext();) {
- int[] oldentry = (int[]) (it.next());
- if (oldentry.length == jj_expentry.length) {
- for (int i = 0; i < jj_expentry.length; i++) {
- if (oldentry[i] != jj_expentry[i]) {
- continue jj_entries_loop;
- }
- }
- jj_expentries.add(jj_expentry);
- break jj_entries_loop;
- }
- }
- if (pos != 0)
- jj_lasttokens[(jj_endpos = pos) - 1] = kind;
- }
- }
-
- /** Generate ParseException. */
- public ParseException generateParseException() {
- jj_expentries.clear();
- boolean[] la1tokens = new boolean[110];
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 203; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1 << j)) != 0) {
- la1tokens[j] = true;
- }
- if ((jj_la1_1[i] & (1 << j)) != 0) {
- la1tokens[32 + j] = true;
- }
- if ((jj_la1_2[i] & (1 << j)) != 0) {
- la1tokens[64 + j] = true;
+/**
+ * The following functions are useful for a DOM CSS implementation only and are
+ * not part of the general CSS2 parser.
+ */
+ final public void _parseRule() throws ParseException {
+ String ret = null;
+ label_129:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[193] = jj_gen;
+ break label_129;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORT_SYM:
+ importDeclaration();
+ break;
+ case LBRACKET:
+ case ANY:
+ case PARENT:
+ case DOT:
+ case COLON:
+ case INTERPOLATION:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[194] = jj_gen;
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
}
- if ((jj_la1_3[i] & (1 << j)) != 0) {
- la1tokens[96 + j] = true;
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ } else {
+ {if (true) throw new CSSParseException("unrecognize rule: " + ret,
+ getLocator());}
}
- }
- }
- }
- for (int i = 0; i < 110; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.add(jj_expentry);
- }
- }
- jj_endpos = 0;
- jj_rescan_token();
- jj_add_error_token(0, 0);
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = jj_expentries.get(i);
- }
- return new ParseException(token, exptokseq, tokenImage);
}
+ }
+
+ final public void _parseImportRule() throws ParseException {
+ label_130:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[195] = jj_gen;
+ break label_130;
+ }
+ jj_consume_token(S);
+ }
+ importDeclaration();
+ }
+
+ final public void _parseMediaRule() throws ParseException {
+ label_131:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[196] = jj_gen;
+ break label_131;
+ }
+ jj_consume_token(S);
+ }
+ media();
+ }
+
+ final public void _parseDeclarationBlock() throws ParseException {
+ 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);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[198] = jj_gen;
+ ;
+ }
+ label_133:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[199] = jj_gen;
+ break label_133;
+ }
+ jj_consume_token(SEMICOLON);
+ label_134:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[200] = jj_gen;
+ break label_134;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[201] = jj_gen;
+ ;
+ }
+ }
+ }
+
+ final public ArrayList<String> _parseSelectors() throws ParseException {
+ ArrayList<String> p = null;
+ try {
+ label_135:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[202] = jj_gen;
+ break label_135;
+ }
+ 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_3R_139() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_148()) {
+ jj_scanpos = xsp;
+ if (jj_3R_149()) {
+ jj_scanpos = xsp;
+ if (jj_3R_150()) {
+ jj_scanpos = xsp;
+ if (jj_3R_151()) {
+ jj_scanpos = xsp;
+ if (jj_3R_152()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_167() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_186()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_187()) {
+ jj_scanpos = xsp;
+ if (jj_3R_188()) {
+ jj_scanpos = xsp;
+ if (jj_3R_189()) {
+ jj_scanpos = xsp;
+ if (jj_3R_190()) {
+ jj_scanpos = xsp;
+ if (jj_3R_191()) {
+ jj_scanpos = xsp;
+ if (jj_3R_192()) {
+ jj_scanpos = xsp;
+ if (jj_3R_193()) {
+ jj_scanpos = xsp;
+ if (jj_3R_194()) {
+ jj_scanpos = xsp;
+ if (jj_3R_195()) {
+ jj_scanpos = xsp;
+ if (jj_3R_196()) {
+ jj_scanpos = xsp;
+ if (jj_3R_197()) {
+ jj_scanpos = xsp;
+ if (jj_3R_198()) {
+ jj_scanpos = xsp;
+ if (jj_3R_199()) {
+ jj_scanpos = xsp;
+ if (jj_3R_200()) {
+ jj_scanpos = xsp;
+ if (jj_3R_201()) {
+ jj_scanpos = xsp;
+ if (jj_3R_202()) {
+ jj_scanpos = xsp;
+ if (jj_3R_203()) {
+ jj_scanpos = xsp;
+ if (jj_3R_204()) {
+ jj_scanpos = xsp;
+ if (jj_3R_205()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_156() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_167()) {
+ jj_scanpos = xsp;
+ if (jj_3R_168()) return true;
+ }
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_142() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_156()) {
+ jj_scanpos = xsp;
+ if (jj_3R_157()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_143() {
+ if (jj_3R_158()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_162() {
+ if (jj_scan_token(HASH)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_214() {
+ if (jj_scan_token(HASH)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_220() {
+ if (jj_scan_token(PLUS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_219() {
+ if (jj_scan_token(MINUS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_212() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_219()) {
+ jj_scanpos = xsp;
+ if (jj_3R_220()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_8() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_143()) jj_scanpos = xsp;
+ if (jj_3R_142()) return true;
+ return false;
+ }
- /** Enable tracing. */
- final public void enable_tracing() {
- }
+ private boolean jj_3R_215() {
+ if (jj_scan_token(URL)) return true;
+ return false;
+ }
- /** Disable tracing. */
- final public void disable_tracing() {
- }
+ private boolean jj_3R_166() {
+ if (jj_3R_142()) return true;
+ return false;
+ }
- private void jj_rescan_token() {
- jj_rescan = true;
- for (int i = 0; i < 8; i++) {
- try {
- JJCalls p = jj_2_rtns[i];
- do {
- if (p.gen > jj_gen) {
- jj_la = p.arg;
- jj_lastpos = jj_scanpos = p.first;
- switch (i) {
- case 0:
- jj_3_1();
- break;
- case 1:
- jj_3_2();
- break;
- case 2:
- jj_3_3();
- break;
- case 3:
- jj_3_4();
- break;
- case 4:
- jj_3_5();
- break;
- case 5:
- jj_3_6();
- break;
- case 6:
- jj_3_7();
- break;
- case 7:
- jj_3_8();
- break;
- }
- }
- p = p.next;
- } while (p != null);
- } catch (LookaheadSuccess ls) {
- }
- }
- jj_rescan = false;
- }
+ private boolean jj_3_2() {
+ if (jj_3R_138()) return true;
+ if (jj_3R_139()) return true;
+ return 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;
- }
+ private boolean jj_3R_171() {
+ 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_158() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_170()) {
+ jj_scanpos = xsp;
+ if (jj_3R_171()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_170() {
+ 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_216() {
+ if (jj_scan_token(UNICODERANGE)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_164() {
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ private boolean jj_3_4() {
+ if (jj_3R_140()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_221() {
+ if (jj_3R_166()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_213() {
+ 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_221()) jj_scanpos = xsp;
+ if (jj_scan_token(RPARAN)) return true;
+ return false;
+ }
+
+ private boolean jj_3_3() {
+ if (jj_3R_140()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_157() {
+ if (jj_3R_169()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_210() {
+ if (jj_3R_216()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_209() {
+ if (jj_3R_215()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_208() {
+ if (jj_3R_214()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_218() {
+ if (jj_scan_token(INTERPOLATION)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_165() {
+ if (jj_scan_token(LBRACKET)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_153() {
+ if (jj_scan_token(IDENT)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_169() {
+ 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_185() {
+ if (jj_scan_token(PARENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_184() {
+ if (jj_scan_token(ANY)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_207() {
+ if (jj_scan_token(IDENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_217() {
+ if (jj_scan_token(IDENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_211() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_217()) {
+ jj_scanpos = xsp;
+ if (jj_3R_218()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_137() {
+ if (jj_3R_140()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_141() {
+ 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_161() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_183()) {
+ jj_scanpos = xsp;
+ if (jj_3R_184()) {
+ jj_scanpos = xsp;
+ if (jj_3R_185()) return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_183() {
+ 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_206() {
+ if (jj_scan_token(STRING)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_205() {
+ if (jj_3R_213()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_180() {
+ if (jj_scan_token(S)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_179() {
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_168() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_206()) {
+ jj_scanpos = xsp;
+ if (jj_3R_207()) {
+ jj_scanpos = xsp;
+ if (jj_3R_208()) {
+ jj_scanpos = xsp;
+ if (jj_3R_209()) {
+ jj_scanpos = xsp;
+ if (jj_3R_210()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_178() {
+ if (jj_scan_token(EQ)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_177() {
+ if (jj_scan_token(RPARAN)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_176() {
+ if (jj_scan_token(FUNCTION)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_175() {
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_174() {
+ if (jj_scan_token(INTERPOLATION)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_173() {
+ if (jj_scan_token(NUMBER)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_159() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_172()) {
+ jj_scanpos = xsp;
+ if (jj_3R_173()) {
+ jj_scanpos = xsp;
+ if (jj_3R_174()) {
+ jj_scanpos = xsp;
+ if (jj_3R_175()) {
+ jj_scanpos = xsp;
+ if (jj_3R_176()) {
+ jj_scanpos = xsp;
+ if (jj_3R_177()) {
+ jj_scanpos = xsp;
+ if (jj_3R_178()) {
+ jj_scanpos = xsp;
+ if (jj_3R_179()) {
+ jj_scanpos = xsp;
+ if (jj_3R_180()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_172() {
+ if (jj_scan_token(IDENT)) return true;
+ return false;
+ }
+
+ private boolean jj_3_7() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_141()) jj_scanpos = xsp;
+ if (jj_3R_142()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_204() {
+ if (jj_scan_token(DIMEN)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_203() {
+ if (jj_scan_token(KHZ)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_163() {
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_136() {
+ if (jj_3R_144()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_202() {
+ if (jj_scan_token(HZ)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_144() {
+ if (jj_scan_token(MICROSOFT_RULE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ if (jj_scan_token(COLON)) return true;
+ if (jj_3R_159()) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_159()) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_182() {
+ if (jj_scan_token(PRECEDES)) return true;
+ return false;
+ }
+
+ private boolean jj_3_6() {
+ if (jj_3R_140()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_201() {
+ if (jj_scan_token(MS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_181() {
+ if (jj_scan_token(PLUS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_200() {
+ if (jj_scan_token(SECOND)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_160() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_181()) {
+ jj_scanpos = xsp;
+ if (jj_3R_182()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_199() {
+ if (jj_scan_token(GRAD)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_146() {
+ if (jj_scan_token(PRECEDES)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_198() {
+ if (jj_scan_token(RAD)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_147() {
+ if (jj_scan_token(S)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_160()) jj_scanpos = xsp;
+ return false;
+ }
+
+ private boolean jj_3R_145() {
+ if (jj_scan_token(PLUS)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_138() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_145()) {
+ jj_scanpos = xsp;
+ if (jj_3R_146()) {
+ jj_scanpos = xsp;
+ if (jj_3R_147()) return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_1() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_136()) {
+ jj_scanpos = xsp;
+ if (jj_3R_137()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_155() {
+ if (jj_scan_token(LBRACE)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_197() {
+ if (jj_scan_token(DEG)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_196() {
+ if (jj_scan_token(EXS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_195() {
+ if (jj_scan_token(EMS)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_194() {
+ if (jj_scan_token(PX)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_193() {
+ if (jj_scan_token(IN)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_154() {
+ if (jj_3R_166()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_192() {
+ if (jj_scan_token(PC)) return true;
+ return false;
+ }
+
+ private boolean jj_3_5() {
+ if (jj_3R_140()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_191() {
+ if (jj_scan_token(MM)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_152() {
+ if (jj_3R_165()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_151() {
+ if (jj_3R_164()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_190() {
+ if (jj_scan_token(CM)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_140() {
+ if (jj_3R_153()) 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_154()) {
+ jj_scanpos = xsp;
+ if (jj_3R_155()) return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_150() {
+ if (jj_3R_163()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_189() {
+ if (jj_scan_token(PT)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_149() {
+ if (jj_3R_162()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_188() {
+ if (jj_scan_token(PERCENTAGE)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_186() {
+ if (jj_3R_212()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_148() {
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_187() {
+ if (jj_scan_token(NUMBER)) return true;
+ return false;
+ }
+
+ /** Generated Token Manager. */
+ public ParserTokenManager token_source;
+ /** Current token. */
+ public Token token;
+ /** Next token. */
+ public Token jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[203];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static private int[] jj_la1_2;
+ static private int[] jj_la1_3;
+ static {
+ jj_la1_init_0();
+ jj_la1_init_1();
+ jj_la1_init_2();
+ jj_la1_init_3();
+ }
+ private static void jj_la1_init_0() {
+ jj_la1_0 = new int[] {0x0,0xc02,0xc02,0x0,0xc00,0x2,0x2,0x2,0x1d000000,0xc00,0x2,0xc00,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x1d3ed400,0x1d3ed400,0x2,0x80000,0x2,0x2,0x2,0x2,0x0,0x0,0x2,0x0,0x100000,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x100000,0x2,0x0,0x2,0x3ed400,0x2,0x2,0x220000,0x2,0x220000,0x220002,0x2,0x50010002,0x50010002,0x2,0x2,0x2,0x2,0x2,0x1d000000,0x0,0x0,0x1d000000,0x2,0x80000,0x2,0x2,0x11000000,0x11000000,0x11000000,0x11000000,0x11000000,0x11000000,0x11000000,0x11000000,0x11000000,0x11000000,0x1d000000,0x0,0x0,0x0,0x0,0xc000000,0x2,0x2,0x1c000,0x2,0x0,0x2,0x1c000,0x0,0x2,0x2,0x0,0x2,0x0,0x2,0x100000,0xe4e70002,0x2,0x1d000000,0x0,0x1d000000,0x2,0x0,0x2,0xe4e70002,0x0,0x2,0x1d000000,0x0,0x1d000000,0x2,0xe4e70002,0x2,0x2,0x2,0x0,0x2,0x1d000000,0x0,0x1d000000,0x2,0x2,0x80000,0x2,0x2,0x2,0x2,0x0,0x2,0x1d000000,0x0,0x1d000000,0x2,0x80000,0x2,0x2,0x2,0x80000,0x0,0x60000,0x80000,0x2,0x60000,0x2,0x0,0x2,0x100000,0x2,0x2,0x2,0x2,0x80000,0x2,0x2,0x0,0x2,0x2,0x2,0x100000,0x2,0x2,0x0,0x100000,0x2,0x0,0x2,0x2,0x0,0x2,0x0,0x100000,0x2,0x0,0x2,0x61000,0x2,0x0,0x2,0x2,0x2,0x2,0x880000,0x880000,0x60000,0x60000,0x0,0x0,0x60000,0x2,0x60000,0x2,0x60000,0x2,0x1d000000,0x2,0x2,0x2,0x0,0x100000,0x2,0x0,0x2,};
+ }
+ private static void jj_la1_init_1() {
+ jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1060018,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x38,0x38,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18,0x18,0x0,0x0,0x0,0x0,0x0,0x95040018,0x80000000,0x15040000,0x18,0x0,0x0,0x0,0x0,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x18,0x10,0x10,0x10,0x10,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x0,0x10040018,0x10040000,0x18,0x0,0x8000000,0x0,0x7,0x0,0x0,0x10040018,0x10040000,0x18,0x0,0x7,0x0,0x0,0x0,0x0,0x0,0x10040018,0x10040000,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11040018,0x11040000,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc000,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,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ }
+ private static void jj_la1_init_2() {
+ jj_la1_2 = new int[] {0x10000000,0x80000000,0x80000000,0x4000000,0x80000000,0x0,0x0,0x0,0x6a000088,0x80000000,0x0,0x80000000,0x0,0x44,0x0,0x8,0x0,0x0,0x0,0xfe00015c,0xfe00015c,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0xfc000154,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18,0x18,0x0,0x0,0x0,0x0,0x0,0xa000088,0x8,0x8000080,0x2000008,0x0,0x0,0x0,0x0,0x2000000,0x2000000,0x0,0x0,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000008,0x8,0x8,0x8,0x8,0x8,0x0,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x2,0x0,0x0,0x98,0x0,0xa000088,0x8000080,0x2000008,0x0,0x0,0x0,0x98,0x1,0x0,0xa000088,0x8000080,0x2000008,0x0,0x98,0x0,0x0,0x0,0x88,0x0,0xa000088,0x8000080,0x2000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0xa000088,0x8000080,0x2000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3ffffdc,0x0,0x0,0x3ffffdc,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x3ffffdc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1ffff10,0x200004c,0x3ffff5c,0x0,0x3ffffdc,0x0,0x3ffffdc,0x0,0x6e000008,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,};
+ }
+ private static void jj_la1_init_3() {
+ jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3401,0x3401,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3401,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x1000,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x800,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,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x800,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1400,0x0,0x0,0x1400,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1400,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x400,0x1400,0x0,0x1400,0x0,0x1400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ }
+ final private JJCalls[] jj_2_rtns = new JJCalls[8];
+ 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 < 203; 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 < 203; 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 < 203; 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 < 203; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ static private final class LookaheadSuccess extends java.lang.Error { }
+ final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+ private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ if (jj_scanpos.kind != kind) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+ return false;
+ }
+
+
+/** Get the next Token. */
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+/** Get the specific Token. */
+ final public Token getToken(int index) {
+ Token t = token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
+ int[] oldentry = (int[])(it.next());
+ if (oldentry.length == jj_expentry.length) {
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ continue jj_entries_loop;
+ }
+ }
+ jj_expentries.add(jj_expentry);
+ break jj_entries_loop;
+ }
+ }
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ /** Generate ParseException. */
+ public ParseException generateParseException() {
+ jj_expentries.clear();
+ boolean[] la1tokens = new boolean[110];
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 203; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ if ((jj_la1_2[i] & (1<<j)) != 0) {
+ la1tokens[64+j] = true;
+ }
+ if ((jj_la1_3[i] & (1<<j)) != 0) {
+ la1tokens[96+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 110; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.add(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = jj_expentries.get(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ /** Enable tracing. */
+ final public void enable_tracing() {
+ }
+
+ /** Disable tracing. */
+ final public void disable_tracing() {
+ }
+
+ private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 8; i++) {
+ try {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ case 1: jj_3_2(); break;
+ case 2: jj_3_3(); break;
+ case 3: jj_3_4(); break;
+ case 4: jj_3_5(); break;
+ case 5: jj_3_6(); break;
+ case 6: jj_3_7(); break;
+ case 7: jj_3_8(); break;
+ }
+ }
+ 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/parser/Parser.jj b/theme-compiler/src/com/vaadin/sass/parser/Parser.jj
index 52f9535213..97031e4616 100644
--- a/theme-compiler/src/com/vaadin/sass/parser/Parser.jj
+++ b/theme-compiler/src/com/vaadin/sass/parser/Parser.jj
@@ -522,7 +522,7 @@ TOKEN :
< DEFAULT >
TOKEN :
{
- < EACH_VAR : "#{"< VARIABLE > "}">
+ < INTERPOLATION : "#{"< VARIABLE > "}">
}
<DEFAULT>
@@ -999,7 +999,7 @@ void microsoftExtension() :
< COLON >
((n = < IDENT > { value += n.image; })
| (n = < NUMBER > { value += n.image; })
- | (n = < EACH_VAR > { value += n.image; })
+ | (n = < INTERPOLATION > { value += n.image; })
| (n = < COLON > { value += n.image; })
| (n = < FUNCTION > { value += n.image; })
| (n = < RPARAN > { value += n.image; })
@@ -1188,7 +1188,7 @@ String _class(String pred) :
String s = ".";
}
{
- "." (t = <IDENT>{s += t.image; }|t = < EACH_VAR >{ s += t.image; })+
+ "." (t = <IDENT>{s += t.image; }|t = < INTERPOLATION >{ s += t.image; })+
{
if (pred == null) {
@@ -1205,7 +1205,7 @@ String s = ".";
String element_name() :
{Token t; String s = "";}
{
- (t = <IDENT>{s += t.image; }|t = < EACH_VAR >{ s += t.image; })+
+ (t = <IDENT>{s += t.image; }|t = < INTERPOLATION >{ s += t.image; })+
{
return s;
}
@@ -1483,7 +1483,6 @@ void mixinDirective() :
args = arglist()) <RPARAN> (<S>)*) <LBRACE> (<S>)*
{documentHandler.startMixinDirective(name, args);}
( includeDirective() | media() | eachDirective() | extendDirective()| variable() | LOOKAHEAD(3) declarationOrNestedProperties() | styleRule())*
- //(includeDirective() | media() | LOOKAHEAD(declaration()) declaration()";"(<S>)* | styleRule())*
<RBRACE>(<S>)*
{documentHandler.endMixinDirective(name, args);}
}
diff --git a/theme-compiler/src/com/vaadin/sass/parser/ParserConstants.java b/theme-compiler/src/com/vaadin/sass/parser/ParserConstants.java
index c7d6042d03..e1585102a4 100644
--- a/theme-compiler/src/com/vaadin/sass/parser/ParserConstants.java
+++ b/theme-compiler/src/com/vaadin/sass/parser/ParserConstants.java
@@ -69,7 +69,7 @@ public interface ParserConstants {
/** RegularExpression Id. */
int COLON = 35;
/** RegularExpression Id. */
- int EACH_VAR = 36;
+ int INTERPOLATION = 36;
/** RegularExpression Id. */
int NONASCII = 37;
/** RegularExpression Id. */
@@ -264,7 +264,7 @@ public interface ParserConstants {
"\"&&\"",
"\"!=\"",
"\":\"",
- "<EACH_VAR>",
+ "<INTERPOLATION>",
"<NONASCII>",
"<H>",
"<UNICODE>",
diff --git a/theme-compiler/src/com/vaadin/sass/tree/BlockNode.java b/theme-compiler/src/com/vaadin/sass/tree/BlockNode.java
index bd240324ba..3c87d3db82 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/BlockNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/BlockNode.java
@@ -18,7 +18,7 @@ package com.vaadin.sass.tree;
import java.util.ArrayList;
-public class BlockNode extends Node implements IVariableNode {
+public class BlockNode extends Node implements IVariableNode, InterpolationNode {
private static final long serialVersionUID = 5742962631468325048L;
@@ -66,6 +66,21 @@ public class BlockNode extends Node implements IVariableNode {
@Override
public void replaceVariables(ArrayList<VariableNode> variables) {
+ if (selectorList == null || selectorList.isEmpty()) {
+ return;
+ }
+
+ for (final VariableNode var : variables) {
+ for (final String selector : new ArrayList<String>(selectorList)) {
+ String interpolation = "#{$" + var.getName() + "}";
+ if (selector.contains(interpolation)) {
+ String replace = selector.replace(interpolation, var
+ .getExpr().toString());
+ selectorList.add(selectorList.indexOf(selector), replace);
+ selectorList.remove(selector);
+ }
+ }
+ }
}
public String getSelectors() {
@@ -77,4 +92,25 @@ public class BlockNode extends Node implements IVariableNode {
return b.toString();
}
+ @Override
+ public void replaceInterpolation(String variableName, String variable) {
+ if (selectorList == null || selectorList.isEmpty()) {
+ return;
+ }
+
+ for (final String selector : new ArrayList<String>(selectorList)) {
+ String interpolation = "#{" + variableName + "}";
+ if (selector.contains(interpolation)) {
+ String replace = selector.replace(interpolation, variable);
+ selectorList.add(selectorList.indexOf(selector), replace);
+ selectorList.remove(selector);
+ }
+ }
+ }
+
+ @Override
+ public boolean containsInterpolationVariable(String variable) {
+ return getSelectors().contains(variable);
+ }
+
}
diff --git a/theme-compiler/src/com/vaadin/sass/tree/InterpolationNode.java b/theme-compiler/src/com/vaadin/sass/tree/InterpolationNode.java
new file mode 100644
index 0000000000..c998b60b52
--- /dev/null
+++ b/theme-compiler/src/com/vaadin/sass/tree/InterpolationNode.java
@@ -0,0 +1,7 @@
+package com.vaadin.sass.tree;
+
+public interface InterpolationNode {
+ public void replaceInterpolation(String variableName, String variable);
+
+ public boolean containsInterpolationVariable(String variable);
+}
diff --git a/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java b/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
index ee8d8145f1..aad4509616 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
@@ -17,10 +17,11 @@
package com.vaadin.sass.tree;
import java.util.ArrayList;
+import java.util.regex.Pattern;
import com.vaadin.sass.parser.LexicalUnitImpl;
-public class RuleNode extends Node implements IVariableNode {
+public class RuleNode extends Node implements IVariableNode, InterpolationNode {
private static final long serialVersionUID = 6653493127869037022L;
String variable;
@@ -83,10 +84,11 @@ public class RuleNode extends Node implements IVariableNode {
public void replaceVariables(ArrayList<VariableNode> variables) {
for (final VariableNode node : variables) {
if (value.getLexicalUnitType() == LexicalUnitImpl.SAC_FUNCTION) {
- if (value.getParameters().toString().contains(node.getName())) {
+ if (value.getParameters().toString()
+ .contains("$" + node.getName())) {
if (value.getParameters() != null) {
if (value.getParameters().toString()
- .contains("$" + node.getName())) {
+ .contains(node.getName())) {
LexicalUnitImpl param = value.getParameters();
while (param != null) {
@@ -125,4 +127,34 @@ public class RuleNode extends Node implements IVariableNode {
}
}
}
+
+ @Override
+ public void replaceInterpolation(String variableName, String variable) {
+ if (this.variable.contains(variableName)) {
+ this.variable = this.variable.replaceAll(variableName, variable);
+ }
+
+ if (value.toString().contains(variableName)) {
+
+ LexicalUnitImpl current = value;
+ while (current != null) {
+ if (current.getValue().toString().contains(variableName)) {
+ current.setStringValue(current
+ .getValue()
+ .toString()
+ .replaceAll(
+ Pattern.quote("#{" + variableName + "}"),
+ variable));
+ }
+
+ current = value.getNextLexicalUnit();
+ }
+ }
+ }
+
+ @Override
+ public boolean containsInterpolationVariable(String variable) {
+ return value.toString().contains(variable)
+ || this.variable.contains(variable);
+ }
}
diff --git a/theme-compiler/src/com/vaadin/sass/visitor/EachVisitor.java b/theme-compiler/src/com/vaadin/sass/visitor/EachVisitor.java
index cc7e4e5930..be5e14a543 100644
--- a/theme-compiler/src/com/vaadin/sass/visitor/EachVisitor.java
+++ b/theme-compiler/src/com/vaadin/sass/visitor/EachVisitor.java
@@ -1,54 +1,70 @@
package com.vaadin.sass.visitor;
-import java.util.HashSet;
-import java.util.regex.Pattern;
+import java.util.HashMap;
+import java.util.Map.Entry;
import com.vaadin.sass.tree.BlockNode;
import com.vaadin.sass.tree.Node;
-import com.vaadin.sass.tree.SimpleNode;
+import com.vaadin.sass.tree.RuleNode;
import com.vaadin.sass.tree.controldirective.EachDefNode;
+import com.vaadin.sass.util.DeepCopy;
public class EachVisitor implements Visitor {
- HashSet<EachDefNode> controlDefs = new HashSet<EachDefNode>();
+ HashMap<EachDefNode, Node> controlDefs = new HashMap<EachDefNode, Node>();
private Node rootNode;
@Override
public void traverse(Node node) throws Exception {
this.rootNode = node;
- for (Node child : node.getChildren()) {
- if (child instanceof EachDefNode) {
- controlDefs.add((EachDefNode) child);
- }
- }
+
+ findDefNodes(null, node);
replaceControlNodes();
}
- private void replaceControlNodes() {
- for (final EachDefNode defNode : controlDefs) {
- replaceEachDefNode(defNode);
+ private void findDefNodes(Node parent, Node node) {
+ for (Node child : node.getChildren()) {
+ findDefNodes(node, child);
+ }
+ if (node instanceof EachDefNode) {
+ controlDefs.put((EachDefNode) node, parent);
+ }
+ }
+ private void replaceControlNodes() {
+ for (final Entry<EachDefNode, Node> entry : controlDefs.entrySet()) {
+ replaceEachDefNode(entry.getKey(), entry.getValue());
}
}
- private void replaceEachDefNode(EachDefNode defNode) {
+ private void replaceEachDefNode(EachDefNode defNode, Node parent) {
+ Node last = defNode;
for (final Node child : defNode.getChildren()) {
if (child instanceof BlockNode) {
- Node lastNode = defNode;
- for (final String variable : defNode.getVariables()) {
+ BlockNode iNode = (BlockNode) child;
+ String interpolation = "#{" + defNode.getVariableName() + "}";
+ if (iNode.containsInterpolationVariable(interpolation)) {
+ for (final String variable : defNode.getVariables()) {
+ BlockNode copy = (BlockNode) DeepCopy.copy(child);
+ copy.replaceInterpolation(defNode.getVariableName(),
+ variable);
- String output = child.toString();
- output = output.replaceAll(
- Pattern.quote("#{" + defNode.getVariableName()
- + "}"), variable);
- SimpleNode simple = new SimpleNode(output);
+ for (final Node blockChild : copy.getChildren()) {
+ if (blockChild instanceof RuleNode) {
+ ((RuleNode) blockChild).replaceInterpolation(
+ defNode.getVariableName(), variable);
+ }
+ }
- rootNode.appendChild(simple, lastNode);
- lastNode = simple;
+ parent.appendChild(copy, last);
+ last = copy;
+ }
}
}
+
+ last = child;
}
rootNode.removeChild(defNode);
}