summaryrefslogtreecommitdiffstats
path: root/parser/html/java
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /parser/html/java
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--parser/html/java/Makefile52
-rw-r--r--parser/html/java/README.txt86
-rw-r--r--parser/html/java/manifest.txt2
-rw-r--r--parser/html/java/named-character-references.html7
-rw-r--r--parser/html/javasrc/AttributeName.java2278
-rw-r--r--parser/html/javasrc/ElementName.java1896
-rw-r--r--parser/html/javasrc/Portability.java159
-rw-r--r--parser/html/javasrc/README.txt6
-rw-r--r--parser/html/javasrc/StackNode.java364
-rw-r--r--parser/html/javasrc/StateSnapshot.java205
-rw-r--r--parser/html/javasrc/Tokenizer.java7636
-rw-r--r--parser/html/javasrc/TreeBuilder.java6550
-rw-r--r--parser/html/javasrc/UTF16Buffer.java151
13 files changed, 19392 insertions, 0 deletions
diff --git a/parser/html/java/Makefile b/parser/html/java/Makefile
new file mode 100644
index 0000000000..5dd7d6bb0a
--- /dev/null
+++ b/parser/html/java/Makefile
@@ -0,0 +1,52 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+libs:: translator
+
+translator:: javaparser \
+; mkdir -p htmlparser/bin && \
+ find htmlparser/translator-src/nu/validator/htmlparser -name "*.java" | \
+ xargs javac -cp javaparser.jar -g -d htmlparser/bin && \
+ jar cfm translator.jar manifest.txt -C htmlparser/bin .
+
+javaparser:: \
+; mkdir -p javaparser/bin && \
+ find javaparser/src -name "*.java" | \
+ xargs javac -encoding ISO-8859-1 -g -d javaparser/bin && \
+ jar cf javaparser.jar -C javaparser/bin .
+
+sync_javaparser:: \
+; if [ ! -d javaparser/.git ] ; \
+ then rm -rf javaparser ; \
+ git clone https://github.com/javaparser/javaparser.git ; \
+ fi ; \
+ cd javaparser ; git checkout javaparser-1.0.6 ; cd ..
+
+sync_htmlparser:: \
+; if [ -d htmlparser/.hg ] ; \
+ then echo "The htmlparser repo has move to GitHub. Please remove the htmlparser directory and resync." ; exit ; \
+ elif [ ! -d htmlparser/.git ] ; \
+ then rm -rf htmlparser ; \
+ git clone https://github.com/validator/htmlparser.git ; \
+ cd htmlparser ; git checkout master ; cd .. ; \
+ fi
+
+sync:: sync_javaparser sync_htmlparser
+
+translate:: translator \
+; mkdir -p ../javasrc ; \
+ java -jar translator.jar \
+ htmlparser/src/nu/validator/htmlparser/impl \
+ .. ../../../xpcom/ds/StaticAtoms.py ../../../xpcom/ds/HTMLAtoms.py
+
+translate_from_snapshot:: translator \
+; mkdir -p ../javasrc ; \
+ java -jar translator.jar \
+ ../javasrc \
+ .. ../../../xpcom/ds/StaticAtoms.py ../../../xpcom/ds/HTMLAtoms.py
+
+named_characters:: translator \
+; java -cp translator.jar \
+ nu.validator.htmlparser.generator.GenerateNamedCharactersCpp \
+ named-character-references.html ../
diff --git a/parser/html/java/README.txt b/parser/html/java/README.txt
new file mode 100644
index 0000000000..13eeb9a5cf
--- /dev/null
+++ b/parser/html/java/README.txt
@@ -0,0 +1,86 @@
+If this is your first time building the HTML5 parser, you need to execute the
+following commands (from this directory) to bootstrap the translation:
+
+ make sync # fetch remote source files and licenses
+ make translate # perform the Java-to-C++ translation from the remote
+ # sources
+ make named_characters # Generate tables for named character tokenization
+
+If you make changes to the translator or the javaparser, you can rebuild by
+retyping 'make' in this directory. If you make changes to the HTML5 Java
+implementation, you can retranslate the Java sources from the htmlparser
+repository by retyping 'make translate' in this directory.
+
+The makefile supports the following targets:
+
+sync_htmlparser:
+ Retrieves the HTML parser and Java to C++ translator sources from GitHub.
+sync_javaparser:
+ Retrieves the javaparser sources from GitHub.
+sync:
+ Runs both sync_javaparser and sync_htmlparser.
+javaparser:
+ Builds the javaparser library retrieved earlier by sync_javaparser.
+translator:
+ Runs the javaparser target and then builds the Java to C++ translator from
+ sources retrieved earlier by sync_htmlparser.
+libs:
+ The default target. Alias for translator
+translate:
+ Runs the translator target and then translates the HTML parser sources
+ retrieved by sync_htmlparser copying the Java sources to ../javasrc.
+translate_from_snapshot:
+ Runs the translator target and then translates the HTML parser sources
+ stored in ../javasrc.
+named_characters:
+ Generates data tables for named character tokenization.
+
+## How to add an attribute
+
+# starting from the root of a mozilla-central checkout
+cd parser/html/java/
+make sync
+# now you have a clone of https://github.com/validator/htmlparser/tree/master in parser/html/java/htmlparser/
+cd htmlparser/src/
+$EDITOR nu/validator/htmlparser/impl/AttributeName.java
+# Search for the word "uncomment" and uncomment stuff according to the comments that talk about uncommenting
+# Duplicate the declaration a normal attribute (nothings special in SVG mode, etc.). Let's use "alt", since it's the first one.
+# In the duplicate, replace ALT with the new name in all caps and "alt" with the new name in quotes in lower case.
+# Search for "ALT,", duplicate that line and change the duplicate to say the new name in all caps followed by comma.
+# Save.
+javac nu/validator/htmlparser/impl/AttributeName.java
+java nu.validator.htmlparser.impl.AttributeName
+# Copy and paste the output into nu/validator/htmlparser/impl/AttributeName.java replacing the text below the comment "START GENERATED CODE" and above the very last "}".
+# Recomment the bits that you uncommented earlier.
+# Save.
+cd ../.. # Back to parser/html/java/
+make translate
+cd ../../..
+./mach clang-format
+
+## How to add an element
+
+# First, add an entry to parser/htmlparser/nsHTMLTagList.h or dom/svg/SVGTagList.h!
+# Then, starting from the root of a mozilla-central checkout
+cd parser/html/java/
+make sync
+# now you have a clone of https://github.com/validator/htmlparser/tree/master in parser/html/java/htmlparser/
+cd htmlparser/src/
+$EDITOR nu/validator/htmlparser/impl/ElementName.java
+# Search for the word "uncomment" and uncomment stuff according to the comments that talk about uncommenting
+# Duplicate the declaration a normal element. Let's use "bdo", since it's the first normal one.
+# In the duplicate, replace BDO with the new name in all caps and "bdo" with the new name in quotes in lower case (twice).
+# Search for "BDO,", duplicate that line and change the duplicate to say the new name in all caps followed by comma.
+# Save.
+javac nu/validator/htmlparser/impl/ElementName.java
+java nu.validator.htmlparser.impl.ElementName ../../../../../parser/htmlparser/nsHTMLTagList.h ../../../../../dom/svg/SVGTagList.h
+# Copy and paste the output into nu/validator/htmlparser/impl/ElementName.java replacing the text below the comment "START GENERATED CODE" and above the very last "}".
+# Recomment the bits that you uncommented earlier.
+# Save.
+cd ../.. # Back to parser/html/java/
+make translate
+cd ../../..
+./mach clang-format
+
+Ben Newman (23 September 2009)
+Henri Sivonen (10 August 2017, 10 February 2020)
diff --git a/parser/html/java/manifest.txt b/parser/html/java/manifest.txt
new file mode 100644
index 0000000000..14cd9d0819
--- /dev/null
+++ b/parser/html/java/manifest.txt
@@ -0,0 +1,2 @@
+Main-Class: nu.validator.htmlparser.cpptranslate.Main
+Class-Path: javaparser.jar
diff --git a/parser/html/java/named-character-references.html b/parser/html/java/named-character-references.html
new file mode 100644
index 0000000000..c8d1e08daf
--- /dev/null
+++ b/parser/html/java/named-character-references.html
@@ -0,0 +1,7 @@
+<!--
+Spec rev 4381
+-->
+
+ <table><thead><tr><th> Name </th> <th> Character </th> <tbody><tr><td> <code title="">AElig;</code> </td> <td> U+000C6 </td> <tr><td> <code title="">AElig</code> </td> <td> U+000C6 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">AMP;</code> </td> <td> U+00026 </td> <tr><td> <code title="">AMP</code> </td> <td> U+00026 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Aacute;</code> </td> <td> U+000C1 </td> <tr><td> <code title="">Aacute</code> </td> <td> U+000C1 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Abreve;</code> </td> <td> U+00102 </td> <tr><td> <code title="">Acirc;</code> </td> <td> U+000C2 </td> <tr><td> <code title="">Acirc</code> </td> <td> U+000C2 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Acy;</code> </td> <td> U+00410 </td> <tr><td> <code title="">Afr;</code> </td> <td> U+1D504 </td> <tr><td> <code title="">Agrave;</code> </td> <td> U+000C0 </td> <tr><td> <code title="">Agrave</code> </td> <td> U+000C0 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Alpha;</code> </td> <td> U+00391 </td> <tr><td> <code title="">Amacr;</code> </td> <td> U+00100 </td> <tr><td> <code title="">And;</code> </td> <td> U+02A53 </td> <tr><td> <code title="">Aogon;</code> </td> <td> U+00104 </td> <tr><td> <code title="">Aopf;</code> </td> <td> U+1D538 </td> <tr><td> <code title="">ApplyFunction;</code> </td> <td> U+02061 </td> <tr><td> <code title="">Aring;</code> </td> <td> U+000C5 </td> <tr><td> <code title="">Aring</code> </td> <td> U+000C5 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ascr;</code> </td> <td> U+1D49C </td> <tr><td> <code title="">Assign;</code> </td> <td> U+02254 </td> <tr><td> <code title="">Atilde;</code> </td> <td> U+000C3 </td> <tr><td> <code title="">Atilde</code> </td> <td> U+000C3 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Auml;</code> </td> <td> U+000C4 </td> <tr><td> <code title="">Auml</code> </td> <td> U+000C4 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Backslash;</code> </td> <td> U+02216 </td> <tr><td> <code title="">Barv;</code> </td> <td> U+02AE7 </td> <tr><td> <code title="">Barwed;</code> </td> <td> U+02306 </td> <tr><td> <code title="">Bcy;</code> </td> <td> U+00411 </td> <tr><td> <code title="">Because;</code> </td> <td> U+02235 </td> <tr><td> <code title="">Bernoullis;</code> </td> <td> U+0212C </td> <tr><td> <code title="">Beta;</code> </td> <td> U+00392 </td> <tr><td> <code title="">Bfr;</code> </td> <td> U+1D505 </td> <tr><td> <code title="">Bopf;</code> </td> <td> U+1D539 </td> <tr><td> <code title="">Breve;</code> </td> <td> U+002D8 </td> <tr><td> <code title="">Bscr;</code> </td> <td> U+0212C </td> <tr><td> <code title="">Bumpeq;</code> </td> <td> U+0224E </td> <tr><td> <code title="">CHcy;</code> </td> <td> U+00427 </td> <tr><td> <code title="">COPY;</code> </td> <td> U+000A9 </td> <tr><td> <code title="">COPY</code> </td> <td> U+000A9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Cacute;</code> </td> <td> U+00106 </td> <tr><td> <code title="">Cap;</code> </td> <td> U+022D2 </td> <tr><td> <code title="">CapitalDifferentialD;</code> </td> <td> U+02145 </td> <tr><td> <code title="">Cayleys;</code> </td> <td> U+0212D </td> <tr><td> <code title="">Ccaron;</code> </td> <td> U+0010C </td> <tr><td> <code title="">Ccedil;</code> </td> <td> U+000C7 </td> <tr><td> <code title="">Ccedil</code> </td> <td> U+000C7 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ccirc;</code> </td> <td> U+00108 </td> <tr><td> <code title="">Cconint;</code> </td> <td> U+02230 </td> <tr><td> <code title="">Cdot;</code> </td> <td> U+0010A </td> <tr><td> <code title="">Cedilla;</code> </td> <td> U+000B8 </td> <tr><td> <code title="">CenterDot;</code> </td> <td> U+000B7 </td> <tr><td> <code title="">Cfr;</code> </td> <td> U+0212D </td> <tr><td> <code title="">Chi;</code> </td> <td> U+003A7 </td> <tr><td> <code title="">CircleDot;</code> </td> <td> U+02299 </td> <tr><td> <code title="">CircleMinus;</code> </td> <td> U+02296 </td> <tr><td> <code title="">CirclePlus;</code> </td> <td> U+02295 </td> <tr><td> <code title="">CircleTimes;</code> </td> <td> U+02297 </td> <tr><td> <code title="">ClockwiseContourIntegral;</code> </td> <td> U+02232 </td> <tr><td> <code title="">CloseCurlyDoubleQuote;</code> </td> <td> U+0201D </td> <tr><td> <code title="">CloseCurlyQuote;</code> </td> <td> U+02019 </td> <tr><td> <code title="">Colon;</code> </td> <td> U+02237 </td> <tr><td> <code title="">Colone;</code> </td> <td> U+02A74 </td> <tr><td> <code title="">Congruent;</code> </td> <td> U+02261 </td> <tr><td> <code title="">Conint;</code> </td> <td> U+0222F </td> <tr><td> <code title="">ContourIntegral;</code> </td> <td> U+0222E </td> <tr><td> <code title="">Copf;</code> </td> <td> U+02102 </td> <tr><td> <code title="">Coproduct;</code> </td> <td> U+02210 </td> <tr><td> <code title="">CounterClockwiseContourIntegral;</code> </td> <td> U+02233 </td> <tr><td> <code title="">Cross;</code> </td> <td> U+02A2F </td> <tr><td> <code title="">Cscr;</code> </td> <td> U+1D49E </td> <tr><td> <code title="">Cup;</code> </td> <td> U+022D3 </td> <tr><td> <code title="">CupCap;</code> </td> <td> U+0224D </td> <tr><td> <code title="">DD;</code> </td> <td> U+02145 </td> <tr><td> <code title="">DDotrahd;</code> </td> <td> U+02911 </td> <tr><td> <code title="">DJcy;</code> </td> <td> U+00402 </td> <tr><td> <code title="">DScy;</code> </td> <td> U+00405 </td> <tr><td> <code title="">DZcy;</code> </td> <td> U+0040F </td> <tr><td> <code title="">Dagger;</code> </td> <td> U+02021 </td> <tr><td> <code title="">Darr;</code> </td> <td> U+021A1 </td> <tr><td> <code title="">Dashv;</code> </td> <td> U+02AE4 </td> <tr><td> <code title="">Dcaron;</code> </td> <td> U+0010E </td> <tr><td> <code title="">Dcy;</code> </td> <td> U+00414 </td> <tr><td> <code title="">Del;</code> </td> <td> U+02207 </td> <tr><td> <code title="">Delta;</code> </td> <td> U+00394 </td> <tr><td> <code title="">Dfr;</code> </td> <td> U+1D507 </td> <tr><td> <code title="">DiacriticalAcute;</code> </td> <td> U+000B4 </td> <tr><td> <code title="">DiacriticalDot;</code> </td> <td> U+002D9 </td> <tr><td> <code title="">DiacriticalDoubleAcute;</code> </td> <td> U+002DD </td> <tr><td> <code title="">DiacriticalGrave;</code> </td> <td> U+00060 </td> <tr><td> <code title="">DiacriticalTilde;</code> </td> <td> U+002DC </td> <tr><td> <code title="">Diamond;</code> </td> <td> U+022C4 </td> <tr><td> <code title="">DifferentialD;</code> </td> <td> U+02146 </td> <tr><td> <code title="">Dopf;</code> </td> <td> U+1D53B </td> <tr><td> <code title="">Dot;</code> </td> <td> U+000A8 </td> <tr><td> <code title="">DotDot;</code> </td> <td> U+020DC </td> <tr><td> <code title="">DotEqual;</code> </td> <td> U+02250 </td> <tr><td> <code title="">DoubleContourIntegral;</code> </td> <td> U+0222F </td> <tr><td> <code title="">DoubleDot;</code> </td> <td> U+000A8 </td> <tr><td> <code title="">DoubleDownArrow;</code> </td> <td> U+021D3 </td> <tr><td> <code title="">DoubleLeftArrow;</code> </td> <td> U+021D0 </td> <tr><td> <code title="">DoubleLeftRightArrow;</code> </td> <td> U+021D4 </td> <tr><td> <code title="">DoubleLeftTee;</code> </td> <td> U+02AE4 </td> <tr><td> <code title="">DoubleLongLeftArrow;</code> </td> <td> U+027F8 </td> <tr><td> <code title="">DoubleLongLeftRightArrow;</code> </td> <td> U+027FA </td> <tr><td> <code title="">DoubleLongRightArrow;</code> </td> <td> U+027F9 </td> <tr><td> <code title="">DoubleRightArrow;</code> </td> <td> U+021D2 </td> <tr><td> <code title="">DoubleRightTee;</code> </td> <td> U+022A8 </td> <tr><td> <code title="">DoubleUpArrow;</code> </td> <td> U+021D1 </td> <tr><td> <code title="">DoubleUpDownArrow;</code> </td> <td> U+021D5 </td> <tr><td> <code title="">DoubleVerticalBar;</code> </td> <td> U+02225 </td> <tr><td> <code title="">DownArrow;</code> </td> <td> U+02193 </td> <tr><td> <code title="">DownArrowBar;</code> </td> <td> U+02913 </td> <tr><td> <code title="">DownArrowUpArrow;</code> </td> <td> U+021F5 </td> <tr><td> <code title="">DownBreve;</code> </td> <td> U+00311 </td> <tr><td> <code title="">DownLeftRightVector;</code> </td> <td> U+02950 </td> <tr><td> <code title="">DownLeftTeeVector;</code> </td> <td> U+0295E </td> <tr><td> <code title="">DownLeftVector;</code> </td> <td> U+021BD </td> <tr><td> <code title="">DownLeftVectorBar;</code> </td> <td> U+02956 </td> <tr><td> <code title="">DownRightTeeVector;</code> </td> <td> U+0295F </td> <tr><td> <code title="">DownRightVector;</code> </td> <td> U+021C1 </td> <tr><td> <code title="">DownRightVectorBar;</code> </td> <td> U+02957 </td> <tr><td> <code title="">DownTee;</code> </td> <td> U+022A4 </td> <tr><td> <code title="">DownTeeArrow;</code> </td> <td> U+021A7 </td> <tr><td> <code title="">Downarrow;</code> </td> <td> U+021D3 </td> <tr><td> <code title="">Dscr;</code> </td> <td> U+1D49F </td> <tr><td> <code title="">Dstrok;</code> </td> <td> U+00110 </td> <tr><td> <code title="">ENG;</code> </td> <td> U+0014A </td> <tr><td> <code title="">ETH;</code> </td> <td> U+000D0 </td> <tr><td> <code title="">ETH</code> </td> <td> U+000D0 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Eacute;</code> </td> <td> U+000C9 </td> <tr><td> <code title="">Eacute</code> </td> <td> U+000C9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ecaron;</code> </td> <td> U+0011A </td> <tr><td> <code title="">Ecirc;</code> </td> <td> U+000CA </td> <tr><td> <code title="">Ecirc</code> </td> <td> U+000CA </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ecy;</code> </td> <td> U+0042D </td> <tr><td> <code title="">Edot;</code> </td> <td> U+00116 </td> <tr><td> <code title="">Efr;</code> </td> <td> U+1D508 </td> <tr><td> <code title="">Egrave;</code> </td> <td> U+000C8 </td> <tr><td> <code title="">Egrave</code> </td> <td> U+000C8 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Element;</code> </td> <td> U+02208 </td> <tr><td> <code title="">Emacr;</code> </td> <td> U+00112 </td> <tr><td> <code title="">EmptySmallSquare;</code> </td> <td> U+025FB </td> <tr><td> <code title="">EmptyVerySmallSquare;</code> </td> <td> U+025AB </td> <tr><td> <code title="">Eogon;</code> </td> <td> U+00118 </td> <tr><td> <code title="">Eopf;</code> </td> <td> U+1D53C </td> <tr><td> <code title="">Epsilon;</code> </td> <td> U+00395 </td> <tr><td> <code title="">Equal;</code> </td> <td> U+02A75 </td> <tr><td> <code title="">EqualTilde;</code> </td> <td> U+02242 </td> <tr><td> <code title="">Equilibrium;</code> </td> <td> U+021CC </td> <tr><td> <code title="">Escr;</code> </td> <td> U+02130 </td> <tr><td> <code title="">Esim;</code> </td> <td> U+02A73 </td> <tr><td> <code title="">Eta;</code> </td> <td> U+00397 </td> <tr><td> <code title="">Euml;</code> </td> <td> U+000CB </td> <tr><td> <code title="">Euml</code> </td> <td> U+000CB </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Exists;</code> </td> <td> U+02203 </td> <tr><td> <code title="">ExponentialE;</code> </td> <td> U+02147 </td> <tr><td> <code title="">Fcy;</code> </td> <td> U+00424 </td> <tr><td> <code title="">Ffr;</code> </td> <td> U+1D509 </td> <tr><td> <code title="">FilledSmallSquare;</code> </td> <td> U+025FC </td> <tr><td> <code title="">FilledVerySmallSquare;</code> </td> <td> U+025AA </td> <tr><td> <code title="">Fopf;</code> </td> <td> U+1D53D </td> <tr><td> <code title="">ForAll;</code> </td> <td> U+02200 </td> <tr><td> <code title="">Fouriertrf;</code> </td> <td> U+02131 </td> <tr><td> <code title="">Fscr;</code> </td> <td> U+02131 </td> <tr><td> <code title="">GJcy;</code> </td> <td> U+00403 </td> <tr><td> <code title="">GT;</code> </td> <td> U+0003E </td> <tr><td> <code title="">GT</code> </td> <td> U+0003E </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Gamma;</code> </td> <td> U+00393 </td> <tr><td> <code title="">Gammad;</code> </td> <td> U+003DC </td> <tr><td> <code title="">Gbreve;</code> </td> <td> U+0011E </td> <tr><td> <code title="">Gcedil;</code> </td> <td> U+00122 </td> <tr><td> <code title="">Gcirc;</code> </td> <td> U+0011C </td> <tr><td> <code title="">Gcy;</code> </td> <td> U+00413 </td> <tr><td> <code title="">Gdot;</code> </td> <td> U+00120 </td> <tr><td> <code title="">Gfr;</code> </td> <td> U+1D50A </td> <tr><td> <code title="">Gg;</code> </td> <td> U+022D9 </td> <tr><td> <code title="">Gopf;</code> </td> <td> U+1D53E </td> <tr><td> <code title="">GreaterEqual;</code> </td> <td> U+02265 </td> <tr><td> <code title="">GreaterEqualLess;</code> </td> <td> U+022DB </td> <tr><td> <code title="">GreaterFullEqual;</code> </td> <td> U+02267 </td> <tr><td> <code title="">GreaterGreater;</code> </td> <td> U+02AA2 </td> <tr><td> <code title="">GreaterLess;</code> </td> <td> U+02277 </td> <tr><td> <code title="">GreaterSlantEqual;</code> </td> <td> U+02A7E </td> <tr><td> <code title="">GreaterTilde;</code> </td> <td> U+02273 </td> <tr><td> <code title="">Gscr;</code> </td> <td> U+1D4A2 </td> <tr><td> <code title="">Gt;</code> </td> <td> U+0226B </td> <tr><td> <code title="">HARDcy;</code> </td> <td> U+0042A </td> <tr><td> <code title="">Hacek;</code> </td> <td> U+002C7 </td> <tr><td> <code title="">Hat;</code> </td> <td> U+0005E </td> <tr><td> <code title="">Hcirc;</code> </td> <td> U+00124 </td> <tr><td> <code title="">Hfr;</code> </td> <td> U+0210C </td> <tr><td> <code title="">HilbertSpace;</code> </td> <td> U+0210B </td> <tr><td> <code title="">Hopf;</code> </td> <td> U+0210D </td> <tr><td> <code title="">HorizontalLine;</code> </td> <td> U+02500 </td> <tr><td> <code title="">Hscr;</code> </td> <td> U+0210B </td> <tr><td> <code title="">Hstrok;</code> </td> <td> U+00126 </td> <tr><td> <code title="">HumpDownHump;</code> </td> <td> U+0224E </td> <tr><td> <code title="">HumpEqual;</code> </td> <td> U+0224F </td> <tr><td> <code title="">IEcy;</code> </td> <td> U+00415 </td> <tr><td> <code title="">IJlig;</code> </td> <td> U+00132 </td> <tr><td> <code title="">IOcy;</code> </td> <td> U+00401 </td> <tr><td> <code title="">Iacute;</code> </td> <td> U+000CD </td> <tr><td> <code title="">Iacute</code> </td> <td> U+000CD </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Icirc;</code> </td> <td> U+000CE </td> <tr><td> <code title="">Icirc</code> </td> <td> U+000CE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Icy;</code> </td> <td> U+00418 </td> <tr><td> <code title="">Idot;</code> </td> <td> U+00130 </td> <tr><td> <code title="">Ifr;</code> </td> <td> U+02111 </td> <tr><td> <code title="">Igrave;</code> </td> <td> U+000CC </td> <tr><td> <code title="">Igrave</code> </td> <td> U+000CC </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Im;</code> </td> <td> U+02111 </td> <tr><td> <code title="">Imacr;</code> </td> <td> U+0012A </td> <tr><td> <code title="">ImaginaryI;</code> </td> <td> U+02148 </td> <tr><td> <code title="">Implies;</code> </td> <td> U+021D2 </td> <tr><td> <code title="">Int;</code> </td> <td> U+0222C </td> <tr><td> <code title="">Integral;</code> </td> <td> U+0222B </td> <tr><td> <code title="">Intersection;</code> </td> <td> U+022C2 </td> <tr><td> <code title="">InvisibleComma;</code> </td> <td> U+02063 </td> <tr><td> <code title="">InvisibleTimes;</code> </td> <td> U+02062 </td> <tr><td> <code title="">Iogon;</code> </td> <td> U+0012E </td> <tr><td> <code title="">Iopf;</code> </td> <td> U+1D540 </td> <tr><td> <code title="">Iota;</code> </td> <td> U+00399 </td> <tr><td> <code title="">Iscr;</code> </td> <td> U+02110 </td> <tr><td> <code title="">Itilde;</code> </td> <td> U+00128 </td> <tr><td> <code title="">Iukcy;</code> </td> <td> U+00406 </td> <tr><td> <code title="">Iuml;</code> </td> <td> U+000CF </td> <tr><td> <code title="">Iuml</code> </td> <td> U+000CF </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Jcirc;</code> </td> <td> U+00134 </td> <tr><td> <code title="">Jcy;</code> </td> <td> U+00419 </td> <tr><td> <code title="">Jfr;</code> </td> <td> U+1D50D </td> <tr><td> <code title="">Jopf;</code> </td> <td> U+1D541 </td> <tr><td> <code title="">Jscr;</code> </td> <td> U+1D4A5 </td> <tr><td> <code title="">Jsercy;</code> </td> <td> U+00408 </td> <tr><td> <code title="">Jukcy;</code> </td> <td> U+00404 </td> <tr><td> <code title="">KHcy;</code> </td> <td> U+00425 </td> <tr><td> <code title="">KJcy;</code> </td> <td> U+0040C </td> <tr><td> <code title="">Kappa;</code> </td> <td> U+0039A </td> <tr><td> <code title="">Kcedil;</code> </td> <td> U+00136 </td> <tr><td> <code title="">Kcy;</code> </td> <td> U+0041A </td> <tr><td> <code title="">Kfr;</code> </td> <td> U+1D50E </td> <tr><td> <code title="">Kopf;</code> </td> <td> U+1D542 </td> <tr><td> <code title="">Kscr;</code> </td> <td> U+1D4A6 </td> <tr><td> <code title="">LJcy;</code> </td> <td> U+00409 </td> <tr><td> <code title="">LT;</code> </td> <td> U+0003C </td> <tr><td> <code title="">LT</code> </td> <td> U+0003C </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Lacute;</code> </td> <td> U+00139 </td> <tr><td> <code title="">Lambda;</code> </td> <td> U+0039B </td> <tr><td> <code title="">Lang;</code> </td> <td> U+027EA </td> <tr><td> <code title="">Laplacetrf;</code> </td> <td> U+02112 </td> <tr><td> <code title="">Larr;</code> </td> <td> U+0219E </td> <tr><td> <code title="">Lcaron;</code> </td> <td> U+0013D </td> <tr><td> <code title="">Lcedil;</code> </td> <td> U+0013B </td> <tr><td> <code title="">Lcy;</code> </td> <td> U+0041B </td> <tr><td> <code title="">LeftAngleBracket;</code> </td> <td> U+027E8 </td> <tr><td> <code title="">LeftArrow;</code> </td> <td> U+02190 </td> <tr><td> <code title="">LeftArrowBar;</code> </td> <td> U+021E4 </td> <tr><td> <code title="">LeftArrowRightArrow;</code> </td> <td> U+021C6 </td> <tr><td> <code title="">LeftCeiling;</code> </td> <td> U+02308 </td> <tr><td> <code title="">LeftDoubleBracket;</code> </td> <td> U+027E6 </td> <tr><td> <code title="">LeftDownTeeVector;</code> </td> <td> U+02961 </td> <tr><td> <code title="">LeftDownVector;</code> </td> <td> U+021C3 </td> <tr><td> <code title="">LeftDownVectorBar;</code> </td> <td> U+02959 </td> <tr><td> <code title="">LeftFloor;</code> </td> <td> U+0230A </td> <tr><td> <code title="">LeftRightArrow;</code> </td> <td> U+02194 </td> <tr><td> <code title="">LeftRightVector;</code> </td> <td> U+0294E </td> <tr><td> <code title="">LeftTee;</code> </td> <td> U+022A3 </td> <tr><td> <code title="">LeftTeeArrow;</code> </td> <td> U+021A4 </td> <tr><td> <code title="">LeftTeeVector;</code> </td> <td> U+0295A </td> <tr><td> <code title="">LeftTriangle;</code> </td> <td> U+022B2 </td> <tr><td> <code title="">LeftTriangleBar;</code> </td> <td> U+029CF </td> <tr><td> <code title="">LeftTriangleEqual;</code> </td> <td> U+022B4 </td> <tr><td> <code title="">LeftUpDownVector;</code> </td> <td> U+02951 </td> <tr><td> <code title="">LeftUpTeeVector;</code> </td> <td> U+02960 </td> <tr><td> <code title="">LeftUpVector;</code> </td> <td> U+021BF </td> <tr><td> <code title="">LeftUpVectorBar;</code> </td> <td> U+02958 </td> <tr><td> <code title="">LeftVector;</code> </td> <td> U+021BC </td> <tr><td> <code title="">LeftVectorBar;</code> </td> <td> U+02952 </td> <tr><td> <code title="">Leftarrow;</code> </td> <td> U+021D0 </td> <tr><td> <code title="">Leftrightarrow;</code> </td> <td> U+021D4 </td> <tr><td> <code title="">LessEqualGreater;</code> </td> <td> U+022DA </td> <tr><td> <code title="">LessFullEqual;</code> </td> <td> U+02266 </td> <tr><td> <code title="">LessGreater;</code> </td> <td> U+02276 </td> <tr><td> <code title="">LessLess;</code> </td> <td> U+02AA1 </td> <tr><td> <code title="">LessSlantEqual;</code> </td> <td> U+02A7D </td> <tr><td> <code title="">LessTilde;</code> </td> <td> U+02272 </td> <tr><td> <code title="">Lfr;</code> </td> <td> U+1D50F </td> <tr><td> <code title="">Ll;</code> </td> <td> U+022D8 </td> <tr><td> <code title="">Lleftarrow;</code> </td> <td> U+021DA </td> <tr><td> <code title="">Lmidot;</code> </td> <td> U+0013F </td> <tr><td> <code title="">LongLeftArrow;</code> </td> <td> U+027F5 </td> <tr><td> <code title="">LongLeftRightArrow;</code> </td> <td> U+027F7 </td> <tr><td> <code title="">LongRightArrow;</code> </td> <td> U+027F6 </td> <tr><td> <code title="">Longleftarrow;</code> </td> <td> U+027F8 </td> <tr><td> <code title="">Longleftrightarrow;</code> </td> <td> U+027FA </td> <tr><td> <code title="">Longrightarrow;</code> </td> <td> U+027F9 </td> <tr><td> <code title="">Lopf;</code> </td> <td> U+1D543 </td> <tr><td> <code title="">LowerLeftArrow;</code> </td> <td> U+02199 </td> <tr><td> <code title="">LowerRightArrow;</code> </td> <td> U+02198 </td> <tr><td> <code title="">Lscr;</code> </td> <td> U+02112 </td> <tr><td> <code title="">Lsh;</code> </td> <td> U+021B0 </td> <tr><td> <code title="">Lstrok;</code> </td> <td> U+00141 </td> <tr><td> <code title="">Lt;</code> </td> <td> U+0226A </td> <tr><td> <code title="">Map;</code> </td> <td> U+02905 </td> <tr><td> <code title="">Mcy;</code> </td> <td> U+0041C </td> <tr><td> <code title="">MediumSpace;</code> </td> <td> U+0205F </td> <tr><td> <code title="">Mellintrf;</code> </td> <td> U+02133 </td> <tr><td> <code title="">Mfr;</code> </td> <td> U+1D510 </td> <tr><td> <code title="">MinusPlus;</code> </td> <td> U+02213 </td> <tr><td> <code title="">Mopf;</code> </td> <td> U+1D544 </td> <tr><td> <code title="">Mscr;</code> </td> <td> U+02133 </td> <tr><td> <code title="">Mu;</code> </td> <td> U+0039C </td> <tr><td> <code title="">NJcy;</code> </td> <td> U+0040A </td> <tr><td> <code title="">Nacute;</code> </td> <td> U+00143 </td> <tr><td> <code title="">Ncaron;</code> </td> <td> U+00147 </td> <tr><td> <code title="">Ncedil;</code> </td> <td> U+00145 </td> <tr><td> <code title="">Ncy;</code> </td> <td> U+0041D </td> <tr><td> <code title="">NegativeMediumSpace;</code> </td> <td> U+0200B </td> <tr><td> <code title="">NegativeThickSpace;</code> </td> <td> U+0200B </td> <tr><td> <code title="">NegativeThinSpace;</code> </td> <td> U+0200B </td> <tr><td> <code title="">NegativeVeryThinSpace;</code> </td> <td> U+0200B </td> <tr><td> <code title="">NestedGreaterGreater;</code> </td> <td> U+0226B </td> <tr><td> <code title="">NestedLessLess;</code> </td> <td> U+0226A </td> <tr><td> <code title="">NewLine;</code> </td> <td> U+0000A </td> <tr><td> <code title="">Nfr;</code> </td> <td> U+1D511 </td> <tr><td> <code title="">NoBreak;</code> </td> <td> U+02060 </td> <tr><td> <code title="">NonBreakingSpace;</code> </td> <td> U+000A0 </td> <tr><td> <code title="">Nopf;</code> </td> <td> U+02115 </td> <tr><td> <code title="">Not;</code> </td> <td> U+02AEC </td> <tr><td> <code title="">NotCongruent;</code> </td> <td> U+02262 </td> <tr><td> <code title="">NotCupCap;</code> </td> <td> U+0226D </td> <tr><td> <code title="">NotDoubleVerticalBar;</code> </td> <td> U+02226 </td> <tr><td> <code title="">NotElement;</code> </td> <td> U+02209 </td> <tr><td> <code title="">NotEqual;</code> </td> <td> U+02260 </td> <tr><td> <code title="">NotExists;</code> </td> <td> U+02204 </td> <tr><td> <code title="">NotGreater;</code> </td> <td> U+0226F </td> <tr><td> <code title="">NotGreaterEqual;</code> </td> <td> U+02271 </td> <tr><td> <code title="">NotGreaterLess;</code> </td> <td> U+02279 </td> <tr><td> <code title="">NotGreaterTilde;</code> </td> <td> U+02275 </td> <tr><td> <code title="">NotLeftTriangle;</code> </td> <td> U+022EA </td> <tr><td> <code title="">NotLeftTriangleEqual;</code> </td> <td> U+022EC </td> <tr><td> <code title="">NotLess;</code> </td> <td> U+0226E </td> <tr><td> <code title="">NotLessEqual;</code> </td> <td> U+02270 </td> <tr><td> <code title="">NotLessGreater;</code> </td> <td> U+02278 </td> <tr><td> <code title="">NotLessTilde;</code> </td> <td> U+02274 </td> <tr><td> <code title="">NotPrecedes;</code> </td> <td> U+02280 </td> <tr><td> <code title="">NotPrecedesSlantEqual;</code> </td> <td> U+022E0 </td> <tr><td> <code title="">NotReverseElement;</code> </td> <td> U+0220C </td> <tr><td> <code title="">NotRightTriangle;</code> </td> <td> U+022EB </td> <tr><td> <code title="">NotRightTriangleEqual;</code> </td> <td> U+022ED </td> <tr><td> <code title="">NotSquareSubsetEqual;</code> </td> <td> U+022E2 </td> <tr><td> <code title="">NotSquareSupersetEqual;</code> </td> <td> U+022E3 </td> <tr><td> <code title="">NotSubsetEqual;</code> </td> <td> U+02288 </td> <tr><td> <code title="">NotSucceeds;</code> </td> <td> U+02281 </td> <tr><td> <code title="">NotSucceedsSlantEqual;</code> </td> <td> U+022E1 </td> <tr><td> <code title="">NotSupersetEqual;</code> </td> <td> U+02289 </td> <tr><td> <code title="">NotTilde;</code> </td> <td> U+02241 </td> <tr><td> <code title="">NotTildeEqual;</code> </td> <td> U+02244 </td> <tr><td> <code title="">NotTildeFullEqual;</code> </td> <td> U+02247 </td> <tr><td> <code title="">NotTildeTilde;</code> </td> <td> U+02249 </td> <tr><td> <code title="">NotVerticalBar;</code> </td> <td> U+02224 </td> <tr><td> <code title="">Nscr;</code> </td> <td> U+1D4A9 </td> <tr><td> <code title="">Ntilde;</code> </td> <td> U+000D1 </td> <tr><td> <code title="">Ntilde</code> </td> <td> U+000D1 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Nu;</code> </td> <td> U+0039D </td> <tr><td> <code title="">OElig;</code> </td> <td> U+00152 </td> <tr><td> <code title="">Oacute;</code> </td> <td> U+000D3 </td> <tr><td> <code title="">Oacute</code> </td> <td> U+000D3 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ocirc;</code> </td> <td> U+000D4 </td> <tr><td> <code title="">Ocirc</code> </td> <td> U+000D4 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ocy;</code> </td> <td> U+0041E </td> <tr><td> <code title="">Odblac;</code> </td> <td> U+00150 </td> <tr><td> <code title="">Ofr;</code> </td> <td> U+1D512 </td> <tr><td> <code title="">Ograve;</code> </td> <td> U+000D2 </td> <tr><td> <code title="">Ograve</code> </td> <td> U+000D2 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Omacr;</code> </td> <td> U+0014C </td> <tr><td> <code title="">Omega;</code> </td> <td> U+003A9 </td> <tr><td> <code title="">Omicron;</code> </td> <td> U+0039F </td> <tr><td> <code title="">Oopf;</code> </td> <td> U+1D546 </td> <tr><td> <code title="">OpenCurlyDoubleQuote;</code> </td> <td> U+0201C </td> <tr><td> <code title="">OpenCurlyQuote;</code> </td> <td> U+02018 </td> <tr><td> <code title="">Or;</code> </td> <td> U+02A54 </td> <tr><td> <code title="">Oscr;</code> </td> <td> U+1D4AA </td> <tr><td> <code title="">Oslash;</code> </td> <td> U+000D8 </td> <tr><td> <code title="">Oslash</code> </td> <td> U+000D8 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Otilde;</code> </td> <td> U+000D5 </td> <tr><td> <code title="">Otilde</code> </td> <td> U+000D5 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Otimes;</code> </td> <td> U+02A37 </td> <tr><td> <code title="">Ouml;</code> </td> <td> U+000D6 </td> <tr><td> <code title="">Ouml</code> </td> <td> U+000D6 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">OverBar;</code> </td> <td> U+0203E </td> <tr><td> <code title="">OverBrace;</code> </td> <td> U+023DE </td> <tr><td> <code title="">OverBracket;</code> </td> <td> U+023B4 </td> <tr><td> <code title="">OverParenthesis;</code> </td> <td> U+023DC </td> <tr><td> <code title="">PartialD;</code> </td> <td> U+02202 </td> <tr><td> <code title="">Pcy;</code> </td> <td> U+0041F </td> <tr><td> <code title="">Pfr;</code> </td> <td> U+1D513 </td> <tr><td> <code title="">Phi;</code> </td> <td> U+003A6 </td> <tr><td> <code title="">Pi;</code> </td> <td> U+003A0 </td> <tr><td> <code title="">PlusMinus;</code> </td> <td> U+000B1 </td> <tr><td> <code title="">Poincareplane;</code> </td> <td> U+0210C </td> <tr><td> <code title="">Popf;</code> </td> <td> U+02119 </td> <tr><td> <code title="">Pr;</code> </td> <td> U+02ABB </td> <tr><td> <code title="">Precedes;</code> </td> <td> U+0227A </td> <tr><td> <code title="">PrecedesEqual;</code> </td> <td> U+02AAF </td> <tr><td> <code title="">PrecedesSlantEqual;</code> </td> <td> U+0227C </td> <tr><td> <code title="">PrecedesTilde;</code> </td> <td> U+0227E </td> <tr><td> <code title="">Prime;</code> </td> <td> U+02033 </td> <tr><td> <code title="">Product;</code> </td> <td> U+0220F </td> <tr><td> <code title="">Proportion;</code> </td> <td> U+02237 </td> <tr><td> <code title="">Proportional;</code> </td> <td> U+0221D </td> <tr><td> <code title="">Pscr;</code> </td> <td> U+1D4AB </td> <tr><td> <code title="">Psi;</code> </td> <td> U+003A8 </td> <tr><td> <code title="">QUOT;</code> </td> <td> U+00022 </td> <tr><td> <code title="">QUOT</code> </td> <td> U+00022 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Qfr;</code> </td> <td> U+1D514 </td> <tr><td> <code title="">Qopf;</code> </td> <td> U+0211A </td> <tr><td> <code title="">Qscr;</code> </td> <td> U+1D4AC </td> <tr><td> <code title="">RBarr;</code> </td> <td> U+02910 </td> <tr><td> <code title="">REG;</code> </td> <td> U+000AE </td> <tr><td> <code title="">REG</code> </td> <td> U+000AE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Racute;</code> </td> <td> U+00154 </td> <tr><td> <code title="">Rang;</code> </td> <td> U+027EB </td> <tr><td> <code title="">Rarr;</code> </td> <td> U+021A0 </td> <tr><td> <code title="">Rarrtl;</code> </td> <td> U+02916 </td> <tr><td> <code title="">Rcaron;</code> </td> <td> U+00158 </td> <tr><td> <code title="">Rcedil;</code> </td> <td> U+00156 </td> <tr><td> <code title="">Rcy;</code> </td> <td> U+00420 </td> <tr><td> <code title="">Re;</code> </td> <td> U+0211C </td> <tr><td> <code title="">ReverseElement;</code> </td> <td> U+0220B </td> <tr><td> <code title="">ReverseEquilibrium;</code> </td> <td> U+021CB </td> <tr><td> <code title="">ReverseUpEquilibrium;</code> </td> <td> U+0296F </td> <tr><td> <code title="">Rfr;</code> </td> <td> U+0211C </td> <tr><td> <code title="">Rho;</code> </td> <td> U+003A1 </td> <tr><td> <code title="">RightAngleBracket;</code> </td> <td> U+027E9 </td> <tr><td> <code title="">RightArrow;</code> </td> <td> U+02192 </td> <tr><td> <code title="">RightArrowBar;</code> </td> <td> U+021E5 </td> <tr><td> <code title="">RightArrowLeftArrow;</code> </td> <td> U+021C4 </td> <tr><td> <code title="">RightCeiling;</code> </td> <td> U+02309 </td> <tr><td> <code title="">RightDoubleBracket;</code> </td> <td> U+027E7 </td> <tr><td> <code title="">RightDownTeeVector;</code> </td> <td> U+0295D </td> <tr><td> <code title="">RightDownVector;</code> </td> <td> U+021C2 </td> <tr><td> <code title="">RightDownVectorBar;</code> </td> <td> U+02955 </td> <tr><td> <code title="">RightFloor;</code> </td> <td> U+0230B </td> <tr><td> <code title="">RightTee;</code> </td> <td> U+022A2 </td> <tr><td> <code title="">RightTeeArrow;</code> </td> <td> U+021A6 </td> <tr><td> <code title="">RightTeeVector;</code> </td> <td> U+0295B </td> <tr><td> <code title="">RightTriangle;</code> </td> <td> U+022B3 </td> <tr><td> <code title="">RightTriangleBar;</code> </td> <td> U+029D0 </td> <tr><td> <code title="">RightTriangleEqual;</code> </td> <td> U+022B5 </td> <tr><td> <code title="">RightUpDownVector;</code> </td> <td> U+0294F </td> <tr><td> <code title="">RightUpTeeVector;</code> </td> <td> U+0295C </td> <tr><td> <code title="">RightUpVector;</code> </td> <td> U+021BE </td> <tr><td> <code title="">RightUpVectorBar;</code> </td> <td> U+02954 </td> <tr><td> <code title="">RightVector;</code> </td> <td> U+021C0 </td> <tr><td> <code title="">RightVectorBar;</code> </td> <td> U+02953 </td> <tr><td> <code title="">Rightarrow;</code> </td> <td> U+021D2 </td> <tr><td> <code title="">Ropf;</code> </td> <td> U+0211D </td> <tr><td> <code title="">RoundImplies;</code> </td> <td> U+02970 </td> <tr><td> <code title="">Rrightarrow;</code> </td> <td> U+021DB </td> <tr><td> <code title="">Rscr;</code> </td> <td> U+0211B </td> <tr><td> <code title="">Rsh;</code> </td> <td> U+021B1 </td> <tr><td> <code title="">RuleDelayed;</code> </td> <td> U+029F4 </td> <tr><td> <code title="">SHCHcy;</code> </td> <td> U+00429 </td> <tr><td> <code title="">SHcy;</code> </td> <td> U+00428 </td> <tr><td> <code title="">SOFTcy;</code> </td> <td> U+0042C </td> <tr><td> <code title="">Sacute;</code> </td> <td> U+0015A </td> <tr><td> <code title="">Sc;</code> </td> <td> U+02ABC </td> <tr><td> <code title="">Scaron;</code> </td> <td> U+00160 </td> <tr><td> <code title="">Scedil;</code> </td> <td> U+0015E </td> <tr><td> <code title="">Scirc;</code> </td> <td> U+0015C </td> <tr><td> <code title="">Scy;</code> </td> <td> U+00421 </td> <tr><td> <code title="">Sfr;</code> </td> <td> U+1D516 </td> <tr><td> <code title="">ShortDownArrow;</code> </td> <td> U+02193 </td> <tr><td> <code title="">ShortLeftArrow;</code> </td> <td> U+02190 </td> <tr><td> <code title="">ShortRightArrow;</code> </td> <td> U+02192 </td> <tr><td> <code title="">ShortUpArrow;</code> </td> <td> U+02191 </td> <tr><td> <code title="">Sigma;</code> </td> <td> U+003A3 </td> <tr><td> <code title="">SmallCircle;</code> </td> <td> U+02218 </td> <tr><td> <code title="">Sopf;</code> </td> <td> U+1D54A </td> <tr><td> <code title="">Sqrt;</code> </td> <td> U+0221A </td> <tr><td> <code title="">Square;</code> </td> <td> U+025A1 </td> <tr><td> <code title="">SquareIntersection;</code> </td> <td> U+02293 </td> <tr><td> <code title="">SquareSubset;</code> </td> <td> U+0228F </td> <tr><td> <code title="">SquareSubsetEqual;</code> </td> <td> U+02291 </td> <tr><td> <code title="">SquareSuperset;</code> </td> <td> U+02290 </td> <tr><td> <code title="">SquareSupersetEqual;</code> </td> <td> U+02292 </td> <tr><td> <code title="">SquareUnion;</code> </td> <td> U+02294 </td> <tr><td> <code title="">Sscr;</code> </td> <td> U+1D4AE </td> <tr><td> <code title="">Star;</code> </td> <td> U+022C6 </td> <tr><td> <code title="">Sub;</code> </td> <td> U+022D0 </td> <tr><td> <code title="">Subset;</code> </td> <td> U+022D0 </td> <tr><td> <code title="">SubsetEqual;</code> </td> <td> U+02286 </td> <tr><td> <code title="">Succeeds;</code> </td> <td> U+0227B </td> <tr><td> <code title="">SucceedsEqual;</code> </td> <td> U+02AB0 </td> <tr><td> <code title="">SucceedsSlantEqual;</code> </td> <td> U+0227D </td> <tr><td> <code title="">SucceedsTilde;</code> </td> <td> U+0227F </td> <tr><td> <code title="">SuchThat;</code> </td> <td> U+0220B </td> <tr><td> <code title="">Sum;</code> </td> <td> U+02211 </td> <tr><td> <code title="">Sup;</code> </td> <td> U+022D1 </td> <tr><td> <code title="">Superset;</code> </td> <td> U+02283 </td> <tr><td> <code title="">SupersetEqual;</code> </td> <td> U+02287 </td> <tr><td> <code title="">Supset;</code> </td> <td> U+022D1 </td> <tr><td> <code title="">THORN;</code> </td> <td> U+000DE </td> <tr><td> <code title="">THORN</code> </td> <td> U+000DE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">TRADE;</code> </td> <td> U+02122 </td> <tr><td> <code title="">TSHcy;</code> </td> <td> U+0040B </td> <tr><td> <code title="">TScy;</code> </td> <td> U+00426 </td> <tr><td> <code title="">Tab;</code> </td> <td> U+00009 </td> <tr><td> <code title="">Tau;</code> </td> <td> U+003A4 </td> <tr><td> <code title="">Tcaron;</code> </td> <td> U+00164 </td> <tr><td> <code title="">Tcedil;</code> </td> <td> U+00162 </td> <tr><td> <code title="">Tcy;</code> </td> <td> U+00422 </td> <tr><td> <code title="">Tfr;</code> </td> <td> U+1D517 </td> <tr><td> <code title="">Therefore;</code> </td> <td> U+02234 </td> <tr><td> <code title="">Theta;</code> </td> <td> U+00398 </td> <tr><td> <code title="">ThinSpace;</code> </td> <td> U+02009 </td> <tr><td> <code title="">Tilde;</code> </td> <td> U+0223C </td> <tr><td> <code title="">TildeEqual;</code> </td> <td> U+02243 </td> <tr><td> <code title="">TildeFullEqual;</code> </td> <td> U+02245 </td> <tr><td> <code title="">TildeTilde;</code> </td> <td> U+02248 </td> <tr><td> <code title="">Topf;</code> </td> <td> U+1D54B </td> <tr><td> <code title="">TripleDot;</code> </td> <td> U+020DB </td> <tr><td> <code title="">Tscr;</code> </td> <td> U+1D4AF </td> <tr><td> <code title="">Tstrok;</code> </td> <td> U+00166 </td> <tr><td> <code title="">Uacute;</code> </td> <td> U+000DA </td> <tr><td> <code title="">Uacute</code> </td> <td> U+000DA </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Uarr;</code> </td> <td> U+0219F </td> <tr><td> <code title="">Uarrocir;</code> </td> <td> U+02949 </td> <tr><td> <code title="">Ubrcy;</code> </td> <td> U+0040E </td> <tr><td> <code title="">Ubreve;</code> </td> <td> U+0016C </td> <tr><td> <code title="">Ucirc;</code> </td> <td> U+000DB </td> <tr><td> <code title="">Ucirc</code> </td> <td> U+000DB </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ucy;</code> </td> <td> U+00423 </td> <tr><td> <code title="">Udblac;</code> </td> <td> U+00170 </td> <tr><td> <code title="">Ufr;</code> </td> <td> U+1D518 </td> <tr><td> <code title="">Ugrave;</code> </td> <td> U+000D9 </td> <tr><td> <code title="">Ugrave</code> </td> <td> U+000D9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Umacr;</code> </td> <td> U+0016A </td> <tr><td> <code title="">UnderBar;</code> </td> <td> U+0005F </td> <tr><td> <code title="">UnderBrace;</code> </td> <td> U+023DF </td> <tr><td> <code title="">UnderBracket;</code> </td> <td> U+023B5 </td> <tr><td> <code title="">UnderParenthesis;</code> </td> <td> U+023DD </td> <tr><td> <code title="">Union;</code> </td> <td> U+022C3 </td> <tr><td> <code title="">UnionPlus;</code> </td> <td> U+0228E </td> <tr><td> <code title="">Uogon;</code> </td> <td> U+00172 </td> <tr><td> <code title="">Uopf;</code> </td> <td> U+1D54C </td> <tr><td> <code title="">UpArrow;</code> </td> <td> U+02191 </td> <tr><td> <code title="">UpArrowBar;</code> </td> <td> U+02912 </td> <tr><td> <code title="">UpArrowDownArrow;</code> </td> <td> U+021C5 </td> <tr><td> <code title="">UpDownArrow;</code> </td> <td> U+02195 </td> <tr><td> <code title="">UpEquilibrium;</code> </td> <td> U+0296E </td> <tr><td> <code title="">UpTee;</code> </td> <td> U+022A5 </td> <tr><td> <code title="">UpTeeArrow;</code> </td> <td> U+021A5 </td> <tr><td> <code title="">Uparrow;</code> </td> <td> U+021D1 </td> <tr><td> <code title="">Updownarrow;</code> </td> <td> U+021D5 </td> <tr><td> <code title="">UpperLeftArrow;</code> </td> <td> U+02196 </td> <tr><td> <code title="">UpperRightArrow;</code> </td> <td> U+02197 </td> <tr><td> <code title="">Upsi;</code> </td> <td> U+003D2 </td> <tr><td> <code title="">Upsilon;</code> </td> <td> U+003A5 </td> <tr><td> <code title="">Uring;</code> </td> <td> U+0016E </td> <tr><td> <code title="">Uscr;</code> </td> <td> U+1D4B0 </td> <tr><td> <code title="">Utilde;</code> </td> <td> U+00168 </td> <tr><td> <code title="">Uuml;</code> </td> <td> U+000DC </td> <tr><td> <code title="">Uuml</code> </td> <td> U+000DC </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">VDash;</code> </td> <td> U+022AB </td> <tr><td> <code title="">Vbar;</code> </td> <td> U+02AEB </td> <tr><td> <code title="">Vcy;</code> </td> <td> U+00412 </td> <tr><td> <code title="">Vdash;</code> </td> <td> U+022A9 </td> <tr><td> <code title="">Vdashl;</code> </td> <td> U+02AE6 </td> <tr><td> <code title="">Vee;</code> </td> <td> U+022C1 </td> <tr><td> <code title="">Verbar;</code> </td> <td> U+02016 </td> <tr><td> <code title="">Vert;</code> </td> <td> U+02016 </td> <tr><td> <code title="">VerticalBar;</code> </td> <td> U+02223 </td> <tr><td> <code title="">VerticalLine;</code> </td> <td> U+0007C </td> <tr><td> <code title="">VerticalSeparator;</code> </td> <td> U+02758 </td> <tr><td> <code title="">VerticalTilde;</code> </td> <td> U+02240 </td> <tr><td> <code title="">VeryThinSpace;</code> </td> <td> U+0200A </td> <tr><td> <code title="">Vfr;</code> </td> <td> U+1D519 </td> <tr><td> <code title="">Vopf;</code> </td> <td> U+1D54D </td> <tr><td> <code title="">Vscr;</code> </td> <td> U+1D4B1 </td> <tr><td> <code title="">Vvdash;</code> </td> <td> U+022AA </td> <tr><td> <code title="">Wcirc;</code> </td> <td> U+00174 </td> <tr><td> <code title="">Wedge;</code> </td> <td> U+022C0 </td> <tr><td> <code title="">Wfr;</code> </td> <td> U+1D51A </td> <tr><td> <code title="">Wopf;</code> </td> <td> U+1D54E </td> <tr><td> <code title="">Wscr;</code> </td> <td> U+1D4B2 </td> <tr><td> <code title="">Xfr;</code> </td> <td> U+1D51B </td> <tr><td> <code title="">Xi;</code> </td> <td> U+0039E </td> <tr><td> <code title="">Xopf;</code> </td> <td> U+1D54F </td> <tr><td> <code title="">Xscr;</code> </td> <td> U+1D4B3 </td> <tr><td> <code title="">YAcy;</code> </td> <td> U+0042F </td> <tr><td> <code title="">YIcy;</code> </td> <td> U+00407 </td> <tr><td> <code title="">YUcy;</code> </td> <td> U+0042E </td> <tr><td> <code title="">Yacute;</code> </td> <td> U+000DD </td> <tr><td> <code title="">Yacute</code> </td> <td> U+000DD </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">Ycirc;</code> </td> <td> U+00176 </td> <tr><td> <code title="">Ycy;</code> </td> <td> U+0042B </td> <tr><td> <code title="">Yfr;</code> </td> <td> U+1D51C </td> <tr><td> <code title="">Yopf;</code> </td> <td> U+1D550 </td> <tr><td> <code title="">Yscr;</code> </td> <td> U+1D4B4 </td> <tr><td> <code title="">Yuml;</code> </td> <td> U+00178 </td> <tr><td> <code title="">ZHcy;</code> </td> <td> U+00416 </td> <tr><td> <code title="">Zacute;</code> </td> <td> U+00179 </td> <tr><td> <code title="">Zcaron;</code> </td> <td> U+0017D </td> <tr><td> <code title="">Zcy;</code> </td> <td> U+00417 </td> <tr><td> <code title="">Zdot;</code> </td> <td> U+0017B </td> <tr><td> <code title="">ZeroWidthSpace;</code> </td> <td> U+0200B </td> <tr><td> <code title="">Zeta;</code> </td> <td> U+00396 </td> <tr><td> <code title="">Zfr;</code> </td> <td> U+02128 </td> <tr><td> <code title="">Zopf;</code> </td> <td> U+02124 </td> <tr><td> <code title="">Zscr;</code> </td> <td> U+1D4B5 </td> <tr><td> <code title="">aacute;</code> </td> <td> U+000E1 </td> <tr><td> <code title="">aacute</code> </td> <td> U+000E1 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">abreve;</code> </td> <td> U+00103 </td> <tr><td> <code title="">ac;</code> </td> <td> U+0223E </td> <tr><td> <code title="">acd;</code> </td> <td> U+0223F </td> <tr><td> <code title="">acirc;</code> </td> <td> U+000E2 </td> <tr><td> <code title="">acirc</code> </td> <td> U+000E2 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">acute;</code> </td> <td> U+000B4 </td> <tr><td> <code title="">acute</code> </td> <td> U+000B4 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">acy;</code> </td> <td> U+00430 </td> <tr><td> <code title="">aelig;</code> </td> <td> U+000E6 </td> <tr><td> <code title="">aelig</code> </td> <td> U+000E6 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">af;</code> </td> <td> U+02061 </td> <tr><td> <code title="">afr;</code> </td> <td> U+1D51E </td> <tr><td> <code title="">agrave;</code> </td> <td> U+000E0 </td> <tr><td> <code title="">agrave</code> </td> <td> U+000E0 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">alefsym;</code> </td> <td> U+02135 </td> <tr><td> <code title="">aleph;</code> </td> <td> U+02135 </td> <tr><td> <code title="">alpha;</code> </td> <td> U+003B1 </td> <tr><td> <code title="">amacr;</code> </td> <td> U+00101 </td> <tr><td> <code title="">amalg;</code> </td> <td> U+02A3F </td> <tr><td> <code title="">amp;</code> </td> <td> U+00026 </td> <tr><td> <code title="">amp</code> </td> <td> U+00026 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">and;</code> </td> <td> U+02227 </td> <tr><td> <code title="">andand;</code> </td> <td> U+02A55 </td> <tr><td> <code title="">andd;</code> </td> <td> U+02A5C </td> <tr><td> <code title="">andslope;</code> </td> <td> U+02A58 </td> <tr><td> <code title="">andv;</code> </td> <td> U+02A5A </td> <tr><td> <code title="">ang;</code> </td> <td> U+02220 </td> <tr><td> <code title="">ange;</code> </td> <td> U+029A4 </td> <tr><td> <code title="">angle;</code> </td> <td> U+02220 </td> <tr><td> <code title="">angmsd;</code> </td> <td> U+02221 </td> <tr><td> <code title="">angmsdaa;</code> </td> <td> U+029A8 </td> <tr><td> <code title="">angmsdab;</code> </td> <td> U+029A9 </td> <tr><td> <code title="">angmsdac;</code> </td> <td> U+029AA </td> <tr><td> <code title="">angmsdad;</code> </td> <td> U+029AB </td> <tr><td> <code title="">angmsdae;</code> </td> <td> U+029AC </td> <tr><td> <code title="">angmsdaf;</code> </td> <td> U+029AD </td> <tr><td> <code title="">angmsdag;</code> </td> <td> U+029AE </td> <tr><td> <code title="">angmsdah;</code> </td> <td> U+029AF </td> <tr><td> <code title="">angrt;</code> </td> <td> U+0221F </td> <tr><td> <code title="">angrtvb;</code> </td> <td> U+022BE </td> <tr><td> <code title="">angrtvbd;</code> </td> <td> U+0299D </td> <tr><td> <code title="">angsph;</code> </td> <td> U+02222 </td> <tr><td> <code title="">angst;</code> </td> <td> U+000C5 </td> <tr><td> <code title="">angzarr;</code> </td> <td> U+0237C </td> <tr><td> <code title="">aogon;</code> </td> <td> U+00105 </td> <tr><td> <code title="">aopf;</code> </td> <td> U+1D552 </td> <tr><td> <code title="">ap;</code> </td> <td> U+02248 </td> <tr><td> <code title="">apE;</code> </td> <td> U+02A70 </td> <tr><td> <code title="">apacir;</code> </td> <td> U+02A6F </td> <tr><td> <code title="">ape;</code> </td> <td> U+0224A </td> <tr><td> <code title="">apid;</code> </td> <td> U+0224B </td> <tr><td> <code title="">apos;</code> </td> <td> U+00027 </td> <tr><td> <code title="">approx;</code> </td> <td> U+02248 </td> <tr><td> <code title="">approxeq;</code> </td> <td> U+0224A </td> <tr><td> <code title="">aring;</code> </td> <td> U+000E5 </td> <tr><td> <code title="">aring</code> </td> <td> U+000E5 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ascr;</code> </td> <td> U+1D4B6 </td> <tr><td> <code title="">ast;</code> </td> <td> U+0002A </td> <tr><td> <code title="">asymp;</code> </td> <td> U+02248 </td> <tr><td> <code title="">asympeq;</code> </td> <td> U+0224D </td> <tr><td> <code title="">atilde;</code> </td> <td> U+000E3 </td> <tr><td> <code title="">atilde</code> </td> <td> U+000E3 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">auml;</code> </td> <td> U+000E4 </td> <tr><td> <code title="">auml</code> </td> <td> U+000E4 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">awconint;</code> </td> <td> U+02233 </td> <tr><td> <code title="">awint;</code> </td> <td> U+02A11 </td> <tr><td> <code title="">bNot;</code> </td> <td> U+02AED </td> <tr><td> <code title="">backcong;</code> </td> <td> U+0224C </td> <tr><td> <code title="">backepsilon;</code> </td> <td> U+003F6 </td> <tr><td> <code title="">backprime;</code> </td> <td> U+02035 </td> <tr><td> <code title="">backsim;</code> </td> <td> U+0223D </td> <tr><td> <code title="">backsimeq;</code> </td> <td> U+022CD </td> <tr><td> <code title="">barvee;</code> </td> <td> U+022BD </td> <tr><td> <code title="">barwed;</code> </td> <td> U+02305 </td> <tr><td> <code title="">barwedge;</code> </td> <td> U+02305 </td> <tr><td> <code title="">bbrk;</code> </td> <td> U+023B5 </td> <tr><td> <code title="">bbrktbrk;</code> </td> <td> U+023B6 </td> <tr><td> <code title="">bcong;</code> </td> <td> U+0224C </td> <tr><td> <code title="">bcy;</code> </td> <td> U+00431 </td> <tr><td> <code title="">bdquo;</code> </td> <td> U+0201E </td> <tr><td> <code title="">becaus;</code> </td> <td> U+02235 </td> <tr><td> <code title="">because;</code> </td> <td> U+02235 </td> <tr><td> <code title="">bemptyv;</code> </td> <td> U+029B0 </td> <tr><td> <code title="">bepsi;</code> </td> <td> U+003F6 </td> <tr><td> <code title="">bernou;</code> </td> <td> U+0212C </td> <tr><td> <code title="">beta;</code> </td> <td> U+003B2 </td> <tr><td> <code title="">beth;</code> </td> <td> U+02136 </td> <tr><td> <code title="">between;</code> </td> <td> U+0226C </td> <tr><td> <code title="">bfr;</code> </td> <td> U+1D51F </td> <tr><td> <code title="">bigcap;</code> </td> <td> U+022C2 </td> <tr><td> <code title="">bigcirc;</code> </td> <td> U+025EF </td> <tr><td> <code title="">bigcup;</code> </td> <td> U+022C3 </td> <tr><td> <code title="">bigodot;</code> </td> <td> U+02A00 </td> <tr><td> <code title="">bigoplus;</code> </td> <td> U+02A01 </td> <tr><td> <code title="">bigotimes;</code> </td> <td> U+02A02 </td> <tr><td> <code title="">bigsqcup;</code> </td> <td> U+02A06 </td> <tr><td> <code title="">bigstar;</code> </td> <td> U+02605 </td> <tr><td> <code title="">bigtriangledown;</code> </td> <td> U+025BD </td> <tr><td> <code title="">bigtriangleup;</code> </td> <td> U+025B3 </td> <tr><td> <code title="">biguplus;</code> </td> <td> U+02A04 </td> <tr><td> <code title="">bigvee;</code> </td> <td> U+022C1 </td> <tr><td> <code title="">bigwedge;</code> </td> <td> U+022C0 </td> <tr><td> <code title="">bkarow;</code> </td> <td> U+0290D </td> <tr><td> <code title="">blacklozenge;</code> </td> <td> U+029EB </td> <tr><td> <code title="">blacksquare;</code> </td> <td> U+025AA </td> <tr><td> <code title="">blacktriangle;</code> </td> <td> U+025B4 </td> <tr><td> <code title="">blacktriangledown;</code> </td> <td> U+025BE </td> <tr><td> <code title="">blacktriangleleft;</code> </td> <td> U+025C2 </td> <tr><td> <code title="">blacktriangleright;</code> </td> <td> U+025B8 </td> <tr><td> <code title="">blank;</code> </td> <td> U+02423 </td> <tr><td> <code title="">blk12;</code> </td> <td> U+02592 </td> <tr><td> <code title="">blk14;</code> </td> <td> U+02591 </td> <tr><td> <code title="">blk34;</code> </td> <td> U+02593 </td> <tr><td> <code title="">block;</code> </td> <td> U+02588 </td> <tr><td> <code title="">bnot;</code> </td> <td> U+02310 </td> <tr><td> <code title="">bopf;</code> </td> <td> U+1D553 </td> <tr><td> <code title="">bot;</code> </td> <td> U+022A5 </td> <tr><td> <code title="">bottom;</code> </td> <td> U+022A5 </td> <tr><td> <code title="">bowtie;</code> </td> <td> U+022C8 </td> <tr><td> <code title="">boxDL;</code> </td> <td> U+02557 </td> <tr><td> <code title="">boxDR;</code> </td> <td> U+02554 </td> <tr><td> <code title="">boxDl;</code> </td> <td> U+02556 </td> <tr><td> <code title="">boxDr;</code> </td> <td> U+02553 </td> <tr><td> <code title="">boxH;</code> </td> <td> U+02550 </td> <tr><td> <code title="">boxHD;</code> </td> <td> U+02566 </td> <tr><td> <code title="">boxHU;</code> </td> <td> U+02569 </td> <tr><td> <code title="">boxHd;</code> </td> <td> U+02564 </td> <tr><td> <code title="">boxHu;</code> </td> <td> U+02567 </td> <tr><td> <code title="">boxUL;</code> </td> <td> U+0255D </td> <tr><td> <code title="">boxUR;</code> </td> <td> U+0255A </td> <tr><td> <code title="">boxUl;</code> </td> <td> U+0255C </td> <tr><td> <code title="">boxUr;</code> </td> <td> U+02559 </td> <tr><td> <code title="">boxV;</code> </td> <td> U+02551 </td> <tr><td> <code title="">boxVH;</code> </td> <td> U+0256C </td> <tr><td> <code title="">boxVL;</code> </td> <td> U+02563 </td> <tr><td> <code title="">boxVR;</code> </td> <td> U+02560 </td> <tr><td> <code title="">boxVh;</code> </td> <td> U+0256B </td> <tr><td> <code title="">boxVl;</code> </td> <td> U+02562 </td> <tr><td> <code title="">boxVr;</code> </td> <td> U+0255F </td> <tr><td> <code title="">boxbox;</code> </td> <td> U+029C9 </td> <tr><td> <code title="">boxdL;</code> </td> <td> U+02555 </td> <tr><td> <code title="">boxdR;</code> </td> <td> U+02552 </td> <tr><td> <code title="">boxdl;</code> </td> <td> U+02510 </td> <tr><td> <code title="">boxdr;</code> </td> <td> U+0250C </td> <tr><td> <code title="">boxh;</code> </td> <td> U+02500 </td> <tr><td> <code title="">boxhD;</code> </td> <td> U+02565 </td> <tr><td> <code title="">boxhU;</code> </td> <td> U+02568 </td> <tr><td> <code title="">boxhd;</code> </td> <td> U+0252C </td> <tr><td> <code title="">boxhu;</code> </td> <td> U+02534 </td> <tr><td> <code title="">boxminus;</code> </td> <td> U+0229F </td> <tr><td> <code title="">boxplus;</code> </td> <td> U+0229E </td> <tr><td> <code title="">boxtimes;</code> </td> <td> U+022A0 </td> <tr><td> <code title="">boxuL;</code> </td> <td> U+0255B </td> <tr><td> <code title="">boxuR;</code> </td> <td> U+02558 </td> <tr><td> <code title="">boxul;</code> </td> <td> U+02518 </td> <tr><td> <code title="">boxur;</code> </td> <td> U+02514 </td> <tr><td> <code title="">boxv;</code> </td> <td> U+02502 </td> <tr><td> <code title="">boxvH;</code> </td> <td> U+0256A </td> <tr><td> <code title="">boxvL;</code> </td> <td> U+02561 </td> <tr><td> <code title="">boxvR;</code> </td> <td> U+0255E </td> <tr><td> <code title="">boxvh;</code> </td> <td> U+0253C </td> <tr><td> <code title="">boxvl;</code> </td> <td> U+02524 </td> <tr><td> <code title="">boxvr;</code> </td> <td> U+0251C </td> <tr><td> <code title="">bprime;</code> </td> <td> U+02035 </td> <tr><td> <code title="">breve;</code> </td> <td> U+002D8 </td> <tr><td> <code title="">brvbar;</code> </td> <td> U+000A6 </td> <tr><td> <code title="">brvbar</code> </td> <td> U+000A6 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">bscr;</code> </td> <td> U+1D4B7 </td> <tr><td> <code title="">bsemi;</code> </td> <td> U+0204F </td> <tr><td> <code title="">bsim;</code> </td> <td> U+0223D </td> <tr><td> <code title="">bsime;</code> </td> <td> U+022CD </td> <tr><td> <code title="">bsol;</code> </td> <td> U+0005C </td> <tr><td> <code title="">bsolb;</code> </td> <td> U+029C5 </td> <tr><td> <code title="">bsolhsub;</code> </td> <td> U+027C8 </td> <tr><td> <code title="">bull;</code> </td> <td> U+02022 </td> <tr><td> <code title="">bullet;</code> </td> <td> U+02022 </td> <tr><td> <code title="">bump;</code> </td> <td> U+0224E </td> <tr><td> <code title="">bumpE;</code> </td> <td> U+02AAE </td> <tr><td> <code title="">bumpe;</code> </td> <td> U+0224F </td> <tr><td> <code title="">bumpeq;</code> </td> <td> U+0224F </td> <tr><td> <code title="">cacute;</code> </td> <td> U+00107 </td> <tr><td> <code title="">cap;</code> </td> <td> U+02229 </td> <tr><td> <code title="">capand;</code> </td> <td> U+02A44 </td> <tr><td> <code title="">capbrcup;</code> </td> <td> U+02A49 </td> <tr><td> <code title="">capcap;</code> </td> <td> U+02A4B </td> <tr><td> <code title="">capcup;</code> </td> <td> U+02A47 </td> <tr><td> <code title="">capdot;</code> </td> <td> U+02A40 </td> <tr><td> <code title="">caret;</code> </td> <td> U+02041 </td> <tr><td> <code title="">caron;</code> </td> <td> U+002C7 </td> <tr><td> <code title="">ccaps;</code> </td> <td> U+02A4D </td> <tr><td> <code title="">ccaron;</code> </td> <td> U+0010D </td> <tr><td> <code title="">ccedil;</code> </td> <td> U+000E7 </td> <tr><td> <code title="">ccedil</code> </td> <td> U+000E7 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ccirc;</code> </td> <td> U+00109 </td> <tr><td> <code title="">ccups;</code> </td> <td> U+02A4C </td> <tr><td> <code title="">ccupssm;</code> </td> <td> U+02A50 </td> <tr><td> <code title="">cdot;</code> </td> <td> U+0010B </td> <tr><td> <code title="">cedil;</code> </td> <td> U+000B8 </td> <tr><td> <code title="">cedil</code> </td> <td> U+000B8 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">cemptyv;</code> </td> <td> U+029B2 </td> <tr><td> <code title="">cent;</code> </td> <td> U+000A2 </td> <tr><td> <code title="">cent</code> </td> <td> U+000A2 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">centerdot;</code> </td> <td> U+000B7 </td> <tr><td> <code title="">cfr;</code> </td> <td> U+1D520 </td> <tr><td> <code title="">chcy;</code> </td> <td> U+00447 </td> <tr><td> <code title="">check;</code> </td> <td> U+02713 </td> <tr><td> <code title="">checkmark;</code> </td> <td> U+02713 </td> <tr><td> <code title="">chi;</code> </td> <td> U+003C7 </td> <tr><td> <code title="">cir;</code> </td> <td> U+025CB </td> <tr><td> <code title="">cirE;</code> </td> <td> U+029C3 </td> <tr><td> <code title="">circ;</code> </td> <td> U+002C6 </td> <tr><td> <code title="">circeq;</code> </td> <td> U+02257 </td> <tr><td> <code title="">circlearrowleft;</code> </td> <td> U+021BA </td> <tr><td> <code title="">circlearrowright;</code> </td> <td> U+021BB </td> <tr><td> <code title="">circledR;</code> </td> <td> U+000AE </td> <tr><td> <code title="">circledS;</code> </td> <td> U+024C8 </td> <tr><td> <code title="">circledast;</code> </td> <td> U+0229B </td> <tr><td> <code title="">circledcirc;</code> </td> <td> U+0229A </td> <tr><td> <code title="">circleddash;</code> </td> <td> U+0229D </td> <tr><td> <code title="">cire;</code> </td> <td> U+02257 </td> <tr><td> <code title="">cirfnint;</code> </td> <td> U+02A10 </td> <tr><td> <code title="">cirmid;</code> </td> <td> U+02AEF </td> <tr><td> <code title="">cirscir;</code> </td> <td> U+029C2 </td> <tr><td> <code title="">clubs;</code> </td> <td> U+02663 </td> <tr><td> <code title="">clubsuit;</code> </td> <td> U+02663 </td> <tr><td> <code title="">colon;</code> </td> <td> U+0003A </td> <tr><td> <code title="">colone;</code> </td> <td> U+02254 </td> <tr><td> <code title="">coloneq;</code> </td> <td> U+02254 </td> <tr><td> <code title="">comma;</code> </td> <td> U+0002C </td> <tr><td> <code title="">commat;</code> </td> <td> U+00040 </td> <tr><td> <code title="">comp;</code> </td> <td> U+02201 </td> <tr><td> <code title="">compfn;</code> </td> <td> U+02218 </td> <tr><td> <code title="">complement;</code> </td> <td> U+02201 </td> <tr><td> <code title="">complexes;</code> </td> <td> U+02102 </td> <tr><td> <code title="">cong;</code> </td> <td> U+02245 </td> <tr><td> <code title="">congdot;</code> </td> <td> U+02A6D </td> <tr><td> <code title="">conint;</code> </td> <td> U+0222E </td> <tr><td> <code title="">copf;</code> </td> <td> U+1D554 </td> <tr><td> <code title="">coprod;</code> </td> <td> U+02210 </td> <tr><td> <code title="">copy;</code> </td> <td> U+000A9 </td> <tr><td> <code title="">copy</code> </td> <td> U+000A9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">copysr;</code> </td> <td> U+02117 </td> <tr><td> <code title="">crarr;</code> </td> <td> U+021B5 </td> <tr><td> <code title="">cross;</code> </td> <td> U+02717 </td> <tr><td> <code title="">cscr;</code> </td> <td> U+1D4B8 </td> <tr><td> <code title="">csub;</code> </td> <td> U+02ACF </td> <tr><td> <code title="">csube;</code> </td> <td> U+02AD1 </td> <tr><td> <code title="">csup;</code> </td> <td> U+02AD0 </td> <tr><td> <code title="">csupe;</code> </td> <td> U+02AD2 </td> <tr><td> <code title="">ctdot;</code> </td> <td> U+022EF </td> <tr><td> <code title="">cudarrl;</code> </td> <td> U+02938 </td> <tr><td> <code title="">cudarrr;</code> </td> <td> U+02935 </td> <tr><td> <code title="">cuepr;</code> </td> <td> U+022DE </td> <tr><td> <code title="">cuesc;</code> </td> <td> U+022DF </td> <tr><td> <code title="">cularr;</code> </td> <td> U+021B6 </td> <tr><td> <code title="">cularrp;</code> </td> <td> U+0293D </td> <tr><td> <code title="">cup;</code> </td> <td> U+0222A </td> <tr><td> <code title="">cupbrcap;</code> </td> <td> U+02A48 </td> <tr><td> <code title="">cupcap;</code> </td> <td> U+02A46 </td> <tr><td> <code title="">cupcup;</code> </td> <td> U+02A4A </td> <tr><td> <code title="">cupdot;</code> </td> <td> U+0228D </td> <tr><td> <code title="">cupor;</code> </td> <td> U+02A45 </td> <tr><td> <code title="">curarr;</code> </td> <td> U+021B7 </td> <tr><td> <code title="">curarrm;</code> </td> <td> U+0293C </td> <tr><td> <code title="">curlyeqprec;</code> </td> <td> U+022DE </td> <tr><td> <code title="">curlyeqsucc;</code> </td> <td> U+022DF </td> <tr><td> <code title="">curlyvee;</code> </td> <td> U+022CE </td> <tr><td> <code title="">curlywedge;</code> </td> <td> U+022CF </td> <tr><td> <code title="">curren;</code> </td> <td> U+000A4 </td> <tr><td> <code title="">curren</code> </td> <td> U+000A4 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">curvearrowleft;</code> </td> <td> U+021B6 </td> <tr><td> <code title="">curvearrowright;</code> </td> <td> U+021B7 </td> <tr><td> <code title="">cuvee;</code> </td> <td> U+022CE </td> <tr><td> <code title="">cuwed;</code> </td> <td> U+022CF </td> <tr><td> <code title="">cwconint;</code> </td> <td> U+02232 </td> <tr><td> <code title="">cwint;</code> </td> <td> U+02231 </td> <tr><td> <code title="">cylcty;</code> </td> <td> U+0232D </td> <tr><td> <code title="">dArr;</code> </td> <td> U+021D3 </td> <tr><td> <code title="">dHar;</code> </td> <td> U+02965 </td> <tr><td> <code title="">dagger;</code> </td> <td> U+02020 </td> <tr><td> <code title="">daleth;</code> </td> <td> U+02138 </td> <tr><td> <code title="">darr;</code> </td> <td> U+02193 </td> <tr><td> <code title="">dash;</code> </td> <td> U+02010 </td> <tr><td> <code title="">dashv;</code> </td> <td> U+022A3 </td> <tr><td> <code title="">dbkarow;</code> </td> <td> U+0290F </td> <tr><td> <code title="">dblac;</code> </td> <td> U+002DD </td> <tr><td> <code title="">dcaron;</code> </td> <td> U+0010F </td> <tr><td> <code title="">dcy;</code> </td> <td> U+00434 </td> <tr><td> <code title="">dd;</code> </td> <td> U+02146 </td> <tr><td> <code title="">ddagger;</code> </td> <td> U+02021 </td> <tr><td> <code title="">ddarr;</code> </td> <td> U+021CA </td> <tr><td> <code title="">ddotseq;</code> </td> <td> U+02A77 </td> <tr><td> <code title="">deg;</code> </td> <td> U+000B0 </td> <tr><td> <code title="">deg</code> </td> <td> U+000B0 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">delta;</code> </td> <td> U+003B4 </td> <tr><td> <code title="">demptyv;</code> </td> <td> U+029B1 </td> <tr><td> <code title="">dfisht;</code> </td> <td> U+0297F </td> <tr><td> <code title="">dfr;</code> </td> <td> U+1D521 </td> <tr><td> <code title="">dharl;</code> </td> <td> U+021C3 </td> <tr><td> <code title="">dharr;</code> </td> <td> U+021C2 </td> <tr><td> <code title="">diam;</code> </td> <td> U+022C4 </td> <tr><td> <code title="">diamond;</code> </td> <td> U+022C4 </td> <tr><td> <code title="">diamondsuit;</code> </td> <td> U+02666 </td> <tr><td> <code title="">diams;</code> </td> <td> U+02666 </td> <tr><td> <code title="">die;</code> </td> <td> U+000A8 </td> <tr><td> <code title="">digamma;</code> </td> <td> U+003DD </td> <tr><td> <code title="">disin;</code> </td> <td> U+022F2 </td> <tr><td> <code title="">div;</code> </td> <td> U+000F7 </td> <tr><td> <code title="">divide;</code> </td> <td> U+000F7 </td> <tr><td> <code title="">divide</code> </td> <td> U+000F7 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">divideontimes;</code> </td> <td> U+022C7 </td> <tr><td> <code title="">divonx;</code> </td> <td> U+022C7 </td> <tr><td> <code title="">djcy;</code> </td> <td> U+00452 </td> <tr><td> <code title="">dlcorn;</code> </td> <td> U+0231E </td> <tr><td> <code title="">dlcrop;</code> </td> <td> U+0230D </td> <tr><td> <code title="">dollar;</code> </td> <td> U+00024 </td> <tr><td> <code title="">dopf;</code> </td> <td> U+1D555 </td> <tr><td> <code title="">dot;</code> </td> <td> U+002D9 </td> <tr><td> <code title="">doteq;</code> </td> <td> U+02250 </td> <tr><td> <code title="">doteqdot;</code> </td> <td> U+02251 </td> <tr><td> <code title="">dotminus;</code> </td> <td> U+02238 </td> <tr><td> <code title="">dotplus;</code> </td> <td> U+02214 </td> <tr><td> <code title="">dotsquare;</code> </td> <td> U+022A1 </td> <tr><td> <code title="">doublebarwedge;</code> </td> <td> U+02306 </td> <tr><td> <code title="">downarrow;</code> </td> <td> U+02193 </td> <tr><td> <code title="">downdownarrows;</code> </td> <td> U+021CA </td> <tr><td> <code title="">downharpoonleft;</code> </td> <td> U+021C3 </td> <tr><td> <code title="">downharpoonright;</code> </td> <td> U+021C2 </td> <tr><td> <code title="">drbkarow;</code> </td> <td> U+02910 </td> <tr><td> <code title="">drcorn;</code> </td> <td> U+0231F </td> <tr><td> <code title="">drcrop;</code> </td> <td> U+0230C </td> <tr><td> <code title="">dscr;</code> </td> <td> U+1D4B9 </td> <tr><td> <code title="">dscy;</code> </td> <td> U+00455 </td> <tr><td> <code title="">dsol;</code> </td> <td> U+029F6 </td> <tr><td> <code title="">dstrok;</code> </td> <td> U+00111 </td> <tr><td> <code title="">dtdot;</code> </td> <td> U+022F1 </td> <tr><td> <code title="">dtri;</code> </td> <td> U+025BF </td> <tr><td> <code title="">dtrif;</code> </td> <td> U+025BE </td> <tr><td> <code title="">duarr;</code> </td> <td> U+021F5 </td> <tr><td> <code title="">duhar;</code> </td> <td> U+0296F </td> <tr><td> <code title="">dwangle;</code> </td> <td> U+029A6 </td> <tr><td> <code title="">dzcy;</code> </td> <td> U+0045F </td> <tr><td> <code title="">dzigrarr;</code> </td> <td> U+027FF </td> <tr><td> <code title="">eDDot;</code> </td> <td> U+02A77 </td> <tr><td> <code title="">eDot;</code> </td> <td> U+02251 </td> <tr><td> <code title="">eacute;</code> </td> <td> U+000E9 </td> <tr><td> <code title="">eacute</code> </td> <td> U+000E9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">easter;</code> </td> <td> U+02A6E </td> <tr><td> <code title="">ecaron;</code> </td> <td> U+0011B </td> <tr><td> <code title="">ecir;</code> </td> <td> U+02256 </td> <tr><td> <code title="">ecirc;</code> </td> <td> U+000EA </td> <tr><td> <code title="">ecirc</code> </td> <td> U+000EA </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ecolon;</code> </td> <td> U+02255 </td> <tr><td> <code title="">ecy;</code> </td> <td> U+0044D </td> <tr><td> <code title="">edot;</code> </td> <td> U+00117 </td> <tr><td> <code title="">ee;</code> </td> <td> U+02147 </td> <tr><td> <code title="">efDot;</code> </td> <td> U+02252 </td> <tr><td> <code title="">efr;</code> </td> <td> U+1D522 </td> <tr><td> <code title="">eg;</code> </td> <td> U+02A9A </td> <tr><td> <code title="">egrave;</code> </td> <td> U+000E8 </td> <tr><td> <code title="">egrave</code> </td> <td> U+000E8 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">egs;</code> </td> <td> U+02A96 </td> <tr><td> <code title="">egsdot;</code> </td> <td> U+02A98 </td> <tr><td> <code title="">el;</code> </td> <td> U+02A99 </td> <tr><td> <code title="">elinters;</code> </td> <td> U+023E7 </td> <tr><td> <code title="">ell;</code> </td> <td> U+02113 </td> <tr><td> <code title="">els;</code> </td> <td> U+02A95 </td> <tr><td> <code title="">elsdot;</code> </td> <td> U+02A97 </td> <tr><td> <code title="">emacr;</code> </td> <td> U+00113 </td> <tr><td> <code title="">empty;</code> </td> <td> U+02205 </td> <tr><td> <code title="">emptyset;</code> </td> <td> U+02205 </td> <tr><td> <code title="">emptyv;</code> </td> <td> U+02205 </td> <tr><td> <code title="">emsp13;</code> </td> <td> U+02004 </td> <tr><td> <code title="">emsp14;</code> </td> <td> U+02005 </td> <tr><td> <code title="">emsp;</code> </td> <td> U+02003 </td> <tr><td> <code title="">eng;</code> </td> <td> U+0014B </td> <tr><td> <code title="">ensp;</code> </td> <td> U+02002 </td> <tr><td> <code title="">eogon;</code> </td> <td> U+00119 </td> <tr><td> <code title="">eopf;</code> </td> <td> U+1D556 </td> <tr><td> <code title="">epar;</code> </td> <td> U+022D5 </td> <tr><td> <code title="">eparsl;</code> </td> <td> U+029E3 </td> <tr><td> <code title="">eplus;</code> </td> <td> U+02A71 </td> <tr><td> <code title="">epsi;</code> </td> <td> U+003B5 </td> <tr><td> <code title="">epsilon;</code> </td> <td> U+003B5 </td> <tr><td> <code title="">epsiv;</code> </td> <td> U+003F5 </td> <tr><td> <code title="">eqcirc;</code> </td> <td> U+02256 </td> <tr><td> <code title="">eqcolon;</code> </td> <td> U+02255 </td> <tr><td> <code title="">eqsim;</code> </td> <td> U+02242 </td> <tr><td> <code title="">eqslantgtr;</code> </td> <td> U+02A96 </td> <tr><td> <code title="">eqslantless;</code> </td> <td> U+02A95 </td> <tr><td> <code title="">equals;</code> </td> <td> U+0003D </td> <tr><td> <code title="">equest;</code> </td> <td> U+0225F </td> <tr><td> <code title="">equiv;</code> </td> <td> U+02261 </td> <tr><td> <code title="">equivDD;</code> </td> <td> U+02A78 </td> <tr><td> <code title="">eqvparsl;</code> </td> <td> U+029E5 </td> <tr><td> <code title="">erDot;</code> </td> <td> U+02253 </td> <tr><td> <code title="">erarr;</code> </td> <td> U+02971 </td> <tr><td> <code title="">escr;</code> </td> <td> U+0212F </td> <tr><td> <code title="">esdot;</code> </td> <td> U+02250 </td> <tr><td> <code title="">esim;</code> </td> <td> U+02242 </td> <tr><td> <code title="">eta;</code> </td> <td> U+003B7 </td> <tr><td> <code title="">eth;</code> </td> <td> U+000F0 </td> <tr><td> <code title="">eth</code> </td> <td> U+000F0 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">euml;</code> </td> <td> U+000EB </td> <tr><td> <code title="">euml</code> </td> <td> U+000EB </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">euro;</code> </td> <td> U+020AC </td> <tr><td> <code title="">excl;</code> </td> <td> U+00021 </td> <tr><td> <code title="">exist;</code> </td> <td> U+02203 </td> <tr><td> <code title="">expectation;</code> </td> <td> U+02130 </td> <tr><td> <code title="">exponentiale;</code> </td> <td> U+02147 </td> <tr><td> <code title="">fallingdotseq;</code> </td> <td> U+02252 </td> <tr><td> <code title="">fcy;</code> </td> <td> U+00444 </td> <tr><td> <code title="">female;</code> </td> <td> U+02640 </td> <tr><td> <code title="">ffilig;</code> </td> <td> U+0FB03 </td> <tr><td> <code title="">fflig;</code> </td> <td> U+0FB00 </td> <tr><td> <code title="">ffllig;</code> </td> <td> U+0FB04 </td> <tr><td> <code title="">ffr;</code> </td> <td> U+1D523 </td> <tr><td> <code title="">filig;</code> </td> <td> U+0FB01 </td> <tr><td> <code title="">flat;</code> </td> <td> U+0266D </td> <tr><td> <code title="">fllig;</code> </td> <td> U+0FB02 </td> <tr><td> <code title="">fltns;</code> </td> <td> U+025B1 </td> <tr><td> <code title="">fnof;</code> </td> <td> U+00192 </td> <tr><td> <code title="">fopf;</code> </td> <td> U+1D557 </td> <tr><td> <code title="">forall;</code> </td> <td> U+02200 </td> <tr><td> <code title="">fork;</code> </td> <td> U+022D4 </td> <tr><td> <code title="">forkv;</code> </td> <td> U+02AD9 </td> <tr><td> <code title="">fpartint;</code> </td> <td> U+02A0D </td> <tr><td> <code title="">frac12;</code> </td> <td> U+000BD </td> <tr><td> <code title="">frac12</code> </td> <td> U+000BD </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">frac13;</code> </td> <td> U+02153 </td> <tr><td> <code title="">frac14;</code> </td> <td> U+000BC </td> <tr><td> <code title="">frac14</code> </td> <td> U+000BC </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">frac15;</code> </td> <td> U+02155 </td> <tr><td> <code title="">frac16;</code> </td> <td> U+02159 </td> <tr><td> <code title="">frac18;</code> </td> <td> U+0215B </td> <tr><td> <code title="">frac23;</code> </td> <td> U+02154 </td> <tr><td> <code title="">frac25;</code> </td> <td> U+02156 </td> <tr><td> <code title="">frac34;</code> </td> <td> U+000BE </td> <tr><td> <code title="">frac34</code> </td> <td> U+000BE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">frac35;</code> </td> <td> U+02157 </td> <tr><td> <code title="">frac38;</code> </td> <td> U+0215C </td> <tr><td> <code title="">frac45;</code> </td> <td> U+02158 </td> <tr><td> <code title="">frac56;</code> </td> <td> U+0215A </td> <tr><td> <code title="">frac58;</code> </td> <td> U+0215D </td> <tr><td> <code title="">frac78;</code> </td> <td> U+0215E </td> <tr><td> <code title="">frasl;</code> </td> <td> U+02044 </td> <tr><td> <code title="">frown;</code> </td> <td> U+02322 </td> <tr><td> <code title="">fscr;</code> </td> <td> U+1D4BB </td> <tr><td> <code title="">gE;</code> </td> <td> U+02267 </td> <tr><td> <code title="">gEl;</code> </td> <td> U+02A8C </td> <tr><td> <code title="">gacute;</code> </td> <td> U+001F5 </td> <tr><td> <code title="">gamma;</code> </td> <td> U+003B3 </td> <tr><td> <code title="">gammad;</code> </td> <td> U+003DD </td> <tr><td> <code title="">gap;</code> </td> <td> U+02A86 </td> <tr><td> <code title="">gbreve;</code> </td> <td> U+0011F </td> <tr><td> <code title="">gcirc;</code> </td> <td> U+0011D </td> <tr><td> <code title="">gcy;</code> </td> <td> U+00433 </td> <tr><td> <code title="">gdot;</code> </td> <td> U+00121 </td> <tr><td> <code title="">ge;</code> </td> <td> U+02265 </td> <tr><td> <code title="">gel;</code> </td> <td> U+022DB </td> <tr><td> <code title="">geq;</code> </td> <td> U+02265 </td> <tr><td> <code title="">geqq;</code> </td> <td> U+02267 </td> <tr><td> <code title="">geqslant;</code> </td> <td> U+02A7E </td> <tr><td> <code title="">ges;</code> </td> <td> U+02A7E </td> <tr><td> <code title="">gescc;</code> </td> <td> U+02AA9 </td> <tr><td> <code title="">gesdot;</code> </td> <td> U+02A80 </td> <tr><td> <code title="">gesdoto;</code> </td> <td> U+02A82 </td> <tr><td> <code title="">gesdotol;</code> </td> <td> U+02A84 </td> <tr><td> <code title="">gesles;</code> </td> <td> U+02A94 </td> <tr><td> <code title="">gfr;</code> </td> <td> U+1D524 </td> <tr><td> <code title="">gg;</code> </td> <td> U+0226B </td> <tr><td> <code title="">ggg;</code> </td> <td> U+022D9 </td> <tr><td> <code title="">gimel;</code> </td> <td> U+02137 </td> <tr><td> <code title="">gjcy;</code> </td> <td> U+00453 </td> <tr><td> <code title="">gl;</code> </td> <td> U+02277 </td> <tr><td> <code title="">glE;</code> </td> <td> U+02A92 </td> <tr><td> <code title="">gla;</code> </td> <td> U+02AA5 </td> <tr><td> <code title="">glj;</code> </td> <td> U+02AA4 </td> <tr><td> <code title="">gnE;</code> </td> <td> U+02269 </td> <tr><td> <code title="">gnap;</code> </td> <td> U+02A8A </td> <tr><td> <code title="">gnapprox;</code> </td> <td> U+02A8A </td> <tr><td> <code title="">gne;</code> </td> <td> U+02A88 </td> <tr><td> <code title="">gneq;</code> </td> <td> U+02A88 </td> <tr><td> <code title="">gneqq;</code> </td> <td> U+02269 </td> <tr><td> <code title="">gnsim;</code> </td> <td> U+022E7 </td> <tr><td> <code title="">gopf;</code> </td> <td> U+1D558 </td> <tr><td> <code title="">grave;</code> </td> <td> U+00060 </td> <tr><td> <code title="">gscr;</code> </td> <td> U+0210A </td> <tr><td> <code title="">gsim;</code> </td> <td> U+02273 </td> <tr><td> <code title="">gsime;</code> </td> <td> U+02A8E </td> <tr><td> <code title="">gsiml;</code> </td> <td> U+02A90 </td> <tr><td> <code title="">gt;</code> </td> <td> U+0003E </td> <tr><td> <code title="">gt</code> </td> <td> U+0003E </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">gtcc;</code> </td> <td> U+02AA7 </td> <tr><td> <code title="">gtcir;</code> </td> <td> U+02A7A </td> <tr><td> <code title="">gtdot;</code> </td> <td> U+022D7 </td> <tr><td> <code title="">gtlPar;</code> </td> <td> U+02995 </td> <tr><td> <code title="">gtquest;</code> </td> <td> U+02A7C </td> <tr><td> <code title="">gtrapprox;</code> </td> <td> U+02A86 </td> <tr><td> <code title="">gtrarr;</code> </td> <td> U+02978 </td> <tr><td> <code title="">gtrdot;</code> </td> <td> U+022D7 </td> <tr><td> <code title="">gtreqless;</code> </td> <td> U+022DB </td> <tr><td> <code title="">gtreqqless;</code> </td> <td> U+02A8C </td> <tr><td> <code title="">gtrless;</code> </td> <td> U+02277 </td> <tr><td> <code title="">gtrsim;</code> </td> <td> U+02273 </td> <tr><td> <code title="">hArr;</code> </td> <td> U+021D4 </td> <tr><td> <code title="">hairsp;</code> </td> <td> U+0200A </td> <tr><td> <code title="">half;</code> </td> <td> U+000BD </td> <tr><td> <code title="">hamilt;</code> </td> <td> U+0210B </td> <tr><td> <code title="">hardcy;</code> </td> <td> U+0044A </td> <tr><td> <code title="">harr;</code> </td> <td> U+02194 </td> <tr><td> <code title="">harrcir;</code> </td> <td> U+02948 </td> <tr><td> <code title="">harrw;</code> </td> <td> U+021AD </td> <tr><td> <code title="">hbar;</code> </td> <td> U+0210F </td> <tr><td> <code title="">hcirc;</code> </td> <td> U+00125 </td> <tr><td> <code title="">hearts;</code> </td> <td> U+02665 </td> <tr><td> <code title="">heartsuit;</code> </td> <td> U+02665 </td> <tr><td> <code title="">hellip;</code> </td> <td> U+02026 </td> <tr><td> <code title="">hercon;</code> </td> <td> U+022B9 </td> <tr><td> <code title="">hfr;</code> </td> <td> U+1D525 </td> <tr><td> <code title="">hksearow;</code> </td> <td> U+02925 </td> <tr><td> <code title="">hkswarow;</code> </td> <td> U+02926 </td> <tr><td> <code title="">hoarr;</code> </td> <td> U+021FF </td> <tr><td> <code title="">homtht;</code> </td> <td> U+0223B </td> <tr><td> <code title="">hookleftarrow;</code> </td> <td> U+021A9 </td> <tr><td> <code title="">hookrightarrow;</code> </td> <td> U+021AA </td> <tr><td> <code title="">hopf;</code> </td> <td> U+1D559 </td> <tr><td> <code title="">horbar;</code> </td> <td> U+02015 </td> <tr><td> <code title="">hscr;</code> </td> <td> U+1D4BD </td> <tr><td> <code title="">hslash;</code> </td> <td> U+0210F </td> <tr><td> <code title="">hstrok;</code> </td> <td> U+00127 </td> <tr><td> <code title="">hybull;</code> </td> <td> U+02043 </td> <tr><td> <code title="">hyphen;</code> </td> <td> U+02010 </td> <tr><td> <code title="">iacute;</code> </td> <td> U+000ED </td> <tr><td> <code title="">iacute</code> </td> <td> U+000ED </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ic;</code> </td> <td> U+02063 </td> <tr><td> <code title="">icirc;</code> </td> <td> U+000EE </td> <tr><td> <code title="">icirc</code> </td> <td> U+000EE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">icy;</code> </td> <td> U+00438 </td> <tr><td> <code title="">iecy;</code> </td> <td> U+00435 </td> <tr><td> <code title="">iexcl;</code> </td> <td> U+000A1 </td> <tr><td> <code title="">iexcl</code> </td> <td> U+000A1 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">iff;</code> </td> <td> U+021D4 </td> <tr><td> <code title="">ifr;</code> </td> <td> U+1D526 </td> <tr><td> <code title="">igrave;</code> </td> <td> U+000EC </td> <tr><td> <code title="">igrave</code> </td> <td> U+000EC </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ii;</code> </td> <td> U+02148 </td> <tr><td> <code title="">iiiint;</code> </td> <td> U+02A0C </td> <tr><td> <code title="">iiint;</code> </td> <td> U+0222D </td> <tr><td> <code title="">iinfin;</code> </td> <td> U+029DC </td> <tr><td> <code title="">iiota;</code> </td> <td> U+02129 </td> <tr><td> <code title="">ijlig;</code> </td> <td> U+00133 </td> <tr><td> <code title="">imacr;</code> </td> <td> U+0012B </td> <tr><td> <code title="">image;</code> </td> <td> U+02111 </td> <tr><td> <code title="">imagline;</code> </td> <td> U+02110 </td> <tr><td> <code title="">imagpart;</code> </td> <td> U+02111 </td> <tr><td> <code title="">imath;</code> </td> <td> U+00131 </td> <tr><td> <code title="">imof;</code> </td> <td> U+022B7 </td> <tr><td> <code title="">imped;</code> </td> <td> U+001B5 </td> <tr><td> <code title="">in;</code> </td> <td> U+02208 </td> <tr><td> <code title="">incare;</code> </td> <td> U+02105 </td> <tr><td> <code title="">infin;</code> </td> <td> U+0221E </td> <tr><td> <code title="">infintie;</code> </td> <td> U+029DD </td> <tr><td> <code title="">inodot;</code> </td> <td> U+00131 </td> <tr><td> <code title="">int;</code> </td> <td> U+0222B </td> <tr><td> <code title="">intcal;</code> </td> <td> U+022BA </td> <tr><td> <code title="">integers;</code> </td> <td> U+02124 </td> <tr><td> <code title="">intercal;</code> </td> <td> U+022BA </td> <tr><td> <code title="">intlarhk;</code> </td> <td> U+02A17 </td> <tr><td> <code title="">intprod;</code> </td> <td> U+02A3C </td> <tr><td> <code title="">iocy;</code> </td> <td> U+00451 </td> <tr><td> <code title="">iogon;</code> </td> <td> U+0012F </td> <tr><td> <code title="">iopf;</code> </td> <td> U+1D55A </td> <tr><td> <code title="">iota;</code> </td> <td> U+003B9 </td> <tr><td> <code title="">iprod;</code> </td> <td> U+02A3C </td> <tr><td> <code title="">iquest;</code> </td> <td> U+000BF </td> <tr><td> <code title="">iquest</code> </td> <td> U+000BF </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">iscr;</code> </td> <td> U+1D4BE </td> <tr><td> <code title="">isin;</code> </td> <td> U+02208 </td> <tr><td> <code title="">isinE;</code> </td> <td> U+022F9 </td> <tr><td> <code title="">isindot;</code> </td> <td> U+022F5 </td> <tr><td> <code title="">isins;</code> </td> <td> U+022F4 </td> <tr><td> <code title="">isinsv;</code> </td> <td> U+022F3 </td> <tr><td> <code title="">isinv;</code> </td> <td> U+02208 </td> <tr><td> <code title="">it;</code> </td> <td> U+02062 </td> <tr><td> <code title="">itilde;</code> </td> <td> U+00129 </td> <tr><td> <code title="">iukcy;</code> </td> <td> U+00456 </td> <tr><td> <code title="">iuml;</code> </td> <td> U+000EF </td> <tr><td> <code title="">iuml</code> </td> <td> U+000EF </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">jcirc;</code> </td> <td> U+00135 </td> <tr><td> <code title="">jcy;</code> </td> <td> U+00439 </td> <tr><td> <code title="">jfr;</code> </td> <td> U+1D527 </td> <tr><td> <code title="">jmath;</code> </td> <td> U+00237 </td> <tr><td> <code title="">jopf;</code> </td> <td> U+1D55B </td> <tr><td> <code title="">jscr;</code> </td> <td> U+1D4BF </td> <tr><td> <code title="">jsercy;</code> </td> <td> U+00458 </td> <tr><td> <code title="">jukcy;</code> </td> <td> U+00454 </td> <tr><td> <code title="">kappa;</code> </td> <td> U+003BA </td> <tr><td> <code title="">kappav;</code> </td> <td> U+003F0 </td> <tr><td> <code title="">kcedil;</code> </td> <td> U+00137 </td> <tr><td> <code title="">kcy;</code> </td> <td> U+0043A </td> <tr><td> <code title="">kfr;</code> </td> <td> U+1D528 </td> <tr><td> <code title="">kgreen;</code> </td> <td> U+00138 </td> <tr><td> <code title="">khcy;</code> </td> <td> U+00445 </td> <tr><td> <code title="">kjcy;</code> </td> <td> U+0045C </td> <tr><td> <code title="">kopf;</code> </td> <td> U+1D55C </td> <tr><td> <code title="">kscr;</code> </td> <td> U+1D4C0 </td> <tr><td> <code title="">lAarr;</code> </td> <td> U+021DA </td> <tr><td> <code title="">lArr;</code> </td> <td> U+021D0 </td> <tr><td> <code title="">lAtail;</code> </td> <td> U+0291B </td> <tr><td> <code title="">lBarr;</code> </td> <td> U+0290E </td> <tr><td> <code title="">lE;</code> </td> <td> U+02266 </td> <tr><td> <code title="">lEg;</code> </td> <td> U+02A8B </td> <tr><td> <code title="">lHar;</code> </td> <td> U+02962 </td> <tr><td> <code title="">lacute;</code> </td> <td> U+0013A </td> <tr><td> <code title="">laemptyv;</code> </td> <td> U+029B4 </td> <tr><td> <code title="">lagran;</code> </td> <td> U+02112 </td> <tr><td> <code title="">lambda;</code> </td> <td> U+003BB </td> <tr><td> <code title="">lang;</code> </td> <td> U+027E8 </td> <tr><td> <code title="">langd;</code> </td> <td> U+02991 </td> <tr><td> <code title="">langle;</code> </td> <td> U+027E8 </td> <tr><td> <code title="">lap;</code> </td> <td> U+02A85 </td> <tr><td> <code title="">laquo;</code> </td> <td> U+000AB </td> <tr><td> <code title="">laquo</code> </td> <td> U+000AB </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">larr;</code> </td> <td> U+02190 </td> <tr><td> <code title="">larrb;</code> </td> <td> U+021E4 </td> <tr><td> <code title="">larrbfs;</code> </td> <td> U+0291F </td> <tr><td> <code title="">larrfs;</code> </td> <td> U+0291D </td> <tr><td> <code title="">larrhk;</code> </td> <td> U+021A9 </td> <tr><td> <code title="">larrlp;</code> </td> <td> U+021AB </td> <tr><td> <code title="">larrpl;</code> </td> <td> U+02939 </td> <tr><td> <code title="">larrsim;</code> </td> <td> U+02973 </td> <tr><td> <code title="">larrtl;</code> </td> <td> U+021A2 </td> <tr><td> <code title="">lat;</code> </td> <td> U+02AAB </td> <tr><td> <code title="">latail;</code> </td> <td> U+02919 </td> <tr><td> <code title="">late;</code> </td> <td> U+02AAD </td> <tr><td> <code title="">lbarr;</code> </td> <td> U+0290C </td> <tr><td> <code title="">lbbrk;</code> </td> <td> U+02772 </td> <tr><td> <code title="">lbrace;</code> </td> <td> U+0007B </td> <tr><td> <code title="">lbrack;</code> </td> <td> U+0005B </td> <tr><td> <code title="">lbrke;</code> </td> <td> U+0298B </td> <tr><td> <code title="">lbrksld;</code> </td> <td> U+0298F </td> <tr><td> <code title="">lbrkslu;</code> </td> <td> U+0298D </td> <tr><td> <code title="">lcaron;</code> </td> <td> U+0013E </td> <tr><td> <code title="">lcedil;</code> </td> <td> U+0013C </td> <tr><td> <code title="">lceil;</code> </td> <td> U+02308 </td> <tr><td> <code title="">lcub;</code> </td> <td> U+0007B </td> <tr><td> <code title="">lcy;</code> </td> <td> U+0043B </td> <tr><td> <code title="">ldca;</code> </td> <td> U+02936 </td> <tr><td> <code title="">ldquo;</code> </td> <td> U+0201C </td> <tr><td> <code title="">ldquor;</code> </td> <td> U+0201E </td> <tr><td> <code title="">ldrdhar;</code> </td> <td> U+02967 </td> <tr><td> <code title="">ldrushar;</code> </td> <td> U+0294B </td> <tr><td> <code title="">ldsh;</code> </td> <td> U+021B2 </td> <tr><td> <code title="">le;</code> </td> <td> U+02264 </td> <tr><td> <code title="">leftarrow;</code> </td> <td> U+02190 </td> <tr><td> <code title="">leftarrowtail;</code> </td> <td> U+021A2 </td> <tr><td> <code title="">leftharpoondown;</code> </td> <td> U+021BD </td> <tr><td> <code title="">leftharpoonup;</code> </td> <td> U+021BC </td> <tr><td> <code title="">leftleftarrows;</code> </td> <td> U+021C7 </td> <tr><td> <code title="">leftrightarrow;</code> </td> <td> U+02194 </td> <tr><td> <code title="">leftrightarrows;</code> </td> <td> U+021C6 </td> <tr><td> <code title="">leftrightharpoons;</code> </td> <td> U+021CB </td> <tr><td> <code title="">leftrightsquigarrow;</code> </td> <td> U+021AD </td> <tr><td> <code title="">leftthreetimes;</code> </td> <td> U+022CB </td> <tr><td> <code title="">leg;</code> </td> <td> U+022DA </td> <tr><td> <code title="">leq;</code> </td> <td> U+02264 </td> <tr><td> <code title="">leqq;</code> </td> <td> U+02266 </td> <tr><td> <code title="">leqslant;</code> </td> <td> U+02A7D </td> <tr><td> <code title="">les;</code> </td> <td> U+02A7D </td> <tr><td> <code title="">lescc;</code> </td> <td> U+02AA8 </td> <tr><td> <code title="">lesdot;</code> </td> <td> U+02A7F </td> <tr><td> <code title="">lesdoto;</code> </td> <td> U+02A81 </td> <tr><td> <code title="">lesdotor;</code> </td> <td> U+02A83 </td> <tr><td> <code title="">lesges;</code> </td> <td> U+02A93 </td> <tr><td> <code title="">lessapprox;</code> </td> <td> U+02A85 </td> <tr><td> <code title="">lessdot;</code> </td> <td> U+022D6 </td> <tr><td> <code title="">lesseqgtr;</code> </td> <td> U+022DA </td> <tr><td> <code title="">lesseqqgtr;</code> </td> <td> U+02A8B </td> <tr><td> <code title="">lessgtr;</code> </td> <td> U+02276 </td> <tr><td> <code title="">lesssim;</code> </td> <td> U+02272 </td> <tr><td> <code title="">lfisht;</code> </td> <td> U+0297C </td> <tr><td> <code title="">lfloor;</code> </td> <td> U+0230A </td> <tr><td> <code title="">lfr;</code> </td> <td> U+1D529 </td> <tr><td> <code title="">lg;</code> </td> <td> U+02276 </td> <tr><td> <code title="">lgE;</code> </td> <td> U+02A91 </td> <tr><td> <code title="">lhard;</code> </td> <td> U+021BD </td> <tr><td> <code title="">lharu;</code> </td> <td> U+021BC </td> <tr><td> <code title="">lharul;</code> </td> <td> U+0296A </td> <tr><td> <code title="">lhblk;</code> </td> <td> U+02584 </td> <tr><td> <code title="">ljcy;</code> </td> <td> U+00459 </td> <tr><td> <code title="">ll;</code> </td> <td> U+0226A </td> <tr><td> <code title="">llarr;</code> </td> <td> U+021C7 </td> <tr><td> <code title="">llcorner;</code> </td> <td> U+0231E </td> <tr><td> <code title="">llhard;</code> </td> <td> U+0296B </td> <tr><td> <code title="">lltri;</code> </td> <td> U+025FA </td> <tr><td> <code title="">lmidot;</code> </td> <td> U+00140 </td> <tr><td> <code title="">lmoust;</code> </td> <td> U+023B0 </td> <tr><td> <code title="">lmoustache;</code> </td> <td> U+023B0 </td> <tr><td> <code title="">lnE;</code> </td> <td> U+02268 </td> <tr><td> <code title="">lnap;</code> </td> <td> U+02A89 </td> <tr><td> <code title="">lnapprox;</code> </td> <td> U+02A89 </td> <tr><td> <code title="">lne;</code> </td> <td> U+02A87 </td> <tr><td> <code title="">lneq;</code> </td> <td> U+02A87 </td> <tr><td> <code title="">lneqq;</code> </td> <td> U+02268 </td> <tr><td> <code title="">lnsim;</code> </td> <td> U+022E6 </td> <tr><td> <code title="">loang;</code> </td> <td> U+027EC </td> <tr><td> <code title="">loarr;</code> </td> <td> U+021FD </td> <tr><td> <code title="">lobrk;</code> </td> <td> U+027E6 </td> <tr><td> <code title="">longleftarrow;</code> </td> <td> U+027F5 </td> <tr><td> <code title="">longleftrightarrow;</code> </td> <td> U+027F7 </td> <tr><td> <code title="">longmapsto;</code> </td> <td> U+027FC </td> <tr><td> <code title="">longrightarrow;</code> </td> <td> U+027F6 </td> <tr><td> <code title="">looparrowleft;</code> </td> <td> U+021AB </td> <tr><td> <code title="">looparrowright;</code> </td> <td> U+021AC </td> <tr><td> <code title="">lopar;</code> </td> <td> U+02985 </td> <tr><td> <code title="">lopf;</code> </td> <td> U+1D55D </td> <tr><td> <code title="">loplus;</code> </td> <td> U+02A2D </td> <tr><td> <code title="">lotimes;</code> </td> <td> U+02A34 </td> <tr><td> <code title="">lowast;</code> </td> <td> U+02217 </td> <tr><td> <code title="">lowbar;</code> </td> <td> U+0005F </td> <tr><td> <code title="">loz;</code> </td> <td> U+025CA </td> <tr><td> <code title="">lozenge;</code> </td> <td> U+025CA </td> <tr><td> <code title="">lozf;</code> </td> <td> U+029EB </td> <tr><td> <code title="">lpar;</code> </td> <td> U+00028 </td> <tr><td> <code title="">lparlt;</code> </td> <td> U+02993 </td> <tr><td> <code title="">lrarr;</code> </td> <td> U+021C6 </td> <tr><td> <code title="">lrcorner;</code> </td> <td> U+0231F </td> <tr><td> <code title="">lrhar;</code> </td> <td> U+021CB </td> <tr><td> <code title="">lrhard;</code> </td> <td> U+0296D </td> <tr><td> <code title="">lrm;</code> </td> <td> U+0200E </td> <tr><td> <code title="">lrtri;</code> </td> <td> U+022BF </td> <tr><td> <code title="">lsaquo;</code> </td> <td> U+02039 </td> <tr><td> <code title="">lscr;</code> </td> <td> U+1D4C1 </td> <tr><td> <code title="">lsh;</code> </td> <td> U+021B0 </td> <tr><td> <code title="">lsim;</code> </td> <td> U+02272 </td> <tr><td> <code title="">lsime;</code> </td> <td> U+02A8D </td> <tr><td> <code title="">lsimg;</code> </td> <td> U+02A8F </td> <tr><td> <code title="">lsqb;</code> </td> <td> U+0005B </td> <tr><td> <code title="">lsquo;</code> </td> <td> U+02018 </td> <tr><td> <code title="">lsquor;</code> </td> <td> U+0201A </td> <tr><td> <code title="">lstrok;</code> </td> <td> U+00142 </td> <tr><td> <code title="">lt;</code> </td> <td> U+0003C </td> <tr><td> <code title="">lt</code> </td> <td> U+0003C </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ltcc;</code> </td> <td> U+02AA6 </td> <tr><td> <code title="">ltcir;</code> </td> <td> U+02A79 </td> <tr><td> <code title="">ltdot;</code> </td> <td> U+022D6 </td> <tr><td> <code title="">lthree;</code> </td> <td> U+022CB </td> <tr><td> <code title="">ltimes;</code> </td> <td> U+022C9 </td> <tr><td> <code title="">ltlarr;</code> </td> <td> U+02976 </td> <tr><td> <code title="">ltquest;</code> </td> <td> U+02A7B </td> <tr><td> <code title="">ltrPar;</code> </td> <td> U+02996 </td> <tr><td> <code title="">ltri;</code> </td> <td> U+025C3 </td> <tr><td> <code title="">ltrie;</code> </td> <td> U+022B4 </td> <tr><td> <code title="">ltrif;</code> </td> <td> U+025C2 </td> <tr><td> <code title="">lurdshar;</code> </td> <td> U+0294A </td> <tr><td> <code title="">luruhar;</code> </td> <td> U+02966 </td> <tr><td> <code title="">mDDot;</code> </td> <td> U+0223A </td> <tr><td> <code title="">macr;</code> </td> <td> U+000AF </td> <tr><td> <code title="">macr</code> </td> <td> U+000AF </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">male;</code> </td> <td> U+02642 </td> <tr><td> <code title="">malt;</code> </td> <td> U+02720 </td> <tr><td> <code title="">maltese;</code> </td> <td> U+02720 </td> <tr><td> <code title="">map;</code> </td> <td> U+021A6 </td> <tr><td> <code title="">mapsto;</code> </td> <td> U+021A6 </td> <tr><td> <code title="">mapstodown;</code> </td> <td> U+021A7 </td> <tr><td> <code title="">mapstoleft;</code> </td> <td> U+021A4 </td> <tr><td> <code title="">mapstoup;</code> </td> <td> U+021A5 </td> <tr><td> <code title="">marker;</code> </td> <td> U+025AE </td> <tr><td> <code title="">mcomma;</code> </td> <td> U+02A29 </td> <tr><td> <code title="">mcy;</code> </td> <td> U+0043C </td> <tr><td> <code title="">mdash;</code> </td> <td> U+02014 </td> <tr><td> <code title="">measuredangle;</code> </td> <td> U+02221 </td> <tr><td> <code title="">mfr;</code> </td> <td> U+1D52A </td> <tr><td> <code title="">mho;</code> </td> <td> U+02127 </td> <tr><td> <code title="">micro;</code> </td> <td> U+000B5 </td> <tr><td> <code title="">micro</code> </td> <td> U+000B5 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">mid;</code> </td> <td> U+02223 </td> <tr><td> <code title="">midast;</code> </td> <td> U+0002A </td> <tr><td> <code title="">midcir;</code> </td> <td> U+02AF0 </td> <tr><td> <code title="">middot;</code> </td> <td> U+000B7 </td> <tr><td> <code title="">middot</code> </td> <td> U+000B7 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">minus;</code> </td> <td> U+02212 </td> <tr><td> <code title="">minusb;</code> </td> <td> U+0229F </td> <tr><td> <code title="">minusd;</code> </td> <td> U+02238 </td> <tr><td> <code title="">minusdu;</code> </td> <td> U+02A2A </td> <tr><td> <code title="">mlcp;</code> </td> <td> U+02ADB </td> <tr><td> <code title="">mldr;</code> </td> <td> U+02026 </td> <tr><td> <code title="">mnplus;</code> </td> <td> U+02213 </td> <tr><td> <code title="">models;</code> </td> <td> U+022A7 </td> <tr><td> <code title="">mopf;</code> </td> <td> U+1D55E </td> <tr><td> <code title="">mp;</code> </td> <td> U+02213 </td> <tr><td> <code title="">mscr;</code> </td> <td> U+1D4C2 </td> <tr><td> <code title="">mstpos;</code> </td> <td> U+0223E </td> <tr><td> <code title="">mu;</code> </td> <td> U+003BC </td> <tr><td> <code title="">multimap;</code> </td> <td> U+022B8 </td> <tr><td> <code title="">mumap;</code> </td> <td> U+022B8 </td> <tr><td> <code title="">nLeftarrow;</code> </td> <td> U+021CD </td> <tr><td> <code title="">nLeftrightarrow;</code> </td> <td> U+021CE </td> <tr><td> <code title="">nRightarrow;</code> </td> <td> U+021CF </td> <tr><td> <code title="">nVDash;</code> </td> <td> U+022AF </td> <tr><td> <code title="">nVdash;</code> </td> <td> U+022AE </td> <tr><td> <code title="">nabla;</code> </td> <td> U+02207 </td> <tr><td> <code title="">nacute;</code> </td> <td> U+00144 </td> <tr><td> <code title="">nap;</code> </td> <td> U+02249 </td> <tr><td> <code title="">napos;</code> </td> <td> U+00149 </td> <tr><td> <code title="">napprox;</code> </td> <td> U+02249 </td> <tr><td> <code title="">natur;</code> </td> <td> U+0266E </td> <tr><td> <code title="">natural;</code> </td> <td> U+0266E </td> <tr><td> <code title="">naturals;</code> </td> <td> U+02115 </td> <tr><td> <code title="">nbsp;</code> </td> <td> U+000A0 </td> <tr><td> <code title="">nbsp</code> </td> <td> U+000A0 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ncap;</code> </td> <td> U+02A43 </td> <tr><td> <code title="">ncaron;</code> </td> <td> U+00148 </td> <tr><td> <code title="">ncedil;</code> </td> <td> U+00146 </td> <tr><td> <code title="">ncong;</code> </td> <td> U+02247 </td> <tr><td> <code title="">ncup;</code> </td> <td> U+02A42 </td> <tr><td> <code title="">ncy;</code> </td> <td> U+0043D </td> <tr><td> <code title="">ndash;</code> </td> <td> U+02013 </td> <tr><td> <code title="">ne;</code> </td> <td> U+02260 </td> <tr><td> <code title="">neArr;</code> </td> <td> U+021D7 </td> <tr><td> <code title="">nearhk;</code> </td> <td> U+02924 </td> <tr><td> <code title="">nearr;</code> </td> <td> U+02197 </td> <tr><td> <code title="">nearrow;</code> </td> <td> U+02197 </td> <tr><td> <code title="">nequiv;</code> </td> <td> U+02262 </td> <tr><td> <code title="">nesear;</code> </td> <td> U+02928 </td> <tr><td> <code title="">nexist;</code> </td> <td> U+02204 </td> <tr><td> <code title="">nexists;</code> </td> <td> U+02204 </td> <tr><td> <code title="">nfr;</code> </td> <td> U+1D52B </td> <tr><td> <code title="">nge;</code> </td> <td> U+02271 </td> <tr><td> <code title="">ngeq;</code> </td> <td> U+02271 </td> <tr><td> <code title="">ngsim;</code> </td> <td> U+02275 </td> <tr><td> <code title="">ngt;</code> </td> <td> U+0226F </td> <tr><td> <code title="">ngtr;</code> </td> <td> U+0226F </td> <tr><td> <code title="">nhArr;</code> </td> <td> U+021CE </td> <tr><td> <code title="">nharr;</code> </td> <td> U+021AE </td> <tr><td> <code title="">nhpar;</code> </td> <td> U+02AF2 </td> <tr><td> <code title="">ni;</code> </td> <td> U+0220B </td> <tr><td> <code title="">nis;</code> </td> <td> U+022FC </td> <tr><td> <code title="">nisd;</code> </td> <td> U+022FA </td> <tr><td> <code title="">niv;</code> </td> <td> U+0220B </td> <tr><td> <code title="">njcy;</code> </td> <td> U+0045A </td> <tr><td> <code title="">nlArr;</code> </td> <td> U+021CD </td> <tr><td> <code title="">nlarr;</code> </td> <td> U+0219A </td> <tr><td> <code title="">nldr;</code> </td> <td> U+02025 </td> <tr><td> <code title="">nle;</code> </td> <td> U+02270 </td> <tr><td> <code title="">nleftarrow;</code> </td> <td> U+0219A </td> <tr><td> <code title="">nleftrightarrow;</code> </td> <td> U+021AE </td> <tr><td> <code title="">nleq;</code> </td> <td> U+02270 </td> <tr><td> <code title="">nless;</code> </td> <td> U+0226E </td> <tr><td> <code title="">nlsim;</code> </td> <td> U+02274 </td> <tr><td> <code title="">nlt;</code> </td> <td> U+0226E </td> <tr><td> <code title="">nltri;</code> </td> <td> U+022EA </td> <tr><td> <code title="">nltrie;</code> </td> <td> U+022EC </td> <tr><td> <code title="">nmid;</code> </td> <td> U+02224 </td> <tr><td> <code title="">nopf;</code> </td> <td> U+1D55F </td> <tr><td> <code title="">not;</code> </td> <td> U+000AC </td> <tr><td> <code title="">not</code> </td> <td> U+000AC </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">notin;</code> </td> <td> U+02209 </td> <tr><td> <code title="">notinva;</code> </td> <td> U+02209 </td> <tr><td> <code title="">notinvb;</code> </td> <td> U+022F7 </td> <tr><td> <code title="">notinvc;</code> </td> <td> U+022F6 </td> <tr><td> <code title="">notni;</code> </td> <td> U+0220C </td> <tr><td> <code title="">notniva;</code> </td> <td> U+0220C </td> <tr><td> <code title="">notnivb;</code> </td> <td> U+022FE </td> <tr><td> <code title="">notnivc;</code> </td> <td> U+022FD </td> <tr><td> <code title="">npar;</code> </td> <td> U+02226 </td> <tr><td> <code title="">nparallel;</code> </td> <td> U+02226 </td> <tr><td> <code title="">npolint;</code> </td> <td> U+02A14 </td> <tr><td> <code title="">npr;</code> </td> <td> U+02280 </td> <tr><td> <code title="">nprcue;</code> </td> <td> U+022E0 </td> <tr><td> <code title="">nprec;</code> </td> <td> U+02280 </td> <tr><td> <code title="">nrArr;</code> </td> <td> U+021CF </td> <tr><td> <code title="">nrarr;</code> </td> <td> U+0219B </td> <tr><td> <code title="">nrightarrow;</code> </td> <td> U+0219B </td> <tr><td> <code title="">nrtri;</code> </td> <td> U+022EB </td> <tr><td> <code title="">nrtrie;</code> </td> <td> U+022ED </td> <tr><td> <code title="">nsc;</code> </td> <td> U+02281 </td> <tr><td> <code title="">nsccue;</code> </td> <td> U+022E1 </td> <tr><td> <code title="">nscr;</code> </td> <td> U+1D4C3 </td> <tr><td> <code title="">nshortmid;</code> </td> <td> U+02224 </td> <tr><td> <code title="">nshortparallel;</code> </td> <td> U+02226 </td> <tr><td> <code title="">nsim;</code> </td> <td> U+02241 </td> <tr><td> <code title="">nsime;</code> </td> <td> U+02244 </td> <tr><td> <code title="">nsimeq;</code> </td> <td> U+02244 </td> <tr><td> <code title="">nsmid;</code> </td> <td> U+02224 </td> <tr><td> <code title="">nspar;</code> </td> <td> U+02226 </td> <tr><td> <code title="">nsqsube;</code> </td> <td> U+022E2 </td> <tr><td> <code title="">nsqsupe;</code> </td> <td> U+022E3 </td> <tr><td> <code title="">nsub;</code> </td> <td> U+02284 </td> <tr><td> <code title="">nsube;</code> </td> <td> U+02288 </td> <tr><td> <code title="">nsubseteq;</code> </td> <td> U+02288 </td> <tr><td> <code title="">nsucc;</code> </td> <td> U+02281 </td> <tr><td> <code title="">nsup;</code> </td> <td> U+02285 </td> <tr><td> <code title="">nsupe;</code> </td> <td> U+02289 </td> <tr><td> <code title="">nsupseteq;</code> </td> <td> U+02289 </td> <tr><td> <code title="">ntgl;</code> </td> <td> U+02279 </td> <tr><td> <code title="">ntilde;</code> </td> <td> U+000F1 </td> <tr><td> <code title="">ntilde</code> </td> <td> U+000F1 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ntlg;</code> </td> <td> U+02278 </td> <tr><td> <code title="">ntriangleleft;</code> </td> <td> U+022EA </td> <tr><td> <code title="">ntrianglelefteq;</code> </td> <td> U+022EC </td> <tr><td> <code title="">ntriangleright;</code> </td> <td> U+022EB </td> <tr><td> <code title="">ntrianglerighteq;</code> </td> <td> U+022ED </td> <tr><td> <code title="">nu;</code> </td> <td> U+003BD </td> <tr><td> <code title="">num;</code> </td> <td> U+00023 </td> <tr><td> <code title="">numero;</code> </td> <td> U+02116 </td> <tr><td> <code title="">numsp;</code> </td> <td> U+02007 </td> <tr><td> <code title="">nvDash;</code> </td> <td> U+022AD </td> <tr><td> <code title="">nvHarr;</code> </td> <td> U+02904 </td> <tr><td> <code title="">nvdash;</code> </td> <td> U+022AC </td> <tr><td> <code title="">nvinfin;</code> </td> <td> U+029DE </td> <tr><td> <code title="">nvlArr;</code> </td> <td> U+02902 </td> <tr><td> <code title="">nvrArr;</code> </td> <td> U+02903 </td> <tr><td> <code title="">nwArr;</code> </td> <td> U+021D6 </td> <tr><td> <code title="">nwarhk;</code> </td> <td> U+02923 </td> <tr><td> <code title="">nwarr;</code> </td> <td> U+02196 </td> <tr><td> <code title="">nwarrow;</code> </td> <td> U+02196 </td> <tr><td> <code title="">nwnear;</code> </td> <td> U+02927 </td> <tr><td> <code title="">oS;</code> </td> <td> U+024C8 </td> <tr><td> <code title="">oacute;</code> </td> <td> U+000F3 </td> <tr><td> <code title="">oacute</code> </td> <td> U+000F3 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">oast;</code> </td> <td> U+0229B </td> <tr><td> <code title="">ocir;</code> </td> <td> U+0229A </td> <tr><td> <code title="">ocirc;</code> </td> <td> U+000F4 </td> <tr><td> <code title="">ocirc</code> </td> <td> U+000F4 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ocy;</code> </td> <td> U+0043E </td> <tr><td> <code title="">odash;</code> </td> <td> U+0229D </td> <tr><td> <code title="">odblac;</code> </td> <td> U+00151 </td> <tr><td> <code title="">odiv;</code> </td> <td> U+02A38 </td> <tr><td> <code title="">odot;</code> </td> <td> U+02299 </td> <tr><td> <code title="">odsold;</code> </td> <td> U+029BC </td> <tr><td> <code title="">oelig;</code> </td> <td> U+00153 </td> <tr><td> <code title="">ofcir;</code> </td> <td> U+029BF </td> <tr><td> <code title="">ofr;</code> </td> <td> U+1D52C </td> <tr><td> <code title="">ogon;</code> </td> <td> U+002DB </td> <tr><td> <code title="">ograve;</code> </td> <td> U+000F2 </td> <tr><td> <code title="">ograve</code> </td> <td> U+000F2 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ogt;</code> </td> <td> U+029C1 </td> <tr><td> <code title="">ohbar;</code> </td> <td> U+029B5 </td> <tr><td> <code title="">ohm;</code> </td> <td> U+003A9 </td> <tr><td> <code title="">oint;</code> </td> <td> U+0222E </td> <tr><td> <code title="">olarr;</code> </td> <td> U+021BA </td> <tr><td> <code title="">olcir;</code> </td> <td> U+029BE </td> <tr><td> <code title="">olcross;</code> </td> <td> U+029BB </td> <tr><td> <code title="">oline;</code> </td> <td> U+0203E </td> <tr><td> <code title="">olt;</code> </td> <td> U+029C0 </td> <tr><td> <code title="">omacr;</code> </td> <td> U+0014D </td> <tr><td> <code title="">omega;</code> </td> <td> U+003C9 </td> <tr><td> <code title="">omicron;</code> </td> <td> U+003BF </td> <tr><td> <code title="">omid;</code> </td> <td> U+029B6 </td> <tr><td> <code title="">ominus;</code> </td> <td> U+02296 </td> <tr><td> <code title="">oopf;</code> </td> <td> U+1D560 </td> <tr><td> <code title="">opar;</code> </td> <td> U+029B7 </td> <tr><td> <code title="">operp;</code> </td> <td> U+029B9 </td> <tr><td> <code title="">oplus;</code> </td> <td> U+02295 </td> <tr><td> <code title="">or;</code> </td> <td> U+02228 </td> <tr><td> <code title="">orarr;</code> </td> <td> U+021BB </td> <tr><td> <code title="">ord;</code> </td> <td> U+02A5D </td> <tr><td> <code title="">order;</code> </td> <td> U+02134 </td> <tr><td> <code title="">orderof;</code> </td> <td> U+02134 </td> <tr><td> <code title="">ordf;</code> </td> <td> U+000AA </td> <tr><td> <code title="">ordf</code> </td> <td> U+000AA </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ordm;</code> </td> <td> U+000BA </td> <tr><td> <code title="">ordm</code> </td> <td> U+000BA </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">origof;</code> </td> <td> U+022B6 </td> <tr><td> <code title="">oror;</code> </td> <td> U+02A56 </td> <tr><td> <code title="">orslope;</code> </td> <td> U+02A57 </td> <tr><td> <code title="">orv;</code> </td> <td> U+02A5B </td> <tr><td> <code title="">oscr;</code> </td> <td> U+02134 </td> <tr><td> <code title="">oslash;</code> </td> <td> U+000F8 </td> <tr><td> <code title="">oslash</code> </td> <td> U+000F8 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">osol;</code> </td> <td> U+02298 </td> <tr><td> <code title="">otilde;</code> </td> <td> U+000F5 </td> <tr><td> <code title="">otilde</code> </td> <td> U+000F5 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">otimes;</code> </td> <td> U+02297 </td> <tr><td> <code title="">otimesas;</code> </td> <td> U+02A36 </td> <tr><td> <code title="">ouml;</code> </td> <td> U+000F6 </td> <tr><td> <code title="">ouml</code> </td> <td> U+000F6 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ovbar;</code> </td> <td> U+0233D </td> <tr><td> <code title="">par;</code> </td> <td> U+02225 </td> <tr><td> <code title="">para;</code> </td> <td> U+000B6 </td> <tr><td> <code title="">para</code> </td> <td> U+000B6 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">parallel;</code> </td> <td> U+02225 </td> <tr><td> <code title="">parsim;</code> </td> <td> U+02AF3 </td> <tr><td> <code title="">parsl;</code> </td> <td> U+02AFD </td> <tr><td> <code title="">part;</code> </td> <td> U+02202 </td> <tr><td> <code title="">pcy;</code> </td> <td> U+0043F </td> <tr><td> <code title="">percnt;</code> </td> <td> U+00025 </td> <tr><td> <code title="">period;</code> </td> <td> U+0002E </td> <tr><td> <code title="">permil;</code> </td> <td> U+02030 </td> <tr><td> <code title="">perp;</code> </td> <td> U+022A5 </td> <tr><td> <code title="">pertenk;</code> </td> <td> U+02031 </td> <tr><td> <code title="">pfr;</code> </td> <td> U+1D52D </td> <tr><td> <code title="">phi;</code> </td> <td> U+003C6 </td> <tr><td> <code title="">phiv;</code> </td> <td> U+003D5 </td> <tr><td> <code title="">phmmat;</code> </td> <td> U+02133 </td> <tr><td> <code title="">phone;</code> </td> <td> U+0260E </td> <tr><td> <code title="">pi;</code> </td> <td> U+003C0 </td> <tr><td> <code title="">pitchfork;</code> </td> <td> U+022D4 </td> <tr><td> <code title="">piv;</code> </td> <td> U+003D6 </td> <tr><td> <code title="">planck;</code> </td> <td> U+0210F </td> <tr><td> <code title="">planckh;</code> </td> <td> U+0210E </td> <tr><td> <code title="">plankv;</code> </td> <td> U+0210F </td> <tr><td> <code title="">plus;</code> </td> <td> U+0002B </td> <tr><td> <code title="">plusacir;</code> </td> <td> U+02A23 </td> <tr><td> <code title="">plusb;</code> </td> <td> U+0229E </td> <tr><td> <code title="">pluscir;</code> </td> <td> U+02A22 </td> <tr><td> <code title="">plusdo;</code> </td> <td> U+02214 </td> <tr><td> <code title="">plusdu;</code> </td> <td> U+02A25 </td> <tr><td> <code title="">pluse;</code> </td> <td> U+02A72 </td> <tr><td> <code title="">plusmn;</code> </td> <td> U+000B1 </td> <tr><td> <code title="">plusmn</code> </td> <td> U+000B1 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">plussim;</code> </td> <td> U+02A26 </td> <tr><td> <code title="">plustwo;</code> </td> <td> U+02A27 </td> <tr><td> <code title="">pm;</code> </td> <td> U+000B1 </td> <tr><td> <code title="">pointint;</code> </td> <td> U+02A15 </td> <tr><td> <code title="">popf;</code> </td> <td> U+1D561 </td> <tr><td> <code title="">pound;</code> </td> <td> U+000A3 </td> <tr><td> <code title="">pound</code> </td> <td> U+000A3 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">pr;</code> </td> <td> U+0227A </td> <tr><td> <code title="">prE;</code> </td> <td> U+02AB3 </td> <tr><td> <code title="">prap;</code> </td> <td> U+02AB7 </td> <tr><td> <code title="">prcue;</code> </td> <td> U+0227C </td> <tr><td> <code title="">pre;</code> </td> <td> U+02AAF </td> <tr><td> <code title="">prec;</code> </td> <td> U+0227A </td> <tr><td> <code title="">precapprox;</code> </td> <td> U+02AB7 </td> <tr><td> <code title="">preccurlyeq;</code> </td> <td> U+0227C </td> <tr><td> <code title="">preceq;</code> </td> <td> U+02AAF </td> <tr><td> <code title="">precnapprox;</code> </td> <td> U+02AB9 </td> <tr><td> <code title="">precneqq;</code> </td> <td> U+02AB5 </td> <tr><td> <code title="">precnsim;</code> </td> <td> U+022E8 </td> <tr><td> <code title="">precsim;</code> </td> <td> U+0227E </td> <tr><td> <code title="">prime;</code> </td> <td> U+02032 </td> <tr><td> <code title="">primes;</code> </td> <td> U+02119 </td> <tr><td> <code title="">prnE;</code> </td> <td> U+02AB5 </td> <tr><td> <code title="">prnap;</code> </td> <td> U+02AB9 </td> <tr><td> <code title="">prnsim;</code> </td> <td> U+022E8 </td> <tr><td> <code title="">prod;</code> </td> <td> U+0220F </td> <tr><td> <code title="">profalar;</code> </td> <td> U+0232E </td> <tr><td> <code title="">profline;</code> </td> <td> U+02312 </td> <tr><td> <code title="">profsurf;</code> </td> <td> U+02313 </td> <tr><td> <code title="">prop;</code> </td> <td> U+0221D </td> <tr><td> <code title="">propto;</code> </td> <td> U+0221D </td> <tr><td> <code title="">prsim;</code> </td> <td> U+0227E </td> <tr><td> <code title="">prurel;</code> </td> <td> U+022B0 </td> <tr><td> <code title="">pscr;</code> </td> <td> U+1D4C5 </td> <tr><td> <code title="">psi;</code> </td> <td> U+003C8 </td> <tr><td> <code title="">puncsp;</code> </td> <td> U+02008 </td> <tr><td> <code title="">qfr;</code> </td> <td> U+1D52E </td> <tr><td> <code title="">qint;</code> </td> <td> U+02A0C </td> <tr><td> <code title="">qopf;</code> </td> <td> U+1D562 </td> <tr><td> <code title="">qprime;</code> </td> <td> U+02057 </td> <tr><td> <code title="">qscr;</code> </td> <td> U+1D4C6 </td> <tr><td> <code title="">quaternions;</code> </td> <td> U+0210D </td> <tr><td> <code title="">quatint;</code> </td> <td> U+02A16 </td> <tr><td> <code title="">quest;</code> </td> <td> U+0003F </td> <tr><td> <code title="">questeq;</code> </td> <td> U+0225F </td> <tr><td> <code title="">quot;</code> </td> <td> U+00022 </td> <tr><td> <code title="">quot</code> </td> <td> U+00022 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">rAarr;</code> </td> <td> U+021DB </td> <tr><td> <code title="">rArr;</code> </td> <td> U+021D2 </td> <tr><td> <code title="">rAtail;</code> </td> <td> U+0291C </td> <tr><td> <code title="">rBarr;</code> </td> <td> U+0290F </td> <tr><td> <code title="">rHar;</code> </td> <td> U+02964 </td> <tr><td> <code title="">racute;</code> </td> <td> U+00155 </td> <tr><td> <code title="">radic;</code> </td> <td> U+0221A </td> <tr><td> <code title="">raemptyv;</code> </td> <td> U+029B3 </td> <tr><td> <code title="">rang;</code> </td> <td> U+027E9 </td> <tr><td> <code title="">rangd;</code> </td> <td> U+02992 </td> <tr><td> <code title="">range;</code> </td> <td> U+029A5 </td> <tr><td> <code title="">rangle;</code> </td> <td> U+027E9 </td> <tr><td> <code title="">raquo;</code> </td> <td> U+000BB </td> <tr><td> <code title="">raquo</code> </td> <td> U+000BB </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">rarr;</code> </td> <td> U+02192 </td> <tr><td> <code title="">rarrap;</code> </td> <td> U+02975 </td> <tr><td> <code title="">rarrb;</code> </td> <td> U+021E5 </td> <tr><td> <code title="">rarrbfs;</code> </td> <td> U+02920 </td> <tr><td> <code title="">rarrc;</code> </td> <td> U+02933 </td> <tr><td> <code title="">rarrfs;</code> </td> <td> U+0291E </td> <tr><td> <code title="">rarrhk;</code> </td> <td> U+021AA </td> <tr><td> <code title="">rarrlp;</code> </td> <td> U+021AC </td> <tr><td> <code title="">rarrpl;</code> </td> <td> U+02945 </td> <tr><td> <code title="">rarrsim;</code> </td> <td> U+02974 </td> <tr><td> <code title="">rarrtl;</code> </td> <td> U+021A3 </td> <tr><td> <code title="">rarrw;</code> </td> <td> U+0219D </td> <tr><td> <code title="">ratail;</code> </td> <td> U+0291A </td> <tr><td> <code title="">ratio;</code> </td> <td> U+02236 </td> <tr><td> <code title="">rationals;</code> </td> <td> U+0211A </td> <tr><td> <code title="">rbarr;</code> </td> <td> U+0290D </td> <tr><td> <code title="">rbbrk;</code> </td> <td> U+02773 </td> <tr><td> <code title="">rbrace;</code> </td> <td> U+0007D </td> <tr><td> <code title="">rbrack;</code> </td> <td> U+0005D </td> <tr><td> <code title="">rbrke;</code> </td> <td> U+0298C </td> <tr><td> <code title="">rbrksld;</code> </td> <td> U+0298E </td> <tr><td> <code title="">rbrkslu;</code> </td> <td> U+02990 </td> <tr><td> <code title="">rcaron;</code> </td> <td> U+00159 </td> <tr><td> <code title="">rcedil;</code> </td> <td> U+00157 </td> <tr><td> <code title="">rceil;</code> </td> <td> U+02309 </td> <tr><td> <code title="">rcub;</code> </td> <td> U+0007D </td> <tr><td> <code title="">rcy;</code> </td> <td> U+00440 </td> <tr><td> <code title="">rdca;</code> </td> <td> U+02937 </td> <tr><td> <code title="">rdldhar;</code> </td> <td> U+02969 </td> <tr><td> <code title="">rdquo;</code> </td> <td> U+0201D </td> <tr><td> <code title="">rdquor;</code> </td> <td> U+0201D </td> <tr><td> <code title="">rdsh;</code> </td> <td> U+021B3 </td> <tr><td> <code title="">real;</code> </td> <td> U+0211C </td> <tr><td> <code title="">realine;</code> </td> <td> U+0211B </td> <tr><td> <code title="">realpart;</code> </td> <td> U+0211C </td> <tr><td> <code title="">reals;</code> </td> <td> U+0211D </td> <tr><td> <code title="">rect;</code> </td> <td> U+025AD </td> <tr><td> <code title="">reg;</code> </td> <td> U+000AE </td> <tr><td> <code title="">reg</code> </td> <td> U+000AE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">rfisht;</code> </td> <td> U+0297D </td> <tr><td> <code title="">rfloor;</code> </td> <td> U+0230B </td> <tr><td> <code title="">rfr;</code> </td> <td> U+1D52F </td> <tr><td> <code title="">rhard;</code> </td> <td> U+021C1 </td> <tr><td> <code title="">rharu;</code> </td> <td> U+021C0 </td> <tr><td> <code title="">rharul;</code> </td> <td> U+0296C </td> <tr><td> <code title="">rho;</code> </td> <td> U+003C1 </td> <tr><td> <code title="">rhov;</code> </td> <td> U+003F1 </td> <tr><td> <code title="">rightarrow;</code> </td> <td> U+02192 </td> <tr><td> <code title="">rightarrowtail;</code> </td> <td> U+021A3 </td> <tr><td> <code title="">rightharpoondown;</code> </td> <td> U+021C1 </td> <tr><td> <code title="">rightharpoonup;</code> </td> <td> U+021C0 </td> <tr><td> <code title="">rightleftarrows;</code> </td> <td> U+021C4 </td> <tr><td> <code title="">rightleftharpoons;</code> </td> <td> U+021CC </td> <tr><td> <code title="">rightrightarrows;</code> </td> <td> U+021C9 </td> <tr><td> <code title="">rightsquigarrow;</code> </td> <td> U+0219D </td> <tr><td> <code title="">rightthreetimes;</code> </td> <td> U+022CC </td> <tr><td> <code title="">ring;</code> </td> <td> U+002DA </td> <tr><td> <code title="">risingdotseq;</code> </td> <td> U+02253 </td> <tr><td> <code title="">rlarr;</code> </td> <td> U+021C4 </td> <tr><td> <code title="">rlhar;</code> </td> <td> U+021CC </td> <tr><td> <code title="">rlm;</code> </td> <td> U+0200F </td> <tr><td> <code title="">rmoust;</code> </td> <td> U+023B1 </td> <tr><td> <code title="">rmoustache;</code> </td> <td> U+023B1 </td> <tr><td> <code title="">rnmid;</code> </td> <td> U+02AEE </td> <tr><td> <code title="">roang;</code> </td> <td> U+027ED </td> <tr><td> <code title="">roarr;</code> </td> <td> U+021FE </td> <tr><td> <code title="">robrk;</code> </td> <td> U+027E7 </td> <tr><td> <code title="">ropar;</code> </td> <td> U+02986 </td> <tr><td> <code title="">ropf;</code> </td> <td> U+1D563 </td> <tr><td> <code title="">roplus;</code> </td> <td> U+02A2E </td> <tr><td> <code title="">rotimes;</code> </td> <td> U+02A35 </td> <tr><td> <code title="">rpar;</code> </td> <td> U+00029 </td> <tr><td> <code title="">rpargt;</code> </td> <td> U+02994 </td> <tr><td> <code title="">rppolint;</code> </td> <td> U+02A12 </td> <tr><td> <code title="">rrarr;</code> </td> <td> U+021C9 </td> <tr><td> <code title="">rsaquo;</code> </td> <td> U+0203A </td> <tr><td> <code title="">rscr;</code> </td> <td> U+1D4C7 </td> <tr><td> <code title="">rsh;</code> </td> <td> U+021B1 </td> <tr><td> <code title="">rsqb;</code> </td> <td> U+0005D </td> <tr><td> <code title="">rsquo;</code> </td> <td> U+02019 </td> <tr><td> <code title="">rsquor;</code> </td> <td> U+02019 </td> <tr><td> <code title="">rthree;</code> </td> <td> U+022CC </td> <tr><td> <code title="">rtimes;</code> </td> <td> U+022CA </td> <tr><td> <code title="">rtri;</code> </td> <td> U+025B9 </td> <tr><td> <code title="">rtrie;</code> </td> <td> U+022B5 </td> <tr><td> <code title="">rtrif;</code> </td> <td> U+025B8 </td> <tr><td> <code title="">rtriltri;</code> </td> <td> U+029CE </td> <tr><td> <code title="">ruluhar;</code> </td> <td> U+02968 </td> <tr><td> <code title="">rx;</code> </td> <td> U+0211E </td> <tr><td> <code title="">sacute;</code> </td> <td> U+0015B </td> <tr><td> <code title="">sbquo;</code> </td> <td> U+0201A </td> <tr><td> <code title="">sc;</code> </td> <td> U+0227B </td> <tr><td> <code title="">scE;</code> </td> <td> U+02AB4 </td> <tr><td> <code title="">scap;</code> </td> <td> U+02AB8 </td> <tr><td> <code title="">scaron;</code> </td> <td> U+00161 </td> <tr><td> <code title="">sccue;</code> </td> <td> U+0227D </td> <tr><td> <code title="">sce;</code> </td> <td> U+02AB0 </td> <tr><td> <code title="">scedil;</code> </td> <td> U+0015F </td> <tr><td> <code title="">scirc;</code> </td> <td> U+0015D </td> <tr><td> <code title="">scnE;</code> </td> <td> U+02AB6 </td> <tr><td> <code title="">scnap;</code> </td> <td> U+02ABA </td> <tr><td> <code title="">scnsim;</code> </td> <td> U+022E9 </td> <tr><td> <code title="">scpolint;</code> </td> <td> U+02A13 </td> <tr><td> <code title="">scsim;</code> </td> <td> U+0227F </td> <tr><td> <code title="">scy;</code> </td> <td> U+00441 </td> <tr><td> <code title="">sdot;</code> </td> <td> U+022C5 </td> <tr><td> <code title="">sdotb;</code> </td> <td> U+022A1 </td> <tr><td> <code title="">sdote;</code> </td> <td> U+02A66 </td> <tr><td> <code title="">seArr;</code> </td> <td> U+021D8 </td> <tr><td> <code title="">searhk;</code> </td> <td> U+02925 </td> <tr><td> <code title="">searr;</code> </td> <td> U+02198 </td> <tr><td> <code title="">searrow;</code> </td> <td> U+02198 </td> <tr><td> <code title="">sect;</code> </td> <td> U+000A7 </td> <tr><td> <code title="">sect</code> </td> <td> U+000A7 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">semi;</code> </td> <td> U+0003B </td> <tr><td> <code title="">seswar;</code> </td> <td> U+02929 </td> <tr><td> <code title="">setminus;</code> </td> <td> U+02216 </td> <tr><td> <code title="">setmn;</code> </td> <td> U+02216 </td> <tr><td> <code title="">sext;</code> </td> <td> U+02736 </td> <tr><td> <code title="">sfr;</code> </td> <td> U+1D530 </td> <tr><td> <code title="">sfrown;</code> </td> <td> U+02322 </td> <tr><td> <code title="">sharp;</code> </td> <td> U+0266F </td> <tr><td> <code title="">shchcy;</code> </td> <td> U+00449 </td> <tr><td> <code title="">shcy;</code> </td> <td> U+00448 </td> <tr><td> <code title="">shortmid;</code> </td> <td> U+02223 </td> <tr><td> <code title="">shortparallel;</code> </td> <td> U+02225 </td> <tr><td> <code title="">shy;</code> </td> <td> U+000AD </td> <tr><td> <code title="">shy</code> </td> <td> U+000AD </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sigma;</code> </td> <td> U+003C3 </td> <tr><td> <code title="">sigmaf;</code> </td> <td> U+003C2 </td> <tr><td> <code title="">sigmav;</code> </td> <td> U+003C2 </td> <tr><td> <code title="">sim;</code> </td> <td> U+0223C </td> <tr><td> <code title="">simdot;</code> </td> <td> U+02A6A </td> <tr><td> <code title="">sime;</code> </td> <td> U+02243 </td> <tr><td> <code title="">simeq;</code> </td> <td> U+02243 </td> <tr><td> <code title="">simg;</code> </td> <td> U+02A9E </td> <tr><td> <code title="">simgE;</code> </td> <td> U+02AA0 </td> <tr><td> <code title="">siml;</code> </td> <td> U+02A9D </td> <tr><td> <code title="">simlE;</code> </td> <td> U+02A9F </td> <tr><td> <code title="">simne;</code> </td> <td> U+02246 </td> <tr><td> <code title="">simplus;</code> </td> <td> U+02A24 </td> <tr><td> <code title="">simrarr;</code> </td> <td> U+02972 </td> <tr><td> <code title="">slarr;</code> </td> <td> U+02190 </td> <tr><td> <code title="">smallsetminus;</code> </td> <td> U+02216 </td> <tr><td> <code title="">smashp;</code> </td> <td> U+02A33 </td> <tr><td> <code title="">smeparsl;</code> </td> <td> U+029E4 </td> <tr><td> <code title="">smid;</code> </td> <td> U+02223 </td> <tr><td> <code title="">smile;</code> </td> <td> U+02323 </td> <tr><td> <code title="">smt;</code> </td> <td> U+02AAA </td> <tr><td> <code title="">smte;</code> </td> <td> U+02AAC </td> <tr><td> <code title="">softcy;</code> </td> <td> U+0044C </td> <tr><td> <code title="">sol;</code> </td> <td> U+0002F </td> <tr><td> <code title="">solb;</code> </td> <td> U+029C4 </td> <tr><td> <code title="">solbar;</code> </td> <td> U+0233F </td> <tr><td> <code title="">sopf;</code> </td> <td> U+1D564 </td> <tr><td> <code title="">spades;</code> </td> <td> U+02660 </td> <tr><td> <code title="">spadesuit;</code> </td> <td> U+02660 </td> <tr><td> <code title="">spar;</code> </td> <td> U+02225 </td> <tr><td> <code title="">sqcap;</code> </td> <td> U+02293 </td> <tr><td> <code title="">sqcup;</code> </td> <td> U+02294 </td> <tr><td> <code title="">sqsub;</code> </td> <td> U+0228F </td> <tr><td> <code title="">sqsube;</code> </td> <td> U+02291 </td> <tr><td> <code title="">sqsubset;</code> </td> <td> U+0228F </td> <tr><td> <code title="">sqsubseteq;</code> </td> <td> U+02291 </td> <tr><td> <code title="">sqsup;</code> </td> <td> U+02290 </td> <tr><td> <code title="">sqsupe;</code> </td> <td> U+02292 </td> <tr><td> <code title="">sqsupset;</code> </td> <td> U+02290 </td> <tr><td> <code title="">sqsupseteq;</code> </td> <td> U+02292 </td> <tr><td> <code title="">squ;</code> </td> <td> U+025A1 </td> <tr><td> <code title="">square;</code> </td> <td> U+025A1 </td> <tr><td> <code title="">squarf;</code> </td> <td> U+025AA </td> <tr><td> <code title="">squf;</code> </td> <td> U+025AA </td> <tr><td> <code title="">srarr;</code> </td> <td> U+02192 </td> <tr><td> <code title="">sscr;</code> </td> <td> U+1D4C8 </td> <tr><td> <code title="">ssetmn;</code> </td> <td> U+02216 </td> <tr><td> <code title="">ssmile;</code> </td> <td> U+02323 </td> <tr><td> <code title="">sstarf;</code> </td> <td> U+022C6 </td> <tr><td> <code title="">star;</code> </td> <td> U+02606 </td> <tr><td> <code title="">starf;</code> </td> <td> U+02605 </td> <tr><td> <code title="">straightepsilon;</code> </td> <td> U+003F5 </td> <tr><td> <code title="">straightphi;</code> </td> <td> U+003D5 </td> <tr><td> <code title="">strns;</code> </td> <td> U+000AF </td> <tr><td> <code title="">sub;</code> </td> <td> U+02282 </td> <tr><td> <code title="">subE;</code> </td> <td> U+02AC5 </td> <tr><td> <code title="">subdot;</code> </td> <td> U+02ABD </td> <tr><td> <code title="">sube;</code> </td> <td> U+02286 </td> <tr><td> <code title="">subedot;</code> </td> <td> U+02AC3 </td> <tr><td> <code title="">submult;</code> </td> <td> U+02AC1 </td> <tr><td> <code title="">subnE;</code> </td> <td> U+02ACB </td> <tr><td> <code title="">subne;</code> </td> <td> U+0228A </td> <tr><td> <code title="">subplus;</code> </td> <td> U+02ABF </td> <tr><td> <code title="">subrarr;</code> </td> <td> U+02979 </td> <tr><td> <code title="">subset;</code> </td> <td> U+02282 </td> <tr><td> <code title="">subseteq;</code> </td> <td> U+02286 </td> <tr><td> <code title="">subseteqq;</code> </td> <td> U+02AC5 </td> <tr><td> <code title="">subsetneq;</code> </td> <td> U+0228A </td> <tr><td> <code title="">subsetneqq;</code> </td> <td> U+02ACB </td> <tr><td> <code title="">subsim;</code> </td> <td> U+02AC7 </td> <tr><td> <code title="">subsub;</code> </td> <td> U+02AD5 </td> <tr><td> <code title="">subsup;</code> </td> <td> U+02AD3 </td> <tr><td> <code title="">succ;</code> </td> <td> U+0227B </td> <tr><td> <code title="">succapprox;</code> </td> <td> U+02AB8 </td> <tr><td> <code title="">succcurlyeq;</code> </td> <td> U+0227D </td> <tr><td> <code title="">succeq;</code> </td> <td> U+02AB0 </td> <tr><td> <code title="">succnapprox;</code> </td> <td> U+02ABA </td> <tr><td> <code title="">succneqq;</code> </td> <td> U+02AB6 </td> <tr><td> <code title="">succnsim;</code> </td> <td> U+022E9 </td> <tr><td> <code title="">succsim;</code> </td> <td> U+0227F </td> <tr><td> <code title="">sum;</code> </td> <td> U+02211 </td> <tr><td> <code title="">sung;</code> </td> <td> U+0266A </td> <tr><td> <code title="">sup1;</code> </td> <td> U+000B9 </td> <tr><td> <code title="">sup1</code> </td> <td> U+000B9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sup2;</code> </td> <td> U+000B2 </td> <tr><td> <code title="">sup2</code> </td> <td> U+000B2 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sup3;</code> </td> <td> U+000B3 </td> <tr><td> <code title="">sup3</code> </td> <td> U+000B3 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">sup;</code> </td> <td> U+02283 </td> <tr><td> <code title="">supE;</code> </td> <td> U+02AC6 </td> <tr><td> <code title="">supdot;</code> </td> <td> U+02ABE </td> <tr><td> <code title="">supdsub;</code> </td> <td> U+02AD8 </td> <tr><td> <code title="">supe;</code> </td> <td> U+02287 </td> <tr><td> <code title="">supedot;</code> </td> <td> U+02AC4 </td> <tr><td> <code title="">suphsol;</code> </td> <td> U+027C9 </td> <tr><td> <code title="">suphsub;</code> </td> <td> U+02AD7 </td> <tr><td> <code title="">suplarr;</code> </td> <td> U+0297B </td> <tr><td> <code title="">supmult;</code> </td> <td> U+02AC2 </td> <tr><td> <code title="">supnE;</code> </td> <td> U+02ACC </td> <tr><td> <code title="">supne;</code> </td> <td> U+0228B </td> <tr><td> <code title="">supplus;</code> </td> <td> U+02AC0 </td> <tr><td> <code title="">supset;</code> </td> <td> U+02283 </td> <tr><td> <code title="">supseteq;</code> </td> <td> U+02287 </td> <tr><td> <code title="">supseteqq;</code> </td> <td> U+02AC6 </td> <tr><td> <code title="">supsetneq;</code> </td> <td> U+0228B </td> <tr><td> <code title="">supsetneqq;</code> </td> <td> U+02ACC </td> <tr><td> <code title="">supsim;</code> </td> <td> U+02AC8 </td> <tr><td> <code title="">supsub;</code> </td> <td> U+02AD4 </td> <tr><td> <code title="">supsup;</code> </td> <td> U+02AD6 </td> <tr><td> <code title="">swArr;</code> </td> <td> U+021D9 </td> <tr><td> <code title="">swarhk;</code> </td> <td> U+02926 </td> <tr><td> <code title="">swarr;</code> </td> <td> U+02199 </td> <tr><td> <code title="">swarrow;</code> </td> <td> U+02199 </td> <tr><td> <code title="">swnwar;</code> </td> <td> U+0292A </td> <tr><td> <code title="">szlig;</code> </td> <td> U+000DF </td> <tr><td> <code title="">szlig</code> </td> <td> U+000DF </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">target;</code> </td> <td> U+02316 </td> <tr><td> <code title="">tau;</code> </td> <td> U+003C4 </td> <tr><td> <code title="">tbrk;</code> </td> <td> U+023B4 </td> <tr><td> <code title="">tcaron;</code> </td> <td> U+00165 </td> <tr><td> <code title="">tcedil;</code> </td> <td> U+00163 </td> <tr><td> <code title="">tcy;</code> </td> <td> U+00442 </td> <tr><td> <code title="">tdot;</code> </td> <td> U+020DB </td> <tr><td> <code title="">telrec;</code> </td> <td> U+02315 </td> <tr><td> <code title="">tfr;</code> </td> <td> U+1D531 </td> <tr><td> <code title="">there4;</code> </td> <td> U+02234 </td> <tr><td> <code title="">therefore;</code> </td> <td> U+02234 </td> <tr><td> <code title="">theta;</code> </td> <td> U+003B8 </td> <tr><td> <code title="">thetasym;</code> </td> <td> U+003D1 </td> <tr><td> <code title="">thetav;</code> </td> <td> U+003D1 </td> <tr><td> <code title="">thickapprox;</code> </td> <td> U+02248 </td> <tr><td> <code title="">thicksim;</code> </td> <td> U+0223C </td> <tr><td> <code title="">thinsp;</code> </td> <td> U+02009 </td> <tr><td> <code title="">thkap;</code> </td> <td> U+02248 </td> <tr><td> <code title="">thksim;</code> </td> <td> U+0223C </td> <tr><td> <code title="">thorn;</code> </td> <td> U+000FE </td> <tr><td> <code title="">thorn</code> </td> <td> U+000FE </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">tilde;</code> </td> <td> U+002DC </td> <tr><td> <code title="">times;</code> </td> <td> U+000D7 </td> <tr><td> <code title="">times</code> </td> <td> U+000D7 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">timesb;</code> </td> <td> U+022A0 </td> <tr><td> <code title="">timesbar;</code> </td> <td> U+02A31 </td> <tr><td> <code title="">timesd;</code> </td> <td> U+02A30 </td> <tr><td> <code title="">tint;</code> </td> <td> U+0222D </td> <tr><td> <code title="">toea;</code> </td> <td> U+02928 </td> <tr><td> <code title="">top;</code> </td> <td> U+022A4 </td> <tr><td> <code title="">topbot;</code> </td> <td> U+02336 </td> <tr><td> <code title="">topcir;</code> </td> <td> U+02AF1 </td> <tr><td> <code title="">topf;</code> </td> <td> U+1D565 </td> <tr><td> <code title="">topfork;</code> </td> <td> U+02ADA </td> <tr><td> <code title="">tosa;</code> </td> <td> U+02929 </td> <tr><td> <code title="">tprime;</code> </td> <td> U+02034 </td> <tr><td> <code title="">trade;</code> </td> <td> U+02122 </td> <tr><td> <code title="">triangle;</code> </td> <td> U+025B5 </td> <tr><td> <code title="">triangledown;</code> </td> <td> U+025BF </td> <tr><td> <code title="">triangleleft;</code> </td> <td> U+025C3 </td> <tr><td> <code title="">trianglelefteq;</code> </td> <td> U+022B4 </td> <tr><td> <code title="">triangleq;</code> </td> <td> U+0225C </td> <tr><td> <code title="">triangleright;</code> </td> <td> U+025B9 </td> <tr><td> <code title="">trianglerighteq;</code> </td> <td> U+022B5 </td> <tr><td> <code title="">tridot;</code> </td> <td> U+025EC </td> <tr><td> <code title="">trie;</code> </td> <td> U+0225C </td> <tr><td> <code title="">triminus;</code> </td> <td> U+02A3A </td> <tr><td> <code title="">triplus;</code> </td> <td> U+02A39 </td> <tr><td> <code title="">trisb;</code> </td> <td> U+029CD </td> <tr><td> <code title="">tritime;</code> </td> <td> U+02A3B </td> <tr><td> <code title="">trpezium;</code> </td> <td> U+023E2 </td> <tr><td> <code title="">tscr;</code> </td> <td> U+1D4C9 </td> <tr><td> <code title="">tscy;</code> </td> <td> U+00446 </td> <tr><td> <code title="">tshcy;</code> </td> <td> U+0045B </td> <tr><td> <code title="">tstrok;</code> </td> <td> U+00167 </td> <tr><td> <code title="">twixt;</code> </td> <td> U+0226C </td> <tr><td> <code title="">twoheadleftarrow;</code> </td> <td> U+0219E </td> <tr><td> <code title="">twoheadrightarrow;</code> </td> <td> U+021A0 </td> <tr><td> <code title="">uArr;</code> </td> <td> U+021D1 </td> <tr><td> <code title="">uHar;</code> </td> <td> U+02963 </td> <tr><td> <code title="">uacute;</code> </td> <td> U+000FA </td> <tr><td> <code title="">uacute</code> </td> <td> U+000FA </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uarr;</code> </td> <td> U+02191 </td> <tr><td> <code title="">ubrcy;</code> </td> <td> U+0045E </td> <tr><td> <code title="">ubreve;</code> </td> <td> U+0016D </td> <tr><td> <code title="">ucirc;</code> </td> <td> U+000FB </td> <tr><td> <code title="">ucirc</code> </td> <td> U+000FB </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">ucy;</code> </td> <td> U+00443 </td> <tr><td> <code title="">udarr;</code> </td> <td> U+021C5 </td> <tr><td> <code title="">udblac;</code> </td> <td> U+00171 </td> <tr><td> <code title="">udhar;</code> </td> <td> U+0296E </td> <tr><td> <code title="">ufisht;</code> </td> <td> U+0297E </td> <tr><td> <code title="">ufr;</code> </td> <td> U+1D532 </td> <tr><td> <code title="">ugrave;</code> </td> <td> U+000F9 </td> <tr><td> <code title="">ugrave</code> </td> <td> U+000F9 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uharl;</code> </td> <td> U+021BF </td> <tr><td> <code title="">uharr;</code> </td> <td> U+021BE </td> <tr><td> <code title="">uhblk;</code> </td> <td> U+02580 </td> <tr><td> <code title="">ulcorn;</code> </td> <td> U+0231C </td> <tr><td> <code title="">ulcorner;</code> </td> <td> U+0231C </td> <tr><td> <code title="">ulcrop;</code> </td> <td> U+0230F </td> <tr><td> <code title="">ultri;</code> </td> <td> U+025F8 </td> <tr><td> <code title="">umacr;</code> </td> <td> U+0016B </td> <tr><td> <code title="">uml;</code> </td> <td> U+000A8 </td> <tr><td> <code title="">uml</code> </td> <td> U+000A8 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uogon;</code> </td> <td> U+00173 </td> <tr><td> <code title="">uopf;</code> </td> <td> U+1D566 </td> <tr><td> <code title="">uparrow;</code> </td> <td> U+02191 </td> <tr><td> <code title="">updownarrow;</code> </td> <td> U+02195 </td> <tr><td> <code title="">upharpoonleft;</code> </td> <td> U+021BF </td> <tr><td> <code title="">upharpoonright;</code> </td> <td> U+021BE </td> <tr><td> <code title="">uplus;</code> </td> <td> U+0228E </td> <tr><td> <code title="">upsi;</code> </td> <td> U+003C5 </td> <tr><td> <code title="">upsih;</code> </td> <td> U+003D2 </td> <tr><td> <code title="">upsilon;</code> </td> <td> U+003C5 </td> <tr><td> <code title="">upuparrows;</code> </td> <td> U+021C8 </td> <tr><td> <code title="">urcorn;</code> </td> <td> U+0231D </td> <tr><td> <code title="">urcorner;</code> </td> <td> U+0231D </td> <tr><td> <code title="">urcrop;</code> </td> <td> U+0230E </td> <tr><td> <code title="">uring;</code> </td> <td> U+0016F </td> <tr><td> <code title="">urtri;</code> </td> <td> U+025F9 </td> <tr><td> <code title="">uscr;</code> </td> <td> U+1D4CA </td> <tr><td> <code title="">utdot;</code> </td> <td> U+022F0 </td> <tr><td> <code title="">utilde;</code> </td> <td> U+00169 </td> <tr><td> <code title="">utri;</code> </td> <td> U+025B5 </td> <tr><td> <code title="">utrif;</code> </td> <td> U+025B4 </td> <tr><td> <code title="">uuarr;</code> </td> <td> U+021C8 </td> <tr><td> <code title="">uuml;</code> </td> <td> U+000FC </td> <tr><td> <code title="">uuml</code> </td> <td> U+000FC </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">uwangle;</code> </td> <td> U+029A7 </td> <tr><td> <code title="">vArr;</code> </td> <td> U+021D5 </td> <tr><td> <code title="">vBar;</code> </td> <td> U+02AE8 </td> <tr><td> <code title="">vBarv;</code> </td> <td> U+02AE9 </td> <tr><td> <code title="">vDash;</code> </td> <td> U+022A8 </td> <tr><td> <code title="">vangrt;</code> </td> <td> U+0299C </td> <tr><td> <code title="">varepsilon;</code> </td> <td> U+003F5 </td> <tr><td> <code title="">varkappa;</code> </td> <td> U+003F0 </td> <tr><td> <code title="">varnothing;</code> </td> <td> U+02205 </td> <tr><td> <code title="">varphi;</code> </td> <td> U+003D5 </td> <tr><td> <code title="">varpi;</code> </td> <td> U+003D6 </td> <tr><td> <code title="">varpropto;</code> </td> <td> U+0221D </td> <tr><td> <code title="">varr;</code> </td> <td> U+02195 </td> <tr><td> <code title="">varrho;</code> </td> <td> U+003F1 </td> <tr><td> <code title="">varsigma;</code> </td> <td> U+003C2 </td> <tr><td> <code title="">vartheta;</code> </td> <td> U+003D1 </td> <tr><td> <code title="">vartriangleleft;</code> </td> <td> U+022B2 </td> <tr><td> <code title="">vartriangleright;</code> </td> <td> U+022B3 </td> <tr><td> <code title="">vcy;</code> </td> <td> U+00432 </td> <tr><td> <code title="">vdash;</code> </td> <td> U+022A2 </td> <tr><td> <code title="">vee;</code> </td> <td> U+02228 </td> <tr><td> <code title="">veebar;</code> </td> <td> U+022BB </td> <tr><td> <code title="">veeeq;</code> </td> <td> U+0225A </td> <tr><td> <code title="">vellip;</code> </td> <td> U+022EE </td> <tr><td> <code title="">verbar;</code> </td> <td> U+0007C </td> <tr><td> <code title="">vert;</code> </td> <td> U+0007C </td> <tr><td> <code title="">vfr;</code> </td> <td> U+1D533 </td> <tr><td> <code title="">vltri;</code> </td> <td> U+022B2 </td> <tr><td> <code title="">vopf;</code> </td> <td> U+1D567 </td> <tr><td> <code title="">vprop;</code> </td> <td> U+0221D </td> <tr><td> <code title="">vrtri;</code> </td> <td> U+022B3 </td> <tr><td> <code title="">vscr;</code> </td> <td> U+1D4CB </td> <tr><td> <code title="">vzigzag;</code> </td> <td> U+0299A </td> <tr><td> <code title="">wcirc;</code> </td> <td> U+00175 </td> <tr><td> <code title="">wedbar;</code> </td> <td> U+02A5F </td> <tr><td> <code title="">wedge;</code> </td> <td> U+02227 </td> <tr><td> <code title="">wedgeq;</code> </td> <td> U+02259 </td> <tr><td> <code title="">weierp;</code> </td> <td> U+02118 </td> <tr><td> <code title="">wfr;</code> </td> <td> U+1D534 </td> <tr><td> <code title="">wopf;</code> </td> <td> U+1D568 </td> <tr><td> <code title="">wp;</code> </td> <td> U+02118 </td> <tr><td> <code title="">wr;</code> </td> <td> U+02240 </td> <tr><td> <code title="">wreath;</code> </td> <td> U+02240 </td> <tr><td> <code title="">wscr;</code> </td> <td> U+1D4CC </td> <tr><td> <code title="">xcap;</code> </td> <td> U+022C2 </td> <tr><td> <code title="">xcirc;</code> </td> <td> U+025EF </td> <tr><td> <code title="">xcup;</code> </td> <td> U+022C3 </td> <tr><td> <code title="">xdtri;</code> </td> <td> U+025BD </td> <tr><td> <code title="">xfr;</code> </td> <td> U+1D535 </td> <tr><td> <code title="">xhArr;</code> </td> <td> U+027FA </td> <tr><td> <code title="">xharr;</code> </td> <td> U+027F7 </td> <tr><td> <code title="">xi;</code> </td> <td> U+003BE </td> <tr><td> <code title="">xlArr;</code> </td> <td> U+027F8 </td> <tr><td> <code title="">xlarr;</code> </td> <td> U+027F5 </td> <tr><td> <code title="">xmap;</code> </td> <td> U+027FC </td> <tr><td> <code title="">xnis;</code> </td> <td> U+022FB </td> <tr><td> <code title="">xodot;</code> </td> <td> U+02A00 </td> <tr><td> <code title="">xopf;</code> </td> <td> U+1D569 </td> <tr><td> <code title="">xoplus;</code> </td> <td> U+02A01 </td> <tr><td> <code title="">xotime;</code> </td> <td> U+02A02 </td> <tr><td> <code title="">xrArr;</code> </td> <td> U+027F9 </td> <tr><td> <code title="">xrarr;</code> </td> <td> U+027F6 </td> <tr><td> <code title="">xscr;</code> </td> <td> U+1D4CD </td> <tr><td> <code title="">xsqcup;</code> </td> <td> U+02A06 </td> <tr><td> <code title="">xuplus;</code> </td> <td> U+02A04 </td> <tr><td> <code title="">xutri;</code> </td> <td> U+025B3 </td> <tr><td> <code title="">xvee;</code> </td> <td> U+022C1 </td> <tr><td> <code title="">xwedge;</code> </td> <td> U+022C0 </td> <tr><td> <code title="">yacute;</code> </td> <td> U+000FD </td> <tr><td> <code title="">yacute</code> </td> <td> U+000FD </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">yacy;</code> </td> <td> U+0044F </td> <tr><td> <code title="">ycirc;</code> </td> <td> U+00177 </td> <tr><td> <code title="">ycy;</code> </td> <td> U+0044B </td> <tr><td> <code title="">yen;</code> </td> <td> U+000A5 </td> <tr><td> <code title="">yen</code> </td> <td> U+000A5 </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">yfr;</code> </td> <td> U+1D536 </td> <tr><td> <code title="">yicy;</code> </td> <td> U+00457 </td> <tr><td> <code title="">yopf;</code> </td> <td> U+1D56A </td> <tr><td> <code title="">yscr;</code> </td> <td> U+1D4CE </td> <tr><td> <code title="">yucy;</code> </td> <td> U+0044E </td> <tr><td> <code title="">yuml;</code> </td> <td> U+000FF </td> <tr><td> <code title="">yuml</code> </td> <td> U+000FF </td> </tr><!-- (invalid entity with missing semicolon for legacy support only) --><tr><td> <code title="">zacute;</code> </td> <td> U+0017A </td> <tr><td> <code title="">zcaron;</code> </td> <td> U+0017E </td> <tr><td> <code title="">zcy;</code> </td> <td> U+00437 </td> <tr><td> <code title="">zdot;</code> </td> <td> U+0017C </td> <tr><td> <code title="">zeetrf;</code> </td> <td> U+02128 </td> <tr><td> <code title="">zeta;</code> </td> <td> U+003B6 </td> <tr><td> <code title="">zfr;</code> </td> <td> U+1D537 </td> <tr><td> <code title="">zhcy;</code> </td> <td> U+00436 </td> <tr><td> <code title="">zigrarr;</code> </td> <td> U+021DD </td> <tr><td> <code title="">zopf;</code> </td> <td> U+1D56B </td> <tr><td> <code title="">zscr;</code> </td> <td> U+1D4CF </td> <tr><td> <code title="">zwj;</code> </td> <td> U+0200D </td> <tr><td> <code title="">zwnj;</code> </td> <td> U+0200C </td> </table>
+
+ \ No newline at end of file
diff --git a/parser/html/javasrc/AttributeName.java b/parser/html/javasrc/AttributeName.java
new file mode 100644
index 0000000000..8014cd8043
--- /dev/null
+++ b/parser/html/javasrc/AttributeName.java
@@ -0,0 +1,2278 @@
+/*
+ * Copyright (c) 2008-2017 Mozilla Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package nu.validator.htmlparser.impl;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import nu.validator.htmlparser.annotation.Inline;
+import nu.validator.htmlparser.annotation.Local;
+import nu.validator.htmlparser.annotation.NoLength;
+import nu.validator.htmlparser.annotation.NsUri;
+import nu.validator.htmlparser.annotation.Prefix;
+import nu.validator.htmlparser.annotation.QName;
+import nu.validator.htmlparser.annotation.Unsigned;
+import nu.validator.htmlparser.common.Interner;
+
+public final class AttributeName
+// Uncomment to regenerate
+// implements Comparable<AttributeName>
+{
+ // [NOCPP[
+
+ public static final int NCNAME_HTML = 1;
+
+ public static final int NCNAME_FOREIGN = (1 << 1) | (1 << 2);
+
+ public static final int NCNAME_LANG = (1 << 3);
+
+ public static final int IS_XMLNS = (1 << 4);
+
+ public static final int CASE_FOLDED = (1 << 5);
+
+ public static final int BOOLEAN = (1 << 6);
+
+ // ]NOCPP]
+
+ /**
+ * An array representing no namespace regardless of namespace mode (HTML,
+ * SVG, MathML, lang-mapping HTML) used.
+ */
+ static final @NoLength @NsUri String[] ALL_NO_NS = { "", "", "",
+ // [NOCPP[
+ ""
+ // ]NOCPP]
+ };
+
+ /**
+ * An array that has no namespace for the HTML mode but the XMLNS namespace
+ * for the SVG and MathML modes.
+ */
+ private static final @NoLength @NsUri String[] XMLNS_NS = { "",
+ "http://www.w3.org/2000/xmlns/", "http://www.w3.org/2000/xmlns/",
+ // [NOCPP[
+ ""
+ // ]NOCPP]
+ };
+
+ /**
+ * An array that has no namespace for the HTML mode but the XML namespace
+ * for the SVG and MathML modes.
+ */
+ private static final @NoLength @NsUri String[] XML_NS = { "",
+ "http://www.w3.org/XML/1998/namespace",
+ "http://www.w3.org/XML/1998/namespace",
+ // [NOCPP[
+ ""
+ // ]NOCPP]
+ };
+
+ /**
+ * An array that has no namespace for the HTML mode but the XLink namespace
+ * for the SVG and MathML modes.
+ */
+ private static final @NoLength @NsUri String[] XLINK_NS = { "",
+ "http://www.w3.org/1999/xlink", "http://www.w3.org/1999/xlink",
+ // [NOCPP[
+ ""
+ // ]NOCPP]
+ };
+
+ // [NOCPP[
+ /**
+ * An array that has no namespace for the HTML, SVG and MathML modes but has
+ * the XML namespace for the lang-mapping HTML mode.
+ */
+ private static final @NoLength @NsUri String[] LANG_NS = { "", "", "",
+ "http://www.w3.org/XML/1998/namespace" };
+
+ // ]NOCPP]
+
+ /**
+ * An array for no prefixes in any mode.
+ */
+ static final @NoLength @Prefix String[] ALL_NO_PREFIX = { null, null, null,
+ // [NOCPP[
+ null
+ // ]NOCPP]
+ };
+
+ /**
+ * An array for no prefixe in the HTML mode and the <code>xmlns</code>
+ * prefix in the SVG and MathML modes.
+ */
+ private static final @NoLength @Prefix String[] XMLNS_PREFIX = { null,
+ "xmlns", "xmlns",
+ // [NOCPP[
+ null
+ // ]NOCPP]
+ };
+
+ /**
+ * An array for no prefixe in the HTML mode and the <code>xlink</code>
+ * prefix in the SVG and MathML modes.
+ */
+ private static final @NoLength @Prefix String[] XLINK_PREFIX = { null,
+ "xlink", "xlink",
+ // [NOCPP[
+ null
+ // ]NOCPP]
+ };
+
+ /**
+ * An array for no prefixe in the HTML mode and the <code>xml</code> prefix
+ * in the SVG and MathML modes.
+ */
+ private static final @NoLength @Prefix String[] XML_PREFIX = { null, "xml",
+ "xml",
+ // [NOCPP[
+ null
+ // ]NOCPP]
+ };
+
+ // [NOCPP[
+
+ private static final @NoLength @Prefix String[] LANG_PREFIX = { null, null,
+ null, "xml" };
+
+ private static @QName String[] COMPUTE_QNAME(String[] local, String[] prefix) {
+ @QName String[] arr = new String[4];
+ for (int i = 0; i < arr.length; i++) {
+ if (prefix[i] == null) {
+ arr[i] = local[i];
+ } else {
+ arr[i] = (prefix[i] + ':' + local[i]).intern();
+ }
+ }
+ return arr;
+ }
+
+ // ]NOCPP]
+
+ /**
+ * An initialization helper for having a one name in the SVG mode and
+ * another name in the other modes.
+ *
+ * @param name
+ * the name for the non-SVG modes
+ * @param camel
+ * the name for the SVG mode
+ * @return the initialized name array
+ */
+ private static @NoLength @Local String[] SVG_DIFFERENT(@Local String name,
+ @Local String camel) {
+ @NoLength @Local String[] arr = new String[4];
+ arr[0] = name;
+ arr[1] = name;
+ arr[2] = camel;
+ // [NOCPP[
+ arr[3] = name;
+ // ]NOCPP]
+ return arr;
+ }
+
+ /**
+ * An initialization helper for having a one name in the MathML mode and
+ * another name in the other modes.
+ *
+ * @param name
+ * the name for the non-MathML modes
+ * @param camel
+ * the name for the MathML mode
+ * @return the initialized name array
+ */
+ private static @NoLength @Local String[] MATH_DIFFERENT(@Local String name,
+ @Local String camel) {
+ @NoLength @Local String[] arr = new String[4];
+ arr[0] = name;
+ arr[1] = camel;
+ arr[2] = name;
+ // [NOCPP[
+ arr[3] = name;
+ // ]NOCPP]
+ return arr;
+ }
+
+ /**
+ * An initialization helper for having a different local name in the HTML
+ * mode and the SVG and MathML modes.
+ *
+ * @param name
+ * the name for the HTML mode
+ * @param suffix
+ * the name for the SVG and MathML modes
+ * @return the initialized name array
+ */
+ private static @NoLength @Local String[] COLONIFIED_LOCAL(
+ @Local String name, @Local String suffix) {
+ @NoLength @Local String[] arr = new String[4];
+ arr[0] = name;
+ arr[1] = suffix;
+ arr[2] = suffix;
+ // [NOCPP[
+ arr[3] = name;
+ // ]NOCPP]
+ return arr;
+ }
+
+ /**
+ * An initialization helper for having the same local name in all modes.
+ *
+ * @param name
+ * the name
+ * @return the initialized name array
+ */
+ static @NoLength @Local String[] SAME_LOCAL(@Local String name) {
+ @NoLength @Local String[] arr = new String[4];
+ arr[0] = name;
+ arr[1] = name;
+ arr[2] = name;
+ // [NOCPP[
+ arr[3] = name;
+ // ]NOCPP]
+ return arr;
+ }
+
+ @Inline static int levelOrderBinarySearch(int[] data, int key) {
+ int n = data.length;
+ int i = 0;
+
+ while (i < n) {
+ int val = data[i];
+ if (val < key) {
+ i = 2 * i + 2;
+ } else if (val > key) {
+ i = 2 * i + 1;
+ } else {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Returns an attribute name by buffer.
+ *
+ * <p>
+ * C++ ownership: The return value is either released by the caller if the
+ * attribute is a duplicate or the ownership is transferred to
+ * HtmlAttributes and released upon clearing or destroying that object.
+ *
+ * @param buf
+ * the buffer
+ * @param offset
+ * ignored
+ * @param length
+ * length of data
+ * @param checkNcName
+ * whether to check ncnameness
+ * @return an <code>AttributeName</code> corresponding to the argument data
+ */
+ @Inline static AttributeName nameByBuffer(@NoLength char[] buf,
+ int length, Interner interner) {
+ // XXX deal with offset
+ @Unsigned int hash = AttributeName.bufToHash(buf, length);
+ int[] hashes;
+ hashes = AttributeName.ATTRIBUTE_HASHES;
+ int index = levelOrderBinarySearch(hashes, hash);
+ if (index < 0) {
+ return null;
+ }
+ AttributeName attributeName = AttributeName.ATTRIBUTE_NAMES[index];
+ @Local String name = attributeName.getLocal(0);
+ if (!Portability.localEqualsBuffer(name, buf, length)) {
+ return null;
+ }
+ return attributeName;
+ }
+
+ /**
+ * This method has to return a unique positive integer for each well-known
+ * lower-cased attribute name.
+ *
+ * @param buf
+ * @param len
+ * @return
+ */
+ @Inline private static @Unsigned int bufToHash(@NoLength char[] buf, int length) {
+ @Unsigned int len = length;
+ @Unsigned int first = buf[0];
+ first <<= 19;
+ @Unsigned int second = 1 << 23;
+ @Unsigned int third = 0;
+ @Unsigned int fourth = 0;
+ @Unsigned int fifth = 0;
+ @Unsigned int sixth = 0;
+ if (length >= 4) {
+ second = buf[length - 4];
+ second <<= 4;
+ third = buf[1];
+ third <<= 9;
+ fourth = buf[length - 2];
+ fourth <<= 14;
+ fifth = buf[3];
+ fifth <<= 24;
+ sixth = buf[length - 1];
+ sixth <<= 11;
+ } else if (length == 3) {
+ second = buf[1];
+ second <<= 4;
+ third = buf[2];
+ third <<= 9;
+ } else if (length == 2) {
+ second = buf[1];
+ second <<= 24;
+ }
+ return len + first + second + third + fourth + fifth + sixth;
+ }
+
+ /**
+ * The mode value for HTML.
+ */
+ public static final int HTML = 0;
+
+ /**
+ * The mode value for MathML.
+ */
+ public static final int MATHML = 1;
+
+ /**
+ * The mode value for SVG.
+ */
+ public static final int SVG = 2;
+
+ // [NOCPP[
+
+ /**
+ * The mode value for lang-mapping HTML.
+ */
+ public static final int HTML_LANG = 3;
+
+ // ]NOCPP]
+
+ /**
+ * The namespaces indexable by mode.
+ */
+ private final @NsUri @NoLength String[] uri;
+
+ /**
+ * The local names indexable by mode.
+ */
+ private final @Local @NoLength String[] local;
+
+ /**
+ * The prefixes indexably by mode.
+ */
+ private final @Prefix @NoLength String[] prefix;
+
+ // CPPONLY: private final boolean custom;
+
+ // [NOCPP[
+
+ private final int flags;
+
+ /**
+ * The qnames indexable by mode.
+ */
+ private final @QName @NoLength String[] qName;
+
+ // ]NOCPP]
+
+ /**
+ * The startup-time constructor.
+ *
+ * @param uri
+ * the namespace
+ * @param local
+ * the local name
+ * @param prefix
+ * the prefix
+ * @param ncname
+ * the ncnameness
+ * @param xmlns
+ * whether this is an xmlns attribute
+ */
+ private AttributeName(@NsUri @NoLength String[] uri,
+ @Local @NoLength String[] local, @Prefix @NoLength String[] prefix
+ // [NOCPP[
+ , int flags
+ // ]NOCPP]
+ ) {
+ this.uri = uri;
+ this.local = local;
+ this.prefix = prefix;
+ // [NOCPP[
+ this.qName = COMPUTE_QNAME(local, prefix);
+ this.flags = flags;
+ // ]NOCPP]
+ // CPPONLY: this.custom = false;
+ }
+
+ // CPPONLY: public AttributeName() {
+ // CPPONLY: this.uri = AttributeName.ALL_NO_NS;
+ // CPPONLY: this.local = AttributeName.SAME_LOCAL(null);
+ // CPPONLY: this.prefix = ALL_NO_PREFIX;
+ // CPPONLY: this.custom = true;
+ // CPPONLY: }
+ // CPPONLY:
+ // CPPONLY: @Inline public boolean isInterned() {
+ // CPPONLY: return !custom;
+ // CPPONLY: }
+ // CPPONLY:
+ // CPPONLY: @Inline public void setNameForNonInterned(@Local String name) {
+ // CPPONLY: assert custom;
+ // CPPONLY: local[0] = name;
+ // CPPONLY: local[1] = name;
+ // CPPONLY: local[2] = name;
+ // CPPONLY: }
+
+ /**
+ * Creates an <code>AttributeName</code> for a local name.
+ *
+ * @param name
+ * the name
+ * @param checkNcName
+ * whether to check ncnameness
+ * @return an <code>AttributeName</code>
+ */
+ static AttributeName createAttributeName(@Local String name
+ // [NOCPP[
+ , boolean checkNcName
+ // ]NOCPP]
+ ) {
+ // [NOCPP[
+ int flags = NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG;
+ if (name.startsWith("xmlns:")) {
+ flags = IS_XMLNS;
+ } else if (checkNcName && !NCName.isNCName(name)) {
+ flags = 0;
+ }
+ // ]NOCPP]
+ return new AttributeName(AttributeName.ALL_NO_NS,
+ AttributeName.SAME_LOCAL(name), ALL_NO_PREFIX, flags);
+ }
+
+ /**
+ * The C++ destructor.
+ */
+ @SuppressWarnings("unused") private void destructor() {
+ Portability.deleteArray(local);
+ }
+
+ // [NOCPP[
+ /**
+ * Creator for use when the XML violation policy requires an attribute name
+ * to be changed.
+ *
+ * @param name
+ * the name of the attribute to create
+ */
+ static AttributeName create(@Local String name) {
+ return new AttributeName(AttributeName.ALL_NO_NS,
+ AttributeName.SAME_LOCAL(name), ALL_NO_PREFIX,
+ NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ }
+
+ /**
+ * Queries whether this name is an XML 1.0 4th ed. NCName.
+ *
+ * @param mode
+ * the SVG/MathML/HTML mode
+ * @return <code>true</code> if this is an NCName in the given mode
+ */
+ public boolean isNcName(int mode) {
+ return (flags & (1 << mode)) != 0;
+ }
+
+ /**
+ * Queries whether this is an <code>xmlns</code> attribute.
+ *
+ * @return <code>true</code> if this is an <code>xmlns</code> attribute
+ */
+ public boolean isXmlns() {
+ return (flags & IS_XMLNS) != 0;
+ }
+
+ /**
+ * Queries whether this attribute has a case-folded value in the HTML4 mode
+ * of the parser.
+ *
+ * @return <code>true</code> if the value is case-folded
+ */
+ boolean isCaseFolded() {
+ return (flags & CASE_FOLDED) != 0;
+ }
+
+ boolean isBoolean() {
+ return (flags & BOOLEAN) != 0;
+ }
+
+ public @QName String getQName(int mode) {
+ return qName[mode];
+ }
+
+ // ]NOCPP]
+
+ public @NsUri String getUri(int mode) {
+ return uri[mode];
+ }
+
+ public @Local String getLocal(int mode) {
+ return local[mode];
+ }
+
+ public @Prefix String getPrefix(int mode) {
+ return prefix[mode];
+ }
+
+ boolean equalsAnother(AttributeName another) {
+ return this.getLocal(AttributeName.HTML) == another.getLocal(AttributeName.HTML);
+ }
+
+ // START CODE ONLY USED FOR GENERATING CODE uncomment to regenerate
+
+// /**
+// * @see java.lang.Object#toString()
+// */
+// @Override public String toString() {
+// return "(" + formatNs() + ", " + formatLocal() + ", " + formatPrefix()
+// + ", " + formatFlags() + ")";
+// }
+//
+// private String formatFlags() {
+// StringBuilder builder = new StringBuilder();
+// if ((flags & NCNAME_HTML) != 0) {
+// if (builder.length() != 0) {
+// builder.append(" | ");
+// }
+// builder.append("NCNAME_HTML");
+// }
+// if ((flags & NCNAME_FOREIGN) != 0) {
+// if (builder.length() != 0) {
+// builder.append(" | ");
+// }
+// builder.append("NCNAME_FOREIGN");
+// }
+// if ((flags & NCNAME_LANG) != 0) {
+// if (builder.length() != 0) {
+// builder.append(" | ");
+// }
+// builder.append("NCNAME_LANG");
+// }
+// if (isXmlns()) {
+// if (builder.length() != 0) {
+// builder.append(" | ");
+// }
+// builder.append("IS_XMLNS");
+// }
+// if (isCaseFolded()) {
+// if (builder.length() != 0) {
+// builder.append(" | ");
+// }
+// builder.append("CASE_FOLDED");
+// }
+// if (isBoolean()) {
+// if (builder.length() != 0) {
+// builder.append(" | ");
+// }
+// builder.append("BOOLEAN");
+// }
+// if (builder.length() == 0) {
+// return "0";
+// }
+// return builder.toString();
+// }
+//
+// public int compareTo(AttributeName other) {
+// int thisHash = this.hash();
+// int otherHash = other.hash();
+// if (thisHash < otherHash) {
+// return -1;
+// } else if (thisHash == otherHash) {
+// return 0;
+// } else {
+// return 1;
+// }
+// }
+//
+// private String formatPrefix() {
+// if (prefix[0] == null && prefix[1] == null && prefix[2] == null
+// && prefix[3] == null) {
+// return "ALL_NO_PREFIX";
+// } else if (prefix[0] == null && prefix[1] == prefix[2]
+// && prefix[3] == null) {
+// if ("xmlns".equals(prefix[1])) {
+// return "XMLNS_PREFIX";
+// } else if ("xml".equals(prefix[1])) {
+// return "XML_PREFIX";
+// } else if ("xlink".equals(prefix[1])) {
+// return "XLINK_PREFIX";
+// } else {
+// throw new IllegalStateException();
+// }
+// } else if (prefix[0] == null && prefix[1] == null && prefix[2] == null
+// && prefix[3] == "xml") {
+// return "LANG_PREFIX";
+// } else {
+// throw new IllegalStateException();
+// }
+// }
+//
+// private String formatLocal() {
+// if (local[0] == local[1] && local[0] == local[3]
+// && local[0] != local[2]) {
+// return "SVG_DIFFERENT(\"" + local[0] + "\", \"" + local[2] + "\")";
+// }
+// if (local[0] == local[2] && local[0] == local[3]
+// && local[0] != local[1]) {
+// return "MATH_DIFFERENT(\"" + local[0] + "\", \"" + local[1] + "\")";
+// }
+// if (local[0] == local[3] && local[1] == local[2]
+// && local[0] != local[1]) {
+// return "COLONIFIED_LOCAL(\"" + local[0] + "\", \"" + local[1]
+// + "\")";
+// }
+// for (int i = 1; i < local.length; i++) {
+// if (local[0] != local[i]) {
+// throw new IllegalStateException();
+// }
+// }
+// return "SAME_LOCAL(\"" + local[0] + "\")";
+// }
+//
+// private String formatNs() {
+// if (uri[0] == "" && uri[1] == "" && uri[2] == "" && uri[3] == "") {
+// return "ALL_NO_NS";
+// } else if (uri[0] == "" && uri[1] == uri[2] && uri[3] == "") {
+// if ("http://www.w3.org/2000/xmlns/".equals(uri[1])) {
+// return "XMLNS_NS";
+// } else if ("http://www.w3.org/XML/1998/namespace".equals(uri[1])) {
+// return "XML_NS";
+// } else if ("http://www.w3.org/1999/xlink".equals(uri[1])) {
+// return "XLINK_NS";
+// } else {
+// throw new IllegalStateException();
+// }
+// } else if (uri[0] == "" && uri[1] == "" && uri[2] == ""
+// && uri[3] == "http://www.w3.org/XML/1998/namespace") {
+// return "LANG_NS";
+// } else {
+// throw new IllegalStateException();
+// }
+// }
+//
+// private String constName() {
+// String name = getLocal(HTML);
+// char[] buf = new char[name.length()];
+// for (int i = 0; i < name.length(); i++) {
+// char c = name.charAt(i);
+// if (c == '-' || c == ':') {
+// buf[i] = '_';
+// } else if (c >= 'a' && c <= 'z') {
+// buf[i] = (char) (c - 0x20);
+// } else {
+// buf[i] = c;
+// }
+// }
+// return new String(buf);
+// }
+//
+// private int hash() {
+// String name = getLocal(HTML);
+// return bufToHash(name.toCharArray(), name.length());
+// }
+//
+// private static void fillLevelOrderArray(List<AttributeName> sorted, int depth,
+// int rootIdx, AttributeName[] levelOrder) {
+// if (rootIdx >= levelOrder.length) {
+// return;
+// }
+//
+// if (depth > 0) {
+// fillLevelOrderArray(sorted, depth - 1, rootIdx * 2 + 1, levelOrder);
+// }
+//
+// if (!sorted.isEmpty()) {
+// levelOrder[rootIdx] = sorted.remove(0);
+// }
+//
+// if (depth > 0) {
+// fillLevelOrderArray(sorted, depth - 1, rootIdx * 2 + 2, levelOrder);
+// }
+// }
+//
+// /**
+// * Regenerate self
+// *
+// * @param args
+// */
+// public static void main(String[] args) {
+// Arrays.sort(ATTRIBUTE_NAMES);
+// for (int i = 0; i < ATTRIBUTE_NAMES.length; i++) {
+// int hash = ATTRIBUTE_NAMES[i].hash();
+// if (hash < 0) {
+// System.err.println("Negative hash: " + ATTRIBUTE_NAMES[i].local[0]);
+// return;
+// }
+// for (int j = i + 1; j < ATTRIBUTE_NAMES.length; j++) {
+// if (hash == ATTRIBUTE_NAMES[j].hash()) {
+// System.err.println(
+// "Hash collision: " + ATTRIBUTE_NAMES[i].local[0] + ", "
+// + ATTRIBUTE_NAMES[j].local[0]);
+// return;
+// }
+// }
+// }
+// for (int i = 0; i < ATTRIBUTE_NAMES.length; i++) {
+// AttributeName att = ATTRIBUTE_NAMES[i];
+// System.out.println("public static final AttributeName "
+// + att.constName() + " = new AttributeName" + att.toString()
+// + ";");
+// }
+//
+// LinkedList<AttributeName> sortedNames = new LinkedList<AttributeName>();
+// Collections.addAll(sortedNames, ATTRIBUTE_NAMES);
+// AttributeName[] levelOrder = new AttributeName[ATTRIBUTE_NAMES.length];
+// int bstDepth = (int) Math.ceil(Math.log(ATTRIBUTE_NAMES.length) / Math.log(2));
+// fillLevelOrderArray(sortedNames, bstDepth, 0, levelOrder);
+//
+// System.out.println("private final static @NoLength AttributeName[] ATTRIBUTE_NAMES = {");
+// for (int i = 0; i < levelOrder.length; i++) {
+// AttributeName att = levelOrder[i];
+// System.out.println(att.constName() + ",");
+// }
+// System.out.println("};");
+// System.out.println("private final static int[] ATTRIBUTE_HASHES = {");
+// for (int i = 0; i < levelOrder.length; i++) {
+// AttributeName att = levelOrder[i];
+// System.out.println(Integer.toString(att.hash()) + ",");
+// }
+// System.out.println("};");
+// }
+
+ // START GENERATED CODE
+ public static final AttributeName ALT = new AttributeName(ALL_NO_NS, SAME_LOCAL("alt"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DIR = new AttributeName(ALL_NO_NS, SAME_LOCAL("dir"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName DUR = new AttributeName(ALL_NO_NS, SAME_LOCAL("dur"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName END = new AttributeName(ALL_NO_NS, SAME_LOCAL("end"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("for"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName IN2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("in2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LOW = new AttributeName(ALL_NO_NS, SAME_LOCAL("low"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("min"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MAX = new AttributeName(ALL_NO_NS, SAME_LOCAL("max"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REL = new AttributeName(ALL_NO_NS, SAME_LOCAL("rel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REV = new AttributeName(ALL_NO_NS, SAME_LOCAL("rev"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SRC = new AttributeName(ALL_NO_NS, SAME_LOCAL("src"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName D = new AttributeName(ALL_NO_NS, SAME_LOCAL("d"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName R = new AttributeName(ALL_NO_NS, SAME_LOCAL("r"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName X = new AttributeName(ALL_NO_NS, SAME_LOCAL("x"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName Y = new AttributeName(ALL_NO_NS, SAME_LOCAL("y"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName Z = new AttributeName(ALL_NO_NS, SAME_LOCAL("z"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName K1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName X1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("x1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName Y1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("y1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName K2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName X2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("x2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName Y2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("y2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName K3 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k3"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName K4 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k4"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName XML_SPACE = new AttributeName(XML_NS, COLONIFIED_LOCAL("xml:space", "space"), XML_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XML_LANG = new AttributeName(XML_NS, COLONIFIED_LOCAL("xml:lang", "lang"), XML_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName ARIA_GRAB = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-grab"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_VALUEMAX = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-valuemax"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_LABELLEDBY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-labelledby"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_DESCRIBEDBY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-describedby"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_DISABLED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-disabled"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_CHECKED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-checked"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_SELECTED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-selected"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_DROPEFFECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-dropeffect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_REQUIRED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-required"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_EXPANDED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-expanded"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_PRESSED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-pressed"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_LEVEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-level"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_CHANNEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-channel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_HIDDEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-hidden"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_SECRET = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-secret"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_POSINSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-posinset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_ATOMIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-atomic"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_INVALID = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-invalid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_TEMPLATEID = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-templateid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_VALUEMIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-valuemin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_MULTISELECTABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-multiselectable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_CONTROLS = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-controls"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_MULTILINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-multiline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_READONLY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-readonly"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_OWNS = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-owns"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_ACTIVEDESCENDANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-activedescendant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_RELEVANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-relevant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_DATATYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-datatype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_VALUENOW = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-valuenow"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_SORT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-sort"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_AUTOCOMPLETE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-autocomplete"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_FLOWTO = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-flowto"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_BUSY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-busy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_LIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-live"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_HASPOPUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-haspopup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARIA_SETSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-setsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLEAR = new AttributeName(ALL_NO_NS, SAME_LOCAL("clear"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName DISABLED = new AttributeName(ALL_NO_NS, SAME_LOCAL("disabled"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName DEFAULT = new AttributeName(ALL_NO_NS, SAME_LOCAL("default"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName DATA = new AttributeName(ALL_NO_NS, SAME_LOCAL("data"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName EQUALCOLUMNS = new AttributeName(ALL_NO_NS, SAME_LOCAL("equalcolumns"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName EQUALROWS = new AttributeName(ALL_NO_NS, SAME_LOCAL("equalrows"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("hspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ISMAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("ismap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName LOCAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("local"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("lspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MOVABLELIMITS = new AttributeName(ALL_NO_NS, SAME_LOCAL("movablelimits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NOTATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("notation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDATAAVAILABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondataavailable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONPASTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onpaste"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("rspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ROWALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowalign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ROTATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("rotate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SEPARATOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("separator"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SEPARATORS = new AttributeName(ALL_NO_NS, SAME_LOCAL("separators"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("vspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName XCHANNELSELECTOR = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("xchannelselector", "xChannelSelector"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName YCHANNELSELECTOR = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("ychannelselector", "yChannelSelector"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ENABLE_BACKGROUND = new AttributeName(ALL_NO_NS, SAME_LOCAL("enable-background"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDBLCLICK = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondblclick"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONABORT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onabort"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CALCMODE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("calcmode", "calcMode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CHECKED = new AttributeName(ALL_NO_NS, SAME_LOCAL("checked"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName FENCE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fence"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONSCROLL = new AttributeName(ALL_NO_NS, SAME_LOCAL("onscroll"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONACTIVATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onactivate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("spacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SPECULAREXPONENT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("specularexponent", "specularExponent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SPECULARCONSTANT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("specularconstant", "specularConstant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BORDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("border"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ID = new AttributeName(ALL_NO_NS, SAME_LOCAL("id"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName GRADIENTTRANSFORM = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("gradienttransform", "gradientTransform"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName GRADIENTUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("gradientunits", "gradientUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HIDDEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("hidden"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HEADERS = new AttributeName(ALL_NO_NS, SAME_LOCAL("headers"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LOADING = new AttributeName(ALL_NO_NS, SAME_LOCAL("loading"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName READONLY = new AttributeName(ALL_NO_NS, SAME_LOCAL("readonly"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName RENDERING_INTENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("rendering-intent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SEED = new AttributeName(ALL_NO_NS, SAME_LOCAL("seed"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SRCDOC = new AttributeName(ALL_NO_NS, SAME_LOCAL("srcdoc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STDDEVIATION = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("stddeviation", "stdDeviation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SANDBOX = new AttributeName(ALL_NO_NS, SAME_LOCAL("sandbox"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName WORD_SPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("word-spacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACCENTUNDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("accentunder"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACCEPT_CHARSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("accept-charset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACCESSKEY = new AttributeName(ALL_NO_NS, SAME_LOCAL("accesskey"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACCENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("accent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACCEPT = new AttributeName(ALL_NO_NS, SAME_LOCAL("accept"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BEVELLED = new AttributeName(ALL_NO_NS, SAME_LOCAL("bevelled"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BASEFREQUENCY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("basefrequency", "baseFrequency"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BASELINE_SHIFT = new AttributeName(ALL_NO_NS, SAME_LOCAL("baseline-shift"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BASEPROFILE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("baseprofile", "baseProfile"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BASELINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("baseline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BASE = new AttributeName(ALL_NO_NS, SAME_LOCAL("base"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("code"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CODETYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("codetype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CODEBASE = new AttributeName(ALL_NO_NS, SAME_LOCAL("codebase"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CITE = new AttributeName(ALL_NO_NS, SAME_LOCAL("cite"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DEFER = new AttributeName(ALL_NO_NS, SAME_LOCAL("defer"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName DATETIME = new AttributeName(ALL_NO_NS, SAME_LOCAL("datetime"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DIRECTION = new AttributeName(ALL_NO_NS, SAME_LOCAL("direction"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName EDGEMODE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("edgemode", "edgeMode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName EDGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("edge"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ENTERKEYHINT = new AttributeName(ALL_NO_NS, SAME_LOCAL("enterkeyhint"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("face"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName INDEX = new AttributeName(ALL_NO_NS, SAME_LOCAL("index"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName INTERCEPT = new AttributeName(ALL_NO_NS, SAME_LOCAL("intercept"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName INTEGRITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("integrity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LINEBREAK = new AttributeName(ALL_NO_NS, SAME_LOCAL("linebreak"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LABEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("label"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LINETHICKNESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("linethickness"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("mode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NAME = new AttributeName(ALL_NO_NS, SAME_LOCAL("name"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NORESIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("noresize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName ONBEFOREUNLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeunload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONREPEAT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onrepeat"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OBJECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("object"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONSELECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onselect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ORDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("order"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OTHER = new AttributeName(ALL_NO_NS, SAME_LOCAL("other"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONRESET = new AttributeName(ALL_NO_NS, SAME_LOCAL("onreset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONREADYSTATECHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onreadystatechange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMESSAGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmessage"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONBEGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbegin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONBEFOREPRINT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeprint"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ORIENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("orient"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ORIENTATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("orientation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONBEFORECOPY = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforecopy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONSELECTSTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("onselectstart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONBEFOREPASTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforepaste"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONKEYPRESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("onkeypress"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONKEYUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onkeyup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONBEFORECUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforecut"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONKEYDOWN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onkeydown"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONRESIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onresize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REPEAT = new AttributeName(ALL_NO_NS, SAME_LOCAL("repeat"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REFERRERPOLICY = new AttributeName(ALL_NO_NS, SAME_LOCAL("referrerpolicy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RULES = new AttributeName(ALL_NO_NS, SAME_LOCAL("rules"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName ROLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("role"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REPEATCOUNT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("repeatcount", "repeatCount"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REPEATDUR = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("repeatdur", "repeatDur"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SELECTED = new AttributeName(ALL_NO_NS, SAME_LOCAL("selected"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName SIZES = new AttributeName(ALL_NO_NS, SAME_LOCAL("sizes"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SUPERSCRIPTSHIFT = new AttributeName(ALL_NO_NS, SAME_LOCAL("superscriptshift"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STRETCHY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stretchy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCHEME = new AttributeName(ALL_NO_NS, SAME_LOCAL("scheme"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SPREADMETHOD = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("spreadmethod", "spreadMethod"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SELECTION = new AttributeName(ALL_NO_NS, SAME_LOCAL("selection"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("size"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("type"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName DIFFUSECONSTANT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("diffuseconstant", "diffuseConstant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HREF = new AttributeName(ALL_NO_NS, SAME_LOCAL("href"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HREFLANG = new AttributeName(ALL_NO_NS, SAME_LOCAL("hreflang"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONAFTERPRINT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onafterprint"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PROFILE = new AttributeName(ALL_NO_NS, SAME_LOCAL("profile"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SURFACESCALE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("surfacescale", "surfaceScale"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName XREF = new AttributeName(ALL_NO_NS, SAME_LOCAL("xref"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("align"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName ALIGNMENT_BASELINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("alignment-baseline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ALIGNMENTSCOPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("alignmentscope"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DRAGGABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("draggable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("height"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName IMAGESIZES = new AttributeName(ALL_NO_NS, SAME_LOCAL("imagesizes"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName IMAGESRCSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("imagesrcset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName IMAGE_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("image-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LANGUAGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("language"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LANG = new AttributeName(LANG_NS, SAME_LOCAL("lang"), LANG_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LARGEOP = new AttributeName(ALL_NO_NS, SAME_LOCAL("largeop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LONGDESC = new AttributeName(ALL_NO_NS, SAME_LOCAL("longdesc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LENGTHADJUST = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("lengthadjust", "lengthAdjust"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARGINHEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("marginheight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARGINWIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("marginwidth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ORIGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("origin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PING = new AttributeName(ALL_NO_NS, SAME_LOCAL("ping"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TARGET = new AttributeName(ALL_NO_NS, SAME_LOCAL("target"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TARGETX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("targetx", "targetX"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TARGETY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("targety", "targetY"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ARCHIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("archive"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HIGH = new AttributeName(ALL_NO_NS, SAME_LOCAL("high"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LIGHTING_COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("lighting-color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MATHBACKGROUND = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathbackground"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName METHOD = new AttributeName(ALL_NO_NS, SAME_LOCAL("method"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName MATHVARIANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathvariant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MATHCOLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathcolor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MATHSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NOSHADE = new AttributeName(ALL_NO_NS, SAME_LOCAL("noshade"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName ONCHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onchange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PATHLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pathlength", "pathLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PATH = new AttributeName(ALL_NO_NS, SAME_LOCAL("path"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ALTIMG = new AttributeName(ALL_NO_NS, SAME_LOCAL("altimg"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACTIONTYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("actiontype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACTION = new AttributeName(ALL_NO_NS, SAME_LOCAL("action"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACTIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("active"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName ADDITIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("additive"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BEGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("begin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DOMINANT_BASELINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("dominant-baseline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DIVISOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("divisor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DEFINITIONURL = new AttributeName(ALL_NO_NS, MATH_DIFFERENT("definitionurl", "definitionURL"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LIMITINGCONEANGLE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("limitingconeangle", "limitingConeAngle"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MEDIA = new AttributeName(ALL_NO_NS, SAME_LOCAL("media"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MANIFEST = new AttributeName(ALL_NO_NS, SAME_LOCAL("manifest"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONFINISH = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfinish"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OPTIMUM = new AttributeName(ALL_NO_NS, SAME_LOCAL("optimum"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RADIOGROUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("radiogroup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RADIUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("radius"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCRIPTLEVEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("scriptlevel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCRIPTSIZEMULTIPLIER = new AttributeName(ALL_NO_NS, SAME_LOCAL("scriptsizemultiplier"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCRIPTMINSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("scriptminsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TABINDEX = new AttributeName(ALL_NO_NS, SAME_LOCAL("tabindex"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("valign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName VISIBILITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("visibility"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BACKGROUND = new AttributeName(ALL_NO_NS, SAME_LOCAL("background"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LINK = new AttributeName(ALL_NO_NS, SAME_LOCAL("link"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARKER_MID = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-mid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARKERHEIGHT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("markerheight", "markerHeight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARKER_END = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-end"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MASK = new AttributeName(ALL_NO_NS, SAME_LOCAL("mask"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARKER_START = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-start"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARKERWIDTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("markerwidth", "markerWidth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MASKUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("maskunits", "maskUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MARKERUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("markerunits", "markerUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MASKCONTENTUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("maskcontentunits", "maskContentUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName AMPLITUDE = new AttributeName(ALL_NO_NS, SAME_LOCAL("amplitude"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CELLSPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("cellspacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CELLPADDING = new AttributeName(ALL_NO_NS, SAME_LOCAL("cellpadding"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DECLARE = new AttributeName(ALL_NO_NS, SAME_LOCAL("declare"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName FILL_RULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fill-rule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FILL = new AttributeName(ALL_NO_NS, SAME_LOCAL("fill"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FILL_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("fill-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MAXLENGTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("maxlength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONCLICK = new AttributeName(ALL_NO_NS, SAME_LOCAL("onclick"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONBLUR = new AttributeName(ALL_NO_NS, SAME_LOCAL("onblur"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REPLACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("replace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName ROWLINES = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowlines"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCALE = new AttributeName(ALL_NO_NS, SAME_LOCAL("scale"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("style"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TABLEVALUES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("tablevalues", "tableValues"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TITLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("title"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName AZIMUTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("azimuth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FORMAT = new AttributeName(ALL_NO_NS, SAME_LOCAL("format"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FRAMEBORDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("frameborder"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FRAME = new AttributeName(ALL_NO_NS, SAME_LOCAL("frame"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName FRAMESPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("framespacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FROM = new AttributeName(ALL_NO_NS, SAME_LOCAL("from"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FORM = new AttributeName(ALL_NO_NS, SAME_LOCAL("form"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PROMPT = new AttributeName(ALL_NO_NS, SAME_LOCAL("prompt"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PRIMITIVEUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("primitiveunits", "primitiveUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SYMMETRIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("symmetric"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SUMMARY = new AttributeName(ALL_NO_NS, SAME_LOCAL("summary"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName USEMAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("usemap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ZOOMANDPAN = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("zoomandpan", "zoomAndPan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ASYNC = new AttributeName(ALL_NO_NS, SAME_LOCAL("async"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName ALINK = new AttributeName(ALL_NO_NS, SAME_LOCAL("alink"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName IN = new AttributeName(ALL_NO_NS, SAME_LOCAL("in"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ICON = new AttributeName(ALL_NO_NS, SAME_LOCAL("icon"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KERNELMATRIX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("kernelmatrix", "kernelMatrix"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KERNING = new AttributeName(ALL_NO_NS, SAME_LOCAL("kerning"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KERNELUNITLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("kernelunitlength", "kernelUnitLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONUNLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onunload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OPEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("open"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONINVALID = new AttributeName(ALL_NO_NS, SAME_LOCAL("oninvalid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONEND = new AttributeName(ALL_NO_NS, SAME_LOCAL("onend"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONINPUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oninput"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName POINTER_EVENTS = new AttributeName(ALL_NO_NS, SAME_LOCAL("pointer-events"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName POINTS = new AttributeName(ALL_NO_NS, SAME_LOCAL("points"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName POINTSATX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pointsatx", "pointsAtX"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName POINTSATY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pointsaty", "pointsAtY"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName POINTSATZ = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pointsatz", "pointsAtZ"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("span"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STANDBY = new AttributeName(ALL_NO_NS, SAME_LOCAL("standby"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TRANSFORM_ORIGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("transform-origin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TRANSFORM = new AttributeName(ALL_NO_NS, SAME_LOCAL("transform"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VLINK = new AttributeName(ALL_NO_NS, SAME_LOCAL("vlink"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName WHEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("when"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName XLINK_HREF = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:href", "href"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XLINK_TITLE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:title", "title"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XLINK_ROLE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:role", "role"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XLINK_ARCROLE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:arcrole", "arcrole"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XMLNS_XLINK = new AttributeName(XMLNS_NS, COLONIFIED_LOCAL("xmlns:xlink", "xlink"), XMLNS_PREFIX, IS_XMLNS);
+ public static final AttributeName XMLNS = new AttributeName(XMLNS_NS, SAME_LOCAL("xmlns"), ALL_NO_PREFIX, IS_XMLNS);
+ public static final AttributeName XLINK_TYPE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:type", "type"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XLINK_SHOW = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:show", "show"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName XLINK_ACTUATE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:actuate", "actuate"), XLINK_PREFIX, NCNAME_FOREIGN);
+ public static final AttributeName AUTOPLAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("autoplay"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName AUTOCOMPLETE = new AttributeName(ALL_NO_NS, SAME_LOCAL("autocomplete"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName AUTOFOCUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("autofocus"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName AUTOCAPITALIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("autocapitalize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BGCOLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("bgcolor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLOR_PROFILE = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-profile"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLOR_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLOR_INTERPOLATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-interpolation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLOR_INTERPOLATION_FILTERS = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-interpolation-filters"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ENCODING = new AttributeName(ALL_NO_NS, SAME_LOCAL("encoding"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName EXPONENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("exponent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FLOOD_COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("flood-color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FLOOD_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("flood-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LQUOTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("lquote"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NUMOCTAVES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("numoctaves", "numOctaves"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NOMODULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("nomodule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName ONLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEWHEEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmousewheel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEENTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseenter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEOVER = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseover"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONFOCUSIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocusin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONCONTEXTMENU = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncontextmenu"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONZOOM = new AttributeName(ALL_NO_NS, SAME_LOCAL("onzoom"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONCOPY = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncopy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSELEAVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseleave"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEMOVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmousemove"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONFOCUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocus"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEOUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseout"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONFOCUSOUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocusout"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONMOUSEDOWN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmousedown"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TO = new AttributeName(ALL_NO_NS, SAME_LOCAL("to"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RQUOTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("rquote"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE_LINECAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-linecap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE_DASHARRAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-dasharray"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE_DASHOFFSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-dashoffset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE_LINEJOIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-linejoin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE_MITERLIMIT = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-miterlimit"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCROLLING = new AttributeName(ALL_NO_NS, SAME_LOCAL("scrolling"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName STROKE_WIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-width"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STROKE_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COMPACT = new AttributeName(ALL_NO_NS, SAME_LOCAL("compact"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName CLIP = new AttributeName(ALL_NO_NS, SAME_LOCAL("clip"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLIP_RULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("clip-rule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLIP_PATH = new AttributeName(ALL_NO_NS, SAME_LOCAL("clip-path"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLIPPATHUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("clippathunits", "clipPathUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DISPLAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("display"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DISPLAYSTYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("displaystyle"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName GLYPH_ORIENTATION_VERTICAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("glyph-orientation-vertical"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName GLYPH_ORIENTATION_HORIZONTAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("glyph-orientation-horizontal"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName GLYPHREF = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("glyphref", "glyphRef"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName HTTP_EQUIV = new AttributeName(ALL_NO_NS, SAME_LOCAL("http-equiv"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KEYPOINTS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("keypoints", "keyPoints"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LOOP = new AttributeName(ALL_NO_NS, SAME_LOCAL("loop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PROPERTY = new AttributeName(ALL_NO_NS, SAME_LOCAL("property"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCOPED = new AttributeName(ALL_NO_NS, SAME_LOCAL("scoped"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STEP = new AttributeName(ALL_NO_NS, SAME_LOCAL("step"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName SHAPE_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("shape-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SCOPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("scope"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName SHAPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("shape"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName SLOPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("slope"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STOP_COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("stop-color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STOP_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stop-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TEMPLATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("template"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName WRAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("wrap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ABBR = new AttributeName(ALL_NO_NS, SAME_LOCAL("abbr"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ATTRIBUTENAME = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("attributename", "attributeName"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ATTRIBUTETYPE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("attributetype", "attributeType"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CHAR = new AttributeName(ALL_NO_NS, SAME_LOCAL("char"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COORDS = new AttributeName(ALL_NO_NS, SAME_LOCAL("coords"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CHAROFF = new AttributeName(ALL_NO_NS, SAME_LOCAL("charoff"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CHARSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("charset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName NOWRAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("nowrap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName NOHREF = new AttributeName(ALL_NO_NS, SAME_LOCAL("nohref"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName ONDRAG = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondrag"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDRAGENTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragenter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDRAGOVER = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragover"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDRAGEND = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragend"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDROP = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondrop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDRAGDROP = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragdrop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONERROR = new AttributeName(ALL_NO_NS, SAME_LOCAL("onerror"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OPERATOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("operator"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OVERFLOW = new AttributeName(ALL_NO_NS, SAME_LOCAL("overflow"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDRAGSTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragstart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONDRAGLEAVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragleave"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STARTOFFSET = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("startoffset", "startOffset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName START = new AttributeName(ALL_NO_NS, SAME_LOCAL("start"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName AS = new AttributeName(ALL_NO_NS, SAME_LOCAL("as"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName AXIS = new AttributeName(ALL_NO_NS, SAME_LOCAL("axis"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BIAS = new AttributeName(ALL_NO_NS, SAME_LOCAL("bias"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLSPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("colspan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLASSID = new AttributeName(ALL_NO_NS, SAME_LOCAL("classid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CROSSORIGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("crossorigin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLS = new AttributeName(ALL_NO_NS, SAME_LOCAL("cols"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CURSOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("cursor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLOSURE = new AttributeName(ALL_NO_NS, SAME_LOCAL("closure"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLOSE = new AttributeName(ALL_NO_NS, SAME_LOCAL("close"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CLASS = new AttributeName(ALL_NO_NS, SAME_LOCAL("class"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName IS = new AttributeName(ALL_NO_NS, SAME_LOCAL("is"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KEYSYSTEM = new AttributeName(ALL_NO_NS, SAME_LOCAL("keysystem"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KEYSPLINES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("keysplines", "keySplines"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LOWSRC = new AttributeName(ALL_NO_NS, SAME_LOCAL("lowsrc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MAXSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("maxsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MINSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("minsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName OFFSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("offset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PRESERVEALPHA = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("preservealpha", "preserveAlpha"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PRESERVEASPECTRATIO = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("preserveaspectratio", "preserveAspectRatio"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ROWSPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowspan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ROWSPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowspacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ROWS = new AttributeName(ALL_NO_NS, SAME_LOCAL("rows"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SRCSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("srcset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SUBSCRIPTSHIFT = new AttributeName(ALL_NO_NS, SAME_LOCAL("subscriptshift"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VERSION = new AttributeName(ALL_NO_NS, SAME_LOCAL("version"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ALTTEXT = new AttributeName(ALL_NO_NS, SAME_LOCAL("alttext"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CONTENTEDITABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("contenteditable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CONTROLS = new AttributeName(ALL_NO_NS, SAME_LOCAL("controls"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CONTENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("content"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CONTEXTMENU = new AttributeName(ALL_NO_NS, SAME_LOCAL("contextmenu"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DEPTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("depth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ENCTYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("enctype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName FONT_STRETCH = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-stretch"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FILTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("filter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONTWEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontweight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONT_WEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-weight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONTSTYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontstyle"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONT_STYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-style"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONTFAMILY = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontfamily"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONT_FAMILY = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-family"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONT_VARIANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-variant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONT_SIZE_ADJUST = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-size-adjust"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FILTERUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("filterunits", "filterUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONTSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FONT_SIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-size"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName KEYTIMES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("keytimes", "keyTimes"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LETTER_SPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("letter-spacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName LIST = new AttributeName(ALL_NO_NS, SAME_LOCAL("list"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName MULTIPLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("multiple"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName RT = new AttributeName(ALL_NO_NS, SAME_LOCAL("rt"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONSTOP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onstop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONSTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("onstart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName POSTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("poster"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PATTERNTRANSFORM = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("patterntransform", "patternTransform"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PATTERN = new AttributeName(ALL_NO_NS, SAME_LOCAL("pattern"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PATTERNUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("patternunits", "patternUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName PATTERNCONTENTUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("patterncontentunits", "patternContentUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RESTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("restart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName STITCHTILES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("stitchtiles", "stitchTiles"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName SYSTEMLANGUAGE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("systemlanguage", "systemLanguage"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TEXT_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("text-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TEXT_DECORATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("text-decoration"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TEXT_ANCHOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("text-anchor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TEXTLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("textlength", "textLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName TEXT = new AttributeName(ALL_NO_NS, SAME_LOCAL("text"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName WRITING_MODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("writing-mode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName WIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("width"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ACCUMULATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("accumulate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLUMNSPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnspan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLUMNLINES = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnlines"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLUMNALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnalign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLUMNSPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnspacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName COLUMNWIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnwidth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName GROUPALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("groupalign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName INPUTMODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("inputmode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONSUBMIT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onsubmit"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ONCUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncut"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REQUIRED = new AttributeName(ALL_NO_NS, SAME_LOCAL("required"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
+ public static final AttributeName REQUIREDFEATURES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("requiredfeatures", "requiredFeatures"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RESULT = new AttributeName(ALL_NO_NS, SAME_LOCAL("result"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REQUIREDEXTENSIONS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("requiredextensions", "requiredExtensions"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VALUES = new AttributeName(ALL_NO_NS, SAME_LOCAL("values"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VALUETYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("valuetype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
+ public static final AttributeName VALUE = new AttributeName(ALL_NO_NS, SAME_LOCAL("value"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName ELEVATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("elevation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VIEWTARGET = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("viewtarget", "viewTarget"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName VIEWBOX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("viewbox", "viewBox"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CX = new AttributeName(ALL_NO_NS, SAME_LOCAL("cx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DX = new AttributeName(ALL_NO_NS, SAME_LOCAL("dx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FX = new AttributeName(ALL_NO_NS, SAME_LOCAL("fx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RX = new AttributeName(ALL_NO_NS, SAME_LOCAL("rx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REFX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("refx", "refX"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName BY = new AttributeName(ALL_NO_NS, SAME_LOCAL("by"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName CY = new AttributeName(ALL_NO_NS, SAME_LOCAL("cy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName DY = new AttributeName(ALL_NO_NS, SAME_LOCAL("dy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName FY = new AttributeName(ALL_NO_NS, SAME_LOCAL("fy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName RY = new AttributeName(ALL_NO_NS, SAME_LOCAL("ry"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ public static final AttributeName REFY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("refy", "refY"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
+ private final static @NoLength AttributeName[] ATTRIBUTE_NAMES = {
+ FILL,
+ DATETIME,
+ CHAROFF,
+ CLEAR,
+ IMAGESRCSET,
+ COLOR,
+ LETTER_SPACING,
+ ARIA_DISABLED,
+ SPECULAREXPONENT,
+ ONKEYUP,
+ DOMINANT_BASELINE,
+ OPEN,
+ SCROLLING,
+ MAXSIZE,
+ REQUIREDFEATURES,
+ Y,
+ ARIA_MULTISELECTABLE,
+ ROTATE,
+ ACCENTUNDER,
+ ONREPEAT,
+ SELECTION,
+ LIGHTING_COLOR,
+ BACKGROUND,
+ FROM,
+ XLINK_TITLE,
+ ONCOPY,
+ PROPERTY,
+ START,
+ DEPTH,
+ TEXT_ANCHOR,
+ RX,
+ MIN,
+ K3,
+ ARIA_CHANNEL,
+ ARIA_VALUENOW,
+ LOCAL,
+ ONABORT,
+ LOADING,
+ BASEPROFILE,
+ INTEGRITY,
+ ONBEGIN,
+ REPEATCOUNT,
+ SURFACESCALE,
+ MARGINWIDTH,
+ PATHLENGTH,
+ RADIOGROUP,
+ MASKUNITS,
+ STYLE,
+ ASYNC,
+ POINTSATZ,
+ AUTOPLAY,
+ NOMODULE,
+ TO,
+ DISPLAY,
+ STOP_OPACITY,
+ ONDROP,
+ CURSOR,
+ SRCSET,
+ FONTFAMILY,
+ PATTERN,
+ COLUMNALIGN,
+ VIEWBOX,
+ DY,
+ END,
+ SRC,
+ Y1,
+ ARIA_GRAB,
+ ARIA_REQUIRED,
+ ARIA_ATOMIC,
+ ARIA_OWNS,
+ ARIA_BUSY,
+ EQUALCOLUMNS,
+ ONDATAAVAILABLE,
+ XCHANNELSELECTOR,
+ ONSCROLL,
+ GRADIENTTRANSFORM,
+ SRCDOC,
+ ACCEPT,
+ CODETYPE,
+ ENTERKEYHINT,
+ MODE,
+ OTHER,
+ ONBEFORECOPY,
+ REPEAT,
+ SUPERSCRIPTSHIFT,
+ HREF,
+ ALIGNMENTSCOPE,
+ LARGEOP,
+ TARGETX,
+ MATHCOLOR,
+ ACTION,
+ MEDIA,
+ SCRIPTMINSIZE,
+ MARKER_END,
+ CELLSPACING,
+ ONBLUR,
+ FORMAT,
+ SYMMETRIC,
+ KERNELMATRIX,
+ POINTER_EVENTS,
+ TRANSFORM,
+ XMLNS,
+ BGCOLOR,
+ FLOOD_COLOR,
+ ONMOUSEOVER,
+ ONFOCUS,
+ STROKE_DASHOFFSET,
+ CLIP,
+ GLYPHREF,
+ SCOPE,
+ ATTRIBUTENAME,
+ ONDRAG,
+ OVERFLOW,
+ COLSPAN,
+ IS,
+ PRESERVEASPECTRATIO,
+ CONTENTEDITABLE,
+ FONTWEIGHT,
+ FILTERUNITS,
+ ONSTOP,
+ STITCHTILES,
+ WIDTH,
+ INPUTMODE,
+ VALUETYPE,
+ DX,
+ BY,
+ RY,
+ DIR,
+ IN2,
+ REL,
+ R,
+ K1,
+ X2,
+ XML_SPACE,
+ ARIA_LABELLEDBY,
+ ARIA_SELECTED,
+ ARIA_PRESSED,
+ ARIA_SECRET,
+ ARIA_TEMPLATEID,
+ ARIA_MULTILINE,
+ ARIA_RELEVANT,
+ ARIA_AUTOCOMPLETE,
+ ARIA_HASPOPUP,
+ DEFAULT,
+ HSPACE,
+ MOVABLELIMITS,
+ RSPACE,
+ SEPARATORS,
+ ENABLE_BACKGROUND,
+ CHECKED,
+ OPACITY,
+ BORDER,
+ HIDDEN,
+ RENDERING_INTENT,
+ SANDBOX,
+ ACCESSKEY,
+ BASEFREQUENCY,
+ BASE,
+ CITE,
+ EDGEMODE,
+ INDEX,
+ LABEL,
+ NORESIZE,
+ ONSELECT,
+ ONREADYSTATECHANGE,
+ ORIENT,
+ ONBEFOREPASTE,
+ ONKEYDOWN,
+ RULES,
+ SELECTED,
+ SCHEME,
+ TYPE,
+ ONAFTERPRINT,
+ ALIGN,
+ HEIGHT,
+ LANGUAGE,
+ LENGTHADJUST,
+ PING,
+ ARCHIVE,
+ METHOD,
+ NOSHADE,
+ ALTIMG,
+ ADDITIVE,
+ DEFINITIONURL,
+ ONFINISH,
+ SCRIPTLEVEL,
+ VALIGN,
+ MARKER_MID,
+ MARKER_START,
+ MASKCONTENTUNITS,
+ DECLARE,
+ MAXLENGTH,
+ ROWLINES,
+ TITLE,
+ FRAME,
+ PROMPT,
+ USEMAP,
+ IN,
+ KERNELUNITLENGTH,
+ ONEND,
+ POINTSATX,
+ STANDBY,
+ WHEN,
+ XLINK_ARCROLE,
+ XLINK_SHOW,
+ AUTOFOCUS,
+ COLOR_RENDERING,
+ ENCODING,
+ LQUOTE,
+ ONMOUSEWHEEL,
+ ONCONTEXTMENU,
+ ONMOUSEMOVE,
+ ONFOCUSOUT,
+ STROKE_LINECAP,
+ STROKE_MITERLIMIT,
+ STROKE_OPACITY,
+ CLIP_PATH,
+ GLYPH_ORIENTATION_VERTICAL,
+ KEYPOINTS,
+ STEP,
+ SLOPE,
+ WRAP,
+ CHAR,
+ NOWRAP,
+ ONDRAGOVER,
+ ONERROR,
+ ONDRAGLEAVE,
+ AXIS,
+ CROSSORIGIN,
+ CLOSE,
+ KEYSPLINES,
+ OFFSET,
+ ROWSPACING,
+ VERSION,
+ CONTENT,
+ FONT_STRETCH,
+ FONTSTYLE,
+ FONT_VARIANT,
+ FONT_SIZE,
+ MULTIPLE,
+ POSTER,
+ PATTERNCONTENTUNITS,
+ TEXT_RENDERING,
+ TEXT,
+ COLUMNSPAN,
+ COLUMNWIDTH,
+ ONCUT,
+ REQUIREDEXTENSIONS,
+ ELEVATION,
+ CX,
+ FX,
+ REFX,
+ CY,
+ FY,
+ REFY,
+ ALT,
+ DUR,
+ FOR,
+ LOW,
+ MAX,
+ REV,
+ D,
+ X,
+ Z,
+ X1,
+ K2,
+ Y2,
+ K4,
+ XML_LANG,
+ ARIA_VALUEMAX,
+ ARIA_DESCRIBEDBY,
+ ARIA_CHECKED,
+ ARIA_DROPEFFECT,
+ ARIA_EXPANDED,
+ ARIA_LEVEL,
+ ARIA_HIDDEN,
+ ARIA_POSINSET,
+ ARIA_INVALID,
+ ARIA_VALUEMIN,
+ ARIA_CONTROLS,
+ ARIA_READONLY,
+ ARIA_ACTIVEDESCENDANT,
+ ARIA_DATATYPE,
+ ARIA_SORT,
+ ARIA_FLOWTO,
+ ARIA_LIVE,
+ ARIA_SETSIZE,
+ DISABLED,
+ DATA,
+ EQUALROWS,
+ ISMAP,
+ LSPACE,
+ NOTATION,
+ ONPASTE,
+ ROWALIGN,
+ SEPARATOR,
+ VSPACE,
+ YCHANNELSELECTOR,
+ ONDBLCLICK,
+ CALCMODE,
+ FENCE,
+ ONACTIVATE,
+ SPACING,
+ SPECULARCONSTANT,
+ ID,
+ GRADIENTUNITS,
+ HEADERS,
+ READONLY,
+ SEED,
+ STDDEVIATION,
+ WORD_SPACING,
+ ACCEPT_CHARSET,
+ ACCENT,
+ BEVELLED,
+ BASELINE_SHIFT,
+ BASELINE,
+ CODE,
+ CODEBASE,
+ DEFER,
+ DIRECTION,
+ EDGE,
+ FACE,
+ INTERCEPT,
+ LINEBREAK,
+ LINETHICKNESS,
+ NAME,
+ ONBEFOREUNLOAD,
+ OBJECT,
+ ORDER,
+ ONRESET,
+ ONMESSAGE,
+ ONBEFOREPRINT,
+ ORIENTATION,
+ ONSELECTSTART,
+ ONKEYPRESS,
+ ONBEFORECUT,
+ ONRESIZE,
+ REFERRERPOLICY,
+ ROLE,
+ REPEATDUR,
+ SIZES,
+ STRETCHY,
+ SPREADMETHOD,
+ SIZE,
+ DIFFUSECONSTANT,
+ HREFLANG,
+ PROFILE,
+ XREF,
+ ALIGNMENT_BASELINE,
+ DRAGGABLE,
+ IMAGESIZES,
+ IMAGE_RENDERING,
+ LANG,
+ LONGDESC,
+ MARGINHEIGHT,
+ ORIGIN,
+ TARGET,
+ TARGETY,
+ HIGH,
+ MATHBACKGROUND,
+ MATHVARIANT,
+ MATHSIZE,
+ ONCHANGE,
+ PATH,
+ ACTIONTYPE,
+ ACTIVE,
+ BEGIN,
+ DIVISOR,
+ LIMITINGCONEANGLE,
+ MANIFEST,
+ OPTIMUM,
+ RADIUS,
+ SCRIPTSIZEMULTIPLIER,
+ TABINDEX,
+ VISIBILITY,
+ LINK,
+ MARKERHEIGHT,
+ MASK,
+ MARKERWIDTH,
+ MARKERUNITS,
+ AMPLITUDE,
+ CELLPADDING,
+ FILL_RULE,
+ FILL_OPACITY,
+ ONCLICK,
+ REPLACE,
+ SCALE,
+ TABLEVALUES,
+ AZIMUTH,
+ FRAMEBORDER,
+ FRAMESPACING,
+ FORM,
+ PRIMITIVEUNITS,
+ SUMMARY,
+ ZOOMANDPAN,
+ ALINK,
+ ICON,
+ KERNING,
+ ONUNLOAD,
+ ONINVALID,
+ ONINPUT,
+ POINTS,
+ POINTSATY,
+ SPAN,
+ TRANSFORM_ORIGIN,
+ VLINK,
+ XLINK_HREF,
+ XLINK_ROLE,
+ XMLNS_XLINK,
+ XLINK_TYPE,
+ XLINK_ACTUATE,
+ AUTOCOMPLETE,
+ AUTOCAPITALIZE,
+ COLOR_PROFILE,
+ COLOR_INTERPOLATION,
+ COLOR_INTERPOLATION_FILTERS,
+ EXPONENT,
+ FLOOD_OPACITY,
+ NUMOCTAVES,
+ ONLOAD,
+ ONMOUSEENTER,
+ ONFOCUSIN,
+ ONZOOM,
+ ONMOUSELEAVE,
+ ONMOUSEUP,
+ ONMOUSEOUT,
+ ONMOUSEDOWN,
+ RQUOTE,
+ STROKE_DASHARRAY,
+ STROKE_LINEJOIN,
+ STROKE,
+ STROKE_WIDTH,
+ COMPACT,
+ CLIP_RULE,
+ CLIPPATHUNITS,
+ DISPLAYSTYLE,
+ GLYPH_ORIENTATION_HORIZONTAL,
+ HTTP_EQUIV,
+ LOOP,
+ SCOPED,
+ SHAPE_RENDERING,
+ SHAPE,
+ STOP_COLOR,
+ TEMPLATE,
+ ABBR,
+ ATTRIBUTETYPE,
+ COORDS,
+ CHARSET,
+ NOHREF,
+ ONDRAGENTER,
+ ONDRAGEND,
+ ONDRAGDROP,
+ OPERATOR,
+ ONDRAGSTART,
+ STARTOFFSET,
+ AS,
+ BIAS,
+ CLASSID,
+ COLS,
+ CLOSURE,
+ CLASS,
+ KEYSYSTEM,
+ LOWSRC,
+ MINSIZE,
+ PRESERVEALPHA,
+ ROWSPAN,
+ ROWS,
+ SUBSCRIPTSHIFT,
+ ALTTEXT,
+ CONTROLS,
+ CONTEXTMENU,
+ ENCTYPE,
+ FILTER,
+ FONT_WEIGHT,
+ FONT_STYLE,
+ FONT_FAMILY,
+ FONT_SIZE_ADJUST,
+ FONTSIZE,
+ KEYTIMES,
+ LIST,
+ RT,
+ ONSTART,
+ PATTERNTRANSFORM,
+ PATTERNUNITS,
+ RESTART,
+ SYSTEMLANGUAGE,
+ TEXT_DECORATION,
+ TEXTLENGTH,
+ WRITING_MODE,
+ ACCUMULATE,
+ COLUMNLINES,
+ COLUMNSPACING,
+ GROUPALIGN,
+ ONSUBMIT,
+ REQUIRED,
+ RESULT,
+ VALUES,
+ VALUE,
+ VIEWTARGET,
+ };
+ private final static int[] ATTRIBUTE_HASHES = {
+ 1867462756,
+ 1748971848,
+ 1966442279,
+ 1681174213,
+ 1785053243,
+ 1916286197,
+ 2004846654,
+ 1680165421,
+ 1723336432,
+ 1754899031,
+ 1816104145,
+ 1905628916,
+ 1924629705,
+ 1988784439,
+ 2024647008,
+ 71827457,
+ 1680282148,
+ 1689324870,
+ 1747295467,
+ 1754579720,
+ 1756889417,
+ 1803561214,
+ 1848600826,
+ 1884295780,
+ 1910441627,
+ 1922607670,
+ 1939976792,
+ 1975062341,
+ 2000752725,
+ 2009079867,
+ 2073034754,
+ 57205395,
+ 911736834,
+ 1680181996,
+ 1680368221,
+ 1685882101,
+ 1704526375,
+ 1736416327,
+ 1747906667,
+ 1751755561,
+ 1754698327,
+ 1756360955,
+ 1773606972,
+ 1787365531,
+ 1805715690,
+ 1823574314,
+ 1854497001,
+ 1874270021,
+ 1898415413,
+ 1906423097,
+ 1915025672,
+ 1921977416,
+ 1923088386,
+ 1933369607,
+ 1941550652,
+ 1972904518,
+ 1983398182,
+ 1991625270,
+ 2001710298,
+ 2007021895,
+ 2016810187,
+ 2060474743,
+ 2082471938,
+ 53006051,
+ 60345635,
+ 885522434,
+ 1680095865,
+ 1680165533,
+ 1680229115,
+ 1680343801,
+ 1680437801,
+ 1682440540,
+ 1687620127,
+ 1692408896,
+ 1721189160,
+ 1733874289,
+ 1740096054,
+ 1747479606,
+ 1748503880,
+ 1749549708,
+ 1753550036,
+ 1754644293,
+ 1754835516,
+ 1756147974,
+ 1756762256,
+ 1767725700,
+ 1781007934,
+ 1786775671,
+ 1791068279,
+ 1804081401,
+ 1814560070,
+ 1820727381,
+ 1824159037,
+ 1854366938,
+ 1865910331,
+ 1872343590,
+ 1884079398,
+ 1890996553,
+ 1903612236,
+ 1906408542,
+ 1908462185,
+ 1910503637,
+ 1915757815,
+ 1917857531,
+ 1922413307,
+ 1922677495,
+ 1924517489,
+ 1932959284,
+ 1934970504,
+ 1941435445,
+ 1965512429,
+ 1972656710,
+ 1972922984,
+ 1983157559,
+ 1984430082,
+ 1990107683,
+ 2000096287,
+ 2001634458,
+ 2001826027,
+ 2006459190,
+ 2008401563,
+ 2010716309,
+ 2019887833,
+ 2026893641,
+ 2065694722,
+ 2081423362,
+ 2089811970,
+ 52488851,
+ 55077603,
+ 59825747,
+ 68157441,
+ 878182402,
+ 901775362,
+ 1037879561,
+ 1680159327,
+ 1680165437,
+ 1680165692,
+ 1680198203,
+ 1680231247,
+ 1680315086,
+ 1680345965,
+ 1680413393,
+ 1680452349,
+ 1681879063,
+ 1683805446,
+ 1686731997,
+ 1689048326,
+ 1689839946,
+ 1699185409,
+ 1714763319,
+ 1721347639,
+ 1731048742,
+ 1734182982,
+ 1739583824,
+ 1740130375,
+ 1747309881,
+ 1747800157,
+ 1748021284,
+ 1748566068,
+ 1749350104,
+ 1751507685,
+ 1753049109,
+ 1754434872,
+ 1754612424,
+ 1754647074,
+ 1754794646,
+ 1754860061,
+ 1754927689,
+ 1756219733,
+ 1756704824,
+ 1756836998,
+ 1757421892,
+ 1771569964,
+ 1780879045,
+ 1784574102,
+ 1786622296,
+ 1786851500,
+ 1788842244,
+ 1797886599,
+ 1804054854,
+ 1804405895,
+ 1814517574,
+ 1814656840,
+ 1816178925,
+ 1821958888,
+ 1823829083,
+ 1825437894,
+ 1854285018,
+ 1854466380,
+ 1854497008,
+ 1866496199,
+ 1871251689,
+ 1873656984,
+ 1874788501,
+ 1884246821,
+ 1889569526,
+ 1891937366,
+ 1900544002,
+ 1903759600,
+ 1905754853,
+ 1906419001,
+ 1907701479,
+ 1909819252,
+ 1910441773,
+ 1910527802,
+ 1915341049,
+ 1916247343,
+ 1917295176,
+ 1921061206,
+ 1922400908,
+ 1922566877,
+ 1922665179,
+ 1922679610,
+ 1924443742,
+ 1924583073,
+ 1924773438,
+ 1933123337,
+ 1934917290,
+ 1937336473,
+ 1941286708,
+ 1941440197,
+ 1943317364,
+ 1966384692,
+ 1972151670,
+ 1972744954,
+ 1972908839,
+ 1972996699,
+ 1982254612,
+ 1983290011,
+ 1983432389,
+ 1987422362,
+ 1989522022,
+ 1991220282,
+ 1993343287,
+ 2000160071,
+ 2001527900,
+ 2001669449,
+ 2001732764,
+ 2001898809,
+ 2005342360,
+ 2006824246,
+ 2007064819,
+ 2009041198,
+ 2009231684,
+ 2016711994,
+ 2017010843,
+ 2023342821,
+ 2024794274,
+ 2034765641,
+ 2065170434,
+ 2066743298,
+ 2075005220,
+ 2081947650,
+ 2083520514,
+ 2091784484,
+ 50917059,
+ 52489043,
+ 53537523,
+ 56685811,
+ 57210387,
+ 59830867,
+ 60817409,
+ 71303169,
+ 72351745,
+ 884998146,
+ 894959618,
+ 902299650,
+ 928514050,
+ 1038063816,
+ 1680140893,
+ 1680159328,
+ 1680165436,
+ 1680165487,
+ 1680165613,
+ 1680181850,
+ 1680185931,
+ 1680198381,
+ 1680230940,
+ 1680251485,
+ 1680311085,
+ 1680323325,
+ 1680345685,
+ 1680347981,
+ 1680411449,
+ 1680433915,
+ 1680446153,
+ 1680511804,
+ 1681733672,
+ 1681969220,
+ 1682587945,
+ 1684319541,
+ 1685902598,
+ 1687164232,
+ 1687751191,
+ 1689130184,
+ 1689788441,
+ 1691145478,
+ 1692933184,
+ 1704262346,
+ 1714745560,
+ 1716303957,
+ 1721305962,
+ 1723309623,
+ 1723336528,
+ 1732771842,
+ 1733919469,
+ 1734404167,
+ 1739561208,
+ 1739927860,
+ 1740119884,
+ 1742183484,
+ 1747299630,
+ 1747446838,
+ 1747792072,
+ 1747839118,
+ 1747939528,
+ 1748306996,
+ 1748552744,
+ 1748869205,
+ 1749027145,
+ 1749399124,
+ 1749856356,
+ 1751679545,
+ 1752985897,
+ 1753297133,
+ 1754214628,
+ 1754546894,
+ 1754606246,
+ 1754643237,
+ 1754645079,
+ 1754647353,
+ 1754792749,
+ 1754798923,
+ 1754858317,
+ 1754872618,
+ 1754907227,
+ 1754958648,
+ 1756190926,
+ 1756302628,
+ 1756471625,
+ 1756737685,
+ 1756804936,
+ 1756874572,
+ 1757053236,
+ 1765800271,
+ 1767875272,
+ 1772032615,
+ 1776114564,
+ 1780975314,
+ 1782518297,
+ 1785051290,
+ 1785174319,
+ 1786740932,
+ 1786821704,
+ 1787193500,
+ 1788254870,
+ 1790814502,
+ 1791070327,
+ 1801312388,
+ 1804036350,
+ 1804069019,
+ 1804235064,
+ 1804978712,
+ 1805715716,
+ 1814558026,
+ 1814656326,
+ 1814986837,
+ 1816144023,
+ 1820262641,
+ 1820928104,
+ 1822002839,
+ 1823580230,
+ 1823841492,
+ 1824377064,
+ 1825677514,
+ 1853862084,
+ 1854302364,
+ 1854464212,
+ 1854474395,
+ 1854497003,
+ 1864698185,
+ 1865910347,
+ 1867448617,
+ 1867620412,
+ 1872034503,
+ 1873590471,
+ 1874261045,
+ 1874698443,
+ 1881750231,
+ 1884142379,
+ 1884267068,
+ 1884343396,
+ 1889633006,
+ 1891186903,
+ 1894552650,
+ 1898428101,
+ 1902640276,
+ 1903659239,
+ 1905541832,
+ 1905672729,
+ 1905902311,
+ 1906408598,
+ 1906421049,
+ 1907660596,
+ 1908316832,
+ 1909438149,
+ 1910328970,
+ 1910441770,
+ 1910487243,
+ 1910507338,
+ 1910572893,
+ 1915295948,
+ 1915394254,
+ 1916210285,
+ 1916278099,
+ 1916337499,
+ 1917327080,
+ 1917953597,
+ 1921894426,
+ 1922319046,
+ 1922413292,
+ 1922470745,
+ 1922567078,
+ 1922665052,
+ 1922671417,
+ 1922679386,
+ 1922699851,
+ 1924206934,
+ 1924462384,
+ 1924570799,
+ 1924585254,
+ 1924738716,
+ 1932870919,
+ 1932986153,
+ 1933145837,
+ 1933508940,
+ 1934917372,
+ 1935597338,
+ 1937777860,
+ 1941253366,
+ 1941409583,
+ 1941438085,
+ 1941454586,
+ 1942026440,
+ 1965349396,
+ 1965561677,
+ 1966439670,
+ 1966454567,
+ 1972196486,
+ 1972744939,
+ 1972863609,
+ 1972904522,
+ 1972909592,
+ 1972962123,
+ 1974849131,
+ 1980235778,
+ 1982640164,
+ 1983266615,
+ 1983347764,
+ 1983416119,
+ 1983461061,
+ 1987410233,
+ 1988132214,
+ 1988788535,
+ 1990062797,
+ 1991021879,
+ 1991392548,
+ 1991643278,
+ 1999273799,
+ 2000125224,
+ 2000162011,
+ 2001210183,
+ 2001578182,
+ 2001634459,
+ 2001669450,
+ 2001710299,
+ 2001814704,
+ 2001898808,
+ 2004199576,
+ 2004957380,
+ 2005925890,
+ 2006516551,
+ 2007019632,
+ 2007064812,
+ 2008084807,
+ 2008408414,
+ 2009071951,
+ 2009141482,
+ 2010452700,
+ 2015950026,
+ 2016787611,
+ 2016910397,
+ 2018908874,
+ 2023146024,
+ 2024616088,
+ 2024763702,
+ 2026741958,
+ 2026975253,
+ 2060302634,
+ };
+}
diff --git a/parser/html/javasrc/ElementName.java b/parser/html/javasrc/ElementName.java
new file mode 100644
index 0000000000..9ee2ad0152
--- /dev/null
+++ b/parser/html/javasrc/ElementName.java
@@ -0,0 +1,1896 @@
+/*
+ * Copyright (c) 2008-2017 Mozilla Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package nu.validator.htmlparser.impl;
+
+// uncomment to regenerate self
+//import java.io.BufferedReader;
+//import java.io.File;
+//import java.io.FileInputStream;
+//import java.io.IOException;
+//import java.io.InputStreamReader;
+//import java.util.Arrays;
+//import java.util.Collections;
+//import java.util.HashMap;
+//import java.util.LinkedList;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.Map.Entry;
+//import java.util.regex.Matcher;
+//import java.util.regex.Pattern;
+
+import nu.validator.htmlparser.annotation.Inline;
+import nu.validator.htmlparser.annotation.Local;
+import nu.validator.htmlparser.annotation.NoLength;
+import nu.validator.htmlparser.annotation.Unsigned;
+import nu.validator.htmlparser.common.Interner;
+
+public final class ElementName
+ // uncomment when regenerating self
+// implements Comparable<ElementName>
+{
+
+ /**
+ * The mask for extracting the dispatch group.
+ */
+ public static final int GROUP_MASK = 127;
+
+ /**
+ * Indicates that the element is not a pre-interned element. Forbidden on
+ * preinterned elements.
+ */
+ public static final int NOT_INTERNED = (1 << 30);
+
+ /**
+ * Indicates that the element is in the "special" category. This bit should
+ * not be pre-set on MathML or SVG specials--only on HTML specials.
+ */
+ public static final int SPECIAL = (1 << 29);
+
+ /**
+ * The element is foster-parenting. This bit should be pre-set on elements
+ * that are foster-parenting as HTML.
+ */
+ public static final int FOSTER_PARENTING = (1 << 28);
+
+ /**
+ * The element is scoping. This bit should be pre-set on elements that are
+ * scoping as HTML.
+ */
+ public static final int SCOPING = (1 << 27);
+
+ /**
+ * The element is scoping as SVG.
+ */
+ public static final int SCOPING_AS_SVG = (1 << 26);
+
+ /**
+ * The element is scoping as MathML.
+ */
+ public static final int SCOPING_AS_MATHML = (1 << 25);
+
+ /**
+ * The element is an HTML integration point.
+ */
+ public static final int HTML_INTEGRATION_POINT = (1 << 24);
+
+ /**
+ * The element has an optional end tag.
+ */
+ public static final int OPTIONAL_END_TAG = (1 << 23);
+
+ private @Local String name;
+
+ private @Local String camelCaseName;
+
+ // CPPONLY: private @HtmlCreator Object htmlCreator;
+
+ // CPPONLY: private @SvgCreator Object svgCreator;
+
+ /**
+ * The lowest 7 bits are the dispatch group. The high bits are flags.
+ */
+ public final int flags;
+
+ @Inline public @Local String getName() {
+ return name;
+ }
+
+ @Inline public @Local String getCamelCaseName() {
+ return camelCaseName;
+ }
+
+ // CPPONLY: @Inline public @HtmlCreator Object getHtmlCreator() {
+ // CPPONLY: return htmlCreator;
+ // CPPONLY: }
+
+ // CPPONLY: @Inline public @SvgCreator Object getSvgCreator() {
+ // CPPONLY: return svgCreator;
+ // CPPONLY: }
+
+ @Inline public int getFlags() {
+ return flags;
+ }
+
+ @Inline public int getGroup() {
+ return flags & ElementName.GROUP_MASK;
+ }
+
+ @Inline public boolean isInterned() {
+ return (flags & ElementName.NOT_INTERNED) == 0;
+ }
+
+ @Inline static int levelOrderBinarySearch(int[] data, int key) {
+ int n = data.length;
+ int i = 0;
+
+ while (i < n) {
+ int val = data[i];
+ if (val < key) {
+ i = 2 * i + 2;
+ } else if (val > key) {
+ i = 2 * i + 1;
+ } else {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ @Inline static ElementName elementNameByBuffer(@NoLength char[] buf,
+ int length, Interner interner) {
+ @Unsigned int hash = ElementName.bufToHash(buf, length);
+ int[] hashes;
+ hashes = ElementName.ELEMENT_HASHES;
+ int index = levelOrderBinarySearch(hashes, hash);
+ if (index < 0) {
+ return null;
+ } else {
+ ElementName elementName = ElementName.ELEMENT_NAMES[index];
+ @Local String name = elementName.name;
+ if (!Portability.localEqualsBuffer(name, buf, length)) {
+ return null;
+ }
+ return elementName;
+ }
+ }
+
+ /**
+ * This method has to return a unique positive integer for each well-known
+ * lower-cased element name.
+ *
+ * @param buf
+ * @param len
+ * @return
+ */
+ @Inline private static @Unsigned int bufToHash(@NoLength char[] buf,
+ int length) {
+ @Unsigned int len = length;
+ @Unsigned int first = buf[0];
+ first <<= 19;
+ @Unsigned int second = 1 << 23;
+ @Unsigned int third = 0;
+ @Unsigned int fourth = 0;
+ @Unsigned int fifth = 0;
+ if (length >= 4) {
+ second = buf[length - 4];
+ second <<= 4;
+ third = buf[length - 3];
+ third <<= 9;
+ fourth = buf[length - 2];
+ fourth <<= 14;
+ fifth = buf[length - 1];
+ fifth <<= 24;
+ } else if (length == 3) {
+ second = buf[1];
+ second <<= 4;
+ third = buf[2];
+ third <<= 9;
+ } else if (length == 2) {
+ second = buf[1];
+ second <<= 24;
+ }
+ return len + first + second + third + fourth + fifth;
+ }
+
+ private ElementName(@Local String name, @Local String camelCaseName,
+ // CPPONLY: @HtmlCreator Object htmlCreator, @SvgCreator Object
+ // CPPONLY: svgCreator,
+ int flags) {
+ this.name = name;
+ this.camelCaseName = camelCaseName;
+ // CPPONLY: this.htmlCreator = htmlCreator;
+ // CPPONLY: this.svgCreator = svgCreator;
+ this.flags = flags;
+ }
+
+ public ElementName() {
+ this.name = null;
+ this.camelCaseName = null;
+ // CPPONLY: this.htmlCreator = NS_NewHTMLUnknownElement;
+ // CPPONLY: this.svgCreator = NS_NewSVGUnknownElement;
+ this.flags = TreeBuilder.OTHER | NOT_INTERNED;
+ }
+
+ public void destructor() {
+ // The translator adds refcount debug code here.
+ }
+
+ @Inline public void setNameForNonInterned(@Local String name
+ // CPPONLY: , boolean custom
+ ) {
+ // No need to worry about refcounting the local name, because in the
+ // C++ case the scoped atom table remembers its own atoms.
+ this.name = name;
+ this.camelCaseName = name;
+ // CPPONLY: if (custom) {
+ // CPPONLY: this.htmlCreator = NS_NewCustomElement;
+ // CPPONLY: } else {
+ // CPPONLY: this.htmlCreator = NS_NewHTMLUnknownElement;
+ // CPPONLY: }
+ // The assertion below relies on TreeBuilder.OTHER being zero!
+ // TreeBuilder.OTHER isn't referenced here, because it would create
+ // a circular C++ header dependency given that this method is inlined.
+ assert this.flags == ElementName.NOT_INTERNED;
+ }
+
+ // CPPONLY: @Inline public boolean isCustom() {
+ // CPPONLY: return this.htmlCreator == NS_NewCustomElement;
+ // CPPONLY: }
+
+ public static final ElementName ANNOTATION_XML = new ElementName(
+ "annotation-xml", "annotation-xml",
+ // CPPONLY: NS_NewHTMLUnknownElement, NS_NewSVGUnknownElement,
+ TreeBuilder.ANNOTATION_XML | SCOPING_AS_MATHML);
+
+ // START CODE ONLY USED FOR GENERATING CODE uncomment and run to regenerate
+
+// private static final Pattern HTML_TAG_DEF = Pattern.compile(
+// "^HTML_TAG\\(([^,]+),\\s*([^,]+),\\s*[^,]+\\).*$");
+//
+// private static final Pattern HTML_HTMLELEMENT_TAG_DEF = Pattern.compile(
+// "^HTML_HTMLELEMENT_TAG\\(([^\\)]+)\\).*$");
+//
+// private static final Pattern SVG_TAG_DEF = Pattern.compile(
+// "^SVG_(?:FROM_PARSER_)?TAG\\(([^,]+),\\s*([^\\)]+)\\).*$");
+//
+// private static final Map<String, String> htmlMap = new HashMap<String, String>();
+//
+// private static final Map<String, String> svgMap = new HashMap<String, String>();
+//
+// private static void ingestHtmlTags(File htmlList) throws IOException {
+// // This doesn't need to be efficient, so let's make it easy to write.
+// BufferedReader htmlReader = new BufferedReader(
+// new InputStreamReader(new FileInputStream(htmlList), "utf-8"));
+// try {
+// String line;
+// while ((line = htmlReader.readLine()) != null) {
+// if (!line.startsWith("HTML_")) {
+// continue;
+// }
+// if (line.startsWith("HTML_OTHER")) {
+// continue;
+// }
+// Matcher m = HTML_TAG_DEF.matcher(line);
+// if (m.matches()) {
+// String iface = m.group(2);
+// if ("Unknown".equals(iface)) {
+// continue;
+// }
+// htmlMap.put(m.group(1), "NS_NewHTML" + iface + "Element");
+// } else {
+// m = HTML_HTMLELEMENT_TAG_DEF.matcher(line);
+// if (!m.matches()) {
+// throw new RuntimeException(
+// "Malformed HTML element definition: " + line);
+// }
+// htmlMap.put(m.group(1), "NS_NewHTMLElement");
+// }
+// }
+// } finally {
+// htmlReader.close();
+// }
+// }
+//
+// private static void ingestSvgTags(File svgList) throws IOException {
+// // This doesn't need to be efficient, so let's make it easy to write.
+// BufferedReader svgReader = new BufferedReader(
+// new InputStreamReader(new FileInputStream(svgList), "utf-8"));
+// try {
+// String line;
+// while ((line = svgReader.readLine()) != null) {
+// if (!line.startsWith("SVG_")) {
+// continue;
+// }
+// Matcher m = SVG_TAG_DEF.matcher(line);
+// if (!m.matches()) {
+// throw new RuntimeException(
+// "Malformed SVG element definition: " + line);
+// }
+// String name = m.group(1);
+// if ("svgSwitch".equals(name)) {
+// name = "switch";
+// }
+// svgMap.put(name, "NS_NewSVG" + m.group(2) + "Element");
+// }
+// } finally {
+// svgReader.close();
+// }
+// }
+//
+// private static String htmlCreator(String name) {
+// String creator = htmlMap.remove(name);
+// if (creator != null) {
+// return creator;
+// }
+// return "NS_NewHTMLUnknownElement";
+// }
+//
+// private static String svgCreator(String name) {
+// String creator = svgMap.remove(name);
+// if (creator != null) {
+// return creator;
+// }
+// return "NS_NewSVGUnknownElement";
+// }
+//
+// /**
+// * @see java.lang.Object#toString()
+// */
+// @Override public String toString() {
+// return "(\"" + name + "\", \"" + camelCaseName + "\", \n// CPP"
+// + "ONLY: " + htmlCreator(name) + ",\n// CPP" + "ONLY: "
+// + svgCreator(camelCaseName) + ", \n" + decomposedFlags() + ")";
+// }
+//
+// private String decomposedFlags() {
+// StringBuilder buf = new StringBuilder("TreeBuilder.");
+// buf.append(treeBuilderGroupToName());
+// if ((flags & SPECIAL) != 0) {
+// buf.append(" | SPECIAL");
+// }
+// if ((flags & FOSTER_PARENTING) != 0) {
+// buf.append(" | FOSTER_PARENTING");
+// }
+// if ((flags & SCOPING) != 0) {
+// buf.append(" | SCOPING");
+// }
+// if ((flags & SCOPING_AS_MATHML) != 0) {
+// buf.append(" | SCOPING_AS_MATHML");
+// }
+// if ((flags & SCOPING_AS_SVG) != 0) {
+// buf.append(" | SCOPING_AS_SVG");
+// }
+// if ((flags & OPTIONAL_END_TAG) != 0) {
+// buf.append(" | OPTIONAL_END_TAG");
+// }
+// return buf.toString();
+// }
+//
+// private String constName() {
+// char[] buf = new char[name.length()];
+// for (int i = 0; i < name.length(); i++) {
+// char c = name.charAt(i);
+// if (c == '-') {
+// if (!"annotation-xml".equals(name)) {
+// throw new RuntimeException(
+// "Non-annotation-xml element name with hyphen: "
+// + name);
+// }
+// buf[i] = '_';
+// } else if (c >= '0' && c <= '9') {
+// buf[i] = c;
+// } else {
+// buf[i] = (char) (c - 0x20);
+// }
+// }
+// return new String(buf);
+// }
+//
+// private int hash() {
+// return bufToHash(name.toCharArray(), name.length());
+// }
+//
+// public int compareTo(ElementName other) {
+// int thisHash = this.hash();
+// int otherHash = other.hash();
+// if (thisHash < otherHash) {
+// return -1;
+// } else if (thisHash == otherHash) {
+// return 0;
+// } else {
+// return 1;
+// }
+// }
+//
+// private String treeBuilderGroupToName() {
+// switch (getGroup()) {
+// case TreeBuilder.OTHER:
+// return "OTHER";
+// case TreeBuilder.A:
+// return "A";
+// case TreeBuilder.BASE:
+// return "BASE";
+// case TreeBuilder.BODY:
+// return "BODY";
+// case TreeBuilder.BR:
+// return "BR";
+// case TreeBuilder.BUTTON:
+// return "BUTTON";
+// case TreeBuilder.CAPTION:
+// return "CAPTION";
+// case TreeBuilder.COL:
+// return "COL";
+// case TreeBuilder.COLGROUP:
+// return "COLGROUP";
+// case TreeBuilder.FONT:
+// return "FONT";
+// case TreeBuilder.FORM:
+// return "FORM";
+// case TreeBuilder.FRAME:
+// return "FRAME";
+// case TreeBuilder.FRAMESET:
+// return "FRAMESET";
+// case TreeBuilder.IMAGE:
+// return "IMAGE";
+// case TreeBuilder.INPUT:
+// return "INPUT";
+// case TreeBuilder.LI:
+// return "LI";
+// case TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND:
+// return "LINK_OR_BASEFONT_OR_BGSOUND";
+// case TreeBuilder.MATH:
+// return "MATH";
+// case TreeBuilder.META:
+// return "META";
+// case TreeBuilder.SVG:
+// return "SVG";
+// case TreeBuilder.HEAD:
+// return "HEAD";
+// case TreeBuilder.HR:
+// return "HR";
+// case TreeBuilder.HTML:
+// return "HTML";
+// case TreeBuilder.KEYGEN:
+// return "KEYGEN";
+// case TreeBuilder.NOBR:
+// return "NOBR";
+// case TreeBuilder.NOFRAMES:
+// return "NOFRAMES";
+// case TreeBuilder.NOSCRIPT:
+// return "NOSCRIPT";
+// case TreeBuilder.OPTGROUP:
+// return "OPTGROUP";
+// case TreeBuilder.OPTION:
+// return "OPTION";
+// case TreeBuilder.P:
+// return "P";
+// case TreeBuilder.PLAINTEXT:
+// return "PLAINTEXT";
+// case TreeBuilder.SCRIPT:
+// return "SCRIPT";
+// case TreeBuilder.SELECT:
+// return "SELECT";
+// case TreeBuilder.STYLE:
+// return "STYLE";
+// case TreeBuilder.TABLE:
+// return "TABLE";
+// case TreeBuilder.TEXTAREA:
+// return "TEXTAREA";
+// case TreeBuilder.TITLE:
+// return "TITLE";
+// case TreeBuilder.TEMPLATE:
+// return "TEMPLATE";
+// case TreeBuilder.TR:
+// return "TR";
+// case TreeBuilder.XMP:
+// return "XMP";
+// case TreeBuilder.TBODY_OR_THEAD_OR_TFOOT:
+// return "TBODY_OR_THEAD_OR_TFOOT";
+// case TreeBuilder.TD_OR_TH:
+// return "TD_OR_TH";
+// case TreeBuilder.DD_OR_DT:
+// return "DD_OR_DT";
+// case TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
+// return "H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6";
+// case TreeBuilder.OBJECT:
+// return "OBJECT";
+// case TreeBuilder.OUTPUT:
+// return "OUTPUT";
+// case TreeBuilder.MARQUEE_OR_APPLET:
+// return "MARQUEE_OR_APPLET";
+// case TreeBuilder.PRE_OR_LISTING:
+// return "PRE_OR_LISTING";
+// case TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
+// return "B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U";
+// case TreeBuilder.UL_OR_OL_OR_DL:
+// return "UL_OR_OL_OR_DL";
+// case TreeBuilder.IFRAME:
+// return "IFRAME";
+// case TreeBuilder.NOEMBED:
+// return "NOEMBED";
+// case TreeBuilder.EMBED:
+// return "EMBED";
+// case TreeBuilder.IMG:
+// return "IMG";
+// case TreeBuilder.AREA_OR_WBR:
+// return "AREA_OR_WBR";
+// case TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
+// return "DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU";
+// case TreeBuilder.FIELDSET:
+// return "FIELDSET";
+// case TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
+// return "ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY";
+// case TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
+// return "RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR";
+// case TreeBuilder.RB_OR_RTC:
+// return "RB_OR_RTC";
+// case TreeBuilder.RT_OR_RP:
+// return "RT_OR_RP";
+// case TreeBuilder.PARAM_OR_SOURCE_OR_TRACK:
+// return "PARAM_OR_SOURCE_OR_TRACK";
+// case TreeBuilder.MGLYPH_OR_MALIGNMARK:
+// return "MGLYPH_OR_MALIGNMARK";
+// case TreeBuilder.MI_MO_MN_MS_MTEXT:
+// return "MI_MO_MN_MS_MTEXT";
+// case TreeBuilder.ANNOTATION_XML:
+// return "ANNOTATION_XML";
+// case TreeBuilder.FOREIGNOBJECT_OR_DESC:
+// return "FOREIGNOBJECT_OR_DESC";
+// }
+// return null;
+// }
+//
+// private static void fillLevelOrderArray(List<ElementName> sorted, int depth,
+// int rootIdx, ElementName[] levelOrder) {
+// if (rootIdx >= levelOrder.length) {
+// return;
+// }
+//
+// if (depth > 0) {
+// fillLevelOrderArray(sorted, depth - 1, rootIdx * 2 + 1, levelOrder);
+// }
+//
+// if (!sorted.isEmpty()) {
+// levelOrder[rootIdx] = sorted.remove(0);
+// }
+//
+// if (depth > 0) {
+// fillLevelOrderArray(sorted, depth - 1, rootIdx * 2 + 2, levelOrder);
+// }
+// }
+//
+// /**
+// * Regenerate self
+// *
+// * The args should be the paths to m-c files
+// * parser/htmlparser/nsHTMLTagList.h and dom/svg/SVGTagList.h.
+// */
+// public static void main(String[] args) {
+// File htmlList = new File(args[0]);
+// File svgList = new File(args[1]);
+// try {
+// ingestHtmlTags(htmlList);
+// } catch (IOException e) {
+// throw new RuntimeException(e);
+// }
+// try {
+// ingestSvgTags(svgList);
+// } catch (IOException e) {
+// throw new RuntimeException(e);
+// }
+//
+// Arrays.sort(ELEMENT_NAMES);
+// for (int i = 0; i < ELEMENT_NAMES.length; i++) {
+// int hash = ELEMENT_NAMES[i].hash();
+// if (hash < 0) {
+// System.err.println("Negative hash: " + ELEMENT_NAMES[i].name);
+// return;
+// }
+// for (int j = i + 1; j < ELEMENT_NAMES.length; j++) {
+// if (hash == ELEMENT_NAMES[j].hash()) {
+// System.err.println(
+// "Hash collision: " + ELEMENT_NAMES[i].name + ", "
+// + ELEMENT_NAMES[j].name);
+// return;
+// }
+// }
+// }
+// for (int i = 0; i < ELEMENT_NAMES.length; i++) {
+// ElementName el = ELEMENT_NAMES[i];
+// System.out.println(
+// "public static final ElementName " + el.constName()
+// + " = new ElementName" + el.toString() + ";");
+// }
+//
+// LinkedList<ElementName> sortedNames = new LinkedList<ElementName>();
+// Collections.addAll(sortedNames, ELEMENT_NAMES);
+// ElementName[] levelOrder = new ElementName[ELEMENT_NAMES.length];
+// int bstDepth = (int) Math.ceil(
+// Math.log(ELEMENT_NAMES.length) / Math.log(2));
+// fillLevelOrderArray(sortedNames, bstDepth, 0, levelOrder);
+//
+// System.out.println(
+// "private final static @NoLength ElementName[] ELEMENT_NAMES = {");
+// for (int i = 0; i < levelOrder.length; i++) {
+// ElementName el = levelOrder[i];
+// System.out.println(el.constName() + ",");
+// }
+// System.out.println("};");
+// System.out.println("private final static int[] ELEMENT_HASHES = {");
+// for (int i = 0; i < levelOrder.length; i++) {
+// ElementName el = levelOrder[i];
+// System.out.println(Integer.toString(el.hash()) + ",");
+// }
+// System.out.println("};");
+//
+// for (Entry<String, String> entry : htmlMap.entrySet()) {
+// System.err.println("Missing HTML element: " + entry.getKey());
+// }
+// for (Entry<String, String> entry : svgMap.entrySet()) {
+// System.err.println("Missing SVG element: " + entry.getKey());
+// }
+// }
+
+ // START GENERATED CODE
+public static final ElementName BIG = new ElementName("big", "big",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName BDI = new ElementName("bdi", "bdi",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName BDO = new ElementName("bdo", "bdo",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName COL = new ElementName("col", "col",
+// CPPONLY: NS_NewHTMLTableColElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.COL | SPECIAL);
+public static final ElementName DEL = new ElementName("del", "del",
+// CPPONLY: NS_NewHTMLModElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName DFN = new ElementName("dfn", "dfn",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName DIR = new ElementName("dir", "dir",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName DIV = new ElementName("div", "div",
+// CPPONLY: NS_NewHTMLDivElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
+public static final ElementName IMG = new ElementName("img", "img",
+// CPPONLY: NS_NewHTMLImageElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.IMG | SPECIAL);
+public static final ElementName INS = new ElementName("ins", "ins",
+// CPPONLY: NS_NewHTMLModElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName KBD = new ElementName("kbd", "kbd",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName MAP = new ElementName("map", "map",
+// CPPONLY: NS_NewHTMLMapElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName NAV = new ElementName("nav", "nav",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName PRE = new ElementName("pre", "pre",
+// CPPONLY: NS_NewHTMLPreElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.PRE_OR_LISTING | SPECIAL);
+public static final ElementName A = new ElementName("a", "a",
+// CPPONLY: NS_NewHTMLAnchorElement,
+// CPPONLY: NS_NewSVGAElement,
+TreeBuilder.A);
+public static final ElementName B = new ElementName("b", "b",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName RTC = new ElementName("rtc", "rtc",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RB_OR_RTC | OPTIONAL_END_TAG);
+public static final ElementName SUB = new ElementName("sub", "sub",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
+public static final ElementName SVG = new ElementName("svg", "svg",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGSVGElement,
+TreeBuilder.SVG);
+public static final ElementName SUP = new ElementName("sup", "sup",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
+public static final ElementName SET = new ElementName("set", "set",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGSetElement,
+TreeBuilder.OTHER);
+public static final ElementName USE = new ElementName("use", "use",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUseElement,
+TreeBuilder.OTHER);
+public static final ElementName VAR = new ElementName("var", "var",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
+public static final ElementName G = new ElementName("g", "g",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGGElement,
+TreeBuilder.OTHER);
+public static final ElementName WBR = new ElementName("wbr", "wbr",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.AREA_OR_WBR | SPECIAL);
+public static final ElementName XMP = new ElementName("xmp", "xmp",
+// CPPONLY: NS_NewHTMLPreElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.XMP | SPECIAL);
+public static final ElementName I = new ElementName("i", "i",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName P = new ElementName("p", "p",
+// CPPONLY: NS_NewHTMLParagraphElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.P | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName Q = new ElementName("q", "q",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName S = new ElementName("s", "s",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName U = new ElementName("u", "u",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName H1 = new ElementName("h1", "h1",
+// CPPONLY: NS_NewHTMLHeadingElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
+public static final ElementName H2 = new ElementName("h2", "h2",
+// CPPONLY: NS_NewHTMLHeadingElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
+public static final ElementName H3 = new ElementName("h3", "h3",
+// CPPONLY: NS_NewHTMLHeadingElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
+public static final ElementName H4 = new ElementName("h4", "h4",
+// CPPONLY: NS_NewHTMLHeadingElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
+public static final ElementName H5 = new ElementName("h5", "h5",
+// CPPONLY: NS_NewHTMLHeadingElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
+public static final ElementName H6 = new ElementName("h6", "h6",
+// CPPONLY: NS_NewHTMLHeadingElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
+public static final ElementName AREA = new ElementName("area", "area",
+// CPPONLY: NS_NewHTMLAreaElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.AREA_OR_WBR | SPECIAL);
+public static final ElementName DATA = new ElementName("data", "data",
+// CPPONLY: NS_NewHTMLDataElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName FEFUNCA = new ElementName("fefunca", "feFuncA",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEFuncAElement,
+TreeBuilder.OTHER);
+public static final ElementName METADATA = new ElementName("metadata", "metadata",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGMetadataElement,
+TreeBuilder.OTHER);
+public static final ElementName META = new ElementName("meta", "meta",
+// CPPONLY: NS_NewHTMLMetaElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.META | SPECIAL);
+public static final ElementName TEXTAREA = new ElementName("textarea", "textarea",
+// CPPONLY: NS_NewHTMLTextAreaElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TEXTAREA | SPECIAL);
+public static final ElementName FEFUNCB = new ElementName("fefuncb", "feFuncB",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEFuncBElement,
+TreeBuilder.OTHER);
+public static final ElementName RB = new ElementName("rb", "rb",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RB_OR_RTC | OPTIONAL_END_TAG);
+public static final ElementName DESC = new ElementName("desc", "desc",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGDescElement,
+TreeBuilder.FOREIGNOBJECT_OR_DESC | SCOPING_AS_SVG);
+public static final ElementName DD = new ElementName("dd", "dd",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.DD_OR_DT | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName BGSOUND = new ElementName("bgsound", "bgsound",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
+public static final ElementName EMBED = new ElementName("embed", "embed",
+// CPPONLY: NS_NewHTMLEmbedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.EMBED | SPECIAL);
+public static final ElementName FEBLEND = new ElementName("feblend", "feBlend",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEBlendElement,
+TreeBuilder.OTHER);
+public static final ElementName FEFLOOD = new ElementName("feflood", "feFlood",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEFloodElement,
+TreeBuilder.OTHER);
+public static final ElementName HEAD = new ElementName("head", "head",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.HEAD | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName LEGEND = new ElementName("legend", "legend",
+// CPPONLY: NS_NewHTMLLegendElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName NOEMBED = new ElementName("noembed", "noembed",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.NOEMBED | SPECIAL);
+public static final ElementName TD = new ElementName("td", "td",
+// CPPONLY: NS_NewHTMLTableCellElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TD_OR_TH | SPECIAL | SCOPING | OPTIONAL_END_TAG);
+public static final ElementName THEAD = new ElementName("thead", "thead",
+// CPPONLY: NS_NewHTMLTableSectionElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
+public static final ElementName ASIDE = new ElementName("aside", "aside",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName ARTICLE = new ElementName("article", "article",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName ANIMATE = new ElementName("animate", "animate",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGAnimateElement,
+TreeBuilder.OTHER);
+public static final ElementName BASE = new ElementName("base", "base",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.BASE | SPECIAL);
+public static final ElementName BLOCKQUOTE = new ElementName("blockquote", "blockquote",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
+public static final ElementName CODE = new ElementName("code", "code",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName CIRCLE = new ElementName("circle", "circle",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGCircleElement,
+TreeBuilder.OTHER);
+public static final ElementName CITE = new ElementName("cite", "cite",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName ELLIPSE = new ElementName("ellipse", "ellipse",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGEllipseElement,
+TreeBuilder.OTHER);
+public static final ElementName FETURBULENCE = new ElementName("feturbulence", "feTurbulence",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFETurbulenceElement,
+TreeBuilder.OTHER);
+public static final ElementName FEMERGENODE = new ElementName("femergenode", "feMergeNode",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEMergeNodeElement,
+TreeBuilder.OTHER);
+public static final ElementName FEIMAGE = new ElementName("feimage", "feImage",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEImageElement,
+TreeBuilder.OTHER);
+public static final ElementName FEMERGE = new ElementName("femerge", "feMerge",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEMergeElement,
+TreeBuilder.OTHER);
+public static final ElementName FETILE = new ElementName("fetile", "feTile",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFETileElement,
+TreeBuilder.OTHER);
+public static final ElementName FRAME = new ElementName("frame", "frame",
+// CPPONLY: NS_NewHTMLFrameElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.FRAME | SPECIAL);
+public static final ElementName FIGURE = new ElementName("figure", "figure",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName FECOMPOSITE = new ElementName("fecomposite", "feComposite",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFECompositeElement,
+TreeBuilder.OTHER);
+public static final ElementName IMAGE = new ElementName("image", "image",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGImageElement,
+TreeBuilder.IMAGE);
+public static final ElementName IFRAME = new ElementName("iframe", "iframe",
+// CPPONLY: NS_NewHTMLIFrameElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.IFRAME | SPECIAL);
+public static final ElementName LINE = new ElementName("line", "line",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGLineElement,
+TreeBuilder.OTHER);
+public static final ElementName MARQUEE = new ElementName("marquee", "marquee",
+// CPPONLY: NS_NewHTMLMarqueeElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MARQUEE_OR_APPLET | SPECIAL | SCOPING);
+public static final ElementName POLYLINE = new ElementName("polyline", "polyline",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGPolylineElement,
+TreeBuilder.OTHER);
+public static final ElementName PICTURE = new ElementName("picture", "picture",
+// CPPONLY: NS_NewHTMLPictureElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName SOURCE = new ElementName("source", "source",
+// CPPONLY: NS_NewHTMLSourceElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.PARAM_OR_SOURCE_OR_TRACK);
+public static final ElementName STRIKE = new ElementName("strike", "strike",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName STYLE = new ElementName("style", "style",
+// CPPONLY: NS_NewHTMLStyleElement,
+// CPPONLY: NS_NewSVGStyleElement,
+TreeBuilder.STYLE | SPECIAL);
+public static final ElementName TABLE = new ElementName("table", "table",
+// CPPONLY: NS_NewHTMLTableElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TABLE | SPECIAL | FOSTER_PARENTING | SCOPING);
+public static final ElementName TITLE = new ElementName("title", "title",
+// CPPONLY: NS_NewHTMLTitleElement,
+// CPPONLY: NS_NewSVGTitleElement,
+TreeBuilder.TITLE | SPECIAL | SCOPING_AS_SVG);
+public static final ElementName TIME = new ElementName("time", "time",
+// CPPONLY: NS_NewHTMLTimeElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName TEMPLATE = new ElementName("template", "template",
+// CPPONLY: NS_NewHTMLTemplateElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TEMPLATE | SPECIAL | SCOPING);
+public static final ElementName ALTGLYPHDEF = new ElementName("altglyphdef", "altGlyphDef",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName GLYPHREF = new ElementName("glyphref", "glyphRef",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName DIALOG = new ElementName("dialog", "dialog",
+// CPPONLY: NS_NewHTMLDialogElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName FEFUNCG = new ElementName("fefuncg", "feFuncG",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEFuncGElement,
+TreeBuilder.OTHER);
+public static final ElementName FEDIFFUSELIGHTING = new ElementName("fediffuselighting", "feDiffuseLighting",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEDiffuseLightingElement,
+TreeBuilder.OTHER);
+public static final ElementName FESPECULARLIGHTING = new ElementName("fespecularlighting", "feSpecularLighting",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFESpecularLightingElement,
+TreeBuilder.OTHER);
+public static final ElementName LISTING = new ElementName("listing", "listing",
+// CPPONLY: NS_NewHTMLPreElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.PRE_OR_LISTING | SPECIAL);
+public static final ElementName STRONG = new ElementName("strong", "strong",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName ALTGLYPH = new ElementName("altglyph", "altGlyph",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName CLIPPATH = new ElementName("clippath", "clipPath",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGClipPathElement,
+TreeBuilder.OTHER);
+public static final ElementName MGLYPH = new ElementName("mglyph", "mglyph",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MGLYPH_OR_MALIGNMARK);
+public static final ElementName MATH = new ElementName("math", "math",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MATH);
+public static final ElementName MPATH = new ElementName("mpath", "mpath",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGMPathElement,
+TreeBuilder.OTHER);
+public static final ElementName PATH = new ElementName("path", "path",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGPathElement,
+TreeBuilder.OTHER);
+public static final ElementName TH = new ElementName("th", "th",
+// CPPONLY: NS_NewHTMLTableCellElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TD_OR_TH | SPECIAL | SCOPING | OPTIONAL_END_TAG);
+public static final ElementName SWITCH = new ElementName("switch", "switch",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGSwitchElement,
+TreeBuilder.OTHER);
+public static final ElementName TEXTPATH = new ElementName("textpath", "textPath",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGTextPathElement,
+TreeBuilder.OTHER);
+public static final ElementName LI = new ElementName("li", "li",
+// CPPONLY: NS_NewHTMLLIElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.LI | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName MI = new ElementName("mi", "mi",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
+public static final ElementName LINK = new ElementName("link", "link",
+// CPPONLY: NS_NewHTMLLinkElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
+public static final ElementName MARK = new ElementName("mark", "mark",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName MALIGNMARK = new ElementName("malignmark", "malignmark",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MGLYPH_OR_MALIGNMARK);
+public static final ElementName MASK = new ElementName("mask", "mask",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGMaskElement,
+TreeBuilder.OTHER);
+public static final ElementName TRACK = new ElementName("track", "track",
+// CPPONLY: NS_NewHTMLTrackElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.PARAM_OR_SOURCE_OR_TRACK | SPECIAL);
+public static final ElementName DL = new ElementName("dl", "dl",
+// CPPONLY: NS_NewHTMLSharedListElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
+public static final ElementName HTML = new ElementName("html", "html",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.HTML | SPECIAL | SCOPING | OPTIONAL_END_TAG);
+public static final ElementName OL = new ElementName("ol", "ol",
+// CPPONLY: NS_NewHTMLSharedListElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
+public static final ElementName LABEL = new ElementName("label", "label",
+// CPPONLY: NS_NewHTMLLabelElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName UL = new ElementName("ul", "ul",
+// CPPONLY: NS_NewHTMLSharedListElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
+public static final ElementName SMALL = new ElementName("small", "small",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName SYMBOL = new ElementName("symbol", "symbol",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGSymbolElement,
+TreeBuilder.OTHER);
+public static final ElementName ALTGLYPHITEM = new ElementName("altglyphitem", "altGlyphItem",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName ANIMATETRANSFORM = new ElementName("animatetransform", "animateTransform",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGAnimateTransformElement,
+TreeBuilder.OTHER);
+public static final ElementName ACRONYM = new ElementName("acronym", "acronym",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName EM = new ElementName("em", "em",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName FORM = new ElementName("form", "form",
+// CPPONLY: NS_NewHTMLFormElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.FORM | SPECIAL);
+public static final ElementName PARAM = new ElementName("param", "param",
+// CPPONLY: NS_NewHTMLSharedElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.PARAM_OR_SOURCE_OR_TRACK | SPECIAL);
+public static final ElementName ANIMATEMOTION = new ElementName("animatemotion", "animateMotion",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGAnimateMotionElement,
+TreeBuilder.OTHER);
+public static final ElementName BUTTON = new ElementName("button", "button",
+// CPPONLY: NS_NewHTMLButtonElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.BUTTON | SPECIAL);
+public static final ElementName CAPTION = new ElementName("caption", "caption",
+// CPPONLY: NS_NewHTMLTableCaptionElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.CAPTION | SPECIAL | SCOPING);
+public static final ElementName FIGCAPTION = new ElementName("figcaption", "figcaption",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName MN = new ElementName("mn", "mn",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
+public static final ElementName KEYGEN = new ElementName("keygen", "keygen",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.KEYGEN | SPECIAL);
+public static final ElementName MAIN = new ElementName("main", "main",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName OPTION = new ElementName("option", "option",
+// CPPONLY: NS_NewHTMLOptionElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OPTION | OPTIONAL_END_TAG);
+public static final ElementName POLYGON = new ElementName("polygon", "polygon",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGPolygonElement,
+TreeBuilder.OTHER);
+public static final ElementName PATTERN = new ElementName("pattern", "pattern",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGPatternElement,
+TreeBuilder.OTHER);
+public static final ElementName SPAN = new ElementName("span", "span",
+// CPPONLY: NS_NewHTMLSpanElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
+public static final ElementName SECTION = new ElementName("section", "section",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName TSPAN = new ElementName("tspan", "tspan",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGTSpanElement,
+TreeBuilder.OTHER);
+public static final ElementName AUDIO = new ElementName("audio", "audio",
+// CPPONLY: NS_NewHTMLAudioElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName MO = new ElementName("mo", "mo",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
+public static final ElementName VIDEO = new ElementName("video", "video",
+// CPPONLY: NS_NewHTMLVideoElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName COLGROUP = new ElementName("colgroup", "colgroup",
+// CPPONLY: NS_NewHTMLTableColElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.COLGROUP | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName FEDISPLACEMENTMAP = new ElementName("fedisplacementmap", "feDisplacementMap",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEDisplacementMapElement,
+TreeBuilder.OTHER);
+public static final ElementName HGROUP = new ElementName("hgroup", "hgroup",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName RP = new ElementName("rp", "rp",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RT_OR_RP | OPTIONAL_END_TAG);
+public static final ElementName OPTGROUP = new ElementName("optgroup", "optgroup",
+// CPPONLY: NS_NewHTMLOptGroupElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OPTGROUP | OPTIONAL_END_TAG);
+public static final ElementName SAMP = new ElementName("samp", "samp",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName STOP = new ElementName("stop", "stop",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGStopElement,
+TreeBuilder.OTHER);
+public static final ElementName BR = new ElementName("br", "br",
+// CPPONLY: NS_NewHTMLBRElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.BR | SPECIAL);
+public static final ElementName ABBR = new ElementName("abbr", "abbr",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName ANIMATECOLOR = new ElementName("animatecolor", "animateColor",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName CENTER = new ElementName("center", "center",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
+public static final ElementName HR = new ElementName("hr", "hr",
+// CPPONLY: NS_NewHTMLHRElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.HR | SPECIAL);
+public static final ElementName FEFUNCR = new ElementName("fefuncr", "feFuncR",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEFuncRElement,
+TreeBuilder.OTHER);
+public static final ElementName FECOMPONENTTRANSFER = new ElementName("fecomponenttransfer", "feComponentTransfer",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEComponentTransferElement,
+TreeBuilder.OTHER);
+public static final ElementName FILTER = new ElementName("filter", "filter",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFilterElement,
+TreeBuilder.OTHER);
+public static final ElementName FOOTER = new ElementName("footer", "footer",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName FEGAUSSIANBLUR = new ElementName("fegaussianblur", "feGaussianBlur",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEGaussianBlurElement,
+TreeBuilder.OTHER);
+public static final ElementName HEADER = new ElementName("header", "header",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName MARKER = new ElementName("marker", "marker",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGMarkerElement,
+TreeBuilder.OTHER);
+public static final ElementName METER = new ElementName("meter", "meter",
+// CPPONLY: NS_NewHTMLMeterElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName NOBR = new ElementName("nobr", "nobr",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.NOBR);
+public static final ElementName TR = new ElementName("tr", "tr",
+// CPPONLY: NS_NewHTMLTableRowElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TR | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
+public static final ElementName ADDRESS = new ElementName("address", "address",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName CANVAS = new ElementName("canvas", "canvas",
+// CPPONLY: NS_NewHTMLCanvasElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName DEFS = new ElementName("defs", "defs",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGDefsElement,
+TreeBuilder.OTHER);
+public static final ElementName DETAILS = new ElementName("details", "details",
+// CPPONLY: NS_NewHTMLDetailsElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName MS = new ElementName("ms", "ms",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
+public static final ElementName NOFRAMES = new ElementName("noframes", "noframes",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.NOFRAMES | SPECIAL);
+public static final ElementName PROGRESS = new ElementName("progress", "progress",
+// CPPONLY: NS_NewHTMLProgressElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName DT = new ElementName("dt", "dt",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.DD_OR_DT | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName APPLET = new ElementName("applet", "applet",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MARQUEE_OR_APPLET | SPECIAL | SCOPING);
+public static final ElementName BASEFONT = new ElementName("basefont", "basefont",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
+public static final ElementName DATALIST = new ElementName("datalist", "datalist",
+// CPPONLY: NS_NewHTMLDataListElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName FOREIGNOBJECT = new ElementName("foreignobject", "foreignObject",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGForeignObjectElement,
+TreeBuilder.FOREIGNOBJECT_OR_DESC | SCOPING_AS_SVG);
+public static final ElementName FIELDSET = new ElementName("fieldset", "fieldset",
+// CPPONLY: NS_NewHTMLFieldSetElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.FIELDSET | SPECIAL);
+public static final ElementName FRAMESET = new ElementName("frameset", "frameset",
+// CPPONLY: NS_NewHTMLFrameSetElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.FRAMESET | SPECIAL);
+public static final ElementName FEOFFSET = new ElementName("feoffset", "feOffset",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEOffsetElement,
+TreeBuilder.OTHER);
+public static final ElementName FESPOTLIGHT = new ElementName("fespotlight", "feSpotLight",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFESpotLightElement,
+TreeBuilder.OTHER);
+public static final ElementName FEPOINTLIGHT = new ElementName("fepointlight", "fePointLight",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEPointLightElement,
+TreeBuilder.OTHER);
+public static final ElementName FEDISTANTLIGHT = new ElementName("fedistantlight", "feDistantLight",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEDistantLightElement,
+TreeBuilder.OTHER);
+public static final ElementName FONT = new ElementName("font", "font",
+// CPPONLY: NS_NewHTMLFontElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.FONT);
+public static final ElementName INPUT = new ElementName("input", "input",
+// CPPONLY: NS_NewHTMLInputElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.INPUT | SPECIAL);
+public static final ElementName LINEARGRADIENT = new ElementName("lineargradient", "linearGradient",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGLinearGradientElement,
+TreeBuilder.OTHER);
+public static final ElementName MTEXT = new ElementName("mtext", "mtext",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
+public static final ElementName NOSCRIPT = new ElementName("noscript", "noscript",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.NOSCRIPT | SPECIAL);
+public static final ElementName RT = new ElementName("rt", "rt",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RT_OR_RP | OPTIONAL_END_TAG);
+public static final ElementName OBJECT = new ElementName("object", "object",
+// CPPONLY: NS_NewHTMLObjectElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OBJECT | SPECIAL | SCOPING);
+public static final ElementName OUTPUT = new ElementName("output", "output",
+// CPPONLY: NS_NewHTMLOutputElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OUTPUT);
+public static final ElementName PLAINTEXT = new ElementName("plaintext", "plaintext",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.PLAINTEXT | SPECIAL);
+public static final ElementName TT = new ElementName("tt", "tt",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
+public static final ElementName RECT = new ElementName("rect", "rect",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGRectElement,
+TreeBuilder.OTHER);
+public static final ElementName RADIALGRADIENT = new ElementName("radialgradient", "radialGradient",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGRadialGradientElement,
+TreeBuilder.OTHER);
+public static final ElementName SELECT = new ElementName("select", "select",
+// CPPONLY: NS_NewHTMLSelectElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.SELECT | SPECIAL);
+public static final ElementName SLOT = new ElementName("slot", "slot",
+// CPPONLY: NS_NewHTMLSlotElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.OTHER);
+public static final ElementName SCRIPT = new ElementName("script", "script",
+// CPPONLY: NS_NewHTMLScriptElement,
+// CPPONLY: NS_NewSVGScriptElement,
+TreeBuilder.SCRIPT | SPECIAL);
+public static final ElementName TFOOT = new ElementName("tfoot", "tfoot",
+// CPPONLY: NS_NewHTMLTableSectionElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
+public static final ElementName TEXT = new ElementName("text", "text",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGTextElement,
+TreeBuilder.OTHER);
+public static final ElementName MENU = new ElementName("menu", "menu",
+// CPPONLY: NS_NewHTMLMenuElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
+public static final ElementName FEDROPSHADOW = new ElementName("fedropshadow", "feDropShadow",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEDropShadowElement,
+TreeBuilder.OTHER);
+public static final ElementName VIEW = new ElementName("view", "view",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGViewElement,
+TreeBuilder.OTHER);
+public static final ElementName FECOLORMATRIX = new ElementName("fecolormatrix", "feColorMatrix",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEColorMatrixElement,
+TreeBuilder.OTHER);
+public static final ElementName FECONVOLVEMATRIX = new ElementName("feconvolvematrix", "feConvolveMatrix",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEConvolveMatrixElement,
+TreeBuilder.OTHER);
+public static final ElementName BODY = new ElementName("body", "body",
+// CPPONLY: NS_NewHTMLBodyElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.BODY | SPECIAL | OPTIONAL_END_TAG);
+public static final ElementName FEMORPHOLOGY = new ElementName("femorphology", "feMorphology",
+// CPPONLY: NS_NewHTMLUnknownElement,
+// CPPONLY: NS_NewSVGFEMorphologyElement,
+TreeBuilder.OTHER);
+public static final ElementName RUBY = new ElementName("ruby", "ruby",
+// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
+public static final ElementName SUMMARY = new ElementName("summary", "summary",
+// CPPONLY: NS_NewHTMLSummaryElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
+public static final ElementName TBODY = new ElementName("tbody", "tbody",
+// CPPONLY: NS_NewHTMLTableSectionElement,
+// CPPONLY: NS_NewSVGUnknownElement,
+TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
+private final static @NoLength ElementName[] ELEMENT_NAMES = {
+MN,
+CITE,
+FRAMESET,
+H1,
+CLIPPATH,
+METER,
+RADIALGRADIENT,
+B,
+BGSOUND,
+SOURCE,
+HTML,
+OPTGROUP,
+NOFRAMES,
+MTEXT,
+VIEW,
+DIV,
+G,
+FEFUNCA,
+THEAD,
+FIGURE,
+GLYPHREF,
+LI,
+ACRONYM,
+TSPAN,
+FEFUNCR,
+CANVAS,
+BASEFONT,
+FEDISTANTLIGHT,
+OUTPUT,
+TFOOT,
+FEMORPHOLOGY,
+COL,
+MAP,
+SUP,
+P,
+H5,
+FEFUNCB,
+HEAD,
+BASE,
+FEIMAGE,
+LINE,
+TITLE,
+FESPECULARLIGHTING,
+PATH,
+MALIGNMARK,
+SMALL,
+ANIMATEMOTION,
+POLYGON,
+COLGROUP,
+ABBR,
+FEGAUSSIANBLUR,
+TR,
+DETAILS,
+DT,
+FOREIGNOBJECT,
+FESPOTLIGHT,
+INPUT,
+RT,
+TT,
+SLOT,
+MENU,
+FECONVOLVEMATRIX,
+SUMMARY,
+BDI,
+DFN,
+INS,
+PRE,
+SUB,
+USE,
+XMP,
+S,
+H3,
+AREA,
+META,
+DESC,
+FEBLEND,
+NOEMBED,
+ARTICLE,
+CODE,
+FETURBULENCE,
+FETILE,
+IMAGE,
+POLYLINE,
+STYLE,
+TEMPLATE,
+FEFUNCG,
+STRONG,
+MATH,
+SWITCH,
+LINK,
+TRACK,
+LABEL,
+ALTGLYPHITEM,
+FORM,
+CAPTION,
+MAIN,
+SPAN,
+MO,
+HGROUP,
+STOP,
+CENTER,
+FILTER,
+MARKER,
+NOBR,
+ADDRESS,
+DEFS,
+MS,
+PROGRESS,
+APPLET,
+DATALIST,
+FIELDSET,
+FEOFFSET,
+FEPOINTLIGHT,
+FONT,
+LINEARGRADIENT,
+NOSCRIPT,
+OBJECT,
+PLAINTEXT,
+RECT,
+SELECT,
+SCRIPT,
+TEXT,
+FEDROPSHADOW,
+FECOLORMATRIX,
+BODY,
+RUBY,
+TBODY,
+BIG,
+BDO,
+DEL,
+DIR,
+IMG,
+KBD,
+NAV,
+A,
+RTC,
+SVG,
+SET,
+VAR,
+WBR,
+I,
+Q,
+U,
+H2,
+H4,
+H6,
+DATA,
+METADATA,
+TEXTAREA,
+RB,
+DD,
+EMBED,
+FEFLOOD,
+LEGEND,
+TD,
+ASIDE,
+ANIMATE,
+BLOCKQUOTE,
+CIRCLE,
+ELLIPSE,
+FEMERGENODE,
+FEMERGE,
+FRAME,
+FECOMPOSITE,
+IFRAME,
+MARQUEE,
+PICTURE,
+STRIKE,
+TABLE,
+TIME,
+ALTGLYPHDEF,
+DIALOG,
+FEDIFFUSELIGHTING,
+LISTING,
+ALTGLYPH,
+MGLYPH,
+MPATH,
+TH,
+TEXTPATH,
+MI,
+MARK,
+MASK,
+DL,
+OL,
+UL,
+SYMBOL,
+ANIMATETRANSFORM,
+EM,
+PARAM,
+BUTTON,
+FIGCAPTION,
+KEYGEN,
+OPTION,
+PATTERN,
+SECTION,
+AUDIO,
+VIDEO,
+FEDISPLACEMENTMAP,
+RP,
+SAMP,
+BR,
+ANIMATECOLOR,
+HR,
+FECOMPONENTTRANSFER,
+FOOTER,
+HEADER,
+};
+private final static int[] ELEMENT_HASHES = {
+1902641154,
+1748359220,
+2001349720,
+876609538,
+1798686984,
+1971465813,
+2007781534,
+59768833,
+1730965751,
+1756474198,
+1868312196,
+1939219752,
+1988763672,
+2005324101,
+2060065124,
+52490899,
+62390273,
+1682547543,
+1740181637,
+1749905526,
+1766992520,
+1818230786,
+1881613047,
+1907959605,
+1967760215,
+1982935782,
+1999397992,
+2001392798,
+2006329158,
+2008851557,
+2085266636,
+51961587,
+57206291,
+60352339,
+67108865,
+943718402,
+1699324759,
+1733890180,
+1747814436,
+1749715159,
+1752979652,
+1757146773,
+1783388498,
+1805502724,
+1854228698,
+1874053333,
+1898223949,
+1906087319,
+1932928296,
+1965115924,
+1968053806,
+1973420034,
+1983633431,
+1998585858,
+2001309869,
+2001392795,
+2003183333,
+2005925890,
+2006974466,
+2008325940,
+2021937364,
+2068523856,
+2092255447,
+51435587,
+52486755,
+55110883,
+58773795,
+60345171,
+61395251,
+62973651,
+68681729,
+910163970,
+1679960596,
+1686491348,
+1715310660,
+1733054663,
+1737099991,
+1747176599,
+1748100148,
+1749656156,
+1749801286,
+1751288021,
+1755076808,
+1756625221,
+1757268168,
+1783210839,
+1790207270,
+1803929812,
+1806806678,
+1853642948,
+1857653029,
+1870268949,
+1881288348,
+1884120164,
+1899272519,
+1904412884,
+1907435316,
+1919418370,
+1935549734,
+1941221172,
+1966223078,
+1967795910,
+1971461414,
+1971938532,
+1982173479,
+1983533124,
+1986527234,
+1990037800,
+1998724870,
+2000525512,
+2001349704,
+2001349736,
+2001392796,
+2001495140,
+2004635806,
+2005719336,
+2006028454,
+2006896969,
+2007601444,
+2008125638,
+2008340774,
+2008994116,
+2051837468,
+2068523853,
+2083120164,
+2091479332,
+2092557349,
+51434643,
+51438659,
+52485715,
+52488851,
+55104723,
+56151587,
+57733651,
+59244545,
+59821379,
+60347747,
+60354131,
+61925907,
+62450211,
+63438849,
+67633153,
+69730305,
+893386754,
+926941186,
+960495618,
+1681770564,
+1686489160,
+1689922072,
+1703936002,
+1730150402,
+1732381397,
+1733076167,
+1736200310,
+1738539010,
+1747048757,
+1747306711,
+1747838298,
+1748225318,
+1749395095,
+1749673195,
+1749723735,
+1749813541,
+1749932347,
+1751386406,
+1753362711,
+1755148615,
+1756600614,
+1757137429,
+1757157700,
+1763839627,
+1782357526,
+1783388497,
+1786534215,
+1797585096,
+1803876550,
+1803929861,
+1805647874,
+1807599880,
+1818755074,
+1854228692,
+1854245076,
+1864368130,
+1870135298,
+1873281026,
+1874102998,
+1881498736,
+1881669634,
+1889085973,
+1898753862,
+1900845386,
+1903302038,
+1905563974,
+1906135367,
+1907661127,
+1914900309,
+1925844629,
+1934172497,
+1938817026,
+1941178676,
+1963982850,
+1965334268,
+1967128578,
+1967788867,
+1967795958,
+1968836118,
+};
+}
diff --git a/parser/html/javasrc/Portability.java b/parser/html/javasrc/Portability.java
new file mode 100644
index 0000000000..1d65894a86
--- /dev/null
+++ b/parser/html/javasrc/Portability.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2008-2015 Mozilla Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package nu.validator.htmlparser.impl;
+
+import org.xml.sax.SAXException;
+
+import nu.validator.htmlparser.annotation.Literal;
+import nu.validator.htmlparser.annotation.Local;
+import nu.validator.htmlparser.annotation.NoLength;
+import nu.validator.htmlparser.common.Interner;
+
+public final class Portability {
+
+ public static int checkedAdd(int a, int b) throws SAXException {
+ // This can't be translated code, because in C++ signed integer overflow is UB, so the below code would be wrong.
+ assert a >= 0;
+ assert b >= 0;
+ int sum = a + b;
+ if (sum < a || sum < b) {
+ throw new SAXException("Integer overflow");
+ }
+ return sum;
+ }
+
+ // Allocating methods
+
+ /**
+ * Allocates a new local name object. In C++, the refcount must be set up in such a way that
+ * calling <code>releaseLocal</code> on the return value balances the refcount set by this method.
+ */
+ public static @Local String newLocalNameFromBuffer(@NoLength char[] buf, int length, Interner interner) {
+ return new String(buf, 0, length).intern();
+ }
+
+ public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length
+ // CPPONLY: , TreeBuilder treeBuilder, boolean maybeAtomize
+ ) {
+ return new String(buf, offset, length);
+ }
+
+ public static String newEmptyString() {
+ return "";
+ }
+
+ public static String newStringFromLiteral(@Literal String literal) {
+ return literal;
+ }
+
+ public static String newStringFromString(String string) {
+ return string;
+ }
+
+ // XXX get rid of this
+ public static char[] newCharArrayFromLocal(@Local String local) {
+ return local.toCharArray();
+ }
+
+ public static char[] newCharArrayFromString(String string) {
+ return string.toCharArray();
+ }
+
+ // Deallocation methods
+
+ public static void releaseString(String str) {
+ // No-op in Java
+ }
+
+ // Comparison methods
+
+ public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int length) {
+ if (local.length() != length) {
+ return false;
+ }
+ for (int i = 0; i < length; i++) {
+ if (local.charAt(i) != buf[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(@Literal String lowerCaseLiteral,
+ String string) {
+ if (string == null) {
+ return false;
+ }
+ if (lowerCaseLiteral.length() > string.length()) {
+ return false;
+ }
+ for (int i = 0; i < lowerCaseLiteral.length(); i++) {
+ char c0 = lowerCaseLiteral.charAt(i);
+ char c1 = string.charAt(i);
+ if (c1 >= 'A' && c1 <= 'Z') {
+ c1 += 0x20;
+ }
+ if (c0 != c1) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean lowerCaseLiteralEqualsIgnoreAsciiCaseString(@Literal String lowerCaseLiteral,
+ String string) {
+ if (string == null) {
+ return false;
+ }
+ if (lowerCaseLiteral.length() != string.length()) {
+ return false;
+ }
+ for (int i = 0; i < lowerCaseLiteral.length(); i++) {
+ char c0 = lowerCaseLiteral.charAt(i);
+ char c1 = string.charAt(i);
+ if (c1 >= 'A' && c1 <= 'Z') {
+ c1 += 0x20;
+ }
+ if (c0 != c1) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean literalEqualsString(@Literal String literal, String string) {
+ return literal.equals(string);
+ }
+
+ public static boolean stringEqualsString(String one, String other) {
+ return one.equals(other);
+ }
+
+ public static void delete(Object o) {
+
+ }
+
+ public static void deleteArray(Object o) {
+
+ }
+}
diff --git a/parser/html/javasrc/README.txt b/parser/html/javasrc/README.txt
new file mode 100644
index 0000000000..4555969cad
--- /dev/null
+++ b/parser/html/javasrc/README.txt
@@ -0,0 +1,6 @@
+The .java files in this directory were placed here by the Java-to-C++
+translator that lives in parser/html/java/translator. Together they represent
+a snapshot of the Java code that was translated to produce the corresponding
+.h and .cpp files in the parent directory. Changing these .java files is not
+worthwhile, as they will just be overwritten by the next translation. See
+parser/html/java/README.txt for information about performing the translation.
diff --git a/parser/html/javasrc/StackNode.java b/parser/html/javasrc/StackNode.java
new file mode 100644
index 0000000000..cfd570724e
--- /dev/null
+++ b/parser/html/javasrc/StackNode.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2007 Henri Sivonen
+ * Copyright (c) 2007-2011 Mozilla Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package nu.validator.htmlparser.impl;
+
+import nu.validator.htmlparser.annotation.Inline;
+import nu.validator.htmlparser.annotation.Local;
+import nu.validator.htmlparser.annotation.NsUri;
+
+final class StackNode<T> {
+ // Index where this stack node is stored in the tree builder's list of stack nodes.
+ // A value of -1 indicates that the stack node is not owned by a tree builder and
+ // must delete itself when its refcount reaches 0.
+ final int idxInTreeBuilder;
+
+ int flags;
+
+ @Local String name;
+
+ @Local String popName;
+
+ @NsUri String ns;
+
+ T node;
+
+ // Only used on the list of formatting elements
+ HtmlAttributes attributes;
+
+ private int refcount = 0;
+
+ /*
+ * Only valid for formatting elements
+ */
+ // CPPONLY: private @HtmlCreator Object htmlCreator;
+
+ // [NOCPP[
+
+ private TaintableLocatorImpl locator;
+
+ public TaintableLocatorImpl getLocator() {
+ return locator;
+ }
+
+ // ]NOCPP]
+
+ @Inline public int getFlags() {
+ return flags;
+ }
+
+ public int getGroup() {
+ return flags & ElementName.GROUP_MASK;
+ }
+
+ public boolean isScoping() {
+ return (flags & ElementName.SCOPING) != 0;
+ }
+
+ public boolean isSpecial() {
+ return (flags & ElementName.SPECIAL) != 0;
+ }
+
+ public boolean isFosterParenting() {
+ return (flags & ElementName.FOSTER_PARENTING) != 0;
+ }
+
+ public boolean isHtmlIntegrationPoint() {
+ return (flags & ElementName.HTML_INTEGRATION_POINT) != 0;
+ }
+
+ // [NOCPP[
+
+ public boolean isOptionalEndTag() {
+ return (flags & ElementName.OPTIONAL_END_TAG) != 0;
+ }
+
+ // ]NOCPP]
+
+ StackNode(int idxInTreeBuilder) {
+ this.idxInTreeBuilder = idxInTreeBuilder;
+ this.flags = 0;
+ this.name = null;
+ this.popName = null;
+ // CPPONLY: this.ns = 0;
+ this.node = null;
+ this.attributes = null;
+ this.refcount = 0;
+ // CPPONLY: this.htmlCreator = null;
+ }
+
+ // CPPONLY: public @HtmlCreator Object getHtmlCreator() {
+ // CPPONLY: return htmlCreator;
+ // CPPONLY: }
+
+ /**
+ * Setter for copying. This doesn't take another <code>StackNode</code>
+ * because in C++ the caller is responsible for reobtaining the local names
+ * from another interner.
+ *
+ * @param flags
+ * @param ns
+ * @param name
+ * @param node
+ * @param popName
+ * @param attributes
+ */
+ void setValues(int flags, @NsUri String ns, @Local String name, T node,
+ @Local String popName, HtmlAttributes attributes,
+ // CPPONLY: @HtmlCreator Object htmlCreator
+ // [NOCPP[
+ TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ assert isUnused();
+ this.flags = flags;
+ this.name = name;
+ this.popName = popName;
+ this.ns = ns;
+ this.node = node;
+ this.attributes = attributes;
+ this.refcount = 1;
+ /*
+ * Need to track creator for formatting elements when copying.
+ */
+ // CPPONLY: this.htmlCreator = htmlCreator;
+ // [NOCPP[
+ this.locator = locator;
+ // ]NOCPP]
+ }
+
+ /**
+ * Short hand for well-known HTML elements.
+ *
+ * @param elementName
+ * @param node
+ */
+ void setValues(ElementName elementName, T node
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ assert isUnused();
+ this.flags = elementName.getFlags();
+ this.name = elementName.getName();
+ this.popName = elementName.getName();
+ this.ns = "http://www.w3.org/1999/xhtml";
+ this.node = node;
+ this.attributes = null;
+ this.refcount = 1;
+ assert elementName.isInterned() : "Don't use this constructor for custom elements.";
+ /*
+ * Not used for formatting elements, so no need to track creator.
+ */
+ // CPPONLY: this.htmlCreator = null;
+ // [NOCPP[
+ this.locator = locator;
+ // ]NOCPP]
+ }
+
+ /**
+ * Setter for HTML formatting elements.
+ *
+ * @param elementName
+ * @param node
+ * @param attributes
+ */
+ void setValues(ElementName elementName, T node, HtmlAttributes attributes
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ assert isUnused();
+ this.flags = elementName.getFlags();
+ this.name = elementName.getName();
+ this.popName = elementName.getName();
+ this.ns = "http://www.w3.org/1999/xhtml";
+ this.node = node;
+ this.attributes = attributes;
+ this.refcount = 1;
+ assert elementName.isInterned() : "Don't use this constructor for custom elements.";
+ /*
+ * Need to track creator for formatting elements in order to be able
+ * to clone them.
+ */
+ // CPPONLY: this.htmlCreator = elementName.getHtmlCreator();
+ // [NOCPP[
+ this.locator = locator;
+ // ]NOCPP]
+ }
+
+ /**
+ * The common-case HTML setter.
+ *
+ * @param elementName
+ * @param node
+ * @param popName
+ */
+ void setValues(ElementName elementName, T node, @Local String popName
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ assert isUnused();
+ this.flags = elementName.getFlags();
+ this.name = elementName.getName();
+ this.popName = popName;
+ this.ns = "http://www.w3.org/1999/xhtml";
+ this.node = node;
+ this.attributes = null;
+ this.refcount = 1;
+ /*
+ * Not used for formatting elements, so no need to track creator.
+ */
+ // CPPONLY: this.htmlCreator = null;
+ // [NOCPP[
+ this.locator = locator;
+ // ]NOCPP]
+ }
+
+ /**
+ * Setter for SVG elements. Note that the order of the arguments is
+ * what distinguishes this from the HTML setter. This is ugly, but
+ * AFAICT the least disruptive way to make this work with Java's generics
+ * and without unnecessary branches. :-(
+ *
+ * @param elementName
+ * @param popName
+ * @param node
+ */
+ void setValues(ElementName elementName, @Local String popName, T node
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ assert isUnused();
+ this.flags = prepareSvgFlags(elementName.getFlags());
+ this.name = elementName.getName();
+ this.popName = popName;
+ this.ns = "http://www.w3.org/2000/svg";
+ this.node = node;
+ this.attributes = null;
+ this.refcount = 1;
+ /*
+ * Not used for formatting elements, so no need to track creator.
+ */
+ // CPPONLY: this.htmlCreator = null;
+ // [NOCPP[
+ this.locator = locator;
+ // ]NOCPP]
+ }
+
+ /**
+ * Setter for MathML.
+ *
+ * @param elementName
+ * @param node
+ * @param popName
+ * @param markAsIntegrationPoint
+ */
+ void setValues(ElementName elementName, T node, @Local String popName,
+ boolean markAsIntegrationPoint
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ assert isUnused();
+ this.flags = prepareMathFlags(elementName.getFlags(),
+ markAsIntegrationPoint);
+ this.name = elementName.getName();
+ this.popName = popName;
+ this.ns = "http://www.w3.org/1998/Math/MathML";
+ this.node = node;
+ this.attributes = null;
+ this.refcount = 1;
+ /*
+ * Not used for formatting elements, so no need to track creator.
+ */
+ // CPPONLY: this.htmlCreator = null;
+ // [NOCPP[
+ this.locator = locator;
+ // ]NOCPP]
+ }
+
+ private static int prepareSvgFlags(int flags) {
+ flags &= ~(ElementName.FOSTER_PARENTING | ElementName.SCOPING
+ | ElementName.SPECIAL | ElementName.OPTIONAL_END_TAG);
+ if ((flags & ElementName.SCOPING_AS_SVG) != 0) {
+ flags |= (ElementName.SCOPING | ElementName.SPECIAL | ElementName.HTML_INTEGRATION_POINT);
+ }
+ return flags;
+ }
+
+ private static int prepareMathFlags(int flags,
+ boolean markAsIntegrationPoint) {
+ flags &= ~(ElementName.FOSTER_PARENTING | ElementName.SCOPING
+ | ElementName.SPECIAL | ElementName.OPTIONAL_END_TAG);
+ if ((flags & ElementName.SCOPING_AS_MATHML) != 0) {
+ flags |= (ElementName.SCOPING | ElementName.SPECIAL);
+ }
+ if (markAsIntegrationPoint) {
+ flags |= ElementName.HTML_INTEGRATION_POINT;
+ }
+ return flags;
+ }
+
+ @SuppressWarnings("unused") private void destructor() {
+ // The translator adds refcount debug code here.
+ }
+
+ public void dropAttributes() {
+ attributes = null;
+ }
+
+ // [NOCPP[
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override public @Local String toString() {
+ return name;
+ }
+
+ // ]NOCPP]
+
+ public void retain() {
+ refcount++;
+ }
+
+ public void release(TreeBuilder<T> owningTreeBuilder) {
+ refcount--;
+ assert refcount >= 0;
+ if (refcount == 0) {
+ Portability.delete(attributes);
+ if (idxInTreeBuilder >= 0) {
+ owningTreeBuilder.notifyUnusedStackNode(idxInTreeBuilder);
+ } else {
+ assert owningTreeBuilder == null;
+ Portability.delete(this);
+ }
+ }
+ }
+
+ boolean isUnused() {
+ return refcount == 0;
+ }
+}
diff --git a/parser/html/javasrc/StateSnapshot.java b/parser/html/javasrc/StateSnapshot.java
new file mode 100644
index 0000000000..cba711f714
--- /dev/null
+++ b/parser/html/javasrc/StateSnapshot.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2009-2010 Mozilla Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package nu.validator.htmlparser.impl;
+
+import nu.validator.htmlparser.annotation.Auto;
+
+
+public class StateSnapshot<T> implements TreeBuilderState<T> {
+
+ private final @Auto StackNode<T>[] stack;
+
+ private final @Auto StackNode<T>[] listOfActiveFormattingElements;
+
+ private final @Auto int[] templateModeStack;
+
+ private final T formPointer;
+
+ private final T headPointer;
+
+ private final int mode;
+
+ private final int originalMode;
+
+ private final boolean framesetOk;
+
+ private final boolean needToDropLF;
+
+ private final boolean quirks;
+
+ /**
+ * @param stack
+ * @param listOfActiveFormattingElements
+ * @param templateModeStack
+ * @param formPointer
+ * @param headPointer
+ * @param deepTreeSurrogateParent
+ * @param mode
+ * @param originalMode
+ * @param framesetOk
+ * @param needToDropLF
+ * @param quirks
+ */
+ StateSnapshot(StackNode<T>[] stack,
+ StackNode<T>[] listOfActiveFormattingElements, int[] templateModeStack, T formPointer,
+ T headPointer, int mode, int originalMode,
+ boolean framesetOk, boolean needToDropLF, boolean quirks) {
+ this.stack = stack;
+ this.listOfActiveFormattingElements = listOfActiveFormattingElements;
+ this.templateModeStack = templateModeStack;
+ this.formPointer = formPointer;
+ this.headPointer = headPointer;
+ this.mode = mode;
+ this.originalMode = originalMode;
+ this.framesetOk = framesetOk;
+ this.needToDropLF = needToDropLF;
+ this.quirks = quirks;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
+ */
+ @Override
+ public StackNode<T>[] getStack() {
+ return stack;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
+ */
+ @Override
+ public int[] getTemplateModeStack() {
+ return templateModeStack;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
+ */
+ @Override
+ public StackNode<T>[] getListOfActiveFormattingElements() {
+ return listOfActiveFormattingElements;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
+ */
+ @Override
+ public T getFormPointer() {
+ return formPointer;
+ }
+
+ /**
+ * Returns the headPointer.
+ *
+ * @return the headPointer
+ */
+ @Override
+ public T getHeadPointer() {
+ return headPointer;
+ }
+
+ /**
+ * Returns the mode.
+ *
+ * @return the mode
+ */
+ @Override
+ public int getMode() {
+ return mode;
+ }
+
+ /**
+ * Returns the originalMode.
+ *
+ * @return the originalMode
+ */
+ @Override
+ public int getOriginalMode() {
+ return originalMode;
+ }
+
+ /**
+ * Returns the framesetOk.
+ *
+ * @return the framesetOk
+ */
+ @Override
+ public boolean isFramesetOk() {
+ return framesetOk;
+ }
+
+ /**
+ * Returns the needToDropLF.
+ *
+ * @return the needToDropLF
+ */
+ @Override
+ public boolean isNeedToDropLF() {
+ return needToDropLF;
+ }
+
+ /**
+ * Returns the quirks.
+ *
+ * @return the quirks
+ */
+ @Override
+ public boolean isQuirks() {
+ return quirks;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
+ */
+ @Override
+ public int getListOfActiveFormattingElementsLength() {
+ return listOfActiveFormattingElements.length;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
+ */
+ @Override
+ public int getStackLength() {
+ return stack.length;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
+ */
+ @Override
+ public int getTemplateModeStackLength() {
+ return templateModeStack.length;
+ }
+
+ @SuppressWarnings("unused") private void destructor() {
+ for (int i = 0; i < stack.length; i++) {
+ stack[i].release(null);
+ }
+ for (int i = 0; i < listOfActiveFormattingElements.length; i++) {
+ if (listOfActiveFormattingElements[i] != null) {
+ listOfActiveFormattingElements[i].release(null);
+ }
+ }
+ }
+}
diff --git a/parser/html/javasrc/Tokenizer.java b/parser/html/javasrc/Tokenizer.java
new file mode 100644
index 0000000000..a8047c7a71
--- /dev/null
+++ b/parser/html/javasrc/Tokenizer.java
@@ -0,0 +1,7636 @@
+/*
+ * Copyright (c) 2005-2007 Henri Sivonen
+ * Copyright (c) 2007-2017 Mozilla Foundation
+ * Portions of comments Copyright 2004-2010 Apple Computer, Inc., Mozilla
+ * Foundation, and Opera Software ASA.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The comments following this one that use the same comment syntax as this
+ * comment are quotes from the WHATWG HTML 5 spec as of 2 June 2007
+ * amended as of June 18 2008 and May 31 2010.
+ * That document came with this statement:
+ * "© Copyright 2004-2010 Apple Computer, Inc., Mozilla Foundation, and
+ * Opera Software ASA. You are granted a license to use, reproduce and
+ * create derivative works of this document."
+ */
+
+package nu.validator.htmlparser.impl;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.ext.Locator2;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import nu.validator.htmlparser.annotation.Auto;
+import nu.validator.htmlparser.annotation.CharacterName;
+import nu.validator.htmlparser.annotation.Const;
+import nu.validator.htmlparser.annotation.Inline;
+import nu.validator.htmlparser.annotation.Local;
+import nu.validator.htmlparser.annotation.NoLength;
+import nu.validator.htmlparser.common.EncodingDeclarationHandler;
+import nu.validator.htmlparser.common.Interner;
+import nu.validator.htmlparser.common.TokenHandler;
+import nu.validator.htmlparser.common.XmlViolationPolicy;
+
+/**
+ * An implementation of
+ * https://html.spec.whatwg.org/multipage/syntax.html#tokenization
+ *
+ * This class implements the <code>Locator</code> interface. This is not an
+ * incidental implementation detail: Users of this class are encouraged to make
+ * use of the <code>Locator</code> nature.
+ *
+ * By default, the tokenizer may report data that XML 1.0 bans. The tokenizer
+ * can be configured to treat these conditions as fatal or to coerce the infoset
+ * to something that XML 1.0 allows.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public class Tokenizer implements Locator, Locator2 {
+
+ private static final int DATA_AND_RCDATA_MASK = ~1;
+
+ public static final int DATA = 0;
+
+ public static final int RCDATA = 1;
+
+ public static final int SCRIPT_DATA = 2;
+
+ public static final int RAWTEXT = 3;
+
+ public static final int SCRIPT_DATA_ESCAPED = 4;
+
+ public static final int ATTRIBUTE_VALUE_DOUBLE_QUOTED = 5;
+
+ public static final int ATTRIBUTE_VALUE_SINGLE_QUOTED = 6;
+
+ public static final int ATTRIBUTE_VALUE_UNQUOTED = 7;
+
+ public static final int PLAINTEXT = 8;
+
+ public static final int TAG_OPEN = 9;
+
+ public static final int CLOSE_TAG_OPEN = 10;
+
+ public static final int TAG_NAME = 11;
+
+ public static final int BEFORE_ATTRIBUTE_NAME = 12;
+
+ public static final int ATTRIBUTE_NAME = 13;
+
+ public static final int AFTER_ATTRIBUTE_NAME = 14;
+
+ public static final int BEFORE_ATTRIBUTE_VALUE = 15;
+
+ public static final int AFTER_ATTRIBUTE_VALUE_QUOTED = 16;
+
+ public static final int BOGUS_COMMENT = 17;
+
+ public static final int MARKUP_DECLARATION_OPEN = 18;
+
+ public static final int DOCTYPE = 19;
+
+ public static final int BEFORE_DOCTYPE_NAME = 20;
+
+ public static final int DOCTYPE_NAME = 21;
+
+ public static final int AFTER_DOCTYPE_NAME = 22;
+
+ public static final int BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 23;
+
+ public static final int DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 24;
+
+ public static final int DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 25;
+
+ public static final int AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 26;
+
+ public static final int BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 27;
+
+ public static final int DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 28;
+
+ public static final int DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 29;
+
+ public static final int AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 30;
+
+ public static final int BOGUS_DOCTYPE = 31;
+
+ public static final int COMMENT_START = 32;
+
+ public static final int COMMENT_START_DASH = 33;
+
+ public static final int COMMENT = 34;
+
+ public static final int COMMENT_END_DASH = 35;
+
+ public static final int COMMENT_END = 36;
+
+ public static final int COMMENT_END_BANG = 37;
+
+ public static final int NON_DATA_END_TAG_NAME = 38;
+
+ public static final int MARKUP_DECLARATION_HYPHEN = 39;
+
+ public static final int MARKUP_DECLARATION_OCTYPE = 40;
+
+ public static final int DOCTYPE_UBLIC = 41;
+
+ public static final int DOCTYPE_YSTEM = 42;
+
+ public static final int AFTER_DOCTYPE_PUBLIC_KEYWORD = 43;
+
+ public static final int BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 44;
+
+ public static final int AFTER_DOCTYPE_SYSTEM_KEYWORD = 45;
+
+ public static final int CONSUME_CHARACTER_REFERENCE = 46;
+
+ public static final int CONSUME_NCR = 47;
+
+ public static final int CHARACTER_REFERENCE_TAIL = 48;
+
+ public static final int HEX_NCR_LOOP = 49;
+
+ public static final int DECIMAL_NRC_LOOP = 50;
+
+ public static final int HANDLE_NCR_VALUE = 51;
+
+ public static final int HANDLE_NCR_VALUE_RECONSUME = 52;
+
+ public static final int CHARACTER_REFERENCE_HILO_LOOKUP = 53;
+
+ public static final int SELF_CLOSING_START_TAG = 54;
+
+ public static final int CDATA_START = 55;
+
+ public static final int CDATA_SECTION = 56;
+
+ public static final int CDATA_RSQB = 57;
+
+ public static final int CDATA_RSQB_RSQB = 58;
+
+ public static final int SCRIPT_DATA_LESS_THAN_SIGN = 59;
+
+ public static final int SCRIPT_DATA_ESCAPE_START = 60;
+
+ public static final int SCRIPT_DATA_ESCAPE_START_DASH = 61;
+
+ public static final int SCRIPT_DATA_ESCAPED_DASH = 62;
+
+ public static final int SCRIPT_DATA_ESCAPED_DASH_DASH = 63;
+
+ public static final int BOGUS_COMMENT_HYPHEN = 64;
+
+ public static final int RAWTEXT_RCDATA_LESS_THAN_SIGN = 65;
+
+ public static final int SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 66;
+
+ public static final int SCRIPT_DATA_DOUBLE_ESCAPE_START = 67;
+
+ public static final int SCRIPT_DATA_DOUBLE_ESCAPED = 68;
+
+ public static final int SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 69;
+
+ public static final int SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 70;
+
+ public static final int SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 71;
+
+ public static final int SCRIPT_DATA_DOUBLE_ESCAPE_END = 72;
+
+ public static final int PROCESSING_INSTRUCTION = 73;
+
+ public static final int PROCESSING_INSTRUCTION_QUESTION_MARK = 74;
+
+ public static final int COMMENT_LESSTHAN = 76;
+
+ public static final int COMMENT_LESSTHAN_BANG = 77;
+
+ public static final int COMMENT_LESSTHAN_BANG_DASH = 78;
+
+ public static final int COMMENT_LESSTHAN_BANG_DASH_DASH = 79;
+
+ /**
+ * Magic value for UTF-16 operations.
+ */
+ private static final int LEAD_OFFSET = (0xD800 - (0x10000 >> 10));
+
+ /**
+ * UTF-16 code unit array containing less than and greater than for emitting
+ * those characters on certain parse errors.
+ */
+ private static final @NoLength char[] LT_GT = { '<', '>' };
+
+ /**
+ * UTF-16 code unit array containing less than and solidus for emitting
+ * those characters on certain parse errors.
+ */
+ private static final @NoLength char[] LT_SOLIDUS = { '<', '/' };
+
+ /**
+ * UTF-16 code unit array containing ]] for emitting those characters on
+ * state transitions.
+ */
+ private static final @NoLength char[] RSQB_RSQB = { ']', ']' };
+
+ /**
+ * Array version of U+FFFD.
+ */
+ private static final @NoLength char[] REPLACEMENT_CHARACTER = { '\uFFFD' };
+
+ // [NOCPP[
+
+ /**
+ * Array version of space.
+ */
+ private static final @NoLength char[] SPACE = { ' ' };
+
+ // ]NOCPP]
+
+ /**
+ * Array version of line feed.
+ */
+ private static final @NoLength char[] LF = { '\n' };
+
+ /**
+ * "CDATA[" as <code>char[]</code>
+ */
+ private static final @NoLength char[] CDATA_LSQB = { 'C', 'D', 'A', 'T',
+ 'A', '[' };
+
+ /**
+ * "octype" as <code>char[]</code>
+ */
+ private static final @NoLength char[] OCTYPE = { 'o', 'c', 't', 'y', 'p',
+ 'e' };
+
+ /**
+ * "ublic" as <code>char[]</code>
+ */
+ private static final @NoLength char[] UBLIC = { 'u', 'b', 'l', 'i', 'c' };
+
+ /**
+ * "ystem" as <code>char[]</code>
+ */
+ private static final @NoLength char[] YSTEM = { 'y', 's', 't', 'e', 'm' };
+
+ private static final char[] TITLE_ARR = { 't', 'i', 't', 'l', 'e' };
+
+ private static final char[] SCRIPT_ARR = { 's', 'c', 'r', 'i', 'p', 't' };
+
+ private static final char[] STYLE_ARR = { 's', 't', 'y', 'l', 'e' };
+
+ private static final char[] PLAINTEXT_ARR = { 'p', 'l', 'a', 'i', 'n', 't',
+ 'e', 'x', 't' };
+
+ private static final char[] XMP_ARR = { 'x', 'm', 'p' };
+
+ private static final char[] TEXTAREA_ARR = { 't', 'e', 'x', 't', 'a', 'r',
+ 'e', 'a' };
+
+ private static final char[] IFRAME_ARR = { 'i', 'f', 'r', 'a', 'm', 'e' };
+
+ private static final char[] NOEMBED_ARR = { 'n', 'o', 'e', 'm', 'b', 'e',
+ 'd' };
+
+ private static final char[] NOSCRIPT_ARR = { 'n', 'o', 's', 'c', 'r', 'i',
+ 'p', 't' };
+
+ private static final char[] NOFRAMES_ARR = { 'n', 'o', 'f', 'r', 'a', 'm',
+ 'e', 's' };
+
+ /**
+ * The token handler.
+ */
+ protected final TokenHandler tokenHandler;
+
+ protected EncodingDeclarationHandler encodingDeclarationHandler;
+
+ // [NOCPP[
+
+ /**
+ * The error handler.
+ */
+ protected ErrorHandler errorHandler;
+
+ // ]NOCPP]
+
+ /**
+ * Whether the previous char read was CR.
+ */
+ protected boolean lastCR;
+
+ protected int stateSave;
+
+ private int returnStateSave;
+
+ protected int index;
+
+ private boolean forceQuirks;
+
+ private char additional;
+
+ private int entCol;
+
+ private int firstCharKey;
+
+ private int lo;
+
+ private int hi;
+
+ private int candidate;
+
+ private int charRefBufMark;
+
+ protected int value;
+
+ private boolean seenDigits;
+
+ private boolean suspendAfterCurrentNonTextToken;
+
+ protected int cstart;
+
+ /**
+ * The SAX public id for the resource being tokenized. (Only passed to back
+ * as part of locator data.)
+ */
+ private String publicId;
+
+ /**
+ * The SAX system id for the resource being tokenized. (Only passed to back
+ * as part of locator data.)
+ */
+ private String systemId;
+
+ /**
+ * Buffer for bufferable things other than those that fit the description
+ * of <code>charRefBuf</code>.
+ */
+ private @Auto char[] strBuf;
+
+ /**
+ * Number of significant <code>char</code>s in <code>strBuf</code>.
+ */
+ private int strBufLen;
+
+ /**
+ * Buffer for characters that might form a character reference but may
+ * end up not forming one.
+ */
+ private final @Auto char[] charRefBuf;
+
+ /**
+ * Number of significant <code>char</code>s in <code>charRefBuf</code>.
+ */
+ private int charRefBufLen;
+
+ /**
+ * Buffer for expanding NCRs falling into the Basic Multilingual Plane.
+ */
+ private final @Auto char[] bmpChar;
+
+ /**
+ * Buffer for expanding astral NCRs.
+ */
+ private final @Auto char[] astralChar;
+
+ /**
+ * The element whose end tag closes the current CDATA or RCDATA element.
+ */
+ protected ElementName endTagExpectation = null;
+
+ private char[] endTagExpectationAsArray; // not @Auto!
+
+ /**
+ * <code>true</code> if tokenizing an end tag
+ */
+ protected boolean endTag;
+
+ /**
+ * <code>true</code> iff the current element/attribute name contains
+ * a hyphen.
+ */
+ private boolean containsHyphen;
+
+ /**
+ * The current tag token name. One of
+ * 1) null,
+ * 2) non-owning reference to nonInternedTagName
+ * 3) non-owning reference to a pre-interned ElementName
+ */
+ private ElementName tagName = null;
+
+ /**
+ * The recycled ElementName instance for the non-pre-interned cases.
+ */
+ private ElementName nonInternedTagName = null;
+
+ /**
+ * The current attribute name.
+ */
+ protected AttributeName attributeName = null;
+
+ // CPPONLY: private AttributeName nonInternedAttributeName = null;
+
+ // [NOCPP[
+
+ /**
+ * Whether comment tokens are emitted.
+ */
+ private boolean wantsComments = false;
+
+ /**
+ * Whether the stream is past the first 1024 bytes.
+ */
+ private boolean metaBoundaryPassed;
+
+ // ]NOCPP]
+
+ /**
+ * The name of the current doctype token.
+ */
+ private @Local String doctypeName;
+
+ /**
+ * The public id of the current doctype token.
+ */
+ private String publicIdentifier;
+
+ /**
+ * The system id of the current doctype token.
+ */
+ private String systemIdentifier;
+
+ /**
+ * The attribute holder.
+ */
+ private HtmlAttributes attributes;
+
+ // [NOCPP[
+
+ /**
+ * The policy for vertical tab and form feed.
+ */
+ private XmlViolationPolicy contentSpacePolicy = XmlViolationPolicy.ALTER_INFOSET;
+
+ /**
+ * The policy for comments.
+ */
+ private XmlViolationPolicy commentPolicy = XmlViolationPolicy.ALTER_INFOSET;
+
+ private XmlViolationPolicy xmlnsPolicy = XmlViolationPolicy.ALTER_INFOSET;
+
+ private XmlViolationPolicy namePolicy = XmlViolationPolicy.ALTER_INFOSET;
+
+ private int mappingLangToXmlLang;
+
+ // ]NOCPP]
+
+ private final boolean newAttributesEachTime;
+
+ private boolean shouldSuspend;
+
+ protected boolean confident;
+
+ private int line;
+
+ /*
+ * The line number of the current attribute. First set to the line of the
+ * attribute name and if there is a value, set to the line the value
+ * started on.
+ */
+ // CPPONLY: private int attributeLine;
+
+ private Interner interner;
+
+ // CPPONLY: private boolean viewingXmlSource;
+
+ // [NOCPP[
+
+ protected LocatorImpl ampersandLocation;
+
+ public Tokenizer(TokenHandler tokenHandler, boolean newAttributesEachTime) {
+ this.tokenHandler = tokenHandler;
+ this.encodingDeclarationHandler = null;
+ this.lastCR = false;
+ this.stateSave = 0;
+ this.returnStateSave = 0;
+ this.index = 0;
+ this.forceQuirks = false;
+ this.additional = '\u0000';
+ this.entCol = 0;
+ this.firstCharKey = 0;
+ this.lo = 0;
+ this.hi = 0;
+ this.candidate = 0;
+ this.charRefBufMark = 0;
+ this.value = 0;
+ this.seenDigits = false;
+ this.suspendAfterCurrentNonTextToken = false;
+ this.cstart = 0;
+ this.strBufLen = 0;
+ this.newAttributesEachTime = newAttributesEachTime;
+ // &CounterClockwiseContourIntegral; is the longest valid char ref and
+ // the semicolon never gets appended to the buffer.
+ this.charRefBuf = new char[32];
+ this.charRefBufLen = 0;
+ this.bmpChar = new char[1];
+ this.astralChar = new char[2];
+ this.endTagExpectation = null;
+ this.endTagExpectationAsArray = null;
+ this.endTag = false;
+ this.containsHyphen = false;
+ this.tagName = null;
+ this.nonInternedTagName = new ElementName();
+ this.attributeName = null;
+ // CPPONLY: this.nonInternedAttributeName = new AttributeName();
+ this.doctypeName = null;
+ this.publicIdentifier = null;
+ this.systemIdentifier = null;
+ this.attributes = null;
+ this.shouldSuspend = false;
+ this.confident = false;
+ this.line = 0;
+ // CPPONLY: this.attributeLine = 0;
+ this.interner = null;
+ }
+
+ // ]NOCPP]
+
+ /**
+ * The constructor.
+ *
+ * @param tokenHandler
+ * the handler for receiving tokens
+ */
+ public Tokenizer(TokenHandler tokenHandler
+ // CPPONLY: , boolean viewingXmlSource
+ ) {
+ this.tokenHandler = tokenHandler;
+ this.encodingDeclarationHandler = null;
+ // [NOCPP[
+ this.newAttributesEachTime = false;
+ // ]NOCPP]
+ this.lastCR = false;
+ this.stateSave = 0;
+ this.returnStateSave = 0;
+ this.index = 0;
+ this.forceQuirks = false;
+ this.additional = '\u0000';
+ this.entCol = 0;
+ this.firstCharKey = 0;
+ this.lo = 0;
+ this.hi = 0;
+ this.candidate = 0;
+ this.charRefBufMark = 0;
+ this.value = 0;
+ this.seenDigits = false;
+ this.suspendAfterCurrentNonTextToken = false;
+ this.cstart = 0;
+ this.strBufLen = 0;
+ // &CounterClockwiseContourIntegral; is the longest valid char ref and
+ // the semicolon never gets appended to the buffer.
+ this.charRefBuf = new char[32];
+ this.charRefBufLen = 0;
+ this.bmpChar = new char[1];
+ this.astralChar = new char[2];
+ this.endTagExpectation = null;
+ this.endTagExpectationAsArray = null;
+ this.endTag = false;
+ this.containsHyphen = false;
+ this.tagName = null;
+ this.nonInternedTagName = new ElementName();
+ this.attributeName = null;
+ // CPPONLY: this.nonInternedAttributeName = new AttributeName();
+ this.doctypeName = null;
+ this.publicIdentifier = null;
+ this.systemIdentifier = null;
+ // [NOCPP[
+ this.attributes = null;
+ // ]NOCPP]
+ // CPPONLY: this.attributes = tokenHandler.HasBuilder() ? new HtmlAttributes(mappingLangToXmlLang) : null;
+ // CPPONLY: this.newAttributesEachTime = !tokenHandler.HasBuilder();
+ this.shouldSuspend = false;
+ this.confident = false;
+ this.line = 0;
+ // CPPONLY: this.attributeLine = 0;
+ this.interner = null;
+ // CPPONLY: this.viewingXmlSource = viewingXmlSource;
+ }
+
+ public void setInterner(Interner interner) {
+ this.interner = interner;
+ }
+
+ public void initLocation(String newPublicId, String newSystemId) {
+ this.systemId = newSystemId;
+ this.publicId = newPublicId;
+
+ }
+
+ // CPPONLY: boolean isViewingXmlSource() {
+ // CPPONLY: return viewingXmlSource;
+ // CPPONLY: }
+
+ // [NOCPP[
+
+ /**
+ * Returns the mappingLangToXmlLang.
+ *
+ * @return the mappingLangToXmlLang
+ */
+ public boolean isMappingLangToXmlLang() {
+ return mappingLangToXmlLang == AttributeName.HTML_LANG;
+ }
+
+ /**
+ * Sets the mappingLangToXmlLang.
+ *
+ * @param mappingLangToXmlLang
+ * the mappingLangToXmlLang to set
+ */
+ public void setMappingLangToXmlLang(boolean mappingLangToXmlLang) {
+ this.mappingLangToXmlLang = mappingLangToXmlLang ? AttributeName.HTML_LANG
+ : AttributeName.HTML;
+ }
+
+ /**
+ * Sets the error handler.
+ *
+ * @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)
+ */
+ public void setErrorHandler(ErrorHandler eh) {
+ this.errorHandler = eh;
+ }
+
+ public ErrorHandler getErrorHandler() {
+ return this.errorHandler;
+ }
+
+ /**
+ * Sets the commentPolicy.
+ *
+ * @param commentPolicy
+ * the commentPolicy to set
+ */
+ public void setCommentPolicy(XmlViolationPolicy commentPolicy) {
+ this.commentPolicy = commentPolicy;
+ }
+
+ /**
+ * Sets the contentNonXmlCharPolicy.
+ *
+ * @param contentNonXmlCharPolicy
+ * the contentNonXmlCharPolicy to set
+ */
+ public void setContentNonXmlCharPolicy(
+ XmlViolationPolicy contentNonXmlCharPolicy) {
+ if (contentNonXmlCharPolicy != XmlViolationPolicy.ALLOW) {
+ throw new IllegalArgumentException(
+ "Must use ErrorReportingTokenizer to set contentNonXmlCharPolicy to non-ALLOW.");
+ }
+ }
+
+ /**
+ * Sets the contentSpacePolicy.
+ *
+ * @param contentSpacePolicy
+ * the contentSpacePolicy to set
+ */
+ public void setContentSpacePolicy(XmlViolationPolicy contentSpacePolicy) {
+ this.contentSpacePolicy = contentSpacePolicy;
+ }
+
+ /**
+ * Sets the xmlnsPolicy.
+ *
+ * @param xmlnsPolicy
+ * the xmlnsPolicy to set
+ */
+ public void setXmlnsPolicy(XmlViolationPolicy xmlnsPolicy) {
+ if (xmlnsPolicy == XmlViolationPolicy.FATAL) {
+ throw new IllegalArgumentException("Can't use FATAL here.");
+ }
+ this.xmlnsPolicy = xmlnsPolicy;
+ }
+
+ public void setNamePolicy(XmlViolationPolicy namePolicy) {
+ this.namePolicy = namePolicy;
+ }
+
+ // ]NOCPP]
+
+ // For the token handler to call
+
+ /**
+ * Sets the tokenizer state and the associated element name. This should
+ * only ever used to put the tokenizer into one of the states that have
+ * a special end tag expectation.
+ *
+ * @param specialTokenizerState
+ * the tokenizer state to set
+ */
+ public void setState(int specialTokenizerState) {
+ this.stateSave = specialTokenizerState;
+ this.endTagExpectation = null;
+ this.endTagExpectationAsArray = null;
+ }
+
+ // [NOCPP[
+
+ /**
+ * Sets the tokenizer state and the associated element name. This should
+ * only ever used to put the tokenizer into one of the states that have
+ * a special end tag expectation. For use from the tokenizer test harness.
+ *
+ * @param specialTokenizerState
+ * the tokenizer state to set
+ * @param endTagExpectation
+ * the expected end tag for transitioning back to normal
+ */
+ public void setStateAndEndTagExpectation(int specialTokenizerState,
+ @Local String endTagExpectation) {
+ this.stateSave = specialTokenizerState;
+ if (specialTokenizerState == Tokenizer.DATA) {
+ return;
+ }
+ @Auto char[] asArray = Portability.newCharArrayFromLocal(endTagExpectation);
+ this.endTagExpectation = ElementName.elementNameByBuffer(asArray,
+ asArray.length, interner);
+ assert this.endTagExpectation != null;
+ endTagExpectationToArray();
+ }
+
+ // ]NOCPP]
+
+ /**
+ * Sets the tokenizer state and the associated element name. This should
+ * only ever used to put the tokenizer into one of the states that have
+ * a special end tag expectation.
+ *
+ * @param specialTokenizerState
+ * the tokenizer state to set
+ * @param endTagExpectation
+ * the expected end tag for transitioning back to normal
+ */
+ public void setStateAndEndTagExpectation(int specialTokenizerState,
+ ElementName endTagExpectation) {
+ this.stateSave = specialTokenizerState;
+ this.endTagExpectation = endTagExpectation;
+ endTagExpectationToArray();
+ }
+
+ private void endTagExpectationToArray() {
+ switch (endTagExpectation.getGroup()) {
+ case TreeBuilder.TITLE:
+ endTagExpectationAsArray = TITLE_ARR;
+ return;
+ case TreeBuilder.SCRIPT:
+ endTagExpectationAsArray = SCRIPT_ARR;
+ return;
+ case TreeBuilder.STYLE:
+ endTagExpectationAsArray = STYLE_ARR;
+ return;
+ case TreeBuilder.PLAINTEXT:
+ endTagExpectationAsArray = PLAINTEXT_ARR;
+ return;
+ case TreeBuilder.XMP:
+ endTagExpectationAsArray = XMP_ARR;
+ return;
+ case TreeBuilder.TEXTAREA:
+ endTagExpectationAsArray = TEXTAREA_ARR;
+ return;
+ case TreeBuilder.IFRAME:
+ endTagExpectationAsArray = IFRAME_ARR;
+ return;
+ case TreeBuilder.NOEMBED:
+ endTagExpectationAsArray = NOEMBED_ARR;
+ return;
+ case TreeBuilder.NOSCRIPT:
+ endTagExpectationAsArray = NOSCRIPT_ARR;
+ return;
+ case TreeBuilder.NOFRAMES:
+ endTagExpectationAsArray = NOFRAMES_ARR;
+ return;
+ default:
+ assert false: "Bad end tag expectation.";
+ return;
+ }
+ }
+
+ /**
+ * For C++ use only.
+ */
+ public void setLineNumber(int line) {
+ // CPPONLY: this.attributeLine = line; // XXX is this needed?
+ this.line = line;
+ }
+
+ // start Locator impl
+
+ /**
+ * @see org.xml.sax.Locator#getLineNumber()
+ */
+ @Inline public int getLineNumber() {
+ return line;
+ }
+
+ // [NOCPP[
+
+ /**
+ * @see org.xml.sax.Locator#getColumnNumber()
+ */
+ @Inline public int getColumnNumber() {
+ return -1;
+ }
+
+ /**
+ * @see org.xml.sax.Locator#getPublicId()
+ */
+ public String getPublicId() {
+ return publicId;
+ }
+
+ /**
+ * @see org.xml.sax.Locator#getSystemId()
+ */
+ public String getSystemId() {
+ return systemId;
+ }
+
+ /**
+ * @see org.xml.sax.ext.Locator2#getXMLVersion()
+ */
+ public String getXMLVersion() {
+ return "1.0";
+ }
+
+ /**
+ * @see org.xml.sax.ext.Locator2#getXMLVersion()
+ */
+ public String getEncoding() {
+ try {
+ return encodingDeclarationHandler == null ? null : encodingDeclarationHandler.getCharacterEncoding();
+ } catch (SAXException e) {
+ return null;
+ }
+ }
+
+ // end Locator impl
+
+ // end public API
+
+ public void notifyAboutMetaBoundary() {
+ metaBoundaryPassed = true;
+ }
+
+ // ]NOCPP]
+
+ HtmlAttributes emptyAttributes() {
+ // [NOCPP[
+ if (newAttributesEachTime) {
+ return new HtmlAttributes(mappingLangToXmlLang);
+ } else {
+ // ]NOCPP]
+ return HtmlAttributes.EMPTY_ATTRIBUTES;
+ // [NOCPP[
+ }
+ // ]NOCPP]
+ }
+
+ @Inline private void appendCharRefBuf(char c) {
+ // CPPONLY: assert charRefBufLen < charRefBuf.length:
+ // CPPONLY: "RELEASE: Attempted to overrun charRefBuf!";
+ charRefBuf[charRefBufLen++] = c;
+ }
+
+ private void emitOrAppendCharRefBuf(int returnState) throws SAXException {
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ appendCharRefBufToStrBuf();
+ } else {
+ if (charRefBufLen > 0) {
+ tokenHandler.characters(charRefBuf, 0, charRefBufLen);
+ charRefBufLen = 0;
+ }
+ }
+ }
+
+ @Inline private void clearStrBufAfterUse() {
+ strBufLen = 0;
+ }
+
+ @Inline private void clearStrBufBeforeUse() {
+ assert strBufLen == 0: "strBufLen not reset after previous use!";
+ strBufLen = 0; // no-op in the absence of bugs
+ }
+
+ @Inline private void clearStrBufAfterOneHyphen() {
+ assert strBufLen == 1: "strBufLen length not one!";
+ assert strBuf[0] == '-': "strBuf does not start with a hyphen!";
+ strBufLen = 0;
+ }
+
+ /**
+ * Appends to the buffer.
+ *
+ * @param c
+ * the UTF-16 code unit to append
+ */
+ @Inline private void appendStrBuf(char c) {
+ // CPPONLY: assert strBufLen < strBuf.length: "Previous buffer length insufficient.";
+ // CPPONLY: if (strBufLen == strBuf.length) {
+ // CPPONLY: if (!EnsureBufferSpace(1)) {
+ // CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure";
+ // CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not
+ // CPPONLY: }
+ strBuf[strBufLen++] = c;
+ }
+
+ /**
+ * The buffer as a String. Currently only used for error reporting.
+ *
+ * <p>
+ * C++ memory note: The return value must be released.
+ *
+ * @return the buffer as a string
+ */
+ protected String strBufToString() {
+ String str = Portability.newStringFromBuffer(strBuf, 0, strBufLen
+ // CPPONLY: , tokenHandler, !newAttributesEachTime && attributeName == AttributeName.CLASS
+ );
+ clearStrBufAfterUse();
+ return str;
+ }
+
+ /**
+ * Returns the buffer as a local name. The return value is released in
+ * emitDoctypeToken().
+ *
+ * @return the buffer as local name
+ */
+ private void strBufToDoctypeName() {
+ doctypeName = Portability.newLocalNameFromBuffer(strBuf, strBufLen, interner);
+ clearStrBufAfterUse();
+ }
+
+ /**
+ * Emits the buffer as character tokens.
+ *
+ * @throws SAXException
+ * if the token handler threw
+ */
+ private void emitStrBuf() throws SAXException {
+ if (strBufLen > 0) {
+ tokenHandler.characters(strBuf, 0, strBufLen);
+ clearStrBufAfterUse();
+ }
+ }
+
+ @Inline private void appendSecondHyphenToBogusComment() throws SAXException {
+ // [NOCPP[
+ switch (commentPolicy) {
+ case ALTER_INFOSET:
+ appendStrBuf(' ');
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ALLOW:
+ warn("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
+ // ]NOCPP]
+ appendStrBuf('-');
+ // [NOCPP[
+ break;
+ case FATAL:
+ fatal("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
+ break;
+ }
+ // ]NOCPP]
+ }
+
+ // [NOCPP[
+ private void maybeAppendSpaceToBogusComment() throws SAXException {
+ switch (commentPolicy) {
+ case ALTER_INFOSET:
+ appendStrBuf(' ');
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ALLOW:
+ warn("The document is not mappable to XML 1.0 due to a trailing hyphen in a comment.");
+ break;
+ case FATAL:
+ fatal("The document is not mappable to XML 1.0 due to a trailing hyphen in a comment.");
+ break;
+ }
+ }
+
+ // ]NOCPP]
+
+ @Inline private void adjustDoubleHyphenAndAppendToStrBufAndErr(char c, boolean reportedConsecutiveHyphens)
+ throws SAXException {
+ // [NOCPP[
+ switch (commentPolicy) {
+ case ALTER_INFOSET:
+ strBufLen--;
+ // WARNING!!! This expands the worst case of the buffer length
+ // given the length of input!
+ appendStrBuf(' ');
+ appendStrBuf('-');
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ALLOW:
+ if (!reportedConsecutiveHyphens) {
+ warn("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
+ }
+ // ]NOCPP]
+ appendStrBuf(c);
+ // [NOCPP[
+ break;
+ case FATAL:
+ fatal("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
+ break;
+ }
+ // ]NOCPP]
+ }
+
+ private void appendStrBuf(@NoLength char[] buffer, int offset, int length) throws SAXException {
+ int newLen = Portability.checkedAdd(strBufLen, length);
+ // CPPONLY: assert newLen <= strBuf.length: "Previous buffer length insufficient.";
+ // CPPONLY: if (strBuf.length < newLen) {
+ // CPPONLY: if (!EnsureBufferSpace(length)) {
+ // CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure";
+ // CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not
+ // CPPONLY: }
+ System.arraycopy(buffer, offset, strBuf, strBufLen, length);
+ strBufLen = newLen;
+ }
+
+ /**
+ * Append the contents of the char reference buffer to the main one.
+ */
+ @Inline private void appendCharRefBufToStrBuf() throws SAXException {
+ appendStrBuf(charRefBuf, 0, charRefBufLen);
+ charRefBufLen = 0;
+ }
+
+ /**
+ * Emits the current comment token.
+ *
+ * NOTE: The method may set <code>shouldSuspend</code>, so the caller
+ * must have this pattern after the state's <code>transition</code> call:
+ *
+ * <pre>
+ * if (shouldSuspend) {
+ * break stateloop;
+ * }
+ * continue stateloop;
+ * </pre>
+ *
+ * @param pos
+ * TODO
+ *
+ * @throws SAXException
+ */
+ private void emitComment(int provisionalHyphens, int pos)
+ throws SAXException {
+ // CPPONLY: RememberGt(pos);
+ // [NOCPP[
+ if (wantsComments) {
+ // ]NOCPP]
+ tokenHandler.comment(strBuf, 0, strBufLen
+ - provisionalHyphens);
+ // [NOCPP[
+ }
+ // ]NOCPP]
+ clearStrBufAfterUse();
+ cstart = pos + 1;
+ suspendIfRequestedAfterCurrentNonTextToken();
+ }
+
+ /**
+ * Flushes coalesced character tokens.
+ *
+ * @param buf
+ * TODO
+ * @param pos
+ * TODO
+ *
+ * @throws SAXException
+ */
+ protected void flushChars(@NoLength char[] buf, int pos)
+ throws SAXException {
+ if (pos > cstart) {
+ tokenHandler.characters(buf, cstart, pos - cstart);
+ }
+ cstart = Integer.MAX_VALUE;
+ }
+
+ /**
+ * Reports an condition that would make the infoset incompatible with XML
+ * 1.0 as fatal.
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ * @throws SAXParseException
+ */
+ public void fatal(String message) throws SAXException {
+ SAXParseException spe = new SAXParseException(message, this);
+ if (errorHandler != null) {
+ errorHandler.fatalError(spe);
+ }
+ throw spe;
+ }
+
+ /**
+ * Reports a Parse Error.
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ public void err(String message) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ SAXParseException spe = new SAXParseException(message, this);
+ errorHandler.error(spe);
+ }
+
+ public void errTreeBuilder(String message) throws SAXException {
+ ErrorHandler eh = null;
+ if (tokenHandler instanceof TreeBuilder<?>) {
+ TreeBuilder<?> treeBuilder = (TreeBuilder<?>) tokenHandler;
+ eh = treeBuilder.getErrorHandler();
+ }
+ if (eh == null) {
+ eh = errorHandler;
+ }
+ if (eh == null) {
+ return;
+ }
+ SAXParseException spe = new SAXParseException(message, this);
+ eh.error(spe);
+ }
+
+ /**
+ * Reports a warning
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ public void warn(String message) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ SAXParseException spe = new SAXParseException(message, this);
+ errorHandler.warning(spe);
+ }
+
+ private void strBufToElementNameString() {
+ if (containsHyphen) {
+ // We've got a custom element or annotation-xml.
+ @Local String annotationName = ElementName.ANNOTATION_XML.getName();
+ if (Portability.localEqualsBuffer(annotationName, strBuf, strBufLen)) {
+ tagName = ElementName.ANNOTATION_XML;
+ } else {
+ nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, strBufLen,
+ interner)
+ // CPPONLY: , true
+ );
+ tagName = nonInternedTagName;
+ }
+ } else {
+ tagName = ElementName.elementNameByBuffer(strBuf, strBufLen, interner);
+ if (tagName == null) {
+ nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, strBufLen,
+ interner)
+ // CPPONLY: , false
+ );
+ tagName = nonInternedTagName;
+ }
+ }
+ containsHyphen = false;
+ clearStrBufAfterUse();
+ }
+
+ /**
+ * Emits a tag token.
+ *
+ * NOTE: The method may set <code>shouldSuspend</code>, so the caller
+ * must have this pattern after the state's <code>transition</code> call:
+ * <pre>
+ * if (shouldSuspend) {
+ * break stateloop;
+ * }
+ * continue stateloop;
+ * </pre>
+ *
+ * @param selfClosing
+ * @param pos
+ * @return
+ * @throws SAXException
+ */
+ private int emitCurrentTagToken(boolean selfClosing, int pos)
+ throws SAXException {
+ // CPPONLY: RememberGt(pos);
+ cstart = pos + 1;
+ maybeErrSlashInEndTag(selfClosing);
+ stateSave = Tokenizer.DATA;
+ HtmlAttributes attrs = (attributes == null ? HtmlAttributes.EMPTY_ATTRIBUTES
+ : attributes);
+ if (endTag) {
+ /*
+ * When an end tag token is emitted, the content model flag must be
+ * switched to the PCDATA state.
+ */
+ maybeErrAttributesOnEndTag(attrs);
+ // CPPONLY: if (!viewingXmlSource) {
+ tokenHandler.endTag(tagName);
+ // CPPONLY: }
+ // CPPONLY: if (newAttributesEachTime) {
+ // CPPONLY: Portability.delete(attributes);
+ // CPPONLY: attributes = null;
+ // CPPONLY: }
+ } else {
+ // CPPONLY: if (viewingXmlSource) {
+ // CPPONLY: assert newAttributesEachTime;
+ // CPPONLY: Portability.delete(attributes);
+ // CPPONLY: attributes = null;
+ // CPPONLY: } else {
+ tokenHandler.startTag(tagName, attrs, selfClosing);
+ // CPPONLY: }
+ }
+ tagName = null;
+ if (newAttributesEachTime) {
+ attributes = null;
+ } else {
+ attributes.clear(mappingLangToXmlLang);
+ }
+ /*
+ * The token handler may have called setStateAndEndTagExpectation
+ * and changed stateSave since the start of this method.
+ */
+ suspendIfRequestedAfterCurrentNonTextToken();
+ return stateSave;
+ }
+
+ private void attributeNameComplete() throws SAXException {
+ attributeName = AttributeName.nameByBuffer(strBuf, strBufLen, interner);
+ if (attributeName == null) {
+ // [NOCPP[
+ attributeName = AttributeName.createAttributeName(
+ Portability.newLocalNameFromBuffer(strBuf, strBufLen,
+ interner),
+ namePolicy != XmlViolationPolicy.ALLOW);
+ // ]NOCPP]
+ // CPPONLY: nonInternedAttributeName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, strBufLen, interner));
+ // CPPONLY: attributeName = nonInternedAttributeName;
+ }
+ clearStrBufAfterUse();
+
+ if (attributes == null) {
+ attributes = new HtmlAttributes(mappingLangToXmlLang);
+ }
+
+ /*
+ * When the user agent leaves the attribute name state (and before
+ * emitting the tag token, if appropriate), the complete attribute's
+ * name must be compared to the other attributes on the same token; if
+ * there is already an attribute on the token with the exact same name,
+ * then this is a parse error and the new attribute must be dropped,
+ * along with the value that gets associated with it (if any).
+ */
+ if (attributes.contains(attributeName)) {
+ errDuplicateAttribute();
+ attributeName = null;
+ }
+ }
+
+ private void addAttributeWithoutValue() throws SAXException {
+ noteAttributeWithoutValue();
+
+ // [NOCPP[
+ if (metaBoundaryPassed && AttributeName.CHARSET == attributeName
+ && ElementName.META == tagName) {
+ err("A \u201Ccharset\u201D attribute on a \u201Cmeta\u201D element found after the first 1024 bytes.");
+ }
+ // ]NOCPP]
+ if (attributeName != null) {
+ // [NOCPP[
+ if (AttributeName.SRC == attributeName
+ || AttributeName.HREF == attributeName) {
+ warn("Attribute \u201C"
+ + attributeName.getLocal(AttributeName.HTML)
+ + "\u201D without an explicit value seen. The attribute may be dropped by IE7.");
+ }
+ // ]NOCPP]
+ attributes.addAttribute(attributeName,
+ Portability.newEmptyString()
+ // [NOCPP[
+ , xmlnsPolicy
+ // ]NOCPP]
+ // CPPONLY: , attributeLine
+ );
+ attributeName = null;
+ } else {
+ clearStrBufAfterUse();
+ }
+ }
+
+ private void addAttributeWithValue() throws SAXException {
+ // [NOCPP[
+ if (metaBoundaryPassed && ElementName.META == tagName
+ && AttributeName.CHARSET == attributeName) {
+ err("A \u201Ccharset\u201D attribute on a \u201Cmeta\u201D element found after the first 1024 bytes.");
+ }
+ // ]NOCPP]
+ if (attributeName != null) {
+ String val = strBufToString(); // Ownership transferred to
+ // HtmlAttributes
+ // CPPONLY: if (mViewSource) {
+ // CPPONLY: mViewSource.MaybeLinkifyAttributeValue(attributeName, val);
+ // CPPONLY: }
+ attributes.addAttribute(attributeName, val
+ // [NOCPP[
+ , xmlnsPolicy
+ // ]NOCPP]
+ // CPPONLY: , attributeLine
+ );
+ attributeName = null;
+ } else {
+ // We have a duplicate attribute. Explicitly discard its value.
+ clearStrBufAfterUse();
+ }
+ }
+
+ // [NOCPP[
+
+ protected void startErrorReporting() throws SAXException {
+
+ }
+
+ // ]NOCPP]
+
+ public void start() throws SAXException {
+ initializeWithoutStarting();
+ tokenHandler.startTokenization(this);
+ // CPPONLY: line = 0;
+ // CPPONLY: col = 1;
+ // CPPONLY: nextCharOnNewLine = true;
+ // [NOCPP[
+ startErrorReporting();
+ // ]NOCPP]
+ }
+
+ public boolean tokenizeBuffer(UTF16Buffer buffer) throws SAXException {
+ int state = stateSave;
+ int returnState = returnStateSave;
+ char c = '\u0000';
+ shouldSuspend = false;
+ lastCR = false;
+
+ int start = buffer.getStart();
+ int end = buffer.getEnd();
+
+ // In C++, the caller of tokenizeBuffer needs to do this explicitly.
+ // [NOCPP[
+ ensureBufferSpace(end - start);
+ // ]NOCPP]
+
+ /**
+ * The index of the last <code>char</code> read from <code>buf</code>.
+ */
+ int pos = start - 1;
+
+ /**
+ * The index of the first <code>char</code> in <code>buf</code> that is
+ * part of a coalesced run of character tokens or
+ * <code>Integer.MAX_VALUE</code> if there is not a current run being
+ * coalesced.
+ */
+ switch (state) {
+ case DATA:
+ case RCDATA:
+ case SCRIPT_DATA:
+ case PLAINTEXT:
+ case RAWTEXT:
+ case CDATA_SECTION:
+ case SCRIPT_DATA_ESCAPED:
+ case SCRIPT_DATA_ESCAPE_START:
+ case SCRIPT_DATA_ESCAPE_START_DASH:
+ case SCRIPT_DATA_ESCAPED_DASH:
+ case SCRIPT_DATA_ESCAPED_DASH_DASH:
+ case SCRIPT_DATA_DOUBLE_ESCAPE_START:
+ case SCRIPT_DATA_DOUBLE_ESCAPED:
+ case SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
+ case SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
+ case SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
+ case SCRIPT_DATA_DOUBLE_ESCAPE_END:
+ cstart = start;
+ break;
+ default:
+ cstart = Integer.MAX_VALUE;
+ break;
+ }
+
+ /**
+ * The number of <code>char</code>s in <code>buf</code> that have
+ * meaning. (The rest of the array is garbage and should not be
+ * examined.)
+ */
+ // CPPONLY: if (mViewSource) {
+ // CPPONLY: mViewSource.SetBuffer(buffer);
+ // CPPONLY: pos = stateLoop(state, c, pos, buffer.getBuffer(), false, returnState, buffer.getEnd());
+ // CPPONLY: mViewSource.DropBuffer((pos == buffer.getEnd()) ? pos : pos + 1);
+ // CPPONLY: } else {
+ // CPPONLY: pos = stateLoop(state, c, pos, buffer.getBuffer(), false, returnState, buffer.getEnd());
+ // CPPONLY: }
+ // [NOCPP[
+ pos = stateLoop(state, c, pos, buffer.getBuffer(), false, returnState,
+ end);
+ // ]NOCPP]
+ if (pos == end) {
+ // exiting due to end of buffer
+ buffer.setStart(pos);
+ } else {
+ buffer.setStart(pos + 1);
+ }
+ return lastCR;
+ }
+
+ // [NOCPP[
+ private void ensureBufferSpace(int inputLength) throws SAXException {
+ // Add 2 to account for emissions of LT_GT, LT_SOLIDUS and RSQB_RSQB.
+ // Adding to the general worst case instead of only the
+ // TreeBuilder-exposed worst case to avoid re-introducing a bug when
+ // unifying the tokenizer and tree builder buffers in the future.
+ int worstCase = strBufLen + inputLength + charRefBufLen + 2;
+ tokenHandler.ensureBufferSpace(worstCase);
+ if (commentPolicy == XmlViolationPolicy.ALTER_INFOSET) {
+ // When altering infoset, if the comment contents are consecutive
+ // hyphens, each hyphen generates a space, too. These buffer
+ // contents never get emitted as characters() to the tokenHandler,
+ // which is why this calculation happens after the call to
+ // ensureBufferSpace on tokenHandler.
+ worstCase *= 2;
+ }
+ if (strBuf == null) {
+ // Add an arbitrary small value to avoid immediate reallocation
+ // once there are a few characters in the buffer.
+ strBuf = new char[worstCase + 128];
+ } else if (worstCase > strBuf.length) {
+ // HotSpot reportedly allocates memory with 8-byte accuracy, so
+ // there's no point in trying to do math here to avoid slop.
+ // Maybe we should add some small constant to worstCase here
+ // but not doing that without profiling. In C++ with jemalloc,
+ // the corresponding method should do math to round up here
+ // to avoid slop.
+ char[] newBuf = new char[Math.max(worstCase, (strBuf.length*5)/4)];
+ System.arraycopy(strBuf, 0, newBuf, 0, strBufLen);
+ strBuf = newBuf;
+ }
+ }
+ // ]NOCPP]
+
+ @SuppressWarnings("unused") private int stateLoop(int state, char c,
+ int pos, @NoLength char[] buf, boolean reconsume, int returnState,
+ int endPos) throws SAXException {
+ boolean reportedConsecutiveHyphens = false;
+ /*
+ * Idioms used in this code:
+ *
+ *
+ * Consuming the next input character
+ *
+ * To consume the next input character, the code does this: if (++pos ==
+ * endPos) { break stateloop; } c = checkChar(buf, pos);
+ *
+ *
+ * Staying in a state
+ *
+ * When there's a state that the tokenizer may stay in over multiple
+ * input characters, the state has a wrapper |for(;;)| loop and staying
+ * in the state continues the loop.
+ *
+ *
+ * Switching to another state
+ *
+ * To switch to another state, the code sets the state variable to the
+ * magic number of the new state. Then it either continues stateloop or
+ * breaks out of the state's own wrapper loop if the target state is
+ * right after the current state in source order. (This is a partial
+ * workaround for Java's lack of goto.)
+ *
+ *
+ * Reconsume support
+ *
+ * The spec sometimes says that an input character is reconsumed in
+ * another state. If a state can ever be entered so that an input
+ * character can be reconsumed in it, the state's code starts with an
+ * |if (reconsume)| that sets reconsume to false and skips over the
+ * normal code for consuming a new character.
+ *
+ * To reconsume the current character in another state, the code sets
+ * |reconsume| to true and then switches to the other state.
+ *
+ *
+ * Emitting character tokens
+ *
+ * This method emits character tokens lazily. Whenever a new range of
+ * character tokens starts, the field cstart must be set to the start
+ * index of the range. The flushChars() method must be called at the end
+ * of a range to flush it.
+ *
+ *
+ * U+0000 handling
+ *
+ * The various states have to handle the replacement of U+0000 with
+ * U+FFFD. However, if U+0000 would be reconsumed in another state, the
+ * replacement doesn't need to happen, because it's handled by the
+ * reconsuming state.
+ *
+ *
+ * LF handling
+ *
+ * Every state needs to increment the line number upon LF unless the LF
+ * gets reconsumed by another state which increments the line number.
+ *
+ *
+ * CR handling
+ *
+ * Every state needs to handle CR unless the CR gets reconsumed and is
+ * handled by the reconsuming state. The CR needs to be handled as if it
+ * were and LF, the lastCR field must be set to true and then this
+ * method must return. The IO driver will then swallow the next
+ * character if it is an LF to coalesce CRLF.
+ */
+ stateloop: for (;;) {
+ switch (state) {
+ case DATA:
+ dataloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ switch (c) {
+ case '&':
+ /*
+ * U+0026 AMPERSAND (&) Switch to the character
+ * reference in data state.
+ */
+ flushChars(buf, pos);
+ assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
+ appendCharRefBuf(c);
+ setAdditionalAndRememberAmpersandLocation('\u0000');
+ returnState = state;
+ state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
+ continue stateloop;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the tag
+ * open state.
+ */
+ flushChars(buf, pos);
+
+ state = transition(state, Tokenizer.TAG_OPEN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break dataloop;
+ case '\u0000':
+ maybeEmitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the input character as a
+ * character token.
+ *
+ * Stay in the data state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case TAG_OPEN:
+ tagopenloop: for (;;) {
+ /*
+ * The behavior of this state depends on the content
+ * model flag.
+ */
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * If the content model flag is set to the PCDATA state
+ * Consume the next input character:
+ */
+ if (c >= 'A' && c <= 'Z') {
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to U+005A
+ * LATIN CAPITAL LETTER Z Create a new start tag
+ * token,
+ */
+ endTag = false;
+ /*
+ * set its tag name to the lowercase version of the
+ * input character (add 0x0020 to the character's
+ * code point),
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf((char) (c + 0x20));
+ containsHyphen = false;
+ /* then switch to the tag name state. */
+ state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
+ /*
+ * (Don't emit the token yet; further details will
+ * be filled in before it is emitted.)
+ */
+ // `break` optimizes; `continue stateloop;` would be valid
+ break tagopenloop;
+ } else if (c >= 'a' && c <= 'z') {
+ /*
+ * U+0061 LATIN SMALL LETTER A through to U+007A
+ * LATIN SMALL LETTER Z Create a new start tag
+ * token,
+ */
+ endTag = false;
+ /*
+ * set its tag name to the input character,
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ containsHyphen = false;
+ /* then switch to the tag name state. */
+ state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
+ /*
+ * (Don't emit the token yet; further details will
+ * be filled in before it is emitted.)
+ */
+ // `break` optimizes; `continue stateloop;` would be valid
+ break tagopenloop;
+ }
+ switch (c) {
+ case '!':
+ /*
+ * U+0021 EXCLAMATION MARK (!) Switch to the
+ * markup declaration open state.
+ */
+ state = transition(state, Tokenizer.MARKUP_DECLARATION_OPEN, reconsume, pos);
+ continue stateloop;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Switch to the close tag
+ * open state.
+ */
+ state = transition(state, Tokenizer.CLOSE_TAG_OPEN, reconsume, pos);
+ continue stateloop;
+ case '?':
+ // CPPONLY: if (viewingXmlSource) {
+ // CPPONLY: state = transition(state,
+ // CPPONLY: Tokenizer.PROCESSING_INSTRUCTION,
+ // CPPONLY: reconsume,
+ // CPPONLY: pos);
+ // CPPONLY: continue stateloop;
+ // CPPONLY: }
+ /*
+ * U+003F QUESTION MARK (?) Parse error.
+ */
+ errProcessingInstruction();
+ /*
+ * Switch to the bogus comment state.
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Parse error.
+ */
+ errLtGt();
+ /*
+ * Emit a U+003C LESS-THAN SIGN character token
+ * and a U+003E GREATER-THAN SIGN character
+ * token.
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 2);
+ /* Switch to the data state. */
+ cstart = pos + 1;
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ continue stateloop;
+ default:
+ /*
+ * Anything else Parse error.
+ */
+ errBadCharAfterLt(c);
+ /*
+ * Emit a U+003C LESS-THAN SIGN character token
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ /*
+ * and reconsume the current input character in
+ * the data state.
+ */
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case TAG_NAME:
+ tagnameloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ strBufToElementNameString();
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the before attribute name state.
+ */
+ strBufToElementNameString();
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break tagnameloop;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Switch to the self-closing
+ * start tag state.
+ */
+ strBufToElementNameString();
+ state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * tag token.
+ */
+ strBufToElementNameString();
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ if (c >= 'A' && c <= 'Z') {
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Append the
+ * lowercase version of the current input
+ * character (add 0x0020 to the character's
+ * code point) to the current tag token's
+ * tag name.
+ */
+ c += 0x20;
+ } else if (c == '-') {
+ containsHyphen = true;
+ }
+ /*
+ * Anything else Append the current input
+ * character to the current tag token's tag
+ * name.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the tag name state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BEFORE_ATTRIBUTE_NAME:
+ beforeattributenameloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the before attribute name state.
+ */
+ continue;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Switch to the self-closing
+ * start tag state.
+ */
+ state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * tag token.
+ */
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case '\"':
+ case '\'':
+ case '<':
+ case '=':
+ /*
+ * U+0022 QUOTATION MARK (") U+0027 APOSTROPHE
+ * (') U+003C LESS-THAN SIGN (<) U+003D EQUALS
+ * SIGN (=) Parse error.
+ */
+ errBadCharBeforeAttributeNameOrNull(c);
+ /*
+ * Treat it as per the "anything else" entry
+ * below.
+ */
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Start a new attribute in the
+ * current tag token.
+ */
+ if (c >= 'A' && c <= 'Z') {
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Set that
+ * attribute's name to the lowercase version
+ * of the current input character (add
+ * 0x0020 to the character's code point)
+ */
+ c += 0x20;
+ }
+ // CPPONLY: attributeLine = line;
+ /*
+ * Set that attribute's name to the current
+ * input character,
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ /*
+ * and its value to the empty string.
+ */
+ // Will do later.
+ /*
+ * Switch to the attribute name state.
+ */
+ state = transition(state, Tokenizer.ATTRIBUTE_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break beforeattributenameloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ATTRIBUTE_NAME:
+ attributenameloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ attributeNameComplete();
+ state = transition(state, Tokenizer.AFTER_ATTRIBUTE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the after attribute name state.
+ */
+ attributeNameComplete();
+ state = transition(state, Tokenizer.AFTER_ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Switch to the self-closing
+ * start tag state.
+ */
+ attributeNameComplete();
+ addAttributeWithoutValue();
+ state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
+ continue stateloop;
+ case '=':
+ /*
+ * U+003D EQUALS SIGN (=) Switch to the before
+ * attribute value state.
+ */
+ attributeNameComplete();
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_VALUE, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break attributenameloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * tag token.
+ */
+ attributeNameComplete();
+ addAttributeWithoutValue();
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case '\"':
+ case '\'':
+ case '<':
+ /*
+ * U+0022 QUOTATION MARK (") U+0027 APOSTROPHE
+ * (') U+003C LESS-THAN SIGN (<) Parse error.
+ */
+ errQuoteOrLtInAttributeNameOrNull(c);
+ /*
+ * Treat it as per the "anything else" entry
+ * below.
+ */
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ if (c >= 'A' && c <= 'Z') {
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Append the
+ * lowercase version of the current input
+ * character (add 0x0020 to the character's
+ * code point) to the current attribute's
+ * name.
+ */
+ c += 0x20;
+ }
+ /*
+ * Anything else Append the current input
+ * character to the current attribute's name.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the attribute name state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BEFORE_ATTRIBUTE_VALUE:
+ beforeattributevalueloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the before attribute value state.
+ */
+ continue;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Switch to the
+ * attribute value (double-quoted) state.
+ */
+ // CPPONLY: attributeLine = line;
+ clearStrBufBeforeUse();
+ state = transition(state, Tokenizer.ATTRIBUTE_VALUE_DOUBLE_QUOTED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break beforeattributevalueloop;
+ case '&':
+ /*
+ * U+0026 AMPERSAND (&) Switch to the attribute
+ * value (unquoted) state and reconsume this
+ * input character.
+ */
+ // CPPONLY: attributeLine = line;
+ clearStrBufBeforeUse();
+ reconsume = true;
+ state = transition(state, Tokenizer.ATTRIBUTE_VALUE_UNQUOTED, reconsume, pos);
+ noteUnquotedAttributeValue();
+ continue stateloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Switch to the attribute
+ * value (single-quoted) state.
+ */
+ // CPPONLY: attributeLine = line;
+ clearStrBufBeforeUse();
+ state = transition(state, Tokenizer.ATTRIBUTE_VALUE_SINGLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Parse error.
+ */
+ errAttributeValueMissing();
+ /*
+ * Emit the current tag token.
+ */
+ addAttributeWithoutValue();
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case '<':
+ case '=':
+ case '`':
+ /*
+ * U+003C LESS-THAN SIGN (<) U+003D EQUALS SIGN
+ * (=) U+0060 GRAVE ACCENT (`)
+ */
+ errLtOrEqualsOrGraveInUnquotedAttributeOrNull(c);
+ /*
+ * Treat it as per the "anything else" entry
+ * below.
+ */
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current attribute's value.
+ */
+ // CPPONLY: attributeLine = line;
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ /*
+ * Switch to the attribute value (unquoted)
+ * state.
+ */
+
+ state = transition(state, Tokenizer.ATTRIBUTE_VALUE_UNQUOTED, reconsume, pos);
+ noteUnquotedAttributeValue();
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
+ attributevaluedoublequotedloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Switch to the after
+ * attribute value (quoted) state.
+ */
+ addAttributeWithValue();
+
+ state = transition(state, Tokenizer.AFTER_ATTRIBUTE_VALUE_QUOTED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break attributevaluedoublequotedloop;
+ case '&':
+ /*
+ * U+0026 AMPERSAND (&) Switch to the character
+ * reference in attribute value state, with the
+ * additional allowed character being U+0022
+ * QUOTATION MARK (").
+ */
+ assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
+ appendCharRefBuf(c);
+ setAdditionalAndRememberAmpersandLocation('\"');
+ returnState = state;
+ state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current attribute's value.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the attribute value (double-quoted)
+ * state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_ATTRIBUTE_VALUE_QUOTED:
+ afterattributevaluequotedloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the before attribute name state.
+ */
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Switch to the self-closing
+ * start tag state.
+ */
+ state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break afterattributevaluequotedloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * tag token.
+ */
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ default:
+ /*
+ * Anything else Parse error.
+ */
+ errNoSpaceBetweenAttributes();
+ /*
+ * Reconsume the character in the before
+ * attribute name state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SELF_CLOSING_START_TAG:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Set the self-closing
+ * flag of the current tag token. Emit the current
+ * tag token.
+ */
+ state = transition(state, emitCurrentTagToken(true, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ default:
+ /* Anything else Parse error. */
+ errSlashNotFollowedByGt();
+ /*
+ * Reconsume the character in the before attribute
+ * name state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ }
+ // no fallthrough, reordering opportunity
+ case ATTRIBUTE_VALUE_UNQUOTED:
+ for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ addAttributeWithValue();
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the before attribute name state.
+ */
+ addAttributeWithValue();
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ case '&':
+ /*
+ * U+0026 AMPERSAND (&) Switch to the character
+ * reference in attribute value state, with the
+ * additional allowed character being U+003E
+ * GREATER-THAN SIGN (>)
+ */
+ assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
+ appendCharRefBuf(c);
+ setAdditionalAndRememberAmpersandLocation('>');
+ returnState = state;
+ state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * tag token.
+ */
+ addAttributeWithValue();
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case '<':
+ case '\"':
+ case '\'':
+ case '=':
+ case '`':
+ /*
+ * U+0022 QUOTATION MARK (") U+0027 APOSTROPHE
+ * (') U+003C LESS-THAN SIGN (<) U+003D EQUALS
+ * SIGN (=) U+0060 GRAVE ACCENT (`) Parse error.
+ */
+ errUnquotedAttributeValOrNull(c);
+ /*
+ * Treat it as per the "anything else" entry
+ * below.
+ */
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current attribute's value.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the attribute value (unquoted) state.
+ */
+ continue;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case AFTER_ATTRIBUTE_NAME:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the after attribute name state.
+ */
+ continue;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Switch to the self-closing
+ * start tag state.
+ */
+ addAttributeWithoutValue();
+ state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
+ continue stateloop;
+ case '=':
+ /*
+ * U+003D EQUALS SIGN (=) Switch to the before
+ * attribute value state.
+ */
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_VALUE, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * tag token.
+ */
+ addAttributeWithoutValue();
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ /*
+ * Switch to the data state.
+ */
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case '\"':
+ case '\'':
+ case '<':
+ errQuoteOrLtInAttributeNameOrNull(c);
+ /*
+ * Treat it as per the "anything else" entry
+ * below.
+ */
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ addAttributeWithoutValue();
+ /*
+ * Anything else Start a new attribute in the
+ * current tag token.
+ */
+ if (c >= 'A' && c <= 'Z') {
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Set that
+ * attribute's name to the lowercase version
+ * of the current input character (add
+ * 0x0020 to the character's code point)
+ */
+ c += 0x20;
+ }
+ /*
+ * Set that attribute's name to the current
+ * input character,
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ /*
+ * and its value to the empty string.
+ */
+ // Will do later.
+ /*
+ * Switch to the attribute name state.
+ */
+ state = transition(state, Tokenizer.ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case MARKUP_DECLARATION_OPEN:
+ markupdeclarationopenloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * If the next two characters are both U+002D
+ * HYPHEN-MINUS characters (-), consume those two
+ * characters, create a comment token whose data is the
+ * empty string, and switch to the comment start state.
+ *
+ * Otherwise, if the next seven characters are an ASCII
+ * case-insensitive match for the word "DOCTYPE", then
+ * consume those characters and switch to the DOCTYPE
+ * state.
+ *
+ * Otherwise, if the insertion mode is
+ * "in foreign content" and the current node is not an
+ * element in the HTML namespace and the next seven
+ * characters are an case-sensitive match for the string
+ * "[CDATA[" (the five uppercase letters "CDATA" with a
+ * U+005B LEFT SQUARE BRACKET character before and
+ * after), then consume those characters and switch to
+ * the CDATA section state.
+ *
+ * Otherwise, is is a parse error. Switch to the bogus
+ * comment state. The next character that is consumed,
+ * if any, is the first character that will be in the
+ * comment.
+ */
+ switch (c) {
+ case '-':
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.MARKUP_DECLARATION_HYPHEN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break markupdeclarationopenloop;
+ case 'd':
+ case 'D':
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ index = 0;
+ state = transition(state, Tokenizer.MARKUP_DECLARATION_OCTYPE, reconsume, pos);
+ continue stateloop;
+ case '[':
+ if (tokenHandler.cdataSectionAllowed()) {
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ index = 0;
+ state = transition(state, Tokenizer.CDATA_START, reconsume, pos);
+ continue stateloop;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ errBogusComment();
+ clearStrBufBeforeUse();
+ reconsume = true;
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case MARKUP_DECLARATION_HYPHEN:
+ markupdeclarationhyphenloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '-':
+ clearStrBufAfterOneHyphen();
+ state = transition(state, Tokenizer.COMMENT_START, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break markupdeclarationhyphenloop;
+ default:
+ errBogusComment();
+ reconsume = true;
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_START:
+ reportedConsecutiveHyphens = false;
+ commentstartloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Comment start state
+ *
+ *
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Switch to the comment
+ * start dash state.
+ */
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_START_DASH, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Parse error.
+ */
+ errPrematureEndOfComment();
+ /* Emit the comment token. */
+ emitComment(0, pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break commentstartloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the input character to
+ * the comment token's data.
+ */
+ appendStrBuf(c);
+ /*
+ * Switch to the comment state.
+ */
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break commentstartloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT:
+ commentloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Comment state Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Switch to the comment
+ * end dash state
+ */
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_END_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break commentloop;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the input character to
+ * the comment token's data.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the comment state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_END_DASH:
+ commentenddashloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Comment end dash state Consume the next input
+ * character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Switch to the comment
+ * end state
+ */
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_END, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break commentenddashloop;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append a U+002D HYPHEN-MINUS
+ * (-) character and the input character to the
+ * comment token's data.
+ */
+ appendStrBuf(c);
+ /*
+ * Switch to the comment state.
+ */
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_END:
+ commentendloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Comment end dash state Consume the next input
+ * character:
+ */
+ switch (c) {
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the comment
+ * token.
+ */
+ emitComment(2, pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '-':
+ /* U+002D HYPHEN-MINUS (-) Parse error. */
+ /*
+ * Append a U+002D HYPHEN-MINUS (-) character to
+ * the comment token's data.
+ */
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c, reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ /*
+ * Stay in the comment end state.
+ */
+ continue;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ adjustDoubleHyphenAndAppendToStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ adjustDoubleHyphenAndAppendToStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ case '!':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_END_BANG, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break commentendloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Append two U+002D HYPHEN-MINUS (-) characters
+ * and the input character to the comment
+ * token's data.
+ */
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c, reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ /*
+ * Switch to the comment state.
+ */
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_END_BANG:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Comment end bang state
+ *
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the comment
+ * token.
+ */
+ emitComment(3, pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '-':
+ /*
+ * Append two U+002D HYPHEN-MINUS (-) characters
+ * and a U+0021 EXCLAMATION MARK (!) character
+ * to the comment token's data.
+ */
+ appendStrBuf(c);
+ /*
+ * Switch to the comment end dash state.
+ */
+ state = transition(state, Tokenizer.COMMENT_END_DASH, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append two U+002D HYPHEN-MINUS
+ * (-) characters, a U+0021 EXCLAMATION MARK (!)
+ * character, and the input character to the
+ * comment token's data. Switch to the comment
+ * state.
+ */
+ appendStrBuf(c);
+ /*
+ * Switch to the comment state.
+ */
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case COMMENT_LESSTHAN:
+ commentlessthanloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '!':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN_BANG, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break commentlessthanloop;
+ case '<':
+ appendStrBuf(c);
+ continue;
+ case '-':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_END_DASH, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_LESSTHAN_BANG:
+ commentlessthanbangloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '-':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN_BANG_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break commentlessthanbangloop;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_LESSTHAN_BANG_DASH:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '-':
+ appendStrBuf(c);
+ state = transition(state,
+ Tokenizer.COMMENT_LESSTHAN_BANG_DASH_DASH,
+ reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state,
+ Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT,
+ reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT,
+ reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT,
+ reconsume, pos);
+ continue stateloop;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case COMMENT_LESSTHAN_BANG_DASH_DASH:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '>':
+ appendStrBuf(c);
+ emitComment(3, pos);
+ state = transition(state, Tokenizer.DATA, reconsume,
+ pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '-':
+ errNestedComment();
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c,
+ reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ state = transition(state, Tokenizer.COMMENT_END,
+ reconsume, pos);
+ continue stateloop;
+ case '\r':
+ c = '\n';
+ silentCarriageReturn();
+ errNestedComment();
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c,
+ reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ state = transition(state, Tokenizer.COMMENT,
+ reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ errNestedComment();
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c,
+ reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ state = transition(state, Tokenizer.COMMENT,
+ reconsume, pos);
+ continue stateloop;
+ case '!':
+ errNestedComment();
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c,
+ reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ state = transition(state,
+ Tokenizer.COMMENT_END_BANG, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ errNestedComment();
+ adjustDoubleHyphenAndAppendToStrBufAndErr(c,
+ reportedConsecutiveHyphens);
+ reportedConsecutiveHyphens = true;
+ state = transition(state, Tokenizer.COMMENT,
+ reconsume, pos);
+ continue stateloop;
+ }
+ // no fallthrough, reordering opportunity
+ case COMMENT_START_DASH:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Comment start dash state
+ *
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Switch to the comment end
+ * state
+ */
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_END, reconsume, pos);
+ continue stateloop;
+ case '>':
+ errPrematureEndOfComment();
+ /* Emit the comment token. */
+ emitComment(1, pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '<':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Append a U+002D HYPHEN-MINUS character (-) and
+ * the current input character to the comment
+ * token's data.
+ */
+ appendStrBuf(c);
+ /*
+ * Switch to the comment state.
+ */
+ state = transition(state, Tokenizer.COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ // no fallthrough, reordering opportunity
+ case CDATA_START:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ if (index < 6) { // CDATA_LSQB.length
+ if (c == Tokenizer.CDATA_LSQB[index]) {
+ appendStrBuf(c);
+ } else {
+ errBogusComment();
+ reconsume = true;
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ index++;
+ continue;
+ } else {
+ clearStrBufAfterUse();
+ cstart = pos; // start coalescing
+ reconsume = true;
+ state = transition(state, Tokenizer.CDATA_SECTION, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case CDATA_SECTION:
+ cdatasectionloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ switch (c) {
+ case ']':
+ flushChars(buf, pos);
+ state = transition(state, Tokenizer.CDATA_RSQB, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break cdatasectionloop;
+ case '\u0000':
+ maybeEmitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case CDATA_RSQB:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case ']':
+ state = transition(state, Tokenizer.CDATA_RSQB_RSQB,
+ reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break;
+ default:
+ tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 1);
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, Tokenizer.CDATA_SECTION,
+ reconsume, pos);
+ continue stateloop;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case CDATA_RSQB_RSQB:
+ cdatarsqbrsqb: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case ']':
+ // Saw a third ]. Emit one ] (logically the
+ // first one) and stay in this state to
+ // remember that the last two characters seen
+ // have been ]].
+ tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 1);
+ continue;
+ case '>':
+ cstart = pos + 1;
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ // Since a CDATA section starts with a less-than sign, it
+ // participates in the suspension-after-current-token
+ // behavior. (The suspension can be requested when the
+ // less-than sign has been seen but we don't yet know the
+ // resulting token type.) Therefore, we need to deal with
+ // a potential request here.
+ suspendIfRequestedAfterCurrentNonTextToken();
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 2);
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, Tokenizer.CDATA_SECTION, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case ATTRIBUTE_VALUE_SINGLE_QUOTED:
+ attributevaluesinglequotedloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Switch to the after
+ * attribute value (quoted) state.
+ */
+ addAttributeWithValue();
+
+ state = transition(state, Tokenizer.AFTER_ATTRIBUTE_VALUE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '&':
+ /*
+ * U+0026 AMPERSAND (&) Switch to the character
+ * reference in attribute value state, with the
+ * + additional allowed character being U+0027
+ * APOSTROPHE (').
+ */
+ assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
+ appendCharRefBuf(c);
+ setAdditionalAndRememberAmpersandLocation('\'');
+ returnState = state;
+ state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break attributevaluesinglequotedloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current attribute's value.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the attribute value (double-quoted)
+ * state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case CONSUME_CHARACTER_REFERENCE:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Unlike the definition is the spec, this state does not
+ * return a value and never requires the caller to
+ * backtrack. This state takes care of emitting characters
+ * or appending to the current attribute value. It also
+ * takes care of that in the case when consuming the
+ * character reference fails.
+ */
+ /*
+ * This section defines how to consume a character
+ * reference. This definition is used when parsing character
+ * references in text and in attributes.
+ *
+ * The behavior depends on the identity of the next
+ * character (the one immediately after the U+0026 AMPERSAND
+ * character):
+ */
+ switch (c) {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r': // we'll reconsume!
+ case '\u000C':
+ case '<':
+ case '&':
+ case '\u0000':
+ case ';':
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ case '#':
+ /*
+ * U+0023 NUMBER SIGN (#) Consume the U+0023 NUMBER
+ * SIGN.
+ */
+ appendCharRefBuf('#');
+ state = transition(state, Tokenizer.CONSUME_NCR, reconsume, pos);
+ continue stateloop;
+ default:
+ if (c == additional) {
+ emitOrAppendCharRefBuf(returnState);
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ if (c >= 'a' && c <= 'z') {
+ firstCharKey = c - 'a' + 26;
+ } else if (c >= 'A' && c <= 'Z') {
+ firstCharKey = c - 'A';
+ } else {
+ // No match
+ if (c == ';') {
+ errNoNamedCharacterMatch();
+ }
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ // Didn't fail yet
+ appendCharRefBuf(c);
+ state = transition(state, Tokenizer.CHARACTER_REFERENCE_HILO_LOOKUP, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case CHARACTER_REFERENCE_HILO_LOOKUP:
+ {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * The data structure is as follows:
+ *
+ * HILO_ACCEL is a two-dimensional int array whose major
+ * index corresponds to the second character of the
+ * character reference (code point as index) and the
+ * minor index corresponds to the first character of the
+ * character reference (packed so that A-Z runs from 0
+ * to 25 and a-z runs from 26 to 51). This layout makes
+ * it easier to use the sparseness of the data structure
+ * to omit parts of it: The second dimension of the
+ * table is null when no character reference starts with
+ * the character corresponding to that row.
+ *
+ * The int value HILO_ACCEL (by these indeces) is zero
+ * if there exists no character reference starting with
+ * that two-letter prefix. Otherwise, the value is an
+ * int that packs two shorts so that the higher short is
+ * the index of the highest character reference name
+ * with that prefix in NAMES and the lower short
+ * corresponds to the index of the lowest character
+ * reference name with that prefix. (It happens that the
+ * first two character reference names share their
+ * prefix so the packed int cannot be 0 by packing the
+ * two shorts.)
+ *
+ * NAMES is an array of byte arrays where each byte
+ * array encodes the name of a character references as
+ * ASCII. The names omit the first two letters of the
+ * name. (Since storing the first two letters would be
+ * redundant with the data contained in HILO_ACCEL.) The
+ * entries are lexically sorted.
+ *
+ * For a given index in NAMES, the same index in VALUES
+ * contains the corresponding expansion as an array of
+ * two UTF-16 code units (either the character and
+ * U+0000 or a suggogate pair).
+ */
+ int hilo = 0;
+ if (c <= 'z') {
+ @Const @NoLength int[] row = NamedCharactersAccel.HILO_ACCEL[c];
+ if (row != null) {
+ hilo = row[firstCharKey];
+ }
+ }
+ if (hilo == 0) {
+ if (c == ';') {
+ errNoNamedCharacterMatch();
+ }
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ // Didn't fail yet
+ appendCharRefBuf(c);
+ lo = hilo & 0xFFFF;
+ hi = hilo >> 16;
+ entCol = -1;
+ candidate = -1;
+ charRefBufMark = 0;
+ state = transition(state, Tokenizer.CHARACTER_REFERENCE_TAIL, reconsume, pos);
+ // fallthrough optimizes; `continue stateloop;` would also be valid
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case CHARACTER_REFERENCE_TAIL:
+ outer: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ entCol++;
+ /*
+ * Consume the maximum number of characters possible,
+ * with the consumed characters matching one of the
+ * identifiers in the first column of the named
+ * character references table (in a case-sensitive
+ * manner).
+ */
+ loloop: for (;;) {
+ if (hi < lo) {
+ break outer;
+ }
+ if (entCol == NamedCharacters.NAMES[lo].length()) {
+ candidate = lo;
+ charRefBufMark = charRefBufLen;
+ lo++;
+ } else if (entCol > NamedCharacters.NAMES[lo].length()) {
+ break outer;
+ } else if (c > NamedCharacters.NAMES[lo].charAt(entCol)) {
+ lo++;
+ } else {
+ break loloop;
+ }
+ }
+
+ hiloop: for (;;) {
+ if (hi < lo) {
+ break outer;
+ }
+ if (entCol == NamedCharacters.NAMES[hi].length()) {
+ break hiloop;
+ }
+ if (entCol > NamedCharacters.NAMES[hi].length()) {
+ break outer;
+ } else if (c < NamedCharacters.NAMES[hi].charAt(entCol)) {
+ hi--;
+ } else {
+ break hiloop;
+ }
+ }
+
+ if (c == ';') {
+ // If we see a semicolon, there cannot be a
+ // longer match. Break the loop. However, before
+ // breaking, take the longest match so far as the
+ // candidate, if we are just about to complete a
+ // match.
+ if (entCol + 1 == NamedCharacters.NAMES[lo].length()) {
+ candidate = lo;
+ charRefBufMark = charRefBufLen;
+ }
+ break outer;
+ }
+
+ if (hi < lo) {
+ break outer;
+ }
+ appendCharRefBuf(c);
+ continue;
+ }
+
+ if (candidate == -1) {
+ // reconsume deals with CR, LF or nul
+ if (c == ';') {
+ errNoNamedCharacterMatch();
+ }
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ } else {
+ // c can't be CR, LF or nul if we got here
+ @Const @CharacterName String candidateName = NamedCharacters.NAMES[candidate];
+ if (candidateName.length() == 0
+ || candidateName.charAt(candidateName.length() - 1) != ';') {
+ /*
+ * If the last character matched is not a U+003B
+ * SEMICOLON (;), there is a parse error.
+ */
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ /*
+ * If the entity is being consumed as part of an
+ * attribute, and the last character matched is
+ * not a U+003B SEMICOLON (;),
+ */
+ char ch;
+ if (charRefBufMark == charRefBufLen) {
+ ch = c;
+ } else {
+ ch = charRefBuf[charRefBufMark];
+ }
+ if (ch == '=' || (ch >= '0' && ch <= '9')
+ || (ch >= 'A' && ch <= 'Z')
+ || (ch >= 'a' && ch <= 'z')) {
+ /*
+ * and the next character is either a U+003D
+ * EQUALS SIGN character (=) or in the range
+ * U+0030 DIGIT ZERO to U+0039 DIGIT NINE,
+ * U+0041 LATIN CAPITAL LETTER A to U+005A
+ * LATIN CAPITAL LETTER Z, or U+0061 LATIN
+ * SMALL LETTER A to U+007A LATIN SMALL
+ * LETTER Z, then, for historical reasons,
+ * all the characters that were matched
+ * after the U+0026 AMPERSAND (&) must be
+ * unconsumed, and nothing is returned.
+ */
+ if (c == ';') {
+ errNoNamedCharacterMatch();
+ }
+ appendCharRefBufToStrBuf();
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ errUnescapedAmpersandInterpretedAsCharacterReference();
+ } else {
+ errNotSemicolonTerminated();
+ }
+ }
+
+ /*
+ * Otherwise, return a character token for the character
+ * corresponding to the entity name (as given by the
+ * second column of the named character references
+ * table).
+ */
+ // CPPONLY: completedNamedCharacterReference();
+ @Const @NoLength char[] val = NamedCharacters.VALUES[candidate];
+ if (
+ // [NOCPP[
+ val.length == 1
+ // ]NOCPP]
+ // CPPONLY: val[1] == 0
+ ) {
+ emitOrAppendOne(val, returnState);
+ } else {
+ emitOrAppendTwo(val, returnState);
+ }
+ // this is so complicated!
+ if (charRefBufMark < charRefBufLen) {
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ appendStrBuf(charRefBuf, charRefBufMark,
+ charRefBufLen - charRefBufMark);
+ } else {
+ tokenHandler.characters(charRefBuf, charRefBufMark,
+ charRefBufLen - charRefBufMark);
+ }
+ }
+ // charRefBufLen will be zeroed below!
+
+ // Check if we broke out early with c being the last
+ // character that matched as opposed to being the
+ // first one that didn't match. In the case of an
+ // early break, the next run on text should start
+ // *after* the current character and the current
+ // character shouldn't be reconsumed.
+ boolean earlyBreak = (c == ';' && charRefBufMark == charRefBufLen);
+ charRefBufLen = 0;
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = earlyBreak ? pos + 1 : pos;
+ }
+ reconsume = !earlyBreak;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ /*
+ * If the markup contains I'm &notit; I tell you, the
+ * entity is parsed as "not", as in, I'm ¬it; I tell
+ * you. But if the markup was I'm &notin; I tell you,
+ * the entity would be parsed as "notin;", resulting in
+ * I'm ∉ I tell you.
+ */
+ }
+ // no fallthrough, reordering opportunity
+ case CONSUME_NCR:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ value = 0;
+ seenDigits = false;
+ /*
+ * The behavior further depends on the character after the
+ * U+0023 NUMBER SIGN:
+ */
+ switch (c) {
+ case 'x':
+ case 'X':
+
+ /*
+ * U+0078 LATIN SMALL LETTER X U+0058 LATIN CAPITAL
+ * LETTER X Consume the X.
+ *
+ * Follow the steps below, but using the range of
+ * characters U+0030 DIGIT ZERO through to U+0039
+ * DIGIT NINE, U+0061 LATIN SMALL LETTER A through
+ * to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN
+ * CAPITAL LETTER A, through to U+0046 LATIN CAPITAL
+ * LETTER F (in other words, 0-9, A-F, a-f).
+ *
+ * When it comes to interpreting the number,
+ * interpret it as a hexadecimal number.
+ */
+ appendCharRefBuf(c);
+ state = transition(state, Tokenizer.HEX_NCR_LOOP, reconsume, pos);
+ continue stateloop;
+ default:
+ /*
+ * Anything else Follow the steps below, but using
+ * the range of characters U+0030 DIGIT ZERO through
+ * to U+0039 DIGIT NINE (i.e. just 0-9).
+ *
+ * When it comes to interpreting the number,
+ * interpret it as a decimal number.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.DECIMAL_NRC_LOOP, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DECIMAL_NRC_LOOP:
+ decimalloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume as many characters as match the range of
+ * characters given above.
+ */
+ assert value >= 0: "value must not become negative.";
+ if (c >= '0' && c <= '9') {
+ seenDigits = true;
+ // Avoid overflow
+ if (value <= 0x10FFFF) {
+ value *= 10;
+ value += c - '0';
+ }
+ continue;
+ } else if (c == ';') {
+ if (seenDigits) {
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos + 1;
+ }
+ state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break decimalloop;
+ } else {
+ errNoDigitsInNCR();
+ appendCharRefBuf(';');
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos + 1;
+ }
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ } else {
+ /*
+ * If no characters match the range, then don't
+ * consume any characters (and unconsume the U+0023
+ * NUMBER SIGN character and, if appropriate, the X
+ * character). This is a parse error; nothing is
+ * returned.
+ *
+ * Otherwise, if the next character is a U+003B
+ * SEMICOLON, consume that too. If it isn't, there
+ * is a parse error.
+ */
+ if (!seenDigits) {
+ errNoDigitsInNCR();
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ } else {
+ errCharRefLacksSemicolon();
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break decimalloop;
+ }
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case HANDLE_NCR_VALUE:
+ // WARNING previous state sets reconsume
+ // We are not going to emit the contents of charRefBuf.
+ charRefBufLen = 0;
+ // XXX inline this case if the method size can take it
+ handleNcrValue(returnState);
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ // no fallthrough, reordering opportunity
+ case HEX_NCR_LOOP:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume as many characters as match the range of
+ * characters given above.
+ */
+ assert value >= 0: "value must not become negative.";
+ if (c >= '0' && c <= '9') {
+ seenDigits = true;
+ // Avoid overflow
+ if (value <= 0x10FFFF) {
+ value *= 16;
+ value += c - '0';
+ }
+ continue;
+ } else if (c >= 'A' && c <= 'F') {
+ seenDigits = true;
+ // Avoid overflow
+ if (value <= 0x10FFFF) {
+ value *= 16;
+ value += c - 'A' + 10;
+ }
+ continue;
+ } else if (c >= 'a' && c <= 'f') {
+ seenDigits = true;
+ // Avoid overflow
+ if (value <= 0x10FFFF) {
+ value *= 16;
+ value += c - 'a' + 10;
+ }
+ continue;
+ } else if (c == ';') {
+ if (seenDigits) {
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos + 1;
+ }
+ state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
+ continue stateloop;
+ } else {
+ errNoDigitsInNCR();
+ appendCharRefBuf(';');
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos + 1;
+ }
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ } else {
+ /*
+ * If no characters match the range, then don't
+ * consume any characters (and unconsume the U+0023
+ * NUMBER SIGN character and, if appropriate, the X
+ * character). This is a parse error; nothing is
+ * returned.
+ *
+ * Otherwise, if the next character is a U+003B
+ * SEMICOLON, consume that too. If it isn't, there
+ * is a parse error.
+ */
+ if (!seenDigits) {
+ errNoDigitsInNCR();
+ emitOrAppendCharRefBuf(returnState);
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ } else {
+ errCharRefLacksSemicolon();
+ if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
+ cstart = pos;
+ }
+ reconsume = true;
+ state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case PLAINTEXT:
+ plaintextloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ switch (c) {
+ case '\u0000':
+ emitPlaintextReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Stay in the
+ * RAWTEXT state.
+ */
+ continue;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case CLOSE_TAG_OPEN:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Otherwise, if the content model flag is set to the PCDATA
+ * state, or if the next few characters do match that tag
+ * name, consume the next input character:
+ */
+ switch (c) {
+ case '>':
+ /* U+003E GREATER-THAN SIGN (>) Parse error. */
+ errLtSlashGt();
+ /*
+ * Switch to the data state.
+ */
+ cstart = pos + 1;
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ silentCarriageReturn();
+ /* Anything else Parse error. */
+ errGarbageAfterLtSlash();
+ /*
+ * Switch to the bogus comment state.
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf('\n');
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ /* Anything else Parse error. */
+ errGarbageAfterLtSlash();
+ /*
+ * Switch to the bogus comment state.
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ if (c >= 'A' && c <= 'Z') {
+ c += 0x20;
+ }
+ if (c >= 'a' && c <= 'z') {
+ /*
+ * U+0061 LATIN SMALL LETTER A through to U+007A
+ * LATIN SMALL LETTER Z Create a new end tag
+ * token,
+ */
+ endTag = true;
+ /*
+ * set its tag name to the input character,
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ containsHyphen = false;
+ /*
+ * then switch to the tag name state. (Don't
+ * emit the token yet; further details will be
+ * filled in before it is emitted.)
+ */
+ state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
+ continue stateloop;
+ } else {
+ /* Anything else Parse error. */
+ errGarbageAfterLtSlash();
+ /*
+ * Switch to the bogus comment state.
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case RCDATA:
+ rcdataloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ switch (c) {
+ case '&':
+ /*
+ * U+0026 AMPERSAND (&) Switch to the character
+ * reference in RCDATA state.
+ */
+ flushChars(buf, pos);
+ assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
+ appendCharRefBuf(c);
+ setAdditionalAndRememberAmpersandLocation('\u0000');
+ returnState = state;
+ state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
+ continue stateloop;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the
+ * RCDATA less-than sign state.
+ */
+ flushChars(buf, pos);
+
+ returnState = state;
+ state = transition(state, Tokenizer.RAWTEXT_RCDATA_LESS_THAN_SIGN, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Emit the current input character as a
+ * character token. Stay in the RCDATA state.
+ */
+ continue;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case RAWTEXT:
+ rawtextloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ switch (c) {
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the
+ * RAWTEXT less-than sign state.
+ */
+ flushChars(buf, pos);
+
+ returnState = state;
+ state = transition(state, Tokenizer.RAWTEXT_RCDATA_LESS_THAN_SIGN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break rawtextloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Emit the current input character as a
+ * character token. Stay in the RAWTEXT state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case RAWTEXT_RCDATA_LESS_THAN_SIGN:
+ rawtextrcdatalessthansignloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Set the temporary buffer
+ * to the empty string. Switch to the script
+ * data end tag open state.
+ */
+ index = 0;
+ clearStrBufBeforeUse();
+ state = transition(state, Tokenizer.NON_DATA_END_TAG_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break rawtextrcdatalessthansignloop;
+ default:
+ /*
+ * Otherwise, emit a U+003C LESS-THAN SIGN
+ * character token
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ /*
+ * and reconsume the current input character in
+ * the data state.
+ */
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case NON_DATA_END_TAG_NAME:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * ASSERT! when entering this state, set index to 0 and
+ * call clearStrBufBeforeUse(); Let's implement the above
+ * without lookahead. strBuf is the 'temporary buffer'.
+ */
+ if (endTagExpectationAsArray == null) {
+ tokenHandler.characters(Tokenizer.LT_SOLIDUS,
+ 0, 2);
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ } else if (index < endTagExpectationAsArray.length) {
+ char e = endTagExpectationAsArray[index];
+ char folded = c;
+ if (c >= 'A' && c <= 'Z') {
+ folded += 0x20;
+ }
+ if (folded != e) {
+ // [NOCPP[
+ errHtml4LtSlashInRcdata(folded);
+ // ]NOCPP]
+ tokenHandler.characters(Tokenizer.LT_SOLIDUS,
+ 0, 2);
+ emitStrBuf();
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ appendStrBuf(c);
+ index++;
+ continue;
+ } else {
+ endTag = true;
+ // XXX replace contentModelElement with different
+ // type
+ tagName = endTagExpectation;
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ clearStrBufAfterUse(); // strBuf not used
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE
+ * FEED (LF) U+000C FORM FEED (FF) U+0020
+ * SPACE If the current end tag token is an
+ * appropriate end tag token, then switch to
+ * the before attribute name state.
+ */
+ clearStrBufAfterUse(); // strBuf not used
+ state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
+ continue stateloop;
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) If the current end tag
+ * token is an appropriate end tag token,
+ * then switch to the self-closing start tag
+ * state.
+ */
+ clearStrBufAfterUse(); // strBuf not used
+ state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) If the
+ * current end tag token is an appropriate
+ * end tag token, then emit the current tag
+ * token and switch to the data state.
+ */
+ clearStrBufAfterUse(); // strBuf not used
+ state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ /*
+ * Emit a U+003C LESS-THAN SIGN character
+ * token, a U+002F SOLIDUS character token,
+ * a character token for each of the
+ * characters in the temporary buffer (in
+ * the order they were added to the buffer),
+ * and reconsume the current input character
+ * in the RAWTEXT state.
+ */
+ // [NOCPP[
+ errWarnLtSlashInRcdata();
+ // ]NOCPP]
+ tokenHandler.characters(
+ Tokenizer.LT_SOLIDUS, 0, 2);
+ emitStrBuf();
+ cstart = pos; // don't drop the
+ // character
+ reconsume = true;
+ state = transition(state, returnState, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ }
+ // no fallthrough, reordering opportunity
+ // BEGIN HOTSPOT WORKAROUND
+ case BOGUS_COMMENT:
+ boguscommentloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume every character up to and including the first
+ * U+003E GREATER-THAN SIGN character (>) or the end of
+ * the file (EOF), whichever comes first. Emit a comment
+ * token whose data is the concatenation of all the
+ * characters starting from and including the character
+ * that caused the state machine to switch into the
+ * bogus comment state, up to and including the
+ * character immediately before the last consumed
+ * character (i.e. up to the character just before the
+ * U+003E or EOF character). (If the comment was started
+ * by the end of the file (EOF), the token is empty.)
+ *
+ * Switch to the data state.
+ *
+ * If the end of the file was reached, reconsume the EOF
+ * character.
+ */
+ switch (c) {
+ case '>':
+ emitComment(0, pos);
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '-':
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.BOGUS_COMMENT_HYPHEN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break boguscommentloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ appendStrBuf(c);
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BOGUS_COMMENT_HYPHEN:
+ boguscommenthyphenloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '>':
+ // [NOCPP[
+ maybeAppendSpaceToBogusComment();
+ // ]NOCPP]
+ emitComment(0, pos);
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '-':
+ appendSecondHyphenToBogusComment();
+ continue boguscommenthyphenloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ appendStrBuf(c);
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case SCRIPT_DATA:
+ scriptdataloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ switch (c) {
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the
+ * script data less-than sign state.
+ */
+ flushChars(buf, pos);
+ returnState = state;
+ state = transition(state, Tokenizer.SCRIPT_DATA_LESS_THAN_SIGN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Stay in the
+ * script data state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_LESS_THAN_SIGN:
+ scriptdatalessthansignloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Set the temporary buffer
+ * to the empty string. Switch to the script
+ * data end tag open state.
+ */
+ index = 0;
+ clearStrBufBeforeUse();
+ state = transition(state, Tokenizer.NON_DATA_END_TAG_NAME, reconsume, pos);
+ continue stateloop;
+ case '!':
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ cstart = pos;
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPE_START, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdatalessthansignloop;
+ default:
+ /*
+ * Otherwise, emit a U+003C LESS-THAN SIGN
+ * character token
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ /*
+ * and reconsume the current input character in
+ * the data state.
+ */
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_ESCAPE_START:
+ scriptdataescapestartloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Switch to the
+ * script data escape start dash state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPE_START_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataescapestartloop;
+ default:
+ /*
+ * Anything else Reconsume the current input
+ * character in the script data state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_ESCAPE_START_DASH:
+ scriptdataescapestartdashloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Switch to the
+ * script data escaped dash dash state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_DASH_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataescapestartdashloop;
+ default:
+ /*
+ * Anything else Reconsume the current input
+ * character in the script data state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_ESCAPED_DASH_DASH:
+ scriptdataescapeddashdashloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Stay in the
+ * script data escaped dash dash state.
+ */
+ continue;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the
+ * script data escaped less-than sign state.
+ */
+ flushChars(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit a U+003E
+ * GREATER-THAN SIGN character token. Switch to
+ * the script data state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ break scriptdataescapeddashdashloop;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Switch to the
+ * script data escaped state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataescapeddashdashloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_ESCAPED:
+ scriptdataescapedloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Switch to the
+ * script data escaped dash state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataescapedloop;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the
+ * script data escaped less-than sign state.
+ */
+ flushChars(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Stay in the
+ * script data escaped state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_ESCAPED_DASH:
+ scriptdataescapeddashloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Switch to the
+ * script data escaped dash dash state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_DASH_DASH, reconsume, pos);
+ continue stateloop;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Switch to the
+ * script data escaped less-than sign state.
+ */
+ flushChars(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataescapeddashloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Switch to the
+ * script data escaped state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:
+ scriptdataescapedlessthanloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Set the temporary buffer
+ * to the empty string. Switch to the script
+ * data escaped end tag open state.
+ */
+ index = 0;
+ clearStrBufBeforeUse();
+ returnState = Tokenizer.SCRIPT_DATA_ESCAPED;
+ state = transition(state, Tokenizer.NON_DATA_END_TAG_NAME, reconsume, pos);
+ continue stateloop;
+ case 'S':
+ case 's':
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Emit a U+003C
+ * LESS-THAN SIGN character token and the
+ * current input character as a character token.
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ cstart = pos;
+ index = 1;
+ /*
+ * Set the temporary buffer to the empty string.
+ * Append the lowercase version of the current
+ * input character (add 0x0020 to the
+ * character's code point) to the temporary
+ * buffer. Switch to the script data double
+ * escape start state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPE_START, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdataescapedlessthanloop;
+ default:
+ /*
+ * Anything else Emit a U+003C LESS-THAN SIGN
+ * character token and reconsume the current
+ * input character in the script data escaped
+ * state.
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ cstart = pos;
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_DOUBLE_ESCAPE_START:
+ scriptdatadoubleescapestartloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ assert index > 0;
+ if (index < 6) { // SCRIPT_ARR.length
+ char folded = c;
+ if (c >= 'A' && c <= 'Z') {
+ folded += 0x20;
+ }
+ if (folded != Tokenizer.SCRIPT_ARR[index]) {
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ index++;
+ continue;
+ }
+ switch (c) {
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ case '/':
+ case '>':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * U+002F SOLIDUS (/) U+003E GREATER-THAN SIGN
+ * (>) Emit the current input character as a
+ * character token. If the temporary buffer is
+ * the string "script", then switch to the
+ * script data double escaped state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdatadoubleescapestartloop;
+ default:
+ /*
+ * Anything else Reconsume the current input
+ * character in the script data escaped state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_DOUBLE_ESCAPED:
+ scriptdatadoubleescapedloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Switch to the
+ * script data double escaped dash state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdatadoubleescapedloop;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Emit a U+003C
+ * LESS-THAN SIGN character token. Switch to the
+ * script data double escaped less-than sign
+ * state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ continue;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Stay in the
+ * script data double escaped state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
+ scriptdatadoubleescapeddashloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Switch to the
+ * script data double escaped dash dash state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdatadoubleescapeddashloop;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Emit a U+003C
+ * LESS-THAN SIGN character token. Switch to the
+ * script data double escaped less-than sign
+ * state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Switch to the
+ * script data double escaped state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
+ scriptdatadoubleescapeddashdashloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '-':
+ /*
+ * U+002D HYPHEN-MINUS (-) Emit a U+002D
+ * HYPHEN-MINUS character token. Stay in the
+ * script data double escaped dash dash state.
+ */
+ continue;
+ case '<':
+ /*
+ * U+003C LESS-THAN SIGN (<) Emit a U+003C
+ * LESS-THAN SIGN character token. Switch to the
+ * script data double escaped less-than sign
+ * state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdatadoubleescapeddashdashloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit a U+003E
+ * GREATER-THAN SIGN character token. Switch to
+ * the script data state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
+ continue stateloop;
+ case '\u0000':
+ emitReplacementCharacter(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Emit the current input
+ * character as a character token. Switch to the
+ * script data double escaped state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
+ scriptdatadoubleescapedlessthanloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '/':
+ /*
+ * U+002F SOLIDUS (/) Emit a U+002F SOLIDUS
+ * character token. Set the temporary buffer to
+ * the empty string. Switch to the script data
+ * double escape end state.
+ */
+ index = 0;
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPE_END, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break scriptdatadoubleescapedlessthanloop;
+ default:
+ /*
+ * Anything else Reconsume the current input
+ * character in the script data double escaped
+ * state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case SCRIPT_DATA_DOUBLE_ESCAPE_END:
+ scriptdatadoubleescapeendloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ if (index < 6) { // SCRIPT_ARR.length
+ char folded = c;
+ if (c >= 'A' && c <= 'Z') {
+ folded += 0x20;
+ }
+ if (folded != Tokenizer.SCRIPT_ARR[index]) {
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ index++;
+ continue;
+ }
+ switch (c) {
+ case '\r':
+ emitCarriageReturn(buf, pos);
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ case '/':
+ case '>':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * U+002F SOLIDUS (/) U+003E GREATER-THAN SIGN
+ * (>) Emit the current input character as a
+ * character token. If the temporary buffer is
+ * the string "script", then switch to the
+ * script data escaped state.
+ */
+ state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
+ continue stateloop;
+ default:
+ /*
+ * Reconsume the current input character in the
+ * script data double escaped state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case MARKUP_DECLARATION_OCTYPE:
+ markupdeclarationdoctypeloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ if (index < 6) { // OCTYPE.length
+ char folded = c;
+ if (c >= 'A' && c <= 'Z') {
+ folded += 0x20;
+ }
+ if (folded == Tokenizer.OCTYPE[index]) {
+ appendStrBuf(c);
+ } else {
+ errBogusComment();
+ reconsume = true;
+ state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
+ continue stateloop;
+ }
+ index++;
+ continue;
+ } else {
+ reconsume = true;
+ state = transition(state, Tokenizer.DOCTYPE, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break markupdeclarationdoctypeloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DOCTYPE:
+ doctypeloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ initDoctypeFields();
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the before DOCTYPE name state.
+ */
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypeloop;
+ default:
+ /*
+ * Anything else Parse error.
+ */
+ errMissingSpaceBeforeDoctypeName();
+ /*
+ * Reconsume the current character in the before
+ * DOCTYPE name state.
+ */
+ reconsume = true;
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypeloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BEFORE_DOCTYPE_NAME:
+ beforedoctypenameloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the before DOCTYPE name state.
+ */
+ continue;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Parse error.
+ */
+ errNamelessDoctype();
+ /*
+ * Create a new DOCTYPE token. Set its
+ * force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit the token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ if (c >= 'A' && c <= 'Z') {
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Create a
+ * new DOCTYPE token. Set the token's name
+ * to the lowercase version of the input
+ * character (add 0x0020 to the character's
+ * code point).
+ */
+ c += 0x20;
+ }
+ /* Anything else Create a new DOCTYPE token. */
+ /*
+ * Set the token's name name to the current
+ * input character.
+ */
+ clearStrBufBeforeUse();
+ appendStrBuf(c);
+ /*
+ * Switch to the DOCTYPE name state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break beforedoctypenameloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DOCTYPE_NAME:
+ doctypenameloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ strBufToDoctypeName();
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_NAME, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the after DOCTYPE name state.
+ */
+ strBufToDoctypeName();
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_NAME, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypenameloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * DOCTYPE token.
+ */
+ strBufToDoctypeName();
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * U+0041 LATIN CAPITAL LETTER A through to
+ * U+005A LATIN CAPITAL LETTER Z Append the
+ * lowercase version of the input character (add
+ * 0x0020 to the character's code point) to the
+ * current DOCTYPE token's name.
+ */
+ if (c >= 'A' && c <= 'Z') {
+ c += 0x0020;
+ }
+ /*
+ * Anything else Append the current input
+ * character to the current DOCTYPE token's
+ * name.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the DOCTYPE name state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_DOCTYPE_NAME:
+ afterdoctypenameloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the after DOCTYPE name state.
+ */
+ continue;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case 'p':
+ case 'P':
+ index = 0;
+ state = transition(state, Tokenizer.DOCTYPE_UBLIC, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break afterdoctypenameloop;
+ case 's':
+ case 'S':
+ index = 0;
+ state = transition(state, Tokenizer.DOCTYPE_YSTEM, reconsume, pos);
+ continue stateloop;
+ default:
+ /*
+ * Otherwise, this is the parse error.
+ */
+ bogusDoctype();
+
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DOCTYPE_UBLIC:
+ doctypeublicloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * If the six characters starting from the current input
+ * character are an ASCII case-insensitive match for the
+ * word "PUBLIC", then consume those characters and
+ * switch to the before DOCTYPE public identifier state.
+ */
+ if (index < 5) { // UBLIC.length
+ char folded = c;
+ if (c >= 'A' && c <= 'Z') {
+ folded += 0x20;
+ }
+ if (folded != Tokenizer.UBLIC[index]) {
+ bogusDoctype();
+ // forceQuirks = true;
+ reconsume = true;
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ index++;
+ continue;
+ } else {
+ reconsume = true;
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_PUBLIC_KEYWORD, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypeublicloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_DOCTYPE_PUBLIC_KEYWORD:
+ afterdoctypepublickeywordloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the before DOCTYPE public
+ * identifier state.
+ */
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break afterdoctypepublickeywordloop;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Parse Error.
+ */
+ errNoSpaceBetweenDoctypePublicKeywordAndQuote();
+ /*
+ * Set the DOCTYPE token's public identifier to
+ * the empty string (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE public identifier
+ * (double-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Parse Error.
+ */
+ errNoSpaceBetweenDoctypePublicKeywordAndQuote();
+ /*
+ * Set the DOCTYPE token's public identifier to
+ * the empty string (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE public identifier
+ * (single-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /* U+003E GREATER-THAN SIGN (>) Parse error. */
+ errExpectedPublicId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ bogusDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:
+ beforedoctypepublicidentifierloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the before DOCTYPE public identifier
+ * state.
+ */
+ continue;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Set the DOCTYPE
+ * token's public identifier to the empty string
+ * (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE public identifier
+ * (double-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break beforedoctypepublicidentifierloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Set the DOCTYPE token's
+ * public identifier to the empty string (not
+ * missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE public identifier
+ * (single-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /* U+003E GREATER-THAN SIGN (>) Parse error. */
+ errExpectedPublicId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ bogusDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:
+ doctypepublicidentifierdoublequotedloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Switch to the after
+ * DOCTYPE public identifier state.
+ */
+ publicIdentifier = strBufToString();
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypepublicidentifierdoublequotedloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Parse error.
+ */
+ errGtInPublicId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ publicIdentifier = strBufToString();
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current DOCTYPE token's
+ * public identifier.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the DOCTYPE public identifier
+ * (double-quoted) state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_DOCTYPE_PUBLIC_IDENTIFIER:
+ afterdoctypepublicidentifierloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ state = transition(state, Tokenizer.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the between DOCTYPE public and
+ * system identifiers state.
+ */
+ state = transition(state, Tokenizer.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break afterdoctypepublicidentifierloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Parse error.
+ */
+ errNoSpaceBetweenPublicAndSystemIds();
+ /*
+ * Set the DOCTYPE token's system identifier to
+ * the empty string (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE system identifier
+ * (double-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Parse error.
+ */
+ errNoSpaceBetweenPublicAndSystemIds();
+ /*
+ * Set the DOCTYPE token's system identifier to
+ * the empty string (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE system identifier
+ * (single-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ default:
+ bogusDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:
+ betweendoctypepublicandsystemidentifiersloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the between DOCTYPE public and system
+ * identifiers state.
+ */
+ continue;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Set the DOCTYPE
+ * token's system identifier to the empty string
+ * (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE system identifier
+ * (double-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break betweendoctypepublicandsystemidentifiersloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Set the DOCTYPE token's
+ * system identifier to the empty string (not
+ * missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE system identifier
+ * (single-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ default:
+ bogusDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:
+ doctypesystemidentifierdoublequotedloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Switch to the after
+ * DOCTYPE system identifier state.
+ */
+ systemIdentifier = strBufToString();
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypesystemidentifierdoublequotedloop;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Parse error.
+ */
+ errGtInSystemId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ systemIdentifier = strBufToString();
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current DOCTYPE token's
+ * system identifier.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the DOCTYPE system identifier
+ * (double-quoted) state.
+ */
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_DOCTYPE_SYSTEM_IDENTIFIER:
+ afterdoctypesystemidentifierloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the after DOCTYPE system identifier state.
+ */
+ continue;
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit the current
+ * DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ /*
+ * Switch to the bogus DOCTYPE state. (This does
+ * not set the DOCTYPE token's force-quirks flag
+ * to on.)
+ */
+ bogusDoctypeWithoutQuirks();
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break afterdoctypesystemidentifierloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BOGUS_DOCTYPE:
+ for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '>':
+ /*
+ * U+003E GREATER-THAN SIGN (>) Emit that
+ * DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Stay in the bogus DOCTYPE
+ * state.
+ */
+ continue;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case DOCTYPE_YSTEM:
+ doctypeystemloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Otherwise, if the six characters starting from the
+ * current input character are an ASCII case-insensitive
+ * match for the word "SYSTEM", then consume those
+ * characters and switch to the before DOCTYPE system
+ * identifier state.
+ */
+ if (index < 5) { // YSTEM.length
+ char folded = c;
+ if (c >= 'A' && c <= 'Z') {
+ folded += 0x20;
+ }
+ if (folded != Tokenizer.YSTEM[index]) {
+ bogusDoctype();
+ reconsume = true;
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ index++;
+ continue stateloop;
+ } else {
+ reconsume = true;
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_SYSTEM_KEYWORD, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break doctypeystemloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_DOCTYPE_SYSTEM_KEYWORD:
+ afterdoctypesystemkeywordloop: for (;;) {
+ if (reconsume) {
+ reconsume = false;
+ } else {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ }
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE
+ * Switch to the before DOCTYPE public
+ * identifier state.
+ */
+ state = transition(state, Tokenizer.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break afterdoctypesystemkeywordloop;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Parse Error.
+ */
+ errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
+ /*
+ * Set the DOCTYPE token's system identifier to
+ * the empty string (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE public identifier
+ * (double-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Parse Error.
+ */
+ errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
+ /*
+ * Set the DOCTYPE token's public identifier to
+ * the empty string (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE public identifier
+ * (single-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '>':
+ /* U+003E GREATER-THAN SIGN (>) Parse error. */
+ errExpectedPublicId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ bogusDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:
+ beforedoctypesystemidentifierloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\r':
+ silentCarriageReturn();
+ break stateloop;
+ case '\n':
+ silentLineFeed();
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case ' ':
+ case '\t':
+ case '\u000C':
+ /*
+ * U+0009 CHARACTER TABULATION U+000A LINE FEED
+ * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
+ * in the before DOCTYPE system identifier
+ * state.
+ */
+ continue;
+ case '"':
+ /*
+ * U+0022 QUOTATION MARK (") Set the DOCTYPE
+ * token's system identifier to the empty string
+ * (not missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE system identifier
+ * (double-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
+ continue stateloop;
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Set the DOCTYPE token's
+ * system identifier to the empty string (not
+ * missing),
+ */
+ clearStrBufBeforeUse();
+ /*
+ * then switch to the DOCTYPE system identifier
+ * (single-quoted) state.
+ */
+ state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break beforedoctypesystemidentifierloop;
+ case '>':
+ /* U+003E GREATER-THAN SIGN (>) Parse error. */
+ errExpectedSystemId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ bogusDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ // done by bogusDoctype();
+ /*
+ * Switch to the bogus DOCTYPE state.
+ */
+ state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
+ continue stateloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Switch to the after
+ * DOCTYPE system identifier state.
+ */
+ systemIdentifier = strBufToString();
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
+ continue stateloop;
+ case '>':
+ errGtInSystemId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ systemIdentifier = strBufToString();
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current DOCTYPE token's
+ * system identifier.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the DOCTYPE system identifier
+ * (double-quoted) state.
+ */
+ continue;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:
+ for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ /*
+ * Consume the next input character:
+ */
+ switch (c) {
+ case '\'':
+ /*
+ * U+0027 APOSTROPHE (') Switch to the after
+ * DOCTYPE public identifier state.
+ */
+ publicIdentifier = strBufToString();
+ state = transition(state, Tokenizer.AFTER_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
+ continue stateloop;
+ case '>':
+ errGtInPublicId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ publicIdentifier = strBufToString();
+ emitDoctypeToken(pos);
+ /*
+ * Switch to the data state.
+ */
+ state = transition(state, Tokenizer.DATA, reconsume, pos);
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ case '\r':
+ appendStrBufCarriageReturn();
+ break stateloop;
+ case '\n':
+ appendStrBufLineFeed();
+ continue;
+ case '\u0000':
+ c = '\uFFFD';
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ /*
+ * Anything else Append the current input
+ * character to the current DOCTYPE token's
+ * public identifier.
+ */
+ appendStrBuf(c);
+ /*
+ * Stay in the DOCTYPE public identifier
+ * (single-quoted) state.
+ */
+ continue;
+ }
+ }
+ // no fallthrough, reordering opportunity
+ case PROCESSING_INSTRUCTION:
+ processinginstructionloop: for (;;) {
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '?':
+ state = transition(
+ state,
+ Tokenizer.PROCESSING_INSTRUCTION_QUESTION_MARK,
+ reconsume, pos);
+ // `break` optimizes; `continue stateloop;` would be valid
+ break processinginstructionloop;
+ default:
+ continue;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case PROCESSING_INSTRUCTION_QUESTION_MARK:
+ if (++pos == endPos) {
+ break stateloop;
+ }
+ c = checkChar(buf, pos);
+ switch (c) {
+ case '>':
+ state = transition(state, Tokenizer.DATA,
+ reconsume, pos);
+ // Processing instruction syntax goes through these
+ // states only in Gecko's XML View Source--not in HTML
+ // parsing in Java or in Gecko.
+ // Since XML View Source doesn't use the
+ // suspension-after-current-token facility, its extension
+ // to processing-instruction states is strictly unnecessary
+ // at the moment. However, if these states ever were to be
+ // used together with the suspension-after-current-token
+ // facility, these states would need to participate, since
+ // suspension could be requested when only less-than has been
+ // seen and we don't yet know if we end up here. Handling
+ // the currently-unnecessary case in order to avoid leaving
+ // a trap for future modification.
+ suspendIfRequestedAfterCurrentNonTextToken();
+ if (shouldSuspend) {
+ break stateloop;
+ }
+ continue stateloop;
+ default:
+ state = transition(state,
+ Tokenizer.PROCESSING_INSTRUCTION,
+ reconsume, pos);
+ continue stateloop;
+ }
+ // END HOTSPOT WORKAROUND
+ }
+ }
+ flushChars(buf, pos);
+ /*
+ * if (prevCR && pos != endPos) { // why is this needed? pos--; col--; }
+ */
+ // Save locals
+ stateSave = state;
+ returnStateSave = returnState;
+ return pos;
+ }
+
+ // HOTSPOT WORKAROUND INSERTION POINT
+
+ // [NOCPP[
+
+ protected int transition(int from, int to, boolean reconsume, int pos) throws SAXException {
+ return to;
+ }
+
+ // ]NOCPP]
+
+ private void initDoctypeFields() {
+ // Discard the characters "DOCTYPE" accumulated as a potential bogus
+ // comment into strBuf.
+ clearStrBufAfterUse();
+ doctypeName = null;
+ if (systemIdentifier != null) {
+ Portability.releaseString(systemIdentifier);
+ systemIdentifier = null;
+ }
+ if (publicIdentifier != null) {
+ Portability.releaseString(publicIdentifier);
+ publicIdentifier = null;
+ }
+ forceQuirks = false;
+ }
+
+ @Inline private void adjustDoubleHyphenAndAppendToStrBufCarriageReturn()
+ throws SAXException {
+ silentCarriageReturn();
+ adjustDoubleHyphenAndAppendToStrBufAndErr('\n', false);
+ }
+
+ @Inline private void adjustDoubleHyphenAndAppendToStrBufLineFeed()
+ throws SAXException {
+ silentLineFeed();
+ adjustDoubleHyphenAndAppendToStrBufAndErr('\n', false);
+ }
+
+ @Inline private void appendStrBufLineFeed() {
+ silentLineFeed();
+ appendStrBuf('\n');
+ }
+
+ @Inline private void appendStrBufCarriageReturn() {
+ silentCarriageReturn();
+ appendStrBuf('\n');
+ }
+
+ // [NOCPP[
+
+ @Inline protected void silentCarriageReturn() {
+ ++line;
+ lastCR = true;
+ }
+
+ @Inline protected void silentLineFeed() {
+ ++line;
+ }
+
+ // ]NOCPP]
+
+ private void emitCarriageReturn(@NoLength char[] buf, int pos)
+ throws SAXException {
+ silentCarriageReturn();
+ flushChars(buf, pos);
+ tokenHandler.characters(Tokenizer.LF, 0, 1);
+ cstart = Integer.MAX_VALUE;
+ }
+
+ private void emitReplacementCharacter(@NoLength char[] buf, int pos)
+ throws SAXException {
+ flushChars(buf, pos);
+ tokenHandler.zeroOriginatingReplacementCharacter();
+ cstart = pos + 1;
+ }
+
+ private void maybeEmitReplacementCharacter(@NoLength char[] buf, int pos)
+ throws SAXException {
+ flushChars(buf, pos);
+ tokenHandler.zeroOrReplacementCharacter();
+ cstart = pos + 1;
+ }
+
+ private void emitPlaintextReplacementCharacter(@NoLength char[] buf, int pos)
+ throws SAXException {
+ flushChars(buf, pos);
+ tokenHandler.characters(REPLACEMENT_CHARACTER, 0, 1);
+ cstart = pos + 1;
+ }
+
+ private void setAdditionalAndRememberAmpersandLocation(char add) {
+ additional = add;
+ // [NOCPP[
+ ampersandLocation = new LocatorImpl(this);
+ // ]NOCPP]
+ }
+
+ private void bogusDoctype() throws SAXException {
+ errBogusDoctype();
+ forceQuirks = true;
+ }
+
+ private void bogusDoctypeWithoutQuirks() throws SAXException {
+ errBogusDoctype();
+ forceQuirks = false;
+ }
+
+ private void handleNcrValue(int returnState) throws SAXException {
+ /*
+ * If one or more characters match the range, then take them all and
+ * interpret the string of characters as a number (either hexadecimal or
+ * decimal as appropriate).
+ */
+ if (value <= 0xFFFF) {
+ if (value >= 0x80 && value <= 0x9f) {
+ /*
+ * If that number is one of the numbers in the first column of
+ * the following table, then this is a parse error.
+ */
+ errNcrInC1Range();
+ /*
+ * Find the row with that number in the first column, and return
+ * a character token for the Unicode character given in the
+ * second column of that row.
+ */
+ @NoLength char[] val = NamedCharacters.WINDOWS_1252[value - 0x80];
+ emitOrAppendOne(val, returnState);
+ // [NOCPP[
+ } else if (value == 0xC
+ && contentSpacePolicy != XmlViolationPolicy.ALLOW) {
+ if (contentSpacePolicy == XmlViolationPolicy.ALTER_INFOSET) {
+ emitOrAppendOne(Tokenizer.SPACE, returnState);
+ } else if (contentSpacePolicy == XmlViolationPolicy.FATAL) {
+ fatal("A character reference expanded to a form feed which is not legal XML 1.0 white space.");
+ }
+ // ]NOCPP]
+ } else if (value == 0x0) {
+ errNcrZero();
+ emitOrAppendOne(Tokenizer.REPLACEMENT_CHARACTER, returnState);
+ } else if ((value & 0xF800) == 0xD800) {
+ errNcrSurrogate();
+ emitOrAppendOne(Tokenizer.REPLACEMENT_CHARACTER, returnState);
+ } else {
+ /*
+ * Otherwise, return a character token for the Unicode character
+ * whose code point is that number.
+ */
+ char ch = (char) value;
+ // [NOCPP[
+ if (value == 0x0D) {
+ errNcrCr();
+ } else if ((value <= 0x0008) || (value == 0x000B)
+ || (value >= 0x000E && value <= 0x001F)) {
+ ch = errNcrControlChar(ch);
+ } else if (value >= 0xFDD0 && value <= 0xFDEF) {
+ errNcrUnassigned();
+ } else if ((value & 0xFFFE) == 0xFFFE) {
+ ch = errNcrNonCharacter(ch);
+ } else if (value >= 0x007F && value <= 0x009F) {
+ errNcrControlChar();
+ } else {
+ maybeWarnPrivateUse(ch);
+ }
+ // ]NOCPP]
+ bmpChar[0] = ch;
+ emitOrAppendOne(bmpChar, returnState);
+ }
+ } else if (value <= 0x10FFFF) {
+ // [NOCPP[
+ maybeWarnPrivateUseAstral();
+ if ((value & 0xFFFE) == 0xFFFE) {
+ errAstralNonCharacter(value);
+ }
+ // ]NOCPP]
+ astralChar[0] = (char) (Tokenizer.LEAD_OFFSET + (value >> 10));
+ astralChar[1] = (char) (0xDC00 + (value & 0x3FF));
+ emitOrAppendTwo(astralChar, returnState);
+ } else {
+ errNcrOutOfRange();
+ emitOrAppendOne(Tokenizer.REPLACEMENT_CHARACTER, returnState);
+ }
+ }
+
+ public void eof() throws SAXException {
+ int state = stateSave;
+ int returnState = returnStateSave;
+
+ eofloop: for (;;) {
+ switch (state) {
+ case SCRIPT_DATA_LESS_THAN_SIGN:
+ case SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:
+ /*
+ * Otherwise, emit a U+003C LESS-THAN SIGN character token
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ /*
+ * and reconsume the current input character in the data
+ * state.
+ */
+ break eofloop;
+ case TAG_OPEN:
+ /*
+ * The behavior of this state depends on the content model
+ * flag.
+ */
+ /*
+ * Anything else Parse error.
+ */
+ errEofAfterLt();
+ /*
+ * Emit a U+003C LESS-THAN SIGN character token
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ /*
+ * and reconsume the current input character in the data
+ * state.
+ */
+ break eofloop;
+ case RAWTEXT_RCDATA_LESS_THAN_SIGN:
+ /*
+ * Emit a U+003C LESS-THAN SIGN character token
+ */
+ tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
+ /*
+ * and reconsume the current input character in the RCDATA
+ * state.
+ */
+ break eofloop;
+ case NON_DATA_END_TAG_NAME:
+ /*
+ * Emit a U+003C LESS-THAN SIGN character token, a U+002F
+ * SOLIDUS character token,
+ */
+ tokenHandler.characters(Tokenizer.LT_SOLIDUS, 0, 2);
+ /*
+ * a character token for each of the characters in the
+ * temporary buffer (in the order they were added to the
+ * buffer),
+ */
+ emitStrBuf();
+ /*
+ * and reconsume the current input character in the RCDATA
+ * state.
+ */
+ break eofloop;
+ case CLOSE_TAG_OPEN:
+ /* EOF Parse error. */
+ errEofAfterLt();
+ /*
+ * Emit a U+003C LESS-THAN SIGN character token and a U+002F
+ * SOLIDUS character token.
+ */
+ tokenHandler.characters(Tokenizer.LT_SOLIDUS, 0, 2);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case TAG_NAME:
+ /*
+ * EOF Parse error.
+ */
+ errEofInTagName();
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case BEFORE_ATTRIBUTE_NAME:
+ case AFTER_ATTRIBUTE_VALUE_QUOTED:
+ case SELF_CLOSING_START_TAG:
+ /* EOF Parse error. */
+ errEofWithoutGt();
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case ATTRIBUTE_NAME:
+ /*
+ * EOF Parse error.
+ */
+ errEofInAttributeName();
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case AFTER_ATTRIBUTE_NAME:
+ case BEFORE_ATTRIBUTE_VALUE:
+ /* EOF Parse error. */
+ errEofWithoutGt();
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
+ case ATTRIBUTE_VALUE_SINGLE_QUOTED:
+ case ATTRIBUTE_VALUE_UNQUOTED:
+ /* EOF Parse error. */
+ errEofInAttributeValue();
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case BOGUS_COMMENT:
+ emitComment(0, 0);
+ break eofloop;
+ case BOGUS_COMMENT_HYPHEN:
+ // [NOCPP[
+ maybeAppendSpaceToBogusComment();
+ // ]NOCPP]
+ emitComment(0, 0);
+ break eofloop;
+ case MARKUP_DECLARATION_OPEN:
+ errBogusComment();
+ emitComment(0, 0);
+ break eofloop;
+ case MARKUP_DECLARATION_HYPHEN:
+ errBogusComment();
+ emitComment(0, 0);
+ break eofloop;
+ case MARKUP_DECLARATION_OCTYPE:
+ if (index < 6) {
+ errBogusComment();
+ emitComment(0, 0);
+ } else {
+ /* EOF Parse error. */
+ errEofInDoctype();
+ /*
+ * Create a new DOCTYPE token. Set its force-quirks flag
+ * to on.
+ */
+ doctypeName = null;
+ if (systemIdentifier != null) {
+ Portability.releaseString(systemIdentifier);
+ systemIdentifier = null;
+ }
+ if (publicIdentifier != null) {
+ Portability.releaseString(publicIdentifier);
+ publicIdentifier = null;
+ }
+ forceQuirks = true;
+ /*
+ * Emit the token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ }
+ break eofloop;
+ case COMMENT_START:
+ case COMMENT:
+ case COMMENT_LESSTHAN:
+ case COMMENT_LESSTHAN_BANG:
+ /*
+ * EOF Parse error.
+ */
+ errEofInComment();
+ /* Emit the comment token. */
+ emitComment(0, 0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case COMMENT_END:
+ case COMMENT_LESSTHAN_BANG_DASH_DASH:
+ errEofInComment();
+ /* Emit the comment token. */
+ emitComment(2, 0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case COMMENT_END_DASH:
+ case COMMENT_START_DASH:
+ case COMMENT_LESSTHAN_BANG_DASH:
+ errEofInComment();
+ /* Emit the comment token. */
+ emitComment(1, 0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case COMMENT_END_BANG:
+ errEofInComment();
+ /* Emit the comment token. */
+ emitComment(3, 0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case DOCTYPE:
+ case BEFORE_DOCTYPE_NAME:
+ errEofInDoctype();
+ /*
+ * Create a new DOCTYPE token. Set its force-quirks flag to
+ * on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit the token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case DOCTYPE_NAME:
+ errEofInDoctype();
+ strBufToDoctypeName();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case DOCTYPE_UBLIC:
+ case DOCTYPE_YSTEM:
+ case AFTER_DOCTYPE_NAME:
+ case AFTER_DOCTYPE_PUBLIC_KEYWORD:
+ case AFTER_DOCTYPE_SYSTEM_KEYWORD:
+ case BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:
+ errEofInDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:
+ case DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:
+ /* EOF Parse error. */
+ errEofInPublicId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ publicIdentifier = strBufToString();
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case AFTER_DOCTYPE_PUBLIC_IDENTIFIER:
+ case BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:
+ case BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:
+ errEofInDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:
+ case DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:
+ /* EOF Parse error. */
+ errEofInSystemId();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ systemIdentifier = strBufToString();
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case AFTER_DOCTYPE_SYSTEM_IDENTIFIER:
+ errEofInDoctype();
+ /*
+ * Set the DOCTYPE token's force-quirks flag to on.
+ */
+ forceQuirks = true;
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case BOGUS_DOCTYPE:
+ /*
+ * Emit that DOCTYPE token.
+ */
+ emitDoctypeToken(0);
+ /*
+ * Reconsume the EOF character in the data state.
+ */
+ break eofloop;
+ case CONSUME_CHARACTER_REFERENCE:
+ /*
+ * Unlike the definition is the spec, this state does not
+ * return a value and never requires the caller to
+ * backtrack. This state takes care of emitting characters
+ * or appending to the current attribute value. It also
+ * takes care of that in the case when consuming the entity
+ * fails.
+ */
+ /*
+ * This section defines how to consume an entity. This
+ * definition is used when parsing entities in text and in
+ * attributes.
+ *
+ * The behavior depends on the identity of the next
+ * character (the one immediately after the U+0026 AMPERSAND
+ * character):
+ */
+
+ emitOrAppendCharRefBuf(returnState);
+ state = returnState;
+ continue;
+ case CHARACTER_REFERENCE_HILO_LOOKUP:
+ emitOrAppendCharRefBuf(returnState);
+ state = returnState;
+ continue;
+ case CHARACTER_REFERENCE_TAIL:
+ outer: for (;;) {
+ char c = '\u0000';
+ entCol++;
+ /*
+ * Consume the maximum number of characters possible,
+ * with the consumed characters matching one of the
+ * identifiers in the first column of the named
+ * character references table (in a case-sensitive
+ * manner).
+ */
+ hiloop: for (;;) {
+ if (hi == -1) {
+ break hiloop;
+ }
+ if (entCol == NamedCharacters.NAMES[hi].length()) {
+ break hiloop;
+ }
+ if (entCol > NamedCharacters.NAMES[hi].length()) {
+ break outer;
+ } else if (c < NamedCharacters.NAMES[hi].charAt(entCol)) {
+ hi--;
+ } else {
+ break hiloop;
+ }
+ }
+
+ loloop: for (;;) {
+ if (hi < lo) {
+ break outer;
+ }
+ if (entCol == NamedCharacters.NAMES[lo].length()) {
+ candidate = lo;
+ charRefBufMark = charRefBufLen;
+ lo++;
+ } else if (entCol > NamedCharacters.NAMES[lo].length()) {
+ break outer;
+ } else if (c > NamedCharacters.NAMES[lo].charAt(entCol)) {
+ lo++;
+ } else {
+ break loloop;
+ }
+ }
+ if (hi < lo) {
+ break outer;
+ }
+ continue;
+ }
+
+ if (candidate == -1) {
+ emitOrAppendCharRefBuf(returnState);
+ state = returnState;
+ continue eofloop;
+ } else {
+ @Const @CharacterName String candidateName = NamedCharacters.NAMES[candidate];
+ if (candidateName.length() == 0
+ || candidateName.charAt(candidateName.length() - 1) != ';') {
+ /*
+ * If the last character matched is not a U+003B
+ * SEMICOLON (;), there is a parse error.
+ */
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ /*
+ * If the entity is being consumed as part of an
+ * attribute, and the last character matched is
+ * not a U+003B SEMICOLON (;),
+ */
+ char ch;
+ if (charRefBufMark == charRefBufLen) {
+ ch = '\u0000';
+ } else {
+ ch = charRefBuf[charRefBufMark];
+ }
+ if ((ch >= '0' && ch <= '9')
+ || (ch >= 'A' && ch <= 'Z')
+ || (ch >= 'a' && ch <= 'z')) {
+ /*
+ * and the next character is in the range
+ * U+0030 DIGIT ZERO to U+0039 DIGIT NINE,
+ * U+0041 LATIN CAPITAL LETTER A to U+005A
+ * LATIN CAPITAL LETTER Z, or U+0061 LATIN
+ * SMALL LETTER A to U+007A LATIN SMALL
+ * LETTER Z, then, for historical reasons,
+ * all the characters that were matched
+ * after the U+0026 AMPERSAND (&) must be
+ * unconsumed, and nothing is returned.
+ */
+ appendCharRefBufToStrBuf();
+ state = returnState;
+ continue eofloop;
+ }
+ }
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ errUnescapedAmpersandInterpretedAsCharacterReference();
+ } else {
+ errNotSemicolonTerminated();
+ }
+ }
+
+ /*
+ * Otherwise, return a character token for the character
+ * corresponding to the entity name (as given by the
+ * second column of the named character references
+ * table).
+ */
+ @Const @NoLength char[] val = NamedCharacters.VALUES[candidate];
+ if (
+ // [NOCPP[
+ val.length == 1
+ // ]NOCPP]
+ // CPPONLY: val[1] == 0
+ ) {
+ emitOrAppendOne(val, returnState);
+ } else {
+ emitOrAppendTwo(val, returnState);
+ }
+ // this is so complicated!
+ if (charRefBufMark < charRefBufLen) {
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ appendStrBuf(charRefBuf, charRefBufMark,
+ charRefBufLen - charRefBufMark);
+ } else {
+ tokenHandler.characters(charRefBuf, charRefBufMark,
+ charRefBufLen - charRefBufMark);
+ }
+ }
+ charRefBufLen = 0;
+ state = returnState;
+ continue eofloop;
+ /*
+ * If the markup contains I'm &notit; I tell you, the
+ * entity is parsed as "not", as in, I'm ¬it; I tell
+ * you. But if the markup was I'm &notin; I tell you,
+ * the entity would be parsed as "notin;", resulting in
+ * I'm ∉ I tell you.
+ */
+ }
+ case CONSUME_NCR:
+ case DECIMAL_NRC_LOOP:
+ case HEX_NCR_LOOP:
+ /*
+ * If no characters match the range, then don't consume any
+ * characters (and unconsume the U+0023 NUMBER SIGN
+ * character and, if appropriate, the X character). This is
+ * a parse error; nothing is returned.
+ *
+ * Otherwise, if the next character is a U+003B SEMICOLON,
+ * consume that too. If it isn't, there is a parse error.
+ */
+ if (!seenDigits) {
+ errNoDigitsInNCR();
+ emitOrAppendCharRefBuf(returnState);
+ state = returnState;
+ continue;
+ } else {
+ errCharRefLacksSemicolon();
+ }
+ // WARNING previous state sets reconsume
+ handleNcrValue(returnState);
+ state = returnState;
+ continue;
+ case CDATA_RSQB:
+ tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 1);
+ break eofloop;
+ case CDATA_RSQB_RSQB:
+ tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 2);
+ break eofloop;
+ case DATA:
+ default:
+ break eofloop;
+ }
+ }
+ // case DATA:
+ /*
+ * EOF Emit an end-of-file token.
+ */
+ tokenHandler.eof();
+ return;
+ }
+
+ /**
+ * Emits a doctype token.
+ *
+ * NOTE: The method may set <code>shouldSuspend</code>, so the caller
+ * must have this pattern after the state's <code>transition</code> call:
+ * <pre>
+ * if (shouldSuspend) {
+ * break stateloop;
+ * }
+ * continue stateloop;
+ * </pre>
+ *
+ * @param pos
+ * @throws SAXException
+ */
+ private void emitDoctypeToken(int pos) throws SAXException {
+ // CPPONLY: RememberGt(pos);
+ cstart = pos + 1;
+ tokenHandler.doctype(doctypeName, publicIdentifier, systemIdentifier,
+ forceQuirks);
+ // It is OK and sufficient to release these here, since
+ // there's no way out of the doctype states than through paths
+ // that call this method.
+ doctypeName = null;
+ Portability.releaseString(publicIdentifier);
+ publicIdentifier = null;
+ Portability.releaseString(systemIdentifier);
+ systemIdentifier = null;
+ suspendIfRequestedAfterCurrentNonTextToken();
+ }
+
+ /**
+ * If a previous call to <code>suspendAfterCurrentTokenIfNotInText()</code>
+ * happened in a non-text context, this method turns that deferred suspension
+ * request into an immediately-pending suspension request.
+ */
+ private void suspendIfRequestedAfterCurrentNonTextToken() {
+ if (suspendAfterCurrentNonTextToken) {
+ suspendAfterCurrentNonTextToken = false;
+ shouldSuspend = true;
+ }
+ }
+
+ // Making this private until the full Java implementation is done.
+ /**
+ * Request suspension after the current token if the tokenizer is currently
+ * in a non-text state (i.e. it's known that the next token will be a
+ * non-text token).
+ *
+ * Must not be called when <code>tokenizeBuffer()</code> is on the call
+ * stack.
+ */
+ @SuppressWarnings("unused") private void suspendAfterCurrentTokenIfNotInText() {
+ switch (stateSave) {
+ case DATA:
+ case RCDATA:
+ case SCRIPT_DATA:
+ case RAWTEXT:
+ case SCRIPT_DATA_ESCAPED:
+ case PLAINTEXT:
+ case NON_DATA_END_TAG_NAME: // We haven't yet committed to the next
+ // token being a non-text token, though
+ // it could be.
+ case SCRIPT_DATA_LESS_THAN_SIGN:
+ case SCRIPT_DATA_ESCAPE_START:
+ case SCRIPT_DATA_ESCAPE_START_DASH:
+ case SCRIPT_DATA_ESCAPED_DASH:
+ case SCRIPT_DATA_ESCAPED_DASH_DASH:
+ case RAWTEXT_RCDATA_LESS_THAN_SIGN:
+ case SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:
+ case SCRIPT_DATA_DOUBLE_ESCAPE_START:
+ case SCRIPT_DATA_DOUBLE_ESCAPED:
+ case SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
+ case SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
+ case SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
+ case SCRIPT_DATA_DOUBLE_ESCAPE_END:
+ return;
+ case TAG_NAME:
+ case BEFORE_ATTRIBUTE_NAME:
+ case ATTRIBUTE_NAME:
+ case AFTER_ATTRIBUTE_NAME:
+ case BEFORE_ATTRIBUTE_VALUE:
+ case AFTER_ATTRIBUTE_VALUE_QUOTED:
+ case BOGUS_COMMENT:
+ case MARKUP_DECLARATION_OPEN:
+ case DOCTYPE:
+ case BEFORE_DOCTYPE_NAME:
+ case DOCTYPE_NAME:
+ case AFTER_DOCTYPE_NAME:
+ case BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:
+ case DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:
+ case DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:
+ case AFTER_DOCTYPE_PUBLIC_IDENTIFIER:
+ case BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:
+ case DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:
+ case DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:
+ case AFTER_DOCTYPE_SYSTEM_IDENTIFIER:
+ case BOGUS_DOCTYPE:
+ case COMMENT_START:
+ case COMMENT_START_DASH:
+ case COMMENT:
+ case COMMENT_END_DASH:
+ case COMMENT_END:
+ case COMMENT_END_BANG:
+ case TAG_OPEN:
+ case CLOSE_TAG_OPEN:
+ case MARKUP_DECLARATION_HYPHEN:
+ case MARKUP_DECLARATION_OCTYPE:
+ case DOCTYPE_UBLIC:
+ case DOCTYPE_YSTEM:
+ case AFTER_DOCTYPE_PUBLIC_KEYWORD:
+ case BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:
+ case AFTER_DOCTYPE_SYSTEM_KEYWORD:
+ case SELF_CLOSING_START_TAG:
+ case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
+ case ATTRIBUTE_VALUE_SINGLE_QUOTED:
+ case ATTRIBUTE_VALUE_UNQUOTED:
+ case BOGUS_COMMENT_HYPHEN:
+ case COMMENT_LESSTHAN:
+ case COMMENT_LESSTHAN_BANG:
+ case COMMENT_LESSTHAN_BANG_DASH:
+ case COMMENT_LESSTHAN_BANG_DASH_DASH:
+ case CDATA_START:
+ case CDATA_SECTION:
+ case CDATA_RSQB:
+ case CDATA_RSQB_RSQB:
+ case PROCESSING_INSTRUCTION:
+ case PROCESSING_INSTRUCTION_QUESTION_MARK:
+ break;
+ case CONSUME_CHARACTER_REFERENCE:
+ case CONSUME_NCR:
+ case CHARACTER_REFERENCE_TAIL:
+ case HEX_NCR_LOOP:
+ case DECIMAL_NRC_LOOP:
+ case HANDLE_NCR_VALUE:
+ case HANDLE_NCR_VALUE_RECONSUME:
+ case CHARACTER_REFERENCE_HILO_LOOKUP:
+ if (returnStateSave == DATA || returnStateSave == RCDATA) {
+ return;
+ }
+ break;
+ default:
+ assert false : "Incomplete switch";
+ return;
+ }
+ suspendAfterCurrentNonTextToken = true;
+ }
+
+ // Making this private until the full Java implementation is done.
+ /**
+ * Queries if we are about to suspend after the current non-text token due to a request
+ * from <code>suspendAfterCurrentTokenIfNotInText()</code>.
+ * @return <code>true</code> iff <code>suspendAfterCurrentTokenIfNotInText()</code> was
+ * called in a non-text position and the then-current token has not been emitted yet.
+ */
+ @SuppressWarnings("unused") private boolean suspensionAfterCurrentNonTextTokenPending() {
+ return suspendAfterCurrentNonTextToken;
+ }
+
+ // [NOCPP[
+
+ @Inline protected char checkChar(@NoLength char[] buf, int pos)
+ throws SAXException {
+ return buf[pos];
+ }
+
+ // ]NOCPP]
+
+ public boolean internalEncodingDeclaration(String internalCharset)
+ throws SAXException {
+ if (encodingDeclarationHandler != null) {
+ return encodingDeclarationHandler.internalEncodingDeclaration(internalCharset);
+ }
+ return false;
+ }
+
+ /**
+ * @param val
+ * @throws SAXException
+ */
+ private void emitOrAppendTwo(@Const @NoLength char[] val, int returnState)
+ throws SAXException {
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ appendStrBuf(val[0]);
+ appendStrBuf(val[1]);
+ } else {
+ tokenHandler.characters(val, 0, 2);
+ }
+ }
+
+ private void emitOrAppendOne(@Const @NoLength char[] val, int returnState)
+ throws SAXException {
+ if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
+ appendStrBuf(val[0]);
+ } else {
+ tokenHandler.characters(val, 0, 1);
+ }
+ }
+
+ public void end() throws SAXException {
+ strBuf = null;
+ doctypeName = null;
+ if (systemIdentifier != null) {
+ Portability.releaseString(systemIdentifier);
+ systemIdentifier = null;
+ }
+ if (publicIdentifier != null) {
+ Portability.releaseString(publicIdentifier);
+ publicIdentifier = null;
+ }
+ tagName = null;
+ nonInternedTagName.setNameForNonInterned(null
+ // CPPONLY: , false
+ );
+ attributeName = null;
+ // CPPONLY: nonInternedAttributeName.setNameForNonInterned(null);
+ tokenHandler.endTokenization();
+ if (attributes != null) {
+ // [NOCPP[
+ attributes = null;
+ // ]NOCPP]
+ // CPPONLY: attributes.clear(mappingLangToXmlLang);
+ }
+ }
+
+ public void requestSuspension() {
+ shouldSuspend = true;
+ }
+
+ // [NOCPP[
+
+ public void becomeConfident() {
+ confident = true;
+ }
+
+ /**
+ * Returns the nextCharOnNewLine.
+ *
+ * @return the nextCharOnNewLine
+ */
+ public boolean isNextCharOnNewLine() {
+ return false;
+ }
+
+ public boolean isPrevCR() {
+ return lastCR;
+ }
+
+ /**
+ * Returns the line.
+ *
+ * @return the line
+ */
+ public int getLine() {
+ return -1;
+ }
+
+ /**
+ * Returns the col.
+ *
+ * @return the col
+ */
+ public int getCol() {
+ return -1;
+ }
+
+ // ]NOCPP]
+
+ public boolean isInDataState() {
+ return (stateSave == DATA);
+ }
+
+ public void resetToDataState() {
+ clearStrBufAfterUse();
+ charRefBufLen = 0;
+ stateSave = Tokenizer.DATA;
+ // line = 1; XXX line numbers
+ lastCR = false;
+ index = 0;
+ forceQuirks = false;
+ additional = '\u0000';
+ entCol = -1;
+ firstCharKey = -1;
+ lo = 0;
+ hi = 0; // will always be overwritten before use anyway
+ candidate = -1;
+ charRefBufMark = 0;
+ value = 0;
+ seenDigits = false;
+ suspendAfterCurrentNonTextToken = false;
+ endTag = false;
+ shouldSuspend = false;
+ initDoctypeFields();
+ containsHyphen = false;
+ tagName = null;
+ attributeName = null;
+ if (newAttributesEachTime) {
+ if (attributes != null) {
+ Portability.delete(attributes);
+ attributes = null;
+ }
+ }
+ }
+
+ public void loadState(Tokenizer other) throws SAXException {
+ strBufLen = other.strBufLen;
+ if (strBufLen > strBuf.length) {
+ strBuf = new char[strBufLen];
+ }
+ System.arraycopy(other.strBuf, 0, strBuf, 0, strBufLen);
+
+ charRefBufLen = other.charRefBufLen;
+ System.arraycopy(other.charRefBuf, 0, charRefBuf, 0, charRefBufLen);
+
+ stateSave = other.stateSave;
+ returnStateSave = other.returnStateSave;
+ endTagExpectation = other.endTagExpectation;
+ endTagExpectationAsArray = other.endTagExpectationAsArray;
+ // line = 1; XXX line numbers
+ lastCR = other.lastCR;
+ index = other.index;
+ forceQuirks = other.forceQuirks;
+ additional = other.additional;
+ entCol = other.entCol;
+ firstCharKey = other.firstCharKey;
+ lo = other.lo;
+ hi = other.hi;
+ candidate = other.candidate;
+ charRefBufMark = other.charRefBufMark;
+ value = other.value;
+ seenDigits = other.seenDigits;
+ endTag = other.endTag;
+ shouldSuspend = false;
+ suspendAfterCurrentNonTextToken = false;
+ doctypeName = other.doctypeName;
+
+ Portability.releaseString(systemIdentifier);
+ if (other.systemIdentifier == null) {
+ systemIdentifier = null;
+ } else {
+ systemIdentifier = Portability.newStringFromString(other.systemIdentifier);
+ }
+
+ Portability.releaseString(publicIdentifier);
+ if (other.publicIdentifier == null) {
+ publicIdentifier = null;
+ } else {
+ publicIdentifier = Portability.newStringFromString(other.publicIdentifier);
+ }
+
+ containsHyphen = other.containsHyphen;
+ if (other.tagName == null) {
+ tagName = null;
+ } else if (other.tagName.isInterned()) {
+ tagName = other.tagName;
+ } else {
+ // In the C++ case, the atoms in the other tokenizer are from a
+ // different tokenizer-scoped atom table. Therefore, we have to
+ // obtain the correspoding atom from our own atom table.
+ nonInternedTagName.setNameForNonInterned(other.tagName.getName()
+ // CPPONLY: , other.tagName.isCustom()
+ );
+ tagName = nonInternedTagName;
+ }
+
+ // [NOCPP[
+ attributeName = other.attributeName;
+ // ]NOCPP]
+ // CPPONLY: if (other.attributeName == null) {
+ // CPPONLY: attributeName = null;
+ // CPPONLY: } else if (other.attributeName.isInterned()) {
+ // CPPONLY: attributeName = other.attributeName;
+ // CPPONLY: } else {
+ // CPPONLY: // In the C++ case, the atoms in the other tokenizer are from a
+ // CPPONLY: // different tokenizer-scoped atom table. Therefore, we have to
+ // CPPONLY: // obtain the correspoding atom from our own atom table.
+ // CPPONLY: nonInternedAttributeName.setNameForNonInterned(other.attributeName.getLocal(AttributeName.HTML));
+ // CPPONLY: attributeName = nonInternedAttributeName;
+ // CPPONLY: }
+
+ Portability.delete(attributes);
+ if (other.attributes == null) {
+ attributes = null;
+ } else {
+ attributes = other.attributes.cloneAttributes();
+ }
+ }
+
+ public void initializeWithoutStarting() throws SAXException {
+ confident = false;
+ strBuf = null;
+ line = 1;
+ // CPPONLY: attributeLine = 1;
+ // [NOCPP[
+ metaBoundaryPassed = false;
+ wantsComments = tokenHandler.wantsComments();
+ if (!newAttributesEachTime) {
+ attributes = new HtmlAttributes(mappingLangToXmlLang);
+ }
+ // ]NOCPP]
+ resetToDataState();
+ }
+
+ protected void errGarbageAfterLtSlash() throws SAXException {
+ }
+
+ protected void errLtSlashGt() throws SAXException {
+ }
+
+ protected void errWarnLtSlashInRcdata() throws SAXException {
+ }
+
+ protected void errHtml4LtSlashInRcdata(char folded) throws SAXException {
+ }
+
+ protected void errCharRefLacksSemicolon() throws SAXException {
+ }
+
+ protected void errNoDigitsInNCR() throws SAXException {
+ }
+
+ protected void errGtInSystemId() throws SAXException {
+ }
+
+ protected void errGtInPublicId() throws SAXException {
+ }
+
+ protected void errNamelessDoctype() throws SAXException {
+ }
+
+ protected void errNestedComment() throws SAXException {
+ }
+
+ protected void errPrematureEndOfComment() throws SAXException {
+ }
+
+ protected void errBogusComment() throws SAXException {
+ }
+
+ protected void errUnquotedAttributeValOrNull(char c) throws SAXException {
+ }
+
+ protected void errSlashNotFollowedByGt() throws SAXException {
+ }
+
+ protected void errNoSpaceBetweenAttributes() throws SAXException {
+ }
+
+ protected void errLtOrEqualsOrGraveInUnquotedAttributeOrNull(char c)
+ throws SAXException {
+ }
+
+ protected void errAttributeValueMissing() throws SAXException {
+ }
+
+ protected void errBadCharBeforeAttributeNameOrNull(char c)
+ throws SAXException {
+ }
+
+ protected void errEqualsSignBeforeAttributeName() throws SAXException {
+ }
+
+ protected void errBadCharAfterLt(char c) throws SAXException {
+ }
+
+ protected void errLtGt() throws SAXException {
+ }
+
+ protected void errProcessingInstruction() throws SAXException {
+ }
+
+ protected void errUnescapedAmpersandInterpretedAsCharacterReference()
+ throws SAXException {
+ }
+
+ protected void errNotSemicolonTerminated() throws SAXException {
+ }
+
+ protected void errNoNamedCharacterMatch() throws SAXException {
+ }
+
+ protected void errQuoteBeforeAttributeName(char c) throws SAXException {
+ }
+
+ protected void errQuoteOrLtInAttributeNameOrNull(char c)
+ throws SAXException {
+ }
+
+ protected void errExpectedPublicId() throws SAXException {
+ }
+
+ protected void errBogusDoctype() throws SAXException {
+ }
+
+ protected void maybeWarnPrivateUseAstral() throws SAXException {
+ }
+
+ protected void maybeWarnPrivateUse(char ch) throws SAXException {
+ }
+
+ protected void maybeErrAttributesOnEndTag(HtmlAttributes attrs)
+ throws SAXException {
+ }
+
+ protected void maybeErrSlashInEndTag(boolean selfClosing)
+ throws SAXException {
+ }
+
+ protected char errNcrNonCharacter(char ch) throws SAXException {
+ return ch;
+ }
+
+ protected void errAstralNonCharacter(int ch) throws SAXException {
+ }
+
+ protected void errNcrSurrogate() throws SAXException {
+ }
+
+ protected char errNcrControlChar(char ch) throws SAXException {
+ return ch;
+ }
+
+ protected void errNcrCr() throws SAXException {
+ }
+
+ protected void errNcrInC1Range() throws SAXException {
+ }
+
+ protected void errEofInPublicId() throws SAXException {
+ }
+
+ protected void errEofInComment() throws SAXException {
+ }
+
+ protected void errEofInDoctype() throws SAXException {
+ }
+
+ protected void errEofInAttributeValue() throws SAXException {
+ }
+
+ protected void errEofInAttributeName() throws SAXException {
+ }
+
+ protected void errEofWithoutGt() throws SAXException {
+ }
+
+ protected void errEofInTagName() throws SAXException {
+ }
+
+ protected void errEofInEndTag() throws SAXException {
+ }
+
+ protected void errEofAfterLt() throws SAXException {
+ }
+
+ protected void errNcrOutOfRange() throws SAXException {
+ }
+
+ protected void errNcrUnassigned() throws SAXException {
+ }
+
+ protected void errDuplicateAttribute() throws SAXException {
+ }
+
+ protected void errEofInSystemId() throws SAXException {
+ }
+
+ protected void errExpectedSystemId() throws SAXException {
+ }
+
+ protected void errMissingSpaceBeforeDoctypeName() throws SAXException {
+ }
+
+ protected void errNcrControlChar() throws SAXException {
+ }
+
+ protected void errNcrZero() throws SAXException {
+ }
+
+ protected void errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
+ throws SAXException {
+ }
+
+ protected void errNoSpaceBetweenPublicAndSystemIds() throws SAXException {
+ }
+
+ protected void errNoSpaceBetweenDoctypePublicKeywordAndQuote()
+ throws SAXException {
+ }
+
+ protected void noteAttributeWithoutValue() throws SAXException {
+ }
+
+ protected void noteUnquotedAttributeValue() throws SAXException {
+ }
+
+ /**
+ * Sets the encodingDeclarationHandler.
+ *
+ * @param encodingDeclarationHandler
+ * the encodingDeclarationHandler to set
+ */
+ public void setEncodingDeclarationHandler(
+ EncodingDeclarationHandler encodingDeclarationHandler) {
+ this.encodingDeclarationHandler = encodingDeclarationHandler;
+ }
+
+ void destructor() {
+ Portability.delete(nonInternedTagName);
+ nonInternedTagName = null;
+ // CPPONLY: Portability.delete(nonInternedAttributeName);
+ // CPPONLY: nonInternedAttributeName = null;
+ // The translator will write refcount tracing stuff here
+ Portability.delete(attributes);
+ attributes = null;
+ }
+
+ // [NOCPP[
+
+ /**
+ * Sets an offset to be added to the position reported to
+ * <code>TransitionHandler</code>.
+ *
+ * @param offset the offset
+ */
+ public void setTransitionBaseOffset(int offset) {
+
+ }
+
+ // ]NOCPP]
+
+}
diff --git a/parser/html/javasrc/TreeBuilder.java b/parser/html/javasrc/TreeBuilder.java
new file mode 100644
index 0000000000..1f437bf744
--- /dev/null
+++ b/parser/html/javasrc/TreeBuilder.java
@@ -0,0 +1,6550 @@
+/*
+ * Copyright (c) 2007 Henri Sivonen
+ * Copyright (c) 2007-2017 Mozilla Foundation
+ * Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
+ * Foundation, and Opera Software ASA.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The comments following this one that use the same comment syntax as this
+ * comment are quotes from the WHATWG HTML 5 spec as of 27 June 2007
+ * amended as of June 28 2007.
+ * That document came with this statement:
+ * "© Copyright 2004-2007 Apple Computer, Inc., Mozilla Foundation, and
+ * Opera Software ASA. You are granted a license to use, reproduce and
+ * create derivative works of this document."
+ */
+
+package nu.validator.htmlparser.impl;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import nu.validator.htmlparser.annotation.Auto;
+import nu.validator.htmlparser.annotation.Const;
+import nu.validator.htmlparser.annotation.IdType;
+import nu.validator.htmlparser.annotation.Inline;
+import nu.validator.htmlparser.annotation.Literal;
+import nu.validator.htmlparser.annotation.Local;
+import nu.validator.htmlparser.annotation.NoLength;
+import nu.validator.htmlparser.annotation.NsUri;
+import nu.validator.htmlparser.common.DocumentMode;
+import nu.validator.htmlparser.common.DocumentModeHandler;
+import nu.validator.htmlparser.common.Interner;
+import nu.validator.htmlparser.common.TokenHandler;
+import nu.validator.htmlparser.common.XmlViolationPolicy;
+
+public abstract class TreeBuilder<T> implements TokenHandler,
+ TreeBuilderState<T> {
+
+ /**
+ * Array version of U+FFFD.
+ */
+ private static final @NoLength char[] REPLACEMENT_CHARACTER = { '\uFFFD' };
+
+ // Start dispatch groups
+
+ final static int OTHER = 0;
+
+ final static int A = 1;
+
+ final static int BASE = 2;
+
+ final static int BODY = 3;
+
+ final static int BR = 4;
+
+ final static int BUTTON = 5;
+
+ final static int CAPTION = 6;
+
+ final static int COL = 7;
+
+ final static int COLGROUP = 8;
+
+ final static int FORM = 9;
+
+ final static int FRAME = 10;
+
+ final static int FRAMESET = 11;
+
+ final static int IMAGE = 12;
+
+ final static int INPUT = 13;
+
+ final static int RT_OR_RP = 14;
+
+ final static int LI = 15;
+
+ final static int LINK_OR_BASEFONT_OR_BGSOUND = 16;
+
+ final static int MATH = 17;
+
+ final static int META = 18;
+
+ final static int SVG = 19;
+
+ final static int HEAD = 20;
+
+ final static int HR = 22;
+
+ final static int HTML = 23;
+
+ final static int NOBR = 24;
+
+ final static int NOFRAMES = 25;
+
+ final static int NOSCRIPT = 26;
+
+ final static int OPTGROUP = 27;
+
+ final static int OPTION = 28;
+
+ final static int P = 29;
+
+ final static int PLAINTEXT = 30;
+
+ final static int SCRIPT = 31;
+
+ final static int SELECT = 32;
+
+ final static int STYLE = 33;
+
+ final static int TABLE = 34;
+
+ final static int TEXTAREA = 35;
+
+ final static int TITLE = 36;
+
+ final static int TR = 37;
+
+ final static int XMP = 38;
+
+ final static int TBODY_OR_THEAD_OR_TFOOT = 39;
+
+ final static int TD_OR_TH = 40;
+
+ final static int DD_OR_DT = 41;
+
+ final static int H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42;
+
+ final static int MARQUEE_OR_APPLET = 43;
+
+ final static int PRE_OR_LISTING = 44;
+
+ final static int B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U = 45;
+
+ final static int UL_OR_OL_OR_DL = 46;
+
+ final static int IFRAME = 47;
+
+ final static int EMBED = 48;
+
+ final static int AREA_OR_WBR = 49;
+
+ final static int DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
+
+ final static int ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY = 51;
+
+ final static int RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
+
+ final static int RB_OR_RTC = 53;
+
+ final static int PARAM_OR_SOURCE_OR_TRACK = 55;
+
+ final static int MGLYPH_OR_MALIGNMARK = 56;
+
+ final static int MI_MO_MN_MS_MTEXT = 57;
+
+ final static int ANNOTATION_XML = 58;
+
+ final static int FOREIGNOBJECT_OR_DESC = 59;
+
+ final static int NOEMBED = 60;
+
+ final static int FIELDSET = 61;
+
+ final static int OUTPUT = 62;
+
+ final static int OBJECT = 63;
+
+ final static int FONT = 64;
+
+ final static int KEYGEN = 65;
+
+ final static int TEMPLATE = 66;
+
+ final static int IMG = 67;
+
+ // start insertion modes
+
+ private static final int IN_ROW = 0;
+
+ private static final int IN_TABLE_BODY = 1;
+
+ private static final int IN_TABLE = 2;
+
+ private static final int IN_CAPTION = 3;
+
+ private static final int IN_CELL = 4;
+
+ private static final int FRAMESET_OK = 5;
+
+ private static final int IN_BODY = 6;
+
+ private static final int IN_HEAD = 7;
+
+ private static final int IN_HEAD_NOSCRIPT = 8;
+
+ // no fall-through
+
+ private static final int IN_COLUMN_GROUP = 9;
+
+ // no fall-through
+
+ private static final int IN_SELECT_IN_TABLE = 10;
+
+ private static final int IN_SELECT = 11;
+
+ // no fall-through
+
+ private static final int AFTER_BODY = 12;
+
+ // no fall-through
+
+ private static final int IN_FRAMESET = 13;
+
+ private static final int AFTER_FRAMESET = 14;
+
+ // no fall-through
+
+ private static final int INITIAL = 15;
+
+ // could add fall-through
+
+ private static final int BEFORE_HTML = 16;
+
+ // could add fall-through
+
+ private static final int BEFORE_HEAD = 17;
+
+ // no fall-through
+
+ private static final int AFTER_HEAD = 18;
+
+ // no fall-through
+
+ private static final int AFTER_AFTER_BODY = 19;
+
+ // no fall-through
+
+ private static final int AFTER_AFTER_FRAMESET = 20;
+
+ // no fall-through
+
+ private static final int TEXT = 21;
+
+ private static final int IN_TEMPLATE = 22;
+
+ // start charset states
+
+ private static final int CHARSET_INITIAL = 0;
+
+ private static final int CHARSET_C = 1;
+
+ private static final int CHARSET_H = 2;
+
+ private static final int CHARSET_A = 3;
+
+ private static final int CHARSET_R = 4;
+
+ private static final int CHARSET_S = 5;
+
+ private static final int CHARSET_E = 6;
+
+ private static final int CHARSET_T = 7;
+
+ private static final int CHARSET_EQUALS = 8;
+
+ private static final int CHARSET_SINGLE_QUOTED = 9;
+
+ private static final int CHARSET_DOUBLE_QUOTED = 10;
+
+ private static final int CHARSET_UNQUOTED = 11;
+
+ // end pseudo enums
+
+ @Literal private final static String[] QUIRKY_PUBLIC_IDS = {
+ "+//silmaril//dtd html pro v0r11 19970101//",
+ "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
+ "-//as//dtd html 3.0 aswedit + extensions//",
+ "-//ietf//dtd html 2.0 level 1//",
+ "-//ietf//dtd html 2.0 level 2//",
+ "-//ietf//dtd html 2.0 strict level 1//",
+ "-//ietf//dtd html 2.0 strict level 2//",
+ "-//ietf//dtd html 2.0 strict//",
+ "-//ietf//dtd html 2.0//",
+ "-//ietf//dtd html 2.1e//",
+ "-//ietf//dtd html 3.0//",
+ "-//ietf//dtd html 3.2 final//",
+ "-//ietf//dtd html 3.2//",
+ "-//ietf//dtd html 3//",
+ "-//ietf//dtd html level 0//",
+ "-//ietf//dtd html level 1//",
+ "-//ietf//dtd html level 2//",
+ "-//ietf//dtd html level 3//",
+ "-//ietf//dtd html strict level 0//",
+ "-//ietf//dtd html strict level 1//",
+ "-//ietf//dtd html strict level 2//",
+ "-//ietf//dtd html strict level 3//",
+ "-//ietf//dtd html strict//",
+ "-//ietf//dtd html//",
+ "-//metrius//dtd metrius presentational//",
+ "-//microsoft//dtd internet explorer 2.0 html strict//",
+ "-//microsoft//dtd internet explorer 2.0 html//",
+ "-//microsoft//dtd internet explorer 2.0 tables//",
+ "-//microsoft//dtd internet explorer 3.0 html strict//",
+ "-//microsoft//dtd internet explorer 3.0 html//",
+ "-//microsoft//dtd internet explorer 3.0 tables//",
+ "-//netscape comm. corp.//dtd html//",
+ "-//netscape comm. corp.//dtd strict html//",
+ "-//o'reilly and associates//dtd html 2.0//",
+ "-//o'reilly and associates//dtd html extended 1.0//",
+ "-//o'reilly and associates//dtd html extended relaxed 1.0//",
+ "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
+ "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
+ "-//spyglass//dtd html 2.0 extended//",
+ "-//sq//dtd html 2.0 hotmetal + extensions//",
+ "-//sun microsystems corp.//dtd hotjava html//",
+ "-//sun microsystems corp.//dtd hotjava strict html//",
+ "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//",
+ "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//",
+ "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//",
+ "-//w3c//dtd html 4.0 transitional//",
+ "-//w3c//dtd html experimental 19960712//",
+ "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//",
+ "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//",
+ "-//webtechs//dtd mozilla html//" };
+
+ private static final int NOT_FOUND_ON_STACK = Integer.MAX_VALUE;
+
+ // [NOCPP[
+
+ private static final @Local String HTML_LOCAL = "html";
+
+ // ]NOCPP]
+
+ private int mode = INITIAL;
+
+ private int originalMode = INITIAL;
+
+ /**
+ * Used only when moving back to IN_BODY.
+ */
+ private boolean framesetOk = true;
+
+ protected Tokenizer tokenizer;
+
+ // [NOCPP[
+
+ protected ErrorHandler errorHandler;
+
+ private DocumentModeHandler documentModeHandler;
+
+ // ]NOCPP]
+
+ private boolean scriptingEnabled = false;
+
+ private boolean needToDropLF;
+
+ // [NOCPP[
+
+ private boolean wantingComments;
+
+ // ]NOCPP]
+
+ private boolean fragment;
+
+ private @Local String contextName;
+
+ private @NsUri String contextNamespace;
+
+ private T contextNode;
+
+ /**
+ * Stack of template insertion modes
+ */
+ private @Auto int[] templateModeStack;
+
+ /**
+ * Current template mode stack pointer.
+ */
+ private int templateModePtr = -1;
+
+ private @Auto StackNode<T>[] stackNodes;
+
+ /**
+ * Index of the earliest possible unused or empty element in stackNodes.
+ */
+ private int stackNodesIdx = -1;
+
+ private int numStackNodes = 0;
+
+ private @Auto StackNode<T>[] stack;
+
+ private int currentPtr = -1;
+
+ private @Auto StackNode<T>[] listOfActiveFormattingElements;
+
+ private int listPtr = -1;
+
+ private T formPointer;
+
+ private T headPointer;
+
+ protected @Auto char[] charBuffer;
+
+ protected int charBufferLen = 0;
+
+ private boolean quirks = false;
+
+ private boolean forceNoQuirks = false;
+
+ // [NOCPP[
+
+ private boolean reportingDoctype = true;
+
+ private XmlViolationPolicy namePolicy = XmlViolationPolicy.ALTER_INFOSET;
+
+ private final Map<String, LocatorImpl> idLocations = new HashMap<String, LocatorImpl>();
+
+ // ]NOCPP]
+
+ protected TreeBuilder() {
+ fragment = false;
+ }
+
+ /**
+ * Reports an condition that would make the infoset incompatible with XML
+ * 1.0 as fatal.
+ *
+ * @throws SAXException
+ * @throws SAXParseException
+ */
+ protected void fatal() throws SAXException {
+ }
+
+ // CPPONLY: @Inline private @Creator Object htmlCreator(@HtmlCreator Object htmlCreator) {
+ // CPPONLY: @Creator Object creator;
+ // CPPONLY: creator.html = htmlCreator;
+ // CPPONLY: return creator;
+ // CPPONLY: }
+ // CPPONLY:
+ // CPPONLY: @Inline private @Creator Object svgCreator(@SvgCreator Object svgCreator) {
+ // CPPONLY: @Creator Object creator;
+ // CPPONLY: creator.svg = svgCreator;
+ // CPPONLY: return creator;
+ // CPPONLY: }
+
+ // [NOCPP[
+
+ protected final void fatal(Exception e) throws SAXException {
+ SAXParseException spe = new SAXParseException(e.getMessage(),
+ tokenizer, e);
+ if (errorHandler != null) {
+ errorHandler.fatalError(spe);
+ }
+ throw spe;
+ }
+
+ final void fatal(String s) throws SAXException {
+ SAXParseException spe = new SAXParseException(s, tokenizer);
+ if (errorHandler != null) {
+ errorHandler.fatalError(spe);
+ }
+ throw spe;
+ }
+
+ /**
+ * Reports a Parse Error.
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ final void err(String message) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck(message);
+ }
+
+ /**
+ * Reports a Parse Error without checking if an error handler is present.
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ final void errNoCheck(String message) throws SAXException {
+ SAXParseException spe = new SAXParseException(message, tokenizer);
+ errorHandler.error(spe);
+ }
+
+ private void errListUnclosedStartTags(int eltPos) throws SAXException {
+ if (currentPtr != -1) {
+ for (int i = currentPtr; i > eltPos; i--) {
+ reportUnclosedElementNameAndLocation(i);
+ }
+ }
+ }
+
+ /**
+ * Reports the name and location of an unclosed element.
+ *
+ * @throws SAXException
+ */
+ private final void reportUnclosedElementNameAndLocation(int pos) throws SAXException {
+ StackNode<T> node = stack[pos];
+ if (node.isOptionalEndTag()) {
+ return;
+ }
+ TaintableLocatorImpl locator = node.getLocator();
+ if (locator.isTainted()) {
+ return;
+ }
+ locator.markTainted();
+ SAXParseException spe = new SAXParseException(
+ "Unclosed element \u201C" + node.popName + "\u201D.", locator);
+ errorHandler.error(spe);
+ }
+
+ /**
+ * Reports a warning
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ final void warn(String message) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ SAXParseException spe = new SAXParseException(message, tokenizer);
+ errorHandler.warning(spe);
+ }
+
+ /**
+ * Reports a warning with an explicit locator
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ final void warn(String message, Locator locator) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ SAXParseException spe = new SAXParseException(message, locator);
+ errorHandler.warning(spe);
+ }
+
+ // ]NOCPP]
+
+ @SuppressWarnings("unchecked") public final void startTokenization(Tokenizer self) throws SAXException {
+ tokenizer = self;
+ stackNodes = new StackNode[64];
+ stack = new StackNode[64];
+ templateModeStack = new int[64];
+ listOfActiveFormattingElements = new StackNode[64];
+ needToDropLF = false;
+ originalMode = INITIAL;
+ templateModePtr = -1;
+ stackNodesIdx = 0;
+ numStackNodes = 0;
+ currentPtr = -1;
+ listPtr = -1;
+ formPointer = null;
+ headPointer = null;
+ // [NOCPP[
+ idLocations.clear();
+ wantingComments = wantsComments();
+ // ]NOCPP]
+ start(fragment);
+ charBufferLen = 0;
+ charBuffer = null;
+ framesetOk = true;
+ if (fragment) {
+ T elt;
+ if (contextNode != null) {
+ elt = contextNode;
+ } else {
+ elt = createHtmlElementSetAsRoot(tokenizer.emptyAttributes());
+ }
+ // When the context node is not in the HTML namespace, contrary
+ // to the spec, the first node on the stack is not set to "html"
+ // in the HTML namespace. Instead, it is set to a node that has
+ // the characteristics of the appropriate "adjusted current node".
+ // This way, there is no need to perform "adjusted current node"
+ // checks during tree construction. Instead, it's sufficient to
+ // just look at the current node. However, this also means that it
+ // is not safe to treat "html" in the HTML namespace as a sentinel
+ // that ends stack popping. Instead, stack popping loops that are
+ // meant not to pop the first element on the stack need to check
+ // for currentPos becoming zero.
+ if (contextNamespace == "http://www.w3.org/2000/svg") {
+ ElementName elementName = ElementName.SVG;
+ if ("title" == contextName || "desc" == contextName
+ || "foreignObject" == contextName) {
+ // These elements are all alike and we don't care about
+ // the exact name.
+ elementName = ElementName.FOREIGNOBJECT;
+ }
+ // This is the SVG variant of the StackNode constructor.
+ StackNode<T> node = createStackNode(elementName,
+ elementName.getCamelCaseName(), elt
+ // [NOCPP[
+ , errorHandler == null ? null
+ : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ currentPtr++;
+ stack[currentPtr] = node;
+ tokenizer.setState(Tokenizer.DATA);
+ // The frameset-ok flag is set even though <frameset> never
+ // ends up being allowed as HTML frameset in the fragment case.
+ mode = FRAMESET_OK;
+ } else if (contextNamespace == "http://www.w3.org/1998/Math/MathML") {
+ ElementName elementName = ElementName.MATH;
+ if ("mi" == contextName || "mo" == contextName
+ || "mn" == contextName || "ms" == contextName
+ || "mtext" == contextName) {
+ // These elements are all alike and we don't care about
+ // the exact name.
+ elementName = ElementName.MTEXT;
+ } else if ("annotation-xml" == contextName) {
+ elementName = ElementName.ANNOTATION_XML;
+ // Blink does not check the encoding attribute of the
+ // annotation-xml element innerHTML is being set on.
+ // Let's do the same at least until
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26783
+ // is resolved.
+ }
+ // This is the MathML variant of the StackNode constructor.
+ StackNode<T> node = createStackNode(elementName, elt,
+ elementName.getName(), false
+ // [NOCPP[
+ , errorHandler == null ? null
+ : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ currentPtr++;
+ stack[currentPtr] = node;
+ tokenizer.setState(Tokenizer.DATA);
+ // The frameset-ok flag is set even though <frameset> never
+ // ends up being allowed as HTML frameset in the fragment case.
+ mode = FRAMESET_OK;
+ } else { // html
+ StackNode<T> node = createStackNode(ElementName.HTML, elt
+ // [NOCPP[
+ , errorHandler == null ? null
+ : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ currentPtr++;
+ stack[currentPtr] = node;
+ if ("template" == contextName) {
+ pushTemplateMode(IN_TEMPLATE);
+ }
+ resetTheInsertionMode();
+ formPointer = getFormPointerForContext(contextNode);
+ if ("title" == contextName || "textarea" == contextName) {
+ tokenizer.setState(Tokenizer.RCDATA);
+ } else if ("style" == contextName || "xmp" == contextName
+ || "iframe" == contextName || "noembed" == contextName
+ || "noframes" == contextName
+ || (scriptingEnabled && "noscript" == contextName)) {
+ tokenizer.setState(Tokenizer.RAWTEXT);
+ } else if ("plaintext" == contextName) {
+ tokenizer.setState(Tokenizer.PLAINTEXT);
+ } else if ("script" == contextName) {
+ tokenizer.setState(Tokenizer.SCRIPT_DATA);
+ } else {
+ tokenizer.setState(Tokenizer.DATA);
+ }
+ }
+ } else {
+ mode = INITIAL;
+ // If we are viewing XML source, put a foreign element permanently
+ // on the stack so that cdataSectionAllowed() returns true.
+ // CPPONLY: if (tokenizer.isViewingXmlSource()) {
+ // CPPONLY: T elt = createElement("http://www.w3.org/2000/svg",
+ // CPPONLY: "svg",
+ // CPPONLY: tokenizer.emptyAttributes(), null,
+ // CPPONLY: svgCreator(NS_NewSVGSVGElement));
+ // CPPONLY: StackNode<T> node = createStackNode(ElementName.SVG,
+ // CPPONLY: "svg",
+ // CPPONLY: elt);
+ // CPPONLY: currentPtr++;
+ // CPPONLY: stack[currentPtr] = node;
+ // CPPONLY: }
+ }
+ }
+
+ public final void doctype(@Local String name, String publicIdentifier,
+ String systemIdentifier, boolean forceQuirks) throws SAXException {
+ needToDropLF = false;
+ if (!isInForeign() && mode == INITIAL) {
+ // [NOCPP[
+ if (reportingDoctype) {
+ // ]NOCPP]
+ String emptyString = Portability.newEmptyString();
+ appendDoctypeToDocument(name == null ? "" : name,
+ publicIdentifier == null ? emptyString
+ : publicIdentifier,
+ systemIdentifier == null ? emptyString
+ : systemIdentifier);
+ Portability.releaseString(emptyString);
+ // [NOCPP[
+ }
+ // ]NOCPP]
+ if (isQuirky(name, publicIdentifier, systemIdentifier,
+ forceQuirks)) {
+ errQuirkyDoctype();
+ documentModeInternal(DocumentMode.QUIRKS_MODE,
+ publicIdentifier, systemIdentifier);
+ } else if (isAlmostStandards(publicIdentifier,
+ systemIdentifier)) {
+ errAlmostStandardsDoctype();
+ documentModeInternal(
+ DocumentMode.ALMOST_STANDARDS_MODE,
+ publicIdentifier, systemIdentifier);
+ } else {
+ // [NOCPP[
+ if ((Portability.literalEqualsString(
+ "-//W3C//DTD HTML 4.0//EN", publicIdentifier) && (systemIdentifier == null || Portability.literalEqualsString(
+ "http://www.w3.org/TR/REC-html40/strict.dtd",
+ systemIdentifier)))
+ || (Portability.literalEqualsString(
+ "-//W3C//DTD HTML 4.01//EN",
+ publicIdentifier) && (systemIdentifier == null || Portability.literalEqualsString(
+ "http://www.w3.org/TR/html4/strict.dtd",
+ systemIdentifier)))
+ || (Portability.literalEqualsString(
+ "-//W3C//DTD XHTML 1.0 Strict//EN",
+ publicIdentifier) && Portability.literalEqualsString(
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd",
+ systemIdentifier))
+ || (Portability.literalEqualsString(
+ "-//W3C//DTD XHTML 1.1//EN",
+ publicIdentifier) && Portability.literalEqualsString(
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd",
+ systemIdentifier))
+
+ ) {
+ err("Obsolete doctype. Expected \u201C<!DOCTYPE html>\u201D.");
+ } else if (!((systemIdentifier == null || Portability.literalEqualsString(
+ "about:legacy-compat", systemIdentifier)) && publicIdentifier == null)) {
+ err("Legacy doctype. Expected \u201C<!DOCTYPE html>\u201D.");
+ }
+ // ]NOCPP]
+ documentModeInternal(DocumentMode.STANDARDS_MODE,
+ publicIdentifier, systemIdentifier);
+ }
+
+ /*
+ *
+ * Then, switch to the root element mode of the tree construction
+ * stage.
+ */
+ mode = BEFORE_HTML;
+ return;
+ }
+ /*
+ * A DOCTYPE token Parse error.
+ */
+ errStrayDoctype();
+ /*
+ * Ignore the token.
+ */
+ return;
+ }
+
+ public final void comment(@NoLength char[] buf, int start, int length)
+ throws SAXException {
+ needToDropLF = false;
+ // [NOCPP[
+ if (!wantingComments) {
+ return;
+ }
+ // ]NOCPP]
+ if (!isInForeign()) {
+ switch (mode) {
+ case INITIAL:
+ case BEFORE_HTML:
+ case AFTER_AFTER_BODY:
+ case AFTER_AFTER_FRAMESET:
+ /*
+ * A comment token Append a Comment node to the Document
+ * object with the data attribute set to the data given in
+ * the comment token.
+ */
+ appendCommentToDocument(buf, start, length);
+ return;
+ case AFTER_BODY:
+ /*
+ * A comment token Append a Comment node to the first
+ * element in the stack of open elements (the html element),
+ * with the data attribute set to the data given in the
+ * comment token.
+ */
+ flushCharacters();
+ appendComment(stack[0].node, buf, start, length);
+ return;
+ default:
+ break;
+ }
+ }
+ /*
+ * A comment token Append a Comment node to the current node with the
+ * data attribute set to the data given in the comment token.
+ */
+ flushCharacters();
+ appendComment(stack[currentPtr].node, buf, start, length);
+ return;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.common.TokenHandler#characters(char[], int,
+ * int)
+ */
+ public final void characters(@Const @NoLength char[] buf, int start, int length)
+ throws SAXException {
+ // Note: Can't attach error messages to EOF in C++ yet
+
+ // CPPONLY: if (tokenizer.isViewingXmlSource()) {
+ // CPPONLY: return;
+ // CPPONLY: }
+ if (needToDropLF) {
+ needToDropLF = false;
+ if (buf[start] == '\n') {
+ start++;
+ length--;
+ if (length == 0) {
+ return;
+ }
+ }
+ }
+
+ // optimize the most common case
+ switch (mode) {
+ case IN_BODY:
+ case IN_CELL:
+ case IN_CAPTION:
+ if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
+ reconstructTheActiveFormattingElements();
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case TEXT:
+ accumulateCharacters(buf, start, length);
+ return;
+ case IN_TABLE:
+ case IN_TABLE_BODY:
+ case IN_ROW:
+ accumulateCharactersForced(buf, start, length);
+ return;
+ default:
+ int end = start + length;
+ charactersloop: for (int i = start; i < end; i++) {
+ switch (buf[i]) {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '\u000C':
+ /*
+ * A character token that is one of one of U+0009
+ * CHARACTER TABULATION, U+000A LINE FEED (LF),
+ * U+000C FORM FEED (FF), or U+0020 SPACE
+ */
+ switch (mode) {
+ case INITIAL:
+ case BEFORE_HTML:
+ case BEFORE_HEAD:
+ /*
+ * Ignore the token.
+ */
+ start = i + 1;
+ continue;
+ case IN_HEAD:
+ case IN_HEAD_NOSCRIPT:
+ case AFTER_HEAD:
+ case IN_COLUMN_GROUP:
+ case IN_FRAMESET:
+ case AFTER_FRAMESET:
+ /*
+ * Append the character to the current node.
+ */
+ continue;
+ case FRAMESET_OK:
+ case IN_TEMPLATE:
+ case IN_BODY:
+ case IN_CELL:
+ case IN_CAPTION:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+
+ /*
+ * Reconstruct the active formatting
+ * elements, if any.
+ */
+ if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
+ flushCharacters();
+ reconstructTheActiveFormattingElements();
+ }
+ /*
+ * Append the token's character to the
+ * current node.
+ */
+ break charactersloop;
+ case IN_SELECT:
+ case IN_SELECT_IN_TABLE:
+ break charactersloop;
+ case IN_TABLE:
+ case IN_TABLE_BODY:
+ case IN_ROW:
+ accumulateCharactersForced(buf, i, 1);
+ start = i + 1;
+ continue;
+ case AFTER_BODY:
+ case AFTER_AFTER_BODY:
+ case AFTER_AFTER_FRAMESET:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * Reconstruct the active formatting
+ * elements, if any.
+ */
+ flushCharacters();
+ reconstructTheActiveFormattingElements();
+ /*
+ * Append the token's character to the
+ * current node.
+ */
+ continue;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH_ASSERT();
+ default:
+ /*
+ * A character token that is not one of one of
+ * U+0009 CHARACTER TABULATION, U+000A LINE FEED
+ * (LF), U+000C FORM FEED (FF), or U+0020 SPACE
+ */
+ switch (mode) {
+ case INITIAL:
+ /*
+ * Parse error.
+ */
+ // [NOCPP[
+ // XXX figure out a way to report this in the Gecko View Source case
+ err("Non-space characters found without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
+ // ]NOCPP]
+ /*
+ *
+ * Set the document to quirks mode.
+ */
+ documentModeInternal(
+ DocumentMode.QUIRKS_MODE, null,
+ null);
+ /*
+ * Then, switch to the root element mode of
+ * the tree construction stage
+ */
+ mode = BEFORE_HTML;
+ /*
+ * and reprocess the current token.
+ */
+ i--;
+ continue;
+ case BEFORE_HTML:
+ /*
+ * Create an HTMLElement node with the tag
+ * name html, in the HTML namespace. Append
+ * it to the Document object.
+ */
+ // No need to flush characters here,
+ // because there's nothing to flush.
+ appendHtmlElementToDocumentAndPush();
+ /* Switch to the main mode */
+ mode = BEFORE_HEAD;
+ /*
+ * reprocess the current token.
+ */
+ i--;
+ continue;
+ case BEFORE_HEAD:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * /Act as if a start tag token with the tag
+ * name "head" and no attributes had been
+ * seen,
+ */
+ flushCharacters();
+ appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_HEAD;
+ /*
+ * then reprocess the current token.
+ *
+ * This will result in an empty head element
+ * being generated, with the current token
+ * being reprocessed in the "after head"
+ * insertion mode.
+ */
+ i--;
+ continue;
+ case IN_HEAD:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * Act as if an end tag token with the tag
+ * name "head" had been seen,
+ */
+ flushCharacters();
+ pop();
+ mode = AFTER_HEAD;
+ /*
+ * and reprocess the current token.
+ */
+ i--;
+ continue;
+ case IN_HEAD_NOSCRIPT:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * Parse error. Act as if an end tag with
+ * the tag name "noscript" had been seen
+ */
+ errNonSpaceInNoscriptInHead();
+ flushCharacters();
+ pop();
+ mode = IN_HEAD;
+ /*
+ * and reprocess the current token.
+ */
+ i--;
+ continue;
+ case AFTER_HEAD:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * Act as if a start tag token with the tag
+ * name "body" and no attributes had been
+ * seen,
+ */
+ flushCharacters();
+ appendToCurrentNodeAndPushBodyElement();
+ mode = FRAMESET_OK;
+ /*
+ * and then reprocess the current token.
+ */
+ i--;
+ continue;
+ case FRAMESET_OK:
+ framesetOk = false;
+ mode = IN_BODY;
+ i--;
+ continue;
+ case IN_TEMPLATE:
+ case IN_BODY:
+ case IN_CELL:
+ case IN_CAPTION:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * Reconstruct the active formatting
+ * elements, if any.
+ */
+ if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
+ flushCharacters();
+ reconstructTheActiveFormattingElements();
+ }
+ /*
+ * Append the token's character to the
+ * current node.
+ */
+ break charactersloop;
+ case IN_TABLE:
+ case IN_TABLE_BODY:
+ case IN_ROW:
+ accumulateCharactersForced(buf, i, 1);
+ start = i + 1;
+ continue;
+ case IN_COLUMN_GROUP:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ start = i;
+ }
+ /*
+ * Act as if an end tag with the tag name
+ * "colgroup" had been seen, and then, if
+ * that token wasn't ignored, reprocess the
+ * current token.
+ */
+ if (currentPtr == 0 || stack[currentPtr].getGroup() ==
+ TreeBuilder.TEMPLATE) {
+ errNonSpaceInColgroupInFragment();
+ start = i + 1;
+ continue;
+ }
+ flushCharacters();
+ pop();
+ mode = IN_TABLE;
+ i--;
+ continue;
+ case IN_SELECT:
+ case IN_SELECT_IN_TABLE:
+ break charactersloop;
+ case AFTER_BODY:
+ errNonSpaceAfterBody();
+ fatal();
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ i--;
+ continue;
+ case IN_FRAMESET:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ // start index is adjusted below.
+ }
+ /*
+ * Parse error.
+ */
+ errNonSpaceInFrameset();
+ /*
+ * Ignore the token.
+ */
+ start = i + 1;
+ continue;
+ case AFTER_FRAMESET:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ // start index is adjusted below.
+ }
+ /*
+ * Parse error.
+ */
+ errNonSpaceAfterFrameset();
+ /*
+ * Ignore the token.
+ */
+ start = i + 1;
+ continue;
+ case AFTER_AFTER_BODY:
+ /*
+ * Parse error.
+ */
+ errNonSpaceInTrailer();
+ /*
+ * Switch back to the main mode and
+ * reprocess the token.
+ */
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ i--;
+ continue;
+ case AFTER_AFTER_FRAMESET:
+ if (start < i) {
+ accumulateCharacters(buf, start, i
+ - start);
+ // start index is adjusted below.
+ }
+ /*
+ * Parse error.
+ */
+ errNonSpaceInTrailer();
+ /*
+ * Ignore the token.
+ */
+ start = i + 1;
+ continue;
+ }
+ }
+ }
+ if (start < end) {
+ accumulateCharacters(buf, start, end - start);
+ }
+ }
+ }
+
+ /**
+ * @see nu.validator.htmlparser.common.TokenHandler#zeroOriginatingReplacementCharacter()
+ */
+ public void zeroOriginatingReplacementCharacter() throws SAXException {
+ if (mode == TEXT) {
+ accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1);
+ return;
+ }
+ if (currentPtr >= 0) {
+ if (isSpecialParentInForeign(stack[currentPtr])) {
+ return;
+ }
+ accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1);
+ }
+ }
+
+ /**
+ * @see nu.validator.htmlparser.common.TokenHandler#zeroOrReplacementCharacter()
+ */
+ public void zeroOrReplacementCharacter() throws SAXException {
+ zeroOriginatingReplacementCharacter();
+ }
+
+ public final void eof() throws SAXException {
+ flushCharacters();
+ // Note: Can't attach error messages to EOF in C++ yet
+ eofloop: for (;;) {
+ switch (mode) {
+ case INITIAL:
+ /*
+ * Parse error.
+ */
+ // [NOCPP[
+ err("End of file seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
+ // ]NOCPP]
+ /*
+ *
+ * Set the document to quirks mode.
+ */
+ documentModeInternal(DocumentMode.QUIRKS_MODE, null, null);
+ /*
+ * Then, switch to the root element mode of the tree
+ * construction stage
+ */
+ mode = BEFORE_HTML;
+ /*
+ * and reprocess the current token.
+ */
+ continue;
+ case BEFORE_HTML:
+ /*
+ * Create an HTMLElement node with the tag name html, in the
+ * HTML namespace. Append it to the Document object.
+ */
+ appendHtmlElementToDocumentAndPush();
+ // XXX application cache manifest
+ /* Switch to the main mode */
+ mode = BEFORE_HEAD;
+ /*
+ * reprocess the current token.
+ */
+ continue;
+ case BEFORE_HEAD:
+ appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_HEAD;
+ continue;
+ case IN_HEAD:
+ // [NOCPP[
+ if (errorHandler != null && currentPtr > 1) {
+ errEofWithUnclosedElements();
+ }
+ // ]NOCPP]
+ while (currentPtr > 0) {
+ popOnEof();
+ }
+ mode = AFTER_HEAD;
+ continue;
+ case IN_HEAD_NOSCRIPT:
+ // [NOCPP[
+ errEofWithUnclosedElements();
+ // ]NOCPP]
+ while (currentPtr > 1) {
+ popOnEof();
+ }
+ mode = IN_HEAD;
+ continue;
+ case AFTER_HEAD:
+ appendToCurrentNodeAndPushBodyElement();
+ mode = IN_BODY;
+ continue;
+ case IN_TABLE_BODY:
+ case IN_ROW:
+ case IN_TABLE:
+ case IN_SELECT_IN_TABLE:
+ case IN_SELECT:
+ case IN_COLUMN_GROUP:
+ case FRAMESET_OK:
+ case IN_CAPTION:
+ case IN_CELL:
+ case IN_BODY:
+ // [NOCPP[
+ // i > 0 to stop in time in the foreign fragment case.
+ openelementloop: for (int i = currentPtr; i > 0; i--) {
+ int group = stack[i].getGroup();
+ switch (group) {
+ case DD_OR_DT:
+ case LI:
+ case P:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TD_OR_TH:
+ case BODY:
+ case HTML:
+ break;
+ default:
+ errEofWithUnclosedElements();
+ break openelementloop;
+ }
+ }
+ // ]NOCPP]
+
+ if (isTemplateModeStackEmpty()) {
+ break eofloop;
+ }
+
+ // fall through to IN_TEMPLATE
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_TEMPLATE:
+ int eltPos = findLast("template");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment;
+ break eofloop;
+ }
+ if (errorHandler != null) {
+ errListUnclosedStartTags(0);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ popTemplateMode();
+ resetTheInsertionMode();
+
+ // Reprocess token.
+ continue;
+ case TEXT:
+ // [NOCPP[
+ if (errorHandler != null) {
+ errNoCheck("End of file seen when expecting text or an end tag.");
+ errListUnclosedStartTags(0);
+ }
+ // ]NOCPP]
+ // XXX mark script as already executed
+ if (originalMode == AFTER_HEAD) {
+ popOnEof();
+ }
+ popOnEof();
+ mode = originalMode;
+ continue;
+ case IN_FRAMESET:
+ // [NOCPP[
+ if (errorHandler != null && currentPtr > 0) {
+ errEofWithUnclosedElements();
+ }
+ // ]NOCPP]
+ break eofloop;
+ case AFTER_BODY:
+ case AFTER_FRAMESET:
+ case AFTER_AFTER_BODY:
+ case AFTER_AFTER_FRAMESET:
+ default:
+ // [NOCPP[
+ if (currentPtr == 0) { // This silliness is here to poison
+ // buggy compiler optimizations in
+ // GWT
+ System.currentTimeMillis();
+ }
+ // ]NOCPP]
+ break eofloop;
+ }
+ }
+ while (currentPtr > 0) {
+ popOnEof();
+ }
+ if (!fragment) {
+ popOnEof();
+ }
+ /* Stop parsing. */
+ }
+
+ /**
+ * @see nu.validator.htmlparser.common.TokenHandler#endTokenization()
+ */
+ public final void endTokenization() throws SAXException {
+ formPointer = null;
+ headPointer = null;
+ contextName = null;
+ contextNode = null;
+ templateModeStack = null;
+ if (stack != null) {
+ while (currentPtr > -1) {
+ stack[currentPtr].release(this);
+ currentPtr--;
+ }
+ stack = null;
+ }
+ if (listOfActiveFormattingElements != null) {
+ while (listPtr > -1) {
+ if (listOfActiveFormattingElements[listPtr] != null) {
+ listOfActiveFormattingElements[listPtr].release(this);
+ }
+ listPtr--;
+ }
+ listOfActiveFormattingElements = null;
+ }
+ if (stackNodes != null) {
+ for (int i = 0; i < numStackNodes; i++) {
+ assert stackNodes[i].isUnused();
+ Portability.delete(stackNodes[i]);
+ }
+ numStackNodes = 0;
+ stackNodesIdx = 0;
+ stackNodes = null;
+ }
+ // [NOCPP[
+ idLocations.clear();
+ // ]NOCPP]
+ charBuffer = null;
+ end();
+ }
+
+ public final void startTag(ElementName elementName,
+ HtmlAttributes attributes, boolean selfClosing) throws SAXException {
+ flushCharacters();
+
+ // [NOCPP[
+ if (errorHandler != null) {
+ // ID uniqueness
+ @IdType String id = attributes.getId();
+ if (id != null) {
+ LocatorImpl oldLoc = idLocations.get(id);
+ if (oldLoc != null) {
+ err("Duplicate ID \u201C" + id + "\u201D.");
+ errorHandler.warning(new SAXParseException(
+ "The first occurrence of ID \u201C" + id
+ + "\u201D was here.", oldLoc));
+ } else {
+ idLocations.put(id, new LocatorImpl(tokenizer));
+ }
+ }
+ }
+ // ]NOCPP]
+
+ int eltPos;
+ needToDropLF = false;
+ starttagloop: for (;;) {
+ int group = elementName.getGroup();
+ @Local String name = elementName.getName();
+ if (isInForeign()) {
+ StackNode<T> currentNode = stack[currentPtr];
+ @NsUri String currNs = currentNode.ns;
+ if (!(currentNode.isHtmlIntegrationPoint() || (currNs == "http://www.w3.org/1998/Math/MathML" && ((currentNode.getGroup() == MI_MO_MN_MS_MTEXT && group != MGLYPH_OR_MALIGNMARK) || (currentNode.getGroup() == ANNOTATION_XML && group == SVG))))) {
+ switch (group) {
+ case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
+ case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
+ case BODY:
+ case BR:
+ case RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
+ case DD_OR_DT:
+ case UL_OR_OL_OR_DL:
+ case EMBED:
+ case IMG:
+ case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
+ case HEAD:
+ case HR:
+ case LI:
+ case META:
+ case NOBR:
+ case P:
+ case PRE_OR_LISTING:
+ case TABLE:
+ case FONT:
+ // re-check FONT to deal with the special case
+ if (!(group == FONT && !(attributes.contains(AttributeName.COLOR)
+ || attributes.contains(AttributeName.FACE) || attributes.contains(AttributeName.SIZE)))) {
+ errHtmlStartTagInForeignContext(name);
+ if (!fragment) {
+ while (!isSpecialParentInForeign(stack[currentPtr])) {
+ popForeign(-1, -1);
+ }
+ continue starttagloop;
+ } // else fall thru
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ if ("http://www.w3.org/2000/svg" == currNs) {
+ attributes.adjustForSvg();
+ if (selfClosing) {
+ appendVoidElementToCurrentMayFosterSVG(
+ elementName, attributes);
+ selfClosing = false;
+ } else {
+ appendToCurrentNodeAndPushElementMayFosterSVG(
+ elementName, attributes);
+ }
+ attributes = null; // CPP
+ break starttagloop;
+ } else {
+ attributes.adjustForMath();
+ if (selfClosing) {
+ appendVoidElementToCurrentMayFosterMathML(
+ elementName, attributes);
+ selfClosing = false;
+ } else {
+ appendToCurrentNodeAndPushElementMayFosterMathML(
+ elementName, attributes);
+ }
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ } // switch
+ } // foreignObject / annotation-xml
+ }
+ switch (mode) {
+ case IN_TEMPLATE:
+ switch (group) {
+ case COL:
+ popTemplateMode();
+ pushTemplateMode(IN_COLUMN_GROUP);
+ mode = IN_COLUMN_GROUP;
+ // Reprocess token.
+ continue;
+ case CAPTION:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ popTemplateMode();
+ pushTemplateMode(IN_TABLE);
+ mode = IN_TABLE;
+ // Reprocess token.
+ continue;
+ case TR:
+ popTemplateMode();
+ pushTemplateMode(IN_TABLE_BODY);
+ mode = IN_TABLE_BODY;
+ // Reprocess token.
+ continue;
+ case TD_OR_TH:
+ popTemplateMode();
+ pushTemplateMode(IN_ROW);
+ mode = IN_ROW;
+ // Reprocess token.
+ continue;
+ case META:
+ checkMetaCharset(attributes);
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case TITLE:
+ startTagTitleInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case BASE:
+ case LINK_OR_BASEFONT_OR_BGSOUND:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case SCRIPT:
+ startTagScriptInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case NOFRAMES:
+ case STYLE:
+ startTagGenericRawText(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ popTemplateMode();
+ pushTemplateMode(IN_BODY);
+ mode = IN_BODY;
+ // Reprocess token.
+ continue;
+ }
+ case IN_ROW:
+ switch (group) {
+ case TD_OR_TH:
+ clearStackBackTo(findLastOrRoot(TreeBuilder.TR));
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_CELL;
+ insertMarker();
+ attributes = null; // CPP
+ break starttagloop;
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ eltPos = findLastOrRoot(TreeBuilder.TR);
+ if (eltPos == 0) {
+ assert fragment || isTemplateContents();
+ errNoTableRowToClose();
+ break starttagloop;
+ }
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE_BODY;
+ continue;
+ default:
+ // fall through to IN_TABLE
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_TABLE_BODY:
+ switch (group) {
+ case TR:
+ clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot());
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_ROW;
+ attributes = null; // CPP
+ break starttagloop;
+ case TD_OR_TH:
+ errStartTagInTableBody(name);
+ clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot());
+ appendToCurrentNodeAndPushElement(
+ ElementName.TR,
+ HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_ROW;
+ continue;
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
+ if (eltPos == 0 || stack[eltPos].getGroup() == TEMPLATE) {
+ assert fragment || isTemplateContents();
+ errStrayStartTag(name);
+ break starttagloop;
+ } else {
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE;
+ continue;
+ }
+ default:
+ // fall through to IN_TABLE
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_TABLE:
+ intableloop: for (;;) {
+ switch (group) {
+ case CAPTION:
+ clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
+ insertMarker();
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_CAPTION;
+ attributes = null; // CPP
+ break starttagloop;
+ case COLGROUP:
+ clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_COLUMN_GROUP;
+ attributes = null; // CPP
+ break starttagloop;
+ case COL:
+ clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
+ appendToCurrentNodeAndPushElement(
+ ElementName.COLGROUP,
+ HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_COLUMN_GROUP;
+ continue starttagloop;
+ case TBODY_OR_THEAD_OR_TFOOT:
+ clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_TABLE_BODY;
+ attributes = null; // CPP
+ break starttagloop;
+ case TR:
+ case TD_OR_TH:
+ clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
+ appendToCurrentNodeAndPushElement(
+ ElementName.TBODY,
+ HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_TABLE_BODY;
+ continue starttagloop;
+ case TEMPLATE:
+ // fall through to IN_HEAD
+ break intableloop;
+ case TABLE:
+ errTableSeenWhileTableOpen();
+ eltPos = findLastInTableScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment || isTemplateContents();
+ break starttagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent("table")) {
+ errNoCheckUnclosedElementsOnStack();
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ continue starttagloop;
+ case SCRIPT:
+ // XXX need to manage much more stuff
+ // here if
+ // supporting
+ // document.write()
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.SCRIPT_DATA, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case STYLE:
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RAWTEXT, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case INPUT:
+ errStartTagInTable(name);
+ if (!Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "hidden",
+ attributes.getValue(AttributeName.TYPE))) {
+ break intableloop;
+ }
+ appendVoidInputToCurrent(
+ attributes,
+ formPointer);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case FORM:
+ if (formPointer != null || isTemplateContents()) {
+ errFormWhenFormOpen();
+ break starttagloop;
+ } else {
+ errStartTagInTable(name);
+ appendVoidFormToCurrent(attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ default:
+ errStartTagInTable(name);
+ // fall through to IN_BODY
+ break intableloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_CAPTION:
+ switch (group) {
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ case TD_OR_TH:
+ eltPos = findLastInTableScope("caption");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment || isTemplateContents();
+ errStrayStartTag(name);
+ break starttagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && currentPtr != eltPos) {
+ errNoCheckUnclosedElementsOnStack();
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ mode = IN_TABLE;
+ continue;
+ default:
+ // fall through to IN_BODY
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_CELL:
+ switch (group) {
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ case TD_OR_TH:
+ eltPos = findLastInTableScopeTdTh();
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errNoCellToClose();
+ break starttagloop;
+ } else {
+ closeTheCell(eltPos);
+ continue;
+ }
+ default:
+ // fall through to IN_BODY
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case FRAMESET_OK:
+ switch (group) {
+ case FRAMESET:
+ if (mode == FRAMESET_OK) {
+ if (currentPtr == 0 || stack[1].getGroup() != BODY) {
+ assert fragment || isTemplateContents();
+ errStrayStartTag(name);
+ break starttagloop;
+ } else {
+ errFramesetStart();
+ detachFromParent(stack[1].node);
+ while (currentPtr > 0) {
+ pop();
+ }
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_FRAMESET;
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ } else {
+ errStrayStartTag(name);
+ break starttagloop;
+ }
+ // NOT falling through!
+ case PRE_OR_LISTING:
+ case LI:
+ case DD_OR_DT:
+ case BUTTON:
+ case MARQUEE_OR_APPLET:
+ case OBJECT:
+ case TABLE:
+ case AREA_OR_WBR:
+ case KEYGEN:
+ case BR:
+ case EMBED:
+ case IMG:
+ case INPUT:
+ case HR:
+ case TEXTAREA:
+ case XMP:
+ case IFRAME:
+ case SELECT:
+ if (mode == FRAMESET_OK
+ && !(group == INPUT && Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "hidden",
+ attributes.getValue(AttributeName.TYPE)))) {
+ framesetOk = false;
+ mode = IN_BODY;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ // fall through to IN_BODY
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_BODY:
+ inbodyloop: for (;;) {
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case BASE:
+ case LINK_OR_BASEFONT_OR_BGSOUND:
+ case META:
+ case STYLE:
+ case SCRIPT:
+ case TITLE:
+ case TEMPLATE:
+ // Fall through to IN_HEAD
+ break inbodyloop;
+ case BODY:
+ if (currentPtr == 0 || stack[1].getGroup() != BODY || isTemplateContents()) {
+ assert fragment || isTemplateContents();
+ errStrayStartTag(name);
+ break starttagloop;
+ }
+ errFooSeenWhenFooOpen(name);
+ framesetOk = false;
+ if (mode == FRAMESET_OK) {
+ mode = IN_BODY;
+ }
+ if (addAttributesToBody(attributes)) {
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case P:
+ case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
+ case UL_OR_OL_OR_DL:
+ case ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
+ implicitlyCloseP();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
+ implicitlyCloseP();
+ if (stack[currentPtr].getGroup() == H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) {
+ errHeadingWhenHeadingOpen();
+ pop();
+ }
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case FIELDSET:
+ implicitlyCloseP();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes, formPointer);
+ attributes = null; // CPP
+ break starttagloop;
+ case PRE_OR_LISTING:
+ implicitlyCloseP();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ needToDropLF = true;
+ attributes = null; // CPP
+ break starttagloop;
+ case FORM:
+ if (formPointer != null && !isTemplateContents()) {
+ errFormWhenFormOpen();
+ break starttagloop;
+ } else {
+ implicitlyCloseP();
+ appendToCurrentNodeAndPushFormElementMayFoster(attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ case LI:
+ case DD_OR_DT:
+ eltPos = currentPtr;
+ for (;;) {
+ StackNode<T> node = stack[eltPos]; // weak
+ // ref
+ if (node.getGroup() == group) { // LI or
+ // DD_OR_DT
+ generateImpliedEndTagsExceptFor(node.name);
+ if (errorHandler != null
+ && eltPos != currentPtr) {
+ errUnclosedElementsImplied(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ break;
+ } else if (eltPos == 0 || (node.isSpecial()
+ && (node.ns != "http://www.w3.org/1999/xhtml"
+ || (node.name != "p"
+ && node.name != "address"
+ && node.name != "div")))) {
+ break;
+ }
+ eltPos--;
+ }
+ implicitlyCloseP();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case PLAINTEXT:
+ implicitlyCloseP();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.PLAINTEXT, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case A:
+ int activeAPos = findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker("a");
+ if (activeAPos != -1) {
+ errFooSeenWhenFooOpen(name);
+ StackNode<T> activeA = listOfActiveFormattingElements[activeAPos];
+ activeA.retain();
+ adoptionAgencyEndTag("a");
+ removeFromStack(activeA);
+ activeAPos = findInListOfActiveFormattingElements(activeA);
+ if (activeAPos != -1) {
+ removeFromListOfActiveFormattingElements(activeAPos);
+ }
+ activeA.release(this);
+ }
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushFormattingElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
+ case FONT:
+ reconstructTheActiveFormattingElements();
+ maybeForgetEarlierDuplicateFormattingElement(elementName.getName(), attributes);
+ appendToCurrentNodeAndPushFormattingElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case NOBR:
+ reconstructTheActiveFormattingElements();
+ if (TreeBuilder.NOT_FOUND_ON_STACK != findLastInScope("nobr")) {
+ errFooSeenWhenFooOpen(name);
+ adoptionAgencyEndTag("nobr");
+ reconstructTheActiveFormattingElements();
+ }
+ appendToCurrentNodeAndPushFormattingElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case BUTTON:
+ eltPos = findLastInScope(name);
+ if (eltPos != TreeBuilder.NOT_FOUND_ON_STACK) {
+ errFooSeenWhenFooOpen(name);
+ generateImpliedEndTags();
+ if (errorHandler != null
+ && !isCurrent(name)) {
+ errUnclosedElementsImplied(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ continue starttagloop;
+ } else {
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes, formPointer);
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ case OBJECT:
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes, formPointer);
+ insertMarker();
+ attributes = null; // CPP
+ break starttagloop;
+ case MARQUEE_OR_APPLET:
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ insertMarker();
+ attributes = null; // CPP
+ break starttagloop;
+ case TABLE:
+ // The only quirk. Blame Hixie and
+ // Acid2.
+ if (!quirks) {
+ implicitlyCloseP();
+ }
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ mode = IN_TABLE;
+ attributes = null; // CPP
+ break starttagloop;
+ case BR:
+ case EMBED:
+ case AREA_OR_WBR:
+ case KEYGEN:
+ reconstructTheActiveFormattingElements();
+ // FALL THROUGH to PARAM_OR_SOURCE_OR_TRACK
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case PARAM_OR_SOURCE_OR_TRACK:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case HR:
+ implicitlyCloseP();
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case IMAGE:
+ errImage();
+ elementName = ElementName.IMG;
+ continue starttagloop;
+ case IMG:
+ case INPUT:
+ reconstructTheActiveFormattingElements();
+ appendVoidElementToCurrentMayFoster(
+ elementName, attributes,
+ formPointer);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case TEXTAREA:
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes, formPointer);
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RCDATA, elementName);
+ originalMode = mode;
+ mode = TEXT;
+ needToDropLF = true;
+ attributes = null; // CPP
+ break starttagloop;
+ case XMP:
+ implicitlyCloseP();
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RAWTEXT, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case NOSCRIPT:
+ if (!scriptingEnabled) {
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case NOFRAMES:
+ case IFRAME:
+ case NOEMBED:
+ startTagGenericRawText(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case SELECT:
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes, formPointer);
+ switch (mode) {
+ case IN_TABLE:
+ case IN_CAPTION:
+ case IN_COLUMN_GROUP:
+ case IN_TABLE_BODY:
+ case IN_ROW:
+ case IN_CELL:
+ mode = IN_SELECT_IN_TABLE;
+ break;
+ default:
+ mode = IN_SELECT;
+ break;
+ }
+ attributes = null; // CPP
+ break starttagloop;
+ case OPTGROUP:
+ case OPTION:
+ if (isCurrent("option")) {
+ pop();
+ }
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case RB_OR_RTC:
+ eltPos = findLastInScope("ruby");
+ if (eltPos != NOT_FOUND_ON_STACK) {
+ generateImpliedEndTags();
+ }
+ if (eltPos != currentPtr) {
+ if (eltPos == NOT_FOUND_ON_STACK) {
+ errStartTagSeenWithoutRuby(name);
+ } else {
+ errUnclosedChildrenInRuby();
+ }
+ }
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case RT_OR_RP:
+ eltPos = findLastInScope("ruby");
+ if (eltPos != NOT_FOUND_ON_STACK) {
+ generateImpliedEndTagsExceptFor("rtc");
+ }
+ if (eltPos != currentPtr) {
+ if (!isCurrent("rtc")) {
+ if (eltPos == NOT_FOUND_ON_STACK) {
+ errStartTagSeenWithoutRuby(name);
+ } else {
+ errUnclosedChildrenInRuby();
+ }
+ }
+ }
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case MATH:
+ reconstructTheActiveFormattingElements();
+ attributes.adjustForMath();
+ if (selfClosing) {
+ appendVoidElementToCurrentMayFosterMathML(
+ elementName, attributes);
+ selfClosing = false;
+ } else {
+ appendToCurrentNodeAndPushElementMayFosterMathML(
+ elementName, attributes);
+ }
+ attributes = null; // CPP
+ break starttagloop;
+ case SVG:
+ reconstructTheActiveFormattingElements();
+ attributes.adjustForSvg();
+ if (selfClosing) {
+ appendVoidElementToCurrentMayFosterSVG(
+ elementName,
+ attributes);
+ selfClosing = false;
+ } else {
+ appendToCurrentNodeAndPushElementMayFosterSVG(
+ elementName, attributes);
+ }
+ attributes = null; // CPP
+ break starttagloop;
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ case TD_OR_TH:
+ case FRAME:
+ case FRAMESET:
+ case HEAD:
+ errStrayStartTag(name);
+ break starttagloop;
+ case OUTPUT:
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes, formPointer);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ reconstructTheActiveFormattingElements();
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_HEAD:
+ inheadloop: for (;;) {
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case BASE:
+ case LINK_OR_BASEFONT_OR_BGSOUND:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case META:
+ // Fall through to IN_HEAD_NOSCRIPT
+ break inheadloop;
+ case TITLE:
+ startTagTitleInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case NOSCRIPT:
+ if (scriptingEnabled) {
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RAWTEXT, elementName);
+ } else {
+ appendToCurrentNodeAndPushElementMayFoster(
+ elementName,
+ attributes);
+ mode = IN_HEAD_NOSCRIPT;
+ }
+ attributes = null; // CPP
+ break starttagloop;
+ case SCRIPT:
+ startTagScriptInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case STYLE:
+ case NOFRAMES:
+ startTagGenericRawText(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case HEAD:
+ /* Parse error. */
+ errFooSeenWhenFooOpen(name);
+ /* Ignore the token. */
+ break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ pop();
+ mode = AFTER_HEAD;
+ continue starttagloop;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_HEAD_NOSCRIPT:
+ switch (group) {
+ case HTML:
+ // XXX did Hixie really mean to omit "base"
+ // here?
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case LINK_OR_BASEFONT_OR_BGSOUND:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case META:
+ checkMetaCharset(attributes);
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case STYLE:
+ case NOFRAMES:
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RAWTEXT, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case HEAD:
+ errFooSeenWhenFooOpen(name);
+ break starttagloop;
+ case NOSCRIPT:
+ errFooSeenWhenFooOpen(name);
+ break starttagloop;
+ default:
+ errBadStartTagInNoscriptInHead(name);
+ pop();
+ mode = IN_HEAD;
+ continue;
+ }
+ case IN_COLUMN_GROUP:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case COL:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ if (currentPtr == 0 || stack[currentPtr].getGroup() == TEMPLATE) {
+ assert fragment || isTemplateContents();
+ errGarbageInColgroup();
+ break starttagloop;
+ }
+ pop();
+ mode = IN_TABLE;
+ continue;
+ }
+ case IN_SELECT_IN_TABLE:
+ switch (group) {
+ case CAPTION:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ case TD_OR_TH:
+ case TABLE:
+ errStartTagWithSelectOpen(name);
+ eltPos = findLastInTableScope("select");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment;
+ break starttagloop; // http://www.w3.org/Bugs/Public/show_bug.cgi?id=8375
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ continue;
+ default:
+ // fall through to IN_SELECT
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_SELECT:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case OPTION:
+ if (isCurrent("option")) {
+ pop();
+ }
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case OPTGROUP:
+ if (isCurrent("option")) {
+ pop();
+ }
+ if (isCurrent("optgroup")) {
+ pop();
+ }
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case SELECT:
+ errStartSelectWhereEndSelectExpected();
+ eltPos = findLastInTableScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment;
+ errNoSelectInTableScope();
+ break starttagloop;
+ } else {
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ break starttagloop;
+ }
+ case INPUT:
+ case TEXTAREA:
+ errStartTagWithSelectOpen(name);
+ eltPos = findLastInTableScope("select");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment;
+ break starttagloop;
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ continue;
+ case SCRIPT:
+ startTagScriptInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case TEMPLATE:
+ startTagTemplateInHead(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ errStrayStartTag(name);
+ break starttagloop;
+ }
+ case AFTER_BODY:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ default:
+ errStrayStartTag(name);
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ continue;
+ }
+ case IN_FRAMESET:
+ switch (group) {
+ case FRAMESET:
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ case FRAME:
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ // fall through to AFTER_FRAMESET
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case AFTER_FRAMESET:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case NOFRAMES:
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RAWTEXT, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ errStrayStartTag(name);
+ break starttagloop;
+ }
+ case INITIAL:
+ /*
+ * Parse error.
+ */
+ errStartTagWithoutDoctype();
+ /*
+ *
+ * Set the document to quirks mode.
+ */
+ documentModeInternal(DocumentMode.QUIRKS_MODE, null, null);
+ /*
+ * Then, switch to the root element mode of the tree
+ * construction stage
+ */
+ mode = BEFORE_HTML;
+ /*
+ * and reprocess the current token.
+ */
+ continue;
+ case BEFORE_HTML:
+ switch (group) {
+ case HTML:
+ // optimize error check and streaming SAX by
+ // hoisting
+ // "html" handling here.
+ if (attributes == HtmlAttributes.EMPTY_ATTRIBUTES) {
+ // This has the right magic side effect
+ // that
+ // it
+ // makes attributes in SAX Tree mutable.
+ appendHtmlElementToDocumentAndPush();
+ } else {
+ appendHtmlElementToDocumentAndPush(attributes);
+ }
+ // XXX application cache should fire here
+ mode = BEFORE_HEAD;
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ /*
+ * Create an HTMLElement node with the tag name
+ * html, in the HTML namespace. Append it to the
+ * Document object.
+ */
+ appendHtmlElementToDocumentAndPush();
+ /* Switch to the main mode */
+ mode = BEFORE_HEAD;
+ /*
+ * reprocess the current token.
+ */
+ continue;
+ }
+ case BEFORE_HEAD:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case HEAD:
+ /*
+ * A start tag whose tag name is "head"
+ *
+ * Create an element for the token.
+ *
+ * Set the head element pointer to this new element
+ * node.
+ *
+ * Append the new element to the current node and
+ * push it onto the stack of open elements.
+ */
+ appendToCurrentNodeAndPushHeadElement(attributes);
+ /*
+ * Change the insertion mode to "in head".
+ */
+ mode = IN_HEAD;
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ /*
+ * Any other start tag token
+ *
+ * Act as if a start tag token with the tag name
+ * "head" and no attributes had been seen,
+ */
+ appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_HEAD;
+ /*
+ * then reprocess the current token.
+ *
+ * This will result in an empty head element being
+ * generated, with the current token being
+ * reprocessed in the "after head" insertion mode.
+ */
+ continue;
+ }
+ case AFTER_HEAD:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case BODY:
+ if (attributes.getLength() == 0) {
+ // This has the right magic side effect
+ // that
+ // it
+ // makes attributes in SAX Tree mutable.
+ appendToCurrentNodeAndPushBodyElement();
+ } else {
+ appendToCurrentNodeAndPushBodyElement(attributes);
+ }
+ framesetOk = false;
+ mode = IN_BODY;
+ attributes = null; // CPP
+ break starttagloop;
+ case FRAMESET:
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ mode = IN_FRAMESET;
+ attributes = null; // CPP
+ break starttagloop;
+ case TEMPLATE:
+ errFooBetweenHeadAndBody(name);
+ pushHeadPointerOntoStack();
+ StackNode<T> headOnStack = stack[currentPtr];
+ startTagTemplateInHead(elementName, attributes);
+ removeFromStack(headOnStack);
+ attributes = null; // CPP
+ break starttagloop;
+ case BASE:
+ case LINK_OR_BASEFONT_OR_BGSOUND:
+ errFooBetweenHeadAndBody(name);
+ pushHeadPointerOntoStack();
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ pop(); // head
+ attributes = null; // CPP
+ break starttagloop;
+ case META:
+ errFooBetweenHeadAndBody(name);
+ checkMetaCharset(attributes);
+ pushHeadPointerOntoStack();
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ attributes);
+ selfClosing = false;
+ pop(); // head
+ attributes = null; // CPP
+ break starttagloop;
+ case SCRIPT:
+ errFooBetweenHeadAndBody(name);
+ pushHeadPointerOntoStack();
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.SCRIPT_DATA, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case STYLE:
+ case NOFRAMES:
+ errFooBetweenHeadAndBody(name);
+ pushHeadPointerOntoStack();
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RAWTEXT, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case TITLE:
+ errFooBetweenHeadAndBody(name);
+ pushHeadPointerOntoStack();
+ appendToCurrentNodeAndPushElement(
+ elementName,
+ attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(
+ Tokenizer.RCDATA, elementName);
+ attributes = null; // CPP
+ break starttagloop;
+ case HEAD:
+ errStrayStartTag(name);
+ break starttagloop;
+ default:
+ appendToCurrentNodeAndPushBodyElement();
+ mode = FRAMESET_OK;
+ continue;
+ }
+ case AFTER_AFTER_BODY:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ default:
+ errStrayStartTag(name);
+ fatal();
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ continue;
+ }
+ case AFTER_AFTER_FRAMESET:
+ switch (group) {
+ case HTML:
+ errStrayStartTag(name);
+ if (!fragment && !isTemplateContents()) {
+ addAttributesToHtml(attributes);
+ attributes = null; // CPP
+ }
+ break starttagloop;
+ case NOFRAMES:
+ startTagGenericRawText(elementName, attributes);
+ attributes = null; // CPP
+ break starttagloop;
+ default:
+ errStrayStartTag(name);
+ break starttagloop;
+ }
+ case TEXT:
+ assert false;
+ break starttagloop; // Avoid infinite loop if the assertion
+ // fails
+ }
+ }
+ if (selfClosing) {
+ errSelfClosing();
+ }
+ // CPPONLY: if (mBuilder == null && attributes != HtmlAttributes.EMPTY_ATTRIBUTES) {
+ // CPPONLY: Portability.delete(attributes);
+ // CPPONLY: }
+ }
+
+ private void startTagTitleInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(Tokenizer.RCDATA, elementName);
+ }
+
+ private void startTagGenericRawText(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(Tokenizer.RAWTEXT, elementName);
+ }
+
+ private void startTagScriptInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ // XXX need to manage much more stuff here if supporting document.write()
+ appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
+ originalMode = mode;
+ mode = TEXT;
+ tokenizer.setStateAndEndTagExpectation(Tokenizer.SCRIPT_DATA, elementName);
+ }
+
+ private void startTagTemplateInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
+ appendToCurrentNodeAndPushElement(elementName, attributes);
+ insertMarker();
+ framesetOk = false;
+ originalMode = mode;
+ mode = IN_TEMPLATE;
+ pushTemplateMode(IN_TEMPLATE);
+ }
+
+ private boolean isTemplateContents() {
+ return TreeBuilder.NOT_FOUND_ON_STACK != findLast("template");
+ }
+
+ private boolean isTemplateModeStackEmpty() {
+ return templateModePtr == -1;
+ }
+
+ private boolean isSpecialParentInForeign(StackNode<T> stackNode) {
+ @NsUri String ns = stackNode.ns;
+ return ("http://www.w3.org/1999/xhtml" == ns)
+ || (stackNode.isHtmlIntegrationPoint())
+ || (("http://www.w3.org/1998/Math/MathML" == ns) && (stackNode.getGroup() == MI_MO_MN_MS_MTEXT));
+ }
+
+ /**
+ *
+ * <p>
+ * C++ memory note: The return value must be released.
+ *
+ * @return
+ * @throws SAXException
+ * @throws StopSniffingException
+ */
+ public static String extractCharsetFromContent(String attributeValue
+ // CPPONLY: , TreeBuilder tb
+ ) {
+ // This is a bit ugly. Converting the string to char array in order to
+ // make the portability layer smaller.
+ int charsetState = CHARSET_INITIAL;
+ int start = -1;
+ int end = -1;
+ @Auto char[] buffer = Portability.newCharArrayFromString(attributeValue);
+
+ charsetloop: for (int i = 0; i < buffer.length; i++) {
+ char c = buffer[i];
+ switch (charsetState) {
+ case CHARSET_INITIAL:
+ switch (c) {
+ case 'c':
+ case 'C':
+ charsetState = CHARSET_C;
+ continue;
+ default:
+ continue;
+ }
+ case CHARSET_C:
+ switch (c) {
+ case 'h':
+ case 'H':
+ charsetState = CHARSET_H;
+ continue;
+ default:
+ charsetState = CHARSET_INITIAL;
+ continue;
+ }
+ case CHARSET_H:
+ switch (c) {
+ case 'a':
+ case 'A':
+ charsetState = CHARSET_A;
+ continue;
+ default:
+ charsetState = CHARSET_INITIAL;
+ continue;
+ }
+ case CHARSET_A:
+ switch (c) {
+ case 'r':
+ case 'R':
+ charsetState = CHARSET_R;
+ continue;
+ default:
+ charsetState = CHARSET_INITIAL;
+ continue;
+ }
+ case CHARSET_R:
+ switch (c) {
+ case 's':
+ case 'S':
+ charsetState = CHARSET_S;
+ continue;
+ default:
+ charsetState = CHARSET_INITIAL;
+ continue;
+ }
+ case CHARSET_S:
+ switch (c) {
+ case 'e':
+ case 'E':
+ charsetState = CHARSET_E;
+ continue;
+ default:
+ charsetState = CHARSET_INITIAL;
+ continue;
+ }
+ case CHARSET_E:
+ switch (c) {
+ case 't':
+ case 'T':
+ charsetState = CHARSET_T;
+ continue;
+ default:
+ charsetState = CHARSET_INITIAL;
+ continue;
+ }
+ case CHARSET_T:
+ switch (c) {
+ case '\t':
+ case '\n':
+ case '\u000C':
+ case '\r':
+ case ' ':
+ continue;
+ case '=':
+ charsetState = CHARSET_EQUALS;
+ continue;
+ default:
+ return null;
+ }
+ case CHARSET_EQUALS:
+ switch (c) {
+ case '\t':
+ case '\n':
+ case '\u000C':
+ case '\r':
+ case ' ':
+ continue;
+ case '\'':
+ start = i + 1;
+ charsetState = CHARSET_SINGLE_QUOTED;
+ continue;
+ case '\"':
+ start = i + 1;
+ charsetState = CHARSET_DOUBLE_QUOTED;
+ continue;
+ default:
+ start = i;
+ charsetState = CHARSET_UNQUOTED;
+ continue;
+ }
+ case CHARSET_SINGLE_QUOTED:
+ switch (c) {
+ case '\'':
+ end = i;
+ break charsetloop;
+ default:
+ continue;
+ }
+ case CHARSET_DOUBLE_QUOTED:
+ switch (c) {
+ case '\"':
+ end = i;
+ break charsetloop;
+ default:
+ continue;
+ }
+ case CHARSET_UNQUOTED:
+ switch (c) {
+ case '\t':
+ case '\n':
+ case '\u000C':
+ case '\r':
+ case ' ':
+ case ';':
+ end = i;
+ break charsetloop;
+ default:
+ continue;
+ }
+ }
+ }
+ if (start != -1) {
+ if (end == -1) {
+ if (charsetState == CHARSET_UNQUOTED) {
+ end = buffer.length;
+ } else {
+ return null;
+ }
+ }
+ return Portability.newStringFromBuffer(buffer, start, end
+ - start
+ // CPPONLY: , tb, false
+ );
+ }
+ return null;
+ }
+
+ private void checkMetaCharset(HtmlAttributes attributes)
+ throws SAXException {
+ String charset = attributes.getValue(AttributeName.CHARSET);
+ if (charset != null) {
+ if (tokenizer.internalEncodingDeclaration(charset)) {
+ requestSuspension();
+ return;
+ }
+ return;
+ }
+ if (!Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "content-type",
+ attributes.getValue(AttributeName.HTTP_EQUIV))) {
+ return;
+ }
+ String content = attributes.getValue(AttributeName.CONTENT);
+ if (content != null) {
+ String extract = TreeBuilder.extractCharsetFromContent(content
+ // CPPONLY: , this
+ );
+ // remember not to return early without releasing the string
+ if (extract != null) {
+ if (tokenizer.internalEncodingDeclaration(extract)) {
+ requestSuspension();
+ }
+ }
+ Portability.releaseString(extract);
+ }
+ }
+
+ public final void endTag(ElementName elementName) throws SAXException {
+ flushCharacters();
+ needToDropLF = false;
+ int eltPos;
+ int group = elementName.getGroup();
+ @Local String name = elementName.getName();
+ endtagloop: for (;;) {
+ if (isInForeign()) {
+ if (stack[currentPtr].name != name) {
+ if (currentPtr == 0) {
+ errStrayEndTag(name);
+ } else {
+ errEndTagDidNotMatchCurrentOpenElement(name, stack[currentPtr].popName);
+ }
+ }
+ eltPos = currentPtr;
+ int origPos = currentPtr;
+ for (;;) {
+ if (eltPos == 0) {
+ assert fragment: "We can get this close to the root of the stack in foreign content only in the fragment case.";
+ break endtagloop;
+ }
+ if (stack[eltPos].name == name) {
+ while (currentPtr >= eltPos) {
+ popForeign(origPos, eltPos);
+ }
+ break endtagloop;
+ }
+ if (stack[--eltPos].ns == "http://www.w3.org/1999/xhtml") {
+ break;
+ }
+ }
+ }
+ switch (mode) {
+ case IN_TEMPLATE:
+ switch (group) {
+ case TEMPLATE:
+ // fall through to IN_HEAD
+ break;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_ROW:
+ switch (group) {
+ case TR:
+ eltPos = findLastOrRoot(TreeBuilder.TR);
+ if (eltPos == 0) {
+ assert fragment || isTemplateContents();
+ errNoTableRowToClose();
+ break endtagloop;
+ }
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE_BODY;
+ break endtagloop;
+ case TABLE:
+ eltPos = findLastOrRoot(TreeBuilder.TR);
+ if (eltPos == 0) {
+ assert fragment || isTemplateContents();
+ errNoTableRowToClose();
+ break endtagloop;
+ }
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE_BODY;
+ continue;
+ case TBODY_OR_THEAD_OR_TFOOT:
+ if (findLastInTableScope(name) == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ eltPos = findLastOrRoot(TreeBuilder.TR);
+ if (eltPos == 0) {
+ assert fragment || isTemplateContents();
+ errNoTableRowToClose();
+ break endtagloop;
+ }
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE_BODY;
+ continue;
+ case BODY:
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case HTML:
+ case TD_OR_TH:
+ errStrayEndTag(name);
+ break endtagloop;
+ default:
+ // fall through to IN_TABLE
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_TABLE_BODY:
+ switch (group) {
+ case TBODY_OR_THEAD_OR_TFOOT:
+ eltPos = findLastOrRoot(name);
+ if (eltPos == 0) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE;
+ break endtagloop;
+ case TABLE:
+ eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
+ if (eltPos == 0 || stack[eltPos].getGroup() == TEMPLATE) {
+ assert fragment || isTemplateContents();
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ clearStackBackTo(eltPos);
+ pop();
+ mode = IN_TABLE;
+ continue;
+ case BODY:
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case HTML:
+ case TD_OR_TH:
+ case TR:
+ errStrayEndTag(name);
+ break endtagloop;
+ default:
+ // fall through to IN_TABLE
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_TABLE:
+ switch (group) {
+ case TABLE:
+ eltPos = findLast("table");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment || isTemplateContents();
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ break endtagloop;
+ case BODY:
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case HTML:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TD_OR_TH:
+ case TR:
+ errStrayEndTag(name);
+ break endtagloop;
+ case TEMPLATE:
+ // fall through to IN_HEAD
+ break;
+ default:
+ errStrayEndTag(name);
+ // fall through to IN_BODY
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_CAPTION:
+ switch (group) {
+ case CAPTION:
+ eltPos = findLastInTableScope("caption");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ break endtagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && currentPtr != eltPos) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ mode = IN_TABLE;
+ break endtagloop;
+ case TABLE:
+ eltPos = findLastInTableScope("caption");
+
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment || isTemplateContents();
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && currentPtr != eltPos) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ mode = IN_TABLE;
+ continue;
+ case BODY:
+ case COL:
+ case COLGROUP:
+ case HTML:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TD_OR_TH:
+ case TR:
+ errStrayEndTag(name);
+ break endtagloop;
+ default:
+ // fall through to IN_BODY
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_CELL:
+ switch (group) {
+ case TD_OR_TH:
+ eltPos = findLastInTableScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ mode = IN_ROW;
+ break endtagloop;
+ case TABLE:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ if (findLastInTableScope(name) == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert name == "tbody" || name == "tfoot" || name == "thead" || fragment || isTemplateContents();
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ closeTheCell(findLastInTableScopeTdTh());
+ continue;
+ case BODY:
+ case CAPTION:
+ case COL:
+ case COLGROUP:
+ case HTML:
+ errStrayEndTag(name);
+ break endtagloop;
+ default:
+ // fall through to IN_BODY
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case FRAMESET_OK:
+ case IN_BODY:
+ switch (group) {
+ case BODY:
+ if (!isSecondOnStackBody()) {
+ assert fragment || isTemplateContents();
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ assert currentPtr >= 1;
+ if (errorHandler != null) {
+ uncloseloop1: for (int i = 2; i <= currentPtr; i++) {
+ switch (stack[i].getGroup()) {
+ case DD_OR_DT:
+ case LI:
+ case OPTGROUP:
+ case OPTION: // is this possible?
+ case P:
+ case RB_OR_RTC:
+ case RT_OR_RP:
+ case TD_OR_TH:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ break;
+ default:
+ errEndWithUnclosedElements(name);
+ break uncloseloop1;
+ }
+ }
+ }
+ mode = AFTER_BODY;
+ break endtagloop;
+ case HTML:
+ if (!isSecondOnStackBody()) {
+ assert fragment || isTemplateContents();
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ if (errorHandler != null) {
+ uncloseloop2: for (int i = 0; i <= currentPtr; i++) {
+ switch (stack[i].getGroup()) {
+ case DD_OR_DT:
+ case LI:
+ case P:
+ case RB_OR_RTC:
+ case RT_OR_RP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TD_OR_TH:
+ case BODY:
+ case HTML:
+ break;
+ default:
+ errEndWithUnclosedElements(name);
+ break uncloseloop2;
+ }
+ }
+ }
+ mode = AFTER_BODY;
+ continue;
+ case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
+ case UL_OR_OL_OR_DL:
+ case PRE_OR_LISTING:
+ case FIELDSET:
+ case BUTTON:
+ case ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
+ eltPos = findLastInScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ } else {
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ }
+ break endtagloop;
+ case FORM:
+ if (!isTemplateContents()) {
+ if (formPointer == null) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ formPointer = null;
+ eltPos = findLastInScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ removeFromStack(eltPos);
+ break endtagloop;
+ } else {
+ eltPos = findLastInScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ break endtagloop;
+ }
+ case P:
+ eltPos = findLastInButtonScope("p");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errNoElementToCloseButEndTagSeen("p");
+ // XXX Can the 'in foreign' case happen anymore?
+ if (isInForeign()) {
+ errHtmlStartTagInForeignContext(name);
+ // Check for currentPtr for the fragment
+ // case.
+ while (currentPtr >= 0 && stack[currentPtr].ns != "http://www.w3.org/1999/xhtml") {
+ pop();
+ }
+ }
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ HtmlAttributes.EMPTY_ATTRIBUTES);
+ break endtagloop;
+ }
+ generateImpliedEndTagsExceptFor("p");
+ assert eltPos != TreeBuilder.NOT_FOUND_ON_STACK;
+ if (errorHandler != null && eltPos != currentPtr) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ break endtagloop;
+ case LI:
+ eltPos = findLastInListScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errNoElementToCloseButEndTagSeen(name);
+ } else {
+ generateImpliedEndTagsExceptFor(name);
+ if (errorHandler != null
+ && eltPos != currentPtr) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ }
+ break endtagloop;
+ case DD_OR_DT:
+ eltPos = findLastInScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errNoElementToCloseButEndTagSeen(name);
+ } else {
+ generateImpliedEndTagsExceptFor(name);
+ if (errorHandler != null
+ && eltPos != currentPtr) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ }
+ break endtagloop;
+ case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
+ eltPos = findLastInScopeHn();
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ } else {
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ }
+ break endtagloop;
+ case OBJECT:
+ case MARQUEE_OR_APPLET:
+ eltPos = findLastInScope(name);
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag(name);
+ } else {
+ generateImpliedEndTags();
+ if (errorHandler != null && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ }
+ break endtagloop;
+ case BR:
+ errEndTagBr();
+ if (isInForeign()) {
+ // XXX can this happen anymore?
+ errHtmlStartTagInForeignContext(name);
+ // Check for currentPtr for the fragment
+ // case.
+ while (currentPtr >= 0 && stack[currentPtr].ns != "http://www.w3.org/1999/xhtml") {
+ pop();
+ }
+ }
+ reconstructTheActiveFormattingElements();
+ appendVoidElementToCurrentMayFoster(
+ elementName,
+ HtmlAttributes.EMPTY_ATTRIBUTES);
+ break endtagloop;
+ case TEMPLATE:
+ // fall through to IN_HEAD;
+ break;
+ case AREA_OR_WBR:
+ case KEYGEN: // XXX??
+ case PARAM_OR_SOURCE_OR_TRACK:
+ case EMBED:
+ case IMG:
+ case IMAGE:
+ case INPUT:
+ case HR:
+ case IFRAME:
+ case NOEMBED: // XXX???
+ case NOFRAMES: // XXX??
+ case SELECT:
+ case TABLE:
+ case TEXTAREA: // XXX??
+ errStrayEndTag(name);
+ break endtagloop;
+ case NOSCRIPT:
+ if (scriptingEnabled) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case A:
+ case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
+ case FONT:
+ case NOBR:
+ if (adoptionAgencyEndTag(name)) {
+ break endtagloop;
+ }
+ // else handle like any other tag
+ // CPPONLY: MOZ_FALLTHROUGH;
+ default:
+ if (isCurrent(name)) {
+ pop();
+ break endtagloop;
+ }
+
+ eltPos = currentPtr;
+ for (;;) {
+ StackNode<T> node = stack[eltPos];
+ if (node.ns == "http://www.w3.org/1999/xhtml" && node.name == name) {
+ generateImpliedEndTags();
+ if (errorHandler != null
+ && !isCurrent(name)) {
+ errUnclosedElements(eltPos, name);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ break endtagloop;
+ } else if (eltPos == 0 || node.isSpecial()) {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ eltPos--;
+ }
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_HEAD:
+ switch (group) {
+ case HEAD:
+ pop();
+ mode = AFTER_HEAD;
+ break endtagloop;
+ case BR:
+ case HTML:
+ case BODY:
+ pop();
+ mode = AFTER_HEAD;
+ continue;
+ case TEMPLATE:
+ endTagTemplateInHead();
+ break endtagloop;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case IN_HEAD_NOSCRIPT:
+ switch (group) {
+ case NOSCRIPT:
+ pop();
+ mode = IN_HEAD;
+ break endtagloop;
+ case BR:
+ errStrayEndTag(name);
+ pop();
+ mode = IN_HEAD;
+ continue;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case IN_COLUMN_GROUP:
+ switch (group) {
+ case COLGROUP:
+ if (currentPtr == 0 || stack[currentPtr].getGroup() ==
+ TreeBuilder.TEMPLATE) {
+ assert fragment || isTemplateContents();
+ errGarbageInColgroup();
+ break endtagloop;
+ }
+ pop();
+ mode = IN_TABLE;
+ break endtagloop;
+ case COL:
+ errStrayEndTag(name);
+ break endtagloop;
+ case TEMPLATE:
+ endTagTemplateInHead();
+ break endtagloop;
+ default:
+ if (currentPtr == 0 || stack[currentPtr].getGroup() ==
+ TreeBuilder.TEMPLATE) {
+ assert fragment || isTemplateContents();
+ errGarbageInColgroup();
+ break endtagloop;
+ }
+ pop();
+ mode = IN_TABLE;
+ continue;
+ }
+ case IN_SELECT_IN_TABLE:
+ switch (group) {
+ case CAPTION:
+ case TABLE:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TR:
+ case TD_OR_TH:
+ errEndTagSeenWithSelectOpen(name);
+ if (findLastInTableScope(name) != TreeBuilder.NOT_FOUND_ON_STACK) {
+ eltPos = findLastInTableScope("select");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment;
+ break endtagloop; // http://www.w3.org/Bugs/Public/show_bug.cgi?id=8375
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ continue;
+ } else {
+ break endtagloop;
+ }
+ default:
+ // fall through to IN_SELECT
+ }
+ // CPPONLY: MOZ_FALLTHROUGH;
+ case IN_SELECT:
+ switch (group) {
+ case OPTION:
+ if (isCurrent("option")) {
+ pop();
+ break endtagloop;
+ } else {
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case OPTGROUP:
+ if (isCurrent("option")
+ && "optgroup" == stack[currentPtr - 1].name) {
+ pop();
+ }
+ if (isCurrent("optgroup")) {
+ pop();
+ } else {
+ errStrayEndTag(name);
+ }
+ break endtagloop;
+ case SELECT:
+ eltPos = findLastInTableScope("select");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ assert fragment;
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ resetTheInsertionMode();
+ break endtagloop;
+ case TEMPLATE:
+ endTagTemplateInHead();
+ break endtagloop;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case AFTER_BODY:
+ switch (group) {
+ case HTML:
+ if (fragment) {
+ errStrayEndTag(name);
+ break endtagloop;
+ } else {
+ mode = AFTER_AFTER_BODY;
+ break endtagloop;
+ }
+ default:
+ errEndTagAfterBody();
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ continue;
+ }
+ case IN_FRAMESET:
+ switch (group) {
+ case FRAMESET:
+ if (currentPtr == 0) {
+ assert fragment;
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ pop();
+ if ((!fragment) && !isCurrent("frameset")) {
+ mode = AFTER_FRAMESET;
+ }
+ break endtagloop;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case AFTER_FRAMESET:
+ switch (group) {
+ case HTML:
+ mode = AFTER_AFTER_FRAMESET;
+ break endtagloop;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case INITIAL:
+ /*
+ * Parse error.
+ */
+ errEndTagSeenWithoutDoctype();
+ /*
+ *
+ * Set the document to quirks mode.
+ */
+ documentModeInternal(DocumentMode.QUIRKS_MODE, null, null);
+ /*
+ * Then, switch to the root element mode of the tree
+ * construction stage
+ */
+ mode = BEFORE_HTML;
+ /*
+ * and reprocess the current token.
+ */
+ continue;
+ case BEFORE_HTML:
+ switch (group) {
+ case HEAD:
+ case BR:
+ case HTML:
+ case BODY:
+ /*
+ * Create an HTMLElement node with the tag name
+ * html, in the HTML namespace. Append it to the
+ * Document object.
+ */
+ appendHtmlElementToDocumentAndPush();
+ /* Switch to the main mode */
+ mode = BEFORE_HEAD;
+ /*
+ * reprocess the current token.
+ */
+ continue;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case BEFORE_HEAD:
+ switch (group) {
+ case HEAD:
+ case BR:
+ case HTML:
+ case BODY:
+ appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
+ mode = IN_HEAD;
+ continue;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case AFTER_HEAD:
+ switch (group) {
+ case TEMPLATE:
+ endTagTemplateInHead();
+ break endtagloop;
+ case HTML:
+ case BODY:
+ case BR:
+ appendToCurrentNodeAndPushBodyElement();
+ mode = FRAMESET_OK;
+ continue;
+ default:
+ errStrayEndTag(name);
+ break endtagloop;
+ }
+ case AFTER_AFTER_BODY:
+ errStrayEndTag(name);
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ continue;
+ case AFTER_AFTER_FRAMESET:
+ errStrayEndTag(name);
+ break endtagloop;
+ case TEXT:
+ // XXX need to manage insertion point here
+ pop();
+ if (originalMode == AFTER_HEAD) {
+ silentPop();
+ }
+ mode = originalMode;
+ break endtagloop;
+ }
+ } // endtagloop
+ }
+
+ private void endTagTemplateInHead() throws SAXException {
+ int eltPos = findLast("template");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ errStrayEndTag("template");
+ return;
+ }
+ generateImpliedEndTagsThoroughly();
+ if (errorHandler != null && !isCurrent("template")) {
+ errUnclosedElements(eltPos, "template");
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ popTemplateMode();
+ resetTheInsertionMode();
+ }
+
+ private int findLastInTableScopeOrRootTemplateTbodyTheadTfoot() {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml"
+ && (stack[i].getGroup() == TreeBuilder.TBODY_OR_THEAD_OR_TFOOT
+ || stack[i].getGroup() == TreeBuilder.TEMPLATE)) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ private int findLast(@Local String name) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].name == name) {
+ return i;
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private int findLastInTableScope(@Local String name) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
+ if (stack[i].name == name) {
+ return i;
+ } else if (stack[i].name == "table" || stack[i].name == "template") {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private int findLastInButtonScope(@Local String name) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
+ if (stack[i].name == name) {
+ return i;
+ } else if (stack[i].name == "button") {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+
+ if (stack[i].isScoping()) {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private int findLastInScope(@Local String name) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].name == name) {
+ return i;
+ } else if (stack[i].isScoping()) {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private int findLastInListScope(@Local String name) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
+ if (stack[i].name == name) {
+ return i;
+ } else if (stack[i].name == "ul" || stack[i].name == "ol") {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+
+ if (stack[i].isScoping()) {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private int findLastInScopeHn() {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].getGroup() == TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) {
+ return i;
+ } else if (stack[i].isScoping()) {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private void generateImpliedEndTagsExceptFor(@Local String name)
+ throws SAXException {
+ for (;;) {
+ StackNode<T> node = stack[currentPtr];
+ switch (node.getGroup()) {
+ case P:
+ case LI:
+ case DD_OR_DT:
+ case OPTION:
+ case OPTGROUP:
+ case RB_OR_RTC:
+ case RT_OR_RP:
+ if (node.ns == "http://www.w3.org/1999/xhtml" && node.name == name) {
+ return;
+ }
+ pop();
+ continue;
+ default:
+ return;
+ }
+ }
+ }
+
+ private void generateImpliedEndTags() throws SAXException {
+ for (;;) {
+ switch (stack[currentPtr].getGroup()) {
+ case P:
+ case LI:
+ case DD_OR_DT:
+ case OPTION:
+ case OPTGROUP:
+ case RB_OR_RTC:
+ case RT_OR_RP:
+ pop();
+ continue;
+ default:
+ return;
+ }
+ }
+ }
+
+ private void generateImpliedEndTagsThoroughly() throws SAXException {
+ for (;;) {
+ switch (stack[currentPtr].getGroup()) {
+ case CAPTION:
+ case COLGROUP:
+ case DD_OR_DT:
+ case LI:
+ case OPTGROUP:
+ case OPTION:
+ case P:
+ case RB_OR_RTC:
+ case RT_OR_RP:
+ case TBODY_OR_THEAD_OR_TFOOT:
+ case TD_OR_TH:
+ case TR:
+ pop();
+ continue;
+ default:
+ return;
+ }
+ }
+ }
+
+ private boolean isSecondOnStackBody() {
+ return currentPtr >= 1 && stack[1].getGroup() == TreeBuilder.BODY;
+ }
+
+ private void documentModeInternal(DocumentMode m, String publicIdentifier,
+ String systemIdentifier)
+ throws SAXException {
+
+ if (forceNoQuirks) {
+ // Srcdoc documents are always rendered in standards mode.
+ quirks = false;
+ if (documentModeHandler != null) {
+ documentModeHandler.documentMode(
+ DocumentMode.STANDARDS_MODE
+ // [NOCPP[
+ , null, null
+ // ]NOCPP]
+ );
+ }
+ return;
+ }
+
+ quirks = (m == DocumentMode.QUIRKS_MODE);
+ if (documentModeHandler != null) {
+ documentModeHandler.documentMode(
+ m
+ // [NOCPP[
+ , publicIdentifier, systemIdentifier
+ // ]NOCPP]
+ );
+ }
+ // [NOCPP[
+ documentMode(m, publicIdentifier, systemIdentifier);
+ // ]NOCPP]
+ }
+
+ private boolean isAlmostStandards(String publicIdentifier,
+ String systemIdentifier) {
+ if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ "-//w3c//dtd xhtml 1.0 transitional//", publicIdentifier)) {
+ return true;
+ }
+ if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ "-//w3c//dtd xhtml 1.0 frameset//", publicIdentifier)) {
+ return true;
+ }
+ if (systemIdentifier != null) {
+ if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ "-//w3c//dtd html 4.01 transitional//", publicIdentifier)) {
+ return true;
+ }
+ if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ "-//w3c//dtd html 4.01 frameset//", publicIdentifier)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isQuirky(@Local String name, String publicIdentifier,
+ String systemIdentifier, boolean forceQuirks) {
+ if (forceQuirks) {
+ return true;
+ }
+ if (name != HTML_LOCAL) {
+ return true;
+ }
+ if (publicIdentifier != null) {
+ for (int i = 0; i < TreeBuilder.QUIRKY_PUBLIC_IDS.length; i++) {
+ if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ TreeBuilder.QUIRKY_PUBLIC_IDS[i], publicIdentifier)) {
+ return true;
+ }
+ }
+ if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "-//w3o//dtd w3 html strict 3.0//en//", publicIdentifier)
+ || Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "-/w3c/dtd html 4.0 transitional/en",
+ publicIdentifier)
+ || Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "html", publicIdentifier)) {
+ return true;
+ }
+ }
+ if (systemIdentifier == null) {
+ if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ "-//w3c//dtd html 4.01 transitional//", publicIdentifier)) {
+ return true;
+ } else if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
+ "-//w3c//dtd html 4.01 frameset//", publicIdentifier)) {
+ return true;
+ }
+ } else if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",
+ systemIdentifier)) {
+ return true;
+ }
+ return false;
+ }
+
+ private void closeTheCell(int eltPos) throws SAXException {
+ generateImpliedEndTags();
+ if (errorHandler != null && eltPos != currentPtr) {
+ errUnclosedElementsCell(eltPos);
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ clearTheListOfActiveFormattingElementsUpToTheLastMarker();
+ mode = IN_ROW;
+ return;
+ }
+
+ private int findLastInTableScopeTdTh() {
+ for (int i = currentPtr; i > 0; i--) {
+ @Local String name = stack[i].name;
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
+ if ("td" == name || "th" == name) {
+ return i;
+ } else if (name == "table" || name == "template") {
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+ }
+ }
+ return TreeBuilder.NOT_FOUND_ON_STACK;
+ }
+
+ private void clearStackBackTo(int eltPos) throws SAXException {
+ int eltGroup = stack[eltPos].getGroup();
+ while (currentPtr > eltPos) { // > not >= intentional
+ if (stack[currentPtr].ns == "http://www.w3.org/1999/xhtml"
+ && stack[currentPtr].getGroup() == TEMPLATE
+ && (eltGroup == TABLE || eltGroup == TBODY_OR_THEAD_OR_TFOOT|| eltGroup == TR || eltPos == 0)) {
+ return;
+ }
+ pop();
+ }
+ }
+
+ private void resetTheInsertionMode() {
+ StackNode<T> node;
+ @Local String name;
+ @NsUri String ns;
+ for (int i = currentPtr; i >= 0; i--) {
+ node = stack[i];
+ name = node.name;
+ ns = node.ns;
+ if (i == 0) {
+ if (!(contextNamespace == "http://www.w3.org/1999/xhtml" && (contextName == "td" || contextName == "th"))) {
+ if (fragment) {
+ // Make sure we are parsing a fragment otherwise the context element doesn't make sense.
+ name = contextName;
+ ns = contextNamespace;
+ }
+ } else {
+ mode = framesetOk ? FRAMESET_OK : IN_BODY; // XXX from Hixie's email
+ return;
+ }
+ }
+ if ("select" == name) {
+ int ancestorIndex = i;
+ while (ancestorIndex > 0) {
+ StackNode<T> ancestor = stack[ancestorIndex--];
+ if ("http://www.w3.org/1999/xhtml" == ancestor.ns) {
+ if ("template" == ancestor.name) {
+ break;
+ }
+ if ("table" == ancestor.name) {
+ mode = IN_SELECT_IN_TABLE;
+ return;
+ }
+ }
+ }
+ mode = IN_SELECT;
+ return;
+ } else if ("td" == name || "th" == name) {
+ mode = IN_CELL;
+ return;
+ } else if ("tr" == name) {
+ mode = IN_ROW;
+ return;
+ } else if ("tbody" == name || "thead" == name || "tfoot" == name) {
+ mode = IN_TABLE_BODY;
+ return;
+ } else if ("caption" == name) {
+ mode = IN_CAPTION;
+ return;
+ } else if ("colgroup" == name) {
+ mode = IN_COLUMN_GROUP;
+ return;
+ } else if ("table" == name) {
+ mode = IN_TABLE;
+ return;
+ } else if ("http://www.w3.org/1999/xhtml" != ns) {
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ return;
+ } else if ("template" == name) {
+ assert templateModePtr >= 0;
+ mode = templateModeStack[templateModePtr];
+ return;
+ } else if ("head" == name) {
+ if (name == contextName) {
+ mode = framesetOk ? FRAMESET_OK : IN_BODY; // really
+ } else {
+ mode = IN_HEAD;
+ }
+ return;
+ } else if ("body" == name) {
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ return;
+ } else if ("frameset" == name) {
+ // TODO: Fragment case. Add error reporting.
+ mode = IN_FRAMESET;
+ return;
+ } else if ("html" == name) {
+ if (headPointer == null) {
+ // TODO: Fragment case. Add error reporting.
+ mode = BEFORE_HEAD;
+ } else {
+ mode = AFTER_HEAD;
+ }
+ return;
+ } else if (i == 0) {
+ mode = framesetOk ? FRAMESET_OK : IN_BODY;
+ return;
+ }
+ }
+ }
+
+ /**
+ * @throws SAXException
+ *
+ */
+ private void implicitlyCloseP() throws SAXException {
+ int eltPos = findLastInButtonScope("p");
+ if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
+ return;
+ }
+ generateImpliedEndTagsExceptFor("p");
+ if (errorHandler != null && eltPos != currentPtr) {
+ errUnclosedElementsImplied(eltPos, "p");
+ }
+ while (currentPtr >= eltPos) {
+ pop();
+ }
+ }
+
+ private boolean debugOnlyClearLastStackSlot() {
+ stack[currentPtr] = null;
+ return true;
+ }
+
+ private boolean debugOnlyClearLastListSlot() {
+ listOfActiveFormattingElements[listPtr] = null;
+ return true;
+ }
+
+ private void pushTemplateMode(int mode) {
+ templateModePtr++;
+ if (templateModePtr == templateModeStack.length) {
+ int[] newStack = new int[templateModeStack.length + 64];
+ System.arraycopy(templateModeStack, 0, newStack, 0, templateModeStack.length);
+ templateModeStack = newStack;
+ }
+ templateModeStack[templateModePtr] = mode;
+ }
+
+ @SuppressWarnings("unchecked") private void push(StackNode<T> node) throws SAXException {
+ currentPtr++;
+ if (currentPtr == stack.length) {
+ StackNode<T>[] newStack = new StackNode[stack.length + 64];
+ System.arraycopy(stack, 0, newStack, 0, stack.length);
+ stack = newStack;
+ }
+ stack[currentPtr] = node;
+ elementPushed(node.ns, node.popName, node.node);
+ }
+
+ @SuppressWarnings("unchecked") private void silentPush(StackNode<T> node) throws SAXException {
+ currentPtr++;
+ if (currentPtr == stack.length) {
+ StackNode<T>[] newStack = new StackNode[stack.length + 64];
+ System.arraycopy(stack, 0, newStack, 0, stack.length);
+ stack = newStack;
+ }
+ stack[currentPtr] = node;
+ }
+
+ @SuppressWarnings("unchecked") private void append(StackNode<T> node) {
+ listPtr++;
+ if (listPtr == listOfActiveFormattingElements.length) {
+ StackNode<T>[] newList = new StackNode[listOfActiveFormattingElements.length + 64];
+ System.arraycopy(listOfActiveFormattingElements, 0, newList, 0,
+ listOfActiveFormattingElements.length);
+ listOfActiveFormattingElements = newList;
+ }
+ listOfActiveFormattingElements[listPtr] = node;
+ }
+
+ @Inline private void insertMarker() {
+ append(null);
+ }
+
+ private void clearTheListOfActiveFormattingElementsUpToTheLastMarker() {
+ while (listPtr > -1) {
+ if (listOfActiveFormattingElements[listPtr] == null) {
+ --listPtr;
+ return;
+ }
+ listOfActiveFormattingElements[listPtr].release(this);
+ --listPtr;
+ }
+ }
+
+ @Inline private boolean isCurrent(@Local String name) {
+ return stack[currentPtr].ns == "http://www.w3.org/1999/xhtml" &&
+ name == stack[currentPtr].name;
+ }
+
+ private void removeFromStack(int pos) throws SAXException {
+ if (currentPtr == pos) {
+ pop();
+ } else {
+ fatal();
+ stack[pos].release(this);
+ System.arraycopy(stack, pos + 1, stack, pos, currentPtr - pos);
+ assert debugOnlyClearLastStackSlot();
+ currentPtr--;
+ }
+ }
+
+ private void removeFromStack(StackNode<T> node) throws SAXException {
+ if (stack[currentPtr] == node) {
+ pop();
+ } else {
+ int pos = currentPtr - 1;
+ while (pos >= 0 && stack[pos] != node) {
+ pos--;
+ }
+ if (pos == -1) {
+ // dead code?
+ return;
+ }
+ fatal();
+ node.release(this);
+ System.arraycopy(stack, pos + 1, stack, pos, currentPtr - pos);
+ currentPtr--;
+ }
+ }
+
+ private void removeFromListOfActiveFormattingElements(int pos) {
+ assert listOfActiveFormattingElements[pos] != null;
+ listOfActiveFormattingElements[pos].release(this);
+ if (pos == listPtr) {
+ assert debugOnlyClearLastListSlot();
+ listPtr--;
+ return;
+ }
+ assert pos < listPtr;
+ System.arraycopy(listOfActiveFormattingElements, pos + 1,
+ listOfActiveFormattingElements, pos, listPtr - pos);
+ assert debugOnlyClearLastListSlot();
+ listPtr--;
+ }
+
+ /**
+ * Adoption agency algorithm.
+ *
+ * @param name subject as described in the specified algorithm.
+ * @return Returns true if the algorithm has completed and there is nothing remaining to
+ * be done. Returns false if the algorithm needs to "act as described in the 'any other
+ * end tag' entry" as described in the specified algorithm.
+ * @throws SAXException
+ */
+ private boolean adoptionAgencyEndTag(@Local String name) throws SAXException {
+ // This check intends to ensure that for properly nested tags, closing tags will match
+ // against the stack instead of the listOfActiveFormattingElements.
+ if (stack[currentPtr].ns == "http://www.w3.org/1999/xhtml" &&
+ stack[currentPtr].name == name &&
+ findInListOfActiveFormattingElements(stack[currentPtr]) == -1) {
+ // If the current element matches the name but isn't on the list of active
+ // formatting elements, then it is possible that the list was mangled by the Noah's Ark
+ // clause. In this case, we want to match the end tag against the stack instead of
+ // proceeding with the AAA algorithm that may match against the list of
+ // active formatting elements (and possibly mangle the tree in unexpected ways).
+ pop();
+ return true;
+ }
+
+ // If you crash around here, perhaps some stack node variable claimed to
+ // be a weak ref isn't.
+ for (int i = 0; i < 8; ++i) {
+ int formattingEltListPos = listPtr;
+ while (formattingEltListPos > -1) {
+ StackNode<T> listNode = listOfActiveFormattingElements[formattingEltListPos]; // weak ref
+ if (listNode == null) {
+ formattingEltListPos = -1;
+ break;
+ } else if (listNode.name == name) {
+ break;
+ }
+ formattingEltListPos--;
+ }
+ if (formattingEltListPos == -1) {
+ return false;
+ }
+ // this *looks* like a weak ref to the list of formatting elements
+ StackNode<T> formattingElt = listOfActiveFormattingElements[formattingEltListPos];
+ int formattingEltStackPos = currentPtr;
+ boolean inScope = true;
+ while (formattingEltStackPos > -1) {
+ StackNode<T> node = stack[formattingEltStackPos]; // weak ref
+ if (node == formattingElt) {
+ break;
+ } else if (node.isScoping()) {
+ inScope = false;
+ }
+ formattingEltStackPos--;
+ }
+ if (formattingEltStackPos == -1) {
+ errNoElementToCloseButEndTagSeen(name);
+ removeFromListOfActiveFormattingElements(formattingEltListPos);
+ return true;
+ }
+ if (!inScope) {
+ errNoElementToCloseButEndTagSeen(name);
+ return true;
+ }
+ // stackPos now points to the formatting element and it is in scope
+ if (formattingEltStackPos != currentPtr) {
+ errEndTagViolatesNestingRules(name);
+ }
+ int furthestBlockPos = formattingEltStackPos + 1;
+ while (furthestBlockPos <= currentPtr) {
+ StackNode<T> node = stack[furthestBlockPos]; // weak ref
+ assert furthestBlockPos > 0: "How is formattingEltStackPos + 1 not > 0?";
+ if (node.isSpecial()) {
+ break;
+ }
+ furthestBlockPos++;
+ }
+ if (furthestBlockPos > currentPtr) {
+ // no furthest block
+ while (currentPtr >= formattingEltStackPos) {
+ pop();
+ }
+ removeFromListOfActiveFormattingElements(formattingEltListPos);
+ return true;
+ }
+ // commonAncestor is used for running the algorithm and
+ // insertionCommonAncestor is used for the actual insertions to
+ // keep them depth-limited.
+ StackNode<T> commonAncestor = stack[formattingEltStackPos - 1]; // weak ref
+ T insertionCommonAncestor = nodeFromStackWithBlinkCompat(formattingEltStackPos - 1); // weak ref
+ StackNode<T> furthestBlock = stack[furthestBlockPos]; // weak ref
+ // detachFromParent(furthestBlock.node); XXX AAA CHANGE
+ int bookmark = formattingEltListPos;
+ int nodePos = furthestBlockPos;
+ StackNode<T> lastNode = furthestBlock; // weak ref
+ int j = 0;
+ for (;;) {
+ ++j;
+ nodePos--;
+ if (nodePos == formattingEltStackPos) {
+ break;
+ }
+ StackNode<T> node = stack[nodePos]; // weak ref
+ int nodeListPos = findInListOfActiveFormattingElements(node);
+
+ if (j > 3 && nodeListPos != -1) {
+ removeFromListOfActiveFormattingElements(nodeListPos);
+
+ // Adjust the indices into the list to account
+ // for the removal of nodeListPos.
+ if (nodeListPos <= formattingEltListPos) {
+ formattingEltListPos--;
+ }
+ if (nodeListPos <= bookmark) {
+ bookmark--;
+ }
+
+ // Update position to reflect removal from list.
+ nodeListPos = -1;
+ }
+
+ if (nodeListPos == -1) {
+ assert formattingEltStackPos < nodePos;
+ assert bookmark < nodePos;
+ assert furthestBlockPos > nodePos;
+ removeFromStack(nodePos); // node is now a bad pointer in C++
+ furthestBlockPos--;
+ continue;
+ }
+ // now node is both on stack and in the list
+ if (nodePos == furthestBlockPos) {
+ bookmark = nodeListPos + 1;
+ }
+ // if (hasChildren(node.node)) { XXX AAA CHANGE
+ assert node == listOfActiveFormattingElements[nodeListPos];
+ assert node == stack[nodePos];
+ T clone = createElement("http://www.w3.org/1999/xhtml",
+ node.name, node.attributes.cloneAttributes(), insertionCommonAncestor
+ // CPPONLY: , htmlCreator(node.getHtmlCreator())
+ );
+ StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
+ node.name, clone, node.popName, node.attributes
+ // CPPONLY: , node.getHtmlCreator()
+ // [NOCPP[
+ , node.getLocator()
+ // ]NOCPP]
+ ); // creation ownership goes to stack
+ node.dropAttributes(); // adopt ownership to newNode
+ stack[nodePos] = newNode;
+ newNode.retain(); // retain for list
+ listOfActiveFormattingElements[nodeListPos] = newNode;
+ node.release(this); // release from stack
+ node.release(this); // release from list
+ node = newNode;
+ // } XXX AAA CHANGE
+ detachFromParent(lastNode.node);
+ appendElement(lastNode.node, nodeFromStackWithBlinkCompat(nodePos));
+ lastNode = node;
+ }
+ // If we insert into a foster parent, for simplicity, we insert
+ // accoding to the spec without Blink's depth limit.
+ if (commonAncestor.isFosterParenting()) {
+ fatal();
+ detachFromParent(lastNode.node);
+ insertIntoFosterParent(lastNode.node);
+ } else {
+ detachFromParent(lastNode.node);
+ appendElement(lastNode.node, insertionCommonAncestor);
+ }
+ T clone = createElement("http://www.w3.org/1999/xhtml",
+ formattingElt.name,
+ formattingElt.attributes.cloneAttributes(), furthestBlock.node
+ // CPPONLY: , htmlCreator(formattingElt.getHtmlCreator())
+ );
+ StackNode<T> formattingClone = createStackNode(
+ formattingElt.getFlags(), formattingElt.ns,
+ formattingElt.name, clone, formattingElt.popName,
+ formattingElt.attributes
+ // CPPONLY: , formattingElt.getHtmlCreator()
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ ); // Ownership transfers to stack below
+ formattingElt.dropAttributes(); // transfer ownership to
+ // formattingClone
+ appendChildrenToNewParent(furthestBlock.node, clone);
+ appendElement(clone, furthestBlock.node);
+ removeFromListOfActiveFormattingElements(formattingEltListPos);
+ insertIntoListOfActiveFormattingElements(formattingClone, bookmark);
+ assert formattingEltStackPos < furthestBlockPos;
+ removeFromStack(formattingEltStackPos);
+ // furthestBlockPos is now off by one and points to the slot after
+ // it
+ insertIntoStack(formattingClone, furthestBlockPos);
+ }
+ return true;
+ }
+
+ private void insertIntoStack(StackNode<T> node, int position)
+ throws SAXException {
+ assert currentPtr + 1 < stack.length;
+ assert position <= currentPtr + 1;
+ if (position == currentPtr + 1) {
+ push(node);
+ } else {
+ System.arraycopy(stack, position, stack, position + 1,
+ (currentPtr - position) + 1);
+ currentPtr++;
+ stack[position] = node;
+ }
+ }
+
+ private void insertIntoListOfActiveFormattingElements(
+ StackNode<T> formattingClone, int bookmark) {
+ formattingClone.retain();
+ assert listPtr + 1 < listOfActiveFormattingElements.length;
+ if (bookmark <= listPtr) {
+ System.arraycopy(listOfActiveFormattingElements, bookmark,
+ listOfActiveFormattingElements, bookmark + 1,
+ (listPtr - bookmark) + 1);
+ }
+ listPtr++;
+ listOfActiveFormattingElements[bookmark] = formattingClone;
+ }
+
+ private int findInListOfActiveFormattingElements(StackNode<T> node) {
+ for (int i = listPtr; i >= 0; i--) {
+ if (node == listOfActiveFormattingElements[i]) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private int findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
+ @Local String name) {
+ for (int i = listPtr; i >= 0; i--) {
+ StackNode<T> node = listOfActiveFormattingElements[i];
+ if (node == null) {
+ return -1;
+ } else if (node.name == name) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+
+ private void maybeForgetEarlierDuplicateFormattingElement(
+ @Local String name, HtmlAttributes attributes) throws SAXException {
+ int candidate = -1;
+ int count = 0;
+ for (int i = listPtr; i >= 0; i--) {
+ StackNode<T> node = listOfActiveFormattingElements[i];
+ if (node == null) {
+ break;
+ }
+ if (node.name == name && node.attributes.equalsAnother(attributes)) {
+ candidate = i;
+ ++count;
+ }
+ }
+ if (count >= 3) {
+ removeFromListOfActiveFormattingElements(candidate);
+ }
+ }
+
+ private int findLastOrRoot(@Local String name) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].name == name) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ private int findLastOrRoot(int group) {
+ for (int i = currentPtr; i > 0; i--) {
+ if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].getGroup() == group) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Attempt to add attribute to the body element.
+ * @param attributes the attributes
+ * @return <code>true</code> iff the attributes were added
+ * @throws SAXException
+ */
+ private boolean addAttributesToBody(HtmlAttributes attributes)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ if (currentPtr >= 1) {
+ StackNode<T> body = stack[1];
+ if (body.getGroup() == TreeBuilder.BODY) {
+ addAttributesToElement(body.node, attributes);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void addAttributesToHtml(HtmlAttributes attributes)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ addAttributesToElement(stack[0].node, attributes);
+ }
+
+ private void pushHeadPointerOntoStack() throws SAXException {
+ assert headPointer != null;
+ assert mode == AFTER_HEAD;
+ fatal();
+ silentPush(createStackNode(ElementName.HEAD, headPointer
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ ));
+ }
+
+ /**
+ * @throws SAXException
+ *
+ */
+ private void reconstructTheActiveFormattingElements() throws SAXException {
+ if (listPtr == -1) {
+ return;
+ }
+ StackNode<T> mostRecent = listOfActiveFormattingElements[listPtr];
+ if (mostRecent == null || isInStack(mostRecent)) {
+ return;
+ }
+ int entryPos = listPtr;
+ for (;;) {
+ entryPos--;
+ if (entryPos == -1) {
+ break;
+ }
+ if (listOfActiveFormattingElements[entryPos] == null) {
+ break;
+ }
+ if (isInStack(listOfActiveFormattingElements[entryPos])) {
+ break;
+ }
+ }
+ while (entryPos < listPtr) {
+ entryPos++;
+ StackNode<T> entry = listOfActiveFormattingElements[entryPos];
+ StackNode<T> current = stack[currentPtr];
+
+ T clone;
+ if (current.isFosterParenting()) {
+ clone = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", entry.name,
+ entry.attributes.cloneAttributes()
+ // CPPONLY: , htmlCreator(entry.getHtmlCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ clone = createElement("http://www.w3.org/1999/xhtml", entry.name,
+ entry.attributes.cloneAttributes(), currentNode
+ // CPPONLY: , htmlCreator(entry.getHtmlCreator())
+ );
+ appendElement(clone, currentNode);
+ }
+
+ StackNode<T> entryClone = createStackNode(entry.getFlags(),
+ entry.ns, entry.name, clone, entry.popName,
+ entry.attributes
+ // CPPONLY: , entry.getHtmlCreator()
+ // [NOCPP[
+ , entry.getLocator()
+ // ]NOCPP]
+ );
+
+ entry.dropAttributes(); // transfer ownership to entryClone
+
+ push(entryClone);
+ // stack takes ownership of the local variable
+ listOfActiveFormattingElements[entryPos] = entryClone;
+ // overwriting the old entry on the list, so release & retain
+ entry.release(this);
+ entryClone.retain();
+ }
+ }
+
+ void notifyUnusedStackNode(int idxInStackNodes) {
+ // stackNodesIdx is the earliest possible index of a stack node that might be unused,
+ // so update the index if necessary.
+ if (idxInStackNodes < stackNodesIdx) {
+ stackNodesIdx = idxInStackNodes;
+ }
+ }
+
+ @SuppressWarnings("unchecked") private StackNode<T> getUnusedStackNode() {
+ // Search for an unused stack node.
+ while (stackNodesIdx < numStackNodes) {
+ if (stackNodes[stackNodesIdx].isUnused()) {
+ return stackNodes[stackNodesIdx++];
+ }
+ stackNodesIdx++;
+ }
+
+ if (stackNodesIdx < stackNodes.length) {
+ // No unused stack nodes, but there is still space in the storage array.
+ stackNodes[stackNodesIdx] = new StackNode<T>(stackNodesIdx);
+ numStackNodes++;
+ return stackNodes[stackNodesIdx++];
+ }
+
+ // Could not find an unused stack node and storage array is full.
+ StackNode<T>[] newStack = new StackNode[stackNodes.length + 64];
+ System.arraycopy(stackNodes, 0, newStack, 0, stackNodes.length);
+ stackNodes = newStack;
+
+ // Create a new stack node and return it.
+ stackNodes[stackNodesIdx] = new StackNode<T>(stackNodesIdx);
+ numStackNodes++;
+ return stackNodes[stackNodesIdx++];
+ }
+
+ private StackNode<T> createStackNode(int flags, @NsUri String ns, @Local String name, T node,
+ @Local String popName, HtmlAttributes attributes
+ // CPPONLY: , @HtmlCreator Object htmlCreator
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ StackNode<T> instance = getUnusedStackNode();
+ instance.setValues(flags, ns, name, node, popName, attributes
+ // CPPONLY: , htmlCreator
+ // [NOCPP[
+ , locator
+ // ]NOCPP]
+ );
+ return instance;
+ }
+
+ private StackNode<T> createStackNode(ElementName elementName, T node
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ StackNode<T> instance = getUnusedStackNode();
+ instance.setValues(elementName, node
+ // [NOCPP[
+ , locator
+ // ]NOCPP]
+ );
+ return instance;
+ }
+
+ private StackNode<T> createStackNode(ElementName elementName, T node, HtmlAttributes attributes
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ StackNode<T> instance = getUnusedStackNode();
+ instance.setValues(elementName, node, attributes
+ // [NOCPP[
+ , locator
+ // ]NOCPP]
+ );
+ return instance;
+ }
+
+ private StackNode<T> createStackNode(ElementName elementName, T node, @Local String popName
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ StackNode<T> instance = getUnusedStackNode();
+ instance.setValues(elementName, node, popName
+ // [NOCPP[
+ , locator
+ // ]NOCPP]
+ );
+ return instance;
+ }
+
+ private StackNode<T> createStackNode(ElementName elementName, @Local String popName, T node
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ StackNode<T> instance = getUnusedStackNode();
+ instance.setValues(elementName, popName, node
+ // [NOCPP[
+ , locator
+ // ]NOCPP]
+ );
+ return instance;
+ }
+
+ private StackNode<T> createStackNode(ElementName elementName, T node, @Local String popName,
+ boolean markAsIntegrationPoint
+ // [NOCPP[
+ , TaintableLocatorImpl locator
+ // ]NOCPP]
+ ) {
+ StackNode<T> instance = getUnusedStackNode();
+ instance.setValues(elementName, node, popName, markAsIntegrationPoint
+ // [NOCPP[
+ , locator
+ // ]NOCPP]
+ );
+ return instance;
+ }
+
+ private void insertIntoFosterParent(T child) throws SAXException {
+ int tablePos = findLastOrRoot(TreeBuilder.TABLE);
+ int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
+
+ if (templatePos >= tablePos) {
+ appendElement(child, stack[templatePos].node);
+ return;
+ }
+
+ StackNode<T> node = stack[tablePos];
+ insertFosterParentedChild(child, node.node, stack[tablePos - 1].node);
+ }
+
+ private T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
+ HtmlAttributes attributes
+ // CPPONLY: , @Creator Object creator
+ ) throws SAXException {
+ return createAndInsertFosterParentedElement(ns, name, attributes, null
+ // CPPONLY: , creator
+ );
+ }
+
+ private T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
+ HtmlAttributes attributes, T form
+ // CPPONLY: , @Creator Object creator
+ ) throws SAXException {
+ int tablePos = findLastOrRoot(TreeBuilder.TABLE);
+ int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
+
+ if (templatePos >= tablePos) {
+ T child = createElement(ns, name, attributes, form, stack[templatePos].node
+ // CPPONLY: , creator
+ );
+ appendElement(child, stack[templatePos].node);
+ return child;
+ }
+
+ StackNode<T> node = stack[tablePos];
+ return createAndInsertFosterParentedElement(ns, name, attributes, form, node.node, stack[tablePos - 1].node
+ // CPPONLY: , creator
+ );
+ }
+
+ private boolean isInStack(StackNode<T> node) {
+ for (int i = currentPtr; i >= 0; i--) {
+ if (stack[i] == node) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void popTemplateMode() {
+ templateModePtr--;
+ }
+
+ private void pop() throws SAXException {
+ StackNode<T> node = stack[currentPtr];
+ assert debugOnlyClearLastStackSlot();
+ currentPtr--;
+ elementPopped(node.ns, node.popName, node.node);
+ node.release(this);
+ }
+
+ private void popForeign(int origPos, int eltPos) throws SAXException {
+ StackNode<T> node = stack[currentPtr];
+ if (origPos != currentPtr || eltPos != currentPtr) {
+ markMalformedIfScript(node.node);
+ }
+ assert debugOnlyClearLastStackSlot();
+ currentPtr--;
+ elementPopped(node.ns, node.popName, node.node);
+ node.release(this);
+ }
+
+ private void silentPop() throws SAXException {
+ StackNode<T> node = stack[currentPtr];
+ assert debugOnlyClearLastStackSlot();
+ currentPtr--;
+ node.release(this);
+ }
+
+ private void popOnEof() throws SAXException {
+ StackNode<T> node = stack[currentPtr];
+ assert debugOnlyClearLastStackSlot();
+ currentPtr--;
+ markMalformedIfScript(node.node);
+ elementPopped(node.ns, node.popName, node.node);
+ node.release(this);
+ }
+
+ // [NOCPP[
+ private void checkAttributes(HtmlAttributes attributes, @NsUri String ns)
+ throws SAXException {
+ if (errorHandler != null) {
+ int len = attributes.getXmlnsLength();
+ for (int i = 0; i < len; i++) {
+ AttributeName name = attributes.getXmlnsAttributeName(i);
+ if (name == AttributeName.XMLNS) {
+ String xmlns = attributes.getXmlnsValue(i);
+ if (!ns.equals(xmlns)) {
+ err("Bad value \u201C"
+ + xmlns
+ + "\u201D for the attribute \u201Cxmlns\u201D (only \u201C"
+ + ns + "\u201D permitted here).");
+ switch (namePolicy) {
+ case ALTER_INFOSET:
+ // fall through
+ case ALLOW:
+ warn("Attribute \u201Cxmlns\u201D is not serializable as XML 1.0.");
+ break;
+ case FATAL:
+ fatal("Attribute \u201Cxmlns\u201D is not serializable as XML 1.0.");
+ break;
+ }
+ }
+ } else if (ns != "http://www.w3.org/1999/xhtml"
+ && name == AttributeName.XMLNS_XLINK) {
+ String xmlns = attributes.getXmlnsValue(i);
+ if (!"http://www.w3.org/1999/xlink".equals(xmlns)) {
+ err("Bad value \u201C"
+ + xmlns
+ + "\u201D for the attribute \u201Cxmlns:link\u201D (only \u201Chttp://www.w3.org/1999/xlink\u201D permitted here).");
+ switch (namePolicy) {
+ case ALTER_INFOSET:
+ // fall through
+ case ALLOW:
+ warn("Attribute \u201Cxmlns:xlink\u201D with a value other than \u201Chttp://www.w3.org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
+ break;
+ case FATAL:
+ fatal("Attribute \u201Cxmlns:xlink\u201D with a value other than \u201Chttp://www.w3.org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
+ break;
+ }
+ }
+ } else {
+ err("Attribute \u201C" + attributes.getXmlnsLocalName(i)
+ + "\u201D not allowed here.");
+ switch (namePolicy) {
+ case ALTER_INFOSET:
+ // fall through
+ case ALLOW:
+ warn("Attribute with the local name \u201C"
+ + attributes.getXmlnsLocalName(i)
+ + "\u201D is not serializable as XML 1.0.");
+ break;
+ case FATAL:
+ fatal("Attribute with the local name \u201C"
+ + attributes.getXmlnsLocalName(i)
+ + "\u201D is not serializable as XML 1.0.");
+ break;
+ }
+ }
+ }
+ }
+ attributes.processNonNcNames(this, namePolicy);
+ }
+
+ private String checkPopName(@Local String name) throws SAXException {
+ if (NCName.isNCName(name)) {
+ return name;
+ } else {
+ switch (namePolicy) {
+ case ALLOW:
+ warn("Element name \u201C" + name
+ + "\u201D cannot be represented as XML 1.0.");
+ return name;
+ case ALTER_INFOSET:
+ warn("Element name \u201C" + name
+ + "\u201D cannot be represented as XML 1.0.");
+ return NCName.escapeName(name);
+ case FATAL:
+ fatal("Element name \u201C" + name
+ + "\u201D cannot be represented as XML 1.0.");
+ }
+ }
+ return null; // keep compiler happy
+ }
+
+ // ]NOCPP]
+
+ private void appendHtmlElementToDocumentAndPush(HtmlAttributes attributes)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ T elt = createHtmlElementSetAsRoot(attributes);
+ StackNode<T> node = createStackNode(ElementName.HTML,
+ elt
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendHtmlElementToDocumentAndPush() throws SAXException {
+ appendHtmlElementToDocumentAndPush(tokenizer.emptyAttributes());
+ }
+
+ private void appendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ T elt = createElement("http://www.w3.org/1999/xhtml", "head", attributes, currentNode
+ /*
+ * head uses NS_NewHTMLSharedElement creator
+ */
+ // CPPONLY: , htmlCreator(NS_NewHTMLSharedElement)
+ );
+ appendElement(elt, currentNode);
+ headPointer = elt;
+ StackNode<T> node = createStackNode(ElementName.HEAD,
+ elt
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendToCurrentNodeAndPushBodyElement(HtmlAttributes attributes)
+ throws SAXException {
+ appendToCurrentNodeAndPushElement(ElementName.BODY,
+ attributes);
+ }
+
+ private void appendToCurrentNodeAndPushBodyElement() throws SAXException {
+ appendToCurrentNodeAndPushBodyElement(tokenizer.emptyAttributes());
+ }
+
+ private void appendToCurrentNodeAndPushFormElementMayFoster(
+ HtmlAttributes attributes) throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", "form", attributes
+ // CPPONLY: , htmlCreator(NS_NewHTMLFormElement)
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1999/xhtml", "form", attributes, currentNode
+ // CPPONLY: , htmlCreator(NS_NewHTMLFormElement)
+ );
+ appendElement(elt, currentNode);
+ }
+
+ if (!isTemplateContents()) {
+ formPointer = elt;
+ }
+
+ StackNode<T> node = createStackNode(ElementName.FORM,
+ elt
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendToCurrentNodeAndPushFormattingElementMayFoster(
+ ElementName elementName, HtmlAttributes attributes)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ // This method can't be called for custom elements
+ HtmlAttributes clone = attributes.cloneAttributes();
+ // Attributes must not be read after calling createElement, because
+ // createElement may delete attributes in C++.
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes, currentNode
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ StackNode<T> node = createStackNode(elementName, elt, clone
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ append(node);
+ node.retain(); // append doesn't retain itself
+ }
+
+ private void appendToCurrentNodeAndPushElement(ElementName elementName,
+ HtmlAttributes attributes)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ // This method can't be called for custom elements
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ T elt = createElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes, currentNode
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ appendElement(elt, currentNode);
+ if (ElementName.TEMPLATE == elementName) {
+ elt = getDocumentFragmentForTemplate(elt);
+ }
+ StackNode<T> node = createStackNode(elementName, elt
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName,
+ HtmlAttributes attributes)
+ throws SAXException {
+ @Local String popName = elementName.getName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ if (!elementName.isInterned()) {
+ popName = checkPopName(popName);
+ }
+ // ]NOCPP]
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", popName, attributes
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1999/xhtml", popName, attributes, currentNode
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ StackNode<T> node = createStackNode(elementName, elt, popName
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendToCurrentNodeAndPushElementMayFosterMathML(
+ ElementName elementName, HtmlAttributes attributes)
+ throws SAXException {
+ @Local String popName = elementName.getName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML");
+ if (!elementName.isInterned()) {
+ popName = checkPopName(popName);
+ }
+ // ]NOCPP]
+ boolean markAsHtmlIntegrationPoint = false;
+ if (ElementName.ANNOTATION_XML == elementName
+ && annotationXmlEncodingPermitsHtml(attributes)) {
+ markAsHtmlIntegrationPoint = true;
+ }
+ // Attributes must not be read after calling createElement(), since
+ // createElement may delete the object in C++.
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1998/Math/MathML", popName, attributes
+ // CPPONLY: , htmlCreator(null)
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes, currentNode
+ // CPPONLY: , htmlCreator(null)
+ );
+ appendElement(elt, currentNode);
+ }
+ StackNode<T> node = createStackNode(elementName, elt, popName,
+ markAsHtmlIntegrationPoint
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ // [NOCPP[
+ T getDocumentFragmentForTemplate(T template) {
+ return template;
+ }
+
+ T getFormPointerForContext(T context) {
+ return null;
+ }
+ // ]NOCPP]
+
+ private boolean annotationXmlEncodingPermitsHtml(HtmlAttributes attributes) {
+ String encoding = attributes.getValue(AttributeName.ENCODING);
+ if (encoding == null) {
+ return false;
+ }
+ return Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "application/xhtml+xml", encoding)
+ || Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
+ "text/html", encoding);
+ }
+
+ private void appendToCurrentNodeAndPushElementMayFosterSVG(
+ ElementName elementName, HtmlAttributes attributes)
+ throws SAXException {
+ @Local String popName = elementName.getCamelCaseName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/2000/svg");
+ if (!elementName.isInterned()) {
+ popName = checkPopName(popName);
+ }
+ // ]NOCPP]
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/2000/svg", popName, attributes
+ // CPPONLY: , svgCreator(elementName.getSvgCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/2000/svg", popName, attributes, currentNode
+ // CPPONLY: , svgCreator(elementName.getSvgCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ StackNode<T> node = createStackNode(elementName, popName, elt
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName,
+ HtmlAttributes attributes, T form)
+ throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ // Can't be called for custom elements
+ T elt;
+ T formOwner = form == null || fragment || isTemplateContents() ? null : form;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.getName(),
+ attributes, formOwner
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1999/xhtml", elementName.getName(),
+ attributes, formOwner, currentNode
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ StackNode<T> node = createStackNode(elementName, elt
+ // [NOCPP[
+ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
+ // ]NOCPP]
+ );
+ push(node);
+ }
+
+ private void appendVoidElementToCurrentMayFoster(
+ ElementName elementName, HtmlAttributes attributes, T form) throws SAXException {
+ @Local String name = elementName.getName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ // Can't be called for custom elements
+ T elt;
+ T formOwner = form == null || fragment || isTemplateContents() ? null : form;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", name,
+ attributes, formOwner
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1999/xhtml", name,
+ attributes, formOwner, currentNode
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ elementPushed("http://www.w3.org/1999/xhtml", name, elt);
+ elementPopped("http://www.w3.org/1999/xhtml", name, elt);
+ }
+
+ private void appendVoidElementToCurrentMayFoster(
+ ElementName elementName, HtmlAttributes attributes)
+ throws SAXException {
+ @Local String popName = elementName.getName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ if (!elementName.isInterned()) {
+ popName = checkPopName(popName);
+ }
+ // ]NOCPP]
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", popName, attributes
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1999/xhtml", popName, attributes, currentNode
+ // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ elementPushed("http://www.w3.org/1999/xhtml", popName, elt);
+ elementPopped("http://www.w3.org/1999/xhtml", popName, elt);
+ }
+
+ private void appendVoidElementToCurrentMayFosterSVG(
+ ElementName elementName, HtmlAttributes attributes)
+ throws SAXException {
+ @Local String popName = elementName.getCamelCaseName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/2000/svg");
+ if (!elementName.isInterned()) {
+ popName = checkPopName(popName);
+ }
+ // ]NOCPP]
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/2000/svg", popName, attributes
+ // CPPONLY: , svgCreator(elementName.getSvgCreator())
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/2000/svg", popName, attributes, currentNode
+ // CPPONLY: , svgCreator(elementName.getSvgCreator())
+ );
+ appendElement(elt, currentNode);
+ }
+ elementPushed("http://www.w3.org/2000/svg", popName, elt);
+ elementPopped("http://www.w3.org/2000/svg", popName, elt);
+ }
+
+ private void appendVoidElementToCurrentMayFosterMathML(
+ ElementName elementName, HtmlAttributes attributes)
+ throws SAXException {
+ @Local String popName = elementName.getName();
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML");
+ if (!elementName.isInterned()) {
+ popName = checkPopName(popName);
+ }
+ // ]NOCPP]
+ T elt;
+ StackNode<T> current = stack[currentPtr];
+ if (current.isFosterParenting()) {
+ fatal();
+ elt = createAndInsertFosterParentedElement("http://www.w3.org/1998/Math/MathML", popName, attributes
+ // CPPONLY: , htmlCreator(null)
+ );
+ } else {
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes, currentNode
+ // CPPONLY: , htmlCreator(null)
+ );
+ appendElement(elt, currentNode);
+ }
+ elementPushed("http://www.w3.org/1998/Math/MathML", popName, elt);
+ elementPopped("http://www.w3.org/1998/Math/MathML", popName, elt);
+ }
+
+ private void appendVoidInputToCurrent(HtmlAttributes attributes, T form) throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ // Can't be called for custom elements
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ T elt = createElement("http://www.w3.org/1999/xhtml", "input", attributes,
+ form == null || fragment || isTemplateContents() ? null : form, currentNode
+ // CPPONLY: , htmlCreator(NS_NewHTMLInputElement)
+ );
+ appendElement(elt, currentNode);
+ elementPushed("http://www.w3.org/1999/xhtml", "input", elt);
+ elementPopped("http://www.w3.org/1999/xhtml", "input", elt);
+ }
+
+ private void appendVoidFormToCurrent(HtmlAttributes attributes) throws SAXException {
+ // [NOCPP[
+ checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
+ // ]NOCPP]
+ T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
+ T elt = createElement("http://www.w3.org/1999/xhtml", "form",
+ attributes, currentNode
+ // CPPONLY: , htmlCreator(NS_NewHTMLFormElement)
+ );
+ formPointer = elt;
+ // ownership transferred to form pointer
+ appendElement(elt, currentNode);
+ elementPushed("http://www.w3.org/1999/xhtml", "form", elt);
+ elementPopped("http://www.w3.org/1999/xhtml", "form", elt);
+ }
+
+ // [NOCPP[
+
+ private final void accumulateCharactersForced(@Const @NoLength char[] buf,
+ int start, int length) throws SAXException {
+ System.arraycopy(buf, start, charBuffer, charBufferLen, length);
+ charBufferLen += length;
+ }
+
+ @Override public void ensureBufferSpace(int inputLength)
+ throws SAXException {
+ // TODO: Unify Tokenizer.strBuf and TreeBuilder.charBuffer so that
+ // this method becomes unnecessary.
+ int worstCase = charBufferLen + inputLength;
+ if (charBuffer == null) {
+ // Add an arbitrary small value to avoid immediate reallocation
+ // once there are a few characters in the buffer.
+ charBuffer = new char[worstCase + 128];
+ } else if (worstCase > charBuffer.length) {
+ // HotSpot reportedly allocates memory with 8-byte accuracy, so
+ // there's no point in trying to do math here to avoid slop.
+ // Maybe we should add some small constant to worstCase here
+ // but not doing that without profiling. In C++ with jemalloc,
+ // the corresponding method should do math to round up here
+ // to avoid slop.
+ char[] newBuf = new char[worstCase];
+ System.arraycopy(charBuffer, 0, newBuf, 0, charBufferLen);
+ charBuffer = newBuf;
+ }
+ }
+
+ // ]NOCPP]
+
+ protected void accumulateCharacters(@Const @NoLength char[] buf, int start,
+ int length) throws SAXException {
+ appendCharacters(stack[currentPtr].node, buf, start, length);
+ }
+
+ // ------------------------------- //
+
+ protected final void requestSuspension() {
+ tokenizer.requestSuspension();
+ }
+
+ protected abstract T createElement(@NsUri String ns, @Local String name,
+ HtmlAttributes attributes, T intendedParent
+ // CPPONLY: , @Creator Object creator
+ ) throws SAXException;
+
+ protected T createElement(@NsUri String ns, @Local String name,
+ HtmlAttributes attributes, T form, T intendedParent
+ // CPPONLY: , @Creator Object creator
+ ) throws SAXException {
+ return createElement("http://www.w3.org/1999/xhtml", name, attributes, intendedParent
+ // CPPONLY: , creator
+ );
+ }
+
+ protected abstract T createHtmlElementSetAsRoot(HtmlAttributes attributes)
+ throws SAXException;
+
+ protected abstract void detachFromParent(T element) throws SAXException;
+
+ protected abstract boolean hasChildren(T element) throws SAXException;
+
+ protected abstract void appendElement(T child, T newParent)
+ throws SAXException;
+
+ protected abstract void appendChildrenToNewParent(T oldParent, T newParent)
+ throws SAXException;
+
+ protected abstract void insertFosterParentedChild(T child, T table,
+ T stackParent) throws SAXException;
+
+ // We don't generate CPP code for this method because it is not used in generated CPP
+ // code. Instead, the form owner version of this method is called with a null form owner.
+ // [NOCPP[
+
+ protected abstract T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
+ HtmlAttributes attributes, T table, T stackParent) throws SAXException;
+
+ // ]NOCPP]
+
+ protected T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
+ HtmlAttributes attributes, T form, T table, T stackParent
+ // CPPONLY: , @Creator Object creator
+ ) throws SAXException {
+ return createAndInsertFosterParentedElement(ns, name, attributes, table, stackParent);
+ };
+
+ protected abstract void insertFosterParentedCharacters(
+ @NoLength char[] buf, int start, int length, T table, T stackParent)
+ throws SAXException;
+
+ protected abstract void appendCharacters(T parent, @NoLength char[] buf,
+ int start, int length) throws SAXException;
+
+ protected abstract void appendComment(T parent, @NoLength char[] buf,
+ int start, int length) throws SAXException;
+
+ protected abstract void appendCommentToDocument(@NoLength char[] buf,
+ int start, int length) throws SAXException;
+
+ protected abstract void addAttributesToElement(T element,
+ HtmlAttributes attributes) throws SAXException;
+
+ protected void markMalformedIfScript(T elt) throws SAXException {
+
+ }
+
+ protected void start(boolean fragmentMode) throws SAXException {
+
+ }
+
+ protected void end() throws SAXException {
+
+ }
+
+ protected void appendDoctypeToDocument(@Local String name,
+ String publicIdentifier, String systemIdentifier)
+ throws SAXException {
+
+ }
+
+ protected void elementPushed(@NsUri String ns, @Local String name, T node)
+ throws SAXException {
+
+ }
+
+ protected void elementPopped(@NsUri String ns, @Local String name, T node)
+ throws SAXException {
+
+ }
+
+ // [NOCPP[
+
+ protected void documentMode(DocumentMode m, String publicIdentifier,
+ String systemIdentifier)
+ throws SAXException {
+
+ }
+
+ /**
+ * @see nu.validator.htmlparser.common.TokenHandler#wantsComments()
+ */
+ public boolean wantsComments() {
+ return wantingComments;
+ }
+
+ public void setIgnoringComments(boolean ignoreComments) {
+ wantingComments = !ignoreComments;
+ }
+
+ /**
+ * Sets the errorHandler.
+ *
+ * @param errorHandler
+ * the errorHandler to set
+ */
+ public final void setErrorHandler(ErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+ /**
+ * Returns the errorHandler.
+ *
+ * @return the errorHandler
+ */
+ public ErrorHandler getErrorHandler() {
+ return errorHandler;
+ }
+
+ /**
+ * The argument MUST be an interned string or <code>null</code>.
+ *
+ * @param context
+ */
+ public final void setFragmentContext(@Local String context) {
+ this.contextName = context;
+ this.contextNamespace = "http://www.w3.org/1999/xhtml";
+ this.contextNode = null;
+ this.fragment = (contextName != null);
+ this.quirks = false;
+ }
+
+ // ]NOCPP]
+
+ /**
+ * @see nu.validator.htmlparser.common.TokenHandler#cdataSectionAllowed()
+ */
+ @Inline public boolean cdataSectionAllowed() throws SAXException {
+ return isInForeign();
+ }
+
+ private boolean isInForeign() {
+ return currentPtr >= 0
+ && stack[currentPtr].ns != "http://www.w3.org/1999/xhtml";
+ }
+
+ private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint() {
+ if (currentPtr < 0) {
+ return false;
+ }
+ return !isSpecialParentInForeign(stack[currentPtr]);
+ }
+
+ /**
+ * The argument MUST be an interned string or <code>null</code>.
+ *
+ * @param context
+ */
+ public final void setFragmentContext(@Local String context,
+ @NsUri String ns, T node, boolean quirks) {
+ // [NOCPP[
+ if (!((context == null && ns == null)
+ || "http://www.w3.org/1999/xhtml" == ns
+ || "http://www.w3.org/2000/svg" == ns || "http://www.w3.org/1998/Math/MathML" == ns)) {
+ throw new IllegalArgumentException(
+ "The namespace must be the HTML, SVG or MathML namespace (or null when the local name is null). Got: "
+ + ns);
+ }
+ // ]NOCPP]
+ this.contextName = context;
+ this.contextNamespace = ns;
+ this.contextNode = node;
+ this.fragment = (contextName != null);
+ this.quirks = quirks;
+ }
+
+ protected final T currentNode() {
+ return stack[currentPtr].node;
+ }
+
+ /**
+ * Returns the scriptingEnabled.
+ *
+ * @return the scriptingEnabled
+ */
+ public boolean isScriptingEnabled() {
+ return scriptingEnabled;
+ }
+
+ /**
+ * Sets the scriptingEnabled.
+ *
+ * @param scriptingEnabled
+ * the scriptingEnabled to set
+ */
+ public void setScriptingEnabled(boolean scriptingEnabled) {
+ this.scriptingEnabled = scriptingEnabled;
+ }
+
+ public void setForceNoQuirks(boolean forceNoQuirks) {
+ this.forceNoQuirks = forceNoQuirks;
+ }
+
+ // Redundant method retained because previously public.
+ public void setIsSrcdocDocument(boolean isSrcdocDocument) {
+ this.setForceNoQuirks(isSrcdocDocument);
+ }
+
+ // [NOCPP[
+
+ public void setNamePolicy(XmlViolationPolicy namePolicy) {
+ this.namePolicy = namePolicy;
+ }
+
+ /**
+ * Sets the documentModeHandler.
+ *
+ * @param documentModeHandler
+ * the documentModeHandler to set
+ */
+ public void setDocumentModeHandler(DocumentModeHandler documentModeHandler) {
+ this.documentModeHandler = documentModeHandler;
+ }
+
+ /**
+ * Sets the reportingDoctype.
+ *
+ * @param reportingDoctype
+ * the reportingDoctype to set
+ */
+ public void setReportingDoctype(boolean reportingDoctype) {
+ this.reportingDoctype = reportingDoctype;
+ }
+
+ // ]NOCPP]
+
+ /**
+ * Flushes the pending characters. Public for document.write use cases only.
+ * @throws SAXException
+ */
+ public final void flushCharacters() throws SAXException {
+ if (charBufferLen > 0) {
+ if ((mode == IN_TABLE || mode == IN_TABLE_BODY || mode == IN_ROW)
+ && charBufferContainsNonWhitespace()) {
+ errNonSpaceInTable();
+ reconstructTheActiveFormattingElements();
+ if (!stack[currentPtr].isFosterParenting()) {
+ // reconstructing gave us a new current node
+ appendCharacters(currentNode(), charBuffer, 0,
+ charBufferLen);
+ charBufferLen = 0;
+ return;
+ }
+
+ int tablePos = findLastOrRoot(TreeBuilder.TABLE);
+ int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
+
+ if (templatePos >= tablePos) {
+ appendCharacters(stack[templatePos].node, charBuffer, 0, charBufferLen);
+ charBufferLen = 0;
+ return;
+ }
+
+ StackNode<T> tableElt = stack[tablePos];
+ insertFosterParentedCharacters(charBuffer, 0, charBufferLen,
+ tableElt.node, stack[tablePos - 1].node);
+ charBufferLen = 0;
+ return;
+ }
+ appendCharacters(currentNode(), charBuffer, 0, charBufferLen);
+ charBufferLen = 0;
+ }
+ }
+
+ private boolean charBufferContainsNonWhitespace() {
+ for (int i = 0; i < charBufferLen; i++) {
+ switch (charBuffer[i]) {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '\u000C':
+ continue;
+ default:
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Creates a comparable snapshot of the tree builder state. Snapshot
+ * creation is only supported immediately after a script end tag has been
+ * processed. In C++ the caller is responsible for calling
+ * <code>delete</code> on the returned object.
+ *
+ * @return a snapshot.
+ * @throws SAXException
+ */
+ @SuppressWarnings("unchecked") public TreeBuilderState<T> newSnapshot()
+ throws SAXException {
+ StackNode<T>[] listCopy = new StackNode[listPtr + 1];
+ for (int i = 0; i < listCopy.length; i++) {
+ StackNode<T> node = listOfActiveFormattingElements[i];
+ if (node != null) {
+ StackNode<T> newNode = new StackNode<T>(-1);
+ newNode.setValues(node.getFlags(), node.ns,
+ node.name, node.node, node.popName,
+ node.attributes.cloneAttributes()
+ // CPPONLY: , node.getHtmlCreator()
+ // [NOCPP[
+ , node.getLocator()
+ // ]NOCPP]
+ );
+ listCopy[i] = newNode;
+ } else {
+ listCopy[i] = null;
+ }
+ }
+ StackNode<T>[] stackCopy = new StackNode[currentPtr + 1];
+ for (int i = 0; i < stackCopy.length; i++) {
+ StackNode<T> node = stack[i];
+ int listIndex = findInListOfActiveFormattingElements(node);
+ if (listIndex == -1) {
+ StackNode<T> newNode = new StackNode<T>(-1);
+ newNode.setValues(node.getFlags(), node.ns,
+ node.name, node.node, node.popName,
+ null
+ // CPPONLY: , node.getHtmlCreator()
+ // [NOCPP[
+ , node.getLocator()
+ // ]NOCPP]
+ );
+ stackCopy[i] = newNode;
+ } else {
+ stackCopy[i] = listCopy[listIndex];
+ stackCopy[i].retain();
+ }
+ }
+ int[] templateModeStackCopy = new int[templateModePtr + 1];
+ System.arraycopy(templateModeStack, 0, templateModeStackCopy, 0,
+ templateModeStackCopy.length);
+ return new StateSnapshot<T>(stackCopy, listCopy, templateModeStackCopy, formPointer,
+ headPointer, mode, originalMode, framesetOk,
+ needToDropLF, quirks);
+ }
+
+ public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
+ StackNode<T>[] stackCopy = snapshot.getStack();
+ int stackLen = snapshot.getStackLength();
+ StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();
+ int listLen = snapshot.getListOfActiveFormattingElementsLength();
+ int[] templateModeStackCopy = snapshot.getTemplateModeStack();
+ int templateModeStackLen = snapshot.getTemplateModeStackLength();
+
+ if (stackLen != currentPtr + 1
+ || listLen != listPtr + 1
+ || templateModeStackLen != templateModePtr + 1
+ || formPointer != snapshot.getFormPointer()
+ || headPointer != snapshot.getHeadPointer()
+ || mode != snapshot.getMode()
+ || originalMode != snapshot.getOriginalMode()
+ || framesetOk != snapshot.isFramesetOk()
+ || needToDropLF != snapshot.isNeedToDropLF()
+ || quirks != snapshot.isQuirks()) { // maybe just assert quirks
+ return false;
+ }
+ for (int i = listLen - 1; i >= 0; i--) {
+ if (listCopy[i] == null
+ && listOfActiveFormattingElements[i] == null) {
+ continue;
+ } else if (listCopy[i] == null
+ || listOfActiveFormattingElements[i] == null) {
+ return false;
+ }
+ if (listCopy[i].node != listOfActiveFormattingElements[i].node) {
+ return false; // it's possible that this condition is overly
+ // strict
+ }
+ }
+ for (int i = stackLen - 1; i >= 0; i--) {
+ if (stackCopy[i].node != stack[i].node) {
+ return false;
+ }
+ }
+ for (int i = templateModeStackLen - 1; i >=0; i--) {
+ if (templateModeStackCopy[i] != templateModeStack[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("unchecked") public void loadState(
+ TreeBuilderState<T> snapshot)
+ throws SAXException {
+ // CPPONLY: mCurrentHtmlScriptIsAsyncOrDefer = false;
+ StackNode<T>[] stackCopy = snapshot.getStack();
+ int stackLen = snapshot.getStackLength();
+ StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();
+ int listLen = snapshot.getListOfActiveFormattingElementsLength();
+ int[] templateModeStackCopy = snapshot.getTemplateModeStack();
+ int templateModeStackLen = snapshot.getTemplateModeStackLength();
+
+ for (int i = 0; i <= listPtr; i++) {
+ if (listOfActiveFormattingElements[i] != null) {
+ listOfActiveFormattingElements[i].release(this);
+ }
+ }
+ if (listOfActiveFormattingElements.length < listLen) {
+ listOfActiveFormattingElements = new StackNode[listLen];
+ }
+ listPtr = listLen - 1;
+
+ for (int i = 0; i <= currentPtr; i++) {
+ stack[i].release(this);
+ }
+ if (stack.length < stackLen) {
+ stack = new StackNode[stackLen];
+ }
+ currentPtr = stackLen - 1;
+
+ if (templateModeStack.length < templateModeStackLen) {
+ templateModeStack = new int[templateModeStackLen];
+ }
+ templateModePtr = templateModeStackLen - 1;
+
+ for (int i = 0; i < listLen; i++) {
+ StackNode<T> node = listCopy[i];
+ if (node != null) {
+ StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
+ node.name, node.node,
+ node.popName,
+ node.attributes.cloneAttributes()
+ // CPPONLY: , node.getHtmlCreator()
+ // [NOCPP[
+ , node.getLocator()
+ // ]NOCPP]
+ );
+ listOfActiveFormattingElements[i] = newNode;
+ } else {
+ listOfActiveFormattingElements[i] = null;
+ }
+ }
+ for (int i = 0; i < stackLen; i++) {
+ StackNode<T> node = stackCopy[i];
+ int listIndex = findInArray(node, listCopy);
+ if (listIndex == -1) {
+ StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
+ node.name, node.node,
+ node.popName,
+ null
+ // CPPONLY: , node.getHtmlCreator()
+ // [NOCPP[
+ , node.getLocator()
+ // ]NOCPP]
+ );
+ stack[i] = newNode;
+ } else {
+ stack[i] = listOfActiveFormattingElements[listIndex];
+ stack[i].retain();
+ }
+ }
+ System.arraycopy(templateModeStackCopy, 0, templateModeStack, 0, templateModeStackLen);
+ formPointer = snapshot.getFormPointer();
+ headPointer = snapshot.getHeadPointer();
+ mode = snapshot.getMode();
+ originalMode = snapshot.getOriginalMode();
+ framesetOk = snapshot.isFramesetOk();
+ needToDropLF = snapshot.isNeedToDropLF();
+ quirks = snapshot.isQuirks();
+ }
+
+ private int findInArray(StackNode<T> node, StackNode<T>[] arr) {
+ for (int i = listPtr; i >= 0; i--) {
+ if (node == arr[i]) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns <code>stack[stackPos].node</code> if <code>stackPos</code> is
+ * smaller than Blink's magic limit or the node at Blink's magic limit
+ * otherwise.
+ *
+ * In order to get Blink-compatible handling of excessive deeply-nested
+ * markup, this method must be used to obtain the node that is used as the
+ * parent node of an insertion.
+ *
+ * Blink's magic number is 512, but our counting is off by one compared to
+ * Blink's way of counting, so in order to get the same
+ * externally-observable outcome, we use 511 as our magic number.
+ *
+ * @param stackPos the stack position to attempt to read
+ * @return node at the position capped to Blink's magic number
+ * @throws SAXException
+ */
+ private T nodeFromStackWithBlinkCompat(int stackPos) throws SAXException {
+ // Magic number if off by one relative to Blink's magic number, but the
+ // outcome is the same, because the counting is different by one.
+ if (stackPos > 511) {
+ errDeepTree();
+ return stack[511].node;
+ }
+ return stack[stackPos].node;
+ }
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
+ */
+ @Override
+ public T getFormPointer() {
+ return formPointer;
+ }
+
+ /**
+ * Returns the headPointer.
+ *
+ * @return the headPointer
+ */
+ @Override
+ public T getHeadPointer() {
+ return headPointer;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
+ */
+ @Override
+ public StackNode<T>[] getListOfActiveFormattingElements() {
+ return listOfActiveFormattingElements;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
+ */
+ @Override
+ public StackNode<T>[] getStack() {
+ return stack;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
+ */
+ @Override
+ public int[] getTemplateModeStack() {
+ return templateModeStack;
+ }
+
+ /**
+ * Returns the mode.
+ *
+ * @return the mode
+ */
+ @Override
+ public int getMode() {
+ return mode;
+ }
+
+ /**
+ * Returns the originalMode.
+ *
+ * @return the originalMode
+ */
+ @Override
+ public int getOriginalMode() {
+ return originalMode;
+ }
+
+ /**
+ * Returns the framesetOk.
+ *
+ * @return the framesetOk
+ */
+ @Override
+ public boolean isFramesetOk() {
+ return framesetOk;
+ }
+
+ /**
+ * Returns the needToDropLF.
+ *
+ * @return the needToDropLF
+ */
+ @Override
+ public boolean isNeedToDropLF() {
+ return needToDropLF;
+ }
+
+ /**
+ * Returns the quirks.
+ *
+ * @return the quirks
+ */
+ @Override
+ public boolean isQuirks() {
+ return quirks;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
+ */
+ @Override
+ public int getListOfActiveFormattingElementsLength() {
+ return listPtr + 1;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
+ */
+ @Override
+ public int getStackLength() {
+ return currentPtr + 1;
+ }
+
+ /**
+ * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
+ */
+ @Override
+ public int getTemplateModeStackLength() {
+ return templateModePtr + 1;
+ }
+
+ /**
+ * Complains about an over-deep tree. Theoretically this should just be
+ * a warning, but in practice authors should take this as an error.
+ *
+ * @throws SAXException
+ */
+ private void errDeepTree() throws SAXException {
+ err("The document tree is more than 513 elements deep, which causes Firefox and Chrome to flatten the tree.");
+ }
+
+ /**
+ * Reports a stray start tag.
+ * @param name the name of the stray tag
+ *
+ * @throws SAXException
+ */
+ private void errStrayStartTag(@Local String name) throws SAXException {
+ err("Stray start tag \u201C" + name + "\u201D.");
+ }
+
+ /**
+ * Reports a stray end tag.
+ * @param name the name of the stray tag
+ *
+ * @throws SAXException
+ */
+ private void errStrayEndTag(@Local String name) throws SAXException {
+ err("Stray end tag \u201C" + name + "\u201D.");
+ }
+
+ /**
+ * Reports a state when elements expected to be closed were not.
+ *
+ * @param eltPos the position of the start tag on the stack of the element
+ * being closed.
+ * @param name the name of the end tag
+ *
+ * @throws SAXException
+ */
+ private void errUnclosedElements(int eltPos, @Local String name) throws SAXException {
+ errNoCheck("End tag \u201C" + name + "\u201D seen, but there were open elements.");
+ errListUnclosedStartTags(eltPos);
+ }
+
+ /**
+ * Reports a state when elements expected to be closed ahead of an implied
+ * end tag but were not.
+ *
+ * @param eltPos the position of the start tag on the stack of the element
+ * being closed.
+ * @param name the name of the end tag
+ *
+ * @throws SAXException
+ */
+ private void errUnclosedElementsImplied(int eltPos, String name) throws SAXException {
+ errNoCheck("End tag \u201C" + name + "\u201D implied, but there were open elements.");
+ errListUnclosedStartTags(eltPos);
+ }
+
+ /**
+ * Reports a state when elements expected to be closed ahead of an implied
+ * table cell close.
+ *
+ * @param eltPos the position of the start tag on the stack of the element
+ * being closed.
+ * @throws SAXException
+ */
+ private void errUnclosedElementsCell(int eltPos) throws SAXException {
+ errNoCheck("A table cell was implicitly closed, but there were open elements.");
+ errListUnclosedStartTags(eltPos);
+ }
+
+ private void errStrayDoctype() throws SAXException {
+ err("Stray doctype.");
+ }
+
+ private void errAlmostStandardsDoctype() throws SAXException {
+ if (!forceNoQuirks) {
+ err("Almost standards mode doctype. Expected \u201C<!DOCTYPE html>\u201D.");
+ }
+ }
+
+ private void errQuirkyDoctype() throws SAXException {
+ if (!forceNoQuirks) {
+ err("Quirky doctype. Expected \u201C<!DOCTYPE html>\u201D.");
+ }
+ }
+
+ private void errNonSpaceInTrailer() throws SAXException {
+ err("Non-space character in page trailer.");
+ }
+
+ private void errNonSpaceAfterFrameset() throws SAXException {
+ err("Non-space after \u201Cframeset\u201D.");
+ }
+
+ private void errNonSpaceInFrameset() throws SAXException {
+ err("Non-space in \u201Cframeset\u201D.");
+ }
+
+ private void errNonSpaceAfterBody() throws SAXException {
+ err("Non-space character after body.");
+ }
+
+ private void errNonSpaceInColgroupInFragment() throws SAXException {
+ err("Non-space in \u201Ccolgroup\u201D when parsing fragment.");
+ }
+
+ private void errNonSpaceInNoscriptInHead() throws SAXException {
+ err("Non-space character inside \u201Cnoscript\u201D inside \u201Chead\u201D.");
+ }
+
+ private void errFooBetweenHeadAndBody(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("\u201C" + name + "\u201D element between \u201Chead\u201D and \u201Cbody\u201D.");
+ }
+
+ private void errStartTagWithoutDoctype() throws SAXException {
+ if (!forceNoQuirks) {
+ err("Start tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
+ }
+ }
+
+ private void errNoSelectInTableScope() throws SAXException {
+ err("No \u201Cselect\u201D in table scope.");
+ }
+
+ private void errStartSelectWhereEndSelectExpected() throws SAXException {
+ err("\u201Cselect\u201D start tag where end tag expected.");
+ }
+
+ private void errStartTagWithSelectOpen(@Local String name)
+ throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("\u201C" + name
+ + "\u201D start tag with \u201Cselect\u201D open.");
+ }
+
+ private void errBadStartTagInNoscriptInHead(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("Bad start tag in \u201C" + name
+ + "\u201D in \u201Cnoscript\u201D in \u201Chead\u201D.");
+ }
+
+ private void errImage() throws SAXException {
+ err("Saw a start tag \u201Cimage\u201D.");
+ }
+
+ private void errFooSeenWhenFooOpen(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("Start tag \u201C" + name + "\u201D seen but an element of the same type was already open.");
+ }
+
+ private void errHeadingWhenHeadingOpen() throws SAXException {
+ err("Heading cannot be a child of another heading.");
+ }
+
+ private void errFramesetStart() throws SAXException {
+ err("\u201Cframeset\u201D start tag seen.");
+ }
+
+ private void errNoCellToClose() throws SAXException {
+ err("No cell to close.");
+ }
+
+ private void errStartTagInTable(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("Start tag \u201C" + name
+ + "\u201D seen in \u201Ctable\u201D.");
+ }
+
+ private void errFormWhenFormOpen() throws SAXException {
+ err("Saw a \u201Cform\u201D start tag, but there was already an active \u201Cform\u201D element. Nested forms are not allowed. Ignoring the tag.");
+ }
+
+ private void errTableSeenWhileTableOpen() throws SAXException {
+ err("Start tag for \u201Ctable\u201D seen but the previous \u201Ctable\u201D is still open.");
+ }
+
+ private void errStartTagInTableBody(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("\u201C" + name + "\u201D start tag in table body.");
+ }
+
+ private void errEndTagSeenWithoutDoctype() throws SAXException {
+ if (!forceNoQuirks) {
+ err("End tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
+ }
+ }
+
+ private void errEndTagAfterBody() throws SAXException {
+ err("Saw an end tag after \u201Cbody\u201D had been closed.");
+ }
+
+ private void errEndTagSeenWithSelectOpen(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("\u201C" + name
+ + "\u201D end tag with \u201Cselect\u201D open.");
+ }
+
+ private void errGarbageInColgroup() throws SAXException {
+ err("Garbage in \u201Ccolgroup\u201D fragment.");
+ }
+
+ private void errEndTagBr() throws SAXException {
+ err("End tag \u201Cbr\u201D.");
+ }
+
+ private void errNoElementToCloseButEndTagSeen(@Local String name)
+ throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("No \u201C" + name + "\u201D element in scope but a \u201C"
+ + name + "\u201D end tag seen.");
+ }
+
+ private void errHtmlStartTagInForeignContext(@Local String name)
+ throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("HTML start tag \u201C" + name
+ + "\u201D in a foreign namespace context.");
+ }
+
+ private void errNoTableRowToClose() throws SAXException {
+ err("No table row to close.");
+ }
+
+ private void errNonSpaceInTable() throws SAXException {
+ err("Misplaced non-space characters inside a table.");
+ }
+
+ private void errUnclosedChildrenInRuby() throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("Unclosed children in \u201Cruby\u201D.");
+ }
+
+ private void errStartTagSeenWithoutRuby(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("Start tag \u201C"
+ + name
+ + "\u201D seen without a \u201Cruby\u201D element being open.");
+ }
+
+ private void errSelfClosing() throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("Self-closing syntax (\u201C/>\u201D) used on a non-void HTML element. Ignoring the slash and treating as a start tag.");
+ }
+
+ private void errNoCheckUnclosedElementsOnStack() throws SAXException {
+ errNoCheck("Unclosed elements on stack.");
+ }
+
+ private void errEndTagDidNotMatchCurrentOpenElement(@Local String name,
+ @Local String currOpenName) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("End tag \u201C"
+ + name
+ + "\u201D did not match the name of the current open element (\u201C"
+ + currOpenName + "\u201D).");
+ }
+
+ private void errEndTagViolatesNestingRules(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("End tag \u201C" + name + "\u201D violates nesting rules.");
+ }
+
+ private void errEofWithUnclosedElements() throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("End of file seen and there were open elements.");
+ // just report all remaining unclosed elements
+ errListUnclosedStartTags(0);
+ }
+
+ /**
+ * Reports arriving at/near end of document with unclosed elements remaining.
+ *
+ * @param message
+ * the message
+ * @throws SAXException
+ */
+ private void errEndWithUnclosedElements(@Local String name) throws SAXException {
+ if (errorHandler == null) {
+ return;
+ }
+ errNoCheck("End tag for \u201C"
+ + name
+ + "\u201D seen, but there were unclosed elements.");
+ // just report all remaining unclosed elements
+ errListUnclosedStartTags(0);
+ }
+}
diff --git a/parser/html/javasrc/UTF16Buffer.java b/parser/html/javasrc/UTF16Buffer.java
new file mode 100644
index 0000000000..ec79185ec2
--- /dev/null
+++ b/parser/html/javasrc/UTF16Buffer.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2008-2010 Mozilla Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package nu.validator.htmlparser.impl;
+
+import nu.validator.htmlparser.annotation.NoLength;
+
+/**
+ * An UTF-16 buffer that knows the start and end indeces of its unconsumed
+ * content.
+ *
+ * @version $Id$
+ * @author hsivonen
+ */
+public final class UTF16Buffer {
+
+ /**
+ * The backing store of the buffer. May be larger than the logical content
+ * of this <code>UTF16Buffer</code>.
+ */
+ private final @NoLength char[] buffer;
+
+ /**
+ * The index of the first unconsumed character in the backing buffer.
+ */
+ private int start;
+
+ /**
+ * The index of the slot immediately after the last character in the backing
+ * buffer that is part of the logical content of this
+ * <code>UTF16Buffer</code>.
+ */
+ private int end;
+
+ //[NOCPP[
+
+ /**
+ * Constructor for wrapping an existing UTF-16 code unit array.
+ *
+ * @param buffer
+ * the backing buffer
+ * @param start
+ * the index of the first character to consume
+ * @param end
+ * the index immediately after the last character to consume
+ */
+ public UTF16Buffer(@NoLength char[] buffer, int start, int end) {
+ this.buffer = buffer;
+ this.start = start;
+ this.end = end;
+ }
+
+ // ]NOCPP]
+
+ /**
+ * Returns the start index.
+ *
+ * @return the start index
+ */
+ public int getStart() {
+ return start;
+ }
+
+ /**
+ * Sets the start index.
+ *
+ * @param start
+ * the start index
+ */
+ public void setStart(int start) {
+ this.start = start;
+ }
+
+ /**
+ * Returns the backing buffer.
+ *
+ * @return the backing buffer
+ */
+ public @NoLength char[] getBuffer() {
+ return buffer;
+ }
+
+ /**
+ * Returns the end index.
+ *
+ * @return the end index
+ */
+ public int getEnd() {
+ return end;
+ }
+
+ /**
+ * Checks if the buffer has data left.
+ *
+ * @return <code>true</code> if there's data left
+ */
+ public boolean hasMore() {
+ return start < end;
+ }
+
+ /**
+ * Returns <code>end - start</code>.
+ *
+ * @return <code>end - start</code>
+ */
+ public int getLength() {
+ return end - start;
+ }
+
+ /**
+ * Adjusts the start index to skip over the first character if it is a line
+ * feed and the previous character was a carriage return.
+ *
+ * @param lastWasCR
+ * whether the previous character was a carriage return
+ */
+ public void adjust(boolean lastWasCR) {
+ if (lastWasCR && buffer[start] == '\n') {
+ start++;
+ }
+ }
+
+ /**
+ * Sets the end index.
+ *
+ * @param end
+ * the end index
+ */
+ public void setEnd(int end) {
+ this.end = end;
+ }
+}