Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
r1435 - in guix/trunk/guix-compiler/src/main/java/org/w3c: css/sac css/sac/helpers flute/parser/selectors flute/util
by kmorin@users.labs.libre-entreprise.org 19 May '09
by kmorin@users.labs.libre-entreprise.org 19 May '09
19 May '09
Author: kmorin
Date: 2009-05-19 08:39:48 +0000 (Tue, 19 May 2009)
New Revision: 1435
Added:
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties
Log:
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,32 @@
+/*
+ * 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: SelectorList.java,v 1.1 1999/09/26 10:06:45 plehegar Exp $
+ */
+package org.w3c.css.sac;
+
+/**
+ * The SelectorList interface provides the abstraction of an ordered collection
+ * of selectors, without defining or constraining how this collection is
+ * implemented.
+ *
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public interface SelectorList {
+
+ /**
+ * Returns the length of this selector list
+ */
+ public int getLength();
+
+ /**
+ * Returns the selector at the specified index, or <code>null</code> if this
+ * is not a valid index.
+ */
+ public Selector item(int index);
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ParserFactory.java,v 1.1 2000/02/14 15:54:49 plehegar Exp $
+ */
+package org.w3c.css.sac.helpers;
+
+import org.w3c.css.sac.Parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class ParserFactory {
+
+ /**
+ * Create a parser with given selectors factory and conditions factory.
+ */
+ public Parser makeParser()
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ NullPointerException,
+ ClassCastException {
+ String className = System.getProperty("org.w3c.css.sac.parser");
+ if (className == null) {
+ throw new NullPointerException("No value for sac.parser property");
+ } else {
+ return (Parser)(Class.forName(className).newInstance());
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: AndConditionImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.CombinatorCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.1 $
+ * @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 <code>Condition</code>.
+ */
+ 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;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: AttributeConditionImpl.java,v 1.2 2002/06/17 14:08:15 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_ATTRIBUTE_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> 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;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: BeginHyphenAttributeConditionImpl.java,v 1.2 2002/06/17 14:11:10 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_BEGIN_HYPHEN_ATTRIBUTE_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> 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;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ChildSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+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: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class ChildSelectorImpl implements DescendantSelector {
+
+ Selector parent;
+ SimpleSelector child;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ 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;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ClassConditionImpl.java,v 1.2 2002/06/17 14:10:28 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_CLASS_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> 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;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ConditionFactoryImpl.java,v 1.2 2002/06/17 14:12:38 plehegar Exp $
+ */
+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: 1.2 $
+ * @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 <code>true</code> if the list should contain
+ * only nodes of the same type (element, text node, ...).
+ * @param type <code>true</code> 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 <code>true</code> 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 <code>true</code> 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 <code>true</code> 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 <code>true</code> 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);
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ConditionalSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+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: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class ConditionalSelectorImpl implements ConditionalSelector {
+
+ SimpleSelector simpleSelector;
+ Condition condition;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ 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.
+ * <p>The simple selector can't be a <code>ConditionalSelector</code>.</p>
+ */
+ public SimpleSelector getSimpleSelector() {
+ return simpleSelector;
+ }
+
+ /**
+ * Returns the condition to be applied on the simple selector.
+ */
+ public Condition getCondition() {
+ return condition;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: DescendantSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+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: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class DescendantSelectorImpl implements DescendantSelector {
+
+ Selector parent;
+ SimpleSelector simpleSelector;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ 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;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: DirectAdjacentSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+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: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class DirectAdjacentSelectorImpl implements SiblingSelector {
+
+ Selector child;
+ SimpleSelector directAdjacent;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ 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;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ElementSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.ElementSelector;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @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 <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_ELEMENT_NODE_SELECTOR;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this element selector.
+ * <p><code>NULL</code> if this element selector can match any namespace.</p>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this element.
+ * <p><code>NULL</code> if this element selector can match any element.</p>
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: IdConditionImpl.java,v 1.2 2002/06/17 14:08:28 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_ID_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> 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;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: LangConditionImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.LangCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.1 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_LANG_CONDITION;
+ }
+
+ /**
+ * Returns the language
+ */
+ public String getLang() {
+ return lang;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: OneOfAttributeConditionImpl.java,v 1.2 2002/06/17 14:09:59 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_ONE_OF_ATTRIBUTE_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> 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;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: PseudoClassConditionImpl.java,v 1.2 2002/06/17 14:08:37 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @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 <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_PSEUDO_CLASS_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> 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;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: PseudoElementSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.ElementSelector;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @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 <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_PSEUDO_ELEMENT_SELECTOR;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this element selector.
+ * <p><code>NULL</code> if this element selector can match any namespace.</p>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this element.
+ * <p><code>NULL</code> if this element selector can match any element.</p>
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: SelectorFactoryImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+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: 1.2 $
+ * @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 <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of the element selector.
+ * @param tagName the <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local
+ * part</a> of the element name. <code>NULL</code> if this element
+ * selector can match any element.</p>
+ * @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. <code>NULL</code> if this
+ * element selector can match any pseudo element.</p>
+ * @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);
+ }
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,49 @@
+/*
+ * 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: Encoding.java,v 1.1 1999/04/02 13:23:32 plehegar Exp $
+ */
+package org.w3c.flute.util;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * @version $Revision: 1.1 $
+ * @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();
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+iso-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
1
0
r1434 - in guix/trunk/guix-test: . src/main/java/org/nuiton/guix src/main/java/org/nuiton/guix/demo
by kmorin@users.labs.libre-entreprise.org 19 May '09
by kmorin@users.labs.libre-entreprise.org 19 May '09
19 May '09
Author: kmorin
Date: 2009-05-19 08:39:27 +0000 (Tue, 19 May 2009)
New Revision: 1434
Added:
guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java
guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java
Modified:
guix/trunk/guix-test/pom.xml
guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css
guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
Log:
Modified: guix/trunk/guix-test/pom.xml
===================================================================
--- guix/trunk/guix-test/pom.xml 2009-05-19 08:39:17 UTC (rev 1433)
+++ guix/trunk/guix-test/pom.xml 2009-05-19 08:39:27 UTC (rev 1434)
@@ -25,6 +25,11 @@
<artifactId>spring-beans</artifactId>
<version>2.0.5</version>
</dependency>
+ <dependency>
+ <groupId>org.jdesktop</groupId>
+ <artifactId>beansbinding</artifactId>
+ <version>1.2.1</version>
+ </dependency>
</dependencies>
@@ -61,7 +66,7 @@
<guixFilesDir>/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
<targetDirectory>/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test/target/generatedFiles/</targetDirectory>
<rootPackage>org.nuiton.guix</rootPackage>
- <mainClass>org.nuiton.guix.GuixDemo2</mainClass>
+ <mainClass>org.nuiton.guix.GuixDemo</mainClass>
</configuration>
<executions>
<execution>
Added: guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java (rev 0)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java 2009-05-19 08:39:27 UTC (rev 1434)
@@ -0,0 +1,144 @@
+package org.nuiton.guix;
+
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.JLabel;
+import org.nuiton.guix.GuixDemo2;
+import javax.swing.*;
+import java.awt.*;
+
+public class GuixDemo extends javax.swing.JFrame {
+ private org.jdesktop.beansbinding.BindingGroup bindingGroup;
+ private GuixDemo2 gd2;
+ private JLabel label;
+ private JPanel panel;
+ private JTextField textfield;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Statics methods --------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {public void run() {GuixDemo main = new GuixDemo();
+ main.pack();
+ main.setVisible(true);}});
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public GuixDemo() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
+ return bindingGroup;
+ }
+
+ public GuixDemo2 getGd2() {
+ return gd2;
+ }
+
+ public JLabel getLabel() {
+ return label;
+ }
+
+ public JPanel getPanel() {
+ return panel;
+ }
+
+ public JTextField getTextfield() {
+ return textfield;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
+ this.bindingGroup = newValue;
+ }
+
+ public void setGd2(GuixDemo2 newValue) {
+ this.gd2 = newValue;
+ }
+
+ public void setLabel(JLabel newValue) {
+ this.label = newValue;
+ }
+
+ public void setPanel(JPanel newValue) {
+ this.panel = newValue;
+ }
+
+ public void setTextfield(JTextField newValue) {
+ this.textfield = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void createComponents() {
+ this.setLayout(new FlowLayout());
+ createPanel();
+ createTextfield();
+ createLabel();
+ createGd2();
+ }
+
+ public void initComponents() {
+ this.setTitle("JAXX Demo");
+ this.setSize(300,200);
+ this.add(panel);
+ panel.add(textfield);
+ panel.add(label);
+ this.add(gd2);
+ }
+
+ public void initDataBinding() {
+ bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
+ bindingGroup.addBinding(
+ org.jdesktop.beansbinding.Bindings.createAutoBinding(
+ org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,this,org.jdesktop.beansbinding.ELProperty.create("${gd2.button.selected}"),textfield,org.jdesktop.beansbinding.BeanProperty.create("enabled")));
+ bindingGroup.bind();
+ bindingGroup.addBinding(
+ org.jdesktop.beansbinding.Bindings.createAutoBinding(
+ org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,this,org.jdesktop.beansbinding.ELProperty.create("${textfield.text}"),label,org.jdesktop.beansbinding.BeanProperty.create("text")));
+ bindingGroup.bind();
+ }
+
+ public void initialize() {
+ createComponents();
+ initComponents();
+ initDataBinding();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ private void createGd2() {
+ gd2 = new GuixDemo2();
+ }
+
+ private void createLabel() {
+ label = new JLabel();
+ label.setForeground(Color.BLUE);
+
+ }
+
+ private void createPanel() {
+ panel = new JPanel();
+ }
+
+ private void createTextfield() {
+ textfield = new JTextField("test");
+ }
+
+}
\ No newline at end of file
Added: guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java (rev 0)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-05-19 08:39:27 UTC (rev 1434)
@@ -0,0 +1,76 @@
+package org.nuiton.guix;
+
+import javax.swing.JToggleButton;
+import javax.swing.*;
+import java.awt.*;
+
+public class GuixDemo2 extends javax.swing.JPanel {
+ private org.jdesktop.beansbinding.BindingGroup bindingGroup;
+ private JToggleButton button;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public GuixDemo2() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
+ return bindingGroup;
+ }
+
+ public JToggleButton getButton() {
+ return button;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
+ this.bindingGroup = newValue;
+ }
+
+ public void setButton(JToggleButton newValue) {
+ this.button = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void createComponents() {
+ this.setLayout(new FlowLayout());
+ createButton();
+ }
+
+ public void initComponents() {
+ this.add(button);
+ }
+
+ public void initDataBinding() {
+ bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
+ }
+
+ public void initialize() {
+ createComponents();
+ initComponents();
+ initDataBinding();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ private void createButton() {
+ button = new JToggleButton();
+ button.setText("-Push me");
+ button.setSelected(false);
+ }
+
+}
\ No newline at end of file
Modified: guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-05-19 08:39:17 UTC (rev 1433)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-05-19 08:39:27 UTC (rev 1434)
@@ -1,5 +1,17 @@
-#display:{object . getText( ) . startsWith( "-" )}
+#button:{object . getText( ) . startsWith( "-" )}
{
foreground: red;
-}
+}
+#label
+{
+ background : blue;
+}
+
+
+.bold
+{
+ font : bold;
+ margin-top: 10px;
+}
+
Modified: guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-05-19 08:39:17 UTC (rev 1433)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-05-19 08:39:27 UTC (rev 1434)
@@ -1,152 +1,9 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!-- test javadoc Application -->
-<Application title="JAXX Demo" width='1024' height='800' xmlns:swing='javax.swing.*'>
- <script><![CDATA[
-
-org.codelutin.i18n.I18n.init();
-
-void $afterCompleteSetup() {
- try { jaxx.runtime.SwingUtil.initNimbusLoookAndFeel(); } catch (Exception e) { log.error(e.getMessage(), e); }
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- int i=0;
- while( i < list.getRowCount()) {
- list.expandRow(i++);
- }
- }
- });
-}
-
-]]></script>
-
- <style><![CDATA[
-#table {
- border: { BorderFactory . createEmptyBorder( 4, 4, 4, 4 )
-}
-
-;
-font-face:
-
-"Trebuchet MS"
-;
-}
-
-#display {
- background: #BCE5AD;
- opaque: true;
- horizontalAlignment: right;
- border: { BorderFactory . createBevelBorder( BevelBorder . LOWERED )
-}
-
-;
-font-size:
-
-22
-;
-font-weight: bold
-
-;
-}
-]]></style>
- <!-- test javadoc $JSplitPane1 -->
- <swing:JSplitPane>
- <!-- JSplitPane dividerLocation='200' -->
- <swing:JScrollPane>
- <swing:JTree id='list' showsRootHandles='true'
- onValueChanged='cardLayout.show(preview, list.getSelectionValue() instanceof DemoPanel ? ((DemoPanel) list.getSelectionValue()).getLabel() : emptyDemo.getLabel())'
- cellRenderer='{new javax.swing.tree.DefaultTreeCellRenderer() {
- public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
- if (value instanceof DemoPanel)
- value = ((DemoPanel) value).getLabel();
- return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
- }
- }
- }'>
- <!-- test javadoc $item1 -->
- <item value="Components">
- <item value='Buttons'>
- <item value='{buttonDemo}'/>
- <item value='{checkBoxDemo}'/>
- <item value='{radioButtonDemo}'/>
- <item value='{toggleButtonDemo}'/>
- </item>
-
- <item value='Form elements'>
- <item value='Text'>
- <item value='{passwordFieldDemo}'/>
- <item value='{textFieldDemo}'/>
- <item value='{textAreaDemo}'/>
- </item>
-
- <item value='{comboBoxDemo}'/>
- <item value='{listDemo}'/>
- <item value='{sliderDemo}'/>
- <item value='{spinnerDemo}'/>
- </item>
-
- <item value='Layout components'>
- <item value='{splitPaneDemo}'/>
- </item>
-
- <item value='Menus'>
- <item value='{menuItemDemo}'/>
- <item value='{checkBoxMenuItemDemo}'/>
- <item value='{radioButtonMenuItemDemo}'/>
- </item>
-
- <item value='Windows'>
- <item value='{dialogDemo}'/>
- </item>
-
- <item value='{progressBarDemo}'/>
-
- </item>
-
- <item value='{labelStyleDemo}'/>
-
- <item value='{counterDemo}'/>
- <item value='{calculatorDemo}'/>
-
- <item value='New features'>
- <item value='Validation'>
- <item value='{validationDemo1}'/>
- <item value='{validationDemo2}'/>
- </item>
- <item value='{dataBindingDemo}'/>
- <item value='{boxedDecoratorDemo}'/>
- </item>
- </swing:JTree>
- </swing:JScrollPane>
- <java.awt.CardLayout id='cardLayout'/>
-<script source="scriptFile.script" />
- <Panel id='preview' layout='{cardLayout}'>
- <EmptyDemo id='emptyDemo' constraints='emptyDemo.getLabel()'/>
- <JButtonDemo id='buttonDemo' constraints='buttonDemo.getLabel()'/>
- <JCheckBoxDemo id='checkBoxDemo' constraints='checkBoxDemo.getLabel()'/>
- <JCheckBoxMenuItemDemo id='checkBoxMenuItemDemo' constraints='checkBoxMenuItemDemo.getLabel()'/>
- <JComboBoxDemo id='comboBoxDemo' constraints='comboBoxDemo.getLabel()'/>
- <JDialogDemo id='dialogDemo' constraints='dialogDemo.getLabel()'/>
- <JListDemo id='listDemo' constraints='listDemo.getLabel()'/>
- <JMenuItemDemo id='menuItemDemo' constraints='menuItemDemo.getLabel()'/>
- <JPasswordFieldDemo id='passwordFieldDemo' constraints='passwordFieldDemo.getLabel()'/>
- <JProgressBarDemo id='progressBarDemo' constraints='progressBarDemo.getLabel()'/>
- <JSliderDemo id='sliderDemo' constraints='sliderDemo.getLabel()'/>
- <JSpinnerDemo id='spinnerDemo' constraints='spinnerDemo.getLabel()'/>
- <JSplitPaneDemo id='splitPaneDemo' constraints='splitPaneDemo.getLabel()'/>
- <JRadioButtonDemo id='radioButtonDemo' constraints='radioButtonDemo.getLabel()'/>
- <JRadioButtonMenuItemDemo id='radioButtonMenuItemDemo' constraints='radioButtonMenuItemDemo.getLabel()'/>
- <JToggleButtonDemo id='toggleButtonDemo' constraints='toggleButtonDemo.getLabel()'/>
- <JTextFieldDemo id='textFieldDemo' constraints='textFieldDemo.getLabel()'/>
- <JTextAreaDemo id='textAreaDemo' constraints='textAreaDemo.getLabel()'/>
- <ValidationListDemo id='validationDemo1' constraints='validationDemo1.getLabel()'/>
- <ValidationTableDemo id='validationDemo2' constraints='validationDemo2.getLabel()'/>
- <BeanDataBindingDemo id='dataBindingDemo' constraints='dataBindingDemo.getLabel()'/>
- <LabelStyleDemo id='labelStyleDemo' constraints='labelStyleDemo.getLabel()'/>
- <CounterDemo id='counterDemo' constraints='counterDemo.getLabel()'/>
- <CalculatorDemo id='calculatorDemo' constraints='calculatorDemo.getLabel()'/>
- <BoxedDecoratorDemo id='boxedDecoratorDemo' constraints='boxedDecoratorDemo.getLabel()'/>
- </Panel>
- <style source="JButton.css" />
- </swing:JSplitPane>
-</Application>
+<swing:JFrame title="JAXX Demo" size="300,200" xmlns:swing='javax.swing.*'>
+ <swing:JPanel id="panel">
+ <swing:JTextField id="textfield" constructor='"test"' enabled="{gd2.getButton().isSelected()}" />
+ <swing:JLabel id="label" text="{textfield.getText()}" styleClass="bold" />
+ </swing:JPanel>
+ <GuixDemo2 id="gd2" />
+</swing:JFrame>
1
0
r1433 - guix/trunk/guix-runtime/src/test/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org 19 May '09
by kmorin@users.labs.libre-entreprise.org 19 May '09
19 May '09
Author: kmorin
Date: 2009-05-19 08:39:17 +0000 (Tue, 19 May 2009)
New Revision: 1433
Added:
guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java
Log:
Added: guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java
===================================================================
--- guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java (rev 0)
+++ guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java 2009-05-19 08:39:17 UTC (rev 1433)
@@ -0,0 +1,38 @@
+package org.nuiton.guix;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
1
0
r1432 - guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org 19 May '09
by kmorin@users.labs.libre-entreprise.org 19 May '09
19 May '09
Author: kmorin
Date: 2009-05-19 08:39:07 +0000 (Tue, 19 May 2009)
New Revision: 1432
Modified:
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java
Log:
Ajout du module (pas encore fonctionnel) guix-runtime
Modified: guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java 2009-05-19 08:39:00 UTC (rev 1431)
+++ guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java 2009-05-19 08:39:07 UTC (rev 1432)
@@ -8,11 +8,20 @@
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.nuiton.guix.databinding.BindingUtils;
import org.nuiton.guix.model.AttributeDescriptor;
+import org.nuiton.guix.model.Rule;
+import org.nuiton.guix.model.Selector;
+import org.nuiton.guix.model.StyleSheet;
/**
*
@@ -20,12 +29,16 @@
*/
public class SwingFileGenerator extends JavaFileGenerator {
+ List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
+
public SwingFileGenerator(GuixModelObject gmo) {
super(gmo);
jf = new JavaFile(gmo.getClassDescriptor().getPackageName(),
Modifier.PUBLIC,
gmo.getClassDescriptor().getName(),
null);
+ if(gmo.getStyleSheets() != null)
+ styleSheets.addAll(gmo.getStyleSheets());
}
@Override
@@ -82,11 +95,10 @@
if (gmo.getParent() != null) {
String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
- StringBuffer creationMethod = new StringBuffer(gmo.getId()).append(" = new ").append(gmo.getClassDescriptor().getName()).append("();");
- jf.addMethod(new JavaMethod(Modifier.PRIVATE, "void", "create" + capitalizedId, null, null, creationMethod.toString()));
+ StringBuffer creationMethod = new StringBuffer();
+ creationMethod.append(gmo.getId()).append(" = new ").append(gmo.getClassDescriptor().getName()).append("(").append(gmo.getConstructor() != null ? gmo.getConstructor() : ""). append(");\n");
componentsCreation.append("create").append(capitalizedId).append("();\n");
-
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId()).append(");\n");
for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
@@ -101,23 +113,78 @@
addQuote = Class.forName(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()).getMethod("get" + capitalizedAttribute, null).getReturnType().equals(String.class);
}
catch (ClassNotFoundException ex) {
- log.error(ex);
+ if(log.isErrorEnabled())
+ log.error(ex);
}
catch (NoSuchMethodException ex) {
try {
addQuote = Class.forName(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()).getMethod("is" + capitalizedAttribute, null).getReturnType().equals(String.class);
}
catch (ClassNotFoundException ex2) {
- log.error(ex2);
+ if(log.isErrorEnabled())
+ log.error(ex2);
}
catch (NoSuchMethodException ex2) {
- log.error(ex2);
+ if(log.isErrorEnabled())
+ log.error(ex2);
}
}
- componentsTree.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ creationMethod.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
}
}
+
+ if(gmo.getStyleSheets() != null)
+ styleSheets.addAll(gmo.getStyleSheets());
+ for(StyleSheet ss : styleSheets) {
+ for(Selector sel : ss.getSelectors()) {
+ if((sel.getJavaClassName() == null || sel.getJavaClassName().equals(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()))
+ && (sel.getId() == null || sel.getId().equals(gmo.getId()))
+ //&& sel.getPseudoClass().equals("")
+ && (sel.getStyleClass() == null || sel.getStyleClass().equals(gmo.getStyleClass()))) {
+ for(Rule rule : sel.getRules()) {
+ for(Entry<String,String> entry : rule.getProperties().entrySet()) {
+ String capitalizedAttribute = (entry.getKey().length() > 0) ? Character.toUpperCase(entry.getKey().charAt(0)) + entry.getKey().substring(1) : entry.getKey();
+ creationMethod.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(entry.getValue()).append(");\n");
+ }
+ }
+ }
+ }
+ }
+ jf.addMethod(new JavaMethod(Modifier.PRIVATE, "void", "create" + capitalizedId, null, null, creationMethod.toString()));
}
+ else {
+ for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
+ String binding = BindingUtils.processDataBindings(attr.getValue());
+ if (binding != null) {
+ bindings.append("bindingGroup.addBinding(\n").append("org.jdesktop.beansbinding.Bindings.createAutoBinding(\norg.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,").append("this").append(",org.jdesktop.beansbinding.ELProperty.create(\"${").append(binding).append("}\"),").append(gmo.getId()).append(",org.jdesktop.beansbinding.BeanProperty.create(\"").append(attr.getName()).append("\")").append("));\n").append("bindingGroup.bind();\n");
+ }
+ else {
+ String capitalizedAttribute = (attr.getName().length() > 0) ? Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
+ boolean addQuote = false;
+ try {
+ addQuote = Class.forName(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName()).getMethod("get" + capitalizedAttribute, null).getReturnType().equals(String.class);
+ }
+ catch (ClassNotFoundException ex) {
+ if(log.isErrorEnabled())
+ log.error(ex);
+ }
+ catch (NoSuchMethodException ex) {
+ try {
+ addQuote = Class.forName(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName()).getMethod("is" + capitalizedAttribute, null).getReturnType().equals(String.class);
+ }
+ catch (ClassNotFoundException ex2) {
+ if(log.isErrorEnabled())
+ log.error(ex2);
+ }
+ catch (NoSuchMethodException ex2) {
+ if(log.isErrorEnabled())
+ log.error(ex2);
+ }
+ }
+ componentsTree.append("this.set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ }
+ }
+ }
for (GuixModelObject child : gmo.getChildren()) {
Map<String, String> methodBodies = browseModelObjects(child);
componentsCreation.append(methodBodies.get("componentsCreation"));
1
0
r1431 - in guix/trunk/guix-compiler/src/main/java: . org org/nuiton/guix/compiler org/nuiton/guix/model org/nuiton/guix/tags org/w3c org/w3c/css org/w3c/flute org/w3c/flute/parser
by kmorin@users.labs.libre-entreprise.org 19 May '09
by kmorin@users.labs.libre-entreprise.org 19 May '09
19 May '09
Author: kmorin
Date: 2009-05-19 08:39:00 +0000 (Tue, 19 May 2009)
New Revision: 1431
Added:
guix/trunk/guix-compiler/src/main/java/org/w3c/
guix/trunk/guix-compiler/src/main/java/org/w3c/css/
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/
Modified:
guix/trunk/guix-compiler/src/main/java/
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
Log:
Ajout du module (pas encore fonctionnel) guix-runtime
Property changes on: guix/trunk/guix-compiler/src/main/java
___________________________________________________________________
Name: svn:ignore
+ .fr-UIndVX
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-18 15:54:21 UTC (rev 1430)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -137,8 +137,8 @@
String tagPackageName = resolvePackageName(tagNameSpace, xpp.getName());
// creation of the root GuixModelObject
- rootMO = new GuixModelObject(xpp.getAttributeValue("", "id"), doc.toString(),
- xpp.getAttributeValue("", "styleClass"));
+ rootMO = new GuixModelObject(xpp.getAttributeValue("", "id"), xpp.getAttributeValue("", "constructor"),
+ doc.toString(), xpp.getAttributeValue("", "styleClass"));
// the class name is the name of the file minus the extension
String className = src.getName().substring(0, src.getName().lastIndexOf('.'));
@@ -285,7 +285,8 @@
: "$" + tagName + index++);
// create the GuixModelObject representing the tag
- GuixModelObject mo = new GuixModelObject(id, javaDoc, xpp.getAttributeValue("", "styleClass"));
+ GuixModelObject mo = new GuixModelObject(id, xpp.getAttributeValue("", "constructor"),
+ javaDoc, xpp.getAttributeValue("", "styleClass"));
mo.setParent(previousMO);
mo.setAttributeDescriptors(getAttributes(xpp));
@@ -389,7 +390,8 @@
List<AttributeDescriptor> result = new ArrayList<AttributeDescriptor>();
for (int i = 0; i < xpp.getAttributeCount(); i++) {
- if (!xpp.getAttributeName(i).equals("id")) {
+ if (!xpp.getAttributeName(i).equals("id") && !xpp.getAttributeName(i).equals("constructor")
+ && !xpp.getAttributeName(i).equals("styleClass")) {
result.add(new AttributeDescriptor(xpp.getAttributeName(i), xpp.getAttributeValue(i)));
}
}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-05-18 15:54:21 UTC (rev 1430)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -30,6 +30,9 @@
/** The id of the object */
private String id;
+ /** The contructor parameters fro this object */
+ private String constructor;
+
/** The javaDoc of the object */
private String javadoc;
@@ -46,8 +49,9 @@
* @param javadoc the javadoc of the object
* @param styleClass the styleclass of the object
*/
- public GuixModelObject(String id, String javadoc, String styleClass) {
+ public GuixModelObject(String id, String constructor, String javadoc, String styleClass) {
this.id = id;
+ this.constructor = constructor;
this.javadoc = javadoc;
this.styleClass = styleClass;
}
@@ -84,6 +88,14 @@
this.id = id;
}
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public void setConstructor(String constructor) {
+ this.constructor = constructor;
+ }
+
public GuixModelObject getParent() {
return parent;
}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-05-18 15:54:21 UTC (rev 1430)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -1,7 +1,8 @@
package org.nuiton.guix.tags;
//~--- non-JDK imports --------------------------------------------------------
-
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -13,24 +14,26 @@
import org.nuiton.guix.model.Rule;
import org.nuiton.guix.model.Selector;
import org.nuiton.guix.model.StyleSheet;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.Parser;
+import org.w3c.css.sac.helpers.ParserFactory;
+import org.w3c.flute.parser.ParserConstants;
+;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
//~--- JDK imports ------------------------------------------------------------
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
/**
* Handles the <code><style></code> tag.
*
@@ -40,7 +43,6 @@
/** log */
protected static final Log log = LogFactory.getLog(TagManager.class);
-
/** List of the selectors */
private List<Selector> selectors = new ArrayList<Selector>();
@@ -54,9 +56,9 @@
*/
private String loadStyleFile(File styleFile) throws FileNotFoundException, IOException {
StringWriter styleBuffer = new StringWriter();
- FileReader in = new FileReader(styleFile);
- char[] readBuffer = new char[2048];
- int c;
+ FileReader in = new FileReader(styleFile);
+ char[] readBuffer = new char[2048];
+ int c;
while ((c = in.read(readBuffer)) > 0) {
styleBuffer.write(readBuffer, 0, c);
@@ -95,8 +97,8 @@
* while parsing the guix file
*/
public StyleSheet compileStyle(XmlPullParser xpp, File styleFile) throws IOException, XmlPullParserException {
- StyleSheet result = null;
- StringBuffer style = new StringBuffer();
+ StyleSheet result = null;
+ StringBuffer style = new StringBuffer();
if ((styleFile != null) && styleFile.exists()) {
style.append(loadStyleFile(styleFile));
@@ -106,21 +108,21 @@
do {
switch (xpp.getEventType()) {
- case XmlPullParser.START_TAG :
- if (log.isWarnEnabled()) {
- log.warn("<style> tag may not contain child elements: " + xpp.getName());
- }
+ case XmlPullParser.START_TAG:
+ if (log.isWarnEnabled()) {
+ log.warn("<style> tag may not contain child elements: " + xpp.getName());
+ }
- break;
+ break;
- case XmlPullParser.TEXT :
- break; // fall through
+ case XmlPullParser.TEXT:
+ break; // fall through
- case XmlPullParser.CDSECT :
- style.append(xpp.getText());
- xpp.nextToken();
+ case XmlPullParser.CDSECT:
+ style.append(xpp.getText());
+ xpp.nextToken();
- break;
+ break;
}
} while ((xpp.getEventType() != XmlPullParser.END_TAG) && (!xpp.getName().equals("style")));
@@ -145,44 +147,44 @@
}
String javaClassName = null;
- String styleClass = null;
- String pseudoClass = null;
- String id = null;
+ String styleClass = null;
+ String pseudoClass = null;
+ String id = null;
for (int i = 0; i < selector.jjtGetNumChildren(); i++) {
SimpleNode child = selector.getChild(i);
switch (child.getId()) {
- // class
- case CSSParserTreeConstants.JJTJAVACLASS :
- if (!child.getText().trim().equals("*")) {
- javaClassName = child.getText();
- }
+ // class
+ case CSSParserTreeConstants.JJTJAVACLASS:
+ if (!child.getText().trim().equals("*")) {
+ javaClassName = child.getText();
+ }
- break;
+ break;
- // styleclass
- case CSSParserTreeConstants.JJTCLASS :
- styleClass = child.getText().substring(1);
+ // styleclass
+ case CSSParserTreeConstants.JJTCLASS:
+ styleClass = child.getText().substring(1);
- break;
+ break;
- // pseudoclass
- case CSSParserTreeConstants.JJTPSEUDOCLASS :
- pseudoClass = child.getText().substring(1);
+ // pseudoclass
+ case CSSParserTreeConstants.JJTPSEUDOCLASS:
+ pseudoClass = child.getText().substring(1);
- break;
+ break;
- // id
- case CSSParserTreeConstants.JJTID :
- id = child.getText().substring(1);
+ // id
+ case CSSParserTreeConstants.JJTID:
+ id = child.getText().substring(1);
- break;
+ break;
- // error if other
- default :
- throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId());
+ // error if other
+ default:
+ throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId());
}
}
@@ -211,7 +213,7 @@
// analyses each selector
for (int i = 0; i < selectorsNode.jjtGetNumChildren(); i++) {
SimpleNode selectorNode = selectorsNode.getChild(i);
- Selector selector = processSelector(selectorNode);
+ Selector selector = processSelector(selectorNode);
ruleSelectors.add(selector);
@@ -228,11 +230,11 @@
SimpleNode declarationNode = ruleNode.getChild(i);
if (declarationNode.getId() == CSSParserTreeConstants.JJTDECLARATION) {
- String key = declarationNode.getChild(0).getText();
+ String key = declarationNode.getChild(0).getText();
SimpleNode valueNode = declarationNode.getChild(1);
- String value = valueNode.getText();
+ String value = valueNode.getText();
- if (valueNode.firstToken.kind == CSSParserConstants.STRING) {
+ if (valueNode.firstToken.kind == ParserConstants.STRING) {
value = value.substring(1, value.length() - 1);
}
@@ -260,34 +262,39 @@
* @param stylesheetText the content of the CSS file or the style tag
* @return the StyleSheet containing the rules of the CSS file or the style tag
*/
- protected StyleSheet processStylesheet(String stylesheetText) {
-
- // parses the CSS
- CSSParser p = new CSSParser(new StringReader(stylesheetText));
- SimpleNode node;
-
+ protected StyleSheet processStylesheet(String stylesheetText) throws IOException {
try {
- node = p.Stylesheet();
- } catch (ParseException ex) {
- throw ex;
- }
+ Parser p = new org.w3c.flute.parser.Parser();
+ p.parseStyleSheet(new InputSource(new StringReader(stylesheetText)));
- List<Rule> rules = new ArrayList<Rule>();
+ // parses the CSS
+ /* CSSParser p = new CSSParser(new StringReader(stylesheetText));
- // analyses each rule
- for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode node = p.Stylesheet();*/
+ List<Rule> rules = new ArrayList<Rule>();
+
+ // analyses each rule
+ /*for (int i = 0; i < node.jjtGetNumChildren(); i++) {
SimpleNode ruleNode = node.getChild(i);
Rule rule = processRule(ruleNode);
rules.add(rule);
- }
+ }*/
- StyleSheet styleSheet = new StyleSheet();
+ StyleSheet styleSheet = new StyleSheet();
- styleSheet.setRules(rules);
- styleSheet.setSelectors(selectors);
+ styleSheet.setRules(rules);
+ styleSheet.setSelectors(selectors);
- return styleSheet;
+ return styleSheet;
+ }
+ catch (Exception ex) {
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ ex.printStackTrace();
+ }
+ }
+ return null;
}
/**
@@ -298,30 +305,16 @@
*/
private boolean selectorRecorded(Selector newSelector) {
for (Selector selector : selectors) {
- boolean areJavaClassNamesNull = (newSelector.getJavaClassName() == null)
- && (selector.getJavaClassName() == null);
- boolean areJavaClassNamesNotNull = (newSelector.getJavaClassName() != null)
- && (selector.getJavaClassName() != null);
- boolean areStyleClassesNull = (newSelector.getStyleClass() == null)
- && (selector.getStyleClass() == null);
- boolean areStyleClassesNotNull = (newSelector.getStyleClass() != null)
- && (selector.getStyleClass() != null);
- boolean arePseudoClassesNull = (newSelector.getPseudoClass() == null)
- && (selector.getPseudoClass() == null);
- boolean arePseudoClassesNotNull = (newSelector.getPseudoClass() != null)
- && (selector.getPseudoClass() != null);
- boolean areIdsNull = (newSelector.getId() == null) && (selector.getId() == null);
+ boolean areJavaClassNamesNull = (newSelector.getJavaClassName() == null) && (selector.getJavaClassName() == null);
+ boolean areJavaClassNamesNotNull = (newSelector.getJavaClassName() != null) && (selector.getJavaClassName() != null);
+ boolean areStyleClassesNull = (newSelector.getStyleClass() == null) && (selector.getStyleClass() == null);
+ boolean areStyleClassesNotNull = (newSelector.getStyleClass() != null) && (selector.getStyleClass() != null);
+ boolean arePseudoClassesNull = (newSelector.getPseudoClass() == null) && (selector.getPseudoClass() == null);
+ boolean arePseudoClassesNotNull = (newSelector.getPseudoClass() != null) && (selector.getPseudoClass() != null);
+ boolean areIdsNull = (newSelector.getId() == null) && (selector.getId() == null);
boolean areIdsNotNull = (newSelector.getId() != null) && (selector.getId() != null);
- if ((areJavaClassNamesNull || (areJavaClassNamesNotNull && newSelector.getJavaClassName()
- .equals(selector
- .getJavaClassName()))) && (areStyleClassesNull || (areStyleClassesNotNull && newSelector
- .getStyleClass()
- .equals(selector
- .getStyleClass()))) && (arePseudoClassesNull || (arePseudoClassesNotNull && newSelector
- .getPseudoClass()
- .equals(selector.getPseudoClass()))) && (areIdsNull || (areIdsNotNull && newSelector
- .getId().equals(selector.getId())))) {
+ if ((areJavaClassNamesNull || (areJavaClassNamesNotNull && newSelector.getJavaClassName().equals(selector.getJavaClassName()))) && (areStyleClassesNull || (areStyleClassesNotNull && newSelector.getStyleClass().equals(selector.getStyleClass()))) && (arePseudoClassesNull || (arePseudoClassesNotNull && newSelector.getPseudoClass().equals(selector.getPseudoClass()))) && (areIdsNull || (areIdsNotNull && newSelector.getId().equals(selector.getId())))) {
return true;
}
}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,110 @@
+/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 0.7pre6 */
+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.
+ */
+
+abstract 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.
+ */
+ abstract public char readChar() throws java.io.IOException;
+
+ /**
+ * Returns the column position of the character last read.
+ * @deprecated
+ * @see #getEndColumn
+ */
+ abstract public int getColumn();
+
+ /**
+ * Returns the line number of the character last read.
+ * @deprecated
+ * @see #getEndLine
+ */
+ abstract public int getLine();
+
+ /**
+ * Returns the column number of the last character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getEndColumn();
+
+ /**
+ * Returns the line number of the last character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getEndLine();
+
+ /**
+ * Returns the column number of the first character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getBeginColumn();
+
+ /**
+ * Returns the line number of the first character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public 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.
+ */
+ abstract public 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.
+ */
+ abstract public 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.
+ */
+ abstract public 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();
+ * }
+ */
+ abstract public 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.
+ */
+ abstract public void Done();
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,355 @@
+/* Generated By:JavaCC: Do not edit this line. Generic_CharStream.java Version 0.7pre6 */
+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.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,22 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: JumpException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class JumpException extends RuntimeException {
+ /**
+ * Creates a new JumpException
+ */
+ public JumpException() {
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,459 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: LexicalUnitImpl.java,v 1.3 2000/02/15 02:08:19 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.LexicalUnit;
+
+/**
+ * @version $Revision: 1.3 $
+ * @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 = "attr(" + 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);
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: LocatorImpl.java,v 1.2 2000/02/14 16:59:06 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.Locator;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class LocatorImpl implements Locator {
+
+ // W3C DEBUG mode
+ private static boolean W3CDebug;
+ static {
+ try {
+ W3CDebug = (Boolean.getBoolean("debug")
+ || Boolean.getBoolean("org.w3c.flute.parser.LocatorImpl.debug")
+ || Boolean.getBoolean("org.w3c.flute.parser.debug")
+ || Boolean.getBoolean("org.w3c.flute.debug")
+ || Boolean.getBoolean("org.w3c.debug")
+ || Boolean.getBoolean("org.debug"));
+ } catch (Exception e) {
+ // nothing
+ }
+ }
+
+ String uri;
+ int line;
+ int column;
+
+ public String getURI() {
+ return uri;
+ }
+
+ public int getLineNumber() {
+ return line;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ /**
+ * Creates a new LocatorImpl
+ */
+ public LocatorImpl(Parser p) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::newLocator(" + p + ");");
+ }
+ uri = p.source.getURI();
+ line = p.token.beginLine;
+ column = p.token.beginColumn;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl(Parser p, Token tok) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::newLocator(" + p
+ + ", " + tok + ");");
+ }
+ uri = p.source.getURI();
+ line = tok.beginLine;
+ column = tok.beginColumn;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl(Parser p, int line, int column) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::newLocator(" + p
+ + ", " + line
+ + ", " + column + ");");
+ }
+ uri = p.source.getURI();
+ this.line = line;
+ this.column = column;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::reInit(" + p + ");" );
+ }
+ uri = p.source.getURI();
+ line = p.token.beginLine;
+ column = p.token.beginColumn;
+ return this;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p, Token tok) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::reInit(" + p
+ + ", " + tok + ");");
+ }
+ uri = p.source.getURI();
+ line = tok.beginLine;
+ column = tok.beginColumn;
+ return this;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p, int line, int column) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::reInit(" + p
+ + ", " + line
+ + ", " + column + ");");
+ }
+ uri = p.source.getURI();
+ this.line = line;
+ this.column = column;
+ return this;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,78 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: MediaListImpl.java,v 1.4 2000/04/26 13:40:19 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.SACMediaList;
+
+/**
+ * @version $Revision: 1.4 $
+ * @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();
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,193 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+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: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,3599 @@
+/* Generated By:JavaCC: Do not edit this line. Parser.java */
+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 H�garet
+ * @version $Revision: 1.15 $
+ */
+public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
+
+ // replaces all \t, \n, etc with this StringBuffer.
+ static final 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 ...
+ private String pseudoElt;
+
+ /**
+ * Creates a new Parser
+ */
+ public Parser() {
+ this((CharStream) null);
+ }
+
+ /**
+ * @@TODO
+ * @exception CSSException Not yet implemented
+ */
+ public void setLocale(Locale locale) throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Set the document handler for this parser
+ */
+ public void setDocumentHandler(DocumentHandler handler) {
+ this.documentHandler = 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 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);
+ }
+ }
+ }
+ afterImportDeclaration();
+ jj_consume_token(0);
+ } finally {
+ documentHandler.endDocument(source);
+ }
+ }
+
+ final public void charset() throws ParseException {
+ Token n;
+ try {
+ jj_consume_token(CHARSET_SYM);
+ label_5:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ break label_5;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(STRING);
+ label_6:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ break label_6;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+ final public void afterImportDeclaration() throws ParseException {
+ String ret;
+ Locator l;
+ label_7:
+ while (true) {
+ ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ l = getLocator();
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ label_8:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ break label_8;
+ }
+ ignoreStatement();
+ label_9:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ break label_9;
+ }
+ jj_consume_token(S);
+ }
+ }
+ }
+ }
+
+ final public void ignoreStatement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ jj_consume_token(CDO);
+ break;
+ case CDC:
+ jj_consume_token(CDC);
+ break;
+ case ATKEYWORD:
+ atRuleDeclaration();
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/**
+ * 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_10:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ break label_10;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ n = jj_consume_token(STRING);
+ uri = convertStringIndex(n.image, 1,
+ n.image.length() -1);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ 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[13] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_11:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ break label_11;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ mediaStatement(ml);
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ label_12:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ break label_12;
+ }
+ jj_consume_token(S);
+ }
+ if (ml.getLength() == 0) {
+ // see section 6.3 of the CSS2 recommandation.
+ ml.addItem("all");
+ }
+ documentHandler.importStyle(uri, ml, null);
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void media() throws ParseException {
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+ try {
+ jj_consume_token(MEDIA_SYM);
+ label_13:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ break label_13;
+ }
+ jj_consume_token(S);
+ }
+ mediaStatement(ml);
+ start = true; documentHandler.startMedia(ml);
+ jj_consume_token(LBRACE);
+ label_14:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ break label_14;
+ }
+ jj_consume_token(S);
+ }
+ label_15:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case NONASCII:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case HASH:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ ;
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ break label_15;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case NONASCII:
+ case STRING:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ skipUnknownRule();
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_16:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ break label_16;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+ }
+
+ final public void mediaStatement(MediaListImpl ml) throws ParseException {
+ String m;
+ m = medium();
+ label_17:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ break label_17;
+ }
+ jj_consume_token(COMMA);
+ label_18:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ break label_18;
+ }
+ jj_consume_token(S);
+ }
+ ml.addItem(m);
+ m = medium();
+ }
+ ml.addItem(m);
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String medium() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_19:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ break label_19;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void page() throws ParseException {
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+ try {
+ jj_consume_token(PAGE_SYM);
+ label_20:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_20;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ label_21:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ break label_21;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[27] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ pseudo = pseudo_page();
+ break;
+ default:
+ jj_la1[28] = jj_gen;
+ ;
+ }
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ jj_consume_token(LBRACE);
+ label_22:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ break label_22;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ ;
+ }
+ label_23:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[31] = jj_gen;
+ break label_23;
+ }
+ jj_consume_token(SEMICOLON);
+ label_24:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[32] = jj_gen;
+ break label_24;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[33] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_25:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[34] = jj_gen;
+ break label_25;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+ }
+
+ final public String pseudo_page() throws ParseException {
+ Token n;
+ jj_consume_token(COLON);
+ n = jj_consume_token(IDENT);
+ label_26:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[35] = jj_gen;
+ break label_26;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void fontFace() throws ParseException {
+ boolean start = false;
+ try {
+ jj_consume_token(FONT_FACE_SYM);
+ label_27:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[36] = jj_gen;
+ break label_27;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LBRACE);
+ label_28:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[37] = jj_gen;
+ break label_28;
+ }
+ jj_consume_token(S);
+ }
+ start = true; documentHandler.startFontFace();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[38] = jj_gen;
+ ;
+ }
+ label_29:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[39] = jj_gen;
+ break label_29;
+ }
+ jj_consume_token(SEMICOLON);
+ label_30:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[40] = jj_gen;
+ break label_30;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[41] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_31:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[42] = jj_gen;
+ break label_31;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void atRuleDeclaration() throws ParseException {
+ Token n;
+ String ret;
+ n = jj_consume_token(ATKEYWORD);
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+
+ final public void skipUnknownRule() throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ATKEYWORD:
+ n = jj_consume_token(ATKEYWORD);
+ break;
+ case CDO:
+ n = jj_consume_token(CDO);
+ break;
+ case CHARSET_SYM:
+ n = jj_consume_token(CHARSET_SYM);
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ break;
+ case DASHMATCH:
+ n = jj_consume_token(DASHMATCH);
+ break;
+ case FONT_FACE_SYM:
+ n = jj_consume_token(FONT_FACE_SYM);
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ break;
+ case IMPORTANT_SYM:
+ n = jj_consume_token(IMPORTANT_SYM);
+ break;
+ case IMPORT_SYM:
+ n = jj_consume_token(IMPORT_SYM);
+ break;
+ case INCLUDES:
+ n = jj_consume_token(INCLUDES);
+ break;
+ case LBRACE:
+ n = jj_consume_token(LBRACE);
+ break;
+ case MEDIA_SYM:
+ n = jj_consume_token(MEDIA_SYM);
+ break;
+ case NONASCII:
+ n = jj_consume_token(NONASCII);
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ break;
+ case PAGE_SYM:
+ n = jj_consume_token(PAGE_SYM);
+ break;
+ case PERCENTAGE:
+ n = jj_consume_token(PERCENTAGE);
+ break;
+ case STRING:
+ n = jj_consume_token(STRING);
+ break;
+ case UNICODERANGE:
+ n = jj_consume_token(UNICODERANGE);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ break;
+ case SEMICOLON:
+ n = jj_consume_token(SEMICOLON);
+ break;
+ case PLUS:
+ n = jj_consume_token(PLUS);
+ break;
+ case PRECEDES:
+ n = jj_consume_token(PRECEDES);
+ break;
+ case MINUS:
+ n = jj_consume_token(MINUS);
+ break;
+ case UNKNOWN:
+ n = jj_consume_token(UNKNOWN);
+ break;
+ default:
+ jj_la1[43] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char combinator() throws ParseException {
+char connector = ' ';
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ label_32:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[44] = jj_gen;
+ break label_32;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '+';}
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ label_33:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[45] = jj_gen;
+ break label_33;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '>';}
+ break;
+ case S:
+ jj_consume_token(S);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case PRECEDES:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ connector = '+';
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ connector = '>';
+ break;
+ default:
+ jj_la1[46] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_34:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[47] = jj_gen;
+ break label_34;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[48] = jj_gen;
+ ;
+ }
+ {if (true) return connector;}
+ break;
+ default:
+ jj_la1[49] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String property() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_35:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[50] = jj_gen;
+ break label_35;
+ }
+ jj_consume_token(S);
+ }
+ {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_36:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[51] = jj_gen;
+ break label_36;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startSelector(l);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[52] = jj_gen;
+ ;
+ }
+ label_37:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[53] = jj_gen;
+ break label_37;
+ }
+ jj_consume_token(SEMICOLON);
+ label_38:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[54] = jj_gen;
+ break label_38;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[55] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_39:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[56] = jj_gen;
+ break label_39;
+ }
+ jj_consume_token(S);
+ }
+ } 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_40:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[57] = jj_gen;
+ break label_40;
+ }
+ jj_consume_token(COMMA);
+ label_41:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[58] = jj_gen;
+ break label_41;
+ }
+ jj_consume_token(S);
+ }
+ 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_42:
+ while (true) {
+ if (jj_2_1(2)) {
+ ;
+ } else {
+ break label_42;
+ }
+ comb = combinator();
+ selector = simple_selector(selector, comb);
+ }
+ 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);
+ }
+ {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:
+ simple_current = element_name();
+ label_44:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[60] = jj_gen;
+ break label_44;
+ }
+ 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[61] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case HASH:
+ cond = hash(cond);
+ label_45:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ ;
+ break;
+ default:
+ jj_la1[62] = jj_gen;
+ break label_45;
+ }
+ 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[63] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case DOT:
+ cond = _class(cond);
+ label_46:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[64] = jj_gen;
+ break label_46;
+ }
+ 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[65] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ label_47:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[66] = jj_gen;
+ break label_47;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[67] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ label_48:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[68] = jj_gen;
+ break label_48;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[69] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ default:
+ jj_la1[70] = 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 ANY:
+ jj_consume_token(ANY);
+ {if (true) return selectorFactory.createElementSelector(null, null);}
+ break;
+ default:
+ jj_la1[71] = 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_49:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ break label_49;
+ }
+ jj_consume_token(S);
+ }
+ att = jj_consume_token(IDENT);
+ label_50:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[73] = jj_gen;
+ break label_50;
+ }
+ 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[74] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_51:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[75] = jj_gen;
+ break label_51;
+ }
+ 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[76] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_52:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[77] = jj_gen;
+ break label_52;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[78] = 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_53:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[79] = jj_gen;
+ break label_53;
+ }
+ jj_consume_token(S);
+ }
+ language = jj_consume_token(IDENT);
+ label_54:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[80] = jj_gen;
+ break label_54;
+ }
+ 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[81] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public 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_55:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[82] = jj_gen;
+ break label_55;
+ }
+ jj_consume_token(S);
+ }
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ important = prio();
+ break;
+ default:
+ jj_la1[83] = 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_56:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[84] = jj_gen;
+ break label_56;
+ }
+ 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_57:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[85] = jj_gen;
+ break label_57;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ label_58:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[86] = jj_gen;
+ break label_58;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ default:
+ jj_la1[87] = 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_59:
+ 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 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[88] = jj_gen;
+ break label_59;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ case DIV:
+ res = operator(res);
+ break;
+ default:
+ jj_la1[89] = 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[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 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[91] = 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[92] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ case STRING:
+ case IDENT:
+ case URL:
+ case HASH:
+ case UNICODERANGE:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ n = jj_consume_token(STRING);
+ result =
+ LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
+ convertStringIndex(n.image, 1,
+ n.image.length() -1));
+ break;
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ String s = convertIdent(n.image);
+ if ("inherit".equals(s)) {
+ result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
+ prev);
+ } else {
+ result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, convertIdent(n.image));
+ }
+
+ /* /
+ Auto correction code used in the CSS Validator but must not
+ be used by a conformant CSS2 parser.
+ * Common error :
+ * H1 {
+ * color : black
+ * background : white
+ * }
+ *
+ Token t = getToken(1);
+ Token semicolon = new Token();
+ semicolon.kind = SEMICOLON;
+ semicolon.image = ";";
+ if (t.kind == COLON) {
+ // @@SEEME. (generate a warning?)
+ // @@SEEME if expression is a single ident,
+ generate an error ?
+ rejectToken(semicolon);
+
+ result = prev;
+ }
+ / */
+
+ break;
+ case HASH:
+ result = hexcolor(prev);
+ break;
+ case URL:
+ result = url(prev);
+ break;
+ case UNICODERANGE:
+ result = unicode(prev);
+ break;
+ default:
+ jj_la1[93] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[94] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_60:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[95] = jj_gen;
+ break label_60;
+ }
+ 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_61:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[96] = jj_gen;
+ break label_61;
+ }
+ 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 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[97] = 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 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_62:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[98] = jj_gen;
+ break label_62;
+ }
+ 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 HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[99] = 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_63:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[100] = jj_gen;
+ break label_63;
+ }
+ jj_consume_token(S);
+ }
+ importDeclaration();
+ }
+
+ final public void _parseMediaRule() throws ParseException {
+ label_64:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[101] = jj_gen;
+ break label_64;
+ }
+ jj_consume_token(S);
+ }
+ media();
+ }
+
+ final public void _parseDeclarationBlock() throws ParseException {
+ label_65:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[102] = jj_gen;
+ break label_65;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[103] = jj_gen;
+ ;
+ }
+ label_66:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[104] = jj_gen;
+ break label_66;
+ }
+ jj_consume_token(SEMICOLON);
+ label_67:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[105] = jj_gen;
+ break label_67;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[106] = jj_gen;
+ ;
+ }
+ }
+ }
+
+ final public SelectorList _parseSelectors() throws ParseException {
+ SelectorList p = null;
+ try {
+ label_68:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[107] = jj_gen;
+ break label_68;
+ }
+ 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 private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_1();
+ jj_save(0, xla);
+ return retval;
+ }
+
+ final private boolean jj_3R_70() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_74()) {
+ jj_scanpos = xsp;
+ if (jj_3R_75()) {
+ jj_scanpos = xsp;
+ if (jj_3R_76()) {
+ jj_scanpos = xsp;
+ if (jj_3R_77()) {
+ jj_scanpos = xsp;
+ if (jj_3R_78()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_88() {
+ if (jj_scan_token(PRECEDES)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_87() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_86() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_80() {
+ if (jj_scan_token(S)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_81() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_87()) {
+ jj_scanpos = xsp;
+ if (jj_3R_88()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_79() {
+ if (jj_scan_token(S)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_83() {
+ if (jj_scan_token(HASH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_72() {
+ if (jj_scan_token(PRECEDES)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_80()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_90() {
+ if (jj_scan_token(ANY)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_73() {
+ if (jj_scan_token(S)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_81()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_71() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_79()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_69() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_71()) {
+ jj_scanpos = xsp;
+ if (jj_3R_72()) {
+ jj_scanpos = xsp;
+ if (jj_3R_73()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_89() {
+ if (jj_scan_token(IDENT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_82() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_89()) {
+ jj_scanpos = xsp;
+ if (jj_3R_90()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_69()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_70()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_84() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_85() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_78() {
+ if (jj_3R_86()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_77() {
+ if (jj_3R_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_76() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_75() {
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_74() {
+ if (jj_3R_82()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ 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[108];
+ final private int[] jj_la1_0 = {0x0,0x62,0x62,0x0,0x60,0x2,0x2,0x2,0x1340000,0x60,0x2,0x60,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x335f6a0,0x335f6a0,0x2,0x4000,0x2,0x2,0x2,0x2,0x0,0x1000000,0x2,0x0,0x8000,0x2,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,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,};
+ final private int[] jj_la1_1 = {0x8000000,0x40000000,0x40000000,0x2000000,0x40000000,0x0,0x0,0x0,0x35000008,0x40000000,0x0,0x40000000,0x0,0x44,0x0,0x8,0x0,0x0,0x0,0xff0000dc,0xff0000dc,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0xfe0000d4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000008,0x8,0x0,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x8,0x0,0x80000000,0x0,0x0,0x0,0x0,0x1ffffdc,0x0,0x0,0x0,0xffff90,0x100004c,0x1ffffdc,0x0,0x0,0x1ffffdc,0x0,0x37000008,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,};
+ final private int[] jj_la1_2 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,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,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x400,0x200,0x600,0x0,0x0,0x600,0x0,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 < 108; 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 < 108; 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 < 108; 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 < 108; 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();
+ }
+
+ 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);
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ 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 _enum = jj_expentries.elements(); _enum.hasMoreElements();) {
+ int[] oldentry = (int[])(_enum.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;
+ }
+ }
+
+ final public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[76];
+ for (int i = 0; i < 76; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 108; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ if ((jj_la1_2[i] & (1<<j)) != 0) {
+ la1tokens[64+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 76; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+ final private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 1; i++) {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ }
+ }
+ 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;
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,1978 @@
+/* -*-java-extended-*-
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: Parser.jj,v 1.15 2000/10/27 21:09:37 plehegar Exp $
+ */
+
+options {
+ IGNORE_CASE = true;
+ STATIC = false;
+ USER_CHAR_STREAM = true;
+ /* DEBUG_TOKEN_MANAGER = true;
+ DEBUG_PARSER = true; */
+}
+
+PARSER_BEGIN(Parser)
+
+package 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 H�garet
+ * @version $Revision: 1.15 $
+ */
+public class Parser implements org.w3c.css.sac.Parser {
+
+ // replaces all \t, \n, etc with this StringBuffer.
+ static final 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 ...
+ private String pseudoElt;
+
+ /**
+ * Creates a new Parser
+ */
+ public Parser() {
+ this((CharStream) null);
+ }
+
+ /**
+ * @@TODO
+ * @exception CSSException Not yet implemented
+ */
+ public void setLocale(Locale locale) throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Set the document handler for this parser
+ */
+ public void setDocumentHandler(DocumentHandler handler) {
+ this.documentHandler = 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 LexicalUnit parsePropertyValue(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return expr();
+ }
+
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return prio();
+ }
+
+ /**
+ * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
+ */
+ private Reader getReader(InputSource source) throws IOException {
+ if (source.getCharacterStream() != null) {
+ return source.getCharacterStream();
+ } else if (source.getByteStream() != null) {
+ // My DOM level 2 implementation doesn't use this case.
+ if (source.getEncoding() == null) {
+ // unknown encoding, use ASCII as default.
+ return new InputStreamReader(source.getByteStream(), "ASCII");
+ } else {
+ return new InputStreamReader(source.getByteStream(),
+ source.getEncoding());
+ }
+ } else {
+ // systemId
+ // @@TODO
+ throw new CSSException("not yet implemented");
+ }
+ }
+
+ /**
+ * Convert the source into a CharStream with encoding informations.
+ * The encoding can be found in the InputSource or in the CSS document.
+ * Since this method marks the reader and make a reset after looking for
+ * the charset declaration, you'll find the charset declaration into the
+ * stream.
+ */
+ private CharStream getCharStreamWithLurk(InputSource source)
+ throws CSSException, IOException {
+ if (source.getCharacterStream() != null) {
+ // all encoding are supposed to be resolved by the user
+ // return the reader
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ } else if (source.getByteStream() == null) {
+ // @@CONTINUE ME. see also getReader() with systemId
+ try {
+ source.setByteStream(new URL(source.getURI()).openStream());
+ } catch (Exception e) {
+ try {
+ source.setByteStream(new FileInputStream(source.getURI()));
+ } catch (IOException ex) {
+ throw new CSSException("invalid url ?");
+ }
+ }
+ }
+ String encoding = "ASCII";
+ InputStream input = source.getByteStream();
+ char c = ' ';
+
+ if (!input.markSupported()) {
+ input = new BufferedInputStream(input);
+ source.setByteStream(input);
+ }
+ input.mark(100);
+ c = (char) input.read();
+
+ if (c == '@') {
+ // hum, is it a charset ?
+ int size = 100;
+ byte[] buf = new byte[size];
+ input.read(buf, 0, 7);
+ String keyword = new String(buf, 0, 7);
+ if (keyword.equals("charset")) {
+ // Yes, this is the charset declaration !
+
+ // here I don't use the right declaration : white space are ' '.
+ while ((c = (char) input.read()) == ' ') {
+ // find the first quote
+ }
+ char endChar = c;
+ int i = 0;
+
+ if ((endChar != '"') && (endChar != '\'')) {
+ // hum this is not a quote.
+ throw new CSSException("invalid charset declaration");
+ }
+
+ while ((c = (char) input.read()) != endChar) {
+ buf[i++] = (byte) c;
+ if (i == size) {
+ byte[] old = buf;
+ buf = new byte[size + 100];
+ System.arraycopy(old, 0, buf, 0, size);
+ size += 100;
+ }
+ }
+ while ((c = (char) input.read()) == ' ') {
+ // find the next relevant character
+ }
+ if (c != ';') {
+ // no semi colon at the end ?
+ throw new CSSException("invalid charset declaration: "
+ + "missing semi colon");
+ }
+ encoding = new String(buf, 0, i);
+ if (source.getEncoding() != null) {
+ // compare the two encoding informations.
+ // For example, I don't accept to have ASCII and after UTF-8.
+ // Is it really good ? That is the question.
+ if (!encoding.equals(source.getEncoding())) {
+ throw new CSSException("invalid encoding information.");
+ }
+ }
+ } // else no charset declaration available
+ }
+ // ok set the real encoding of this source.
+ source.setEncoding(encoding);
+ // set the real reader of this source.
+ source.setCharacterStream(new InputStreamReader(source.getByteStream(),
+ Encoding.getJavaEncoding(encoding)));
+ // reset the stream (leave the charset declaration in the stream).
+ input.reset();
+
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ }
+
+ private LocatorImpl currentLocator;
+ private Locator getLocator() {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this);
+ }
+ private LocatorImpl getLocator(Token save) {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this, save);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this, save);
+ }
+
+ private void reportError(Locator l, Exception e) {
+ if (errorHandler != null) {
+ if (e instanceof ParseException) {
+ // construct a clean error message.
+ ParseException pe = (ParseException) e;
+ if (pe.specialConstructor) {
+ StringBuffer errorM = new StringBuffer();
+ if (pe.currentToken != null) {
+ errorM.append("encountered \"")
+ .append(pe.currentToken.next);
+ }
+ errorM.append('"');
+ if (pe.expectedTokenSequences.length != 0) {
+ errorM.append(". Was expecting one of: ");
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ int kind = pe.expectedTokenSequences[i][j];
+ if (kind != S) {
+ errorM.append(pe.tokenImage[kind]);
+ errorM.append(' ');
+ }
+ }
+ }
+ }
+ errorHandler.error(new CSSParseException(errorM.toString(),
+ l, e));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(),
+ l, e));
+ }
+ } else if (e == null) {
+ errorHandler.error(new CSSParseException("error", l, null));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(), l, e));
+ }
+ }
+ }
+
+ private void reportWarningSkipText(Locator l, String text) {
+ if (errorHandler != null && text != null) {
+ errorHandler.warning(new CSSParseException("Skipping: " + text, l));
+ }
+ }
+}
+
+PARSER_END(Parser)
+
+/*
+ * The tokenizer
+ */
+
+<DEFAULT>
+TOKEN :
+{
+ < S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ >
+ { image = Parser.SPACE; }
+}
+
+<DEFAULT>
+MORE : /* Comments */
+{
+ < "/*" > : IN_COMMENT
+}
+
+<IN_COMMENT>
+SKIP :
+{
+ < "*/" > : DEFAULT
+}
+
+<IN_COMMENT>
+MORE :
+{
+ < ~[] > : IN_COMMENT
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < CDO : "<!--" >
+ | < CDC : "-->" >
+ | < LBRACE : "{" >
+ | < RBRACE : "}">
+ | < DASHMATCH : "|=" >
+ | < INCLUDES : "~=" >
+ | < EQ : "=" >
+ | < PLUS : "+" >
+ | < MINUS : "-" >
+ | < COMMA : "," >
+ | < SEMICOLON : ";" >
+ | < PRECEDES : ">" >
+ | < DIV : "/" >
+ | < LBRACKET : "[" >
+ | < RBRACKET : "]" >
+ | < ANY : "*" >
+ | < DOT : "." >
+ | < LPARAN : ")" >
+ | < RPARAN : "(">
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < COLON : ":" >
+}
+
+<DEFAULT>
+TOKEN : /* basic tokens */
+{
+ < NONASCII : ["\200"-"\377"] >
+ | < #H : ["0"-"9", "a"-"f"] >
+ | < #UNICODE : "\\" <H> ( <H> )? /* I can't say {1,6} */
+ ( <H> )? ( <H> )?
+ ( <H> )? ( <H> )?
+ ( [ " ", "\t" , "\n" , "\r", "\f" ] )? >
+ | < #ESCAPE : <UNICODE> | ( "\\" [ " "-"~","\200"-"\377" ] ) >
+ | < #NMSTART : [ "a"-"z" ] | <NONASCII> | <ESCAPE> >
+ | < #NMCHAR : ["a"-"z", "0"-"9", "-"] | <NONASCII> | <ESCAPE> >
+ | < #STRINGCHAR : [ "\t"," ","!","#","$","%","&","("-"~" ]
+ | "\\\n" | "\\\r\n" | "\\\r" | "\\\f"
+ | <NONASCII> | <ESCAPE> >
+ | < #D : ["0"-"9"] >
+ | < #NAME : ( <NMCHAR> )+ >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < STRING : ( "\"" ( <STRINGCHAR> | "'" )* "\"" ) |
+ ( "'" ( <STRINGCHAR> | "\"" )* "'" ) >
+ | < IDENT : <NMSTART> ( <NMCHAR> )* >
+ | < NUMBER : ( <D> )+ | ( <D> )* "." ( <D> )+ >
+ | < #_URL : [ "!","#","$","%","&","*"-"~" ] | <NONASCII> | <ESCAPE> >
+ | < URL : "url(" ( <S> )*
+ ( <STRING> | ( <_URL> )* ) ( <S> )* ")" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < PERCENTAGE : <NUMBER> "%" >
+ | < PT : <NUMBER> "pt" >
+ | < MM : <NUMBER> "mm" >
+ | < CM : <NUMBER> "cm" >
+ | < PC : <NUMBER> "pc" >
+ | < IN : <NUMBER> "in" >
+ | < PX : <NUMBER> "px" >
+ | < EMS : <NUMBER> "em" >
+ | < EXS : <NUMBER> "ex" >
+ | < DEG : <NUMBER> "deg" >
+ | < RAD : <NUMBER> "rad" >
+ | < GRAD : <NUMBER> "grad" >
+ | < MS : <NUMBER> "ms" >
+ | < SECOND : <NUMBER> "s" >
+ | < HZ : <NUMBER> "Hz" >
+ | < KHZ : <NUMBER> "kHz" >
+ | < DIMEN : <NUMBER> <IDENT> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < HASH : "#" <NAME> >
+}
+
+/* RESERVED ATRULE WORDS */
+<DEFAULT>
+TOKEN :
+{
+ < IMPORT_SYM : "@import">
+ | < MEDIA_SYM : "@media" >
+ | < CHARSET_SYM : "@charset" >
+ | < PAGE_SYM : "@page" >
+ | < FONT_FACE_SYM: "@font-face" >
+ | < ATKEYWORD : "@" <IDENT> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < IMPORTANT_SYM : "!" ( <S> )? "important" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < #RANGE0 : <H> <H> <H> <H> <H> >
+ | < #RANGE1 : <H> <H> <H> <H> <H> ( "?" )? >
+ | < #RANGE2 : <H> <H> <H> <H> ( "?" )? ( "?" )? >
+ | < #RANGE3 : <H> <H> <H> ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE4 : <H> <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE5 : <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE6 : "?" ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE : <RANGE0> | <RANGE1> | <RANGE2>
+ | <RANGE3> | <RANGE4> | <RANGE5> | <RANGE6> >
+ | < #UNI : <H> ( <H> )? ( <H> )? ( <H> )? ( <H> )? ( <H> )? >
+ | < UNICODERANGE : "U+" <RANGE>
+ | "U+" <UNI> "-" <UNI> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < FUNCTION : <IDENT> "(" >
+}
+
+<DEFAULT, IN_COMMENT>
+TOKEN :
+{ /* avoid token manager error */
+ < UNKNOWN : ~[] >
+}
+
+/*
+ * The grammar of CSS2
+ */
+
+/**
+ * The main entry for the parser.
+ *
+ * @exception ParseException exception during the parse
+ */
+void parserUnit() :
+{}
+{
+ try {
+ { documentHandler.startDocument(source); }
+ ( charset() )?
+ ( <S> | ignoreStatement() )*
+ ( importDeclaration() ( ignoreStatement() ( <S> )* )* )*
+ afterImportDeclaration()
+ <EOF>
+ } finally {
+ documentHandler.endDocument(source);
+ }
+}
+
+
+void charset() :
+{ Token n; }
+{
+ try {
+ <CHARSET_SYM> ( <S> )* n=<STRING> ( <S> )* ";"
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ }
+}
+
+void afterImportDeclaration() :
+{String ret;
+ Locator l;
+}
+{
+ ( ( styleRule() | media() | page() | fontFace()
+ | { l = getLocator(); } ret=skipStatement()
+ {
+ if ((ret == null) || (ret.length() == 0)) {
+ return;
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ )
+ ( ignoreStatement() ( <S> )* )* )*
+}
+
+void ignoreStatement() :
+{}
+{
+ <CDO> | <CDC> | atRuleDeclaration()
+}
+
+/**
+ * The import statement
+ *
+ * @exception ParseException exception during the parse
+ */
+void importDeclaration() :
+{Token n;
+ String uri;
+ MediaListImpl ml = new MediaListImpl();
+}
+{
+ try {
+ <IMPORT_SYM>
+ ( <S> )* ( n=<STRING> { uri = convertStringIndex(n.image, 1,
+ n.image.length() -1); }
+ | n=<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);
+ }
+ }
+ )
+ ( <S> )* ( mediaStatement(ml) )? ";"
+ ( <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());
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void media() :
+{
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+}
+{
+ try {
+ <MEDIA_SYM> ( <S> )*
+ mediaStatement(ml)
+ { start = true; documentHandler.startMedia(ml); }
+ <LBRACE> ( <S> )* ( styleRule() | skipUnknownRule() )* <RBRACE> ( <S> )*
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+}
+
+void mediaStatement(MediaListImpl ml) :
+{
+ String m;
+}
+{
+ m=medium() ( <COMMA> ( <S> )* { ml.addItem(m); } m=medium() )*
+ { ml.addItem(m); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String medium() : /* tv, projection, screen, ... */
+{Token n;}
+{
+ n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void page() :
+{
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+}
+{
+ try {
+ <PAGE_SYM> ( <S> )* ( n=<IDENT> ( <S> )* )?
+ ( pseudo=pseudo_page() )?
+ {
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ }
+ <LBRACE> (<S>)*
+ {
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+}
+
+String pseudo_page() :
+{ Token n; }
+{
+ ":" n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+void fontFace() :
+{
+ boolean start = false;
+}
+{
+ try {
+ <FONT_FACE_SYM> ( <S> )*
+ <LBRACE> (<S>)*
+ { start = true; documentHandler.startFontFace(); }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void atRuleDeclaration() :
+{Token n;
+ String ret;
+}
+{
+ n=<ATKEYWORD>
+ {
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+}
+
+void skipUnknownRule() :
+{ Token n;}
+{
+ ( n=<ATKEYWORD>
+| n=<CDO>
+| n=<CHARSET_SYM>
+| n=<COMMA>
+| n=<DASHMATCH>
+| n=<FONT_FACE_SYM>
+| n=<FUNCTION>
+| n=<IMPORTANT_SYM>
+| n=<IMPORT_SYM>
+| n=<INCLUDES>
+| n=<LBRACE>
+| n=<MEDIA_SYM>
+| n=<NONASCII>
+| n=<NUMBER>
+| n=<PAGE_SYM>
+| n=<PERCENTAGE>
+| n=<STRING>
+| n=<UNICODERANGE>
+| n=<URL>
+| n=";"
+| n="+"
+| n=">"
+| n="-"
+| n=<UNKNOWN>
+ ) {
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+char combinator() :
+{
+char connector = ' ';
+}
+{
+ "+" ( <S> )* { return '+'; }
+ | ">" ( <S> )* { return '>'; }
+| <S> ( ( "+" { connector = '+'; }
+ | ">" { connector = '>'; } )
+ ( <S> )* )? { return connector; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String property() :
+{Token n; }
+{
+ n=<IDENT> ( <S> )* { 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; } <LBRACE> (<S>)*
+ {
+ start = true;
+ documentHandler.startSelector(l);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ThrowedParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.e.currentToken.next.beginLine,
+ e.e.currentToken.next.beginColumn-1);
+ reportError(li, e.e);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } catch (TokenMgrError e) {
+ reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endSelector(l);
+ }
+ }
+}
+
+SelectorList selectorList() :
+{
+ SelectorListImpl selectors = new SelectorListImpl();
+ Selector selector;
+}
+{
+ selector=selector() ( <COMMA> (<S>)* { 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) )* (<S>)*
+ {
+ return selector;
+ }
+ } catch (ParseException e) {
+ /*
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+ reportWarningSkipText(getLocator(), s.toString());
+ */
+ Token t = getToken(1);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ getNextToken();
+ t = getToken(1);
+ }
+
+ throw new ThrowedParseException(e);
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+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=<IDENT>
+ {
+ 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=<IDENT>
+ {
+ 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;
+}
+{
+ "[" ( <S> )* att=<IDENT> ( <S> )*
+ ( ( "=" { cases = 1; }
+ | <INCLUDES> { cases = 2; }
+ | <DASHMATCH> { cases = 3; } ) ( <S> )*
+ ( val=<IDENT> { attValue = val.image; }
+ | val=<STRING> { attValue = convertStringIndex(val.image, 1,
+ val.image.length() -1);}
+ )
+ ( <S> )* )?
+ "]"
+ {
+ 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=<IDENT>
+ {
+ 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=<FUNCTION> ( <S> )* language=<IDENT> ( <S> )* ")"
+ {
+ 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=<HASH>
+ {
+ 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; }
+ ":" ( <S> )* exp=expr() ( important=prio() )?
+ {
+ documentHandler.property(name, exp, important);
+ }
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+boolean prio() :
+{}
+{
+ <IMPORTANT_SYM> ( <S> )* { return true; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl operator(LexicalUnitImpl prev) :
+{Token n;}
+{
+n="/" ( <S> )* { return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev); }
+| n="," ( <S> )* { return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+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=<NUMBER>
+ { result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
+ prev, number(op, n, 0)); }
+ | n=<PERCENTAGE>
+ { result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1)); }
+ | n=<PT>
+ { result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<CM>
+ { result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<MM>
+ { result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<PC>
+ { result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<IN>
+ { result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<PX>
+ { result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<EMS>
+ { result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<EXS>
+ { result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<DEG>
+ { result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<RAD>
+ { result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<GRAD>
+ { result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<SECOND>
+ { result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1)); }
+ | n=<MS>
+ { result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<HZ>
+ { result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<KHZ>
+ { result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<DIMEN>
+ {
+ 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=<STRING>
+ { result =
+ LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
+ convertStringIndex(n.image, 1,
+ n.image.length() -1));}
+ | n=<IDENT>
+ { String s = convertIdent(n.image);
+ if ("inherit".equals(s)) {
+ result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
+ prev);
+ } else {
+ result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, convertIdent(n.image));
+ }
+
+ /* /
+ Auto correction code used in the CSS Validator but must not
+ be used by a conformant CSS2 parser.
+ * Common error :
+ * H1 {
+ * color : black
+ * background : white
+ * }
+ *
+ Token t = getToken(1);
+ Token semicolon = new Token();
+ semicolon.kind = SEMICOLON;
+ semicolon.image = ";";
+ if (t.kind == COLON) {
+ // @@SEEME. (generate a warning?)
+ // @@SEEME if expression is a single ident,
+ generate an error ?
+ rejectToken(semicolon);
+
+ result = prev;
+ }
+ / */
+ }
+ | result=hexcolor(prev)
+ | result=url(prev)
+ | result=unicode(prev)
+ ) ) ( <S> )*
+ {
+ return result;
+ }
+}
+
+/**
+ * Handle all CSS2 functions.
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl function(char operator, LexicalUnitImpl prev) :
+{Token n;
+ LexicalUnit params = null;
+}
+{
+ n=<FUNCTION> ( <S> )* ( params=expr() )? ")"
+ {
+ if (operator != ' ') {
+ throw new CSSParseException("invalid operator before a function.",
+ getLocator());
+ }
+ String f = convertIdent(n.image);
+ LexicalUnitImpl l = (LexicalUnitImpl) params;
+ boolean loop = true;
+ if ("rgb(".equals(f)) {
+ // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
+ && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ if (loop) {
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ }
+ if ((i == 5) && loop && (l == null)) {
+ return LexicalUnitImpl.createRGBColor(n.beginLine,
+ n.beginColumn,
+ prev, params);
+ } else {
+ if (errorHandler != null) {
+ String errorText;
+ Locator loc;
+ if (i < 5) {
+ if (params == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters.";
+ } else if (l == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters: "
+ + params.toString();
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "invalid parameter: "
+ + l.toString();
+ }
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "too many parameters: "
+ + l.toString();
+ }
+ errorHandler.error(new CSSParseException(errorText, loc));
+ }
+
+ throw new JumpException();
+ }
+ } else if ("counter".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 3) {
+ switch (i) {
+ case 0:
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 1:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 1) || (i == 3)) && loop && (l == null)) {
+ return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+
+ } else if ("counters(".equals(f)) {
+
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 4:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 3) || (i == 5)) && loop && (l == null)) {
+ return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+ } else if ("attr(".equals(f)) {
+ if ((l != null)
+ && (l.getNextLexicalUnit() == null)
+ && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
+ return LexicalUnitImpl.createAttr(l.getLineNumber(),
+ l.getColumnNumber(),
+ prev, l.getStringValue());
+ }
+ } else if ("rect(".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 7) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ switch (l.getLexicalUnitType()) {
+ case LexicalUnit.SAC_INTEGER:
+ if (l.getIntegerValue() != 0) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_IDENT:
+ if (!l.getStringValue().equals("auto")) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_EM:
+ case LexicalUnit.SAC_EX:
+ case LexicalUnit.SAC_PIXEL:
+ case LexicalUnit.SAC_CENTIMETER:
+ case LexicalUnit.SAC_MILLIMETER:
+ case LexicalUnit.SAC_INCH:
+ case LexicalUnit.SAC_POINT:
+ case LexicalUnit.SAC_PICA:
+ // nothing
+ break;
+ default:
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ case 5:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if ((i == 7) && loop && (l == null)) {
+ return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+ }
+ return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
+ f.substring(0,
+ f.length() -1),
+ params);
+ }
+}
+
+LexicalUnitImpl unicode(LexicalUnitImpl prev) :
+{ Token n;
+}
+{
+ n=<UNICODERANGE>
+ {
+ LexicalUnitImpl params = null;
+ String s = n.image.substring(2);
+ int index = s.indexOf('-');
+ if (index == -1) {
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s, 16));
+ } else {
+ String s1 = s.substring(0, index);
+ String s2 = s.substring(index);
+
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s1, 16));
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s2, 16));
+ }
+
+ return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+}
+
+LexicalUnitImpl url(LexicalUnitImpl prev) :
+{ Token n;
+}
+{
+ n=<URL>
+ {
+ String urlname = n.image.substring(4, n.image.length()-1).trim();
+ 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=<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;
+ 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 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;
+}
+{
+ ( <S> )*
+ ( importDeclaration() | styleRule() | media() | page()
+ | fontFace() | ret=skipStatement()
+ {
+ if ((ret == null) || (ret.length() == 0)) {
+ return;
+ }
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ } else {
+ throw new CSSParseException("unrecognize rule: " + ret,
+ getLocator());
+ }
+ }
+ )
+}
+
+void _parseImportRule() :
+{
+}
+{
+ ( <S> )* importDeclaration()
+}
+
+void _parseMediaRule() :
+{
+}
+{
+ ( <S> )* media()
+}
+
+void _parseDeclarationBlock() :
+{
+}
+{
+ ( <S> )*
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ }
+
+SelectorList _parseSelectors() :
+{ SelectorList p = null;
+}
+{
+ try {
+ ( <S> )* p = selectorList()
+ { return p; }
+ } catch (ThrowedParseException e) {
+ throw (ParseException) e.e.fillInStackTrace();
+ }
+}
+
+/*
+ * Local Variables:
+ * compile-command: javacc Parser.jj & javac Parser.java
+ * End:
+ */
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,162 @@
+/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */
+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 STRING = 34;
+ int IDENT = 35;
+ int NUMBER = 36;
+ int _URL = 37;
+ int URL = 38;
+ int PERCENTAGE = 39;
+ int PT = 40;
+ int MM = 41;
+ int CM = 42;
+ int PC = 43;
+ int IN = 44;
+ int PX = 45;
+ int EMS = 46;
+ int EXS = 47;
+ int DEG = 48;
+ int RAD = 49;
+ int GRAD = 50;
+ int MS = 51;
+ int SECOND = 52;
+ int HZ = 53;
+ int KHZ = 54;
+ int DIMEN = 55;
+ int HASH = 56;
+ int IMPORT_SYM = 57;
+ int MEDIA_SYM = 58;
+ int CHARSET_SYM = 59;
+ int PAGE_SYM = 60;
+ int FONT_FACE_SYM = 61;
+ int ATKEYWORD = 62;
+ int IMPORTANT_SYM = 63;
+ int RANGE0 = 64;
+ int RANGE1 = 65;
+ int RANGE2 = 66;
+ int RANGE3 = 67;
+ int RANGE4 = 68;
+ int RANGE5 = 69;
+ int RANGE6 = 70;
+ int RANGE = 71;
+ int UNI = 72;
+ int UNICODERANGE = 73;
+ int FUNCTION = 74;
+ int UNKNOWN = 75;
+
+ int DEFAULT = 0;
+ int IN_COMMENT = 1;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "<S>",
+ "\"/*\"",
+ "\"*/\"",
+ "<token of kind 4>",
+ "\"<!--\"",
+ "\"-->\"",
+ "\"{\"",
+ "\"}\"",
+ "\"|=\"",
+ "\"~=\"",
+ "\"=\"",
+ "\"+\"",
+ "\"-\"",
+ "\",\"",
+ "\";\"",
+ "\">\"",
+ "\"/\"",
+ "\"[\"",
+ "\"]\"",
+ "\"*\"",
+ "\".\"",
+ "\")\"",
+ "\"(\"",
+ "\":\"",
+ "<NONASCII>",
+ "<H>",
+ "<UNICODE>",
+ "<ESCAPE>",
+ "<NMSTART>",
+ "<NMCHAR>",
+ "<STRINGCHAR>",
+ "<D>",
+ "<NAME>",
+ "<STRING>",
+ "<IDENT>",
+ "<NUMBER>",
+ "<_URL>",
+ "<URL>",
+ "<PERCENTAGE>",
+ "<PT>",
+ "<MM>",
+ "<CM>",
+ "<PC>",
+ "<IN>",
+ "<PX>",
+ "<EMS>",
+ "<EXS>",
+ "<DEG>",
+ "<RAD>",
+ "<GRAD>",
+ "<MS>",
+ "<SECOND>",
+ "<HZ>",
+ "<KHZ>",
+ "<DIMEN>",
+ "<HASH>",
+ "\"@import\"",
+ "\"@media\"",
+ "\"@charset\"",
+ "\"@page\"",
+ "\"@font-face\"",
+ "<ATKEYWORD>",
+ "<IMPORTANT_SYM>",
+ "<RANGE0>",
+ "<RANGE1>",
+ "<RANGE2>",
+ "<RANGE3>",
+ "<RANGE4>",
+ "<RANGE5>",
+ "<RANGE6>",
+ "<RANGE>",
+ "<UNI>",
+ "<UNICODERANGE>",
+ "<FUNCTION>",
+ "<UNKNOWN>",
+ };
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,3250 @@
+/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */
+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
+{
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+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;
+}
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x200000L) != 0L)
+ return 335;
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ return 48;
+ return -1;
+ case 1:
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 1;
+ return 336;
+ }
+ return -1;
+ case 2:
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 2;
+ return 336;
+ }
+ return -1;
+ case 3:
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 3;
+ return 336;
+ }
+ return -1;
+ case 4:
+ if ((active0 & 0x2e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 4;
+ return 336;
+ }
+ if ((active0 & 0x1000000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 5:
+ if ((active0 & 0x2a00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 5;
+ return 336;
+ }
+ if ((active0 & 0x400000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 6:
+ if ((active0 & 0x2800000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 6;
+ return 336;
+ }
+ if ((active0 & 0x200000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 7:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 7;
+ return 336;
+ }
+ if ((active0 & 0x800000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 8:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 8;
+ return 336;
+ }
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), 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);
+ case 46:
+ return jjStartNfaWithStates_0(0, 21, 335);
+ case 47:
+ jjmatchedKind = 17;
+ return jjMoveStringLiteralDfa1_0(0x4L);
+ case 58:
+ return jjStopAtPos(0, 24);
+ case 59:
+ return jjStopAtPos(0, 15);
+ case 60:
+ return jjMoveStringLiteralDfa1_0(0x20L);
+ case 61:
+ return jjStopAtPos(0, 11);
+ case 62:
+ return jjStopAtPos(0, 16);
+ case 64:
+ return jjMoveStringLiteralDfa1_0(0x3e00000000000000L);
+ case 91:
+ return jjStopAtPos(0, 18);
+ case 93:
+ return jjStopAtPos(0, 19);
+ case 123:
+ return jjStopAtPos(0, 7);
+ case 124:
+ return jjMoveStringLiteralDfa1_0(0x200L);
+ case 125:
+ return jjStopAtPos(0, 8);
+ case 126:
+ return jjMoveStringLiteralDfa1_0(0x400L);
+ default :
+ return jjMoveNfa_0(1, 0);
+ }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 33:
+ return jjMoveStringLiteralDfa2_0(active0, 0x20L);
+ case 42:
+ if ((active0 & 0x4L) != 0L)
+ return jjStopAtPos(1, 2);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa2_0(active0, 0x40L);
+ 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, 0x800000000000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa2_0(active0, 0x200000000000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000000000000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20L);
+ case 62:
+ if ((active0 & 0x40L) != 0L)
+ return jjStopAtPos(2, 6);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 45:
+ if ((active0 & 0x20L) != 0L)
+ return jjStopAtPos(3, 5);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa4_0(active0, 0x400000000000000L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa4_0(active0, 0x200000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ if ((active0 & 0x1000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 60, 336);
+ break;
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000000L);
+ case 65:
+ case 97:
+ if ((active0 & 0x400000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 58, 336);
+ break;
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa6_0(active0, 0x200000000000000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000000L);
+ case 84:
+ case 116:
+ if ((active0 & 0x200000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 57, 336);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0);
+}
+private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa8_0(active0, 0x2000000000000000L);
+ case 84:
+ case 116:
+ if ((active0 & 0x800000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 59, 336);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0);
+}
+private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, active0);
+}
+private final int jjMoveStringLiteralDfa9_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 61, 336);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, active0);
+}
+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 = 335;
+ 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 336:
+ case 49:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 335:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(148, 151);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(145, 147);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(143, 144);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(140, 142);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(135, 139);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(131, 134);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(127, 130);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(124, 126);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(121, 123);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(118, 120);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(115, 117);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(112, 114);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(109, 111);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(106, 108);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(103, 105);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(101, 102);
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAdd(100);
+ }
+ break;
+ case 1:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAddStates(3, 74);
+ }
+ else if ((0x100003600L & l) != 0L)
+ {
+ if (kind > 1)
+ kind = 1;
+ jjCheckNAdd(0);
+ }
+ else if (curChar == 46)
+ jjCheckNAddStates(75, 92);
+ else if (curChar == 33)
+ jjCheckNAddTwoStates(67, 76);
+ else if (curChar == 35)
+ jjCheckNAddTwoStates(37, 38);
+ else if (curChar == 39)
+ jjCheckNAddStates(93, 96);
+ else if (curChar == 34)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 0:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 1)
+ kind = 1;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if (curChar == 34)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 3:
+ if ((0xfffffffb00000200L & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 4:
+ if (curChar == 34 && kind > 34)
+ kind = 34;
+ break;
+ case 6:
+ if (curChar == 12)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 8:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 9:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(101, 106);
+ break;
+ case 10:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 11:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(107, 115);
+ break;
+ case 12:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(116, 120);
+ break;
+ case 13:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(121, 126);
+ break;
+ case 14:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(127, 133);
+ break;
+ case 15:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(134, 141);
+ break;
+ case 16:
+ if (curChar == 13)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 17:
+ if (curChar == 10)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 18:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 17;
+ break;
+ case 19:
+ if (curChar == 39)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 20:
+ if ((0xffffff7f00000200L & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 21:
+ if (curChar == 39 && kind > 34)
+ kind = 34;
+ break;
+ case 23:
+ if (curChar == 12)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 25:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 26:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(142, 147);
+ break;
+ case 27:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 28:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(148, 156);
+ break;
+ case 29:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(157, 161);
+ break;
+ case 30:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(162, 167);
+ break;
+ case 31:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(168, 174);
+ break;
+ case 32:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(175, 182);
+ break;
+ case 33:
+ if (curChar == 13)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 34:
+ if (curChar == 10)
+ jjCheckNAddStates(93, 96);
+ 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 > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 39:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 40:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(183, 186);
+ break;
+ case 41:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 42:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(187, 193);
+ break;
+ case 43:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(194, 196);
+ break;
+ case 44:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(197, 200);
+ break;
+ case 45:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(201, 205);
+ break;
+ case 46:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(206, 211);
+ break;
+ case 51:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 52:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(212, 215);
+ break;
+ case 53:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 54:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(216, 222);
+ break;
+ case 55:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(223, 225);
+ break;
+ case 56:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(226, 229);
+ break;
+ case 57:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(230, 234);
+ break;
+ case 58:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(235, 240);
+ break;
+ case 60:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(241, 244);
+ break;
+ case 61:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(245, 251);
+ break;
+ case 62:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(252, 254);
+ break;
+ case 63:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(255, 258);
+ break;
+ case 64:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(259, 263);
+ break;
+ case 65:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(264, 269);
+ break;
+ case 66:
+ if (curChar == 33)
+ jjCheckNAddTwoStates(67, 76);
+ break;
+ case 67:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(67, 76);
+ break;
+ case 78:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 80:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 81:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(270, 273);
+ break;
+ case 82:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 83:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(274, 280);
+ break;
+ case 84:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(281, 283);
+ break;
+ case 85:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(284, 287);
+ break;
+ case 86:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(288, 292);
+ break;
+ case 87:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(293, 298);
+ break;
+ case 88:
+ if ((0x3ff200000000000L & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 89:
+ if (curChar == 40 && kind > 74)
+ kind = 74;
+ break;
+ case 91:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 92:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(302, 306);
+ break;
+ case 93:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 94:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(307, 314);
+ break;
+ case 95:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(315, 318);
+ break;
+ case 96:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(319, 323);
+ break;
+ case 97:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(324, 329);
+ break;
+ case 98:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(330, 336);
+ break;
+ case 99:
+ if (curChar == 46)
+ jjCheckNAddStates(75, 92);
+ break;
+ case 100:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAdd(100);
+ break;
+ case 101:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(101, 102);
+ break;
+ case 102:
+ if (curChar == 37 && kind > 39)
+ kind = 39;
+ break;
+ case 103:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(103, 105);
+ break;
+ case 106:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(106, 108);
+ break;
+ case 109:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(109, 111);
+ break;
+ case 112:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(112, 114);
+ break;
+ case 115:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(115, 117);
+ break;
+ case 118:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(118, 120);
+ break;
+ case 121:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(121, 123);
+ break;
+ case 124:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(124, 126);
+ break;
+ case 127:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(127, 130);
+ break;
+ case 131:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(131, 134);
+ break;
+ case 135:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(135, 139);
+ break;
+ case 140:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(140, 142);
+ break;
+ case 143:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(143, 144);
+ break;
+ case 145:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(145, 147);
+ break;
+ case 148:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(148, 151);
+ break;
+ case 152:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 154:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 156:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 157:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(337, 340);
+ break;
+ case 158:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 159:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(341, 347);
+ break;
+ case 160:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(348, 350);
+ break;
+ case 161:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(351, 354);
+ break;
+ case 162:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(355, 359);
+ break;
+ case 163:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(360, 365);
+ break;
+ case 165:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(366, 369);
+ break;
+ case 166:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(370, 376);
+ break;
+ case 167:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(377, 379);
+ break;
+ case 168:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(380, 383);
+ break;
+ case 169:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(384, 388);
+ break;
+ case 170:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(389, 394);
+ break;
+ case 172:
+ if (curChar == 40)
+ jjCheckNAddStates(395, 400);
+ break;
+ case 173:
+ if ((0xfffffc7a00000000L & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 174:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(174, 175);
+ break;
+ case 175:
+ if (curChar == 41 && kind > 38)
+ kind = 38;
+ break;
+ case 177:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 178:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(405, 409);
+ break;
+ case 179:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 180:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(410, 417);
+ break;
+ case 181:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(418, 421);
+ break;
+ case 182:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(422, 426);
+ break;
+ case 183:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(427, 432);
+ break;
+ case 184:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(433, 439);
+ break;
+ case 185:
+ if (curChar == 39)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 186:
+ if ((0xffffff7f00000200L & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 187:
+ if (curChar == 39)
+ jjCheckNAddTwoStates(174, 175);
+ break;
+ case 189:
+ if (curChar == 12)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 191:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 192:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(444, 449);
+ break;
+ case 193:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 194:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(450, 458);
+ break;
+ case 195:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(459, 463);
+ break;
+ case 196:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(464, 469);
+ break;
+ case 197:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(470, 476);
+ break;
+ case 198:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(477, 484);
+ break;
+ case 199:
+ if (curChar == 13)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 200:
+ if (curChar == 10)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 201:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 200;
+ break;
+ case 202:
+ if (curChar == 34)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 203:
+ if ((0xfffffffb00000200L & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 204:
+ if (curChar == 34)
+ jjCheckNAddTwoStates(174, 175);
+ break;
+ case 206:
+ if (curChar == 12)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 208:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 209:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(489, 494);
+ break;
+ case 210:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 211:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(495, 503);
+ break;
+ case 212:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(504, 508);
+ break;
+ case 213:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(509, 514);
+ break;
+ case 214:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(515, 521);
+ break;
+ case 215:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(522, 529);
+ break;
+ case 216:
+ if (curChar == 13)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 217:
+ if (curChar == 10)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 218:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 217;
+ break;
+ case 219:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(530, 536);
+ break;
+ case 222:
+ if (curChar == 43)
+ jjAddStates(537, 538);
+ break;
+ case 223:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 224;
+ break;
+ case 224:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(539, 542);
+ break;
+ case 225:
+ if (curChar == 63 && kind > 73)
+ kind = 73;
+ break;
+ case 226:
+ case 241:
+ case 245:
+ case 248:
+ case 251:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(225);
+ break;
+ case 227:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 226);
+ break;
+ case 228:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(543, 545);
+ break;
+ case 229:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjAddStates(546, 551);
+ break;
+ case 230:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 231;
+ break;
+ case 231:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 232;
+ break;
+ case 232:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(233);
+ break;
+ case 233:
+ if ((0x3ff000000000000L & l) != 0L && kind > 73)
+ kind = 73;
+ break;
+ case 234:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 235;
+ break;
+ case 235:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 236;
+ break;
+ case 236:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 237;
+ break;
+ case 237:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(225);
+ break;
+ case 238:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 239;
+ break;
+ case 239:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 240;
+ break;
+ case 240:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 241;
+ break;
+ case 242:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 243;
+ break;
+ case 243:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 244;
+ break;
+ case 244:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 245);
+ break;
+ case 246:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 247;
+ break;
+ case 247:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(552, 554);
+ break;
+ case 249:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 248);
+ break;
+ case 250:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(555, 558);
+ break;
+ case 252:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 251);
+ break;
+ case 253:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(559, 561);
+ break;
+ case 254:
+ if (curChar == 43)
+ jjstateSet[jjnewStateCnt++] = 255;
+ break;
+ case 255:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(256, 262);
+ break;
+ case 256:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 257;
+ break;
+ case 257:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 258;
+ break;
+ case 258:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(562, 565);
+ break;
+ case 259:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(233);
+ break;
+ case 260:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(233, 259);
+ break;
+ case 261:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(566, 568);
+ break;
+ case 262:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(569, 573);
+ break;
+ case 263:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(256);
+ break;
+ case 264:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(263, 256);
+ break;
+ case 265:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(574, 576);
+ break;
+ case 266:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(577, 580);
+ break;
+ case 268:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(581, 584);
+ break;
+ case 269:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(585, 591);
+ break;
+ case 270:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(592, 594);
+ break;
+ case 271:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(595, 598);
+ break;
+ case 272:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(599, 603);
+ break;
+ case 273:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(604, 609);
+ break;
+ case 274:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(610, 614);
+ break;
+ case 275:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(615, 622);
+ break;
+ case 276:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(623, 626);
+ break;
+ case 277:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(627, 631);
+ break;
+ case 278:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(632, 637);
+ break;
+ case 279:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(638, 644);
+ break;
+ case 280:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAddStates(3, 74);
+ break;
+ case 281:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAdd(281);
+ break;
+ case 282:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(282, 283);
+ break;
+ case 283:
+ if (curChar == 46)
+ jjCheckNAdd(100);
+ break;
+ case 284:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(284, 102);
+ break;
+ case 285:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(285, 286);
+ break;
+ case 286:
+ if (curChar == 46)
+ jjCheckNAdd(101);
+ break;
+ case 287:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(287, 105);
+ break;
+ case 288:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(288, 289);
+ break;
+ case 289:
+ if (curChar == 46)
+ jjCheckNAdd(103);
+ break;
+ case 290:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(290, 108);
+ break;
+ case 291:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(291, 292);
+ break;
+ case 292:
+ if (curChar == 46)
+ jjCheckNAdd(106);
+ break;
+ case 293:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(293, 111);
+ break;
+ case 294:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(294, 295);
+ break;
+ case 295:
+ if (curChar == 46)
+ jjCheckNAdd(109);
+ break;
+ case 296:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(296, 114);
+ break;
+ case 297:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(297, 298);
+ break;
+ case 298:
+ if (curChar == 46)
+ jjCheckNAdd(112);
+ break;
+ case 299:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(299, 117);
+ break;
+ case 300:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(300, 301);
+ break;
+ case 301:
+ if (curChar == 46)
+ jjCheckNAdd(115);
+ break;
+ case 302:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(302, 120);
+ break;
+ case 303:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(303, 304);
+ break;
+ case 304:
+ if (curChar == 46)
+ jjCheckNAdd(118);
+ break;
+ case 305:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(305, 123);
+ break;
+ case 306:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(306, 307);
+ break;
+ case 307:
+ if (curChar == 46)
+ jjCheckNAdd(121);
+ break;
+ case 308:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(308, 126);
+ break;
+ case 309:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(309, 310);
+ break;
+ case 310:
+ if (curChar == 46)
+ jjCheckNAdd(124);
+ break;
+ case 311:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(311, 130);
+ break;
+ case 312:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(312, 313);
+ break;
+ case 313:
+ if (curChar == 46)
+ jjCheckNAdd(127);
+ break;
+ case 314:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(314, 134);
+ break;
+ case 315:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(315, 316);
+ break;
+ case 316:
+ if (curChar == 46)
+ jjCheckNAdd(131);
+ break;
+ case 317:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(317, 139);
+ break;
+ case 318:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(318, 319);
+ break;
+ case 319:
+ if (curChar == 46)
+ jjCheckNAdd(135);
+ break;
+ case 320:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(320, 142);
+ break;
+ case 321:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(321, 322);
+ break;
+ case 322:
+ if (curChar == 46)
+ jjCheckNAdd(140);
+ break;
+ case 323:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(323, 144);
+ break;
+ case 324:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(324, 325);
+ break;
+ case 325:
+ if (curChar == 46)
+ jjCheckNAdd(143);
+ break;
+ case 326:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(326, 147);
+ break;
+ case 327:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(327, 328);
+ break;
+ case 328:
+ if (curChar == 46)
+ jjCheckNAdd(145);
+ break;
+ case 329:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(329, 151);
+ break;
+ case 330:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(330, 331);
+ break;
+ case 331:
+ if (curChar == 46)
+ jjCheckNAdd(148);
+ break;
+ case 332:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(645, 647);
+ break;
+ case 333:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(333, 334);
+ break;
+ case 334:
+ if (curChar == 46)
+ jjCheckNAdd(152);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 336:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(51, 52);
+ break;
+ case 1:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ }
+ else if (curChar == 92)
+ jjCheckNAddStates(653, 656);
+ else if (curChar == 64)
+ jjAddStates(657, 658);
+ if ((0x20000000200000L & l) != 0L)
+ jjAddStates(659, 661);
+ break;
+ case 48:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(51, 60);
+ break;
+ case 3:
+ case 8:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 5:
+ if (curChar == 92)
+ jjAddStates(662, 665);
+ break;
+ case 7:
+ if (curChar == 92)
+ jjAddStates(666, 667);
+ break;
+ case 9:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(101, 106);
+ break;
+ case 11:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(107, 115);
+ break;
+ case 12:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(116, 120);
+ break;
+ case 13:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(121, 126);
+ break;
+ case 14:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(127, 133);
+ break;
+ case 15:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(134, 141);
+ break;
+ case 20:
+ case 25:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 22:
+ if (curChar == 92)
+ jjAddStates(668, 671);
+ break;
+ case 24:
+ if (curChar == 92)
+ jjAddStates(672, 673);
+ break;
+ case 26:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(142, 147);
+ break;
+ case 28:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(148, 156);
+ break;
+ case 29:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(157, 161);
+ break;
+ case 30:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(162, 167);
+ break;
+ case 31:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(168, 174);
+ break;
+ case 32:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(175, 182);
+ break;
+ case 37:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 38:
+ if (curChar == 92)
+ jjAddStates(674, 675);
+ break;
+ case 39:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 40:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(183, 186);
+ break;
+ case 42:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(187, 193);
+ break;
+ case 43:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(194, 196);
+ break;
+ case 44:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(197, 200);
+ break;
+ case 45:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(201, 205);
+ break;
+ case 46:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(206, 211);
+ break;
+ case 47:
+ if (curChar == 64)
+ jjAddStates(657, 658);
+ break;
+ case 49:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 50:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(51, 52);
+ break;
+ case 51:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 52:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(212, 215);
+ break;
+ case 54:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(216, 222);
+ break;
+ case 55:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(223, 225);
+ break;
+ case 56:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(226, 229);
+ break;
+ case 57:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(230, 234);
+ break;
+ case 58:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(235, 240);
+ break;
+ case 59:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(51, 60);
+ break;
+ case 60:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(241, 244);
+ break;
+ case 61:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(245, 251);
+ break;
+ case 62:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(252, 254);
+ break;
+ case 63:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(255, 258);
+ break;
+ case 64:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(259, 263);
+ break;
+ case 65:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(264, 269);
+ break;
+ case 68:
+ if ((0x10000000100000L & l) != 0L && kind > 63)
+ kind = 63;
+ 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 ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ break;
+ case 78:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 79:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(80, 81);
+ break;
+ case 80:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 81:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(270, 273);
+ break;
+ case 83:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(274, 280);
+ break;
+ case 84:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(281, 283);
+ break;
+ case 85:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(284, 287);
+ break;
+ case 86:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(288, 292);
+ break;
+ case 87:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(293, 298);
+ break;
+ case 88:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 90:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(91, 92);
+ break;
+ case 91:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 92:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(302, 306);
+ break;
+ case 94:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(307, 314);
+ break;
+ case 95:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(315, 318);
+ break;
+ case 96:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(319, 323);
+ break;
+ case 97:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(324, 329);
+ break;
+ case 98:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(330, 336);
+ break;
+ case 104:
+ if ((0x10000000100000L & l) != 0L && kind > 40)
+ kind = 40;
+ break;
+ case 105:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 104;
+ break;
+ case 107:
+ if ((0x200000002000L & l) != 0L && kind > 41)
+ kind = 41;
+ break;
+ case 108:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 107;
+ break;
+ case 110:
+ if ((0x200000002000L & l) != 0L && kind > 42)
+ kind = 42;
+ break;
+ case 111:
+ if ((0x800000008L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 110;
+ break;
+ case 113:
+ if ((0x800000008L & l) != 0L && kind > 43)
+ kind = 43;
+ break;
+ case 114:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 113;
+ break;
+ case 116:
+ if ((0x400000004000L & l) != 0L && kind > 44)
+ kind = 44;
+ break;
+ case 117:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 116;
+ break;
+ case 119:
+ if ((0x100000001000000L & l) != 0L && kind > 45)
+ kind = 45;
+ break;
+ case 120:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 119;
+ break;
+ case 122:
+ if ((0x200000002000L & l) != 0L && kind > 46)
+ kind = 46;
+ break;
+ case 123:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 122;
+ break;
+ case 125:
+ if ((0x100000001000000L & l) != 0L && kind > 47)
+ kind = 47;
+ break;
+ case 126:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 125;
+ break;
+ case 128:
+ if ((0x8000000080L & l) != 0L && kind > 48)
+ kind = 48;
+ break;
+ case 129:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 128;
+ break;
+ case 130:
+ if ((0x1000000010L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 129;
+ break;
+ case 132:
+ if ((0x1000000010L & l) != 0L && kind > 49)
+ kind = 49;
+ break;
+ case 133:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 132;
+ break;
+ case 134:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 133;
+ break;
+ case 136:
+ if ((0x1000000010L & l) != 0L && kind > 50)
+ kind = 50;
+ break;
+ case 137:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 136;
+ break;
+ case 138:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 137;
+ break;
+ case 139:
+ if ((0x8000000080L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 138;
+ break;
+ case 141:
+ if ((0x8000000080000L & l) != 0L && kind > 51)
+ kind = 51;
+ break;
+ case 142:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 141;
+ break;
+ case 144:
+ if ((0x8000000080000L & l) != 0L && kind > 52)
+ kind = 52;
+ break;
+ case 146:
+ if ((0x400000004000000L & l) != 0L && kind > 53)
+ kind = 53;
+ break;
+ case 147:
+ if ((0x10000000100L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 146;
+ break;
+ case 149:
+ if ((0x400000004000000L & l) != 0L && kind > 54)
+ kind = 54;
+ break;
+ case 150:
+ if ((0x10000000100L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 149;
+ break;
+ case 151:
+ if ((0x80000000800L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 150;
+ break;
+ case 153:
+ case 154:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 155:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(156, 157);
+ break;
+ case 156:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 157:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(337, 340);
+ break;
+ case 159:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(341, 347);
+ break;
+ case 160:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(348, 350);
+ break;
+ case 161:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(351, 354);
+ break;
+ case 162:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(355, 359);
+ break;
+ case 163:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(360, 365);
+ break;
+ case 164:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(156, 165);
+ break;
+ case 165:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(366, 369);
+ break;
+ case 166:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(370, 376);
+ break;
+ case 167:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(377, 379);
+ break;
+ case 168:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(380, 383);
+ break;
+ case 169:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(384, 388);
+ break;
+ case 170:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(389, 394);
+ break;
+ case 171:
+ if ((0x20000000200000L & l) != 0L)
+ jjAddStates(659, 661);
+ break;
+ case 173:
+ case 177:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 176:
+ if (curChar == 92)
+ jjAddStates(676, 677);
+ break;
+ case 178:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(405, 409);
+ break;
+ case 180:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(410, 417);
+ break;
+ case 181:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(418, 421);
+ break;
+ case 182:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(422, 426);
+ break;
+ case 183:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(427, 432);
+ break;
+ case 184:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(433, 439);
+ break;
+ case 186:
+ case 191:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 188:
+ if (curChar == 92)
+ jjAddStates(678, 681);
+ break;
+ case 190:
+ if (curChar == 92)
+ jjAddStates(682, 683);
+ break;
+ case 192:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(444, 449);
+ break;
+ case 194:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(450, 458);
+ break;
+ case 195:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(459, 463);
+ break;
+ case 196:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(464, 469);
+ break;
+ case 197:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(470, 476);
+ break;
+ case 198:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(477, 484);
+ break;
+ case 203:
+ case 208:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 205:
+ if (curChar == 92)
+ jjAddStates(684, 687);
+ break;
+ case 207:
+ if (curChar == 92)
+ jjAddStates(688, 689);
+ break;
+ case 209:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(489, 494);
+ break;
+ case 211:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(495, 503);
+ break;
+ case 212:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(504, 508);
+ break;
+ case 213:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(509, 514);
+ break;
+ case 214:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(515, 521);
+ break;
+ case 215:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(522, 529);
+ break;
+ case 220:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 172;
+ break;
+ case 221:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 220;
+ break;
+ case 229:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjAddStates(546, 551);
+ break;
+ case 230:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 231;
+ break;
+ case 231:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 232;
+ break;
+ case 232:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAdd(233);
+ break;
+ case 233:
+ if ((0x7e0000007eL & l) != 0L && kind > 73)
+ kind = 73;
+ break;
+ case 234:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 235;
+ break;
+ case 235:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 236;
+ break;
+ case 236:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 237;
+ break;
+ case 237:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 225;
+ break;
+ case 238:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 239;
+ break;
+ case 239:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 240;
+ break;
+ case 240:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 241;
+ break;
+ case 242:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 243;
+ break;
+ case 243:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 244;
+ break;
+ case 246:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 247;
+ break;
+ case 255:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(256, 262);
+ break;
+ case 257:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 258;
+ break;
+ case 258:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(562, 565);
+ break;
+ case 259:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(233);
+ break;
+ case 260:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(233, 259);
+ break;
+ case 261:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(566, 568);
+ break;
+ case 262:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(569, 573);
+ break;
+ case 263:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAdd(256);
+ break;
+ case 264:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(263, 256);
+ break;
+ case 265:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(574, 576);
+ break;
+ case 266:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(577, 580);
+ break;
+ case 267:
+ if (curChar == 92)
+ jjCheckNAddStates(653, 656);
+ break;
+ case 268:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(581, 584);
+ break;
+ case 269:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(585, 591);
+ break;
+ case 270:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(592, 594);
+ break;
+ case 271:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(595, 598);
+ break;
+ case 272:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(599, 603);
+ break;
+ case 273:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(604, 609);
+ break;
+ case 274:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(610, 614);
+ break;
+ case 275:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(615, 622);
+ break;
+ case 276:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(623, 626);
+ break;
+ case 277:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(627, 631);
+ break;
+ case 278:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(632, 637);
+ break;
+ case 279:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(638, 644);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 336:
+ case 49:
+ case 51:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 1:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ {
+ if (kind > 25)
+ kind = 25;
+ }
+ if ((jjbitVec0[i2] & l2) != 0L)
+ {
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ }
+ break;
+ case 48:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 3:
+ case 8:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 20:
+ case 25:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 37:
+ case 39:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 77:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ break;
+ case 78:
+ case 80:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 88:
+ case 91:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 153:
+ case 154:
+ case 156:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 173:
+ case 177:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 186:
+ case 191:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 203:
+ case 208:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 335 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static final int[] jjnextStates = {
+ 152, 153, 164, 281, 282, 283, 284, 285, 286, 102, 287, 288, 289, 105, 290, 291,
+ 292, 108, 293, 294, 295, 111, 296, 297, 298, 114, 299, 300, 301, 117, 302, 303,
+ 304, 120, 305, 306, 307, 123, 308, 309, 310, 126, 311, 312, 313, 130, 314, 315,
+ 316, 134, 317, 318, 319, 139, 320, 321, 322, 142, 323, 324, 325, 144, 326, 327,
+ 328, 147, 329, 330, 331, 151, 332, 333, 334, 153, 164, 100, 101, 103, 106, 109,
+ 112, 115, 118, 121, 124, 127, 131, 135, 140, 143, 145, 148, 152, 20, 21, 22,
+ 24, 3, 4, 5, 7, 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, 89, 90, 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, 154, 158, 155, 159, 154, 160, 158, 155, 161, 162, 163, 154, 158, 155, 154,
+ 160, 158, 155, 154, 160, 158, 155, 161, 154, 160, 158, 155, 161, 162, 158, 154,
+ 155, 166, 167, 158, 154, 155, 168, 169, 170, 158, 154, 155, 167, 158, 154, 155,
+ 167, 158, 154, 155, 168, 167, 158, 154, 155, 168, 169, 173, 185, 202, 175, 176,
+ 219, 173, 174, 175, 176, 173, 175, 176, 179, 180, 173, 181, 175, 176, 179, 182,
+ 183, 184, 173, 175, 176, 179, 173, 181, 175, 176, 179, 173, 181, 175, 176, 179,
+ 182, 173, 181, 175, 176, 179, 182, 183, 186, 187, 188, 190, 186, 193, 187, 188,
+ 190, 194, 186, 195, 193, 187, 188, 190, 196, 197, 198, 186, 193, 187, 188, 190,
+ 186, 195, 193, 187, 188, 190, 186, 195, 193, 187, 188, 190, 196, 186, 195, 193,
+ 187, 188, 190, 196, 197, 203, 204, 205, 207, 203, 210, 204, 205, 207, 211, 203,
+ 212, 210, 204, 205, 207, 213, 214, 215, 203, 210, 204, 205, 207, 203, 212, 210,
+ 204, 205, 207, 203, 212, 210, 204, 205, 207, 213, 203, 212, 210, 204, 205, 207,
+ 213, 214, 173, 185, 202, 174, 175, 176, 219, 223, 229, 225, 226, 227, 228, 225,
+ 226, 227, 230, 234, 238, 242, 246, 250, 225, 248, 249, 225, 251, 252, 253, 225,
+ 251, 252, 233, 259, 260, 261, 233, 259, 260, 263, 256, 264, 265, 266, 263, 256,
+ 264, 263, 256, 264, 265, 82, 78, 79, 269, 270, 82, 78, 79, 271, 272, 273,
+ 82, 78, 79, 270, 82, 78, 79, 270, 82, 78, 79, 271, 270, 82, 78, 79,
+ 271, 272, 93, 88, 89, 90, 275, 276, 93, 88, 89, 90, 277, 278, 279, 93,
+ 88, 89, 90, 276, 93, 88, 89, 90, 276, 93, 88, 89, 90, 277, 276, 93,
+ 88, 89, 90, 277, 278, 332, 153, 164, 78, 88, 89, 90, 79, 80, 268, 91,
+ 274, 48, 59, 221, 222, 254, 6, 16, 18, 17, 8, 9, 23, 33, 35, 34,
+ 25, 26, 39, 40, 177, 178, 189, 199, 201, 200, 191, 192, 206, 216, 218, 217,
+ 208, 209,
+};
+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, };
+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,
+};
+static final long[] jjtoToken = {
+ 0xffffffdc03ffffe3L, 0xe00L,
+};
+static final long[] jjtoSkip = {
+ 0x8L, 0x0L,
+};
+static final long[] jjtoMore = {
+ 0x14L, 0x0L,
+};
+private CharStream input_stream;
+private final int[] jjrounds = new int[335];
+private final int[] jjstateSet = new int[670];
+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 = 335; 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;
+}
+
+private final 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 final 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 > 75)
+ {
+ jjmatchedKind = 75;
+ }
+ 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);
+ }
+ }
+}
+
+final 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;
+ }
+}
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: SelectorListImpl.java,v 1.1 2000/08/07 01:16:21 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @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;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: Selectors.java,v 1.1 2000/02/14 16:58:31 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class Selectors implements SelectorList {
+
+ Selector[] selectors = new Selector[5];
+ int current;
+
+ public Selector item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public Selector itemSelector(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public int getLength() {
+ return current;
+ }
+
+ void addSelector(Selector selector) {
+ if (current == selectors.length) {
+ Selector[] old = selectors;
+ selectors = new Selector[old.length + old.length];
+ System.arraycopy(old, 0, selectors, 0, old.length);
+ }
+ selectors[current++] = selector;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,24 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: ThrowedParseException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class ThrowedParseException extends RuntimeException {
+ ParseException e;
+
+ /**
+ * Creates a new ThrowedParseException
+ */
+ ThrowedParseException(ParseException e) {
+ this.e = e;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,81 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+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 final 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();
+ }
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,133 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+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.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ 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);
+ }
+}
1
0
Author: tchemit
Date: 2009-05-18 15:54:21 +0000 (Mon, 18 May 2009)
New Revision: 1430
Modified:
jaxx/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-18 10:53:19 UTC (rev 1429)
+++ jaxx/trunk/pom.xml 2009-05-18 15:54:21 UTC (rev 1430)
@@ -153,8 +153,8 @@
<inceptionYear>2008</inceptionYear>
<!-- attention sur du multi-module l'url de deployement doit correspondre à l'url du site
sinon le plugin site perd les pédales et pour un module A, on dans le menu module A/A/index.html ...-->
- <url>http://lutinbuilder.labs.libre-entreprise.org/nuiton/jaxx</url>
- <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
+ <url>http://maven-site.nuiton.org/jaxx</url>
+ <!--url>http://www.nuiton.org/embedded/jaxx</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
Author: tchemit
Date: 2009-05-18 10:53:19 +0000 (Mon, 18 May 2009)
New Revision: 1429
Modified:
jaxx/trunk/pom.xml
Log:
use mavempom snapshot
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 22:10:39 UTC (rev 1428)
+++ jaxx/trunk/pom.xml 2009-05-18 10:53:19 UTC (rev 1429)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.0-alpha-2</version>
+ <version>1.0.0-alpha-3-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
Author: tchemit
Date: 2009-05-17 22:10:39 +0000 (Sun, 17 May 2009)
New Revision: 1428
Modified:
jaxx/trunk/pom.xml
Log:
fix site url for multi-module must be same domain as real deployment otherwise it bugs on the modules menu : link to A/A rather than A/B
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
+++ jaxx/trunk/pom.xml 2009-05-17 22:10:39 UTC (rev 1428)
@@ -151,7 +151,10 @@
<name>${project.artifactId}</name>
<description>Jaxx library parent pom</description>
<inceptionYear>2008</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <!-- attention sur du multi-module l'url de deployement doit correspondre à l'url du site
+ sinon le plugin site perd les pédales et pour un module A, on dans le menu module A/A/index.html ...-->
+ <url>http://lutinbuilder.labs.libre-entreprise.org/nuiton/jaxx</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
r1427 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org 17 May '09
by tchemit@users.labs.libre-entreprise.org 17 May '09
17 May '09
Author: tchemit
Date: 2009-05-17 20:50:11 +0000 (Sun, 17 May 2009)
New Revision: 1427
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -204,9 +204,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.6.0-alpha-1</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
<!-- a utiliser quand on sera sur nuiton -->
<!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
1
0
Author: tchemit
Date: 2009-05-17 20:50:06 +0000 (Sun, 17 May 2009)
New Revision: 1426
Added:
jaxx/tags/jaxx-1.6.0-alpha-1/
Log:
[maven-scm] copy for tag jaxx-1.6.0-alpha-1
Copied: jaxx/tags/jaxx-1.6.0-alpha-1 (from rev 1425, jaxx/trunk)
1
0