flute-1.1.6/0000755000175000017500000000000011635761110011303 5ustar renereneflute-1.1.6/source/0000755000175000017500000000000011365604770012613 5ustar renereneflute-1.1.6/source/org/0000755000175000017500000000000011365604770013402 5ustar renereneflute-1.1.6/source/org/w3c/0000755000175000017500000000000011365604770014076 5ustar renereneflute-1.1.6/source/org/w3c/flute/0000755000175000017500000000000011365604770015215 5ustar renereneflute-1.1.6/source/org/w3c/flute/util/0000755000175000017500000000000011365604770016172 5ustar renereneflute-1.1.6/source/org/w3c/flute/util/encoding.properties0000644000175000017500000000434111365604770022100 0ustar renereneiso-ir-6 = ASCII ANSI_X3.4-1986 = ASCII ISO_646.irv:1991 = ASCII ASCII = ASCII ISO646-US = ASCII US-ASCII = ASCII us = ASCII IBM367 = ASCII cp367 = ASCII csASCII = ASCII iso-ir-100 = ISO8859_1 ISO_8859-1:1987 = ISO8859_1 ISO_8859-1 = ISO8859_1 ISO-8859-1 = ISO8859_1 latin1 = ISO8859_1 l1 = ISO8859_1 IBM819 = ISO8859_1 CP819 = ISO8859_1 csISOLatin1 = ISO8859_1 iso-ir-101 = ISO8859_2 ISO_8859-2:1987 = ISO8859_2 ISO_8859-2 = ISO8859_2 ISO-8859-2 = ISO8859_2 latin2 = ISO8859_2 l2 = ISO8859_2 csISOLatin2 = ISO8859_2 ISO_8859-3:1988 = ISO8859_3 iso-ir-109 = ISO8859_3 ISO_8859-3 = ISO8859_3 ISO-8859-3 = ISO8859_3 latin3 = ISO8859_3 l3 = ISO8859_3 csISOLatin3 = ISO8859_3 iso-ir-110 = ISO8859_4 ISO_8859-4:1988 = ISO8859_4 ISO_8859-4 = ISO8859_4 ISO-8859-4 = ISO8859_4 latin4 = ISO8859_4 l4 = ISO8859_4 csISOLatin4 = ISO8859_4 iso-ir-127 = ISO8859_6 ISO_8859-6 = ISO8859_6 ISO_8859-6:1987 = ISO8859_6 ISO-8859-6 = ISO8859_6 ECMA-114 = ISO8859_6 ASMO-708 = ISO8859_6 arabic = ISO8859_6 csISOLatinArabic = ISO8859_6 iso-ir-126 = ISO8859_7 ISO_8859-7 = ISO8859_7 ISO_8859-7:1987 = ISO8859_7 ISO-8859-7 = ISO8859_7 ELOT_928 = ISO8859_7 ECMA-118 = ISO8859_7 greek = ISO8859_7 greek8 = ISO8859_7 csISOLatinGreek = ISO8859_7 ISO_8859-8:1988 = ISO8859_8 iso-ir-138 = ISO8859_8 ISO_8859-8 = ISO8859_8 ISO-8859-8 = ISO8859_8 hebrew = ISO8859_8 csISOLatinHebrew = ISO8859_8 ISO_8859-9:1989 = ISO8859_9 iso-ir-148 = ISO8859_9 ISO_8859-9 = ISO8859_9 ISO-8859-9 = ISO8859_9 latin5 = ISO8859_9 l5 = ISO8859_9 csISOLatin5 = ISO8859_9 ISO_8859-15 = ISO8859_15_FDIS UTF-8 = UTF8 Shift_JIS = SJIS MS_Kanji = SJIS csShiftJIS = SJIS EUC-JP = EUC_JP csEUCPkdFmtJapanese = EUC_JP Extended_UNIX_Code_Packed_Format_for_Japanese = EUC_JP csBig5 = Big5 flute-1.1.6/source/org/w3c/flute/util/Encoding.java0000644000175000017500000000344511365604770020571 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 1999 - 2009 Pentaho Corporation, World Wide Web Consortium. All rights reserved. */ package org.w3c.flute.util; import java.io.InputStream; import java.net.URL; import java.util.Properties; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class Encoding { private Encoding() {} /** * Converts the format encoding information into Java encoding information. */ public static String getJavaEncoding(String encoding) { String _result = encodings.getProperty(encoding); if (_result == null) { return encoding; } return _result; } static Properties encodings; static { encodings = new Properties(); try { URL url = Encoding.class.getResource("encoding.properties"); InputStream f = url.openStream(); encodings.load(f); f.close(); } catch (Exception e) { System.err.println(Encoding.class + ": couldn't load encoding properties "); e.printStackTrace(); } } } flute-1.1.6/source/org/w3c/flute/parser/0000755000175000017500000000000011365604770016511 5ustar renereneflute-1.1.6/source/org/w3c/flute/parser/JumpException.java0000644000175000017500000000206611365604770022152 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class JumpException extends RuntimeException { /** * Creates a new JumpException */ public JumpException() { } } flute-1.1.6/source/org/w3c/flute/parser/Generic_CharStream.java0000644000175000017500000002206711365604770023050 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public final class Generic_CharStream implements CharStream { public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; public int bufpos = -1; private int bufline[]; private int bufcolumn[]; private int column = 0; private int line = 1; private boolean prevCharIsCR = false; private boolean prevCharIsLF = false; private java.io.Reader reader; private char[] buffer; private int maxNextCharInd = 0; private int inBuf = 0; private final void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } private final void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = reader.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { reader.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } public final char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } private final void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (8 - (column & 07)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } public final char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]); } if (++bufpos >= maxNextCharInd) FillBuff(); char c = (char)((char)0xff & buffer[bufpos]); UpdateLineColumn(c); return (c); } /** * @deprecated * @see #getEndColumn */ public final int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public final int getLine() { return bufline[bufpos]; } public final int getEndColumn() { return bufcolumn[bufpos]; } public final int getEndLine() { return bufline[bufpos]; } public final int getBeginColumn() { return bufcolumn[tokenBegin]; } public final int getBeginLine() { return bufline[tokenBegin]; } public final void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public Generic_CharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { reader = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } public Generic_CharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { reader = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public final String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } public final char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token.
*/ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } flute-1.1.6/source/org/w3c/flute/parser/Parser.jj0000644000175000017500000014574211365604770020307 0ustar renerene/* -*-java-extended-*- * Copyright (c) 1999 World Wide Web Consortium * (Massachusetts Institute of Technology, Institut National de Recherche * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * * $Id: Parser.jj 3056 2007-07-30 13:59:14Z tmorgner $ */ options { IGNORE_CASE = true; STATIC = false; USER_CHAR_STREAM = true; /* DEBUG_TOKEN_MANAGER = true; DEBUG_PARSER = true; */ } PARSER_BEGIN(Parser) package org.w3c.flute.parser; import java.io.*; import java.net.*; import java.util.Locale; import org.w3c.css.sac.ConditionFactory; import org.w3c.css.sac.Condition; import org.w3c.css.sac.SelectorFactory; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; import org.w3c.css.sac.DocumentHandler; import org.w3c.css.sac.InputSource; import org.w3c.css.sac.ErrorHandler; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Locator; import org.w3c.css.sac.LexicalUnit; import org.w3c.flute.parser.selectors.SelectorFactoryImpl; import org.w3c.flute.parser.selectors.ConditionFactoryImpl; import org.w3c.flute.util.Encoding; /** * A CSS2 parser * * @author Philippe Le Hegaret * @version $Revision: 3056 $ */ public class Parser implements org.w3c.css.sac.Parser { // replaces all \t, \n, etc with this StringBuffer. static final StringBuffer SPACE = new StringBuffer(" "); // the document handler for the parser protected DocumentHandler documentHandler; // the error handler for the parser protected ErrorHandler errorHandler; // the input source for the parser protected InputSource source; protected ConditionFactory conditionFactory; protected SelectorFactory selectorFactory; // temporary place holder for pseudo-element ... protected String pseudoElt; /** * Creates a new Parser */ public Parser() { this((CharStream) null); } /** * @@TODO * @exception CSSException Not yet implemented */ public void setLocale(Locale locale) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Set the document handler for this parser */ public void setDocumentHandler(DocumentHandler handler) { this.documentHandler = handler; } public void setSelectorFactory(SelectorFactory selectorFactory) { this.selectorFactory = selectorFactory; } public void setConditionFactory(ConditionFactory conditionFactory) { this.conditionFactory = conditionFactory; } /** * Set the error handler for this parser */ public void setErrorHandler(ErrorHandler error) { this.errorHandler = error; } /** * Main parse methods * * @param source the source of the style sheet. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseStyleSheet(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } parserUnit(); } /** * Convenient method for URIs. * * @param systemId the fully resolved URI of the style sheet. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseStyleSheet(String systemId) throws CSSException, IOException { parseStyleSheet(new InputSource(systemId)); } /** * This method parses only one rule (style rule or at-rule, except @charset). * * @param source the source of the rule. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseRule(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseRule(); } /** * This method parses a style declaration (including the surrounding curly * braces). * * @param source the source of the style declaration. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseDeclarationBlock(); } /** * This methods returns "http://www.w3.org/TR/REC-CSS2". * @return the string "http://www.w3.org/TR/REC-CSS2". */ public String getParserVersion() { return "http://www.w3.org/TR/REC-CSS2"; } /** * Parse methods used by DOM Level 2 implementation. */ public void parseImportRule(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseImportRule(); } public void parseMediaRule(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseMediaRule(); } public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } return _parseSelectors(); } public String parseNamespaceToken(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } return _parseNamespaceToken(); } public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); return expr(); } public boolean parsePriority(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); return prio(); } /** * Convert the source into a Reader. Used only by DOM Level 2 parser methods. */ private Reader getReader(InputSource source) throws IOException { if (source.getCharacterStream() != null) { return source.getCharacterStream(); } else if (source.getByteStream() != null) { // My DOM level 2 implementation doesn't use this case. if (source.getEncoding() == null) { // unknown encoding, use ASCII as default. return new InputStreamReader(source.getByteStream(), "ASCII"); } else { return new InputStreamReader(source.getByteStream(), source.getEncoding()); } } else { // systemId // @@TODO throw new CSSException("not yet implemented"); } } /** * Convert the source into a CharStream with encoding informations. * The encoding can be found in the InputSource or in the CSS document. * Since this method marks the reader and make a reset after looking for * the charset declaration, you'll find the charset declaration into the * stream. */ private CharStream getCharStreamWithLurk(InputSource source) throws CSSException, IOException { if (source.getCharacterStream() != null) { // all encoding are supposed to be resolved by the user // return the reader return new Generic_CharStream(source.getCharacterStream(), 1, 1); } else if (source.getByteStream() == null) { // @@CONTINUE ME. see also getReader() with systemId try { source.setByteStream(new URL(source.getURI()).openStream()); } catch (Exception e) { try { source.setByteStream(new FileInputStream(source.getURI())); } catch (IOException ex) { throw new CSSException("invalid url ?"); } } } String encoding = "ASCII"; InputStream input = source.getByteStream(); char c = ' '; if (!input.markSupported()) { input = new BufferedInputStream(input); source.setByteStream(input); } input.mark(100); c = (char) input.read(); if (c == '@') { // hum, is it a charset ? int size = 100; byte[] buf = new byte[size]; input.read(buf, 0, 7); String keyword = new String(buf, 0, 7); if (keyword.equals("charset")) { // Yes, this is the charset declaration ! // here I don't use the right declaration : white space are ' '. while ((c = (char) input.read()) == ' ') { // find the first quote } char endChar = c; int i = 0; if ((endChar != '"') && (endChar != '\'')) { // hum this is not a quote. throw new CSSException("invalid charset declaration"); } while ((c = (char) input.read()) != endChar) { buf[i++] = (byte) c; if (i == size) { byte[] old = buf; buf = new byte[size + 100]; System.arraycopy(old, 0, buf, 0, size); size += 100; } } while ((c = (char) input.read()) == ' ') { // find the next relevant character } if (c != ';') { // no semi colon at the end ? throw new CSSException("invalid charset declaration: " + "missing semi colon"); } encoding = new String(buf, 0, i); if (source.getEncoding() != null) { // compare the two encoding informations. // For example, I don't accept to have ASCII and after UTF-8. // Is it really good ? That is the question. if (!encoding.equals(source.getEncoding())) { throw new CSSException("invalid encoding information."); } } } // else no charset declaration available } // ok set the real encoding of this source. source.setEncoding(encoding); // set the real reader of this source. source.setCharacterStream(new InputStreamReader(source.getByteStream(), Encoding.getJavaEncoding(encoding))); // reset the stream (leave the charset declaration in the stream). input.reset(); return new Generic_CharStream(source.getCharacterStream(), 1, 1); } private LocatorImpl currentLocator; private Locator getLocator() { if (currentLocator == null) { currentLocator = new LocatorImpl(this); return currentLocator; } return currentLocator.reInit(this); } private LocatorImpl getLocator(Token save) { if (currentLocator == null) { currentLocator = new LocatorImpl(this, save); return currentLocator; } return currentLocator.reInit(this, save); } private void reportError(Locator l, Exception e) { if (errorHandler != null) { if (e instanceof ParseException) { // construct a clean error message. ParseException pe = (ParseException) e; if (pe.specialConstructor) { StringBuffer errorM = new StringBuffer(); if (pe.currentToken != null) { errorM.append("encountered \"") .append(pe.currentToken.next); } errorM.append('"'); if (pe.expectedTokenSequences.length != 0) { errorM.append(". Was expecting one of: "); for (int i = 0; i < pe.expectedTokenSequences.length; i++) { for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) { int kind = pe.expectedTokenSequences[i][j]; if (kind != S) { errorM.append(pe.tokenImage[kind]); errorM.append(' '); } } } } errorHandler.error(new CSSParseException(errorM.toString(), l, e)); } else { errorHandler.error(new CSSParseException(e.getMessage(), l, e)); } } else if (e == null) { errorHandler.error(new CSSParseException("error", l, null)); } else { errorHandler.error(new CSSParseException(e.getMessage(), l, e)); } } } private void reportWarningSkipText(Locator l, String text) { if (errorHandler != null && text != null) { errorHandler.warning(new CSSParseException("Skipping: " + text, l)); } } } PARSER_END(Parser) /* * The tokenizer */ TOKEN : { < S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ > { image = Parser.SPACE; } } MORE : /* Comments */ { < "/*" > : IN_COMMENT } SKIP : { < "*/" > : DEFAULT } MORE : { < ~[] > : IN_COMMENT } TOKEN : { < CDO : "" > | < LBRACE : "{" > | < RBRACE : "}"> | < DASHMATCH : "|=" > | < INCLUDES : "~=" > | < EQ : "=" > | < PLUS : "+" > | < MINUS : "-" > | < COMMA : "," > | < SEMICOLON : ";" > | < PRECEDES : ">" > | < DIV : "/" > | < LBRACKET : "[" > | < RBRACKET : "]" > | < ANY : "*" > | < DOT : "." > | < LPARAN : ")" > | < RPARAN : "("> } TOKEN : { < COLON : ":" > } TOKEN : /* basic tokens */ { < NONASCII : ["\200"-"\377"] > | < #H : ["0"-"9", "a"-"f"] > | < #UNICODE : "\\" ( )? /* I can't say {1,6} */ ( )? ( )? ( )? ( )? ( [ " ", "\t" , "\n" , "\r", "\f" ] )? > | < #ESCAPE : | ( "\\" [ " "-"~","\200"-"\377" ] ) > | < #NMSTART : [ "a"-"z","-","_" ] | | > | < #NMCHAR : ["a"-"z", "0"-"9", "-", "_"] | | > | < #STRINGCHAR : [ "\t"," ","!","#","$","%","&","("-"~" ] | "\\\n" | "\\\r\n" | "\\\r" | "\\\f" | | > | < #D : ["0"-"9"] > | < #NAME : ( )+ > | < #NNAME : ( )* > } TOKEN : { < STRING : ( "\"" ( | "'" )* "\"" ) | ( "'" ( | "\"" )* "'" ) > | < IDENT : > | < NUMBER : ( )+ | ( )* "." ( )+ > | < #_URL : [ "!","#","$","%","&","*"-"~" ] | | > | < URL : "url(" ( )* ( | ( <_URL> )* ) ( )* ")" > } TOKEN : { < NAMESPACE_IDENT : ( "|" ) | ( "|" ) > } TOKEN : { < PERCENTAGE : "%" > | < PT : "pt" > | < MM : "mm" > | < CM : "cm" > | < PC : "pc" > | < IN : "in" > | < PX : "px" > | < EMS : "em" > | < EXS : "ex" > | < DEG : "deg" > | < RAD : "rad" > | < GRAD : "grad" > | < MS : "ms" > | < SECOND : "s" > | < HZ : "Hz" > | < KHZ : "kHz" > | < DIMEN : > } TOKEN : { < HASH : "#" > } /* RESERVED ATRULE WORDS */ TOKEN : { < IMPORT_SYM : "@import"> | < MEDIA_SYM : "@media" > | < CHARSET_SYM : "@charset" > | < PAGE_SYM : "@page" > | < NAMESPACE_SYM : "@namespace" > | < FONT_FACE_SYM: "@font-face" > | < ATKEYWORD : "@" > } TOKEN : { < IMPORTANT_SYM : "!" ( )? "important" > } TOKEN : { < #RANGE0 : > | < #RANGE1 : ( "?" )? > | < #RANGE2 : ( "?" )? ( "?" )? > | < #RANGE3 : ( "?" )? ( "?" )? ( "?" )? > | < #RANGE4 : ( "?" )? ( "?" )? ( "?" )? ( "?" )? > | < #RANGE5 : ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? > | < #RANGE6 : "?" ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? > | < #RANGE : | | | | | | > | < #UNI : ( )? ( )? ( )? ( )? ( )? > | < UNICODERANGE : "U+" | "U+" "-" > } TOKEN : { < FUNCTION : "(" > } TOKEN : { /* avoid token manager error */ < UNKNOWN : ~[] > } /* * The grammar of CSS2 */ /** * The main entry for the parser. * * @exception ParseException exception during the parse */ void parserUnit() : {} { try { { documentHandler.startDocument(source); } ( charset() )? ( | ignoreStatement() )* ( importDeclaration() ( ignoreStatement() ( )* )* )* ( namespaceDeclaration() ( ignoreStatement() ( )* )* )* afterImportDeclaration() } finally { documentHandler.endDocument(source); } } void charset() : { Token n; } { try { ( )* n= ( )* ";" } catch (ParseException e) { reportError(getLocator(e.currentToken.next), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } catch (Exception e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } } void afterImportDeclaration() : {String ret; Locator l; } { ( ( styleRule() | media() | page() | fontFace() | { l = getLocator(); } ret=skipStatement() { if ((ret == null) || (ret.length() == 0)) { return; } reportWarningSkipText(l, ret); if (ret.charAt(0) == '@') { documentHandler.ignorableAtRule(ret); } } ) ( ignoreStatement() ( )* )* )* } void ignoreStatement() : {} { | | atRuleDeclaration() } /** * The import statement * * @exception ParseException exception during the parse */ void importDeclaration() : {Token n; String uri; MediaListImpl ml = new MediaListImpl(); } { try { ( )* ( n= { uri = convertStringIndex(n.image, 1, n.image.length() -1); } | n= { uri = n.image.substring(4, n.image.length()-1).trim(); if ((uri.charAt(0) == '"') || (uri.charAt(0) == '\'')) { uri = uri.substring(1, uri.length()-1); } } ) ( )* ( mediaStatement(ml) )? ";" ( )* { if (ml.getLength() == 0) { // see section 6.3 of the CSS2 recommandation. ml.addItem("all"); } documentHandler.importStyle(uri, ml, null); } } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } } /** * The namespace statement * * @exception ParseException exception during the parse */ void namespaceDeclaration() : {Token n; Token prefix = null; String uri; } { try { ( )* ( (( prefix = ) ( )*)? ( n= { uri = n.image.substring(4, n.image.length()-1).trim(); if ((uri.charAt(0) == '"') || (uri.charAt(0) == '\'')) { uri = uri.substring(1, uri.length()-1); } } ) ) ";" ( )* { if (prefix == null) { this.documentHandler.namespaceDeclaration("", uri); } else { this.documentHandler.namespaceDeclaration(prefix.image, uri); } } } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } } /** * @exception ParseException exception during the parse */ void media() : { boolean start = false; String ret; MediaListImpl ml = new MediaListImpl(); } { try { ( )* mediaStatement(ml) { start = true; documentHandler.startMedia(ml); } ( )* ( styleRule() | skipUnknownRule() )* ( )* } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } finally { if (start) { documentHandler.endMedia(ml); } } } void mediaStatement(MediaListImpl ml) : { String m; } { m=medium() ( ( )* { ml.addItem(m); } m=medium() )* { ml.addItem(m); } } /** * @exception ParseException exception during the parse */ String medium() : /* tv, projection, screen, ... */ {Token n;} { n= ( )* { return convertIdent(n.image); } } /** * @exception ParseException exception during the parse */ void page() : { boolean start = false; Token n = null; String page = null; String pseudo = null; } { try { ( )* ( n= ( )* )? ( pseudo=pseudo_page() )? { if (n != null) { page = convertIdent(n.image); } } ()* { start = true; documentHandler.startPage(page, pseudo); } ( ( declaration() )? ( ";" ( )* ( declaration() )? )* ( atRuleDeclaration() )* ) ()* } catch (ParseException e) { if (errorHandler != null) { LocatorImpl li = new LocatorImpl(this, e.currentToken.next.beginLine, e.currentToken.next.beginColumn-1); reportError(li, e); skipStatement(); // reportWarningSkipText(li, skipStatement()); } else { skipStatement(); } } finally { if (start) { documentHandler.endPage(page, pseudo); } } } String pseudo_page() : { Token n; } { ":" n= ( )* { return convertIdent(n.image); } } void fontFace() : { boolean start = false; } { try { ( )* ()* { start = true; documentHandler.startFontFace(); } ( declaration() )? ( ";" ( )* ( declaration() )? )* ()* } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } finally { if (start) { documentHandler.endFontFace(); } } } /** * @exception ParseException exception during the parse */ void atRuleDeclaration() : {Token n; String ret; } { n= { ret=skipStatementNoSemicolon(); reportWarningSkipText(getLocator(), ret); if ((ret != null) && (ret.charAt(0) == '@')) { documentHandler.ignorableAtRule(ret); } } } void skipUnknownRule() : { Token n;} { ( n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n= | n=";" | n="+" | n=">" | n="-" | n= ) { String ret; Locator loc = getLocator(); ret=skipStatement(); reportWarningSkipText(loc, ret); if ((ret != null) && (n.image.charAt(0) == '@')) { documentHandler.ignorableAtRule(ret); } } } /** * @exception ParseException exception during the parse */ char combinator() : { char connector = ' '; } { "+" ( )* { return '+'; } | ">" ( )* { return '>'; } | ( ( "+" { connector = '+'; } | ">" { connector = '>'; } ) ( )* )? { return connector; } } /** * @exception ParseException exception during the parse */ String property() : {Token n; } { n= ( )* { return convertIdent(n.image); } } /** * @exception ParseException exception during the parse */ void styleRule() : { boolean start = false; SelectorList l = null; Token save; Locator loc; } { try { l=selectorList() { save = token; } ()* { start = true; documentHandler.startSelector(l); } ( declaration() )? ( ";" ( )* ( declaration() )? )* ()* } 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(l); } } } SelectorList selectorList() : { SelectorListImpl selectors = new SelectorListImpl(); Selector selector; } { selector=selector() ( ()* { selectors.addSelector(selector); } selector=selector() )* { selectors.addSelector(selector); return selectors; } } /** * @exception ParseException exception during the parse */ Selector selector() : { Selector selector; char comb; } { try { selector=simple_selector(null, ' ') ( LOOKAHEAD(2) comb=combinator() selector=simple_selector(selector, comb) )* ()* { return selector; } } catch (ParseException e) { /* Token t = getToken(1); StringBuffer s = new StringBuffer(); s.append(getToken(0).image); while ((t.kind != COMMA) && (t.kind != SEMICOLON) && (t.kind != LBRACE) && (t.kind != EOF)) { s.append(t.image); getNextToken(); t = getToken(1); } reportWarningSkipText(getLocator(), s.toString()); */ Token t = getToken(1); while ((t.kind != COMMA) && (t.kind != SEMICOLON) && (t.kind != LBRACE) && (t.kind != EOF)) { getNextToken(); t = getToken(1); } throw new ThrowedParseException(e); } } /** * @exception ParseException exception during the parse */ Selector simple_selector(Selector selector, char comb) : { SimpleSelector simple_current = null; Condition cond = null; pseudoElt = null; } { ( simple_current=element_name() ( cond=hash(cond) | cond=_class(cond) | cond=attrib(cond) | cond=pseudo(cond) )* | cond=hash(cond) ( cond=_class(cond) | cond=attrib(cond) | cond=pseudo(cond) )* | cond=_class(cond) ( cond=hash(cond) | cond=_class(cond) | cond=attrib(cond) | cond=pseudo(cond) )* | cond=pseudo(cond) ( cond=hash(cond) | cond=_class(cond) | cond=attrib(cond) | cond=pseudo(cond) )* | cond=attrib(cond) ( cond=hash(cond) | cond=_class(cond) | cond=attrib(cond) | cond=pseudo(cond) )* ) { if (simple_current == null) { simple_current = selectorFactory.createElementSelector(null, null); } if (cond != null) { simple_current = selectorFactory.createConditionalSelector(simple_current, cond); } if (selector != null) { switch (comb) { case ' ': selector = selectorFactory.createDescendantSelector(selector, simple_current); break; case '+': selector = selectorFactory.createDirectAdjacentSelector((short) 1, selector, simple_current); break; case '>': selector = selectorFactory.createChildSelector(selector, simple_current); break; default: throw new ParseException("invalid state. send a bug report"); } } else { selector= simple_current; } if (pseudoElt != null) { selector = selectorFactory.createChildSelector(selector, selectorFactory.createPseudoElementSelector(null, pseudoElt)); } return selector; } } /** * @exception ParseException exception during the parse */ Condition _class(Condition pred) : {Token n; Condition c; } { "." n= { c = conditionFactory.createClassCondition(null, n.image); if (pred == null) { return c; } else { return conditionFactory.createAndCondition(pred, c); } } } /** * @exception ParseException exception during the parse */ SimpleSelector element_name() : {Token n; } { n= { return selectorFactory.createElementSelector(null, convertIdent(n.image)); } | n= { return selectorFactory.createElementSelector(null, convertIdent(n.image)); } | "*" { return selectorFactory.createElementSelector(null, null); } } /** * @exception ParseException exception during the parse */ Condition attrib(Condition pred) : { int cases = 0; Token att = null; Token val = null; String attValue = null; } { "[" ( )* ( att= | att= ) ( )* ( ( "=" { cases = 1; } | { cases = 2; } | { cases = 3; } ) ( )* ( val= { attValue = val.image; } | val= { attValue = convertStringIndex(val.image, 1, val.image.length() -1); } ) ( )* )? "]" { String name = convertIdent(att.image); Condition c; switch (cases) { case 0: c = conditionFactory.createAttributeCondition(name, null, false, null); break; case 1: c = conditionFactory.createAttributeCondition(name, null, false, attValue); break; case 2: c = conditionFactory.createOneOfAttributeCondition(name, null, false, attValue); break; case 3: c = conditionFactory.createBeginHyphenAttributeCondition(name, null, false, attValue); break; default: // never reached. c = null; } if (pred == null) { return c; } else { return conditionFactory.createAndCondition(pred, c); } } } /** * @exception ParseException exception during the parse */ Condition pseudo(Condition pred) : {Token n; Token language; } { ":" ( n= { String s = convertIdent(n.image); if (s.equals("first-letter") || s.equals("first-line")) { if (pseudoElt != null) { throw new CSSParseException("duplicate pseudo element definition " + s, getLocator()); } else { pseudoElt = s; return pred; } } else { Condition c = conditionFactory.createPseudoClassCondition(null, s); if (pred == null) { return c; } else { return conditionFactory.createAndCondition(pred, c); } } } | ( n= ( )* language= ( )* ")" { String f = convertIdent(n.image); if (f.equals("lang(")) { Condition d = conditionFactory.createLangCondition(convertIdent(language.image)); if (pred == null) { return d; } else { return conditionFactory.createAndCondition(pred, d); } } else { throw new CSSParseException("invalid pseudo function name " + f, getLocator()); } } ) ) } /** * @exception ParseException exception during the parse */ Condition hash(Condition pred) : {Token n; } { n= { Condition d = conditionFactory.createIdCondition(n.image.substring(1)); if (pred == null) { return d; } else { return conditionFactory.createAndCondition(pred, d); } } } /** * @exception ParseException exception during the parse */ void declaration() : { boolean important = false; String name; LexicalUnit exp; Token save; } { try { name=property() { save = token; } ":" ( )* exp=expr() ( important=prio() )? { documentHandler.property(name, exp, important); } } catch (JumpException e) { skipAfterExpression(); // reportWarningSkipText(getLocator(), skipAfterExpression()); } catch (NumberFormatException e) { if (errorHandler != null) { errorHandler.error(new CSSParseException("Invalid number " + e.getMessage(), getLocator(), e)); } reportWarningSkipText(getLocator(), skipAfterExpression()); } catch (ParseException e) { if (errorHandler != null) { if (e.currentToken != null) { LocatorImpl li = new LocatorImpl(this, e.currentToken.next.beginLine, e.currentToken.next.beginColumn-1); reportError(li, e); } else { reportError(getLocator(), e); } skipAfterExpression(); /* LocatorImpl loc = (LocatorImpl) getLocator(); loc.column--; reportWarningSkipText(loc, skipAfterExpression()); */ } else { skipAfterExpression(); } } } /** * @exception ParseException exception during the parse */ boolean prio() : {} { ( )* { return true; } } /** * @exception ParseException exception during the parse */ LexicalUnitImpl operator(LexicalUnitImpl prev) : {Token n;} { n="/" ( )* { return LexicalUnitImpl.createSlash(n.beginLine, n.beginColumn, prev); } | n="," ( )* { return LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, prev); } } /** * @exception ParseException exception during the parse */ LexicalUnit expr() : { LexicalUnitImpl first, res; char op; } { first=term(null) { res = first; } ( ( res=operator(res) )? res=term(res) )* { return first; } } /** * @exception ParseException exception during the parse */ char unaryOperator() : {} { "-" { return '-'; } | "+" { return '+'; } } /** * @exception ParseException exception during the parse */ LexicalUnitImpl term(LexicalUnitImpl prev) : { LexicalUnitImpl result = null; Token n = null; char op = ' '; } { ( ( ( op=unaryOperator() )? ( n= { result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn, prev, number(op, n, 0)); } | n= { result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn, prev, number(op, n, 1)); } | n= { result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn, prev, number(op, n, 3)); } | n= { result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn, prev, number(op, n, 3)); } | n= { result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn, prev, number(op, n, 3)); } | n= { result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn, prev, number(op, n, 1)); } | n= { result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn, prev, number(op, n, 2)); } | n= { result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn, prev, number(op, n, 3)); } | n= { 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)); } | result=function(op, prev) ) ) | ( n= { result = LexicalUnitImpl.createString (n.beginLine, n.beginColumn, prev, convertStringIndex(n.image, 1, n.image.length() -1)); } | n= { result = LexicalUnitImpl.createIdent (n.beginLine, n.beginColumn, prev, convertIdent(n.image)); } | n= { 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, s); } /* / Auto correction code used in the CSS Validator but must not be used by a conformant CSS2 parser. * Common error : * H1 { * color : black * background : white * } * Token t = getToken(1); Token semicolon = new Token(); semicolon.kind = SEMICOLON; semicolon.image = ";"; if (t.kind == COLON) { // @@SEEME. (generate a warning?) // @@SEEME if expression is a single ident, generate an error ? rejectToken(semicolon); result = prev; } / */ } | result=hexcolor(prev) | result=url(prev) | result=unicode(prev) ) ) ( )* { return result; } } /** * Handle all CSS2 functions. * @exception ParseException exception during the parse */ LexicalUnitImpl function(char operator, LexicalUnitImpl prev) : {Token n; LexicalUnit params = null; } { n= ( )* ( params=expr() )? ")" { if (operator != ' ') { throw new CSSParseException("invalid operator before a function.", getLocator()); } String f = convertIdent(n.image); LexicalUnitImpl l = (LexicalUnitImpl) params; boolean loop = true; if ("rgb(".equals(f)) { // this is a RGB declaration (e.g. rgb(255, 50%, 0) ) int i = 0; while (loop && l != null && i < 5) { switch (i) { case 0: case 2: case 4: if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER) && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) { loop = false; } break; case 1: case 3: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: throw new ParseException("implementation error"); } if (loop) { l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } } if ((i == 5) && loop && (l == null)) { return LexicalUnitImpl.createRGBColor(n.beginLine, n.beginColumn, prev, params); } else { if (errorHandler != null) { String errorText; Locator loc; if (i < 5) { if (params == null) { loc = new LocatorImpl(this, n.beginLine, n.beginColumn-1); errorText = "not enough parameters."; } else if (l == null) { loc = new LocatorImpl(this, n.beginLine, n.beginColumn-1); errorText = "not enough parameters: " + params.toString(); } else { loc = new LocatorImpl(this, l.getLineNumber(), l.getColumnNumber()); errorText = "invalid parameter: " + l.toString(); } } else { loc = new LocatorImpl(this, l.getLineNumber(), l.getColumnNumber()); errorText = "too many parameters: " + l.toString(); } errorHandler.error(new CSSParseException(errorText, loc)); } throw new JumpException(); } } else if ("counter".equals(f)) { int i = 0; while (loop && l != null && i < 3) { switch (i) { case 0: case 2: if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { loop = false; } break; case 1: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: throw new ParseException("implementation error"); } l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } if (((i == 1) || (i == 3)) && loop && (l == null)) { return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn, prev, params); } } else if ("counters(".equals(f)) { int i = 0; while (loop && l != null && i < 5) { switch (i) { case 0: case 4: if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { loop = false; } break; case 2: if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) { loop = false; } break; case 1: case 3: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: throw new ParseException("implementation error"); } l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } if (((i == 3) || (i == 5)) && loop && (l == null)) { return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn, prev, params); } } else if ("attr(".equals(f)) { if ((l != null) && (l.getNextLexicalUnit() == null) && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) { return LexicalUnitImpl.createAttr(l.getLineNumber(), l.getColumnNumber(), prev, l.getStringValue()); } } else if ("rect(".equals(f)) { int i = 0; while (loop && l != null && i < 7) { switch (i) { case 0: case 2: case 4: case 6: switch (l.getLexicalUnitType()) { case LexicalUnit.SAC_INTEGER: if (l.getIntegerValue() != 0) { loop = false; } break; case LexicalUnit.SAC_IDENT: if (!l.getStringValue().equals("auto")) { loop = false; } break; case LexicalUnit.SAC_EM: case LexicalUnit.SAC_EX: case LexicalUnit.SAC_PIXEL: case LexicalUnit.SAC_CENTIMETER: case LexicalUnit.SAC_MILLIMETER: case LexicalUnit.SAC_INCH: case LexicalUnit.SAC_POINT: case LexicalUnit.SAC_PICA: // nothing break; default: loop = false; } break; case 1: case 3: case 5: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: throw new ParseException("implementation error"); } l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } if ((i == 7) && loop && (l == null)) { return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn, prev, params); } } return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev, f.substring(0, f.length() -1), params); } } LexicalUnitImpl unicode(LexicalUnitImpl prev) : { Token n; } { n= { LexicalUnitImpl params = null; String s = n.image.substring(2); int index = s.indexOf('-'); if (index == -1) { params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, Integer.parseInt(s, 16)); } else { String s1 = s.substring(0, index); String s2 = s.substring(index); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, Integer.parseInt(s1, 16)); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, Integer.parseInt(s2, 16)); } return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn, prev, params); } } LexicalUnitImpl url(LexicalUnitImpl prev) : { Token n; } { n= { String urlname = n.image.substring(4, n.image.length()-1).trim(); if (urlname.charAt(0) == '"' || urlname.charAt(0) == '\'') { urlname = urlname.substring(1, urlname.length()-1); } return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname); } } /** * @exception ParseException exception during the parse */ LexicalUnitImpl hexcolor(LexicalUnitImpl prev) : {Token n; } { n= { int r; LexicalUnitImpl first, params = null; String s = n.image.substring(1); if (s.length() == 3) { String sh = s.substring(0,1); r = Integer.parseInt(sh+sh, 16); first = params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); sh = s.substring(1,2); r = Integer.parseInt(sh+sh, 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); sh = s.substring(2,3); r = Integer.parseInt(sh+sh, 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); } else if (s.length() == 6) { r = Integer.parseInt(s.substring(0,2), 16); first = params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); r = Integer.parseInt(s.substring(2,4), 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); r = Integer.parseInt(s.substring(4,6), 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); } else { first = null; throw new CSSParseException("invalid hexadecimal notation for RGB: " + s, getLocator()); } return LexicalUnitImpl.createRGBColor(n.beginLine, n.beginColumn, prev, first); } } JAVACODE float number(char operator, Token n, int lengthUnit) { String image = n.image; float f = 0; if (lengthUnit != 0) { image = image.substring(0, image.length() - lengthUnit); } f = Float.valueOf(image).floatValue(); return (operator == '-')? -f: f; } JAVACODE String skipStatementNoSemicolon() { 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; } getNextToken(); } // skip white space while (true) { if (tok.kind != S) { break; } tok = getNextToken(); tok = getToken(1); } return s.toString().trim(); } JAVACODE String skipStatement() { StringBuffer s = new StringBuffer(); Token tok = getToken(0); if (tok.image != null) { s.append(tok.image); } while (true) { tok = getToken(1); if (tok.kind == EOF) { return null; } s.append(tok.image); if (tok.kind == LBRACE) { getNextToken(); s.append(skip_to_matching_brace()); getNextToken(); tok = getToken(1); break; } else if (tok.kind == RBRACE) { getNextToken(); tok = getToken(1); break; } else if (tok.kind == SEMICOLON) { getNextToken(); tok = getToken(1); break; } getNextToken(); } // skip white space while (true) { if (tok.kind != S) { break; } tok = getNextToken(); tok = getToken(1); } return s.toString().trim(); } JAVACODE String skip_to_matching_brace() { StringBuffer s = new StringBuffer(); Token tok; int nesting = 1; while (true) { tok = getToken(1); if (tok.kind == EOF) { break; } s.append(tok.image); if (tok.kind == LBRACE) { nesting++; } else if (tok.kind == RBRACE) { nesting--; if (nesting == 0) { break; } } getNextToken(); } return s.toString(); } /* * Here I handle all CSS2 unicode character stuffs. * I convert all \XXXXXX character into a single character. * Don't forget that the parser has recognize the token before. * (So IDENT won't contain newline and stuffs like this). */ JAVACODE String convertStringIndex(String s, int start, int len) { StringBuffer buf = new StringBuffer(len); int index = start; while (index < len) { char c = s.charAt(index); if (c == '\\') { if (++index < len) { c = s.charAt(index); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': int numValue = Character.digit(c, 16); int count = 0; int p = 16; while (index + 1 < len && count < 6) { c = s.charAt(index+1); if (Character.digit(c, 16) != -1) { numValue = (numValue * 16) + Character.digit(c, 16); p *= 16; index++; } else { if (c == ' ') { // skip the latest white space index++; } break; } } buf.append((char) numValue); break; case '\n': case '\f': break; case '\r': if (index + 1 < len) { if (s.charAt(index + 1) == '\n') { index ++; } } break; default: buf.append(c); } } else { throw new CSSParseException("invalid string " + s, getLocator()); } } else { buf.append(c); } index++; } return buf.toString(); } JAVACODE String convertIdent(String s) { return convertStringIndex(s, 0, s.length()); } JAVACODE String convertString(String s) { return convertStringIndex(s, 0, s.length()); } /* * @@HACK * I can't insert a token into the tokens flow. * It's jj_consume_token implementation dependant! :-( */ JAVACODE void rejectToken(Token t) { Token fakeToken = new Token(); t.next = token; fakeToken.next = t; token = fakeToken; } /** * skip after an expression */ JAVACODE String skipAfterExpression() { Token t = getToken(1); StringBuffer s = new StringBuffer(); s.append(getToken(0).image); while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) { s.append(t.image); getNextToken(); t = getToken(1); } return s.toString(); } /** * The following functions are useful for a DOM CSS implementation only and are * not part of the general CSS2 parser. */ void _parseRule() : {String ret = null; } { ( )* ( importDeclaration() | styleRule() | media() | page() | fontFace() | ret=skipStatement() { if ((ret == null) || (ret.length() == 0)) { return; } if (ret.charAt(0) == '@') { documentHandler.ignorableAtRule(ret); } else { throw new CSSParseException("unrecognize rule: " + ret, getLocator()); } } ) } void _parseImportRule() : { } { ( )* importDeclaration() } void _parseMediaRule() : { } { ( )* media() } void _parseDeclarationBlock() : { } { ( )* ( declaration() )? ( ";" ( )* ( declaration() )? )* } SelectorList _parseSelectors() : { SelectorList p = null; } { try { ( )* p = selectorList() { return p; } } catch (ThrowedParseException e) { throw (ParseException) e.e;//.fillInStackTrace(); } } String _parseNamespaceToken() : { Token retval = null; } { ( retval = { return retval.image; } ) | ( retval = { return retval.image; } ) } /* * Local Variables: * compile-command: javacc Parser.jj & javac Parser.java * End: */ flute-1.1.6/source/org/w3c/flute/parser/Parser.java0000644000175000017500000032465711365604770020631 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; import java.io.*; import java.net.*; import java.util.Locale; import org.w3c.css.sac.ConditionFactory; import org.w3c.css.sac.Condition; import org.w3c.css.sac.SelectorFactory; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; import org.w3c.css.sac.DocumentHandler; import org.w3c.css.sac.InputSource; import org.w3c.css.sac.ErrorHandler; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Locator; import org.w3c.css.sac.LexicalUnit; import org.w3c.flute.parser.selectors.SelectorFactoryImpl; import org.w3c.flute.parser.selectors.ConditionFactoryImpl; import org.w3c.flute.util.Encoding; /** * A CSS2 parser * * @author Philippe Le Hegaret * @version $Revision: 9877 $ */ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { // replaces all \t, \n, etc with this StringBuffer. static final StringBuffer SPACE = new StringBuffer(" "); // the document handler for the parser protected DocumentHandler documentHandler; // the error handler for the parser protected ErrorHandler errorHandler; // the input source for the parser protected InputSource source; protected ConditionFactory conditionFactory; protected SelectorFactory selectorFactory; // temporary place holder for pseudo-element ... protected String pseudoElt; /** * Creates a new Parser */ public Parser() { this((CharStream) null); } /** * @@TODO * @exception CSSException Not yet implemented */ public void setLocale(Locale locale) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Set the document handler for this parser */ public void setDocumentHandler(DocumentHandler handler) { this.documentHandler = handler; } public void setSelectorFactory(SelectorFactory selectorFactory) { this.selectorFactory = selectorFactory; } public void setConditionFactory(ConditionFactory conditionFactory) { this.conditionFactory = conditionFactory; } /** * Set the error handler for this parser */ public void setErrorHandler(ErrorHandler error) { this.errorHandler = error; } /** * Main parse methods * * @param source the source of the style sheet. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseStyleSheet(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } parserUnit(); } /** * Convenient method for URIs. * * @param systemId the fully resolved URI of the style sheet. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseStyleSheet(String systemId) throws CSSException, IOException { parseStyleSheet(new InputSource(systemId)); } /** * This method parses only one rule (style rule or at-rule, except @charset). * * @param source the source of the rule. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseRule(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseRule(); } /** * This method parses a style declaration (including the surrounding curly * braces). * * @param source the source of the style declaration. * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseDeclarationBlock(); } /** * This methods returns "http://www.w3.org/TR/REC-CSS2". * @return the string "http://www.w3.org/TR/REC-CSS2". */ public String getParserVersion() { return "http://www.w3.org/TR/REC-CSS2"; } /** * Parse methods used by DOM Level 2 implementation. */ public void parseImportRule(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseImportRule(); } public void parseMediaRule(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } _parseMediaRule(); } public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } return _parseSelectors(); } public String parseNamespaceToken(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); if (selectorFactory == null) { selectorFactory = new SelectorFactoryImpl(); } if (conditionFactory == null) { conditionFactory = new ConditionFactoryImpl(); } return _parseNamespaceToken(); } public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); return expr(); } public boolean parsePriority(InputSource source) throws CSSException, IOException { this.source = source; ReInit(getCharStreamWithLurk(source)); return prio(); } /** * Convert the source into a Reader. Used only by DOM Level 2 parser methods. */ private Reader getReader(InputSource source) throws IOException { if (source.getCharacterStream() != null) { return source.getCharacterStream(); } else if (source.getByteStream() != null) { // My DOM level 2 implementation doesn't use this case. if (source.getEncoding() == null) { // unknown encoding, use ASCII as default. return new InputStreamReader(source.getByteStream(), "ASCII"); } else { return new InputStreamReader(source.getByteStream(), source.getEncoding()); } } else { // systemId // @@TODO throw new CSSException("not yet implemented"); } } /** * Convert the source into a CharStream with encoding informations. * The encoding can be found in the InputSource or in the CSS document. * Since this method marks the reader and make a reset after looking for * the charset declaration, you'll find the charset declaration into the * stream. */ private CharStream getCharStreamWithLurk(InputSource source) throws CSSException, IOException { if (source.getCharacterStream() != null) { // all encoding are supposed to be resolved by the user // return the reader return new Generic_CharStream(source.getCharacterStream(), 1, 1); } else if (source.getByteStream() == null) { // @@CONTINUE ME. see also getReader() with systemId try { source.setByteStream(new URL(source.getURI()).openStream()); } catch (Exception e) { try { source.setByteStream(new FileInputStream(source.getURI())); } catch (IOException ex) { throw new CSSException("invalid url ?"); } } } String encoding = "ASCII"; InputStream input = source.getByteStream(); char c = ' '; if (!input.markSupported()) { input = new BufferedInputStream(input); source.setByteStream(input); } input.mark(100); c = (char) input.read(); if (c == '@') { // hum, is it a charset ? int size = 100; byte[] buf = new byte[size]; input.read(buf, 0, 7); String keyword = new String(buf, 0, 7); if (keyword.equals("charset")) { // Yes, this is the charset declaration ! // here I don't use the right declaration : white space are ' '. while ((c = (char) input.read()) == ' ') { // find the first quote } char endChar = c; int i = 0; if ((endChar != '"') && (endChar != '\'')) { // hum this is not a quote. throw new CSSException("invalid charset declaration"); } while ((c = (char) input.read()) != endChar) { buf[i++] = (byte) c; if (i == size) { byte[] old = buf; buf = new byte[size + 100]; System.arraycopy(old, 0, buf, 0, size); size += 100; } } while ((c = (char) input.read()) == ' ') { // find the next relevant character } if (c != ';') { // no semi colon at the end ? throw new CSSException("invalid charset declaration: " + "missing semi colon"); } encoding = new String(buf, 0, i); if (source.getEncoding() != null) { // compare the two encoding informations. // For example, I don't accept to have ASCII and after UTF-8. // Is it really good ? That is the question. if (!encoding.equals(source.getEncoding())) { throw new CSSException("invalid encoding information."); } } } // else no charset declaration available } // ok set the real encoding of this source. source.setEncoding(encoding); // set the real reader of this source. source.setCharacterStream(new InputStreamReader(source.getByteStream(), Encoding.getJavaEncoding(encoding))); // reset the stream (leave the charset declaration in the stream). input.reset(); return new Generic_CharStream(source.getCharacterStream(), 1, 1); } private LocatorImpl currentLocator; private Locator getLocator() { if (currentLocator == null) { currentLocator = new LocatorImpl(this); return currentLocator; } return currentLocator.reInit(this); } private LocatorImpl getLocator(Token save) { if (currentLocator == null) { currentLocator = new LocatorImpl(this, save); return currentLocator; } return currentLocator.reInit(this, save); } private void reportError(Locator l, Exception e) { if (errorHandler != null) { if (e instanceof ParseException) { // construct a clean error message. ParseException pe = (ParseException) e; if (pe.specialConstructor) { StringBuffer errorM = new StringBuffer(); if (pe.currentToken != null) { errorM.append("encountered \"") .append(pe.currentToken.next); } errorM.append('"'); if (pe.expectedTokenSequences.length != 0) { errorM.append(". Was expecting one of: "); for (int i = 0; i < pe.expectedTokenSequences.length; i++) { for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) { int kind = pe.expectedTokenSequences[i][j]; if (kind != S) { errorM.append(pe.tokenImage[kind]); errorM.append(' '); } } } } errorHandler.error(new CSSParseException(errorM.toString(), l, e)); } else { errorHandler.error(new CSSParseException(e.getMessage(), l, e)); } } else if (e == null) { errorHandler.error(new CSSParseException("error", l, null)); } else { errorHandler.error(new CSSParseException(e.getMessage(), l, e)); } } } private void reportWarningSkipText(Locator l, String text) { if (errorHandler != null && text != null) { errorHandler.warning(new CSSParseException("Skipping: " + text, l)); } } /* * 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); 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); } } } label_5: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NAMESPACE_SYM: ; break; default: jj_la1[6] = jj_gen; break label_5; } namespaceDeclaration(); label_6: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CDO: case CDC: case ATKEYWORD: ; break; default: jj_la1[7] = jj_gen; break label_6; } ignoreStatement(); label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[8] = jj_gen; break label_7; } 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_8: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[9] = jj_gen; break label_8; } jj_consume_token(S); } n = jj_consume_token(STRING); 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); } 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_10: while (true) { ; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: case ANY: case DOT: case COLON: case IDENT: case NAMESPACE_IDENT: case HASH: styleRule(); break; case MEDIA_SYM: media(); break; case PAGE_SYM: page(); break; case FONT_FACE_SYM: fontFace(); break; default: jj_la1[11] = 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_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CDO: case CDC: case ATKEYWORD: ; break; default: jj_la1[12] = jj_gen; break label_11; } ignoreStatement(); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[13] = jj_gen; break label_12; } 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[14] = 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(); try { jj_consume_token(IMPORT_SYM); label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[15] = jj_gen; break label_13; } 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); uri = n.image.substring(4, n.image.length()-1).trim(); if ((uri.charAt(0) == '"') || (uri.charAt(0) == '\'')) { uri = uri.substring(1, uri.length()-1); } break; default: jj_la1[16] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_14: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[17] = jj_gen; break label_14; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: mediaStatement(ml); break; default: jj_la1[18] = jj_gen; ; } jj_consume_token(SEMICOLON); label_15: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[19] = jj_gen; break label_15; } jj_consume_token(S); } if (ml.getLength() == 0) { // see section 6.3 of the CSS2 recommandation. ml.addItem("all"); } documentHandler.importStyle(uri, ml, null); } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } } /** * The namespace statement * * @exception ParseException exception during the parse */ final public void namespaceDeclaration() throws ParseException { Token n; Token prefix = null; String uri; try { jj_consume_token(NAMESPACE_SYM); label_16: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[20] = jj_gen; break label_16; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: prefix = jj_consume_token(IDENT); label_17: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[21] = jj_gen; break label_17; } jj_consume_token(S); } break; default: jj_la1[22] = jj_gen; ; } n = jj_consume_token(URL); uri = n.image.substring(4, n.image.length()-1).trim(); if ((uri.charAt(0) == '"') || (uri.charAt(0) == '\'')) { uri = uri.substring(1, uri.length()-1); } jj_consume_token(SEMICOLON); 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); } if (prefix == null) { this.documentHandler.namespaceDeclaration("", uri); } else { this.documentHandler.namespaceDeclaration(prefix.image, uri); } } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } } /** * @exception ParseException exception during the parse */ final public void media() throws ParseException { boolean start = false; String ret; MediaListImpl ml = new MediaListImpl(); try { jj_consume_token(MEDIA_SYM); label_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); } mediaStatement(ml); start = true; documentHandler.startMedia(ml); jj_consume_token(LBRACE); 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); } label_21: 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 DOT: case COLON: case NONASCII: case STRING: case IDENT: case NUMBER: case URL: case NAMESPACE_IDENT: 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[26] = jj_gen; break label_21; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: case ANY: case DOT: case COLON: case IDENT: case NAMESPACE_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[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RBRACE); label_22: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[28] = jj_gen; break label_22; } 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_23: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[29] = jj_gen; break label_23; } jj_consume_token(COMMA); label_24: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[30] = jj_gen; break label_24; } 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_25: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[31] = jj_gen; break label_25; } 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_26: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[32] = jj_gen; break label_26; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: n = jj_consume_token(IDENT); label_27: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[33] = jj_gen; break label_27; } jj_consume_token(S); } break; default: jj_la1[34] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COLON: pseudo = pseudo_page(); break; default: jj_la1[35] = jj_gen; ; } if (n != null) { page = convertIdent(n.image); } jj_consume_token(LBRACE); label_28: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[36] = jj_gen; break label_28; } 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[37] = jj_gen; ; } label_29: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: ; break; default: jj_la1[38] = 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[39] = jj_gen; break label_30; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[40] = jj_gen; ; } } label_31: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ATKEYWORD: ; break; default: jj_la1[41] = jj_gen; break label_31; } atRuleDeclaration(); } jj_consume_token(RBRACE); label_32: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[42] = jj_gen; break label_32; } 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_33: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[43] = jj_gen; break label_33; } 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_34: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[44] = jj_gen; break label_34; } jj_consume_token(S); } jj_consume_token(LBRACE); label_35: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[45] = jj_gen; break label_35; } jj_consume_token(S); } start = true; documentHandler.startFontFace(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[46] = jj_gen; ; } label_36: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: ; break; default: jj_la1[47] = 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[48] = jj_gen; break label_37; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[49] = jj_gen; ; } } jj_consume_token(RBRACE); label_38: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[50] = jj_gen; break label_38; } jj_consume_token(S); } } catch (ParseException e) { reportError(getLocator(), e); skipStatement(); // reportWarningSkipText(getLocator(), skipStatement()); } finally { if (start) { documentHandler.endFontFace(); } } } /** * @exception ParseException exception during the parse */ final public void atRuleDeclaration() throws ParseException { Token n; String ret; n = jj_consume_token(ATKEYWORD); ret=skipStatementNoSemicolon(); reportWarningSkipText(getLocator(), ret); if ((ret != null) && (ret.charAt(0) == '@')) { documentHandler.ignorableAtRule(ret); } } final public void skipUnknownRule() throws ParseException { Token n; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ATKEYWORD: n = jj_consume_token(ATKEYWORD); break; case CDO: n = jj_consume_token(CDO); break; case CHARSET_SYM: n = jj_consume_token(CHARSET_SYM); break; case COMMA: n = jj_consume_token(COMMA); break; case DASHMATCH: n = jj_consume_token(DASHMATCH); break; case FONT_FACE_SYM: n = jj_consume_token(FONT_FACE_SYM); break; case FUNCTION: n = jj_consume_token(FUNCTION); break; case IMPORTANT_SYM: n = jj_consume_token(IMPORTANT_SYM); break; case IMPORT_SYM: n = jj_consume_token(IMPORT_SYM); break; case INCLUDES: n = jj_consume_token(INCLUDES); break; case LBRACE: n = jj_consume_token(LBRACE); break; case MEDIA_SYM: n = jj_consume_token(MEDIA_SYM); break; case NONASCII: n = jj_consume_token(NONASCII); break; case NUMBER: n = jj_consume_token(NUMBER); break; case PAGE_SYM: n = jj_consume_token(PAGE_SYM); break; case PERCENTAGE: n = jj_consume_token(PERCENTAGE); break; case STRING: n = jj_consume_token(STRING); break; case UNICODERANGE: n = jj_consume_token(UNICODERANGE); break; case URL: n = jj_consume_token(URL); break; case SEMICOLON: n = jj_consume_token(SEMICOLON); break; case PLUS: n = jj_consume_token(PLUS); break; case PRECEDES: n = jj_consume_token(PRECEDES); break; case MINUS: n = jj_consume_token(MINUS); break; case UNKNOWN: n = jj_consume_token(UNKNOWN); break; default: jj_la1[51] = jj_gen; jj_consume_token(-1); throw new ParseException(); } String ret; Locator loc = getLocator(); ret=skipStatement(); reportWarningSkipText(loc, ret); if ((ret != null) && (n.image.charAt(0) == '@')) { documentHandler.ignorableAtRule(ret); } } /** * @exception ParseException exception during the parse */ final public char combinator() throws ParseException { char connector = ' '; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: jj_consume_token(PLUS); label_39: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[52] = jj_gen; break label_39; } jj_consume_token(S); } {if (true) return '+';} break; case PRECEDES: jj_consume_token(PRECEDES); label_40: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[53] = jj_gen; break label_40; } 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[54] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_41: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[55] = jj_gen; break label_41; } jj_consume_token(S); } break; default: jj_la1[56] = jj_gen; ; } {if (true) return connector;} break; default: jj_la1[57] = 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 property() throws ParseException { Token n; n = jj_consume_token(IDENT); label_42: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[58] = jj_gen; break label_42; } 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 styleRule() throws ParseException { boolean start = false; SelectorList l = null; Token save; Locator loc; try { l = selectorList(); save = token; jj_consume_token(LBRACE); label_43: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[59] = jj_gen; break label_43; } jj_consume_token(S); } start = true; documentHandler.startSelector(l); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[60] = jj_gen; ; } label_44: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: ; break; default: jj_la1[61] = jj_gen; break label_44; } jj_consume_token(SEMICOLON); label_45: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[62] = jj_gen; break label_45; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[63] = jj_gen; ; } } jj_consume_token(RBRACE); label_46: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[64] = jj_gen; break label_46; } 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(l); } } } final public SelectorList selectorList() throws ParseException { SelectorListImpl selectors = new SelectorListImpl(); Selector selector; selector = selector(); label_47: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[65] = jj_gen; break label_47; } jj_consume_token(COMMA); label_48: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[66] = jj_gen; break label_48; } jj_consume_token(S); } selectors.addSelector(selector); selector = selector(); } selectors.addSelector(selector); {if (true) return selectors;} throw new Error("Missing return statement in function"); } /** * @exception ParseException exception during the parse */ final public Selector selector() throws ParseException { Selector selector; char comb; try { selector = simple_selector(null, ' '); label_49: while (true) { if (jj_2_1(2)) { ; } else { break label_49; } comb = combinator(); selector = simple_selector(selector, comb); } label_50: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[67] = jj_gen; break label_50; } jj_consume_token(S); } {if (true) return selector;} } catch (ParseException e) { /* Token t = getToken(1); StringBuffer s = new StringBuffer(); s.append(getToken(0).image); while ((t.kind != COMMA) && (t.kind != SEMICOLON) && (t.kind != LBRACE) && (t.kind != EOF)) { s.append(t.image); getNextToken(); t = getToken(1); } reportWarningSkipText(getLocator(), s.toString()); */ Token t = getToken(1); while ((t.kind != COMMA) && (t.kind != SEMICOLON) && (t.kind != LBRACE) && (t.kind != EOF)) { getNextToken(); t = getToken(1); } {if (true) throw new ThrowedParseException(e);} } throw new Error("Missing return statement in function"); } /** * @exception ParseException exception during the parse */ final public Selector simple_selector(Selector selector, char comb) throws ParseException { SimpleSelector simple_current = null; Condition cond = null; pseudoElt = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ANY: case IDENT: case NAMESPACE_IDENT: simple_current = element_name(); label_51: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: case DOT: case COLON: case HASH: ; break; default: jj_la1[68] = jj_gen; break label_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[69] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; case HASH: cond = hash(cond); label_52: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: case DOT: case COLON: ; break; default: jj_la1[70] = jj_gen; break label_52; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOT: cond = _class(cond); break; case LBRACKET: cond = attrib(cond); break; case COLON: cond = pseudo(cond); break; default: jj_la1[71] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; case DOT: cond = _class(cond); label_53: 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_53; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case HASH: cond = hash(cond); break; case DOT: cond = _class(cond); break; case LBRACKET: cond = attrib(cond); break; case COLON: cond = pseudo(cond); break; default: jj_la1[73] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; case COLON: cond = pseudo(cond); label_54: 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_54; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case HASH: cond = hash(cond); break; case DOT: cond = _class(cond); break; case LBRACKET: cond = attrib(cond); break; case COLON: cond = pseudo(cond); break; default: jj_la1[75] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; case LBRACKET: cond = attrib(cond); label_55: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: case DOT: case COLON: case HASH: ; break; default: jj_la1[76] = jj_gen; break label_55; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case HASH: cond = hash(cond); break; case DOT: cond = _class(cond); break; case LBRACKET: cond = attrib(cond); break; case COLON: cond = pseudo(cond); break; default: jj_la1[77] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; default: jj_la1[78] = jj_gen; jj_consume_token(-1); throw new ParseException(); } if (simple_current == null) { simple_current = selectorFactory.createElementSelector(null, null); } if (cond != null) { simple_current = selectorFactory.createConditionalSelector(simple_current, cond); } if (selector != null) { switch (comb) { case ' ': selector = selectorFactory.createDescendantSelector(selector, simple_current); break; case '+': selector = selectorFactory.createDirectAdjacentSelector((short) 1, selector, simple_current); break; case '>': selector = selectorFactory.createChildSelector(selector, simple_current); break; default: {if (true) throw new ParseException("invalid state. send a bug report");} } } else { selector= simple_current; } if (pseudoElt != null) { selector = selectorFactory.createChildSelector(selector, selectorFactory.createPseudoElementSelector(null, pseudoElt)); } {if (true) return selector;} throw new Error("Missing return statement in function"); } /** * @exception ParseException exception during the parse */ final public Condition _class(Condition pred) throws ParseException { Token n; Condition c; jj_consume_token(DOT); n = jj_consume_token(IDENT); c = conditionFactory.createClassCondition(null, n.image); if (pred == null) { {if (true) return c;} } else { {if (true) return conditionFactory.createAndCondition(pred, c);} } throw new Error("Missing return statement in function"); } /** * @exception ParseException exception during the parse */ final public SimpleSelector element_name() throws ParseException { Token n; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: n = jj_consume_token(IDENT); {if (true) return selectorFactory.createElementSelector(null, convertIdent(n.image));} break; case NAMESPACE_IDENT: n = jj_consume_token(NAMESPACE_IDENT); {if (true) return selectorFactory.createElementSelector(null, convertIdent(n.image));} break; case ANY: jj_consume_token(ANY); {if (true) return selectorFactory.createElementSelector(null, null);} break; default: jj_la1[79] = 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 Condition attrib(Condition pred) throws ParseException { int cases = 0; Token att = null; Token val = null; String attValue = null; jj_consume_token(LBRACKET); label_56: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[80] = jj_gen; break label_56; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: att = jj_consume_token(IDENT); break; case NAMESPACE_IDENT: att = jj_consume_token(NAMESPACE_IDENT); break; default: jj_la1[81] = 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[82] = jj_gen; break label_57; } 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[83] = 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[84] = jj_gen; break label_58; } 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 = convertStringIndex(val.image, 1, val.image.length() -1); break; default: jj_la1[85] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_59: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[86] = jj_gen; break label_59; } jj_consume_token(S); } break; default: jj_la1[87] = jj_gen; ; } jj_consume_token(RBRACKET); String name = convertIdent(att.image); Condition c; switch (cases) { case 0: c = conditionFactory.createAttributeCondition(name, null, false, null); break; case 1: c = conditionFactory.createAttributeCondition(name, null, false, attValue); break; case 2: c = conditionFactory.createOneOfAttributeCondition(name, null, false, attValue); break; case 3: c = conditionFactory.createBeginHyphenAttributeCondition(name, null, false, attValue); break; default: // never reached. c = null; } if (pred == null) { {if (true) return c;} } else { {if (true) return conditionFactory.createAndCondition(pred, c);} } throw new Error("Missing return statement in function"); } /** * @exception ParseException exception during the parse */ final public Condition pseudo(Condition pred) throws ParseException { Token n; Token language; jj_consume_token(COLON); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: n = jj_consume_token(IDENT); String s = convertIdent(n.image); if (s.equals("first-letter") || s.equals("first-line")) { if (pseudoElt != null) { {if (true) throw new CSSParseException("duplicate pseudo element definition " + s, getLocator());} } else { pseudoElt = s; {if (true) return pred;} } } else { Condition c = conditionFactory.createPseudoClassCondition(null, s); if (pred == null) { {if (true) return c;} } else { {if (true) return conditionFactory.createAndCondition(pred, c);} } } break; case FUNCTION: n = jj_consume_token(FUNCTION); label_60: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[88] = jj_gen; break label_60; } jj_consume_token(S); } language = jj_consume_token(IDENT); label_61: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[89] = jj_gen; break label_61; } jj_consume_token(S); } jj_consume_token(LPARAN); String f = convertIdent(n.image); if (f.equals("lang(")) { Condition d = conditionFactory.createLangCondition(convertIdent(language.image)); if (pred == null) { {if (true) return d;} } else { {if (true) return conditionFactory.createAndCondition(pred, d);} } } else { {if (true) throw new CSSParseException("invalid pseudo function name " + f, getLocator());} } break; default: jj_la1[90] = 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 Condition hash(Condition pred) throws ParseException { Token n; n = jj_consume_token(HASH); Condition d = conditionFactory.createIdCondition(n.image.substring(1)); if (pred == null) { {if (true) return d;} } else { {if (true) return conditionFactory.createAndCondition(pred, d);} } throw new Error("Missing return statement in function"); } /** * @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_62: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[91] = jj_gen; break label_62; } jj_consume_token(S); } exp = expr(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IMPORTANT_SYM: important = prio(); break; default: jj_la1[92] = 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_63: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[93] = jj_gen; break label_63; } 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_64: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[94] = jj_gen; break label_64; } jj_consume_token(S); } {if (true) return LexicalUnitImpl.createSlash(n.beginLine, n.beginColumn, prev);} break; case COMMA: n = jj_consume_token(COMMA); label_65: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[95] = jj_gen; break label_65; } jj_consume_token(S); } {if (true) return LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, prev);} break; default: jj_la1[96] = 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 LexicalUnit expr() throws ParseException { LexicalUnitImpl first, res; char op; first = term(null); res = first; label_66: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: case COMMA: case DIV: case STRING: case IDENT: case NUMBER: case URL: case NAMESPACE_IDENT: 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[97] = jj_gen; break label_66; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: case DIV: res = operator(res); break; default: jj_la1[98] = 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[99] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } /** * @exception ParseException exception during the parse */ final public LexicalUnitImpl term(LexicalUnitImpl prev) throws ParseException { LexicalUnitImpl result = null; Token n = null; char op = ' '; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: case 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[100] = 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[101] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; case STRING: case IDENT: case URL: case NAMESPACE_IDENT: 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 NAMESPACE_IDENT: n = jj_consume_token(NAMESPACE_IDENT); result = LexicalUnitImpl.createIdent (n.beginLine, n.beginColumn, prev, convertIdent(n.image)); 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, s); } /* / Auto correction code used in the CSS Validator but must not be used by a conformant CSS2 parser. * Common error : * H1 { * color : black * background : white * } * Token t = getToken(1); Token semicolon = new Token(); semicolon.kind = SEMICOLON; semicolon.image = ";"; if (t.kind == COLON) { // @@SEEME. (generate a warning?) // @@SEEME if expression is a single ident, generate an error ? rejectToken(semicolon); result = prev; } / */ break; case HASH: result = hexcolor(prev); break; case URL: result = url(prev); break; case UNICODERANGE: result = unicode(prev); break; default: jj_la1[102] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[103] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_67: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[104] = jj_gen; break label_67; } jj_consume_token(S); } {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_68: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[105] = jj_gen; break label_68; } 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 NAMESPACE_IDENT: 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[106] = jj_gen; ; } jj_consume_token(LPARAN); if (operator != ' ') { {if (true) throw new CSSParseException("invalid operator before a function.", getLocator());} } String f = convertIdent(n.image); LexicalUnitImpl l = (LexicalUnitImpl) params; boolean loop = true; if ("rgb(".equals(f)) { // this is a RGB declaration (e.g. rgb(255, 50%, 0) ) int i = 0; while (loop && l != null && i < 5) { switch (i) { case 0: case 2: case 4: if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER) && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) { loop = false; } break; case 1: case 3: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: {if (true) throw new ParseException("implementation error");} } if (loop) { l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } } if ((i == 5) && loop && (l == null)) { {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine, n.beginColumn, prev, params);} } else { if (errorHandler != null) { String errorText; Locator loc; if (i < 5) { if (params == null) { loc = new LocatorImpl(this, n.beginLine, n.beginColumn-1); errorText = "not enough parameters."; } else if (l == null) { loc = new LocatorImpl(this, n.beginLine, n.beginColumn-1); errorText = "not enough parameters: " + params.toString(); } else { loc = new LocatorImpl(this, l.getLineNumber(), l.getColumnNumber()); errorText = "invalid parameter: " + l.toString(); } } else { loc = new LocatorImpl(this, l.getLineNumber(), l.getColumnNumber()); errorText = "too many parameters: " + l.toString(); } errorHandler.error(new CSSParseException(errorText, loc)); } {if (true) throw new JumpException();} } } else if ("counter".equals(f)) { int i = 0; while (loop && l != null && i < 3) { switch (i) { case 0: case 2: if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { loop = false; } break; case 1: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: {if (true) throw new ParseException("implementation error");} } l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } if (((i == 1) || (i == 3)) && loop && (l == null)) { {if (true) return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn, prev, params);} } } else if ("counters(".equals(f)) { int i = 0; while (loop && l != null && i < 5) { switch (i) { case 0: case 4: if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { loop = false; } break; case 2: if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) { loop = false; } break; case 1: case 3: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: {if (true) throw new ParseException("implementation error");} } l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } if (((i == 3) || (i == 5)) && loop && (l == null)) { {if (true) return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn, prev, params);} } } else if ("attr(".equals(f)) { if ((l != null) && (l.getNextLexicalUnit() == null) && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) { {if (true) return LexicalUnitImpl.createAttr(l.getLineNumber(), l.getColumnNumber(), prev, l.getStringValue());} } } else if ("rect(".equals(f)) { int i = 0; while (loop && l != null && i < 7) { switch (i) { case 0: case 2: case 4: case 6: switch (l.getLexicalUnitType()) { case LexicalUnit.SAC_INTEGER: if (l.getIntegerValue() != 0) { loop = false; } break; case LexicalUnit.SAC_IDENT: if (!l.getStringValue().equals("auto")) { loop = false; } break; case LexicalUnit.SAC_EM: case LexicalUnit.SAC_EX: case LexicalUnit.SAC_PIXEL: case LexicalUnit.SAC_CENTIMETER: case LexicalUnit.SAC_MILLIMETER: case LexicalUnit.SAC_INCH: case LexicalUnit.SAC_POINT: case LexicalUnit.SAC_PICA: // nothing break; default: loop = false; } break; case 1: case 3: case 5: if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { loop = false; } break; default: {if (true) throw new ParseException("implementation error");} } l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; } if ((i == 7) && loop && (l == null)) { {if (true) return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn, prev, params);} } } {if (true) return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev, f.substring(0, f.length() -1), params);} throw new Error("Missing return statement in function"); } final public LexicalUnitImpl unicode(LexicalUnitImpl prev) throws ParseException { Token n; n = jj_consume_token(UNICODERANGE); LexicalUnitImpl params = null; String s = n.image.substring(2); int index = s.indexOf('-'); if (index == -1) { params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, Integer.parseInt(s, 16)); } else { String s1 = s.substring(0, index); String s2 = s.substring(index); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, Integer.parseInt(s1, 16)); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, Integer.parseInt(s2, 16)); } {if (true) return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn, prev, params);} throw new Error("Missing return statement in function"); } final public LexicalUnitImpl url(LexicalUnitImpl prev) throws ParseException { Token n; n = jj_consume_token(URL); String urlname = n.image.substring(4, n.image.length()-1).trim(); if (urlname.charAt(0) == '"' || urlname.charAt(0) == '\'') { urlname = urlname.substring(1, urlname.length()-1); } {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) { String sh = s.substring(0,1); r = Integer.parseInt(sh+sh, 16); first = params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); sh = s.substring(1,2); r = Integer.parseInt(sh+sh, 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); sh = s.substring(2,3); r = Integer.parseInt(sh+sh, 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); } else if (s.length() == 6) { r = Integer.parseInt(s.substring(0,2), 16); first = params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); r = Integer.parseInt(s.substring(2,4), 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn, params); r = Integer.parseInt(s.substring(4,6), 16); params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn, params, r); } else { first = null; {if (true) throw new CSSParseException("invalid hexadecimal notation for RGB: " + s, getLocator());} } {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine, n.beginColumn, prev, first);} 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 skipStatementNoSemicolon() 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; } getNextToken(); } // skip white space while (true) { if (tok.kind != S) { break; } tok = getNextToken(); tok = getToken(1); } return s.toString().trim(); } String skipStatement() throws ParseException { StringBuffer s = new StringBuffer(); Token tok = getToken(0); if (tok.image != null) { s.append(tok.image); } while (true) { tok = getToken(1); if (tok.kind == EOF) { return null; } s.append(tok.image); if (tok.kind == LBRACE) { getNextToken(); s.append(skip_to_matching_brace()); getNextToken(); tok = getToken(1); break; } else if (tok.kind == RBRACE) { getNextToken(); tok = getToken(1); break; } else if (tok.kind == SEMICOLON) { getNextToken(); tok = getToken(1); break; } getNextToken(); } // skip white space while (true) { if (tok.kind != S) { break; } tok = getNextToken(); tok = getToken(1); } return s.toString().trim(); } String skip_to_matching_brace() throws ParseException { StringBuffer s = new StringBuffer(); Token tok; int nesting = 1; while (true) { tok = getToken(1); if (tok.kind == EOF) { break; } s.append(tok.image); if (tok.kind == LBRACE) { nesting++; } else if (tok.kind == RBRACE) { nesting--; if (nesting == 0) { break; } } getNextToken(); } return s.toString(); } String convertStringIndex(String s, int start, int len) throws ParseException { StringBuffer buf = new StringBuffer(len); int index = start; while (index < len) { char c = s.charAt(index); if (c == '\\') { if (++index < len) { c = s.charAt(index); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': int numValue = Character.digit(c, 16); int count = 0; int p = 16; while (index + 1 < len && count < 6) { c = s.charAt(index+1); if (Character.digit(c, 16) != -1) { numValue = (numValue * 16) + Character.digit(c, 16); p *= 16; index++; } else { if (c == ' ') { // skip the latest white space index++; } break; } } buf.append((char) numValue); break; case '\n': case '\f': break; case '\r': if (index + 1 < len) { if (s.charAt(index + 1) == '\n') { index ++; } } break; default: buf.append(c); } } else { throw new CSSParseException("invalid string " + s, getLocator()); } } else { buf.append(c); } index++; } return buf.toString(); } String convertIdent(String s) throws ParseException { return convertStringIndex(s, 0, s.length()); } String convertString(String s) throws ParseException { return convertStringIndex(s, 0, s.length()); } void rejectToken(Token t) throws ParseException { Token fakeToken = new Token(); t.next = token; fakeToken.next = t; token = fakeToken; } String skipAfterExpression() throws ParseException { Token t = getToken(1); StringBuffer s = new StringBuffer(); s.append(getToken(0).image); while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) { s.append(t.image); getNextToken(); t = getToken(1); } return s.toString(); } /** * The following functions are useful for a DOM CSS implementation only and are * not part of the general CSS2 parser. */ final public void _parseRule() throws ParseException { String ret = null; label_69: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[107] = jj_gen; break label_69; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IMPORT_SYM: importDeclaration(); break; case LBRACKET: case ANY: case DOT: case COLON: case IDENT: case NAMESPACE_IDENT: case HASH: styleRule(); break; case MEDIA_SYM: media(); break; case PAGE_SYM: page(); break; case FONT_FACE_SYM: fontFace(); break; default: jj_la1[108] = 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_70: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[109] = jj_gen; break label_70; } jj_consume_token(S); } importDeclaration(); } final public void _parseMediaRule() throws ParseException { label_71: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[110] = jj_gen; break label_71; } jj_consume_token(S); } media(); } final public void _parseDeclarationBlock() throws ParseException { label_72: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[111] = jj_gen; break label_72; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[112] = jj_gen; ; } label_73: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: ; break; default: jj_la1[113] = jj_gen; break label_73; } jj_consume_token(SEMICOLON); label_74: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[114] = jj_gen; break label_74; } jj_consume_token(S); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: declaration(); break; default: jj_la1[115] = jj_gen; ; } } } final public SelectorList _parseSelectors() throws ParseException { SelectorList p = null; try { label_75: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: ; break; default: jj_la1[116] = jj_gen; break label_75; } jj_consume_token(S); } p = selectorList(); {if (true) return p;} } catch (ThrowedParseException e) { {if (true) throw (ParseException) e.e;}//.fillInStackTrace(); } throw new Error("Missing return statement in function"); } final public String _parseNamespaceToken() throws ParseException { Token retval = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NAMESPACE_IDENT: retval = jj_consume_token(NAMESPACE_IDENT); {if (true) return retval.image;} break; case IDENT: retval = jj_consume_token(IDENT); {if (true) return retval.image;} break; default: jj_la1[117] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } final 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); } } final private boolean jj_3R_92() { if (jj_scan_token(PLUS)) return true; return false; } final private boolean jj_3R_86() { Token xsp; xsp = jj_scanpos; if (jj_3R_92()) { jj_scanpos = xsp; if (jj_3R_93()) return true; } return false; } final private boolean jj_3R_85() { if (jj_3R_91()) return true; return false; } final private boolean jj_3R_91() { if (jj_scan_token(LBRACKET)) return true; return false; } final private boolean jj_3R_79() { 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; } final private boolean jj_3R_80() { if (jj_scan_token(S)) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_86()) jj_scanpos = xsp; return false; } final private boolean jj_3R_78() { 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; } final private boolean jj_3R_76() { Token xsp; xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; if (jj_3R_79()) { jj_scanpos = xsp; if (jj_3R_80()) return true; } } return false; } final private boolean jj_3R_84() { if (jj_3R_90()) return true; return false; } final private boolean jj_3R_83() { if (jj_3R_89()) return true; return false; } final private boolean jj_3R_96() { if (jj_scan_token(ANY)) return true; return false; } final private boolean jj_3_1() { if (jj_3R_76()) return true; if (jj_3R_77()) return true; return false; } final private boolean jj_3R_95() { if (jj_scan_token(NAMESPACE_IDENT)) return true; return false; } final private boolean jj_3R_90() { if (jj_scan_token(COLON)) return true; return false; } final private boolean jj_3R_82() { if (jj_3R_88()) return true; return false; } final private boolean jj_3R_88() { if (jj_scan_token(HASH)) return true; return false; } final private boolean jj_3R_94() { if (jj_scan_token(IDENT)) return true; return false; } final private boolean jj_3R_87() { Token xsp; xsp = jj_scanpos; if (jj_3R_94()) { jj_scanpos = xsp; if (jj_3R_95()) { jj_scanpos = xsp; if (jj_3R_96()) return true; } } return false; } final private boolean jj_3R_81() { if (jj_3R_87()) return true; return false; } final private boolean jj_3R_77() { Token xsp; xsp = jj_scanpos; if (jj_3R_81()) { jj_scanpos = xsp; if (jj_3R_82()) { jj_scanpos = xsp; if (jj_3R_83()) { jj_scanpos = xsp; if (jj_3R_84()) { jj_scanpos = xsp; if (jj_3R_85()) return true; } } } } return false; } final private boolean jj_3R_93() { if (jj_scan_token(PRECEDES)) return true; return false; } final private boolean jj_3R_89() { if (jj_scan_token(DOT)) return true; return false; } public ParserTokenManager token_source; public Token token, jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; public boolean lookingAhead = false; private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[118]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; static { jj_la1_0(); jj_la1_1(); jj_la1_2(); } private static void jj_la1_0() { jj_la1_0 = new int[] {0x0,0x62,0x62,0x0,0x60,0x2,0x0,0x60,0x2,0x2,0x2,0x1340000,0x60,0x2,0x60,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x0,0x2,0x2,0x2,0x335f6a0,0x335f6a0,0x2,0x4000,0x2,0x2,0x2,0x2,0x0,0x1000000,0x2,0x0,0x8000,0x2,0x0,0x0,0x2,0x2,0x2,0x2,0x0,0x8000,0x2,0x0,0x2,0x201f6a0,0x2,0x2,0x11000,0x2,0x11000,0x11002,0x2,0x2,0x0,0x8000,0x2,0x0,0x2,0x4000,0x2,0x2,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1340000,0x100000,0x2,0x0,0x2,0xe00,0x2,0x0,0x2,0xe00,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x24000,0x27000,0x24000,0x3000,0x3000,0x0,0x0,0x3000,0x2,0x2,0x3000,0x2,0x1340000,0x2,0x2,0x2,0x0,0x8000,0x2,0x0,0x2,0x0,}; } private static void jj_la1_1() { jj_la1_1 = new int[] {0x20000000,0x0,0x0,0x8000000,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x54000110,0x0,0x0,0x0,0x0,0x88,0x0,0x10,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x7c0003b8,0x7c0003b8,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x780002a8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x4000000,0x4000000,0x0,0x0,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000110,0x110,0x0,0x110,0x0,0x0,0x0,0x18,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffb8,0x0,0x0,0x0,0x3fffe20,0x4000198,0x7ffffb8,0x0,0x0,0x7ffffb8,0x0,0x5c000110,0x0,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x110,}; } private static void jj_la1_2() { jj_la1_2 = new int[] {0x0,0x2,0x2,0x0,0x2,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x2,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7007,0x7007,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7007,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,0x2000,0x0,0x4,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x2000,0x1000,0x3000,0x0,0x0,0x3000,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[1]; private boolean jj_rescan = false; private int jj_gc = 0; public Parser(CharStream stream) { token_source = new ParserTokenManager(stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 118; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(CharStream stream) { token_source.ReInit(stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 118; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public Parser(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 118; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 118; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } final 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(); final 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; } 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; } final public Token getToken(int index) { Token t = lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } final 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.Vector jj_expentries = new java.util.Vector(); 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]; } boolean exists = false; for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { int[] oldentry = (int[])(e.nextElement()); if (oldentry.length == jj_expentry.length) { exists = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { exists = false; break; } } if (exists) break; } } if (!exists) jj_expentries.addElement(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[79]; for (int i = 0; i < 79; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 118; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; } } p = p.next; } while (p != null); } jj_rescan = false; } final 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; } } flute-1.1.6/source/org/w3c/flute/parser/Selectors.java0000644000175000017500000000332111365604770021316 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 1999 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.Selector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ class Selectors implements SelectorList { Selector[] selectors = new Selector[5]; int current; public Selector item(int index) { if ((index < 0) || (index >= current)) { return null; } return selectors[index]; } public Selector itemSelector(int index) { if ((index < 0) || (index >= current)) { return null; } return selectors[index]; } public int getLength() { return current; } void addSelector(Selector selector) { if (current == selectors.length) { Selector[] old = selectors; selectors = new Selector[old.length + old.length]; System.arraycopy(old, 0, selectors, 0, old.length); } selectors[current++] = selector; } } flute-1.1.6/source/org/w3c/flute/parser/SelectorListImpl.java0000644000175000017500000000333011365604770022611 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 1999 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.Selector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ class SelectorListImpl implements SelectorList { Selector[] selectors = new Selector[5]; int current; public Selector item(int index) { if ((index < 0) || (index >= current)) { return null; } return selectors[index]; } public Selector itemSelector(int index) { if ((index < 0) || (index >= current)) { return null; } return selectors[index]; } public int getLength() { return current; } void addSelector(Selector selector) { if (current == selectors.length) { Selector[] old = selectors; selectors = new Selector[old.length + old.length]; System.arraycopy(old, 0, selectors, 0, old.length); } selectors[current++] = selector; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/0000755000175000017500000000000011365604770020514 5ustar renereneflute-1.1.6/source/org/w3c/flute/parser/selectors/IdConditionImpl.java0000644000175000017500000000547211365604770024414 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class IdConditionImpl implements AttributeCondition { String value; /** * Creates a new AttributeConditionImpl */ public IdConditionImpl(String value) { this.value = value; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_ID_CONDITION; } /** * Returns the * namespace * URI of this attribute condition. *

NULL if : *

    *
  • this attribute condition can match any namespace. *
  • this attribute is an id attribute. *
*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this attribute. *

NULL if : *

    *
  • this attribute condition can match any attribute. *

  • this attribute is a class attribute. *

  • this attribute is an id attribute. *

  • this attribute is a pseudo-class attribute. *

*/ public String getLocalName() { return null; } /** * Returns true if the attribute must have an explicit value * in the original document, false otherwise. */ public boolean getSpecified() { return false; } /** * Returns the value of the attribute. * If this attribute is a class or a pseudo class attribute, you'll get * the class name (or psedo class name) without the '.' or ':'. */ public String getValue() { return value; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java0000644000175000017500000000400311365604770026142 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.ConditionalSelector; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class ConditionalSelectorImpl implements ConditionalSelector { SimpleSelector simpleSelector; Condition condition; /** * An integer indicating the type of Selector */ public short getSelectorType() { return Selector.SAC_CONDITIONAL_SELECTOR; } /** * Creates a new ConditionalSelectorImpl */ public ConditionalSelectorImpl(SimpleSelector simpleSelector, Condition condition) { this.simpleSelector = simpleSelector; this.condition = condition; } /** * Returns the simple selector. *

The simple selector can't be a ConditionalSelector.

*/ public SimpleSelector getSimpleSelector() { return simpleSelector; } /** * Returns the condition to be applied on the simple selector. */ public Condition getCondition() { return condition; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java0000644000175000017500000000552511365604770026304 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class PseudoClassConditionImpl implements AttributeCondition { String value; /** * Creates a new AttributeConditionImpl */ public PseudoClassConditionImpl(String value) { this.value = value; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_PSEUDO_CLASS_CONDITION; } /** * Returns the * namespace * URI of this attribute condition. *

NULL if : *

    *
  • this attribute condition can match any namespace. *
  • this attribute is an id attribute. *
*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this attribute. *

NULL if : *

    *
  • this attribute condition can match any attribute. *

  • this attribute is a class attribute. *

  • this attribute is an id attribute. *

  • this attribute is a pseudo-class attribute. *

*/ public String getLocalName() { return null; } /** * Returns true if the attribute must have an explicit value * in the original document, false otherwise. */ public boolean getSpecified() { return true; } /** * Returns the value of the attribute. * If this attribute is a class or a pseudo class attribute, you'll get * the class name (or psedo class name) without the '.' or ':'. */ public String getValue() { return value; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java0000644000175000017500000000416011365604770026454 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.ElementSelector; import org.w3c.css.sac.Selector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class PseudoElementSelectorImpl implements ElementSelector { String localName; /** * Creates a new ElementSelectorImpl */ public PseudoElementSelectorImpl(String localName) { this.localName = localName; } /** * An integer indicating the type of Selector */ public short getSelectorType() { return Selector.SAC_PSEUDO_ELEMENT_SELECTOR; } /** * Returns the * namespace * URI of this element selector. *

NULL if this element selector can match any namespace.

*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this element. *

NULL if this element selector can match any element.

* */ public String getLocalName() { return localName; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java0000644000175000017500000001651111365604770025315 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.SelectorFactory; import org.w3c.css.sac.ConditionalSelector; import org.w3c.css.sac.NegativeSelector; import org.w3c.css.sac.SimpleSelector; import org.w3c.css.sac.ElementSelector; import org.w3c.css.sac.CharacterDataSelector; import org.w3c.css.sac.ProcessingInstructionSelector; import org.w3c.css.sac.SiblingSelector; import org.w3c.css.sac.DescendantSelector; import org.w3c.css.sac.Selector; import org.w3c.css.sac.Condition; import org.w3c.css.sac.CSSException; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class SelectorFactoryImpl implements SelectorFactory { /** * Creates a conditional selector. * * @param selector a selector. * @param condition a condition * @return the conditional selector. * @exception CSSException If this selector is not supported. */ public ConditionalSelector createConditionalSelector(SimpleSelector selector, Condition condition) throws CSSException { return new ConditionalSelectorImpl(selector, condition); } /** * Creates an any node selector. * * @return the any node selector. * @exception CSSException If this selector is not supported. */ public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates an root node selector. * * @return the root node selector. * @exception CSSException If this selector is not supported. */ public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates an negative selector. * * @param selector a selector. * @return the negative selector. * @exception CSSException If this selector is not supported. */ public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates an element selector. * * @param namespaceURI the namespace * URI of the element selector. * @param tagName the local * part of the element name. NULL if this element * selector can match any element.

* @return the element selector * @exception CSSException If this selector is not supported. */ public ElementSelector createElementSelector(String namespaceURI, String localName) throws CSSException { if (namespaceURI != null) { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } else { return new ElementSelectorImpl(localName); } } /** * Creates a text node selector. * * @param data the data * @return the text node selector * @exception CSSException If this selector is not supported. */ public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a cdata section node selector. * * @param data the data * @return the cdata section node selector * @exception CSSException If this selector is not supported. */ public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a processing instruction node selector. * * @param target the target * @param data the data * @return the processing instruction node selector * @exception CSSException If this selector is not supported. */ public ProcessingInstructionSelector createProcessingInstructionSelector(String target, String data) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a comment node selector. * * @param data the data * @return the comment node selector * @exception CSSException If this selector is not supported. */ public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a pseudo element selector. * * @param pseudoName the pseudo element name. NULL if this * element selector can match any pseudo element.

* @return the element selector * @exception CSSException If this selector is not supported. */ public ElementSelector createPseudoElementSelector(String namespaceURI, String pseudoName) throws CSSException { if (namespaceURI != null) { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } else { return new PseudoElementSelectorImpl(pseudoName); } } /** * Creates a descendant selector. * * @param parent the parent selector * @param descendant the descendant selector * @return the combinator selector. * @exception CSSException If this selector is not supported. */ public DescendantSelector createDescendantSelector(Selector parent, SimpleSelector descendant) throws CSSException { return new DescendantSelectorImpl(parent, descendant); } /** * Creates a child selector. * * @param parent the parent selector * @param child the child selector * @return the combinator selector. * @exception CSSException If this selector is not supported. */ public DescendantSelector createChildSelector(Selector parent, SimpleSelector child) throws CSSException { return new ChildSelectorImpl(parent, child); } /** * Creates a direct adjacent selector. * * @param child the child selector * @param adjacent the direct adjacent selector * @return the combinator selector. * @exception CSSException If this selector is not supported. */ public SiblingSelector createDirectAdjacentSelector(short nodeType, Selector child, SimpleSelector directAdjacent) throws CSSException { if (nodeType != 1) { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } else { return new DirectAdjacentSelectorImpl(child, directAdjacent); } } } flute-1.1.6/source/org/w3c/flute/parser/selectors/LangConditionImpl.java0000644000175000017500000000276611365604770024744 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.LangCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class LangConditionImpl implements LangCondition { String lang; /** * Creates a new LangConditionImpl */ public LangConditionImpl(String lang) { this.lang = lang; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_LANG_CONDITION; } /** * Returns the language */ public String getLang() { return lang; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java0000644000175000017500000000570311365604770030141 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class BeginHyphenAttributeConditionImpl implements AttributeCondition { String localName; String value; /** * Creates a new AttributeConditionImpl */ public BeginHyphenAttributeConditionImpl(String localName, String value) { this.localName = localName; this.value = value; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_BEGIN_HYPHEN_ATTRIBUTE_CONDITION; } /** * Returns the * namespace * URI of this attribute condition. *

NULL if : *

    *
  • this attribute condition can match any namespace. *
  • this attribute is an id attribute. *
*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this attribute. *

NULL if : *

    *
  • this attribute condition can match any attribute. *

  • this attribute is a class attribute. *

  • this attribute is an id attribute. *

  • this attribute is a pseudo-class attribute. *

*/ public String getLocalName() { return localName; } /** * Returns true if the attribute must have an explicit value * in the original document, false otherwise. */ public boolean getSpecified() { return false; } /** * Returns the value of the attribute. * If this attribute is a class or a pseudo class attribute, you'll get * the class name (or psedo class name) without the '.' or ':'. */ public String getValue() { return value; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/AttributeConditionImpl.java0000644000175000017500000000564011365604770026020 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class AttributeConditionImpl implements AttributeCondition { String localName; String value; /** * Creates a new AttributeConditionImpl */ public AttributeConditionImpl(String localName, String value) { this.localName = localName; this.value = value; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_ATTRIBUTE_CONDITION; } /** * Returns the * namespace * URI of this attribute condition. *

NULL if : *

    *
  • this attribute condition can match any namespace. *
  • this attribute is an id attribute. *
*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this attribute. *

NULL if : *

    *
  • this attribute condition can match any attribute. *

  • this attribute is a class attribute. *

  • this attribute is an id attribute. *

  • this attribute is a pseudo-class attribute. *

*/ public String getLocalName() { return localName; } /** * Returns true if the attribute must have an explicit value * in the original document, false otherwise. */ public boolean getSpecified() { return false; } /** * Returns the value of the attribute. * If this attribute is a class or a pseudo class attribute, you'll get * the class name (or psedo class name) without the '.' or ':'. */ public String getValue() { return value; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java0000644000175000017500000000353011365604770025753 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.DescendantSelector; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class DescendantSelectorImpl implements DescendantSelector { Selector parent; SimpleSelector simpleSelector; /** * An integer indicating the type of Selector */ public short getSelectorType() { return Selector.SAC_DESCENDANT_SELECTOR; } /** * Creates a new DescendantSelectorImpl */ public DescendantSelectorImpl(Selector parent, SimpleSelector simpleSelector) { this.parent = parent; this.simpleSelector = simpleSelector; } /** * Returns the parent selector. */ public Selector getAncestorSelector() { return parent; } /* * Returns the simple selector. */ public SimpleSelector getSimpleSelector() { return simpleSelector; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/ElementSelectorImpl.java0000644000175000017500000000414211365604770025274 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.ElementSelector; import org.w3c.css.sac.Selector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class ElementSelectorImpl implements ElementSelector { String localName; /** * Creates a new ElementSelectorImpl */ public ElementSelectorImpl(String localName) { this.localName = localName; } /** * An integer indicating the type of Selector */ public short getSelectorType() { return Selector.SAC_ELEMENT_NODE_SELECTOR; } /** * Returns the * namespace * URI of this element selector. *

NULL if this element selector can match any namespace.

*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this element. *

NULL if this element selector can match any element.

* */ public String getLocalName() { return localName; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/ChildSelectorImpl.java0000644000175000017500000000342711365604770024733 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.DescendantSelector; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class ChildSelectorImpl implements DescendantSelector { Selector parent; SimpleSelector child; /** * An integer indicating the type of Selector */ public short getSelectorType() { return Selector.SAC_CHILD_SELECTOR; } /** * Creates a new ChildSelectorImpl */ public ChildSelectorImpl(Selector parent, SimpleSelector child) { this.parent = parent; this.child = child; } /** * Returns the parent selector. */ public Selector getAncestorSelector() { return parent; } /* * Returns the simple selector. */ public SimpleSelector getSimpleSelector() { return child; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java0000644000175000017500000000362011365604770026547 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.SiblingSelector; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class DirectAdjacentSelectorImpl implements SiblingSelector { Selector child; SimpleSelector directAdjacent; /** * An integer indicating the type of Selector */ public short getSelectorType() { return Selector.SAC_DIRECT_ADJACENT_SELECTOR; } /** * Creates a new DescendantSelectorImpl */ public DirectAdjacentSelectorImpl(Selector child, SimpleSelector directAdjacent) { this.child = child; this.directAdjacent = directAdjacent; } public short getNodeType() { return 1; } /** * Returns the parent selector. */ public Selector getSelector() { return child; } /* * Returns the simple selector. */ public SimpleSelector getSiblingSelector() { return directAdjacent; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java0000644000175000017500000000566111365604770026752 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class OneOfAttributeConditionImpl implements AttributeCondition { String localName; String value; /** * Creates a new AttributeConditionImpl */ public OneOfAttributeConditionImpl(String localName, String value) { this.localName = localName; this.value = value; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_ONE_OF_ATTRIBUTE_CONDITION; } /** * Returns the * namespace * URI of this attribute condition. *

NULL if : *

    *
  • this attribute condition can match any namespace. *
  • this attribute is an id attribute. *
*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this attribute. *

NULL if : *

    *
  • this attribute condition can match any attribute. *

  • this attribute is a class attribute. *

  • this attribute is an id attribute. *

  • this attribute is a pseudo-class attribute. *

*/ public String getLocalName() { return localName; } /** * Returns true if the attribute must have an explicit value * in the original document, false otherwise. */ public boolean getSpecified() { return false; } /** * Returns the value of the attribute. * If this attribute is a class or a pseudo class attribute, you'll get * the class name (or psedo class name) without the '.' or ':'. */ public String getValue() { return value; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/ClassConditionImpl.java0000644000175000017500000000550311365604770025120 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class ClassConditionImpl implements AttributeCondition { String value; /** * Creates a new AttributeConditionImpl */ public ClassConditionImpl(String value) { this.value = value; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_CLASS_CONDITION; } /** * Returns the * namespace * URI of this attribute condition. *

NULL if : *

    *
  • this attribute condition can match any namespace. *
  • this attribute is an id attribute. *
*/ public String getNamespaceURI() { return null; } /** * Returns the * local part * of the * qualified * name of this attribute. *

NULL if : *

    *
  • this attribute condition can match any attribute. *

  • this attribute is a class attribute. *

  • this attribute is an id attribute. *

  • this attribute is a pseudo-class attribute. *

*/ public String getLocalName() { return null; } /** * Returns true if the attribute must have an explicit value * in the original document, false otherwise. */ public boolean getSpecified() { return false; } /** * Returns the value of the attribute. * If this attribute is a class or a pseudo class attribute, you'll get * the class name (or psedo class name) without the '.' or ':'. */ public String getValue() { return value; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/AndConditionImpl.java0000644000175000017500000000346711365604770024564 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.CombinatorCondition; import org.w3c.css.sac.Condition; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class AndConditionImpl implements CombinatorCondition { Condition firstCondition; Condition secondCondition; /** * Creates a new AndConditionImpl */ public AndConditionImpl(Condition firstCondition, Condition secondCondition) { this.firstCondition = firstCondition; this.secondCondition = secondCondition; } /** * An integer indicating the type of Condition. */ public short getConditionType() { return Condition.SAC_AND_CONDITION; } /** * Returns the first condition. */ public Condition getFirstCondition() { return firstCondition; } /** * Returns the second condition. */ public Condition getSecondCondition() { return secondCondition; } } flute-1.1.6/source/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java0000644000175000017500000002076711365604770025473 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, World Wide Web Consortium,. All rights reserved. */ package org.w3c.flute.parser.selectors; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.Condition; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.LangCondition; import org.w3c.css.sac.ContentCondition; import org.w3c.css.sac.CombinatorCondition; import org.w3c.css.sac.PositionalCondition; import org.w3c.css.sac.NegativeCondition; import org.w3c.css.sac.ConditionFactory; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class ConditionFactoryImpl implements ConditionFactory { /** * Creates an and condition * * @param first the first condition * @param second the second condition * @return A combinator condition * @exception CSSException if this exception is not supported. */ public CombinatorCondition createAndCondition(Condition first, Condition second) throws CSSException { return new AndConditionImpl(first, second); } /** * Creates an or condition * * @param first the first condition * @param second the second condition * @return A combinator condition * @exception CSSException if this exception is not supported. */ public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a negative condition * * @param condition the condition * @return A negative condition * @exception CSSException if this exception is not supported. */ public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a positional condition * * @param position the position of the node in the list. * @param typeNode true if the list should contain * only nodes of the same type (element, text node, ...). * @param type true true if the list should contain * only nodes of the same node (for element, same localName * and same namespaceURI). * @return A positional condition * @exception CSSException if this exception is not supported. */ public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * creates an attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified true if the attribute must be specified * in the document. * @param value the value of this attribute. * @return An attribute condition * @exception CSSException if this exception is not supported. */ public AttributeCondition createAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { if ((namespaceURI != null) || specified) { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } else { return new AttributeConditionImpl(localName, value); } } /** * Creates an id condition * * @param value the value of the id. * @return An Id condition * @exception CSSException if this exception is not supported. */ public AttributeCondition createIdCondition(String value) throws CSSException { return new IdConditionImpl(value); } /** * Creates a lang condition * * @param value the value of the language. * @return A lang condition * @exception CSSException if this exception is not supported. */ public LangCondition createLangCondition(String lang) throws CSSException { return new LangConditionImpl(lang); } /** * Creates a "one of" attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified true if the attribute must be specified * in the document. * @param value the value of this attribute. * @return A "one of" attribute condition * @exception CSSException if this exception is not supported. */ public AttributeCondition createOneOfAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { if ((namespaceURI != null) || specified) { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } else { return new OneOfAttributeConditionImpl(localName, value); } } /** * Creates a "begin hyphen" attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified true if the attribute must be specified * in the document. * @param value the value of this attribute. * @return A "begin hyphen" attribute condition * @exception CSSException if this exception is not supported. */ public AttributeCondition createBeginHyphenAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { if ((namespaceURI != null) || specified) { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } else { return new BeginHyphenAttributeConditionImpl(localName, value); } } /** * Creates a class condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified true if the attribute must be specified * in the document. * @param value the name of the class. * @return A class condition * @exception CSSException if this exception is not supported. */ public AttributeCondition createClassCondition(String namespaceURI, String value) throws CSSException { return new ClassConditionImpl(value); } /** * Creates a pseudo class condition * * @param namespaceURI the namespace URI of the attribute * @param value the name of the pseudo class * @return A pseudo class condition * @exception CSSException if this exception is not supported. */ public AttributeCondition createPseudoClassCondition(String namespaceURI, String value) throws CSSException { return new PseudoClassConditionImpl(value); } /** * Creates a "only one" child condition * * @return A "only one" child condition * @exception CSSException if this exception is not supported. */ public Condition createOnlyChildCondition() throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a "only one" type condition * * @return A "only one" type condition * @exception CSSException if this exception is not supported. */ public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } /** * Creates a content condition * * @param data the data in the content * @return A content condition * @exception CSSException if this exception is not supported. */ public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); } } flute-1.1.6/source/org/w3c/flute/parser/LexicalUnitImpl.java0000644000175000017500000003211411365604770022420 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 1999 - 2009 Pentaho Corporation, World Wide Web Consortium. All rights reserved. */ package org.w3c.flute.parser; import org.w3c.css.sac.LexicalUnit; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ class LexicalUnitImpl implements LexicalUnit { LexicalUnit prev; LexicalUnit next; short type; int line; int column; int i; float f; short dimension; String sdimension; String s; String fname; LexicalUnitImpl params; LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl p) { if (p != null) { prev = p; p.next = this; } this.line = line; this.column = column -1; this.type = type; } LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, int i) { this(SAC_INTEGER, line, column, previous); this.i = i; } LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, short dimension, String sdimension, float f) { this(dimension, line, column, previous); this.f = f; this.dimension = dimension; this.sdimension = sdimension; } LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, short type, String s) { this(type, line, column, previous); this.s = s; } LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl previous, String fname, LexicalUnitImpl params) { this(type, line, column, previous); this.fname = fname; this.params = params; } public int getLineNumber() { return line; } public int getColumnNumber() { return column; } public short getLexicalUnitType() { return type; } public LexicalUnit getNextLexicalUnit() { return next; } public LexicalUnit getPreviousLexicalUnit() { return prev; } public int getIntegerValue() { return i; } void setIntegerValue(int i) { this.i = i; } public float getFloatValue() { return f; } void setFloatValue(float f) { this.f = f; } public String getDimensionUnitText() { switch (type) { case SAC_PERCENTAGE: return "%"; case SAC_EM: return "em"; case SAC_EX: return "ex"; case SAC_PIXEL: return "px"; case SAC_CENTIMETER: return "cm"; case SAC_MILLIMETER: return "mm"; case SAC_INCH: return "in"; case SAC_POINT: return "pt"; case SAC_PICA: return "pc"; case SAC_DEGREE: return "deg"; case SAC_RADIAN: return "rad"; case SAC_GRADIAN: return "grad"; case SAC_MILLISECOND: return "ms"; case SAC_SECOND: return "s"; case SAC_HERTZ: return "Hz"; case SAC_KILOHERTZ: return "kHz"; case SAC_DIMENSION: return sdimension; default: throw new IllegalStateException("invalid dimension " + type); } } public String getStringValue() { return s; } public String getFunctionName() { return fname; } public org.w3c.css.sac.LexicalUnit getParameters() { return params; } public org.w3c.css.sac.LexicalUnit getSubValues() { return params; } public String toString() { String text; switch (type) { case SAC_OPERATOR_COMMA: text = ","; break; case SAC_OPERATOR_PLUS: text = "+"; break; case SAC_OPERATOR_MINUS: text = "-"; break; case SAC_OPERATOR_MULTIPLY: text = "*"; break; case SAC_OPERATOR_SLASH: text = "/"; break; case SAC_OPERATOR_MOD: text = "%"; break; case SAC_OPERATOR_EXP: text = "^"; break; case SAC_OPERATOR_LT: text = "<"; break; case SAC_OPERATOR_GT: text = ">"; break; case SAC_OPERATOR_LE: text = "<="; break; case SAC_OPERATOR_GE: text = "=>"; break; case SAC_OPERATOR_TILDE: text = "~"; break; case SAC_INHERIT: text = "inherit"; break; case SAC_INTEGER: text = Integer.toString(i, 10); break; case SAC_REAL: text = f + ""; break; case SAC_EM: case SAC_EX: case SAC_PIXEL: case SAC_INCH: case SAC_CENTIMETER: case SAC_MILLIMETER: case SAC_POINT: case SAC_PICA: case SAC_PERCENTAGE: case SAC_DEGREE: case SAC_GRADIAN: case SAC_RADIAN: case SAC_MILLISECOND: case SAC_SECOND: case SAC_HERTZ: case SAC_KILOHERTZ: case SAC_DIMENSION: String fs = null; int i = (int) f; if (((float) i) == f) { text = i + getDimensionUnitText(); } else { text = f + getDimensionUnitText(); } break; case SAC_URI: text = "uri(" + s + ")"; break; case SAC_COUNTER_FUNCTION: case SAC_COUNTERS_FUNCTION: case SAC_RGBCOLOR: case SAC_RECT_FUNCTION: case SAC_FUNCTION: text = getFunctionName() + "(" + getParameters() + ")"; break; case SAC_IDENT: text = getStringValue(); break; case SAC_STRING_VALUE: // @@SEEME. not exact text = "\"" + getStringValue() + "\""; break; case SAC_ATTR: text = "attr(" + getStringValue() + ")"; break; case SAC_UNICODERANGE: text = "@@TODO"; break; case SAC_SUB_EXPRESSION: text = getSubValues().toString(); break; default: text = "@unknown"; break; } if (next != null) { return text + ' ' + next; } else { return text; } } // here some useful function for creation static LexicalUnitImpl createNumber(int line, int column, LexicalUnitImpl previous, float v) { int i = (int) v; if (v == ((float) i)) { return new LexicalUnitImpl(line, column, previous, i); } else { return new LexicalUnitImpl(line, column, previous, SAC_REAL, "", v); } } static LexicalUnitImpl createInteger(int line, int column, LexicalUnitImpl previous, int i) { return new LexicalUnitImpl(line, column, previous, i); } static LexicalUnitImpl createPercentage(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_PERCENTAGE, null, v); } static LexicalUnitImpl createEMS(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_EM, null, v); } static LexicalUnitImpl createEXS(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_EX, null, v); } static LexicalUnitImpl createPX(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_PIXEL, null, v); } static LexicalUnitImpl createCM(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_CENTIMETER, null, v); } static LexicalUnitImpl createMM(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_MILLIMETER, null, v); } static LexicalUnitImpl createIN(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_INCH, null, v); } static LexicalUnitImpl createPT(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_POINT, null, v); } static LexicalUnitImpl createPC(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_PICA, null, v); } static LexicalUnitImpl createDEG(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_DEGREE, null, v); } static LexicalUnitImpl createRAD(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_RADIAN, null, v); } static LexicalUnitImpl createGRAD(int line, int column, LexicalUnitImpl previous, float v) { return new LexicalUnitImpl(line, column, previous, SAC_GRADIAN, null, v); } static LexicalUnitImpl createMS(int line, int column, LexicalUnitImpl previous, float v) { if (v < 0) { throw new ParseException("Time values may not be negative"); } return new LexicalUnitImpl(line, column, previous, SAC_MILLISECOND, null, v); } static LexicalUnitImpl createS(int line, int column, LexicalUnitImpl previous, float v) { if (v < 0) { throw new ParseException("Time values may not be negative"); } return new LexicalUnitImpl(line, column, previous, SAC_SECOND, null, v); } static LexicalUnitImpl createHZ(int line, int column, LexicalUnitImpl previous, float v) { if (v < 0) { throw new ParseException("Frequency values may not be negative"); } return new LexicalUnitImpl(line, column, previous, SAC_HERTZ, null, v); } static LexicalUnitImpl createKHZ(int line, int column, LexicalUnitImpl previous, float v) { if (v < 0) { throw new ParseException("Frequency values may not be negative"); } return new LexicalUnitImpl(line, column, previous, SAC_KILOHERTZ, null, v); } static LexicalUnitImpl createDimen(int line, int column, LexicalUnitImpl previous, float v, String s) { return new LexicalUnitImpl(line, column, previous, SAC_DIMENSION, s, v); } static LexicalUnitImpl createInherit(int line, int column, LexicalUnitImpl previous) { return new LexicalUnitImpl(line, column, previous, SAC_INHERIT, "inherit"); } static LexicalUnitImpl createIdent(int line, int column, LexicalUnitImpl previous, String s) { return new LexicalUnitImpl(line, column, previous, SAC_IDENT, s); } static LexicalUnitImpl createString(int line, int column, LexicalUnitImpl previous, String s) { return new LexicalUnitImpl(line, column, previous, SAC_STRING_VALUE, s); } static LexicalUnitImpl createURL(int line, int column, LexicalUnitImpl previous, String s) { return new LexicalUnitImpl(line, column, previous, SAC_URI, s); } static LexicalUnitImpl createAttr(int line, int column, LexicalUnitImpl previous, String s) { return new LexicalUnitImpl(line, column, previous, SAC_ATTR, s); } static LexicalUnitImpl createCounter(int line, int column, LexicalUnitImpl previous, LexicalUnit params) { return new LexicalUnitImpl(SAC_COUNTER_FUNCTION, line, column, previous, "counter", (LexicalUnitImpl) params); } static LexicalUnitImpl createCounters(int line, int column, LexicalUnitImpl previous, LexicalUnit params) { return new LexicalUnitImpl(SAC_COUNTERS_FUNCTION, line, column, previous, "counters", (LexicalUnitImpl) params); } static LexicalUnitImpl createRGBColor(int line, int column, LexicalUnitImpl previous, LexicalUnit params) { return new LexicalUnitImpl(SAC_RGBCOLOR, line, column, previous, "color", (LexicalUnitImpl) params); } static LexicalUnitImpl createRect(int line, int column, LexicalUnitImpl previous, LexicalUnit params) { return new LexicalUnitImpl(SAC_RECT_FUNCTION, line, column, previous, "rect", (LexicalUnitImpl) params); } static LexicalUnitImpl createFunction(int line, int column, LexicalUnitImpl previous, String fname, LexicalUnit params) { return new LexicalUnitImpl(SAC_FUNCTION, line, column, previous, fname, (LexicalUnitImpl) params); } static LexicalUnitImpl createUnicodeRange(int line, int column, LexicalUnit previous, LexicalUnit params) { // @@ return new LexicalUnitImpl(line, column, previous, null, SAC_UNICODERANGE, params); return null; } static LexicalUnitImpl createComma(int line, int column, LexicalUnitImpl previous) { return new LexicalUnitImpl(SAC_OPERATOR_COMMA, line, column, previous); } static LexicalUnitImpl createSlash(int line, int column, LexicalUnitImpl previous) { return new LexicalUnitImpl(SAC_OPERATOR_SLASH, line, column, previous); } } flute-1.1.6/source/org/w3c/flute/parser/ParserConstants.java0000644000175000017500000000677511365604770022524 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; public interface ParserConstants { int EOF = 0; int S = 1; int CDO = 5; int CDC = 6; int LBRACE = 7; int RBRACE = 8; int DASHMATCH = 9; int INCLUDES = 10; int EQ = 11; int PLUS = 12; int MINUS = 13; int COMMA = 14; int SEMICOLON = 15; int PRECEDES = 16; int DIV = 17; int LBRACKET = 18; int RBRACKET = 19; int ANY = 20; int DOT = 21; int LPARAN = 22; int RPARAN = 23; int COLON = 24; int NONASCII = 25; int H = 26; int UNICODE = 27; int ESCAPE = 28; int NMSTART = 29; int NMCHAR = 30; int STRINGCHAR = 31; int D = 32; int NAME = 33; int NNAME = 34; int STRING = 35; int IDENT = 36; int NUMBER = 37; int _URL = 38; int URL = 39; int NAMESPACE_IDENT = 40; int PERCENTAGE = 41; int PT = 42; int MM = 43; int CM = 44; int PC = 45; int IN = 46; int PX = 47; int EMS = 48; int EXS = 49; int DEG = 50; int RAD = 51; int GRAD = 52; int MS = 53; int SECOND = 54; int HZ = 55; int KHZ = 56; int DIMEN = 57; int HASH = 58; int IMPORT_SYM = 59; int MEDIA_SYM = 60; int CHARSET_SYM = 61; int PAGE_SYM = 62; int NAMESPACE_SYM = 63; int FONT_FACE_SYM = 64; int ATKEYWORD = 65; int IMPORTANT_SYM = 66; int RANGE0 = 67; int RANGE1 = 68; int RANGE2 = 69; int RANGE3 = 70; int RANGE4 = 71; int RANGE5 = 72; int RANGE6 = 73; int RANGE = 74; int UNI = 75; int UNICODERANGE = 76; int FUNCTION = 77; int UNKNOWN = 78; int DEFAULT = 0; int IN_COMMENT = 1; String[] tokenImage = { "", "", "\"/*\"", "\"*/\"", "", "\"\"", "\"{\"", "\"}\"", "\"|=\"", "\"~=\"", "\"=\"", "\"+\"", "\"-\"", "\",\"", "\";\"", "\">\"", "\"/\"", "\"[\"", "\"]\"", "\"*\"", "\".\"", "\")\"", "\"(\"", "\":\"", "", "", "", "", "", "", "", "", "", "", "", "", "", "<_URL>", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\"@import\"", "\"@media\"", "\"@charset\"", "\"@page\"", "\"@namespace\"", "\"@font-face\"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }; } flute-1.1.6/source/org/w3c/flute/parser/Token.java0000644000175000017500000000654011365604770020441 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** * beginLine and beginColumn describe the position of the first character * of this token; endLine and endColumn describe the position of the * last character of this token. */ public int beginLine, beginColumn, endLine, endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simlpy add something like : * * case MyParserConstants.ID : return new IDToken(); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ public static final Token newToken(int ofKind) { switch(ofKind) { default : return new Token(); } } } flute-1.1.6/source/org/w3c/flute/parser/CharStream.java0000644000175000017500000001051711365604770021411 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; /** * This interface describes a character stream that maintains line and * column number positions of the characters. It also has the capability * to backup the stream to some extent. An implementation of this * interface is used in the TokenManager implementation generated by * JavaCCParser. * * All the methods except backup can be implemented in any fashion. backup * needs to be implemented correctly for the correct operation of the lexer. * Rest of the methods are all used to get information like line number, * column number and the String that constitutes a token and are not used * by the lexer. Hence their implementation won't affect the generated lexer's * operation. */ public interface CharStream { /** * Returns the next character from the selected input. The method * of selecting the input is the responsibility of the class * implementing this interface. Can throw any java.io.IOException. */ char readChar() throws java.io.IOException; /** * Returns the column position of the character last read. * @deprecated * @see #getEndColumn */ int getColumn(); /** * Returns the line number of the character last read. * @deprecated * @see #getEndLine */ int getLine(); /** * Returns the column number of the last character for current token (being * matched after the last call to BeginTOken). */ int getEndColumn(); /** * Returns the line number of the last character for current token (being * matched after the last call to BeginTOken). */ int getEndLine(); /** * Returns the column number of the first character for current token (being * matched after the last call to BeginTOken). */ int getBeginColumn(); /** * Returns the line number of the first character for current token (being * matched after the last call to BeginTOken). */ int getBeginLine(); /** * Backs up the input stream by amount steps. Lexer calls this method if it * had already read some characters, but could not use them to match a * (longer) token. So, they will be used again as the prefix of the next * token and it is the implemetation's responsibility to do this right. */ void backup(int amount); /** * Returns the next character that marks the beginning of the next token. * All characters must remain in the buffer between two successive calls * to this method to implement backup correctly. */ char BeginToken() throws java.io.IOException; /** * Returns a string made up of characters from the marked token beginning * to the current buffer position. Implementations have the choice of returning * anything that they want to. For example, for efficiency, one might decide * to just return null, which is a valid implementation. */ String GetImage(); /** * Returns an array of characters that make up the suffix of length 'len' for * the currently matched token. This is used to build up the matched string * for use in actions in the case of MORE. A simple and inefficient * implementation of this is as follows : * * { * String t = GetImage(); * return t.substring(t.length() - len, t.length()).toCharArray(); * } */ char[] GetSuffix(int len); /** * The lexer calls this function to indicate that it is done with the stream * and hence implementations can free any resources held by this class. * Again, the body of this function can be just empty and it will not * affect the lexer's operation. */ void Done(); } flute-1.1.6/source/org/w3c/flute/parser/ParseException.java0000644000175000017500000001601011365604770022303 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2006 - 2009 Pentaho Corperation and Contributors. All rights reserved. */ package org.w3c.flute.parser; import org.w3c.css.sac.CSSException; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends CSSException { /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. The boolean * flag "specialConstructor" is also set to true to indicate that * this constructor was used to create this object. * This constructor calls its super class with the empty string * to force the "toString" method of parent class "Throwable" to * print the error message in the form: * ParseException: */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(""); specialConstructor = true; currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); specialConstructor = false; } public ParseException(String message) { super(message); specialConstructor = false; } /** * This variable determines which constructor was used to create * this object and thereby affects the semantics of the * "getMessage" method (see below). */ protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * This method has the standard behavior when this object has been * created using the standard constructors. Otherwise, it uses * "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser), then this method is called during the printing * of the final stack trace, and hence the correct error message * gets displayed. */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected += tokenImage[expectedTokenSequences[i][j]] + " "; } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected += "..."; } expected += eol + " "; } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected; return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ protected String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } flute-1.1.6/source/org/w3c/flute/parser/MediaListImpl.java0000644000175000017500000000415111365604770022052 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; import org.w3c.css.sac.SACMediaList; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class MediaListImpl implements SACMediaList { String[] array = new String[10]; int current; public int getLength() { return current; } public String item(int index) { if ((index < 0) || (index >= current)) { return null; } return array[index]; } void addItem(String medium) { if (medium.equals("all")) { array[0] = "all"; current = 1; return; } for (int i = 0; i < current; i++) { if (medium.equals(array[i])) { return; } } if (current == array.length) { String[] old = array; array = new String[current + current]; System.arraycopy(old, 0, array, 0, current); } array[current++] = medium; } /** * Returns a string representation of this object. */ public String toString() { int _i; switch (current) { case 0: return ""; case 1: return array[0]; default: boolean not_done = true; int i = 0; StringBuffer buf = new StringBuffer(50); do { buf.append(array[i++]); if (i == current) { not_done = false; } else { buf.append(", "); } } while (not_done); return buf.toString(); } } } flute-1.1.6/source/org/w3c/flute/parser/ParserTokenManager.java0000644000175000017500000041324411365604770023114 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; import java.io.*; import java.net.*; import java.util.Locale; import org.w3c.css.sac.ConditionFactory; import org.w3c.css.sac.Condition; import org.w3c.css.sac.SelectorFactory; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SimpleSelector; import org.w3c.css.sac.DocumentHandler; import org.w3c.css.sac.InputSource; import org.w3c.css.sac.ErrorHandler; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Locator; import org.w3c.css.sac.LexicalUnit; import org.w3c.flute.parser.selectors.SelectorFactoryImpl; import org.w3c.flute.parser.selectors.ConditionFactoryImpl; import org.w3c.flute.util.Encoding; public class ParserTokenManager implements ParserConstants { public java.io.PrintStream debugStream = System.out; public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) { switch (pos) { case 0: if ((active0 & 0xf800000000000000L) != 0L || (active1 & 0x1L) != 0L) return 48; if ((active0 & 0x200000L) != 0L) return 387; if ((active0 & 0x2040L) != 0L) return 388; return -1; case 1: if ((active0 & 0xf800000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 1; return 389; } if ((active0 & 0x40L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 1; return 388; } return -1; case 2: if ((active0 & 0xf800000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 2; return 389; } return -1; case 3: if ((active0 & 0xf800000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 3; return 389; } return -1; case 4: if ((active0 & 0x4000000000000000L) != 0L) return 389; if ((active0 & 0xb800000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 4; return 389; } return -1; case 5: if ((active0 & 0x1000000000000000L) != 0L) return 389; if ((active0 & 0xa800000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 5; return 389; } return -1; case 6: if ((active0 & 0x800000000000000L) != 0L) return 389; if ((active0 & 0xa000000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 6; return 389; } return -1; case 7: if ((active0 & 0x2000000000000000L) != 0L) return 389; if ((active0 & 0x8000000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 7; return 389; } return -1; case 8: if ((active0 & 0x8000000000000000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 65; jjmatchedPos = 8; return 389; } return -1; default : return -1; } } private final int jjStartNfa_0(int pos, long active0, long active1) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); } private final int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private final int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } private final int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 40: return jjStopAtPos(0, 23); case 41: return jjStopAtPos(0, 22); case 42: return jjStopAtPos(0, 20); case 43: return jjStopAtPos(0, 12); case 44: return jjStopAtPos(0, 14); case 45: jjmatchedKind = 13; return jjMoveStringLiteralDfa1_0(0x40L, 0x0L); case 46: return jjStartNfaWithStates_0(0, 21, 387); case 47: jjmatchedKind = 17; return jjMoveStringLiteralDfa1_0(0x4L, 0x0L); case 58: return jjStopAtPos(0, 24); case 59: return jjStopAtPos(0, 15); case 60: return jjMoveStringLiteralDfa1_0(0x20L, 0x0L); case 61: return jjStopAtPos(0, 11); case 62: return jjStopAtPos(0, 16); case 64: return jjMoveStringLiteralDfa1_0(0xf800000000000000L, 0x1L); case 91: return jjStopAtPos(0, 18); case 93: return jjStopAtPos(0, 19); case 123: return jjStopAtPos(0, 7); case 124: return jjMoveStringLiteralDfa1_0(0x200L, 0x0L); case 125: return jjStopAtPos(0, 8); case 126: return jjMoveStringLiteralDfa1_0(0x400L, 0x0L); default : return jjMoveNfa_0(1, 0); } } private final int jjMoveStringLiteralDfa1_0(long active0, long active1) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0, active1); return 1; } switch(curChar) { case 33: return jjMoveStringLiteralDfa2_0(active0, 0x20L, active1, 0L); case 42: if ((active0 & 0x4L) != 0L) return jjStopAtPos(1, 2); break; case 45: return jjMoveStringLiteralDfa2_0(active0, 0x40L, active1, 0L); case 61: if ((active0 & 0x200L) != 0L) return jjStopAtPos(1, 9); else if ((active0 & 0x400L) != 0L) return jjStopAtPos(1, 10); break; case 67: case 99: return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L, active1, 0L); case 70: case 102: return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1L); case 73: case 105: return jjMoveStringLiteralDfa2_0(active0, 0x800000000000000L, active1, 0L); case 77: case 109: return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L); case 78: case 110: return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000000L, active1, 0L); case 80: case 112: return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000000L, active1, 0L); default : break; } return jjStartNfa_0(0, active0, active1); } private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(0, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0, active1); return 2; } switch(curChar) { case 45: return jjMoveStringLiteralDfa3_0(active0, 0x20L, active1, 0L); case 62: if ((active0 & 0x40L) != 0L) return jjStopAtPos(2, 6); break; case 65: case 97: return jjMoveStringLiteralDfa3_0(active0, 0xc000000000000000L, active1, 0L); case 69: case 101: return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0L); case 72: case 104: return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0L); case 77: case 109: return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0L); case 79: case 111: return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x1L); default : break; } return jjStartNfa_0(1, active0, active1); } private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(1, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0, active1); return 3; } switch(curChar) { case 45: if ((active0 & 0x20L) != 0L) return jjStopAtPos(3, 5); break; case 65: case 97: return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0L); case 68: case 100: return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0L); case 71: case 103: return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0L); case 77: case 109: return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000000L, active1, 0L); case 78: case 110: return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x1L); case 80: case 112: return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0L); default : break; } return jjStartNfa_0(2, active0, active1); } private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(2, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0, active1); return 4; } switch(curChar) { case 69: case 101: if ((active0 & 0x4000000000000000L) != 0L) return jjStartNfaWithStates_0(4, 62, 389); return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000000L, active1, 0L); case 73: case 105: return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000000L, active1, 0L); case 79: case 111: return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0L); case 82: case 114: return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000000L, active1, 0L); case 84: case 116: return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1L); default : break; } return jjStartNfa_0(3, active0, active1); } private final int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(3, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0, active1); return 5; } switch(curChar) { case 45: return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x1L); case 65: case 97: if ((active0 & 0x1000000000000000L) != 0L) return jjStartNfaWithStates_0(5, 60, 389); break; case 82: case 114: return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L, active1, 0L); case 83: case 115: return jjMoveStringLiteralDfa6_0(active0, 0xa000000000000000L, active1, 0L); default : break; } return jjStartNfa_0(4, active0, active1); } private final int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(4, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0, active1); return 6; } switch(curChar) { case 69: case 101: return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000000L, active1, 0L); case 70: case 102: return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x1L); case 80: case 112: return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000000L, active1, 0L); case 84: case 116: if ((active0 & 0x800000000000000L) != 0L) return jjStartNfaWithStates_0(6, 59, 389); break; default : break; } return jjStartNfa_0(5, active0, active1); } private final int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(5, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0, active1); return 7; } switch(curChar) { case 65: case 97: return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000000L, active1, 0x1L); case 84: case 116: if ((active0 & 0x2000000000000000L) != 0L) return jjStartNfaWithStates_0(7, 61, 389); break; default : break; } return jjStartNfa_0(6, active0, active1); } private final int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(6, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0, active1); return 8; } switch(curChar) { case 67: case 99: return jjMoveStringLiteralDfa9_0(active0, 0x8000000000000000L, active1, 0x1L); default : break; } return jjStartNfa_0(7, active0, active1); } private final int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(7, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0, active1); return 9; } switch(curChar) { case 69: case 101: if ((active0 & 0x8000000000000000L) != 0L) return jjStartNfaWithStates_0(9, 63, 389); else if ((active1 & 0x1L) != 0L) return jjStartNfaWithStates_0(9, 64, 389); break; default : break; } return jjStartNfa_0(8, active0, active1); } private final void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private final void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private final void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private final void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } private final void jjCheckNAddStates(int start) { jjCheckNAdd(jjnextStates[start]); jjCheckNAdd(jjnextStates[start + 1]); } static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private final int jjMoveNfa_0(int startState, int curPos) { int[] nextStates; int startsAt = 0; jjnewStateCnt = 387; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; MatchLoop: do { switch(jjstateSet[--i]) { case 388: if ((0x3ff200000000000L & l) != 0L) jjCheckNAddStates(0, 2); else if (curChar == 40) { if (kind > 77) kind = 77; } if ((0x3ff200000000000L & l) != 0L) jjCheckNAddStates(3, 5); if ((0x3ff200000000000L & l) != 0L) jjCheckNAddStates(6, 8); if ((0x3ff200000000000L & l) != 0L) { if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); } break; case 1: if ((0x3ff000000000000L & l) != 0L) { if (kind > 37) kind = 37; jjCheckNAddStates(9, 80); } else if ((0x100003600L & l) != 0L) { if (kind > 1) kind = 1; jjCheckNAdd(0); } else if (curChar == 46) jjCheckNAddStates(81, 98); else if (curChar == 45) { if (kind > 36) kind = 36; jjCheckNAddStates(99, 109); } else if (curChar == 33) jjCheckNAddTwoStates(67, 76); else if (curChar == 35) jjCheckNAddTwoStates(37, 38); else if (curChar == 39) jjCheckNAddStates(110, 113); else if (curChar == 34) jjCheckNAddStates(114, 117); break; case 387: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(118, 120); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(188, 191); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(185, 187); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(183, 184); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(180, 182); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(175, 179); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(171, 174); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(167, 170); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(164, 166); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(161, 163); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(158, 160); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(155, 157); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(152, 154); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(149, 151); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(146, 148); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(143, 145); if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(141, 142); if ((0x3ff000000000000L & l) != 0L) { if (kind > 37) kind = 37; jjCheckNAdd(140); } break; case 389: case 49: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 48: if (curChar != 45) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 0: if ((0x100003600L & l) == 0L) break; if (kind > 1) kind = 1; jjCheckNAdd(0); break; case 2: if (curChar == 34) jjCheckNAddStates(114, 117); break; case 3: if ((0xfffffffb00000200L & l) != 0L) jjCheckNAddStates(114, 117); break; case 4: if (curChar == 34 && kind > 35) kind = 35; break; case 6: if (curChar == 12) jjCheckNAddStates(114, 117); break; case 8: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(114, 117); break; case 9: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(121, 126); break; case 10: if ((0x100003600L & l) != 0L) jjCheckNAddStates(114, 117); break; case 11: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(127, 135); break; case 12: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(136, 140); break; case 13: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(141, 146); break; case 14: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(147, 153); break; case 15: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(154, 161); break; case 16: if (curChar == 13) jjCheckNAddStates(114, 117); break; case 17: if (curChar == 10) jjCheckNAddStates(114, 117); break; case 18: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 17; break; case 19: if (curChar == 39) jjCheckNAddStates(110, 113); break; case 20: if ((0xffffff7f00000200L & l) != 0L) jjCheckNAddStates(110, 113); break; case 21: if (curChar == 39 && kind > 35) kind = 35; break; case 23: if (curChar == 12) jjCheckNAddStates(110, 113); break; case 25: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(110, 113); break; case 26: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(162, 167); break; case 27: if ((0x100003600L & l) != 0L) jjCheckNAddStates(110, 113); break; case 28: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(168, 176); break; case 29: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(177, 181); break; case 30: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(182, 187); break; case 31: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(188, 194); break; case 32: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(195, 202); break; case 33: if (curChar == 13) jjCheckNAddStates(110, 113); break; case 34: if (curChar == 10) jjCheckNAddStates(110, 113); break; case 35: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 34; break; case 36: if (curChar == 35) jjCheckNAddTwoStates(37, 38); break; case 37: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddTwoStates(37, 38); break; case 39: if ((0xffffffff00000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddTwoStates(37, 38); break; case 40: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(203, 206); break; case 41: if ((0x100003600L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddTwoStates(37, 38); break; case 42: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(207, 213); break; case 43: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(214, 216); break; case 44: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(217, 220); break; case 45: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(221, 225); break; case 46: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(226, 231); break; case 51: if ((0xffffffff00000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 52: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(232, 235); break; case 53: if ((0x100003600L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 54: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(236, 242); break; case 55: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(243, 245); break; case 56: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(246, 249); break; case 57: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(250, 254); break; case 58: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(255, 260); break; case 60: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(261, 264); break; case 61: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(265, 271); break; case 62: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(272, 274); break; case 63: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(275, 278); break; case 64: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(279, 283); break; case 65: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(284, 289); break; case 66: if (curChar == 33) jjCheckNAddTwoStates(67, 76); break; case 67: if ((0x100003600L & l) != 0L) jjCheckNAddTwoStates(67, 76); break; case 77: if (curChar != 45) break; if (kind > 36) kind = 36; jjCheckNAddStates(99, 109); break; case 78: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); break; case 80: if ((0xffffffff00000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); break; case 81: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(290, 293); break; case 82: if ((0x100003600L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); break; case 83: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(294, 300); break; case 84: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(301, 303); break; case 85: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(304, 307); break; case 86: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(308, 312); break; case 87: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(313, 318); break; case 88: if ((0x3ff200000000000L & l) != 0L) jjCheckNAddStates(6, 8); break; case 91: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(6, 8); break; case 92: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(319, 323); break; case 93: if ((0x100003600L & l) != 0L) jjCheckNAddStates(6, 8); break; case 94: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(324, 331); break; case 95: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(332, 335); break; case 96: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(336, 340); break; case 97: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(341, 346); break; case 98: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(347, 353); break; case 99: if ((0x3ff200000000000L & l) != 0L) jjCheckNAddStates(3, 5); break; case 101: if (curChar != 45) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 102: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 104: if ((0xffffffff00000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 105: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(354, 357); break; case 106: if ((0x100003600L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 107: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(358, 364); break; case 108: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(365, 367); break; case 109: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(368, 371); break; case 110: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(372, 376); break; case 111: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(377, 382); break; case 113: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(383, 386); break; case 114: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(387, 393); break; case 115: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(394, 396); break; case 116: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(397, 400); break; case 117: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(401, 405); break; case 118: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(406, 411); break; case 120: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(3, 5); break; case 121: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(412, 416); break; case 122: if ((0x100003600L & l) != 0L) jjCheckNAddStates(3, 5); break; case 123: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(417, 424); break; case 124: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(425, 428); break; case 125: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(429, 433); break; case 126: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(434, 439); break; case 127: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(440, 446); break; case 128: if ((0x3ff200000000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 129: if (curChar == 40 && kind > 77) kind = 77; break; case 131: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 132: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(447, 451); break; case 133: if ((0x100003600L & l) != 0L) jjCheckNAddStates(0, 2); break; case 134: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(452, 459); break; case 135: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(460, 463); break; case 136: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(464, 468); break; case 137: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(469, 474); break; case 138: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(475, 481); break; case 139: if (curChar == 46) jjCheckNAddStates(81, 98); break; case 140: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 37) kind = 37; jjCheckNAdd(140); break; case 141: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(141, 142); break; case 142: if (curChar == 37 && kind > 41) kind = 41; break; case 143: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(143, 145); break; case 146: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(146, 148); break; case 149: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(149, 151); break; case 152: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(152, 154); break; case 155: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(155, 157); break; case 158: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(158, 160); break; case 161: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(161, 163); break; case 164: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(164, 166); break; case 167: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(167, 170); break; case 171: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(171, 174); break; case 175: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(175, 179); break; case 180: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(180, 182); break; case 183: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(183, 184); break; case 185: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(185, 187); break; case 188: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(188, 191); break; case 192: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(118, 120); break; case 193: if (curChar != 45) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 194: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 196: if ((0xffffffff00000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 197: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(482, 485); break; case 198: if ((0x100003600L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 199: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(486, 492); break; case 200: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(493, 495); break; case 201: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(496, 499); break; case 202: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(500, 504); break; case 203: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(505, 510); break; case 205: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(511, 514); break; case 206: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(515, 521); break; case 207: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(522, 524); break; case 208: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(525, 528); break; case 209: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(529, 533); break; case 210: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(534, 539); break; case 212: if (curChar == 40) jjCheckNAddStates(540, 545); break; case 213: if ((0xfffffc7a00000000L & l) != 0L) jjCheckNAddStates(546, 549); break; case 214: if ((0x100003600L & l) != 0L) jjCheckNAddTwoStates(214, 215); break; case 215: if (curChar == 41 && kind > 39) kind = 39; break; case 217: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(546, 549); break; case 218: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(550, 554); break; case 219: if ((0x100003600L & l) != 0L) jjCheckNAddStates(546, 549); break; case 220: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(555, 562); break; case 221: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(563, 566); break; case 222: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(567, 571); break; case 223: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(572, 577); break; case 224: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(578, 584); break; case 225: if (curChar == 39) jjCheckNAddStates(585, 588); break; case 226: if ((0xffffff7f00000200L & l) != 0L) jjCheckNAddStates(585, 588); break; case 227: if (curChar == 39) jjCheckNAddTwoStates(214, 215); break; case 229: if (curChar == 12) jjCheckNAddStates(585, 588); break; case 231: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(585, 588); break; case 232: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(589, 594); break; case 233: if ((0x100003600L & l) != 0L) jjCheckNAddStates(585, 588); break; case 234: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(595, 603); break; case 235: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(604, 608); break; case 236: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(609, 614); break; case 237: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(615, 621); break; case 238: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(622, 629); break; case 239: if (curChar == 13) jjCheckNAddStates(585, 588); break; case 240: if (curChar == 10) jjCheckNAddStates(585, 588); break; case 241: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 240; break; case 242: if (curChar == 34) jjCheckNAddStates(630, 633); break; case 243: if ((0xfffffffb00000200L & l) != 0L) jjCheckNAddStates(630, 633); break; case 244: if (curChar == 34) jjCheckNAddTwoStates(214, 215); break; case 246: if (curChar == 12) jjCheckNAddStates(630, 633); break; case 248: if ((0xffffffff00000000L & l) != 0L) jjCheckNAddStates(630, 633); break; case 249: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(634, 639); break; case 250: if ((0x100003600L & l) != 0L) jjCheckNAddStates(630, 633); break; case 251: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(640, 648); break; case 252: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(649, 653); break; case 253: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(654, 659); break; case 254: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(660, 666); break; case 255: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(667, 674); break; case 256: if (curChar == 13) jjCheckNAddStates(630, 633); break; case 257: if (curChar == 10) jjCheckNAddStates(630, 633); break; case 258: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 257; break; case 259: if ((0x100003600L & l) != 0L) jjCheckNAddStates(675, 681); break; case 262: if (curChar == 43) jjAddStates(682, 683); break; case 263: if (curChar != 63) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 264; break; case 264: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddStates(684, 687); break; case 265: if (curChar == 63 && kind > 76) kind = 76; break; case 266: case 281: case 285: case 288: case 291: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAdd(265); break; case 267: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddTwoStates(265, 266); break; case 268: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddStates(688, 690); break; case 269: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjAddStates(691, 696); break; case 270: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 271; break; case 271: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 272; break; case 272: if ((0x3ff000000000000L & l) != 0L) jjCheckNAdd(273); break; case 273: if ((0x3ff000000000000L & l) != 0L && kind > 76) kind = 76; break; case 274: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 275; break; case 275: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 276; break; case 276: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 277; break; case 277: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAdd(265); break; case 278: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 279; break; case 279: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 280; break; case 280: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 281; break; case 282: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 283; break; case 283: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 284; break; case 284: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddTwoStates(265, 285); break; case 286: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 287; break; case 287: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddStates(697, 699); break; case 289: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddTwoStates(265, 288); break; case 290: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddStates(700, 703); break; case 292: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddTwoStates(265, 291); break; case 293: if (curChar != 63) break; if (kind > 76) kind = 76; jjCheckNAddStates(704, 706); break; case 294: if (curChar == 43) jjstateSet[jjnewStateCnt++] = 295; break; case 295: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(296, 302); break; case 296: if (curChar == 45) jjstateSet[jjnewStateCnt++] = 297; break; case 297: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 298; break; case 298: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAddStates(707, 710); break; case 299: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAdd(273); break; case 300: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAddTwoStates(273, 299); break; case 301: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAddStates(711, 713); break; case 302: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(714, 718); break; case 303: if ((0x3ff000000000000L & l) != 0L) jjCheckNAdd(296); break; case 304: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(303, 296); break; case 305: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(719, 721); break; case 306: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(722, 725); break; case 308: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(726, 729); break; case 309: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(730, 736); break; case 310: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(737, 739); break; case 311: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(740, 743); break; case 312: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(744, 748); break; case 313: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(749, 754); break; case 314: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(755, 759); break; case 315: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(760, 767); break; case 316: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(768, 771); break; case 317: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(772, 776); break; case 318: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(777, 782); break; case 319: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(783, 789); break; case 320: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(790, 794); break; case 321: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(795, 802); break; case 322: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(803, 806); break; case 323: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(807, 811); break; case 324: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(812, 817); break; case 325: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(818, 824); break; case 326: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(825, 829); break; case 327: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(830, 837); break; case 328: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(838, 841); break; case 329: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(842, 846); break; case 330: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(847, 852); break; case 331: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(853, 859); break; case 332: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 37) kind = 37; jjCheckNAddStates(9, 80); break; case 333: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 37) kind = 37; jjCheckNAdd(333); break; case 334: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(334, 335); break; case 335: if (curChar == 46) jjCheckNAdd(140); break; case 336: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(336, 142); break; case 337: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(337, 338); break; case 338: if (curChar == 46) jjCheckNAdd(141); break; case 339: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(339, 145); break; case 340: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(340, 341); break; case 341: if (curChar == 46) jjCheckNAdd(143); break; case 342: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(342, 148); break; case 343: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(343, 344); break; case 344: if (curChar == 46) jjCheckNAdd(146); break; case 345: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(345, 151); break; case 346: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(346, 347); break; case 347: if (curChar == 46) jjCheckNAdd(149); break; case 348: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(348, 154); break; case 349: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(349, 350); break; case 350: if (curChar == 46) jjCheckNAdd(152); break; case 351: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(351, 157); break; case 352: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(352, 353); break; case 353: if (curChar == 46) jjCheckNAdd(155); break; case 354: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(354, 160); break; case 355: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(355, 356); break; case 356: if (curChar == 46) jjCheckNAdd(158); break; case 357: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(357, 163); break; case 358: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(358, 359); break; case 359: if (curChar == 46) jjCheckNAdd(161); break; case 360: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(360, 166); break; case 361: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(361, 362); break; case 362: if (curChar == 46) jjCheckNAdd(164); break; case 363: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(363, 170); break; case 364: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(364, 365); break; case 365: if (curChar == 46) jjCheckNAdd(167); break; case 366: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(366, 174); break; case 367: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(367, 368); break; case 368: if (curChar == 46) jjCheckNAdd(171); break; case 369: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(369, 179); break; case 370: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(370, 371); break; case 371: if (curChar == 46) jjCheckNAdd(175); break; case 372: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(372, 182); break; case 373: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(373, 374); break; case 374: if (curChar == 46) jjCheckNAdd(180); break; case 375: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(375, 184); break; case 376: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(376, 377); break; case 377: if (curChar == 46) jjCheckNAdd(183); break; case 378: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(378, 187); break; case 379: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(379, 380); break; case 380: if (curChar == 46) jjCheckNAdd(185); break; case 381: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(381, 191); break; case 382: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(382, 383); break; case 383: if (curChar == 46) jjCheckNAdd(188); break; case 384: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(860, 862); break; case 385: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(385, 386); break; case 386: if (curChar == 46) jjCheckNAdd(192); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 388: if ((0x7fffffe87fffffeL & l) != 0L) jjCheckNAddStates(0, 2); else if (curChar == 92) jjCheckNAddTwoStates(80, 81); else if (curChar == 124) jjAddStates(863, 864); if ((0x7fffffe87fffffeL & l) != 0L) jjCheckNAddStates(3, 5); else if (curChar == 92) jjCheckNAddTwoStates(91, 92); else if (curChar == 124) { if (kind > 40) kind = 40; } if ((0x7fffffe87fffffeL & l) != 0L) jjCheckNAddStates(6, 8); else if (curChar == 92) jjCheckNAddTwoStates(120, 121); if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); } else if (curChar == 92) jjCheckNAddTwoStates(131, 132); break; case 1: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 36) kind = 36; jjCheckNAddStates(99, 109); } else if (curChar == 92) jjCheckNAddStates(865, 872); else if (curChar == 64) jjAddStates(873, 874); if ((0x20000000200000L & l) != 0L) jjAddStates(875, 877); break; case 389: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); } else if (curChar == 92) jjCheckNAddTwoStates(51, 52); break; case 48: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); } else if (curChar == 92) jjCheckNAddTwoStates(51, 60); break; case 3: case 8: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(114, 117); break; case 5: if (curChar == 92) jjAddStates(878, 881); break; case 7: if (curChar == 92) jjAddStates(882, 883); break; case 9: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(121, 126); break; case 11: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(127, 135); break; case 12: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(136, 140); break; case 13: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(141, 146); break; case 14: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(147, 153); break; case 15: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(154, 161); break; case 20: case 25: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(110, 113); break; case 22: if (curChar == 92) jjAddStates(884, 887); break; case 24: if (curChar == 92) jjAddStates(888, 889); break; case 26: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(162, 167); break; case 28: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(168, 176); break; case 29: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(177, 181); break; case 30: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(182, 187); break; case 31: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(188, 194); break; case 32: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(195, 202); break; case 37: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddTwoStates(37, 38); break; case 38: if (curChar == 92) jjAddStates(890, 891); break; case 39: if ((0x7fffffffffffffffL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddTwoStates(37, 38); break; case 40: if ((0x7e0000007eL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(203, 206); break; case 42: if ((0x7e0000007eL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(207, 213); break; case 43: if ((0x7e0000007eL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(214, 216); break; case 44: if ((0x7e0000007eL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(217, 220); break; case 45: if ((0x7e0000007eL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(221, 225); break; case 46: if ((0x7e0000007eL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddStates(226, 231); break; case 47: if (curChar == 64) jjAddStates(873, 874); break; case 49: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 50: if (curChar == 92) jjCheckNAddTwoStates(51, 52); break; case 51: if ((0x7fffffffffffffffL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 52: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(232, 235); break; case 54: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(236, 242); break; case 55: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(243, 245); break; case 56: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(246, 249); break; case 57: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(250, 254); break; case 58: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(255, 260); break; case 59: if (curChar == 92) jjCheckNAddTwoStates(51, 60); break; case 60: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(261, 264); break; case 61: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(265, 271); break; case 62: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(272, 274); break; case 63: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(275, 278); break; case 64: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(279, 283); break; case 65: if ((0x7e0000007eL & l) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddStates(284, 289); break; case 68: if ((0x10000000100000L & l) != 0L && kind > 66) kind = 66; break; case 69: if ((0x400000004000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 68; break; case 70: if ((0x200000002L & l) != 0L) jjstateSet[jjnewStateCnt++] = 69; break; case 71: if ((0x10000000100000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 70; break; case 72: if ((0x4000000040000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 71; break; case 73: if ((0x800000008000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 72; break; case 74: if ((0x1000000010000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 73; break; case 75: if ((0x200000002000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 74; break; case 76: if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 75; break; case 77: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(99, 109); break; case 78: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); break; case 79: if (curChar == 92) jjCheckNAddTwoStates(80, 81); break; case 80: if ((0x7fffffffffffffffL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); break; case 81: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(290, 293); break; case 83: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(294, 300); break; case 84: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(301, 303); break; case 85: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(304, 307); break; case 86: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(308, 312); break; case 87: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(313, 318); break; case 88: if ((0x7fffffe87fffffeL & l) != 0L) jjCheckNAddStates(6, 8); break; case 89: if (curChar == 124 && kind > 40) kind = 40; break; case 90: if (curChar == 92) jjCheckNAddTwoStates(91, 92); break; case 91: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(6, 8); break; case 92: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(319, 323); break; case 94: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(324, 331); break; case 95: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(332, 335); break; case 96: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(336, 340); break; case 97: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(341, 346); break; case 98: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(347, 353); break; case 99: if ((0x7fffffe87fffffeL & l) != 0L) jjCheckNAddStates(3, 5); break; case 100: if (curChar == 124) jjAddStates(863, 864); break; case 101: case 102: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 103: if (curChar == 92) jjCheckNAddTwoStates(104, 105); break; case 104: if ((0x7fffffffffffffffL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 105: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(354, 357); break; case 107: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(358, 364); break; case 108: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(365, 367); break; case 109: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(368, 371); break; case 110: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(372, 376); break; case 111: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(377, 382); break; case 112: if (curChar == 92) jjCheckNAddTwoStates(104, 113); break; case 113: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(383, 386); break; case 114: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(387, 393); break; case 115: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(394, 396); break; case 116: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(397, 400); break; case 117: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(401, 405); break; case 118: if ((0x7e0000007eL & l) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddStates(406, 411); break; case 119: if (curChar == 92) jjCheckNAddTwoStates(120, 121); break; case 120: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(3, 5); break; case 121: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(412, 416); break; case 123: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(417, 424); break; case 124: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(425, 428); break; case 125: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(429, 433); break; case 126: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(434, 439); break; case 127: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(440, 446); break; case 128: if ((0x7fffffe87fffffeL & l) != 0L) jjCheckNAddStates(0, 2); break; case 130: if (curChar == 92) jjCheckNAddTwoStates(131, 132); break; case 131: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(0, 2); break; case 132: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(447, 451); break; case 134: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(452, 459); break; case 135: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(460, 463); break; case 136: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(464, 468); break; case 137: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(469, 474); break; case 138: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(475, 481); break; case 144: if ((0x10000000100000L & l) != 0L && kind > 42) kind = 42; break; case 145: if ((0x1000000010000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 144; break; case 147: if ((0x200000002000L & l) != 0L && kind > 43) kind = 43; break; case 148: if ((0x200000002000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 147; break; case 150: if ((0x200000002000L & l) != 0L && kind > 44) kind = 44; break; case 151: if ((0x800000008L & l) != 0L) jjstateSet[jjnewStateCnt++] = 150; break; case 153: if ((0x800000008L & l) != 0L && kind > 45) kind = 45; break; case 154: if ((0x1000000010000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 153; break; case 156: if ((0x400000004000L & l) != 0L && kind > 46) kind = 46; break; case 157: if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 156; break; case 159: if ((0x100000001000000L & l) != 0L && kind > 47) kind = 47; break; case 160: if ((0x1000000010000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 159; break; case 162: if ((0x200000002000L & l) != 0L && kind > 48) kind = 48; break; case 163: if ((0x2000000020L & l) != 0L) jjstateSet[jjnewStateCnt++] = 162; break; case 165: if ((0x100000001000000L & l) != 0L && kind > 49) kind = 49; break; case 166: if ((0x2000000020L & l) != 0L) jjstateSet[jjnewStateCnt++] = 165; break; case 168: if ((0x8000000080L & l) != 0L && kind > 50) kind = 50; break; case 169: if ((0x2000000020L & l) != 0L) jjstateSet[jjnewStateCnt++] = 168; break; case 170: if ((0x1000000010L & l) != 0L) jjstateSet[jjnewStateCnt++] = 169; break; case 172: if ((0x1000000010L & l) != 0L && kind > 51) kind = 51; break; case 173: if ((0x200000002L & l) != 0L) jjstateSet[jjnewStateCnt++] = 172; break; case 174: if ((0x4000000040000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 173; break; case 176: if ((0x1000000010L & l) != 0L && kind > 52) kind = 52; break; case 177: if ((0x200000002L & l) != 0L) jjstateSet[jjnewStateCnt++] = 176; break; case 178: if ((0x4000000040000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 177; break; case 179: if ((0x8000000080L & l) != 0L) jjstateSet[jjnewStateCnt++] = 178; break; case 181: if ((0x8000000080000L & l) != 0L && kind > 53) kind = 53; break; case 182: if ((0x200000002000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 181; break; case 184: if ((0x8000000080000L & l) != 0L && kind > 54) kind = 54; break; case 186: if ((0x400000004000000L & l) != 0L && kind > 55) kind = 55; break; case 187: if ((0x10000000100L & l) != 0L) jjstateSet[jjnewStateCnt++] = 186; break; case 189: if ((0x400000004000000L & l) != 0L && kind > 56) kind = 56; break; case 190: if ((0x10000000100L & l) != 0L) jjstateSet[jjnewStateCnt++] = 189; break; case 191: if ((0x80000000800L & l) != 0L) jjstateSet[jjnewStateCnt++] = 190; break; case 193: case 194: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 195: if (curChar == 92) jjCheckNAddTwoStates(196, 197); break; case 196: if ((0x7fffffffffffffffL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 197: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(482, 485); break; case 199: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(486, 492); break; case 200: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(493, 495); break; case 201: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(496, 499); break; case 202: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(500, 504); break; case 203: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(505, 510); break; case 204: if (curChar == 92) jjCheckNAddTwoStates(196, 205); break; case 205: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(511, 514); break; case 206: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(515, 521); break; case 207: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(522, 524); break; case 208: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(525, 528); break; case 209: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(529, 533); break; case 210: if ((0x7e0000007eL & l) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddStates(534, 539); break; case 211: if ((0x20000000200000L & l) != 0L) jjAddStates(875, 877); break; case 213: case 217: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(546, 549); break; case 216: if (curChar == 92) jjAddStates(892, 893); break; case 218: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(550, 554); break; case 220: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(555, 562); break; case 221: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(563, 566); break; case 222: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(567, 571); break; case 223: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(572, 577); break; case 224: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(578, 584); break; case 226: case 231: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(585, 588); break; case 228: if (curChar == 92) jjAddStates(894, 897); break; case 230: if (curChar == 92) jjAddStates(898, 899); break; case 232: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(589, 594); break; case 234: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(595, 603); break; case 235: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(604, 608); break; case 236: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(609, 614); break; case 237: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(615, 621); break; case 238: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(622, 629); break; case 243: case 248: if ((0x7fffffffffffffffL & l) != 0L) jjCheckNAddStates(630, 633); break; case 245: if (curChar == 92) jjAddStates(900, 903); break; case 247: if (curChar == 92) jjAddStates(904, 905); break; case 249: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(634, 639); break; case 251: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(640, 648); break; case 252: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(649, 653); break; case 253: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(654, 659); break; case 254: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(660, 666); break; case 255: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(667, 674); break; case 260: if ((0x100000001000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 212; break; case 261: if ((0x4000000040000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 260; break; case 269: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjAddStates(691, 696); break; case 270: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 271; break; case 271: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 272; break; case 272: if ((0x7e0000007eL & l) != 0L) jjCheckNAdd(273); break; case 273: if ((0x7e0000007eL & l) != 0L && kind > 76) kind = 76; break; case 274: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 275; break; case 275: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 276; break; case 276: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 277; break; case 277: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 265; break; case 278: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 279; break; case 279: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 280; break; case 280: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 281; break; case 282: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 283; break; case 283: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 284; break; case 286: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 287; break; case 295: if ((0x7e0000007eL & l) != 0L) jjCheckNAddTwoStates(296, 302); break; case 297: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjstateSet[jjnewStateCnt++] = 298; break; case 298: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAddStates(707, 710); break; case 299: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAdd(273); break; case 300: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAddTwoStates(273, 299); break; case 301: if ((0x7e0000007eL & l) == 0L) break; if (kind > 76) kind = 76; jjCheckNAddStates(711, 713); break; case 302: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(714, 718); break; case 303: if ((0x7e0000007eL & l) != 0L) jjCheckNAdd(296); break; case 304: if ((0x7e0000007eL & l) != 0L) jjCheckNAddTwoStates(303, 296); break; case 305: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(719, 721); break; case 306: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(722, 725); break; case 307: if (curChar == 92) jjCheckNAddStates(865, 872); break; case 308: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(726, 729); break; case 309: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(730, 736); break; case 310: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(737, 739); break; case 311: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(740, 743); break; case 312: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(744, 748); break; case 313: if ((0x7e0000007eL & l) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(749, 754); break; case 314: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(755, 759); break; case 315: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(760, 767); break; case 316: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(768, 771); break; case 317: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(772, 776); break; case 318: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(777, 782); break; case 319: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(783, 789); break; case 320: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(790, 794); break; case 321: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(795, 802); break; case 322: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(803, 806); break; case 323: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(807, 811); break; case 324: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(812, 817); break; case 325: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(818, 824); break; case 326: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(825, 829); break; case 327: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(830, 837); break; case 328: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(838, 841); break; case 329: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(842, 846); break; case 330: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(847, 852); break; case 331: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(853, 859); break; default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 388: if ((jjbitVec0[i2] & l2) != 0L) { if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); } if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(6, 8); if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(3, 5); if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(0, 2); break; case 1: if ((jjbitVec0[i2] & l2) != 0L) { if (kind > 25) kind = 25; } if ((jjbitVec0[i2] & l2) != 0L) { if (kind > 36) kind = 36; jjCheckNAddStates(99, 109); } break; case 389: case 49: case 51: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 48: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 65) kind = 65; jjCheckNAddTwoStates(49, 50); break; case 3: case 8: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(114, 117); break; case 20: case 25: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(110, 113); break; case 37: case 39: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 58) kind = 58; jjCheckNAddTwoStates(37, 38); break; case 77: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddStates(99, 109); break; case 78: case 80: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 36) kind = 36; jjCheckNAddTwoStates(78, 79); break; case 88: case 91: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(6, 8); break; case 99: case 120: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(3, 5); break; case 101: case 102: case 104: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 40) kind = 40; jjCheckNAddTwoStates(102, 103); break; case 128: case 131: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(0, 2); break; case 193: case 194: case 196: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 57) kind = 57; jjCheckNAddTwoStates(194, 195); break; case 213: case 217: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(546, 549); break; case 226: case 231: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(585, 588); break; case 243: case 248: if ((jjbitVec0[i2] & l2) != 0L) jjCheckNAddStates(630, 633); break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 387 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private final int jjMoveStringLiteralDfa0_1() { switch(curChar) { case 42: return jjMoveStringLiteralDfa1_1(0x8L); default : return 1; } } private final int jjMoveStringLiteralDfa1_1(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 1; } switch(curChar) { case 47: if ((active0 & 0x8L) != 0L) return jjStopAtPos(1, 3); break; default : return 2; } return 2; } static final int[] jjnextStates = { 128, 129, 130, 99, 100, 119, 88, 89, 90, 333, 334, 335, 336, 337, 338, 142, 339, 340, 341, 145, 342, 343, 344, 148, 345, 346, 347, 151, 348, 349, 350, 154, 351, 352, 353, 157, 354, 355, 356, 160, 357, 358, 359, 163, 360, 361, 362, 166, 363, 364, 365, 170, 366, 367, 368, 174, 369, 370, 371, 179, 372, 373, 374, 182, 375, 376, 377, 184, 378, 379, 380, 187, 381, 382, 383, 191, 384, 385, 386, 193, 204, 140, 141, 143, 146, 149, 152, 155, 158, 161, 164, 167, 171, 175, 180, 183, 185, 188, 192, 78, 88, 89, 99, 100, 128, 129, 130, 119, 90, 79, 20, 21, 22, 24, 3, 4, 5, 7, 192, 193, 204, 3, 10, 4, 5, 7, 11, 3, 12, 10, 4, 5, 7, 13, 14, 15, 3, 10, 4, 5, 7, 3, 12, 10, 4, 5, 7, 3, 12, 10, 4, 5, 7, 13, 3, 12, 10, 4, 5, 7, 13, 14, 20, 27, 21, 22, 24, 28, 20, 29, 27, 21, 22, 24, 30, 31, 32, 20, 27, 21, 22, 24, 20, 29, 27, 21, 22, 24, 20, 29, 27, 21, 22, 24, 30, 20, 29, 27, 21, 22, 24, 30, 31, 37, 41, 38, 42, 37, 43, 41, 38, 44, 45, 46, 37, 41, 38, 37, 43, 41, 38, 37, 43, 41, 38, 44, 37, 43, 41, 38, 44, 45, 49, 53, 50, 54, 49, 55, 53, 50, 56, 57, 58, 49, 53, 50, 49, 55, 53, 50, 49, 55, 53, 50, 56, 49, 55, 53, 50, 56, 57, 53, 49, 50, 61, 62, 53, 49, 50, 63, 64, 65, 53, 49, 50, 62, 53, 49, 50, 62, 53, 49, 50, 63, 62, 53, 49, 50, 63, 64, 78, 82, 79, 83, 78, 84, 82, 79, 85, 86, 87, 78, 82, 79, 78, 84, 82, 79, 78, 84, 82, 79, 85, 78, 84, 82, 79, 85, 86, 88, 93, 89, 90, 94, 88, 95, 93, 89, 90, 96, 97, 98, 88, 93, 89, 90, 88, 95, 93, 89, 90, 88, 95, 93, 89, 90, 96, 88, 95, 93, 89, 90, 96, 97, 102, 106, 103, 107, 102, 108, 106, 103, 109, 110, 111, 102, 106, 103, 102, 108, 106, 103, 102, 108, 106, 103, 109, 102, 108, 106, 103, 109, 110, 106, 102, 103, 114, 115, 106, 102, 103, 116, 117, 118, 106, 102, 103, 115, 106, 102, 103, 115, 106, 102, 103, 116, 115, 106, 102, 103, 116, 117, 99, 122, 100, 119, 123, 99, 124, 122, 100, 119, 125, 126, 127, 99, 122, 100, 119, 99, 124, 122, 100, 119, 99, 124, 122, 100, 119, 125, 99, 124, 122, 100, 119, 125, 126, 128, 133, 129, 130, 134, 128, 135, 133, 129, 130, 136, 137, 138, 128, 133, 129, 130, 128, 135, 133, 129, 130, 128, 135, 133, 129, 130, 136, 128, 135, 133, 129, 130, 136, 137, 194, 198, 195, 199, 194, 200, 198, 195, 201, 202, 203, 194, 198, 195, 194, 200, 198, 195, 194, 200, 198, 195, 201, 194, 200, 198, 195, 201, 202, 198, 194, 195, 206, 207, 198, 194, 195, 208, 209, 210, 198, 194, 195, 207, 198, 194, 195, 207, 198, 194, 195, 208, 207, 198, 194, 195, 208, 209, 213, 225, 242, 215, 216, 259, 213, 214, 215, 216, 213, 215, 216, 219, 220, 213, 221, 215, 216, 219, 222, 223, 224, 213, 215, 216, 219, 213, 221, 215, 216, 219, 213, 221, 215, 216, 219, 222, 213, 221, 215, 216, 219, 222, 223, 226, 227, 228, 230, 226, 233, 227, 228, 230, 234, 226, 235, 233, 227, 228, 230, 236, 237, 238, 226, 233, 227, 228, 230, 226, 235, 233, 227, 228, 230, 226, 235, 233, 227, 228, 230, 236, 226, 235, 233, 227, 228, 230, 236, 237, 243, 244, 245, 247, 243, 250, 244, 245, 247, 251, 243, 252, 250, 244, 245, 247, 253, 254, 255, 243, 250, 244, 245, 247, 243, 252, 250, 244, 245, 247, 243, 252, 250, 244, 245, 247, 253, 243, 252, 250, 244, 245, 247, 253, 254, 213, 225, 242, 214, 215, 216, 259, 263, 269, 265, 266, 267, 268, 265, 266, 267, 270, 274, 278, 282, 286, 290, 265, 288, 289, 265, 291, 292, 293, 265, 291, 292, 273, 299, 300, 301, 273, 299, 300, 303, 296, 304, 305, 306, 303, 296, 304, 303, 296, 304, 305, 82, 78, 79, 309, 310, 82, 78, 79, 311, 312, 313, 82, 78, 79, 310, 82, 78, 79, 310, 82, 78, 79, 311, 310, 82, 78, 79, 311, 312, 93, 88, 89, 90, 315, 316, 93, 88, 89, 90, 317, 318, 319, 93, 88, 89, 90, 316, 93, 88, 89, 90, 316, 93, 88, 89, 90, 317, 316, 93, 88, 89, 90, 317, 318, 122, 99, 100, 119, 321, 322, 122, 99, 100, 119, 323, 324, 325, 122, 99, 100, 119, 322, 122, 99, 100, 119, 322, 122, 99, 100, 119, 323, 322, 122, 99, 100, 119, 323, 324, 133, 128, 129, 130, 327, 328, 133, 128, 129, 130, 329, 330, 331, 133, 128, 129, 130, 328, 133, 128, 129, 130, 328, 133, 128, 129, 130, 329, 328, 133, 128, 129, 130, 329, 330, 384, 193, 204, 101, 112, 80, 308, 91, 314, 120, 320, 131, 326, 48, 59, 261, 262, 294, 6, 16, 18, 17, 8, 9, 23, 33, 35, 34, 25, 26, 39, 40, 217, 218, 229, 239, 241, 240, 231, 232, 246, 256, 258, 257, 248, 249, }; public static final String[] jjstrLiteralImages = { "", null, null, null, null, "\74\41\55\55", "\55\55\76", "\173", "\175", "\174\75", "\176\75", "\75", "\53", "\55", "\54", "\73", "\76", "\57", "\133", "\135", "\52", "\56", "\51", "\50", "\72", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }; public static final String[] lexStateNames = { "DEFAULT", "IN_COMMENT", }; public static final int[] jjnewLexState = { -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { 0xffffffb803ffffe3L, 0x7007L, }; static final long[] jjtoSkip = { 0x8L, 0x0L, }; static final long[] jjtoMore = { 0x14L, 0x0L, }; protected CharStream input_stream; private final int[] jjrounds = new int[387]; private final int[] jjstateSet = new int[774]; StringBuffer image; int jjimageLen; int lengthOfMatch; protected char curChar; public ParserTokenManager(CharStream stream) { input_stream = stream; } public ParserTokenManager(CharStream stream, int lexState) { this(stream); SwitchTo(lexState); } public void ReInit(CharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private final void ReInitRounds() { int i; jjround = 0x80000001; for (i = 387; i-- > 0;) jjrounds[i] = 0x80000000; } public void ReInit(CharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } public void SwitchTo(int lexState) { if (lexState >= 2 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } protected Token jjFillToken() { Token t = Token.newToken(jjmatchedKind); t.kind = jjmatchedKind; String im = jjstrLiteralImages[jjmatchedKind]; t.image = (im == null) ? input_stream.GetImage() : im; t.beginLine = input_stream.getBeginLine(); t.beginColumn = input_stream.getBeginColumn(); t.endLine = input_stream.getEndLine(); t.endColumn = input_stream.getEndColumn(); return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; public Token getNextToken() { int kind; Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } image = null; jjimageLen = 0; for (;;) { switch(curLexState) { case 0: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedPos == 0 && jjmatchedKind > 78) { jjmatchedKind = 78; } break; case 1: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_1(); if (jjmatchedPos == 0 && jjmatchedKind > 4) { jjmatchedKind = 4; } break; } if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); TokenLexicalActions(matchedToken); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; return matchedToken; } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; continue EOFLoop; } jjimageLen += jjmatchedPos + 1; if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; curPos = 0; jjmatchedKind = 0x7fffffff; try { curChar = input_stream.readChar(); continue; } catch (java.io.IOException e1) { } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } void TokenLexicalActions(Token matchedToken) { switch(jjmatchedKind) { case 1 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)))); else image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); image = Parser.SPACE; break; default : break; } } } flute-1.1.6/source/org/w3c/flute/parser/LocatorImpl.java0000644000175000017500000000670111365604770021605 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 1999 - 2009 Pentaho Corporation, World Wide Web Consortium. All rights reserved. */ package org.w3c.flute.parser; import org.w3c.css.sac.Locator; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ public class LocatorImpl implements Locator { // W3C DEBUG mode private static boolean W3CDebug; static { try { W3CDebug = (Boolean.getBoolean("debug") || Boolean.getBoolean("org.w3c.flute.parser.LocatorImpl.debug") || Boolean.getBoolean("org.w3c.flute.parser.debug") || Boolean.getBoolean("org.w3c.flute.debug") || Boolean.getBoolean("org.w3c.debug") || Boolean.getBoolean("org.debug")); } catch (Exception e) { // nothing } } String uri; int line; int column; public String getURI() { return uri; } public int getLineNumber() { return line; } public int getColumnNumber() { return column; } /** * Creates a new LocatorImpl */ public LocatorImpl(Parser p) { if (W3CDebug) { System.err.println( "LocatorImpl::newLocator(" + p + ");"); } uri = p.source.getURI(); line = p.token.beginLine; column = p.token.beginColumn; } /** * Reinitializes a LocatorImpl */ public LocatorImpl(Parser p, Token tok) { if (W3CDebug) { System.err.println( "LocatorImpl::newLocator(" + p + ", " + tok + ");"); } uri = p.source.getURI(); line = tok.beginLine; column = tok.beginColumn; } /** * Reinitializes a LocatorImpl */ public LocatorImpl(Parser p, int line, int column) { if (W3CDebug) { System.err.println( "LocatorImpl::newLocator(" + p + ", " + line + ", " + column + ");"); } uri = p.source.getURI(); this.line = line; this.column = column; } /** * Reinitializes a LocatorImpl */ public LocatorImpl reInit(Parser p) { if (W3CDebug) { System.err.println( "LocatorImpl::reInit(" + p + ");" ); } uri = p.source.getURI(); line = p.token.beginLine; column = p.token.beginColumn; return this; } /** * Reinitializes a LocatorImpl */ public LocatorImpl reInit(Parser p, Token tok) { if (W3CDebug) { System.err.println( "LocatorImpl::reInit(" + p + ", " + tok + ");"); } uri = p.source.getURI(); line = tok.beginLine; column = tok.beginColumn; return this; } /** * Reinitializes a LocatorImpl */ public LocatorImpl reInit(Parser p, int line, int column) { if (W3CDebug) { System.err.println("LocatorImpl::reInit(" + p + ", " + line + ", " + column + ");"); } uri = p.source.getURI(); this.line = line; this.column = column; return this; } } flute-1.1.6/source/org/w3c/flute/parser/TokenMgrError.java0000644000175000017500000001154011365604770022115 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; public class TokenMgrError extends Error { /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error * curLexState : lexical state in which this error occured * errorLine : line number when the error occured * errorColumn : column number when the error occured * errorAfter : prefix that was seen before this error occured * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } flute-1.1.6/source/org/w3c/flute/parser/ThrowedParseException.java0000644000175000017500000000217211365604770023644 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2009 Pentaho Corporation. All rights reserved. */ package org.w3c.flute.parser; /** * @version $Revision: 9877 $ * @author Philippe Le Hegaret */ class ThrowedParseException extends RuntimeException { ParseException e; /** * Creates a new ThrowedParseException */ ThrowedParseException(ParseException e) { this.e = e; } } flute-1.1.6/README.txt0000644000175000017500000000156311365604770013016 0ustar renereneThe grammar of the parser has been changed to be a little bit more suitable for CSS3. The @page-rule grammer given in the CSS3-Page module was funny, but unusable. Therefore it has been replaced by a simplicistic approach. The margin-rules now have to follow the property declarations - mixing margins and property declarations is no longer valid. The margin-box rules get forwarded to the 'ignorableAtRule' method of the Handler class - we have to maintain API level compatibility for BIRT and other projects, which may depend on that parser. The selector syntax is also upgraded to CSS3 - especially the pseudo-elements were not parsed and caused trouble here. As this did not work before, stylesheets of other programms should not be affected by this change - if they specified things which were known not to work and start dying if it works - well, that's bad luck, I guess. flute-1.1.6/test-lib/0000755000175000017500000000000011365605034013030 5ustar renereneflute-1.1.6/COPYRIGHT.html0000644000175000017500000000726511365604770013563 0ustar renerene W3C IPR SOFTWARE NOTICE

W3C IPR SOFTWARE NOTICE

Copyright © 2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.

Note: The original version of the W3C Software Copyright Notice and License could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720

Copyright © 1994-2000 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/

This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:

Permission to use, copy, and modify this software and its documentation, with or without modification,  for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:

  1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
  2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © 2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
  3. Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.

The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.

flute-1.1.6/ChangeLog.txt0000644000175000017500000000000011365604770013671 0ustar renereneflute-1.1.6/devresource/0000755000175000017500000000000011365604770013641 5ustar renereneflute-1.1.6/devresource/META-INF/0000755000175000017500000000000011365604770015001 5ustar renereneflute-1.1.6/devresource/META-INF/MANIFEST.MF0000644000175000017500000000043711365604770016437 0ustar renereneSpecification-Title: flute Specification-Vendor: The World-Wide-Web Consortium Implementation-Title: flute Implementation-Vendor: Pentaho Corporation Implementation-ProductID: flute Release-Major-Number: 1 Release-Minor-Number: 3 Release-Milestone-Number: 0 Release-Candidate-Token: dev flute-1.1.6/dev-lib/0000755000175000017500000000000011365604774012641 5ustar renereneflute-1.1.6/.classpath0000644000175000017500000000141311365604770013275 0ustar renerene flute-1.1.6/flute.iml0000644000175000017500000001703411365604766013147 0ustar renerene flute-1.1.6/ivysettings.xml0000644000175000017500000000174311365604770014432 0ustar renerene flute-1.1.6/lib/0000755000175000017500000000000011635760310012052 5ustar renereneflute-1.1.6/ChangeLog0000644000175000017500000000173011365604770013066 0ustar renerene * Changed the grammar to support vendor-extension stylekeys. Vendor specific stylekeys must be preceeded with '-x-vendorname-', for instance '-x-moz-' for keys defined by the Mozilla foundation. Both "_" and "-" have been added as valid name-token-chars. 23-Apr-2006: Flute 1.3-jfree * Changed the grammar to accept namespaces. As we have to co-exist with Birt, we can't change the overal semantics; therefore we map the raw- strings into the single name-property and leave the namespace parameter unused. LibLayout's SelectorFactory later parses that raw-format and translates the prefixes into URIs. The same happens for attribute values for the 'attr(..)' function (This seems to be the only place in the value space, where namespaces are used at all.) While working on it, I changed what seemed to be a bug in the LexicalUnit class: 'Ident'-Units should not print themself as 'attr(..)' functions.flute-1.1.6/common_build.xml0000644000175000017500000020225611365604770014513 0ustar renerene ------------------------------------------------------------------------------- Common Build file provides tasks needed to perform a project build. It is typically not used directly but imported by each project's build.xml file. The build.xml file can override tasks when customization is required. MAIN TARGETS ============ * clean / clean-all : remove all artifacts of the build, clean-all adds the removal of any library or jar dependencies downloaded as part of the build * resolve : download/refresh library or jar dependencies needed for the build (uses Apache IVY) * compile : run javac on the project's source * jar : creates a jar file * dist : creates all project distributables * test : runs JUnit tests from your project's test source SPECIAL TARGETS ============ * publish-local : builds a jar for your project and registers it with the local artifact repository isolated to your machine at $HOME/.ivy2/local. Further executions of the the resolve target by this or other projects will find your published jar. * ivy-clean* : this family of targets helps reset your IVY environment in the event that you are having difficulty resolving dependencies TYPICAL TARGET SEQUENCE ============ * clean-all resolve dist : a good start to build all project distributables from scratch. Note that jar dependencies will not be downloaded unless you explicitly run the resolve target. We made the resolution and retrieval completely discretionary since there are many situations in which you will not want to get or refresh dependencies, e.g. if you are offline with no Internet access. In such case, you could just run "dist" if the set of jars you already have are sufficient. flute-1.1.6/.project0000644000175000017500000000057511365604770012771 0ustar renerene flute org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature flute-1.1.6/ant/0000755000175000017500000000000011365604770012075 5ustar renereneflute-1.1.6/ant/build-lib.xml0000644000175000017500000006224211365604770014470 0ustar renerene flute-1.1.6/ivy.xml0000644000175000017500000000134211365604770012644 0ustar renerene flute-1.1.6/build.xml0000644000175000017500000000323311365604770013135 0ustar renerene This build file is used to create the API project and works with the common_build.xml file. flute-1.1.6/build.properties0000644000175000017500000000027311365604770014532 0ustar renereneproject.revision=1.1-SNAPSHOT ivy.artifact.group=pentaho-library ivy.artifact.id=flute impl.title=Flute impl.productID=flute src.dir=${basedir}/source javadoc.packagenames=org.w3c.flute.*