You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/07/31 16:08:55 UTC
svn commit: r427121 [10/29] - in
/incubator/harmony/enhanced/classlib/trunk/modules/swing: make/
src/main/java/common/javax/swing/ src/main/java/common/javax/swing/text/
src/main/java/common/javax/swing/text/html/
src/main/java/common/javax/swing/text/...
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+import java.util.Hashtable;
+
+/**
+ * This class is generated basing on <a href="http://www.w3.org/TR/html401/sgml/loosedtd.html">HTML 4.01 Transitional DTD</a>.
+ * Don't edit this autogenerated class!
+ */
+class ElementsHandler {
+ static Hashtable atts = new Hashtable();
+ static Object dtd;
+ static void put(final String s1,
+ final String s2) {
+ DTDUtilities.putAttribute(atts, s1, s2);
+ }
+
+ static void handleElement(final String name,
+ final String desc) {
+ DTDUtilities.handleElement(dtd, name, desc, atts);
+ }
+ static void initElementsCreation(final Object dtd) {
+ ElementsHandler.dtd = dtd;
+ handleAllElements();
+ }
+
+ static final String HTML_VERSION = "401Transitional" ;
+ static final String HTML_FRAMESET = "IGNORE";
+ static final String CONTENTTYPE = "CDATA" ;
+ static final String CONTENTTYPES = "CDATA" ;
+ static final String CHARSET = "CDATA" ;
+ static final String CHARSETS = "CDATA" ;
+ static final String LANGUAGECODE = "NAME" ;
+ static final String CHARACTER = "CDATA" ;
+ static final String LINKTYPES = "CDATA" ;
+ static final String MEDIADESC = "CDATA" ;
+ static final String URI = "CDATA" ;
+ static final String DATETIME = "CDATA" ;
+ static final String SCRIPT = "CDATA" ;
+ static final String STYLESHEET = "CDATA" ;
+ static final String FRAMETARGET = "CDATA" ;
+ static final String TEXT = "CDATA";
+ static final String HEAD_MISC = "SCRIPT|STYLE|META|LINK|OBJECT" ;
+ static final String HEADING = "H1|H2|H3|H4|H5|H6";
+ static final String LIST = "UL | OL | DIR | MENU";
+ static final String PREFORMATTED = "PRE";
+ static final String COLOR = "CDATA" ;
+ static final String BODYCOLORS = " bgcolor " + COLOR + " #IMPLIED text " + COLOR + " #IMPLIED link " + COLOR + " #IMPLIED vlink " + COLOR + " #IMPLIED alink " + COLOR + " #IMPLIED ";
+ static final String HTMLLAT1 = "Ignore" ;
+ static final String COREATTRS = "id ID #IMPLIED class CDATA #IMPLIED style " + STYLESHEET + " #IMPLIED title " + TEXT + " #IMPLIED " ;
+ static final String I18N = "lang " + LANGUAGECODE + " #IMPLIED dir (ltr|rtl) #IMPLIED " ;
+ static final String EVENTS = "onclick " + SCRIPT + " #IMPLIED ondblclick " + SCRIPT + " #IMPLIED onmousedown " + SCRIPT + " #IMPLIED onmouseup " + SCRIPT + " #IMPLIED onmouseover " + SCRIPT + " #IMPLIED onmousemove " + SCRIPT + " #IMPLIED onmouseout " + SCRIPT + " #IMPLIED onkeypress " + SCRIPT + " #IMPLIED onkeydown " + SCRIPT + " #IMPLIED onkeyup " + SCRIPT + " #IMPLIED " ;
+ static final String HTML_RESERVED = "IGNORE";
+ static final String RESERVED = "";
+ static final String ATTRS = "" + COREATTRS + " " + I18N + " " + EVENTS + "";
+ static final String ALIGN = "align (left|center|right|justify) #IMPLIED" ;
+ static final String FONTSTYLE = "TT | I | B | U | S | STRIKE | BIG | SMALL";
+ static final String PHRASE = "EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM" ;
+ static final String SPECIAL = "A | IMG | APPLET | OBJECT | FONT | BASEFONT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO | IFRAME";
+ static final String FORMCTRL = "INPUT | SELECT | TEXTAREA | LABEL | BUTTON";
+ static final String INLINE = "#PCDATA | " + FONTSTYLE + " | " + PHRASE + " | " + SPECIAL + " | " + FORMCTRL + "";
+ static final String BLOCK = "P | " + HEADING + " | " + LIST + " | " + PREFORMATTED + " | DL | DIV | CENTER | NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR | TABLE | FIELDSET | ADDRESS";
+ static final String FLOW = "" + BLOCK + " | " + INLINE + "";
+ static final String SHAPE = "(rect|circle|poly|default)";
+ static final String COORDS = "CDATA" ;
+ static final String LENGTH = "CDATA" ;
+ static final String MULTILENGTH = "CDATA" ;
+ static final String PIXELS = "CDATA" ;
+ static final String IALIGN = "(top|middle|bottom|left|right)" ;
+ static final String PRE_EXCLUSION = "IMG|OBJECT|APPLET|BIG|SMALL|SUB|SUP|FONT|BASEFONT";
+ static final String OLSTYLE = "CDATA" ;
+ static final String ULSTYLE = "(disc|square|circle)";
+ static final String LISTYLE = "CDATA" ;
+ static final String INPUTTYPE = "(TEXT | PASSWORD | CHECKBOX | RADIO | SUBMIT | RESET | FILE | HIDDEN | IMAGE | BUTTON)" ;
+ static final String LALIGN = "(top|bottom|left|right)";
+ static final String TFRAME = "(void|above|below|hsides|lhs|rhs|vsides|box|border)";
+ static final String TRULES = "(none | groups | rows | cols | all)";
+ static final String TALIGN = "(left|center|right)";
+ static final String CELLHALIGN = "align (left|center|right|justify|char) #IMPLIED char " + CHARACTER + " #IMPLIED charoff " + LENGTH + " #IMPLIED " ;
+ static final String CELLVALIGN = "valign (top|middle|bottom|baseline) #IMPLIED" ;
+ static final String CALIGN = "(top|bottom|left|right)";
+ static final String SCOPE = "(row|col|rowgroup|colgroup)";
+ static final String NOFRAMES_CONTENT = "(" + FLOW + ")*";
+ static final String HEAD_CONTENT = "TITLE & ISINDEX? & BASE?";
+ static final String VERSION = "version CDATA #FIXED";
+ static final String HTML_CONTENT = "HEAD, BODY";
+ static void initAttributes() {
+ put("(" + FONTSTYLE + "|" + PHRASE + ")", ATTRS);
+ put("(SUB|SUP)", ATTRS);
+ put("SPAN", ATTRS + RESERVED + " ");
+ put("BDO", COREATTRS + " lang " + LANGUAGECODE + " #IMPLIED dir (ltr|rtl) #REQUIRED ");
+ put("BASEFONT", "id ID #IMPLIED size CDATA #REQUIRED color " + COLOR + " #IMPLIED face CDATA #IMPLIED ");
+ put("FONT", COREATTRS + I18N + " size CDATA #IMPLIED color " + COLOR + " #IMPLIED face CDATA #IMPLIED ");
+ put("BR", COREATTRS + " clear (left|all|right|none) none ");
+ put("BODY", ATTRS + " onload " + SCRIPT + " #IMPLIED onunload " + SCRIPT + " #IMPLIED background " + URI + " #IMPLIED " + BODYCOLORS);
+ put("ADDRESS", ATTRS);
+ put("DIV", ATTRS + ALIGN + RESERVED);
+ put("CENTER", ATTRS);
+ put("A", ATTRS + " charset " + CHARSET + " #IMPLIED type " + CONTENTTYPE + " #IMPLIED name CDATA #IMPLIED href " + URI + " #IMPLIED hreflang " + LANGUAGECODE + " #IMPLIED target " + FRAMETARGET + " #IMPLIED rel " + LINKTYPES + " #IMPLIED rev " + LINKTYPES + " #IMPLIED accesskey " + CHARACTER + " #IMPLIED shape " + SHAPE + " rect coords " + COORDS + " #IMPLIED tabindex NUMBER #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED ");
+ put("MAP", ATTRS + " name CDATA #REQUIRED ");
+ put("AREA", ATTRS + " shape " + SHAPE + " rect coords " + COORDS + " #IMPLIED href " + URI + " #IMPLIED target " + FRAMETARGET + " #IMPLIED nohref (nohref) #IMPLIED alt " + TEXT + " #REQUIRED tabindex NUMBER #IMPLIED accesskey " + CHARACTER + " #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED ");
+ put("LINK", ATTRS + " charset " + CHARSET + " #IMPLIED href " + URI + " #IMPLIED hreflang " + LANGUAGECODE + " #IMPLIED type " + CONTENTTYPE + " #IMPLIED rel " + LINKTYPES + " #IMPLIED rev " + LINKTYPES + " #IMPLIED media " + MEDIADESC + " #IMPLIED target " + FRAMETARGET + " #IMPLIED ");
+ put("IMG", ATTRS + " src " + URI + " #REQUIRED alt " + TEXT + " #REQUIRED longdesc " + URI + " #IMPLIED name CDATA #IMPLIED height " + LENGTH + " #IMPLIED width " + LENGTH + " #IMPLIED usemap " + URI + " #IMPLIED ismap (ismap) #IMPLIED align " + IALIGN + " #IMPLIED border " + PIXELS + " #IMPLIED hspace " + PIXELS + " #IMPLIED vspace " + PIXELS + " #IMPLIED ");
+ put("OBJECT", ATTRS + " declare (declare) #IMPLIED classid " + URI + " #IMPLIED codebase " + URI + " #IMPLIED data " + URI + " #IMPLIED type " + CONTENTTYPE + " #IMPLIED codetype " + CONTENTTYPE + " #IMPLIED archive CDATA #IMPLIED standby " + TEXT + " #IMPLIED height " + LENGTH + " #IMPLIED width " + LENGTH + " #IMPLIED usemap " + URI + " #IMPLIED name CDATA #IMPLIED tabindex NUMBER #IMPLIED align " + IALIGN + " #IMPLIED border " + PIXELS + " #IMPLIED hspace " + PIXELS + " #IMPLIED vspace " + PIXELS + " #IMPLIED " + RESERVED);
+ put("PARAM", "id ID #IMPLIED name CDATA #REQUIRED value CDATA #IMPLIED valuetype (DATA|REF|OBJECT) DATA type " + CONTENTTYPE + " #IMPLIED ");
+ put("APPLET", COREATTRS + " codebase " + URI + " #IMPLIED archive CDATA #IMPLIED code CDATA #IMPLIED object CDATA #IMPLIED alt " + TEXT + " #IMPLIED name CDATA #IMPLIED width " + LENGTH + " #REQUIRED height " + LENGTH + " #REQUIRED align " + IALIGN + " #IMPLIED hspace " + PIXELS + " #IMPLIED vspace " + PIXELS + " #IMPLIED ");
+ put("HR", ATTRS + " align (left|center|right) #IMPLIED noshade (noshade) #IMPLIED size " + PIXELS + " #IMPLIED width " + LENGTH + " #IMPLIED ");
+ put("P", ATTRS + ALIGN);
+ put("(" + HEADING + ")", ATTRS + ALIGN);
+ put("PRE", ATTRS + " width NUMBER #IMPLIED ");
+ put("Q", ATTRS + " cite " + URI + " #IMPLIED ");
+ put("BLOCKQUOTE", ATTRS + " cite " + URI + " #IMPLIED ");
+ put("(INS|DEL)", ATTRS + " cite " + URI + " #IMPLIED datetime " + DATETIME + " #IMPLIED ");
+ put("DL", ATTRS + " compact (compact) #IMPLIED ");
+ put("(DT|DD)", ATTRS);
+ put("OL", ATTRS + " type " + OLSTYLE + " #IMPLIED compact (compact) #IMPLIED start NUMBER #IMPLIED ");
+ put("UL", ATTRS + " type " + ULSTYLE + " #IMPLIED compact (compact) #IMPLIED ");
+ put("DIR", ATTRS + " compact (compact) #IMPLIED ");
+ put("MENU", ATTRS + " compact (compact) #IMPLIED ");
+ put("LI", ATTRS + " type " + LISTYLE + " #IMPLIED value NUMBER #IMPLIED ");
+ put("FORM", ATTRS + " action " + URI + " #REQUIRED method (GET|POST) GET enctype " + CONTENTTYPE + " application/x-www-form-urlencoded accept " + CONTENTTYPE + "s; #IMPLIED name CDATA #IMPLIED onsubmit " + SCRIPT + " #IMPLIED onreset " + SCRIPT + " #IMPLIED target " + FRAMETARGET + " #IMPLIED accept-charset " + CHARSET + "s; #IMPLIED ");
+ put("LABEL", ATTRS + " for IDREF #IMPLIED accesskey " + CHARACTER + " #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED ");
+ put("INPUT", ATTRS + " type " + INPUTTYPE + " TEXT name CDATA #IMPLIED value CDATA #IMPLIED checked (checked) #IMPLIED disabled (disabled) #IMPLIED readonly (readonly) #IMPLIED size CDATA #IMPLIED maxlength NUMBER #IMPLIED src " + URI + " #IMPLIED alt CDATA #IMPLIED usemap " + URI + " #IMPLIED ismap (ismap) #IMPLIED tabindex NUMBER #IMPLIED accesskey " + CHARACTER + " #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED onselect " + SCRIPT + " #IMPLIED onchange " + SCRIPT + " #IMPLIED accept " + CONTENTTYPE + "s; #IMPLIED align " + IALIGN + " #IMPLIED " + RESERVED);
+ put("SELECT", ATTRS + " name CDATA #IMPLIED size NUMBER #IMPLIED multiple (multiple) #IMPLIED disabled (disabled) #IMPLIED tabindex NUMBER #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED onchange " + SCRIPT + " #IMPLIED " + RESERVED);
+ put("OPTGROUP", ATTRS + " disabled (disabled) #IMPLIED label " + TEXT + " #REQUIRED ");
+ put("OPTION", ATTRS + " selected (selected) #IMPLIED disabled (disabled) #IMPLIED label " + TEXT + " #IMPLIED value CDATA #IMPLIED ");
+ put("TEXTAREA", ATTRS + " name CDATA #IMPLIED rows NUMBER #REQUIRED cols NUMBER #REQUIRED disabled (disabled) #IMPLIED readonly (readonly) #IMPLIED tabindex NUMBER #IMPLIED accesskey " + CHARACTER + " #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED onselect " + SCRIPT + " #IMPLIED onchange " + SCRIPT + " #IMPLIED " + RESERVED);
+ put("FIELDSET", ATTRS);
+ put("LEGEND", ATTRS + " accesskey " + CHARACTER + " #IMPLIED align " + LALIGN + " #IMPLIED ");
+ put("BUTTON", ATTRS + " name CDATA #IMPLIED value CDATA #IMPLIED type (button|submit|reset) submit disabled (disabled) #IMPLIED tabindex NUMBER #IMPLIED accesskey " + CHARACTER + " #IMPLIED onfocus " + SCRIPT + " #IMPLIED onblur " + SCRIPT + " #IMPLIED " + RESERVED);
+ put("TABLE", ATTRS + " summary " + TEXT + " #IMPLIED width " + LENGTH + " #IMPLIED border " + PIXELS + " #IMPLIED frame " + TFRAME + " #IMPLIED rules " + TRULES + " #IMPLIED cellspacing " + LENGTH + " #IMPLIED cellpadding " + LENGTH + " #IMPLIED align " + TALIGN + " #IMPLIED bgcolor " + COLOR + " #IMPLIED " + RESERVED + " datapagesize CDATA #IMPLIED ");
+ put("CAPTION", ATTRS + " align " + CALIGN + " #IMPLIED ");
+ put("COLGROUP", ATTRS + " span NUMBER 1 width " + MULTILENGTH + " #IMPLIED " + CELLHALIGN + CELLVALIGN);
+ put("COL", ATTRS + " span NUMBER 1 width " + MULTILENGTH + " #IMPLIED " + CELLHALIGN + CELLVALIGN);
+ put("(THEAD|TBODY|TFOOT)", ATTRS + CELLHALIGN + CELLVALIGN);
+ put("TR", ATTRS + CELLHALIGN + CELLVALIGN + " bgcolor " + COLOR + " #IMPLIED ");
+ put("(TH|TD)", ATTRS + " abbr " + TEXT + " #IMPLIED axis CDATA #IMPLIED headers IDREFS #IMPLIED scope " + SCOPE + " #IMPLIED rowspan NUMBER 1 colspan NUMBER 1 " + CELLHALIGN + CELLVALIGN + " nowrap (nowrap) #IMPLIED bgcolor " + COLOR + " #IMPLIED width " + LENGTH + " #IMPLIED height " + LENGTH + " #IMPLIED ");
+ put("FRAMESET", COREATTRS + " rows " + MULTILENGTH + "s; #IMPLIED cols " + MULTILENGTH + "s; #IMPLIED onload " + SCRIPT + " #IMPLIED onunload " + SCRIPT + " #IMPLIED ");
+ put("FRAME", COREATTRS + " longdesc " + URI + " #IMPLIED name CDATA #IMPLIED src " + URI + " #IMPLIED frameborder (1|0) 1 marginwidth " + PIXELS + " #IMPLIED marginheight " + PIXELS + " #IMPLIED noresize (noresize) #IMPLIED scrolling (yes|no|auto) auto ");
+ put("IFRAME", COREATTRS + " longdesc " + URI + " #IMPLIED name CDATA #IMPLIED src " + URI + " #IMPLIED frameborder (1|0) 1 marginwidth " + PIXELS + " #IMPLIED marginheight " + PIXELS + " #IMPLIED scrolling (yes|no|auto) auto align " + IALIGN + " #IMPLIED height " + LENGTH + " #IMPLIED width " + LENGTH + " #IMPLIED ");
+ put("NOFRAMES", ATTRS);
+ put("HEAD", I18N + " profile " + URI + " #IMPLIED ");
+ put("TITLE", I18N);
+ put("ISINDEX", COREATTRS + I18N + " prompt " + TEXT + " #IMPLIED ");
+ put("BASE", "href " + URI + " #IMPLIED target " + FRAMETARGET + " #IMPLIED ");
+ put("META", I18N + " http-equiv NAME #IMPLIED name NAME #IMPLIED content CDATA #REQUIRED scheme CDATA #IMPLIED ");
+ put("STYLE", I18N + " type " + CONTENTTYPE + " #REQUIRED media " + MEDIADESC + " #IMPLIED title " + TEXT + " #IMPLIED ");
+ put("SCRIPT", "charset " + CHARSET + " #IMPLIED type " + CONTENTTYPE + " #REQUIRED language CDATA #IMPLIED src " + URI + " #IMPLIED defer (defer) #IMPLIED event CDATA #IMPLIED for " + URI + " #IMPLIED ");
+ put("NOSCRIPT", ATTRS);
+ put("HTML", I18N + VERSION);
+ }
+
+ static void handleAllElements() {
+ handleElement("(" + FONTSTYLE + "|" + PHRASE + ")", "- - (" + INLINE + ")*");
+ handleElement("(SUB|SUP)", "- - (" + INLINE + ")* ");
+ handleElement("SPAN", "- - (" + INLINE + ")* ");
+ handleElement("BDO", "- - (" + INLINE + ")* ");
+ handleElement("BASEFONT", "- O EMPTY ");
+ handleElement("FONT", "- - (" + INLINE + ")* ");
+ handleElement("BR", "- O EMPTY ");
+ handleElement("BODY", "O O (" + FLOW + ")* +(INS|DEL) ");
+ handleElement("ADDRESS", "- - ((" + INLINE + ")|P)* ");
+ handleElement("DIV", "- - (" + FLOW + ")* ");
+ handleElement("CENTER", "- - (" + FLOW + ")* ");
+ handleElement("A", "- - (" + INLINE + ")* -(A) ");
+ handleElement("MAP", "- - ((" + BLOCK + ") | AREA)+ ");
+ handleElement("AREA", "- O EMPTY ");
+ handleElement("LINK", "- O EMPTY ");
+ handleElement("IMG", "- O EMPTY ");
+ handleElement("OBJECT", "- - (PARAM | " + FLOW + ")* ");
+ handleElement("PARAM", "- O EMPTY ");
+ handleElement("APPLET", "- - (PARAM | " + FLOW + ")* ");
+ handleElement("HR", "- O EMPTY ");
+ handleElement("P", "- O (" + INLINE + ")* ");
+ handleElement("(" + HEADING + ")", "- - (" + INLINE + ")* ");
+ handleElement("PRE", "- - (" + INLINE + ")* -(" + PRE_EXCLUSION + ") ");
+ handleElement("Q", "- - (" + INLINE + ")* ");
+ handleElement("BLOCKQUOTE", "- - (" + FLOW + ")* ");
+ handleElement("(INS|DEL)", "- - (" + FLOW + ")* ");
+ handleElement("DL", "- - (DT|DD)+ ");
+ handleElement("DT", "- O (" + INLINE + ")* ");
+ handleElement("DD", "- O (" + FLOW + ")* ");
+ handleElement("OL", "- - (LI)+ ");
+ handleElement("UL", "- - (LI)+ ");
+ handleElement("(DIR|MENU)", "- - (LI)+ -(" + BLOCK + ") ");
+ handleElement("LI", "- O (" + FLOW + ")* ");
+ handleElement("FORM", "- - (" + FLOW + ")* -(FORM) ");
+ handleElement("LABEL", "- - (" + INLINE + ")* -(LABEL) ");
+ handleElement("INPUT", "- O EMPTY ");
+ handleElement("SELECT", "- - (OPTGROUP|OPTION)+ ");
+ handleElement("OPTGROUP", "- - (OPTION)+ ");
+ handleElement("OPTION", "- O (#PCDATA) ");
+ handleElement("TEXTAREA", "- - (#PCDATA) ");
+ handleElement("FIELDSET", "- - (#PCDATA,LEGEND,(" + FLOW + ")*) ");
+ handleElement("LEGEND", "- - (" + INLINE + ")* ");
+ handleElement("BUTTON", "- - (" + FLOW + ")* -(A|" + FORMCTRL + "|FORM|ISINDEX|FIELDSET|IFRAME) ");
+ handleElement("TABLE", "- - (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)");
+ handleElement("CAPTION", "- - (" + INLINE + ")* ");
+ handleElement("THEAD", "- O (TR)+ ");
+ handleElement("TFOOT", "- O (TR)+ ");
+ handleElement("TBODY", "O O (TR)+ ");
+ handleElement("COLGROUP", "- O (COL)* ");
+ handleElement("COL", "- O EMPTY ");
+ handleElement("TR", "- O (TH|TD)+ ");
+ handleElement("(TH|TD)", "- O (" + FLOW + ")* ");
+ handleElement("FRAME", "- O EMPTY ");
+ handleElement("IFRAME", "- - (" + FLOW + ")* ");
+ handleElement("NOFRAMES", "- - " + NOFRAMES_CONTENT + " ");
+ handleElement("HEAD", "O O (" + HEAD_CONTENT + ") +(" + HEAD_MISC + ") ");
+ handleElement("TITLE", "- - (#PCDATA) -(" + HEAD_MISC + ") ");
+ handleElement("ISINDEX", "- O EMPTY ");
+ handleElement("BASE", "- O EMPTY ");
+ handleElement("META", "- O EMPTY ");
+ handleElement("STYLE", "- - " + STYLESHEET + " ");
+ handleElement("SCRIPT", "- - " + SCRIPT + " ");
+ handleElement("NOSCRIPT", "- - (" + FLOW + ")* ");
+ handleElement("HTML", "O O (" + HTML_CONTENT + ") ");
+ handleElement("FRAMESET", "- - ((FRAMESET|FRAME)+ & NOFRAMES?)");
+ }
+}
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+
+/**
+ * Class is generated basing on <a href="http://www.w3.org/TR/html401/sgml/entities.html">Character Entities</a>
+ */
+class EntitiesHandler {
+ static void handleEntities() {
+ //don't edit!
+ handleEntity("squot", 39);
+ //lat1
+ handleEntity("nbsp", 160);
+ handleEntity("iexcl", 161);
+ handleEntity("cent", 162);
+ handleEntity("pound", 163);
+ handleEntity("curren", 164);
+ handleEntity("yen", 165);
+ handleEntity("brvbar", 166);
+ handleEntity("sect", 167);
+ handleEntity("uml", 168);
+ handleEntity("copy", 169);
+ handleEntity("ordf", 170);
+ handleEntity("laquo", 171);
+ handleEntity("not", 172);
+ handleEntity("shy", 173);
+ handleEntity("reg", 174);
+ handleEntity("macr", 175);
+ handleEntity("deg", 176);
+ handleEntity("plusmn", 177);
+ handleEntity("sup2", 178);
+ handleEntity("sup3", 179);
+ handleEntity("acute", 180);
+ handleEntity("micro", 181);
+ handleEntity("para", 182);
+ handleEntity("middot", 183);
+ handleEntity("cedil", 184);
+ handleEntity("sup1", 185);
+ handleEntity("ordm", 186);
+ handleEntity("raquo", 187);
+ handleEntity("frac14", 188);
+ handleEntity("frac12", 189);
+ handleEntity("frac34", 190);
+ handleEntity("iquest", 191);
+ handleEntity("Agrave", 192);
+ handleEntity("Aacute", 193);
+ handleEntity("Acirc", 194);
+ handleEntity("Atilde", 195);
+ handleEntity("Auml", 196);
+ handleEntity("Aring", 197);
+ handleEntity("AElig", 198);
+ handleEntity("Ccedil", 199);
+ handleEntity("Egrave", 200);
+ handleEntity("Eacute", 201);
+ handleEntity("Ecirc", 202);
+ handleEntity("Euml", 203);
+ handleEntity("Igrave", 204);
+ handleEntity("Iacute", 205);
+ handleEntity("Icirc", 206);
+ handleEntity("Iuml", 207);
+ handleEntity("ETH", 208);
+ handleEntity("Ntilde", 209);
+ handleEntity("Ograve", 210);
+ handleEntity("Oacute", 211);
+ handleEntity("Ocirc", 212);
+ handleEntity("Otilde", 213);
+ handleEntity("Ouml", 214);
+ handleEntity("times", 215);
+ handleEntity("Oslash", 216);
+ handleEntity("Ugrave", 217);
+ handleEntity("Uacute", 218);
+ handleEntity("Ucirc", 219);
+ handleEntity("Uuml", 220);
+ handleEntity("Yacute", 221);
+ handleEntity("THORN", 222);
+ handleEntity("szlig", 223);
+ handleEntity("agrave", 224);
+ handleEntity("aacute", 225);
+ handleEntity("acirc", 226);
+ handleEntity("atilde", 227);
+ handleEntity("auml", 228);
+ handleEntity("aring", 229);
+ handleEntity("aelig", 230);
+ handleEntity("ccedil", 231);
+ handleEntity("egrave", 232);
+ handleEntity("eacute", 233);
+ handleEntity("ecirc", 234);
+ handleEntity("euml", 235);
+ handleEntity("igrave", 236);
+ handleEntity("iacute", 237);
+ handleEntity("icirc", 238);
+ handleEntity("iuml", 239);
+ handleEntity("eth", 240);
+ handleEntity("ntilde", 241);
+ handleEntity("ograve", 242);
+ handleEntity("oacute", 243);
+ handleEntity("ocirc", 244);
+ handleEntity("otilde", 245);
+ handleEntity("ouml", 246);
+ handleEntity("divide", 247);
+ handleEntity("oslash", 248);
+ handleEntity("ugrave", 249);
+ handleEntity("uacute", 250);
+ handleEntity("ucirc", 251);
+ handleEntity("uuml", 252);
+ handleEntity("yacute", 253);
+ handleEntity("thorn", 254);
+ handleEntity("yuml", 255);
+ //special
+ handleEntity("quot", 34);
+ handleEntity("amp", 38);
+ handleEntity("lt", 60);
+ handleEntity("gt", 62);
+ handleEntity("OElig", 338);
+ handleEntity("oelig", 339);
+ handleEntity("Scaron", 352);
+ handleEntity("scaron", 353);
+ handleEntity("Yuml", 376);
+ handleEntity("circ", 710);
+ handleEntity("tilde", 732);
+ handleEntity("ensp", 8194);
+ handleEntity("emsp", 8195);
+ handleEntity("thinsp", 8201);
+ handleEntity("zwnj", 8204);
+ handleEntity("zwj", 8205);
+ handleEntity("lrm", 8206);
+ handleEntity("rlm", 8207);
+ handleEntity("ndash", 8211);
+ handleEntity("mdash", 8212);
+ handleEntity("lsquo", 8216);
+ handleEntity("rsquo", 8217);
+ handleEntity("sbquo", 8218);
+ handleEntity("ldquo", 8220);
+ handleEntity("rdquo", 8221);
+ handleEntity("bdquo", 8222);
+ handleEntity("dagger", 8224);
+ handleEntity("Dagger", 8225);
+ handleEntity("permil", 8240);
+ handleEntity("lsaquo", 8249);
+ handleEntity("rsaquo", 8250);
+ handleEntity("euro", 8364);
+ //symbol
+ handleEntity("fnof", 402);
+ handleEntity("Alpha", 913);
+ handleEntity("Beta", 914);
+ handleEntity("Gamma", 915);
+ handleEntity("Delta", 916);
+ handleEntity("Epsilon", 917);
+ handleEntity("Zeta", 918);
+ handleEntity("Eta", 919);
+ handleEntity("Theta", 920);
+ handleEntity("Iota", 921);
+ handleEntity("Kappa", 922);
+ handleEntity("Lambda", 923);
+ handleEntity("Mu", 924);
+ handleEntity("Nu", 925);
+ handleEntity("Xi", 926);
+ handleEntity("Omicron", 927);
+ handleEntity("Pi", 928);
+ handleEntity("Rho", 929);
+ handleEntity("Sigma", 931);
+ handleEntity("Tau", 932);
+ handleEntity("Upsilon", 933);
+ handleEntity("Phi", 934);
+ handleEntity("Chi", 935);
+ handleEntity("Psi", 936);
+ handleEntity("Omega", 937);
+ handleEntity("alpha", 945);
+ handleEntity("beta", 946);
+ handleEntity("gamma", 947);
+ handleEntity("delta", 948);
+ handleEntity("epsilon", 949);
+ handleEntity("zeta", 950);
+ handleEntity("eta", 951);
+ handleEntity("theta", 952);
+ handleEntity("iota", 953);
+ handleEntity("kappa", 954);
+ handleEntity("lambda", 955);
+ handleEntity("mu", 956);
+ handleEntity("nu", 957);
+ handleEntity("xi", 958);
+ handleEntity("omicron", 959);
+ handleEntity("pi", 960);
+ handleEntity("rho", 961);
+ handleEntity("sigmaf", 962);
+ handleEntity("sigma", 963);
+ handleEntity("tau", 964);
+ handleEntity("upsilon", 965);
+ handleEntity("phi", 966);
+ handleEntity("chi", 967);
+ handleEntity("psi", 968);
+ handleEntity("omega", 969);
+ handleEntity("thetasym", 977);
+ handleEntity("upsih", 978);
+ handleEntity("piv", 982);
+ handleEntity("bull", 8226);
+ handleEntity("hellip", 8230);
+ handleEntity("prime", 8242);
+ handleEntity("Prime", 8243);
+ handleEntity("oline", 8254);
+ handleEntity("frasl", 8260);
+ handleEntity("weierp", 8472);
+ handleEntity("image", 8465);
+ handleEntity("real", 8476);
+ handleEntity("trade", 8482);
+ handleEntity("alefsym", 8501);
+ handleEntity("larr", 8592);
+ handleEntity("uarr", 8593);
+ handleEntity("rarr", 8594);
+ handleEntity("darr", 8595);
+ handleEntity("harr", 8596);
+ handleEntity("crarr", 8629);
+ handleEntity("lArr", 8656);
+ handleEntity("uArr", 8657);
+ handleEntity("rArr", 8658);
+ handleEntity("dArr", 8659);
+ handleEntity("hArr", 8660);
+ handleEntity("forall", 8704);
+ handleEntity("part", 8706);
+ handleEntity("exist", 8707);
+ handleEntity("empty", 8709);
+ handleEntity("nabla", 8711);
+ handleEntity("isin", 8712);
+ handleEntity("notin", 8713);
+ handleEntity("ni", 8715);
+ handleEntity("prod", 8719);
+ handleEntity("sum", 8721);
+ handleEntity("minus", 8722);
+ handleEntity("lowast", 8727);
+ handleEntity("radic", 8730);
+ handleEntity("prop", 8733);
+ handleEntity("infin", 8734);
+ handleEntity("ang", 8736);
+ handleEntity("and", 8743);
+ handleEntity("or", 8744);
+ handleEntity("cap", 8745);
+ handleEntity("cup", 8746);
+ handleEntity("int", 8747);
+ handleEntity("there4", 8756);
+ handleEntity("sim", 8764);
+ handleEntity("cong", 8773);
+ handleEntity("asymp", 8776);
+ handleEntity("ne", 8800);
+ handleEntity("equiv", 8801);
+ handleEntity("le", 8804);
+ handleEntity("ge", 8805);
+ handleEntity("sub", 8834);
+ handleEntity("sup", 8835);
+ handleEntity("nsub", 8836);
+ handleEntity("sube", 8838);
+ handleEntity("supe", 8839);
+ handleEntity("oplus", 8853);
+ handleEntity("otimes", 8855);
+ handleEntity("perp", 8869);
+ handleEntity("sdot", 8901);
+ handleEntity("lceil", 8968);
+ handleEntity("rceil", 8969);
+ handleEntity("lfloor", 8970);
+ handleEntity("rfloor", 8971);
+ handleEntity("lang", 9001);
+ handleEntity("rang", 9002);
+ handleEntity("loz", 9674);
+ handleEntity("spades", 9824);
+ handleEntity("clubs", 9827);
+ handleEntity("hearts", 9829);
+ handleEntity("diams", 9830);
+ }
+
+ static DTD dtd;
+ static void initEntitiesCreation(final DTD dtd) {
+ EntitiesHandler.dtd = dtd;
+ handleEntities();
+ }
+ static void handleEntity(final String name, final int data) {
+ DTDUtilities.handleEntity(dtd, name, data);
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+
+
+public final class Entity implements DTDConstants {
+ public String name;
+
+ public int type;
+
+ public char[] data;
+
+ boolean isGeneral;
+
+ boolean isParameter;
+
+
+ public Entity(final String name,
+ final int type,
+ final char[] data) {
+ this.name = name;
+ this.type = type;
+ this.data = data;
+ }
+
+ Entity(final String name,
+ final int type,
+ final String data,
+ final boolean isGeneral,
+ final boolean isParameter) {
+ this.name = name;
+ this.type = type;
+ this.data = data.toCharArray();
+ this.isGeneral = isGeneral;
+ this.isParameter = isParameter;
+ }
+
+ Entity(final String name,
+ final char ch) {
+ this.name = name;
+ this.type = DTDConstants.CDATA;
+ this.data = new char[] {ch};
+ this.isGeneral = true;
+ }
+
+
+ public String getString() {
+ return String.valueOf(data);
+ }
+
+ public char[] getData() {
+ return data;
+ }
+
+ public boolean isGeneral() {
+ // TODO: implement
+ return isGeneral;
+ }
+
+ public boolean isParameter() {
+ // TODO: implement
+ return isParameter;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public static int name2type(final String name) {
+ if (name.equals("PUBLIC")) {
+ return DTDConstants.PUBLIC;
+ } else if (name.equals("SDATA")) {
+ return DTDConstants.SDATA;
+ } else if (name.equals("PI")) {
+ return DTDConstants.PI;
+ } else if (name.equals("STARTTAG")) {
+ return DTDConstants.STARTTAG;
+ } else if (name.equals("ENDTAG")) {
+ return DTDConstants.ENDTAG;
+ } else if (name.equals("MS")) {
+ return DTDConstants.MS;
+ } else if (name.equals("MD")) {
+ return DTDConstants.MD;
+ } else if (name.equals("SYSTEM")) {
+ return DTDConstants.SYSTEM;
+ } else {
+ return DTDConstants.CDATA;
+ }
+ }
+
+}
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+
+interface HTMLConstants {
+ String PCDATA_ELEMENT_NAME = "#PCDATA";
+ String HTML_ELEMENT_NAME = "HTML";
+ String META_ELEMENT_NAME = "META";
+ String BASE_ELEMENT_NAME = "BASE";
+ String ISINDEX_ELEMENT_NAME = "ISINDEX";
+ String HEAD_ELEMENT_NAME = "HEAD";
+ String BODY_ELEMENT_NAME = "BODY";
+ String APPLET_ELEMENT_NAME = "APPLET";
+ String PARAM_ELEMENT_NAME = "PARAM";
+ String P_ELEMENT_NAME = "P";
+ String TITLE_ELEMENT_NAME = "TITLE";
+ String STYLE_ELEMENT_NAME = "STYLE";
+ String LINK_ELEMENT_NAME = "LINK";
+ String UNKNOWN_ELEMENT_NAME = "UNKNOWN";
+
+ String SPACE_ENTITY_NAME = "#SPACE";
+ String RS_ENTITY_NAME = "#RS";
+ String RE_ENTITY_NAME = "#RE";
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+
+import java.io.IOException;
+import java.io.Reader;
+import javax.swing.text.ChangedCharSetException;
+import javax.swing.text.SimpleAttributeSet;
+
+public class Parser implements DTDConstants {
+
+
+ protected DTD dtd;
+
+ protected boolean strict;
+
+
+ public Parser(final DTD a0) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+
+ protected int getCurrentPos() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+
+ public synchronized void parse(final Reader a0) throws IOException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected boolean parseMarkupDeclarations(final StringBuffer a0) throws IOException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ public String parseDTDMarkup() throws IOException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void markFirstTime(final Element a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void endTag(final boolean a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void startTag(final TagElement a0) throws ChangedCharSetException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void error(final String a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void error(final String a0, final String a1) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void error(final String a0, final String a1, final String a2) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void error(final String a0, final String a1, final String a2, final String a3) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleError(final int a0, final String a1) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleEndTag(final TagElement a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleStartTag(final TagElement a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleEmptyTag(final TagElement a0) throws ChangedCharSetException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleEOFInComment() {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleComment(final char[] a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleTitle(final char[] a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void handleText(final char[] a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected void flushAttributes() {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ protected SimpleAttributeSet getAttributes() {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected TagElement makeTag(final Element a0) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected TagElement makeTag(final Element a0, final boolean a1) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected int getCurrentLine() {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+}
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserDelegator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserDelegator.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserDelegator.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserDelegator.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+
+import javax.swing.text.html.HTMLEditorKit;
+
+public class ParserDelegator extends HTMLEditorKit.Parser implements Serializable {
+
+
+
+ public ParserDelegator() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+
+ public void parse(final Reader a0, final HTMLEditorKit.ParserCallback a1, final boolean a2) throws IOException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected static DTD createDTD(final DTD a0, final String a1) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+
+ protected static synchronized void setDefaultDTD() {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+}
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/TagElement.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/TagElement.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/TagElement.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/TagElement.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Evgeniya G. Maenkova
+ * @version $Revision$
+ */
+package javax.swing.text.html.parser;
+
+import javax.swing.text.html.HTML;
+
+public class TagElement {
+ private HTML.Tag tag;
+ private Element element;
+ private boolean isFictional;
+
+ public TagElement(final Element element,
+ final boolean fictional) {
+ this.element = element;
+ isFictional = fictional;
+ tag = HTML.getTag(element.name.toLowerCase());
+ if (tag == null) {
+ tag = new HTML.UnknownTag(element.name.toLowerCase());
+ }
+ }
+
+
+ public TagElement(final Element element) {
+ this(element, false);
+ }
+
+
+ public boolean fictional() {
+ return isFictional;
+ }
+
+
+ public HTML.Tag getHTMLTag() {
+ return tag;
+ }
+
+
+ public Element getElement() {
+ return element;
+ }
+
+
+ public boolean isPreformatted() {
+ return tag.isPreformatted();
+ }
+
+
+ public boolean breaksFlow() {
+ return tag.breaksFlow();
+ }
+}
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/transitional401.bdtd
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/transitional401.bdtd?rev=427121&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/transitional401.bdtd
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/StringConstants.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/StringConstants.java?rev=427121&r1=427120&r2=427121&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/StringConstants.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/StringConstants.java Mon Jul 31 07:08:47 2006
@@ -88,6 +88,7 @@
String TEXT_COMPONENT_MARGIN_PROPERTY = "margin";
String TEXT_COMPONENR_KEYMAP_PROPERTY = "keymap";
String TEXT_COMPONENT_NAV_FILTER_NAME = "navigationFilter";
+ String IGNORE_CHARSET_DIRECTIVE = "IgnoreCharsetDirective";
String EDITOR_PANE_EDITOR_KIT_PROPERTY = "editorKit";
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/HTMLIconFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/HTMLIconFactory.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/HTMLIconFactory.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/HTMLIconFactory.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Roman I. Chernyatchik
+ * @version $Revision$
+ */
+package org.apache.harmony.x.swing.text.html;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+public class HTMLIconFactory implements Serializable {
+ private static HTMLIconFactory instance;
+
+ private static Icon loadingFailedIcon;
+ private static Icon loadingImageIcon;
+ private static Icon noImageIcon;
+
+ public static Icon getLoadingFailedIcon() {
+
+ if (loadingFailedIcon == null) {
+ loadingFailedIcon = loadIcon("icons/loadingFailedIcon.gif");
+ }
+ return loadingFailedIcon;
+ }
+
+ public static Icon getLoadingImageIcon() {
+ if (loadingImageIcon == null) {
+ loadingImageIcon = loadIcon("icons/loadingImageIcon.gif");
+ }
+ return loadingImageIcon;
+ }
+
+ public static Icon getNoImageIcon() {
+ if (noImageIcon == null) {
+ noImageIcon = loadIcon("icons/noImageIcon.gif");
+ }
+ return noImageIcon;
+ }
+
+ protected HTMLIconFactory() {
+ }
+
+ private static URL getResource(final String resource) {
+ if (instance == null) {
+ instance = new HTMLIconFactory();
+ }
+ return instance.getClass().getResource(resource);
+ }
+
+ private static Icon loadIcon(final String resource) {
+ return new ImageIcon(getResource(resource));
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSGrammar.jj
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSGrammar.jj?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSGrammar.jj (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSGrammar.jj Mon Jul 31 07:08:47 2006
@@ -0,0 +1,473 @@
+/*
+ Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+/*
+Author: Anton Avtamonov, Alexey A. Ivanov
+Version: $Revision$
+*/
+
+options {
+ UNICODE_INPUT = true;
+ STATIC = false;
+}
+
+
+PARSER_BEGIN(CSSParser)
+package org.apache.harmony.x.swing.text.html.cssparser;
+
+import org.apache.harmony.x.swing.text.html.cssparser.metamodel.*;
+
+public class CSSParser {
+ private final CSSLogger logger = new CSSLogger();
+
+ public Sheet parse() throws ParseException {
+ return cssGrammar();
+ }
+
+ public RuleSet parseRuleSet() throws ParseException {
+ return ruleSet_recoverable();
+ }
+
+
+ private boolean skipTillDeclarationEnd() {
+ logger.logError(getToken(1));
+ return skipTillTokens(new int[] {CLOSE_BRACE, SEMICOLON}, false);
+ }
+
+ private boolean skipTillImportEnd() {
+ logger.logError(getToken(1));
+ return skipTillTokens(new int[] {SEMICOLON}, true);
+ }
+
+ private boolean skipTillRuleSetEnd() {
+ logger.logError(getToken(1));
+ return skipTillTokens(new int[] {CLOSE_BRACE}, true);
+ }
+
+
+ private boolean skipTillTokens(final int[] stopTokens, final boolean removeStopToken) {
+ Token currentToken = getToken(1);
+ while (currentToken != null && currentToken.kind != EOF) {
+ for (int i = 0; i < stopTokens.length; i++) {
+ if (currentToken.kind == stopTokens[i]) {
+ if (removeStopToken) {
+ getNextToken();
+ }
+ return true;
+ }
+ }
+ getNextToken();
+ currentToken = getToken(1);
+ }
+ return false;
+ }
+/*
+ private static String getTokenInfo(final Token t) {
+ return t.image + " at " + t.beginLine + "x" + t.beginColumn;
+ }
+ */
+}
+
+PARSER_END(CSSParser)
+
+SKIP :
+{
+ " "
+ |
+ "\t"
+ |
+ "\n"
+ |
+ "\r"
+ |
+ "\f"
+ |
+ <HTML_COMMENT: "<!--" | "-->">
+}
+
+
+SKIP :
+{
+ "/*" : CSS_COMMENT
+}
+
+<CSS_COMMENT> SKIP :
+{
+ <~[]>
+}
+
+<CSS_COMMENT> SKIP :
+{
+ "*/" : DEFAULT
+}
+
+
+
+
+TOKEN :
+{
+ <SEMICOLON: ";">
+ |
+ <COLON: ":">
+ |
+ <COMMA: ",">
+ |
+ <DOT: ".">
+ |
+ <HASH_CHAR: "#">
+ |
+ <OPEN_PARENSIS: "(">
+ |
+ <CLOSE_PARENSIS: ")">
+ |
+ <OPEN_BRACE: "{">
+ |
+ <CLOSE_BRACE: "}">
+ |
+ <SLASH: "/">
+ |
+ <PLUS: "+">
+ |
+ <MINUS: "-">
+}
+
+TOKEN :
+{
+ <IMPORT: "@import">
+ |
+ <MEDIA: "@media">
+}
+
+
+TOKEN :
+{
+ <EMS: <NUMBER> "em">
+ |
+ <EXS: <NUMBER> "ex">
+ |
+ <LENGTH: <NUMBER> ("pt" | "mm" | "cm" | "pc" | "in" | "px")>
+ |
+ <PERCENTAGE: <NUMBER> "%">
+ |
+ <NUMBER: (<DIGIT>)+ | ((<DIGIT>)* <DOT> (<DIGIT>)+)>
+ |
+ <RGB: "rgb" <OPEN_PARENSIS> <COLOR_COMPONENT> <COMMA> <COLOR_COMPONENT> <COMMA> <COLOR_COMPONENT> <CLOSE_PARENSIS>>
+ |
+ <URL: "url" <OPEN_PARENSIS> ([" ", "\n", "\r", "\t"])* (<STRING> | (~[" ", "\n", "\r", "'", "\"", ")"] | ("\\" [" ", "'", "\"", ")"]))+) ([" ", "\n", "\r", "\t"])* <CLOSE_PARENSIS>>
+ |
+ <HEX_COLOR: <HASH_CHAR> <UNICODE_CHAR> <UNICODE_CHAR> <UNICODE_CHAR> (<UNICODE_CHAR> <UNICODE_CHAR> <UNICODE_CHAR>)?>
+ |
+ <IDENT: <NMSTRT> (<NMCHAR>)*>
+ |
+ <ELEMENT_NAME: <IDENT> (<HASH> ((<CLASS>)? (<SOLITARY_PSEUDO_CLASS>)?) | (<CLASS> (<SOLITARY_PSEUDO_CLASS>)?)) | <SOLITARY_PSEUDO_CLASS>>
+ |
+ <SOLITARY_ID: <HASH> (<CLASS>)? (<SOLITARY_PSEUDO_CLASS>)?>
+ |
+ <SOLITARY_CLASS: <CLASS> (<SOLITARY_PSEUDO_CLASS>)?>
+ |
+ <SOLITARY_PSEUDO_CLASS: <COLON> ("link" | "visited" | "active")>
+ |
+ <PSEUDO_ELEMENT: (<IDENT> <COLON>) ("first-letter" | "first-line")>
+ |
+ <SOLITARY_PSEUDO_ELEMENT: <COLON> ("first-letter" | "first-line")>
+ |
+ <HASH: <HASH_CHAR> (<NAME> | <IDENT>)>
+ |
+ <CLASS: <DOT> (<NAME> | <IDENT>)>
+ |
+ <STRING: ("\"" (<STRING_CHAR> | "'")+ "\"") | ("'" (<STRING_CHAR> | "\"")+ "'")>
+ |
+ <IMPORTANT_SYM: "!" ([" ", "\n", "\r", "\t"])* "important">
+ |
+ <#UNICODE_CHAR: <DIGIT> | ["a"-"f","A"-"F"]>
+ |
+ <#DIGIT: ["0"-"9"]>
+ |
+ <#COLOR_COMPONENT: ([" ", "\n", "\r", "\t"])* <NUMBER> ("%")? ([" ", "\n", "\r", "\t"])*>
+ |
+ <#LATIN1: ["\u007f"-"\uffff"]>
+ |
+ <#ESCAPE: <UNICODE> | ("\\" ([" "-"~"] | <LATIN1>))>
+ |
+ <#STRING_CHAR: <ESCAPE> | <LATIN1> | [" ", "!", "#", "$", "%", "&", "("-"~"]>
+ |
+ <#NMSTRT: ["a"-"z", "A"-"Z"] | <LATIN1> | <ESCAPE>>
+ |
+ <#NAME: (<NMCHAR>)+>
+ |
+ <#NMCHAR: ["-", "a"-"z", "A"-"Z"] | <DIGIT> | <LATIN1> | <ESCAPE>>
+ |
+ <#UNICODE: "\\" <UNICODE_CHAR> (<UNICODE_CHAR>)? (<UNICODE_CHAR>)? (<UNICODE_CHAR>)?>
+}
+
+
+TOKEN :
+{
+ <ANY: ~[]>
+}
+
+
+
+Sheet cssGrammar() :
+{Sheet result;}
+{
+ result = styleSheet() <EOF>
+
+ {
+ return result;
+ }
+}
+
+Sheet styleSheet() :
+{ Sheet result = new Sheet(); String importURL; }
+{
+ (importURL = import_recoverable() {result.addImport(importURL);})* styleSheetBody(result)
+
+ {
+ return result;
+ }
+}
+
+String importStatement() :
+{ Token importValue; }
+{
+ <IMPORT> (importValue = <STRING> | importValue = <URL>) <SEMICOLON>
+
+ {
+ return TokenResolver.resolve(importValue);
+ }
+}
+
+String import_recoverable() :
+{ String result = null; }
+{
+ try {
+ result = importStatement()
+ } catch (ParseException e) {
+ skipTillImportEnd();
+ }
+
+ {
+ return result;
+ }
+}
+
+void styleSheetBody(final Sheet sheet) :
+{ RuleSet ruleSet; }
+{
+ (LOOKAHEAD({getToken(1).kind != EOF}) (ruleSet = ruleSet_recoverable() {sheet.addRuleSet(ruleSet);} | skipTillExpressionEnd()))*
+}
+
+
+void mediaSet() :
+{}
+{
+ <MEDIA> <IDENT> <OPEN_BRACE> (ruleSet_recoverable())* <CLOSE_BRACE>
+}
+
+
+RuleSet ruleSet() :
+{ RuleSet result = new RuleSet(); String selector; Property p; }
+{
+ selector = selector() { result.addSelector(selector); } (<COMMA> selector = selector() { result.addSelector(selector); })*
+ <OPEN_BRACE>
+ p = declaration_recoverable() {result.addProperty(p);} (<SEMICOLON> p = declaration_recoverable() {result.addProperty(p);})*
+ <CLOSE_BRACE>
+
+ {
+ return result;
+ }
+}
+
+RuleSet ruleSet_recoverable() :
+{ RuleSet result = null; }
+{
+ try {
+ result = ruleSet()
+ } catch (ParseException pe) {
+ skipTillRuleSetEnd();
+ }
+
+ {
+ return result;
+ }
+}
+
+String selector() :
+{ Token startToken = getToken(1); }
+{
+ (
+ (simple_selector())+ [pseudo_element() | solitary_pseudo_element()]
+ |
+ solitary_pseudo_element()
+ )
+
+ {
+ return TokenResolver.resolve(startToken, getToken(0), true);
+ }
+}
+
+void simple_selector() :
+{}
+{
+ (
+ element_name()
+ |
+ solitary_id()
+ |
+ solitary_class()
+ |
+ solitary_pseudo_class()
+ )
+}
+
+
+void element_name() :
+{}
+{
+ (
+ <ELEMENT_NAME>
+ |
+ <IDENT>
+ )
+}
+
+void solitary_pseudo_class() :
+{}
+{
+ <SOLITARY_PSEUDO_CLASS>
+}
+
+void solitary_class() :
+{}
+{
+ <SOLITARY_CLASS>
+}
+
+void pseudo_element() :
+{}
+{
+ <PSEUDO_ELEMENT>
+}
+
+void solitary_pseudo_element() :
+{}
+{
+ <SOLITARY_PSEUDO_ELEMENT>
+}
+
+void solitary_id() :
+{}
+{
+ (
+ <SOLITARY_ID>
+ |
+ <HASH>
+ |
+ <HEX_COLOR>
+ )
+}
+
+
+Property declaration() :
+{ String name; String value; boolean isImportant = false; }
+{
+ [name = property() <COLON> value = expr() [prio() {isImportant = true;}] { return new Property(name, value, isImportant); }]
+
+ {
+ return null;
+ }
+}
+
+Property declaration_recoverable() :
+{ Property result = null; }
+{
+ try {
+ result = declaration()
+ } catch (ParseException e) {
+ skipTillDeclarationEnd();
+ }
+
+ {
+ return result;
+ }
+}
+
+void prio() :
+{}
+{
+ <IMPORTANT_SYM>
+}
+
+String expr() :
+{ StringBuffer result = new StringBuffer(); String term; String oper; boolean operSet; }
+{
+ [term = term() {result.append(term);} ({operSet = false;} [oper = oper() {result.append(oper); operSet = true;}] term = term() {if (!operSet) {result.append(" ");} result.append(term);})*]
+
+ {
+ return result.toString();
+ }
+}
+
+String term() :
+{ Token startToken = getToken(1); }
+{
+ [unary_oper()] (<NUMBER> | <STRING> | <PERCENTAGE> | <LENGTH> | <EMS> | <EXS> | <IDENT> | <HEX_COLOR> | <URL> | <RGB>)
+
+ {
+ return TokenResolver.resolve(startToken, getToken(0), false);
+ }
+
+}
+
+String oper() :
+{ Token oper; }
+{
+ (
+ oper = <SLASH>
+ |
+ oper = <COMMA>
+ )
+
+ {
+ return TokenResolver.resolve(oper);
+ }
+}
+
+void unary_oper() :
+{}
+{
+ (
+ <MINUS>
+ |
+ <PLUS>
+ )
+}
+
+String property() :
+{ Token name; }
+{
+ name = <IDENT>
+
+ {
+ return TokenResolver.resolve(name);
+ }
+}
+
+
+JAVACODE
+void skipTillExpressionEnd() {
+ skipTillRuleSetEnd();
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSLogger.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSLogger.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSLogger.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSLogger.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Anton Avtamonov, Alexey A. Ivanov
+ * @version $Revision$
+ */
+package org.apache.harmony.x.swing.text.html.cssparser;
+
+public class CSSLogger {
+ public boolean loggingEnabled = true;
+
+ public void logError(final Token token) {
+ printMessage("CSSParser: failed to parse " + getTokenInfo(token));
+ }
+
+
+ private void printMessage(final String msg) {
+ if (loggingEnabled) {
+ System.err.println(msg);
+ }
+ }
+
+ private String getTokenInfo(final Token token) {
+ return "'" + token.image + "'"
+ + " at [" + token.beginLine + ", " + token.beginColumn + "]";
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParser.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParser.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParser.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParser.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,714 @@
+/* Generated By:JavaCC: Do not edit this line. CSSParser.java */
+package org.apache.harmony.x.swing.text.html.cssparser;
+
+import org.apache.harmony.x.swing.text.html.cssparser.metamodel.*;
+
+public class CSSParser implements CSSParserConstants {
+ private final CSSLogger logger = new CSSLogger();
+
+ public Sheet parse() throws ParseException {
+ return cssGrammar();
+ }
+
+ public RuleSet parseRuleSet() throws ParseException {
+ return ruleSet_recoverable();
+ }
+
+
+ private boolean skipTillDeclarationEnd() {
+ logger.logError(getToken(1));
+ return skipTillTokens(new int[] {CLOSE_BRACE, SEMICOLON}, false);
+ }
+
+ private boolean skipTillImportEnd() {
+ logger.logError(getToken(1));
+ return skipTillTokens(new int[] {SEMICOLON}, true);
+ }
+
+ private boolean skipTillRuleSetEnd() {
+ logger.logError(getToken(1));
+ return skipTillTokens(new int[] {CLOSE_BRACE}, true);
+ }
+
+
+ private boolean skipTillTokens(final int[] stopTokens, final boolean removeStopToken) {
+ Token currentToken = getToken(1);
+ while (currentToken != null && currentToken.kind != EOF) {
+ for (int i = 0; i < stopTokens.length; i++) {
+ if (currentToken.kind == stopTokens[i]) {
+ if (removeStopToken) {
+ getNextToken();
+ }
+ return true;
+ }
+ }
+ getNextToken();
+ currentToken = getToken(1);
+ }
+ return false;
+ }
+
+ final public Sheet cssGrammar() throws ParseException {
+ Sheet result;
+ result = styleSheet();
+ jj_consume_token(0);
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Sheet styleSheet() throws ParseException {
+ Sheet result = new Sheet(); String importURL;
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORT:
+ ;
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ break label_1;
+ }
+ importURL = import_recoverable();
+ result.addImport(importURL);
+ }
+ styleSheetBody(result);
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String importStatement() throws ParseException {
+ Token importValue;
+ jj_consume_token(IMPORT);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ importValue = jj_consume_token(STRING);
+ break;
+ case URL:
+ importValue = jj_consume_token(URL);
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(SEMICOLON);
+ {if (true) return TokenResolver.resolve(importValue);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String import_recoverable() throws ParseException {
+ String result = null;
+ try {
+ result = importStatement();
+ } catch (ParseException e) {
+ skipTillImportEnd();
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void styleSheetBody(final Sheet sheet) throws ParseException {
+ RuleSet ruleSet;
+ label_2:
+ while (true) {
+ if (getToken(1).kind != EOF) {
+ ;
+ } else {
+ break label_2;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HEX_COLOR:
+ case IDENT:
+ case ELEMENT_NAME:
+ case SOLITARY_ID:
+ case SOLITARY_CLASS:
+ case SOLITARY_PSEUDO_CLASS:
+ case SOLITARY_PSEUDO_ELEMENT:
+ case HASH:
+ ruleSet = ruleSet_recoverable();
+ sheet.addRuleSet(ruleSet);
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ skipTillExpressionEnd();
+ }
+ }
+ }
+
+ final public void mediaSet() throws ParseException {
+ jj_consume_token(MEDIA);
+ jj_consume_token(IDENT);
+ jj_consume_token(OPEN_BRACE);
+ label_3:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HEX_COLOR:
+ case IDENT:
+ case ELEMENT_NAME:
+ case SOLITARY_ID:
+ case SOLITARY_CLASS:
+ case SOLITARY_PSEUDO_CLASS:
+ case SOLITARY_PSEUDO_ELEMENT:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_3;
+ }
+ ruleSet_recoverable();
+ }
+ jj_consume_token(CLOSE_BRACE);
+ }
+
+ final public RuleSet ruleSet() throws ParseException {
+ RuleSet result = new RuleSet(); String selector; Property p;
+ selector = selector();
+ result.addSelector(selector);
+ label_4:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ break label_4;
+ }
+ jj_consume_token(COMMA);
+ selector = selector();
+ result.addSelector(selector);
+ }
+ jj_consume_token(OPEN_BRACE);
+ p = declaration_recoverable();
+ result.addProperty(p);
+ label_5:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ break label_5;
+ }
+ jj_consume_token(SEMICOLON);
+ p = declaration_recoverable();
+ result.addProperty(p);
+ }
+ jj_consume_token(CLOSE_BRACE);
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public RuleSet ruleSet_recoverable() throws ParseException {
+ RuleSet result = null;
+ try {
+ result = ruleSet();
+ } catch (ParseException pe) {
+ skipTillRuleSetEnd();
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String selector() throws ParseException {
+ Token startToken = getToken(1);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HEX_COLOR:
+ case IDENT:
+ case ELEMENT_NAME:
+ case SOLITARY_ID:
+ case SOLITARY_CLASS:
+ case SOLITARY_PSEUDO_CLASS:
+ case HASH:
+ label_6:
+ while (true) {
+ simple_selector();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HEX_COLOR:
+ case IDENT:
+ case ELEMENT_NAME:
+ case SOLITARY_ID:
+ case SOLITARY_CLASS:
+ case SOLITARY_PSEUDO_CLASS:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ break label_6;
+ }
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PSEUDO_ELEMENT:
+ case SOLITARY_PSEUDO_ELEMENT:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PSEUDO_ELEMENT:
+ pseudo_element();
+ break;
+ case SOLITARY_PSEUDO_ELEMENT:
+ solitary_pseudo_element();
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ ;
+ }
+ break;
+ case SOLITARY_PSEUDO_ELEMENT:
+ solitary_pseudo_element();
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return TokenResolver.resolve(startToken, getToken(0), true);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void simple_selector() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ case ELEMENT_NAME:
+ element_name();
+ break;
+ case HEX_COLOR:
+ case SOLITARY_ID:
+ case HASH:
+ solitary_id();
+ break;
+ case SOLITARY_CLASS:
+ solitary_class();
+ break;
+ case SOLITARY_PSEUDO_CLASS:
+ solitary_pseudo_class();
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public void element_name() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ELEMENT_NAME:
+ jj_consume_token(ELEMENT_NAME);
+ break;
+ case IDENT:
+ jj_consume_token(IDENT);
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public void solitary_pseudo_class() throws ParseException {
+ jj_consume_token(SOLITARY_PSEUDO_CLASS);
+ }
+
+ final public void solitary_class() throws ParseException {
+ jj_consume_token(SOLITARY_CLASS);
+ }
+
+ final public void pseudo_element() throws ParseException {
+ jj_consume_token(PSEUDO_ELEMENT);
+ }
+
+ final public void solitary_pseudo_element() throws ParseException {
+ jj_consume_token(SOLITARY_PSEUDO_ELEMENT);
+ }
+
+ final public void solitary_id() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SOLITARY_ID:
+ jj_consume_token(SOLITARY_ID);
+ break;
+ case HASH:
+ jj_consume_token(HASH);
+ break;
+ case HEX_COLOR:
+ jj_consume_token(HEX_COLOR);
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public Property declaration() throws ParseException {
+ String name; String value; boolean isImportant = false;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ name = property();
+ jj_consume_token(COLON);
+ value = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ prio();
+ isImportant = true;
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ ;
+ }
+ {if (true) return new Property(name, value, isImportant);}
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ ;
+ }
+ {if (true) return null;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Property declaration_recoverable() throws ParseException {
+ Property result = null;
+ try {
+ result = declaration();
+ } catch (ParseException e) {
+ skipTillDeclarationEnd();
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void prio() throws ParseException {
+ jj_consume_token(IMPORTANT_SYM);
+ }
+
+ final public String expr() throws ParseException {
+ StringBuffer result = new StringBuffer(); String term; String oper; boolean operSet;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case EMS:
+ case EXS:
+ case LENGTH:
+ case PERCENTAGE:
+ case NUMBER:
+ case RGB:
+ case URL:
+ case HEX_COLOR:
+ case IDENT:
+ case STRING:
+ term = term();
+ result.append(term);
+ label_7:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ case SLASH:
+ case PLUS:
+ case MINUS:
+ case EMS:
+ case EXS:
+ case LENGTH:
+ case PERCENTAGE:
+ case NUMBER:
+ case RGB:
+ case URL:
+ case HEX_COLOR:
+ case IDENT:
+ case STRING:
+ ;
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ break label_7;
+ }
+ operSet = false;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ case SLASH:
+ oper = oper();
+ result.append(oper); operSet = true;
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ ;
+ }
+ term = term();
+ if (!operSet) {result.append(" ");} result.append(term);
+ }
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ ;
+ }
+ {if (true) return result.toString();}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String term() throws ParseException {
+ Token startToken = getToken(1);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ unary_oper();
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case NUMBER:
+ jj_consume_token(NUMBER);
+ break;
+ case STRING:
+ jj_consume_token(STRING);
+ break;
+ case PERCENTAGE:
+ jj_consume_token(PERCENTAGE);
+ break;
+ case LENGTH:
+ jj_consume_token(LENGTH);
+ break;
+ case EMS:
+ jj_consume_token(EMS);
+ break;
+ case EXS:
+ jj_consume_token(EXS);
+ break;
+ case IDENT:
+ jj_consume_token(IDENT);
+ break;
+ case HEX_COLOR:
+ jj_consume_token(HEX_COLOR);
+ break;
+ case URL:
+ jj_consume_token(URL);
+ break;
+ case RGB:
+ jj_consume_token(RGB);
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return TokenResolver.resolve(startToken, getToken(0), false);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String oper() throws ParseException {
+ Token oper;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SLASH:
+ oper = jj_consume_token(SLASH);
+ break;
+ case COMMA:
+ oper = jj_consume_token(COMMA);
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return TokenResolver.resolve(oper);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void unary_oper() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MINUS:
+ jj_consume_token(MINUS);
+ break;
+ case PLUS:
+ jj_consume_token(PLUS);
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public String property() throws ParseException {
+ Token name;
+ name = jj_consume_token(IDENT);
+ {if (true) return TokenResolver.resolve(name);}
+ throw new Error("Missing return statement in function");
+ }
+
+ void skipTillExpressionEnd() throws ParseException {
+ skipTillRuleSetEnd();
+ }
+
+ public CSSParserTokenManager token_source;
+ SimpleCharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[22];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static {
+ jj_la1_0();
+ jj_la1_1();
+ }
+ private static void jj_la1_0() {
+ jj_la1_0 = new int[] {0x400000,0x40000000,0x80000000,0x80000000,0x1000,0x400,0x80000000,0x0,0x0,0x80000000,0x80000000,0x0,0x80000000,0x0,0x0,0xff381000,0x81000,0xff300000,0x300000,0xff000000,0x81000,0x300000,};
+ }
+ private static void jj_la1_1() {
+ jj_la1_1 = new int[] {0x0,0x200,0xdf,0xdf,0x0,0x0,0x9f,0x60,0x60,0xdf,0x9f,0x3,0x84,0x400,0x1,0x201,0x0,0x201,0x0,0x201,0x0,0x0,};
+ }
+
+ public CSSParser(java.io.InputStream stream) {
+ this(stream, null);
+ }
+ public CSSParser(java.io.InputStream stream, String encoding) {
+ try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+ token_source = new CSSParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 22; i++) jj_la1[i] = -1;
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ ReInit(stream, null);
+ }
+ public void ReInit(java.io.InputStream stream, String encoding) {
+ try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 22; i++) jj_la1[i] = -1;
+ }
+
+ public CSSParser(java.io.Reader stream) {
+ jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new CSSParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 22; i++) jj_la1[i] = -1;
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 22; i++) jj_la1[i] = -1;
+ }
+
+ public CSSParser(CSSParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 22; i++) jj_la1[i] = -1;
+ }
+
+ public void ReInit(CSSParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 22; i++) jj_la1[i] = -1;
+ }
+
+ 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++;
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ 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 = 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;
+
+ public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[54];
+ for (int i = 0; i < 54; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 22; 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;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 54; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ 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() {
+ }
+
+/*
+ private static String getTokenInfo(final Token t) {
+ return t.image + " at " + t.beginLine + "x" + t.beginColumn;
+ }
+ */
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParserConstants.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParserConstants.java?rev=427121&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParserConstants.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/text/html/cssparser/CSSParserConstants.java Mon Jul 31 07:08:47 2006
@@ -0,0 +1,113 @@
+/* Generated By:JavaCC: Do not edit this line. CSSParserConstants.java */
+package org.apache.harmony.x.swing.text.html.cssparser;
+
+public interface CSSParserConstants {
+
+ int EOF = 0;
+ int HTML_COMMENT = 6;
+ int SEMICOLON = 10;
+ int COLON = 11;
+ int COMMA = 12;
+ int DOT = 13;
+ int HASH_CHAR = 14;
+ int OPEN_PARENSIS = 15;
+ int CLOSE_PARENSIS = 16;
+ int OPEN_BRACE = 17;
+ int CLOSE_BRACE = 18;
+ int SLASH = 19;
+ int PLUS = 20;
+ int MINUS = 21;
+ int IMPORT = 22;
+ int MEDIA = 23;
+ int EMS = 24;
+ int EXS = 25;
+ int LENGTH = 26;
+ int PERCENTAGE = 27;
+ int NUMBER = 28;
+ int RGB = 29;
+ int URL = 30;
+ int HEX_COLOR = 31;
+ int IDENT = 32;
+ int ELEMENT_NAME = 33;
+ int SOLITARY_ID = 34;
+ int SOLITARY_CLASS = 35;
+ int SOLITARY_PSEUDO_CLASS = 36;
+ int PSEUDO_ELEMENT = 37;
+ int SOLITARY_PSEUDO_ELEMENT = 38;
+ int HASH = 39;
+ int CLASS = 40;
+ int STRING = 41;
+ int IMPORTANT_SYM = 42;
+ int UNICODE_CHAR = 43;
+ int DIGIT = 44;
+ int COLOR_COMPONENT = 45;
+ int LATIN1 = 46;
+ int ESCAPE = 47;
+ int STRING_CHAR = 48;
+ int NMSTRT = 49;
+ int NAME = 50;
+ int NMCHAR = 51;
+ int UNICODE = 52;
+ int ANY = 53;
+
+ int DEFAULT = 0;
+ int CSS_COMMENT = 1;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\t\"",
+ "\"\\n\"",
+ "\"\\r\"",
+ "\"\\f\"",
+ "<HTML_COMMENT>",
+ "\"/*\"",
+ "<token of kind 8>",
+ "\"*/\"",
+ "\";\"",
+ "\":\"",
+ "\",\"",
+ "\".\"",
+ "\"#\"",
+ "\"(\"",
+ "\")\"",
+ "\"{\"",
+ "\"}\"",
+ "\"/\"",
+ "\"+\"",
+ "\"-\"",
+ "\"@import\"",
+ "\"@media\"",
+ "<EMS>",
+ "<EXS>",
+ "<LENGTH>",
+ "<PERCENTAGE>",
+ "<NUMBER>",
+ "<RGB>",
+ "<URL>",
+ "<HEX_COLOR>",
+ "<IDENT>",
+ "<ELEMENT_NAME>",
+ "<SOLITARY_ID>",
+ "<SOLITARY_CLASS>",
+ "<SOLITARY_PSEUDO_CLASS>",
+ "<PSEUDO_ELEMENT>",
+ "<SOLITARY_PSEUDO_ELEMENT>",
+ "<HASH>",
+ "<CLASS>",
+ "<STRING>",
+ "<IMPORTANT_SYM>",
+ "<UNICODE_CHAR>",
+ "<DIGIT>",
+ "<COLOR_COMPONENT>",
+ "<LATIN1>",
+ "<ESCAPE>",
+ "<STRING_CHAR>",
+ "<NMSTRT>",
+ "<NAME>",
+ "<NMCHAR>",
+ "<UNICODE>",
+ "<ANY>",
+ };
+
+}