src/share/classes/com/sun/tools/doclint/Entity.java

Sat, 07 Nov 2020 10:30:02 +0800

author
aoqi
date
Sat, 07 Nov 2020 10:30:02 +0800
changeset 3938
93012e2a5d1d
parent 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag mips-jdk8u275-b01 for changeset eb6ee6a5f2fe

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.tools.doclint;
aoqi@0 27
aoqi@0 28 import java.util.HashMap;
aoqi@0 29 import java.util.Map;
aoqi@0 30
aoqi@0 31 /**
aoqi@0 32 * Table of entities defined in HTML 4.01.
aoqi@0 33 *
aoqi@0 34 * <p> Derived from
aoqi@0 35 * <a href="http://www.w3.org/TR/html4/sgml/entities.html">Character entity references in HTML 4</a>.
aoqi@0 36 *
aoqi@0 37 * The name of the member follows the name of the entity,
aoqi@0 38 * except when it clashes with a keyword, in which case
aoqi@0 39 * it is prefixed by '_'.
aoqi@0 40 *
aoqi@0 41 * <p><b>This is NOT part of any supported API.
aoqi@0 42 * If you write code that depends on this, you do so at your own
aoqi@0 43 * risk. This code and its internal interfaces are subject to change
aoqi@0 44 * or deletion without notice.</b></p>
aoqi@0 45 */
aoqi@0 46 public enum Entity {
aoqi@0 47 nbsp(160),
aoqi@0 48 iexcl(161),
aoqi@0 49 cent(162),
aoqi@0 50 pound(163),
aoqi@0 51 curren(164),
aoqi@0 52 yen(165),
aoqi@0 53 brvbar(166),
aoqi@0 54 sect(167),
aoqi@0 55 uml(168),
aoqi@0 56 copy(169),
aoqi@0 57 ordf(170),
aoqi@0 58 laquo(171),
aoqi@0 59 not(172),
aoqi@0 60 shy(173),
aoqi@0 61 reg(174),
aoqi@0 62 macr(175),
aoqi@0 63 deg(176),
aoqi@0 64 plusmn(177),
aoqi@0 65 sup2(178),
aoqi@0 66 sup3(179),
aoqi@0 67 acute(180),
aoqi@0 68 micro(181),
aoqi@0 69 para(182),
aoqi@0 70 middot(183),
aoqi@0 71 cedil(184),
aoqi@0 72 sup1(185),
aoqi@0 73 ordm(186),
aoqi@0 74 raquo(187),
aoqi@0 75 frac14(188),
aoqi@0 76 frac12(189),
aoqi@0 77 frac34(190),
aoqi@0 78 iquest(191),
aoqi@0 79 Agrave(192),
aoqi@0 80 Aacute(193),
aoqi@0 81 Acirc(194),
aoqi@0 82 Atilde(195),
aoqi@0 83 Auml(196),
aoqi@0 84 Aring(197),
aoqi@0 85 AElig(198),
aoqi@0 86 Ccedil(199),
aoqi@0 87 Egrave(200),
aoqi@0 88 Eacute(201),
aoqi@0 89 Ecirc(202),
aoqi@0 90 Euml(203),
aoqi@0 91 Igrave(204),
aoqi@0 92 Iacute(205),
aoqi@0 93 Icirc(206),
aoqi@0 94 Iuml(207),
aoqi@0 95 ETH(208),
aoqi@0 96 Ntilde(209),
aoqi@0 97 Ograve(210),
aoqi@0 98 Oacute(211),
aoqi@0 99 Ocirc(212),
aoqi@0 100 Otilde(213),
aoqi@0 101 Ouml(214),
aoqi@0 102 times(215),
aoqi@0 103 Oslash(216),
aoqi@0 104 Ugrave(217),
aoqi@0 105 Uacute(218),
aoqi@0 106 Ucirc(219),
aoqi@0 107 Uuml(220),
aoqi@0 108 Yacute(221),
aoqi@0 109 THORN(222),
aoqi@0 110 szlig(223),
aoqi@0 111 agrave(224),
aoqi@0 112 aacute(225),
aoqi@0 113 acirc(226),
aoqi@0 114 atilde(227),
aoqi@0 115 auml(228),
aoqi@0 116 aring(229),
aoqi@0 117 aelig(230),
aoqi@0 118 ccedil(231),
aoqi@0 119 egrave(232),
aoqi@0 120 eacute(233),
aoqi@0 121 ecirc(234),
aoqi@0 122 euml(235),
aoqi@0 123 igrave(236),
aoqi@0 124 iacute(237),
aoqi@0 125 icirc(238),
aoqi@0 126 iuml(239),
aoqi@0 127 eth(240),
aoqi@0 128 ntilde(241),
aoqi@0 129 ograve(242),
aoqi@0 130 oacute(243),
aoqi@0 131 ocirc(244),
aoqi@0 132 otilde(245),
aoqi@0 133 ouml(246),
aoqi@0 134 divide(247),
aoqi@0 135 oslash(248),
aoqi@0 136 ugrave(249),
aoqi@0 137 uacute(250),
aoqi@0 138 ucirc(251),
aoqi@0 139 uuml(252),
aoqi@0 140 yacute(253),
aoqi@0 141 thorn(254),
aoqi@0 142 yuml(255),
aoqi@0 143 fnof(402),
aoqi@0 144 Alpha(913),
aoqi@0 145 Beta(914),
aoqi@0 146 Gamma(915),
aoqi@0 147 Delta(916),
aoqi@0 148 Epsilon(917),
aoqi@0 149 Zeta(918),
aoqi@0 150 Eta(919),
aoqi@0 151 Theta(920),
aoqi@0 152 Iota(921),
aoqi@0 153 Kappa(922),
aoqi@0 154 Lambda(923),
aoqi@0 155 Mu(924),
aoqi@0 156 Nu(925),
aoqi@0 157 Xi(926),
aoqi@0 158 Omicron(927),
aoqi@0 159 Pi(928),
aoqi@0 160 Rho(929),
aoqi@0 161 Sigma(931),
aoqi@0 162 Tau(932),
aoqi@0 163 Upsilon(933),
aoqi@0 164 Phi(934),
aoqi@0 165 Chi(935),
aoqi@0 166 Psi(936),
aoqi@0 167 Omega(937),
aoqi@0 168 alpha(945),
aoqi@0 169 beta(946),
aoqi@0 170 gamma(947),
aoqi@0 171 delta(948),
aoqi@0 172 epsilon(949),
aoqi@0 173 zeta(950),
aoqi@0 174 eta(951),
aoqi@0 175 theta(952),
aoqi@0 176 iota(953),
aoqi@0 177 kappa(954),
aoqi@0 178 lambda(955),
aoqi@0 179 mu(956),
aoqi@0 180 nu(957),
aoqi@0 181 xi(958),
aoqi@0 182 omicron(959),
aoqi@0 183 pi(960),
aoqi@0 184 rho(961),
aoqi@0 185 sigmaf(962),
aoqi@0 186 sigma(963),
aoqi@0 187 tau(964),
aoqi@0 188 upsilon(965),
aoqi@0 189 phi(966),
aoqi@0 190 chi(967),
aoqi@0 191 psi(968),
aoqi@0 192 omega(969),
aoqi@0 193 thetasym(977),
aoqi@0 194 upsih(978),
aoqi@0 195 piv(982),
aoqi@0 196 bull(8226),
aoqi@0 197 hellip(8230),
aoqi@0 198 prime(8242),
aoqi@0 199 Prime(8243),
aoqi@0 200 oline(8254),
aoqi@0 201 frasl(8260),
aoqi@0 202 weierp(8472),
aoqi@0 203 image(8465),
aoqi@0 204 real(8476),
aoqi@0 205 trade(8482),
aoqi@0 206 alefsym(8501),
aoqi@0 207 larr(8592),
aoqi@0 208 uarr(8593),
aoqi@0 209 rarr(8594),
aoqi@0 210 darr(8595),
aoqi@0 211 harr(8596),
aoqi@0 212 crarr(8629),
aoqi@0 213 lArr(8656),
aoqi@0 214 uArr(8657),
aoqi@0 215 rArr(8658),
aoqi@0 216 dArr(8659),
aoqi@0 217 hArr(8660),
aoqi@0 218 forall(8704),
aoqi@0 219 part(8706),
aoqi@0 220 exist(8707),
aoqi@0 221 empty(8709),
aoqi@0 222 nabla(8711),
aoqi@0 223 isin(8712),
aoqi@0 224 notin(8713),
aoqi@0 225 ni(8715),
aoqi@0 226 prod(8719),
aoqi@0 227 sum(8721),
aoqi@0 228 minus(8722),
aoqi@0 229 lowast(8727),
aoqi@0 230 radic(8730),
aoqi@0 231 prop(8733),
aoqi@0 232 infin(8734),
aoqi@0 233 ang(8736),
aoqi@0 234 and(8743),
aoqi@0 235 or(8744),
aoqi@0 236 cap(8745),
aoqi@0 237 cup(8746),
aoqi@0 238 _int(8747),
aoqi@0 239 there4(8756),
aoqi@0 240 sim(8764),
aoqi@0 241 cong(8773),
aoqi@0 242 asymp(8776),
aoqi@0 243 ne(8800),
aoqi@0 244 equiv(8801),
aoqi@0 245 le(8804),
aoqi@0 246 ge(8805),
aoqi@0 247 sub(8834),
aoqi@0 248 sup(8835),
aoqi@0 249 nsub(8836),
aoqi@0 250 sube(8838),
aoqi@0 251 supe(8839),
aoqi@0 252 oplus(8853),
aoqi@0 253 otimes(8855),
aoqi@0 254 perp(8869),
aoqi@0 255 sdot(8901),
aoqi@0 256 lceil(8968),
aoqi@0 257 rceil(8969),
aoqi@0 258 lfloor(8970),
aoqi@0 259 rfloor(8971),
aoqi@0 260 lang(9001),
aoqi@0 261 rang(9002),
aoqi@0 262 loz(9674),
aoqi@0 263 spades(9824),
aoqi@0 264 clubs(9827),
aoqi@0 265 hearts(9829),
aoqi@0 266 diams(9830),
aoqi@0 267 quot(34),
aoqi@0 268 amp(38),
aoqi@0 269 lt(60),
aoqi@0 270 gt(62),
aoqi@0 271 OElig(338),
aoqi@0 272 oelig(339),
aoqi@0 273 Scaron(352),
aoqi@0 274 scaron(353),
aoqi@0 275 Yuml(376),
aoqi@0 276 circ(710),
aoqi@0 277 tilde(732),
aoqi@0 278 ensp(8194),
aoqi@0 279 emsp(8195),
aoqi@0 280 thinsp(8201),
aoqi@0 281 zwnj(8204),
aoqi@0 282 zwj(8205),
aoqi@0 283 lrm(8206),
aoqi@0 284 rlm(8207),
aoqi@0 285 ndash(8211),
aoqi@0 286 mdash(8212),
aoqi@0 287 lsquo(8216),
aoqi@0 288 rsquo(8217),
aoqi@0 289 sbquo(8218),
aoqi@0 290 ldquo(8220),
aoqi@0 291 rdquo(8221),
aoqi@0 292 bdquo(8222),
aoqi@0 293 dagger(8224),
aoqi@0 294 Dagger(8225),
aoqi@0 295 permil(8240),
aoqi@0 296 lsaquo(8249),
aoqi@0 297 rsaquo(8250),
aoqi@0 298 euro(8364);
aoqi@0 299
aoqi@0 300 int code;
aoqi@0 301
aoqi@0 302 private Entity(int code) {
aoqi@0 303 this.code = code;
aoqi@0 304 }
aoqi@0 305
aoqi@0 306 static boolean isValid(String name) {
aoqi@0 307 return names.containsKey(name);
aoqi@0 308 }
aoqi@0 309
aoqi@0 310 static boolean isValid(int code) {
aoqi@0 311 // allow numeric codes for standard ANSI characters
aoqi@0 312 return codes.containsKey(code) || ( 32 <= code && code < 2127);
aoqi@0 313 }
aoqi@0 314
aoqi@0 315 private static final Map<String,Entity> names = new HashMap<String,Entity>();
aoqi@0 316 private static final Map<Integer,Entity> codes = new HashMap<Integer,Entity>();
aoqi@0 317 static {
aoqi@0 318 for (Entity e: values()) {
aoqi@0 319 String name = e.name();
aoqi@0 320 int code = e.code;
aoqi@0 321 if (name.startsWith("_")) name = name.substring(1);
aoqi@0 322 names.put(name, e);
aoqi@0 323 codes.put(code, e);
aoqi@0 324 }
aoqi@0 325 }
aoqi@0 326 }

mercurial