mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-05-27 21:48:28 +00:00
Add java htmlparser sources that match the original 52-level state
https://hg.mozilla.org/projects/htmlparser/ Commit: abe62ab2a9b69ccb3b5d8a231ec1ae11154c571d
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Big5 extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"big5",
|
||||
"big5-hkscs",
|
||||
"cn-big5",
|
||||
"csbig5",
|
||||
"x-x-big5"
|
||||
};
|
||||
|
||||
private static final String NAME = "big5";
|
||||
|
||||
static final Big5 INSTANCE = new Big5();
|
||||
|
||||
private Big5() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new Big5Decoder(this);
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return new Big5Encoder(this);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) 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.encoding;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
public class Big5Decoder extends Decoder {
|
||||
|
||||
private int big5Lead = 0;
|
||||
|
||||
private char pendingTrail = '\u0000';
|
||||
|
||||
protected Big5Decoder(Charset cs) {
|
||||
super(cs, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
|
||||
assert !(this.report && (big5Lead != 0)):
|
||||
"When reporting, this method should never return with big5Lead set.";
|
||||
if (pendingTrail != '\u0000') {
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put(pendingTrail);
|
||||
pendingTrail = '\u0000';
|
||||
}
|
||||
for (;;) {
|
||||
if (!in.hasRemaining()) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
int b = ((int) in.get() & 0xFF);
|
||||
if (big5Lead == 0) {
|
||||
if (b <= 0x7F) {
|
||||
out.put((char) b);
|
||||
continue;
|
||||
}
|
||||
if (b >= 0x81 && b <= 0xFE) {
|
||||
if (this.report && !in.hasRemaining()) {
|
||||
// The Java API is badly documented. Need to do this
|
||||
// crazy thing and hope the caller knows about the
|
||||
// undocumented aspects of the API!
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
big5Lead = b;
|
||||
continue;
|
||||
}
|
||||
if (this.report) {
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
out.put('\uFFFD');
|
||||
continue;
|
||||
}
|
||||
int lead = big5Lead;
|
||||
big5Lead = 0;
|
||||
int offset = (b < 0x7F) ? 0x40 : 0x62;
|
||||
if ((b >= 0x40 && b <= 0x7E) || (b >= 0xA1 && b <= 0xFE)) {
|
||||
int pointer = (lead - 0x81) * 157 + (b - offset);
|
||||
char outTrail;
|
||||
switch (pointer) {
|
||||
case 1133:
|
||||
out.put('\u00CA');
|
||||
outTrail = '\u0304';
|
||||
break;
|
||||
case 1135:
|
||||
out.put('\u00CA');
|
||||
outTrail = '\u030C';
|
||||
break;
|
||||
case 1164:
|
||||
out.put('\u00EA');
|
||||
outTrail = '\u0304';
|
||||
break;
|
||||
case 1166:
|
||||
out.put('\u00EA');
|
||||
outTrail = '\u030C';
|
||||
break;
|
||||
default:
|
||||
char lowBits = Big5Data.lowBits(pointer);
|
||||
if (lowBits == '\u0000') {
|
||||
// The following |if| block fixes
|
||||
// https://github.com/whatwg/encoding/issues/5
|
||||
if (b <= 0x7F) {
|
||||
// prepend byte to stream
|
||||
// Always legal, since we've always just read a byte
|
||||
// if we come here.
|
||||
in.position(in.position() - 1);
|
||||
}
|
||||
if (this.report) {
|
||||
// This can go past the start of the buffer
|
||||
// if the caller does not conform to the
|
||||
// undocumented aspects of the API.
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.malformedForLength(b <= 0x7F ? 1 : 2);
|
||||
}
|
||||
out.put('\uFFFD');
|
||||
continue;
|
||||
}
|
||||
if (Big5Data.isAstral(pointer)) {
|
||||
int codePoint = lowBits | 0x20000;
|
||||
out.put((char) (0xD7C0 + (codePoint >> 10)));
|
||||
outTrail = (char) (0xDC00 + (codePoint & 0x3FF));
|
||||
break;
|
||||
}
|
||||
out.put(lowBits);
|
||||
continue;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
pendingTrail = outTrail;
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put(outTrail);
|
||||
continue;
|
||||
}
|
||||
// pointer is null
|
||||
if (b <= 0x7F) {
|
||||
// prepend byte to stream
|
||||
// Always legal, since we've always just read a byte
|
||||
// if we come here.
|
||||
in.position(in.position() - 1);
|
||||
}
|
||||
if (this.report) {
|
||||
// if position() == 0, the caller is not using the
|
||||
// undocumented part of the API right and the line
|
||||
// below will throw!
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.malformedForLength(b <= 0x7F ? 1 : 2);
|
||||
}
|
||||
out.put('\uFFFD');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected CoderResult implFlush(CharBuffer out) {
|
||||
if (pendingTrail != '\u0000') {
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put(pendingTrail);
|
||||
pendingTrail = '\u0000';
|
||||
}
|
||||
if (big5Lead != 0) {
|
||||
assert !this.report: "How come big5Lead got to be non-zero when decodeLoop() returned in the reporting mode?";
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put('\uFFFD');
|
||||
big5Lead = 0;
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
@Override protected void implReset() {
|
||||
big5Lead = 0;
|
||||
pendingTrail = '\u0000';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 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.encoding;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
public class Big5Encoder extends Encoder {
|
||||
|
||||
private char utf16Lead = '\u0000';
|
||||
|
||||
private byte pendingTrail = 0;
|
||||
|
||||
protected Big5Encoder(Charset cs) {
|
||||
super(cs, 1.5f, 2.0f);
|
||||
}
|
||||
|
||||
@Override protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
|
||||
assert !((this.reportMalformed || this.reportUnmappable) && (utf16Lead != '\u0000')):
|
||||
"When reporting, this method should never return with utf16Lead set.";
|
||||
if (pendingTrail != 0) {
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put(pendingTrail);
|
||||
pendingTrail = 0;
|
||||
}
|
||||
for (;;) {
|
||||
if (!in.hasRemaining()) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
boolean isAstral; // true means Plane 2, false means BMP
|
||||
char lowBits; // The low 16 bits of the code point
|
||||
char codeUnit = in.get();
|
||||
int highBits = (codeUnit & 0xFC00);
|
||||
if (highBits == 0xD800) {
|
||||
// high surrogate
|
||||
if (utf16Lead != '\u0000') {
|
||||
// High surrogate follows another high surrogate. The
|
||||
// *previous* code unit is in error.
|
||||
if (this.reportMalformed) {
|
||||
// The caller had better adhere to the API contract.
|
||||
// Otherwise, this may throw.
|
||||
in.position(in.position() - 2);
|
||||
utf16Lead = '\u0000';
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
out.put((byte) '?');
|
||||
}
|
||||
utf16Lead = codeUnit;
|
||||
continue;
|
||||
}
|
||||
if (highBits == 0xDC00) {
|
||||
// low surrogate
|
||||
if (utf16Lead == '\u0000') {
|
||||
// Got low surrogate without a previous high surrogate
|
||||
if (this.reportMalformed) {
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
out.put((byte) '?');
|
||||
continue;
|
||||
}
|
||||
int codePoint = (utf16Lead << 10) + codeUnit - 56613888;
|
||||
utf16Lead = '\u0000';
|
||||
// Plane 2 is the only astral plane that has potentially
|
||||
// Big5-encodable characters.
|
||||
if ((0xFF0000 & codePoint) != 0x20000) {
|
||||
if (this.reportUnmappable) {
|
||||
in.position(in.position() - 2);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
out.put((byte) '?');
|
||||
continue;
|
||||
}
|
||||
isAstral = true;
|
||||
lowBits = (char)(codePoint & 0xFFFF);
|
||||
} else {
|
||||
// not a surrogate
|
||||
if (utf16Lead != '\u0000') {
|
||||
// Non-surrogate follows a high surrogate. The *previous*
|
||||
// code unit is in error.
|
||||
utf16Lead = '\u0000';
|
||||
if (this.reportMalformed) {
|
||||
// The caller had better adhere to the API contract.
|
||||
// Otherwise, this may throw.
|
||||
in.position(in.position() - 2);
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
out.put((byte) '?');
|
||||
// Let's unconsume this code unit and reloop in order to
|
||||
// re-check if the output buffer still has space.
|
||||
in.position(in.position() - 1);
|
||||
continue;
|
||||
}
|
||||
isAstral = false;
|
||||
lowBits = codeUnit;
|
||||
}
|
||||
// isAstral now tells us if we have a Plane 2 or a BMP character.
|
||||
// lowBits tells us the low 16 bits.
|
||||
// After all the above setup to deal with UTF-16, we are now
|
||||
// finally ready to follow the spec.
|
||||
if (!isAstral && lowBits <= 0x7F) {
|
||||
out.put((byte)lowBits);
|
||||
continue;
|
||||
}
|
||||
int pointer = Big5Data.findPointer(lowBits, isAstral);
|
||||
if (pointer == 0) {
|
||||
if (this.reportUnmappable) {
|
||||
if (isAstral) {
|
||||
in.position(in.position() - 2);
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.unmappableForLength(1);
|
||||
}
|
||||
out.put((byte)'?');
|
||||
continue;
|
||||
}
|
||||
int lead = pointer / 157 + 0x81;
|
||||
int trail = pointer % 157;
|
||||
if (trail < 0x3F) {
|
||||
trail += 0x40;
|
||||
} else {
|
||||
trail += 0x62;
|
||||
}
|
||||
out.put((byte)lead);
|
||||
if (!out.hasRemaining()) {
|
||||
pendingTrail = (byte)trail;
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put((byte)trail);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected CoderResult implFlush(ByteBuffer out) {
|
||||
if (pendingTrail != 0) {
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put(pendingTrail);
|
||||
pendingTrail = 0;
|
||||
}
|
||||
if (utf16Lead != '\u0000') {
|
||||
assert !this.reportMalformed: "How come utf16Lead got to be non-zero when decodeLoop() returned in the reporting mode?";
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
out.put((byte)'?');
|
||||
utf16Lead = '\u0000';
|
||||
}
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
|
||||
@Override protected void implReset() {
|
||||
utf16Lead = '\u0000';
|
||||
pendingTrail = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 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.encoding;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
|
||||
public abstract class Decoder extends CharsetDecoder {
|
||||
|
||||
protected boolean report = true;
|
||||
|
||||
protected Decoder(Charset cs, float averageCharsPerByte, float maxCharsPerByte) {
|
||||
super(cs, averageCharsPerByte, maxCharsPerByte);
|
||||
}
|
||||
|
||||
@Override protected final void implOnMalformedInput(CodingErrorAction newAction) {
|
||||
if (newAction == null) {
|
||||
throw new IllegalArgumentException("The argument must not be null.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.IGNORE) {
|
||||
throw new IllegalArgumentException("The Encoding Standard does not allow errors to be ignored.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPLACE) {
|
||||
this.report = false;
|
||||
return;
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPORT) {
|
||||
this.report = true;
|
||||
return;
|
||||
}
|
||||
assert false: "Unreachable.";
|
||||
throw new IllegalArgumentException("Unknown CodingErrorAction.");
|
||||
}
|
||||
|
||||
@Override protected final void implOnUnmappableCharacter(
|
||||
CodingErrorAction newAction) {
|
||||
if (newAction == null) {
|
||||
throw new IllegalArgumentException("The argument must not be null.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.IGNORE) {
|
||||
throw new IllegalArgumentException("The Encoding Standard does not allow errors to be ignored.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPLACE) {
|
||||
return; // We don't actually care, since there are no unmappables.
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPORT) {
|
||||
return; // We don't actually care, since there are no unmappables.
|
||||
}
|
||||
assert false: "Unreachable.";
|
||||
throw new IllegalArgumentException("Unknown CodingErrorAction.");
|
||||
}
|
||||
|
||||
@Override protected final void implReplaceWith(String newReplacement) {
|
||||
if (!"\uFFFD".equals(newReplacement)) {
|
||||
throw new IllegalArgumentException("Only U+FFFD is allowed as the replacement.");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Check if the JDK decoders reset the reporting state on reset()
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 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.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
|
||||
public abstract class Encoder extends CharsetEncoder {
|
||||
|
||||
boolean reportMalformed = true;
|
||||
|
||||
boolean reportUnmappable = true;
|
||||
|
||||
protected Encoder(Charset cs, float averageBytesPerChar,
|
||||
float maxBytesPerChar) {
|
||||
super(cs, averageBytesPerChar, maxBytesPerChar);
|
||||
}
|
||||
|
||||
@Override protected final void implOnMalformedInput(CodingErrorAction newAction) {
|
||||
if (newAction == null) {
|
||||
throw new IllegalArgumentException("The argument must not be null.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.IGNORE) {
|
||||
throw new IllegalArgumentException("The Encoding Standard does not allow errors to be ignored.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPLACE) {
|
||||
this.reportMalformed = false;
|
||||
return;
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPORT) {
|
||||
this.reportUnmappable = true;
|
||||
return;
|
||||
}
|
||||
assert false: "Unreachable.";
|
||||
throw new IllegalArgumentException("Unknown CodingErrorAction.");
|
||||
}
|
||||
|
||||
@Override protected final void implOnUnmappableCharacter(
|
||||
CodingErrorAction newAction) {
|
||||
if (newAction == null) {
|
||||
throw new IllegalArgumentException("The argument must not be null.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.IGNORE) {
|
||||
throw new IllegalArgumentException("The Encoding Standard does not allow errors to be ignored.");
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPLACE) {
|
||||
this.reportUnmappable = false;
|
||||
return;
|
||||
}
|
||||
if (newAction == CodingErrorAction.REPORT) {
|
||||
this.reportMalformed = true;
|
||||
return;
|
||||
}
|
||||
assert false: "Unreachable.";
|
||||
throw new IllegalArgumentException("Unknown CodingErrorAction.");
|
||||
}
|
||||
|
||||
@Override public boolean isLegalReplacement(byte[] repl) {
|
||||
if (repl == null) {
|
||||
return false;
|
||||
}
|
||||
if (repl.length != 1) {
|
||||
return false;
|
||||
}
|
||||
if (repl[0] != '?') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override protected final void implReplaceWith(byte[] newReplacement) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,886 @@
|
||||
/*
|
||||
* Copyright (c) 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.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.nio.charset.spi.CharsetProvider;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Represents an <a href="https://encoding.spec.whatwg.org/#encoding">encoding</a>
|
||||
* as defined in the <a href="https://encoding.spec.whatwg.org/">Encoding
|
||||
* Standard</a>, provides access to each encoding defined in the Encoding
|
||||
* Standard via a static constant and provides the
|
||||
* "<a href="https://encoding.spec.whatwg.org/#concept-encoding-get">get an
|
||||
* encoding</a>" algorithm defined in the Encoding Standard.
|
||||
*
|
||||
* <p>This class inherits from {@link Charset} to allow the Encoding
|
||||
* Standard-compliant encodings to be used in contexts that support
|
||||
* <code>Charset</code> instances. However, by design, the Encoding
|
||||
* Standard-compliant encodings are not supplied via a {@link CharsetProvider}
|
||||
* and, therefore, are not available via and do not interfere with the static
|
||||
* methods provided by <code>Charset</code>. (This class provides methods of
|
||||
* the same name to hide each static method of <code>Charset</code> to help
|
||||
* avoid accidental calls to the static methods of the superclass when working
|
||||
* with Encoding Standard-compliant encodings.)
|
||||
*
|
||||
* <p>When an application needs to use a particular encoding, such as utf-8
|
||||
* or windows-1252, the corresponding constant, i.e.
|
||||
* {@link #UTF_8 Encoding.UTF_8} and {@link #WINDOWS_1252 Encoding.WINDOWS_1252}
|
||||
* respectively, should be used. However, when the application receives an
|
||||
* encoding label from external input, the method {@link #forName(String)
|
||||
* forName()} should be used to obtain the object representing the encoding
|
||||
* identified by the label. In contexts where labels that map to the
|
||||
* <a href="https://encoding.spec.whatwg.org/#replacement">replacement
|
||||
* encoding</a> should be treated as unknown, the method {@link
|
||||
* #forNameNoReplacement(String) forNameNoReplacement()} should be used instead.
|
||||
*
|
||||
*
|
||||
* @author hsivonen
|
||||
*/
|
||||
public abstract class Encoding extends Charset {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"866",
|
||||
"ansi_x3.4-1968",
|
||||
"arabic",
|
||||
"ascii",
|
||||
"asmo-708",
|
||||
"big5",
|
||||
"big5-hkscs",
|
||||
"chinese",
|
||||
"cn-big5",
|
||||
"cp1250",
|
||||
"cp1251",
|
||||
"cp1252",
|
||||
"cp1253",
|
||||
"cp1254",
|
||||
"cp1255",
|
||||
"cp1256",
|
||||
"cp1257",
|
||||
"cp1258",
|
||||
"cp819",
|
||||
"cp866",
|
||||
"csbig5",
|
||||
"cseuckr",
|
||||
"cseucpkdfmtjapanese",
|
||||
"csgb2312",
|
||||
"csibm866",
|
||||
"csiso2022jp",
|
||||
"csiso2022kr",
|
||||
"csiso58gb231280",
|
||||
"csiso88596e",
|
||||
"csiso88596i",
|
||||
"csiso88598e",
|
||||
"csiso88598i",
|
||||
"csisolatin1",
|
||||
"csisolatin2",
|
||||
"csisolatin3",
|
||||
"csisolatin4",
|
||||
"csisolatin5",
|
||||
"csisolatin6",
|
||||
"csisolatin9",
|
||||
"csisolatinarabic",
|
||||
"csisolatincyrillic",
|
||||
"csisolatingreek",
|
||||
"csisolatinhebrew",
|
||||
"cskoi8r",
|
||||
"csksc56011987",
|
||||
"csmacintosh",
|
||||
"csshiftjis",
|
||||
"cyrillic",
|
||||
"dos-874",
|
||||
"ecma-114",
|
||||
"ecma-118",
|
||||
"elot_928",
|
||||
"euc-jp",
|
||||
"euc-kr",
|
||||
"gb18030",
|
||||
"gb2312",
|
||||
"gb_2312",
|
||||
"gb_2312-80",
|
||||
"gbk",
|
||||
"greek",
|
||||
"greek8",
|
||||
"hebrew",
|
||||
"hz-gb-2312",
|
||||
"ibm819",
|
||||
"ibm866",
|
||||
"iso-2022-cn",
|
||||
"iso-2022-cn-ext",
|
||||
"iso-2022-jp",
|
||||
"iso-2022-kr",
|
||||
"iso-8859-1",
|
||||
"iso-8859-10",
|
||||
"iso-8859-11",
|
||||
"iso-8859-13",
|
||||
"iso-8859-14",
|
||||
"iso-8859-15",
|
||||
"iso-8859-16",
|
||||
"iso-8859-2",
|
||||
"iso-8859-3",
|
||||
"iso-8859-4",
|
||||
"iso-8859-5",
|
||||
"iso-8859-6",
|
||||
"iso-8859-6-e",
|
||||
"iso-8859-6-i",
|
||||
"iso-8859-7",
|
||||
"iso-8859-8",
|
||||
"iso-8859-8-e",
|
||||
"iso-8859-8-i",
|
||||
"iso-8859-9",
|
||||
"iso-ir-100",
|
||||
"iso-ir-101",
|
||||
"iso-ir-109",
|
||||
"iso-ir-110",
|
||||
"iso-ir-126",
|
||||
"iso-ir-127",
|
||||
"iso-ir-138",
|
||||
"iso-ir-144",
|
||||
"iso-ir-148",
|
||||
"iso-ir-149",
|
||||
"iso-ir-157",
|
||||
"iso-ir-58",
|
||||
"iso8859-1",
|
||||
"iso8859-10",
|
||||
"iso8859-11",
|
||||
"iso8859-13",
|
||||
"iso8859-14",
|
||||
"iso8859-15",
|
||||
"iso8859-2",
|
||||
"iso8859-3",
|
||||
"iso8859-4",
|
||||
"iso8859-5",
|
||||
"iso8859-6",
|
||||
"iso8859-7",
|
||||
"iso8859-8",
|
||||
"iso8859-9",
|
||||
"iso88591",
|
||||
"iso885910",
|
||||
"iso885911",
|
||||
"iso885913",
|
||||
"iso885914",
|
||||
"iso885915",
|
||||
"iso88592",
|
||||
"iso88593",
|
||||
"iso88594",
|
||||
"iso88595",
|
||||
"iso88596",
|
||||
"iso88597",
|
||||
"iso88598",
|
||||
"iso88599",
|
||||
"iso_8859-1",
|
||||
"iso_8859-15",
|
||||
"iso_8859-1:1987",
|
||||
"iso_8859-2",
|
||||
"iso_8859-2:1987",
|
||||
"iso_8859-3",
|
||||
"iso_8859-3:1988",
|
||||
"iso_8859-4",
|
||||
"iso_8859-4:1988",
|
||||
"iso_8859-5",
|
||||
"iso_8859-5:1988",
|
||||
"iso_8859-6",
|
||||
"iso_8859-6:1987",
|
||||
"iso_8859-7",
|
||||
"iso_8859-7:1987",
|
||||
"iso_8859-8",
|
||||
"iso_8859-8:1988",
|
||||
"iso_8859-9",
|
||||
"iso_8859-9:1989",
|
||||
"koi",
|
||||
"koi8",
|
||||
"koi8-r",
|
||||
"koi8-ru",
|
||||
"koi8-u",
|
||||
"koi8_r",
|
||||
"korean",
|
||||
"ks_c_5601-1987",
|
||||
"ks_c_5601-1989",
|
||||
"ksc5601",
|
||||
"ksc_5601",
|
||||
"l1",
|
||||
"l2",
|
||||
"l3",
|
||||
"l4",
|
||||
"l5",
|
||||
"l6",
|
||||
"l9",
|
||||
"latin1",
|
||||
"latin2",
|
||||
"latin3",
|
||||
"latin4",
|
||||
"latin5",
|
||||
"latin6",
|
||||
"logical",
|
||||
"mac",
|
||||
"macintosh",
|
||||
"ms932",
|
||||
"ms_kanji",
|
||||
"shift-jis",
|
||||
"shift_jis",
|
||||
"sjis",
|
||||
"sun_eu_greek",
|
||||
"tis-620",
|
||||
"unicode-1-1-utf-8",
|
||||
"us-ascii",
|
||||
"utf-16",
|
||||
"utf-16be",
|
||||
"utf-16le",
|
||||
"utf-8",
|
||||
"utf8",
|
||||
"visual",
|
||||
"windows-1250",
|
||||
"windows-1251",
|
||||
"windows-1252",
|
||||
"windows-1253",
|
||||
"windows-1254",
|
||||
"windows-1255",
|
||||
"windows-1256",
|
||||
"windows-1257",
|
||||
"windows-1258",
|
||||
"windows-31j",
|
||||
"windows-874",
|
||||
"windows-949",
|
||||
"x-cp1250",
|
||||
"x-cp1251",
|
||||
"x-cp1252",
|
||||
"x-cp1253",
|
||||
"x-cp1254",
|
||||
"x-cp1255",
|
||||
"x-cp1256",
|
||||
"x-cp1257",
|
||||
"x-cp1258",
|
||||
"x-euc-jp",
|
||||
"x-gbk",
|
||||
"x-mac-cyrillic",
|
||||
"x-mac-roman",
|
||||
"x-mac-ukrainian",
|
||||
"x-sjis",
|
||||
"x-user-defined",
|
||||
"x-x-big5",
|
||||
};
|
||||
|
||||
private static final Encoding[] ENCODINGS_FOR_LABELS = {
|
||||
Ibm866.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Big5.INSTANCE,
|
||||
Big5.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Big5.INSTANCE,
|
||||
Windows1250.INSTANCE,
|
||||
Windows1251.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Windows1253.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1255.INSTANCE,
|
||||
Windows1256.INSTANCE,
|
||||
Windows1257.INSTANCE,
|
||||
Windows1258.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Ibm866.INSTANCE,
|
||||
Big5.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
EucJp.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Ibm866.INSTANCE,
|
||||
Iso2022Jp.INSTANCE,
|
||||
Replacement.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Iso8I.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Koi8R.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
Macintosh.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
EucJp.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
Gb18030.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Replacement.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Ibm866.INSTANCE,
|
||||
Replacement.INSTANCE,
|
||||
Replacement.INSTANCE,
|
||||
Iso2022Jp.INSTANCE,
|
||||
Replacement.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
Iso13.INSTANCE,
|
||||
Iso14.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Iso16.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Iso8I.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
Iso13.INSTANCE,
|
||||
Iso14.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
Iso13.INSTANCE,
|
||||
Iso14.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Koi8R.INSTANCE,
|
||||
Koi8R.INSTANCE,
|
||||
Koi8R.INSTANCE,
|
||||
Koi8U.INSTANCE,
|
||||
Koi8U.INSTANCE,
|
||||
Koi8R.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Iso8I.INSTANCE,
|
||||
Macintosh.INSTANCE,
|
||||
Macintosh.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
Utf8.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Utf16Le.INSTANCE,
|
||||
Utf16Be.INSTANCE,
|
||||
Utf16Le.INSTANCE,
|
||||
Utf8.INSTANCE,
|
||||
Utf8.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Windows1250.INSTANCE,
|
||||
Windows1251.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Windows1253.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1255.INSTANCE,
|
||||
Windows1256.INSTANCE,
|
||||
Windows1257.INSTANCE,
|
||||
Windows1258.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
Windows1250.INSTANCE,
|
||||
Windows1251.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Windows1253.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1255.INSTANCE,
|
||||
Windows1256.INSTANCE,
|
||||
Windows1257.INSTANCE,
|
||||
Windows1258.INSTANCE,
|
||||
EucJp.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
MacCyrillic.INSTANCE,
|
||||
Macintosh.INSTANCE,
|
||||
MacCyrillic.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
UserDefined.INSTANCE,
|
||||
Big5.INSTANCE,
|
||||
};
|
||||
|
||||
private static final Encoding[] ENCODINGS = {
|
||||
Big5.INSTANCE,
|
||||
EucJp.INSTANCE,
|
||||
EucKr.INSTANCE,
|
||||
Gb18030.INSTANCE,
|
||||
Gbk.INSTANCE,
|
||||
Ibm866.INSTANCE,
|
||||
Iso2022Jp.INSTANCE,
|
||||
Iso10.INSTANCE,
|
||||
Iso13.INSTANCE,
|
||||
Iso14.INSTANCE,
|
||||
Iso15.INSTANCE,
|
||||
Iso16.INSTANCE,
|
||||
Iso2.INSTANCE,
|
||||
Iso3.INSTANCE,
|
||||
Iso4.INSTANCE,
|
||||
Iso5.INSTANCE,
|
||||
Iso6.INSTANCE,
|
||||
Iso7.INSTANCE,
|
||||
Iso8.INSTANCE,
|
||||
Iso8I.INSTANCE,
|
||||
Koi8R.INSTANCE,
|
||||
Koi8U.INSTANCE,
|
||||
Macintosh.INSTANCE,
|
||||
Replacement.INSTANCE,
|
||||
ShiftJis.INSTANCE,
|
||||
Utf16Be.INSTANCE,
|
||||
Utf16Le.INSTANCE,
|
||||
Utf8.INSTANCE,
|
||||
Windows1250.INSTANCE,
|
||||
Windows1251.INSTANCE,
|
||||
Windows1252.INSTANCE,
|
||||
Windows1253.INSTANCE,
|
||||
Windows1254.INSTANCE,
|
||||
Windows1255.INSTANCE,
|
||||
Windows1256.INSTANCE,
|
||||
Windows1257.INSTANCE,
|
||||
Windows1258.INSTANCE,
|
||||
Windows874.INSTANCE,
|
||||
MacCyrillic.INSTANCE,
|
||||
UserDefined.INSTANCE,
|
||||
};
|
||||
|
||||
/**
|
||||
* The big5 encoding.
|
||||
*/
|
||||
public static final Encoding BIG5 = Big5.INSTANCE;
|
||||
|
||||
/**
|
||||
* The euc-jp encoding.
|
||||
*/
|
||||
public static final Encoding EUC_JP = EucJp.INSTANCE;
|
||||
|
||||
/**
|
||||
* The euc-kr encoding.
|
||||
*/
|
||||
public static final Encoding EUC_KR = EucKr.INSTANCE;
|
||||
|
||||
/**
|
||||
* The gb18030 encoding.
|
||||
*/
|
||||
public static final Encoding GB18030 = Gb18030.INSTANCE;
|
||||
|
||||
/**
|
||||
* The gbk encoding.
|
||||
*/
|
||||
public static final Encoding GBK = Gbk.INSTANCE;
|
||||
|
||||
/**
|
||||
* The ibm866 encoding.
|
||||
*/
|
||||
public static final Encoding IBM866 = Ibm866.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-2022-jp encoding.
|
||||
*/
|
||||
public static final Encoding ISO_2022_JP = Iso2022Jp.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-10 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_10 = Iso10.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-13 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_13 = Iso13.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-14 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_14 = Iso14.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-15 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_15 = Iso15.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-16 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_16 = Iso16.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-2 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_2 = Iso2.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-3 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_3 = Iso3.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-4 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_4 = Iso4.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-5 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_5 = Iso5.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-6 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_6 = Iso6.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-7 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_7 = Iso7.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-8 encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_8 = Iso8.INSTANCE;
|
||||
|
||||
/**
|
||||
* The iso-8859-8-i encoding.
|
||||
*/
|
||||
public static final Encoding ISO_8859_8_I = Iso8I.INSTANCE;
|
||||
|
||||
/**
|
||||
* The koi8-r encoding.
|
||||
*/
|
||||
public static final Encoding KOI8_R = Koi8R.INSTANCE;
|
||||
|
||||
/**
|
||||
* The koi8-u encoding.
|
||||
*/
|
||||
public static final Encoding KOI8_U = Koi8U.INSTANCE;
|
||||
|
||||
/**
|
||||
* The macintosh encoding.
|
||||
*/
|
||||
public static final Encoding MACINTOSH = Macintosh.INSTANCE;
|
||||
|
||||
/**
|
||||
* The replacement encoding.
|
||||
*/
|
||||
public static final Encoding REPLACEMENT = Replacement.INSTANCE;
|
||||
|
||||
/**
|
||||
* The shift_jis encoding.
|
||||
*/
|
||||
public static final Encoding SHIFT_JIS = ShiftJis.INSTANCE;
|
||||
|
||||
/**
|
||||
* The utf-16be encoding.
|
||||
*/
|
||||
public static final Encoding UTF_16BE = Utf16Be.INSTANCE;
|
||||
|
||||
/**
|
||||
* The utf-16le encoding.
|
||||
*/
|
||||
public static final Encoding UTF_16LE = Utf16Le.INSTANCE;
|
||||
|
||||
/**
|
||||
* The utf-8 encoding.
|
||||
*/
|
||||
public static final Encoding UTF_8 = Utf8.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1250 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1250 = Windows1250.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1251 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1251 = Windows1251.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1252 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1252 = Windows1252.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1253 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1253 = Windows1253.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1254 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1254 = Windows1254.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1255 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1255 = Windows1255.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1256 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1256 = Windows1256.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1257 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1257 = Windows1257.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-1258 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_1258 = Windows1258.INSTANCE;
|
||||
|
||||
/**
|
||||
* The windows-874 encoding.
|
||||
*/
|
||||
public static final Encoding WINDOWS_874 = Windows874.INSTANCE;
|
||||
|
||||
/**
|
||||
* The x-mac-cyrillic encoding.
|
||||
*/
|
||||
public static final Encoding X_MAC_CYRILLIC = MacCyrillic.INSTANCE;
|
||||
|
||||
/**
|
||||
* The x-user-defined encoding.
|
||||
*/
|
||||
public static final Encoding X_USER_DEFINED = UserDefined.INSTANCE;
|
||||
|
||||
|
||||
private static SortedMap<String, Charset> encodings = null;
|
||||
|
||||
protected Encoding(String canonicalName, String[] aliases) {
|
||||
super(canonicalName, aliases);
|
||||
}
|
||||
|
||||
private enum State {
|
||||
HEAD, LABEL, TAIL
|
||||
};
|
||||
|
||||
public static Encoding forName(String label) {
|
||||
if (label == null) {
|
||||
throw new IllegalArgumentException("Label must not be null.");
|
||||
}
|
||||
if (label.length() == 0) {
|
||||
throw new IllegalCharsetNameException(label);
|
||||
}
|
||||
// First try the fast path
|
||||
int index = Arrays.binarySearch(LABELS, label);
|
||||
if (index >= 0) {
|
||||
return ENCODINGS_FOR_LABELS[index];
|
||||
}
|
||||
// Else, slow path
|
||||
StringBuilder sb = new StringBuilder();
|
||||
State state = State.HEAD;
|
||||
for (int i = 0; i < label.length(); i++) {
|
||||
char c = label.charAt(i);
|
||||
if ((c == ' ') || (c == '\n') || (c == '\r') || (c == '\t')
|
||||
|| (c == '\u000C')) {
|
||||
if (state == State.LABEL) {
|
||||
state = State.TAIL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) {
|
||||
switch (state) {
|
||||
case HEAD:
|
||||
state = State.LABEL;
|
||||
// Fall through
|
||||
case LABEL:
|
||||
sb.append(c);
|
||||
continue;
|
||||
case TAIL:
|
||||
throw new IllegalCharsetNameException(label);
|
||||
}
|
||||
}
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
c += 0x20;
|
||||
switch (state) {
|
||||
case HEAD:
|
||||
state = State.LABEL;
|
||||
// Fall through
|
||||
case LABEL:
|
||||
sb.append(c);
|
||||
continue;
|
||||
case TAIL:
|
||||
throw new IllegalCharsetNameException(label);
|
||||
}
|
||||
}
|
||||
if ((c == '-') || (c == '+') || (c == '.') || (c == ':')
|
||||
|| (c == '_')) {
|
||||
switch (state) {
|
||||
case LABEL:
|
||||
sb.append(c);
|
||||
continue;
|
||||
case HEAD:
|
||||
case TAIL:
|
||||
throw new IllegalCharsetNameException(label);
|
||||
}
|
||||
}
|
||||
throw new IllegalCharsetNameException(label);
|
||||
}
|
||||
index = Arrays.binarySearch(LABELS, sb.toString());
|
||||
if (index >= 0) {
|
||||
return ENCODINGS_FOR_LABELS[index];
|
||||
}
|
||||
throw new UnsupportedCharsetException(label);
|
||||
}
|
||||
|
||||
public static Encoding forNameNoReplacement(String label) {
|
||||
Encoding encoding = Encoding.forName(label);
|
||||
if (encoding == Encoding.REPLACEMENT) {
|
||||
throw new UnsupportedCharsetException(label);
|
||||
}
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public static boolean isSupported(String label) {
|
||||
try {
|
||||
Encoding.forName(label);
|
||||
} catch (UnsupportedCharsetException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isSupportedNoReplacement(String label) {
|
||||
try {
|
||||
Encoding.forNameNoReplacement(label);
|
||||
} catch (UnsupportedCharsetException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static SortedMap<String, Charset> availableCharsets() {
|
||||
if (encodings == null) {
|
||||
TreeMap<String, Charset> map = new TreeMap<String, Charset>();
|
||||
for (Encoding encoding : ENCODINGS) {
|
||||
map.put(encoding.name(), encoding);
|
||||
}
|
||||
encodings = Collections.unmodifiableSortedMap(map);
|
||||
}
|
||||
return encodings;
|
||||
}
|
||||
|
||||
public static Encoding defaultCharset() {
|
||||
return WINDOWS_1252;
|
||||
}
|
||||
|
||||
@Override public boolean canEncode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean contains(Charset cs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
throw new UnsupportedOperationException("Encoder not implemented.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class EucJp extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cseucpkdfmtjapanese",
|
||||
"euc-jp",
|
||||
"x-euc-jp"
|
||||
};
|
||||
|
||||
private static final String NAME = "euc-jp";
|
||||
|
||||
static final EucJp INSTANCE = new EucJp();
|
||||
|
||||
private EucJp() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class EucKr extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cseuckr",
|
||||
"csksc56011987",
|
||||
"euc-kr",
|
||||
"iso-ir-149",
|
||||
"korean",
|
||||
"ks_c_5601-1987",
|
||||
"ks_c_5601-1989",
|
||||
"ksc5601",
|
||||
"ksc_5601",
|
||||
"windows-949"
|
||||
};
|
||||
|
||||
private static final String NAME = "euc-kr";
|
||||
|
||||
static final EucKr INSTANCE = new EucKr();
|
||||
|
||||
private EucKr() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.encoding;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
public final class FallibleSingleByteDecoder extends InfallibleSingleByteDecoder {
|
||||
|
||||
public FallibleSingleByteDecoder(Encoding cs, char[] upperHalf) {
|
||||
super(cs, upperHalf);
|
||||
}
|
||||
|
||||
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
|
||||
if (!this.report) {
|
||||
return super.decodeLoop(in, out);
|
||||
} else {
|
||||
for (;;) {
|
||||
if (!in.hasRemaining()) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
int b = (int) in.get();
|
||||
if (b >= 0) {
|
||||
out.put((char) b);
|
||||
} else {
|
||||
char mapped = this.upperHalf[b + 128];
|
||||
if (mapped == '\uFFFD') {
|
||||
in.position(in.position() - 1);
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
out.put(mapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Gb18030 extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"gb18030"
|
||||
};
|
||||
|
||||
private static final String NAME = "gb18030";
|
||||
|
||||
static final Gb18030 INSTANCE = new Gb18030();
|
||||
|
||||
private Gb18030() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Gbk extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"chinese",
|
||||
"csgb2312",
|
||||
"csiso58gb231280",
|
||||
"gb2312",
|
||||
"gb_2312",
|
||||
"gb_2312-80",
|
||||
"gbk",
|
||||
"iso-ir-58",
|
||||
"x-gbk"
|
||||
};
|
||||
|
||||
private static final String NAME = "gbk";
|
||||
|
||||
static final Gbk INSTANCE = new Gbk();
|
||||
|
||||
private Gbk() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName("gb18030").newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Ibm866 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0410',
|
||||
'\u0411',
|
||||
'\u0412',
|
||||
'\u0413',
|
||||
'\u0414',
|
||||
'\u0415',
|
||||
'\u0416',
|
||||
'\u0417',
|
||||
'\u0418',
|
||||
'\u0419',
|
||||
'\u041a',
|
||||
'\u041b',
|
||||
'\u041c',
|
||||
'\u041d',
|
||||
'\u041e',
|
||||
'\u041f',
|
||||
'\u0420',
|
||||
'\u0421',
|
||||
'\u0422',
|
||||
'\u0423',
|
||||
'\u0424',
|
||||
'\u0425',
|
||||
'\u0426',
|
||||
'\u0427',
|
||||
'\u0428',
|
||||
'\u0429',
|
||||
'\u042a',
|
||||
'\u042b',
|
||||
'\u042c',
|
||||
'\u042d',
|
||||
'\u042e',
|
||||
'\u042f',
|
||||
'\u0430',
|
||||
'\u0431',
|
||||
'\u0432',
|
||||
'\u0433',
|
||||
'\u0434',
|
||||
'\u0435',
|
||||
'\u0436',
|
||||
'\u0437',
|
||||
'\u0438',
|
||||
'\u0439',
|
||||
'\u043a',
|
||||
'\u043b',
|
||||
'\u043c',
|
||||
'\u043d',
|
||||
'\u043e',
|
||||
'\u043f',
|
||||
'\u2591',
|
||||
'\u2592',
|
||||
'\u2593',
|
||||
'\u2502',
|
||||
'\u2524',
|
||||
'\u2561',
|
||||
'\u2562',
|
||||
'\u2556',
|
||||
'\u2555',
|
||||
'\u2563',
|
||||
'\u2551',
|
||||
'\u2557',
|
||||
'\u255d',
|
||||
'\u255c',
|
||||
'\u255b',
|
||||
'\u2510',
|
||||
'\u2514',
|
||||
'\u2534',
|
||||
'\u252c',
|
||||
'\u251c',
|
||||
'\u2500',
|
||||
'\u253c',
|
||||
'\u255e',
|
||||
'\u255f',
|
||||
'\u255a',
|
||||
'\u2554',
|
||||
'\u2569',
|
||||
'\u2566',
|
||||
'\u2560',
|
||||
'\u2550',
|
||||
'\u256c',
|
||||
'\u2567',
|
||||
'\u2568',
|
||||
'\u2564',
|
||||
'\u2565',
|
||||
'\u2559',
|
||||
'\u2558',
|
||||
'\u2552',
|
||||
'\u2553',
|
||||
'\u256b',
|
||||
'\u256a',
|
||||
'\u2518',
|
||||
'\u250c',
|
||||
'\u2588',
|
||||
'\u2584',
|
||||
'\u258c',
|
||||
'\u2590',
|
||||
'\u2580',
|
||||
'\u0440',
|
||||
'\u0441',
|
||||
'\u0442',
|
||||
'\u0443',
|
||||
'\u0444',
|
||||
'\u0445',
|
||||
'\u0446',
|
||||
'\u0447',
|
||||
'\u0448',
|
||||
'\u0449',
|
||||
'\u044a',
|
||||
'\u044b',
|
||||
'\u044c',
|
||||
'\u044d',
|
||||
'\u044e',
|
||||
'\u044f',
|
||||
'\u0401',
|
||||
'\u0451',
|
||||
'\u0404',
|
||||
'\u0454',
|
||||
'\u0407',
|
||||
'\u0457',
|
||||
'\u040e',
|
||||
'\u045e',
|
||||
'\u00b0',
|
||||
'\u2219',
|
||||
'\u00b7',
|
||||
'\u221a',
|
||||
'\u2116',
|
||||
'\u00a4',
|
||||
'\u25a0',
|
||||
'\u00a0'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"866",
|
||||
"cp866",
|
||||
"csibm866",
|
||||
"ibm866"
|
||||
};
|
||||
|
||||
private static final String NAME = "ibm866";
|
||||
|
||||
static final Encoding INSTANCE = new Ibm866();
|
||||
|
||||
private Ibm866() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.encoding;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
public class InfallibleSingleByteDecoder extends Decoder {
|
||||
|
||||
protected final char[] upperHalf;
|
||||
|
||||
protected InfallibleSingleByteDecoder(Encoding cs, char[] upperHalf) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
this.upperHalf = upperHalf;
|
||||
}
|
||||
|
||||
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
|
||||
// TODO figure out if it's worthwhile to optimize the case where both
|
||||
// buffers are array-backed.
|
||||
for (;;) {
|
||||
if (!in.hasRemaining()) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
int b = (int) in.get();
|
||||
if (b >= 0) {
|
||||
out.put((char) b);
|
||||
} else {
|
||||
out.put(this.upperHalf[b + 128]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso10 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0104',
|
||||
'\u0112',
|
||||
'\u0122',
|
||||
'\u012a',
|
||||
'\u0128',
|
||||
'\u0136',
|
||||
'\u00a7',
|
||||
'\u013b',
|
||||
'\u0110',
|
||||
'\u0160',
|
||||
'\u0166',
|
||||
'\u017d',
|
||||
'\u00ad',
|
||||
'\u016a',
|
||||
'\u014a',
|
||||
'\u00b0',
|
||||
'\u0105',
|
||||
'\u0113',
|
||||
'\u0123',
|
||||
'\u012b',
|
||||
'\u0129',
|
||||
'\u0137',
|
||||
'\u00b7',
|
||||
'\u013c',
|
||||
'\u0111',
|
||||
'\u0161',
|
||||
'\u0167',
|
||||
'\u017e',
|
||||
'\u2015',
|
||||
'\u016b',
|
||||
'\u014b',
|
||||
'\u0100',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u00c3',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u012e',
|
||||
'\u010c',
|
||||
'\u00c9',
|
||||
'\u0118',
|
||||
'\u00cb',
|
||||
'\u0116',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u00d0',
|
||||
'\u0145',
|
||||
'\u014c',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u0168',
|
||||
'\u00d8',
|
||||
'\u0172',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u00dd',
|
||||
'\u00de',
|
||||
'\u00df',
|
||||
'\u0101',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u00e3',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u012f',
|
||||
'\u010d',
|
||||
'\u00e9',
|
||||
'\u0119',
|
||||
'\u00eb',
|
||||
'\u0117',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u00f0',
|
||||
'\u0146',
|
||||
'\u014d',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u0169',
|
||||
'\u00f8',
|
||||
'\u0173',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u00fd',
|
||||
'\u00fe',
|
||||
'\u0138'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatin6",
|
||||
"iso-8859-10",
|
||||
"iso-ir-157",
|
||||
"iso8859-10",
|
||||
"iso885910",
|
||||
"l6",
|
||||
"latin6"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-10";
|
||||
|
||||
static final Encoding INSTANCE = new Iso10();
|
||||
|
||||
private Iso10() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso13 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u201d',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u201e',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00d8',
|
||||
'\u00a9',
|
||||
'\u0156',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00c6',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u201c',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00f8',
|
||||
'\u00b9',
|
||||
'\u0157',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u00e6',
|
||||
'\u0104',
|
||||
'\u012e',
|
||||
'\u0100',
|
||||
'\u0106',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u0118',
|
||||
'\u0112',
|
||||
'\u010c',
|
||||
'\u00c9',
|
||||
'\u0179',
|
||||
'\u0116',
|
||||
'\u0122',
|
||||
'\u0136',
|
||||
'\u012a',
|
||||
'\u013b',
|
||||
'\u0160',
|
||||
'\u0143',
|
||||
'\u0145',
|
||||
'\u00d3',
|
||||
'\u014c',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u0172',
|
||||
'\u0141',
|
||||
'\u015a',
|
||||
'\u016a',
|
||||
'\u00dc',
|
||||
'\u017b',
|
||||
'\u017d',
|
||||
'\u00df',
|
||||
'\u0105',
|
||||
'\u012f',
|
||||
'\u0101',
|
||||
'\u0107',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u0119',
|
||||
'\u0113',
|
||||
'\u010d',
|
||||
'\u00e9',
|
||||
'\u017a',
|
||||
'\u0117',
|
||||
'\u0123',
|
||||
'\u0137',
|
||||
'\u012b',
|
||||
'\u013c',
|
||||
'\u0161',
|
||||
'\u0144',
|
||||
'\u0146',
|
||||
'\u00f3',
|
||||
'\u014d',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u0173',
|
||||
'\u0142',
|
||||
'\u015b',
|
||||
'\u016b',
|
||||
'\u00fc',
|
||||
'\u017c',
|
||||
'\u017e',
|
||||
'\u2019'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"iso-8859-13",
|
||||
"iso8859-13",
|
||||
"iso885913"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-13";
|
||||
|
||||
static final Encoding INSTANCE = new Iso13();
|
||||
|
||||
private Iso13() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso14 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u1e02',
|
||||
'\u1e03',
|
||||
'\u00a3',
|
||||
'\u010a',
|
||||
'\u010b',
|
||||
'\u1e0a',
|
||||
'\u00a7',
|
||||
'\u1e80',
|
||||
'\u00a9',
|
||||
'\u1e82',
|
||||
'\u1e0b',
|
||||
'\u1ef2',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u0178',
|
||||
'\u1e1e',
|
||||
'\u1e1f',
|
||||
'\u0120',
|
||||
'\u0121',
|
||||
'\u1e40',
|
||||
'\u1e41',
|
||||
'\u00b6',
|
||||
'\u1e56',
|
||||
'\u1e81',
|
||||
'\u1e57',
|
||||
'\u1e83',
|
||||
'\u1e60',
|
||||
'\u1ef3',
|
||||
'\u1e84',
|
||||
'\u1e85',
|
||||
'\u1e61',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u00c3',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u00cc',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u0174',
|
||||
'\u00d1',
|
||||
'\u00d2',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u1e6a',
|
||||
'\u00d8',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u00dd',
|
||||
'\u0176',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u00e3',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ec',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u0175',
|
||||
'\u00f1',
|
||||
'\u00f2',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u1e6b',
|
||||
'\u00f8',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u00fd',
|
||||
'\u0177',
|
||||
'\u00ff'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"iso-8859-14",
|
||||
"iso8859-14",
|
||||
"iso885914"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-14";
|
||||
|
||||
static final Encoding INSTANCE = new Iso14();
|
||||
|
||||
private Iso14() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso15 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u00a1',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u20ac',
|
||||
'\u00a5',
|
||||
'\u0160',
|
||||
'\u00a7',
|
||||
'\u0161',
|
||||
'\u00a9',
|
||||
'\u00aa',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u017d',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u017e',
|
||||
'\u00b9',
|
||||
'\u00ba',
|
||||
'\u00bb',
|
||||
'\u0152',
|
||||
'\u0153',
|
||||
'\u0178',
|
||||
'\u00bf',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u00c3',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u00cc',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u00d0',
|
||||
'\u00d1',
|
||||
'\u00d2',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u00d8',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u00dd',
|
||||
'\u00de',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u00e3',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ec',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u00f0',
|
||||
'\u00f1',
|
||||
'\u00f2',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u00f8',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u00fd',
|
||||
'\u00fe',
|
||||
'\u00ff'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatin9",
|
||||
"iso-8859-15",
|
||||
"iso8859-15",
|
||||
"iso885915",
|
||||
"iso_8859-15",
|
||||
"l9"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-15";
|
||||
|
||||
static final Encoding INSTANCE = new Iso15();
|
||||
|
||||
private Iso15() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso16 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0104',
|
||||
'\u0105',
|
||||
'\u0141',
|
||||
'\u20ac',
|
||||
'\u201e',
|
||||
'\u0160',
|
||||
'\u00a7',
|
||||
'\u0161',
|
||||
'\u00a9',
|
||||
'\u0218',
|
||||
'\u00ab',
|
||||
'\u0179',
|
||||
'\u00ad',
|
||||
'\u017a',
|
||||
'\u017b',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u010c',
|
||||
'\u0142',
|
||||
'\u017d',
|
||||
'\u201d',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u017e',
|
||||
'\u010d',
|
||||
'\u0219',
|
||||
'\u00bb',
|
||||
'\u0152',
|
||||
'\u0153',
|
||||
'\u0178',
|
||||
'\u017c',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u0102',
|
||||
'\u00c4',
|
||||
'\u0106',
|
||||
'\u00c6',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u00cc',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u0110',
|
||||
'\u0143',
|
||||
'\u00d2',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u0150',
|
||||
'\u00d6',
|
||||
'\u015a',
|
||||
'\u0170',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u0118',
|
||||
'\u021a',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u0103',
|
||||
'\u00e4',
|
||||
'\u0107',
|
||||
'\u00e6',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ec',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u0111',
|
||||
'\u0144',
|
||||
'\u00f2',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u0151',
|
||||
'\u00f6',
|
||||
'\u015b',
|
||||
'\u0171',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u0119',
|
||||
'\u021b',
|
||||
'\u00ff'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"iso-8859-16"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-16";
|
||||
|
||||
static final Encoding INSTANCE = new Iso16();
|
||||
|
||||
private Iso16() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso2 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0104',
|
||||
'\u02d8',
|
||||
'\u0141',
|
||||
'\u00a4',
|
||||
'\u013d',
|
||||
'\u015a',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u0160',
|
||||
'\u015e',
|
||||
'\u0164',
|
||||
'\u0179',
|
||||
'\u00ad',
|
||||
'\u017d',
|
||||
'\u017b',
|
||||
'\u00b0',
|
||||
'\u0105',
|
||||
'\u02db',
|
||||
'\u0142',
|
||||
'\u00b4',
|
||||
'\u013e',
|
||||
'\u015b',
|
||||
'\u02c7',
|
||||
'\u00b8',
|
||||
'\u0161',
|
||||
'\u015f',
|
||||
'\u0165',
|
||||
'\u017a',
|
||||
'\u02dd',
|
||||
'\u017e',
|
||||
'\u017c',
|
||||
'\u0154',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u0102',
|
||||
'\u00c4',
|
||||
'\u0139',
|
||||
'\u0106',
|
||||
'\u00c7',
|
||||
'\u010c',
|
||||
'\u00c9',
|
||||
'\u0118',
|
||||
'\u00cb',
|
||||
'\u011a',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u010e',
|
||||
'\u0110',
|
||||
'\u0143',
|
||||
'\u0147',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u0150',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u0158',
|
||||
'\u016e',
|
||||
'\u00da',
|
||||
'\u0170',
|
||||
'\u00dc',
|
||||
'\u00dd',
|
||||
'\u0162',
|
||||
'\u00df',
|
||||
'\u0155',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u0103',
|
||||
'\u00e4',
|
||||
'\u013a',
|
||||
'\u0107',
|
||||
'\u00e7',
|
||||
'\u010d',
|
||||
'\u00e9',
|
||||
'\u0119',
|
||||
'\u00eb',
|
||||
'\u011b',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u010f',
|
||||
'\u0111',
|
||||
'\u0144',
|
||||
'\u0148',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u0151',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u0159',
|
||||
'\u016f',
|
||||
'\u00fa',
|
||||
'\u0171',
|
||||
'\u00fc',
|
||||
'\u00fd',
|
||||
'\u0163',
|
||||
'\u02d9'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatin2",
|
||||
"iso-8859-2",
|
||||
"iso-ir-101",
|
||||
"iso8859-2",
|
||||
"iso88592",
|
||||
"iso_8859-2",
|
||||
"iso_8859-2:1987",
|
||||
"l2",
|
||||
"latin2"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-2";
|
||||
|
||||
static final Encoding INSTANCE = new Iso2();
|
||||
|
||||
private Iso2() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Iso2022Jp extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csiso2022jp",
|
||||
"iso-2022-jp"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-2022-jp";
|
||||
|
||||
static final Iso2022Jp INSTANCE = new Iso2022Jp();
|
||||
|
||||
private Iso2022Jp() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso3 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0126',
|
||||
'\u02d8',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\ufffd',
|
||||
'\u0124',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u0130',
|
||||
'\u015e',
|
||||
'\u011e',
|
||||
'\u0134',
|
||||
'\u00ad',
|
||||
'\ufffd',
|
||||
'\u017b',
|
||||
'\u00b0',
|
||||
'\u0127',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u0125',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u0131',
|
||||
'\u015f',
|
||||
'\u011f',
|
||||
'\u0135',
|
||||
'\u00bd',
|
||||
'\ufffd',
|
||||
'\u017c',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\ufffd',
|
||||
'\u00c4',
|
||||
'\u010a',
|
||||
'\u0108',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u00cc',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\ufffd',
|
||||
'\u00d1',
|
||||
'\u00d2',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u0120',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u011c',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u016c',
|
||||
'\u015c',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\ufffd',
|
||||
'\u00e4',
|
||||
'\u010b',
|
||||
'\u0109',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ec',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\ufffd',
|
||||
'\u00f1',
|
||||
'\u00f2',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u0121',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u011d',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u016d',
|
||||
'\u015d',
|
||||
'\u02d9'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatin3",
|
||||
"iso-8859-3",
|
||||
"iso-ir-109",
|
||||
"iso8859-3",
|
||||
"iso88593",
|
||||
"iso_8859-3",
|
||||
"iso_8859-3:1988",
|
||||
"l3",
|
||||
"latin3"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-3";
|
||||
|
||||
static final Encoding INSTANCE = new Iso3();
|
||||
|
||||
private Iso3() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso4 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0104',
|
||||
'\u0138',
|
||||
'\u0156',
|
||||
'\u00a4',
|
||||
'\u0128',
|
||||
'\u013b',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u0160',
|
||||
'\u0112',
|
||||
'\u0122',
|
||||
'\u0166',
|
||||
'\u00ad',
|
||||
'\u017d',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u0105',
|
||||
'\u02db',
|
||||
'\u0157',
|
||||
'\u00b4',
|
||||
'\u0129',
|
||||
'\u013c',
|
||||
'\u02c7',
|
||||
'\u00b8',
|
||||
'\u0161',
|
||||
'\u0113',
|
||||
'\u0123',
|
||||
'\u0167',
|
||||
'\u014a',
|
||||
'\u017e',
|
||||
'\u014b',
|
||||
'\u0100',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u00c3',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u012e',
|
||||
'\u010c',
|
||||
'\u00c9',
|
||||
'\u0118',
|
||||
'\u00cb',
|
||||
'\u0116',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u012a',
|
||||
'\u0110',
|
||||
'\u0145',
|
||||
'\u014c',
|
||||
'\u0136',
|
||||
'\u00d4',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u00d8',
|
||||
'\u0172',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u0168',
|
||||
'\u016a',
|
||||
'\u00df',
|
||||
'\u0101',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u00e3',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u012f',
|
||||
'\u010d',
|
||||
'\u00e9',
|
||||
'\u0119',
|
||||
'\u00eb',
|
||||
'\u0117',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u012b',
|
||||
'\u0111',
|
||||
'\u0146',
|
||||
'\u014d',
|
||||
'\u0137',
|
||||
'\u00f4',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u00f8',
|
||||
'\u0173',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u0169',
|
||||
'\u016b',
|
||||
'\u02d9'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatin4",
|
||||
"iso-8859-4",
|
||||
"iso-ir-110",
|
||||
"iso8859-4",
|
||||
"iso88594",
|
||||
"iso_8859-4",
|
||||
"iso_8859-4:1988",
|
||||
"l4",
|
||||
"latin4"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-4";
|
||||
|
||||
static final Encoding INSTANCE = new Iso4();
|
||||
|
||||
private Iso4() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso5 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0401',
|
||||
'\u0402',
|
||||
'\u0403',
|
||||
'\u0404',
|
||||
'\u0405',
|
||||
'\u0406',
|
||||
'\u0407',
|
||||
'\u0408',
|
||||
'\u0409',
|
||||
'\u040a',
|
||||
'\u040b',
|
||||
'\u040c',
|
||||
'\u00ad',
|
||||
'\u040e',
|
||||
'\u040f',
|
||||
'\u0410',
|
||||
'\u0411',
|
||||
'\u0412',
|
||||
'\u0413',
|
||||
'\u0414',
|
||||
'\u0415',
|
||||
'\u0416',
|
||||
'\u0417',
|
||||
'\u0418',
|
||||
'\u0419',
|
||||
'\u041a',
|
||||
'\u041b',
|
||||
'\u041c',
|
||||
'\u041d',
|
||||
'\u041e',
|
||||
'\u041f',
|
||||
'\u0420',
|
||||
'\u0421',
|
||||
'\u0422',
|
||||
'\u0423',
|
||||
'\u0424',
|
||||
'\u0425',
|
||||
'\u0426',
|
||||
'\u0427',
|
||||
'\u0428',
|
||||
'\u0429',
|
||||
'\u042a',
|
||||
'\u042b',
|
||||
'\u042c',
|
||||
'\u042d',
|
||||
'\u042e',
|
||||
'\u042f',
|
||||
'\u0430',
|
||||
'\u0431',
|
||||
'\u0432',
|
||||
'\u0433',
|
||||
'\u0434',
|
||||
'\u0435',
|
||||
'\u0436',
|
||||
'\u0437',
|
||||
'\u0438',
|
||||
'\u0439',
|
||||
'\u043a',
|
||||
'\u043b',
|
||||
'\u043c',
|
||||
'\u043d',
|
||||
'\u043e',
|
||||
'\u043f',
|
||||
'\u0440',
|
||||
'\u0441',
|
||||
'\u0442',
|
||||
'\u0443',
|
||||
'\u0444',
|
||||
'\u0445',
|
||||
'\u0446',
|
||||
'\u0447',
|
||||
'\u0448',
|
||||
'\u0449',
|
||||
'\u044a',
|
||||
'\u044b',
|
||||
'\u044c',
|
||||
'\u044d',
|
||||
'\u044e',
|
||||
'\u044f',
|
||||
'\u2116',
|
||||
'\u0451',
|
||||
'\u0452',
|
||||
'\u0453',
|
||||
'\u0454',
|
||||
'\u0455',
|
||||
'\u0456',
|
||||
'\u0457',
|
||||
'\u0458',
|
||||
'\u0459',
|
||||
'\u045a',
|
||||
'\u045b',
|
||||
'\u045c',
|
||||
'\u00a7',
|
||||
'\u045e',
|
||||
'\u045f'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatincyrillic",
|
||||
"cyrillic",
|
||||
"iso-8859-5",
|
||||
"iso-ir-144",
|
||||
"iso8859-5",
|
||||
"iso88595",
|
||||
"iso_8859-5",
|
||||
"iso_8859-5:1988"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-5";
|
||||
|
||||
static final Encoding INSTANCE = new Iso5();
|
||||
|
||||
private Iso5() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso6 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u00a4',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u060c',
|
||||
'\u00ad',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u061b',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u061f',
|
||||
'\ufffd',
|
||||
'\u0621',
|
||||
'\u0622',
|
||||
'\u0623',
|
||||
'\u0624',
|
||||
'\u0625',
|
||||
'\u0626',
|
||||
'\u0627',
|
||||
'\u0628',
|
||||
'\u0629',
|
||||
'\u062a',
|
||||
'\u062b',
|
||||
'\u062c',
|
||||
'\u062d',
|
||||
'\u062e',
|
||||
'\u062f',
|
||||
'\u0630',
|
||||
'\u0631',
|
||||
'\u0632',
|
||||
'\u0633',
|
||||
'\u0634',
|
||||
'\u0635',
|
||||
'\u0636',
|
||||
'\u0637',
|
||||
'\u0638',
|
||||
'\u0639',
|
||||
'\u063a',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u0640',
|
||||
'\u0641',
|
||||
'\u0642',
|
||||
'\u0643',
|
||||
'\u0644',
|
||||
'\u0645',
|
||||
'\u0646',
|
||||
'\u0647',
|
||||
'\u0648',
|
||||
'\u0649',
|
||||
'\u064a',
|
||||
'\u064b',
|
||||
'\u064c',
|
||||
'\u064d',
|
||||
'\u064e',
|
||||
'\u064f',
|
||||
'\u0650',
|
||||
'\u0651',
|
||||
'\u0652',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"arabic",
|
||||
"asmo-708",
|
||||
"csiso88596e",
|
||||
"csiso88596i",
|
||||
"csisolatinarabic",
|
||||
"ecma-114",
|
||||
"iso-8859-6",
|
||||
"iso-8859-6-e",
|
||||
"iso-8859-6-i",
|
||||
"iso-ir-127",
|
||||
"iso8859-6",
|
||||
"iso88596",
|
||||
"iso_8859-6",
|
||||
"iso_8859-6:1987"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-6";
|
||||
|
||||
static final Encoding INSTANCE = new Iso6();
|
||||
|
||||
private Iso6() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso7 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u00a3',
|
||||
'\u20ac',
|
||||
'\u20af',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u037a',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\ufffd',
|
||||
'\u2015',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u0384',
|
||||
'\u0385',
|
||||
'\u0386',
|
||||
'\u00b7',
|
||||
'\u0388',
|
||||
'\u0389',
|
||||
'\u038a',
|
||||
'\u00bb',
|
||||
'\u038c',
|
||||
'\u00bd',
|
||||
'\u038e',
|
||||
'\u038f',
|
||||
'\u0390',
|
||||
'\u0391',
|
||||
'\u0392',
|
||||
'\u0393',
|
||||
'\u0394',
|
||||
'\u0395',
|
||||
'\u0396',
|
||||
'\u0397',
|
||||
'\u0398',
|
||||
'\u0399',
|
||||
'\u039a',
|
||||
'\u039b',
|
||||
'\u039c',
|
||||
'\u039d',
|
||||
'\u039e',
|
||||
'\u039f',
|
||||
'\u03a0',
|
||||
'\u03a1',
|
||||
'\ufffd',
|
||||
'\u03a3',
|
||||
'\u03a4',
|
||||
'\u03a5',
|
||||
'\u03a6',
|
||||
'\u03a7',
|
||||
'\u03a8',
|
||||
'\u03a9',
|
||||
'\u03aa',
|
||||
'\u03ab',
|
||||
'\u03ac',
|
||||
'\u03ad',
|
||||
'\u03ae',
|
||||
'\u03af',
|
||||
'\u03b0',
|
||||
'\u03b1',
|
||||
'\u03b2',
|
||||
'\u03b3',
|
||||
'\u03b4',
|
||||
'\u03b5',
|
||||
'\u03b6',
|
||||
'\u03b7',
|
||||
'\u03b8',
|
||||
'\u03b9',
|
||||
'\u03ba',
|
||||
'\u03bb',
|
||||
'\u03bc',
|
||||
'\u03bd',
|
||||
'\u03be',
|
||||
'\u03bf',
|
||||
'\u03c0',
|
||||
'\u03c1',
|
||||
'\u03c2',
|
||||
'\u03c3',
|
||||
'\u03c4',
|
||||
'\u03c5',
|
||||
'\u03c6',
|
||||
'\u03c7',
|
||||
'\u03c8',
|
||||
'\u03c9',
|
||||
'\u03ca',
|
||||
'\u03cb',
|
||||
'\u03cc',
|
||||
'\u03cd',
|
||||
'\u03ce',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csisolatingreek",
|
||||
"ecma-118",
|
||||
"elot_928",
|
||||
"greek",
|
||||
"greek8",
|
||||
"iso-8859-7",
|
||||
"iso-ir-126",
|
||||
"iso8859-7",
|
||||
"iso88597",
|
||||
"iso_8859-7",
|
||||
"iso_8859-7:1987",
|
||||
"sun_eu_greek"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-7";
|
||||
|
||||
static final Encoding INSTANCE = new Iso7();
|
||||
|
||||
private Iso7() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso8 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\ufffd',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u00d7',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u00f7',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u2017',
|
||||
'\u05d0',
|
||||
'\u05d1',
|
||||
'\u05d2',
|
||||
'\u05d3',
|
||||
'\u05d4',
|
||||
'\u05d5',
|
||||
'\u05d6',
|
||||
'\u05d7',
|
||||
'\u05d8',
|
||||
'\u05d9',
|
||||
'\u05da',
|
||||
'\u05db',
|
||||
'\u05dc',
|
||||
'\u05dd',
|
||||
'\u05de',
|
||||
'\u05df',
|
||||
'\u05e0',
|
||||
'\u05e1',
|
||||
'\u05e2',
|
||||
'\u05e3',
|
||||
'\u05e4',
|
||||
'\u05e5',
|
||||
'\u05e6',
|
||||
'\u05e7',
|
||||
'\u05e8',
|
||||
'\u05e9',
|
||||
'\u05ea',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u200e',
|
||||
'\u200f',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csiso88598e",
|
||||
"csisolatinhebrew",
|
||||
"hebrew",
|
||||
"iso-8859-8",
|
||||
"iso-8859-8-e",
|
||||
"iso-ir-138",
|
||||
"iso8859-8",
|
||||
"iso88598",
|
||||
"iso_8859-8",
|
||||
"iso_8859-8:1988",
|
||||
"visual"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-8";
|
||||
|
||||
static final Encoding INSTANCE = new Iso8();
|
||||
|
||||
private Iso8() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Iso8I extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0080',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u0085',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u0091',
|
||||
'\u0092',
|
||||
'\u0093',
|
||||
'\u0094',
|
||||
'\u0095',
|
||||
'\u0096',
|
||||
'\u0097',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\ufffd',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u00d7',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u00f7',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u2017',
|
||||
'\u05d0',
|
||||
'\u05d1',
|
||||
'\u05d2',
|
||||
'\u05d3',
|
||||
'\u05d4',
|
||||
'\u05d5',
|
||||
'\u05d6',
|
||||
'\u05d7',
|
||||
'\u05d8',
|
||||
'\u05d9',
|
||||
'\u05da',
|
||||
'\u05db',
|
||||
'\u05dc',
|
||||
'\u05dd',
|
||||
'\u05de',
|
||||
'\u05df',
|
||||
'\u05e0',
|
||||
'\u05e1',
|
||||
'\u05e2',
|
||||
'\u05e3',
|
||||
'\u05e4',
|
||||
'\u05e5',
|
||||
'\u05e6',
|
||||
'\u05e7',
|
||||
'\u05e8',
|
||||
'\u05e9',
|
||||
'\u05ea',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u200e',
|
||||
'\u200f',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csiso88598i",
|
||||
"iso-8859-8-i",
|
||||
"logical"
|
||||
};
|
||||
|
||||
private static final String NAME = "iso-8859-8-i";
|
||||
|
||||
static final Encoding INSTANCE = new Iso8I();
|
||||
|
||||
private Iso8I() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Koi8R extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u2500',
|
||||
'\u2502',
|
||||
'\u250c',
|
||||
'\u2510',
|
||||
'\u2514',
|
||||
'\u2518',
|
||||
'\u251c',
|
||||
'\u2524',
|
||||
'\u252c',
|
||||
'\u2534',
|
||||
'\u253c',
|
||||
'\u2580',
|
||||
'\u2584',
|
||||
'\u2588',
|
||||
'\u258c',
|
||||
'\u2590',
|
||||
'\u2591',
|
||||
'\u2592',
|
||||
'\u2593',
|
||||
'\u2320',
|
||||
'\u25a0',
|
||||
'\u2219',
|
||||
'\u221a',
|
||||
'\u2248',
|
||||
'\u2264',
|
||||
'\u2265',
|
||||
'\u00a0',
|
||||
'\u2321',
|
||||
'\u00b0',
|
||||
'\u00b2',
|
||||
'\u00b7',
|
||||
'\u00f7',
|
||||
'\u2550',
|
||||
'\u2551',
|
||||
'\u2552',
|
||||
'\u0451',
|
||||
'\u2553',
|
||||
'\u2554',
|
||||
'\u2555',
|
||||
'\u2556',
|
||||
'\u2557',
|
||||
'\u2558',
|
||||
'\u2559',
|
||||
'\u255a',
|
||||
'\u255b',
|
||||
'\u255c',
|
||||
'\u255d',
|
||||
'\u255e',
|
||||
'\u255f',
|
||||
'\u2560',
|
||||
'\u2561',
|
||||
'\u0401',
|
||||
'\u2562',
|
||||
'\u2563',
|
||||
'\u2564',
|
||||
'\u2565',
|
||||
'\u2566',
|
||||
'\u2567',
|
||||
'\u2568',
|
||||
'\u2569',
|
||||
'\u256a',
|
||||
'\u256b',
|
||||
'\u256c',
|
||||
'\u00a9',
|
||||
'\u044e',
|
||||
'\u0430',
|
||||
'\u0431',
|
||||
'\u0446',
|
||||
'\u0434',
|
||||
'\u0435',
|
||||
'\u0444',
|
||||
'\u0433',
|
||||
'\u0445',
|
||||
'\u0438',
|
||||
'\u0439',
|
||||
'\u043a',
|
||||
'\u043b',
|
||||
'\u043c',
|
||||
'\u043d',
|
||||
'\u043e',
|
||||
'\u043f',
|
||||
'\u044f',
|
||||
'\u0440',
|
||||
'\u0441',
|
||||
'\u0442',
|
||||
'\u0443',
|
||||
'\u0436',
|
||||
'\u0432',
|
||||
'\u044c',
|
||||
'\u044b',
|
||||
'\u0437',
|
||||
'\u0448',
|
||||
'\u044d',
|
||||
'\u0449',
|
||||
'\u0447',
|
||||
'\u044a',
|
||||
'\u042e',
|
||||
'\u0410',
|
||||
'\u0411',
|
||||
'\u0426',
|
||||
'\u0414',
|
||||
'\u0415',
|
||||
'\u0424',
|
||||
'\u0413',
|
||||
'\u0425',
|
||||
'\u0418',
|
||||
'\u0419',
|
||||
'\u041a',
|
||||
'\u041b',
|
||||
'\u041c',
|
||||
'\u041d',
|
||||
'\u041e',
|
||||
'\u041f',
|
||||
'\u042f',
|
||||
'\u0420',
|
||||
'\u0421',
|
||||
'\u0422',
|
||||
'\u0423',
|
||||
'\u0416',
|
||||
'\u0412',
|
||||
'\u042c',
|
||||
'\u042b',
|
||||
'\u0417',
|
||||
'\u0428',
|
||||
'\u042d',
|
||||
'\u0429',
|
||||
'\u0427',
|
||||
'\u042a'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cskoi8r",
|
||||
"koi",
|
||||
"koi8",
|
||||
"koi8-r",
|
||||
"koi8_r"
|
||||
};
|
||||
|
||||
private static final String NAME = "koi8-r";
|
||||
|
||||
static final Encoding INSTANCE = new Koi8R();
|
||||
|
||||
private Koi8R() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Koi8U extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u2500',
|
||||
'\u2502',
|
||||
'\u250c',
|
||||
'\u2510',
|
||||
'\u2514',
|
||||
'\u2518',
|
||||
'\u251c',
|
||||
'\u2524',
|
||||
'\u252c',
|
||||
'\u2534',
|
||||
'\u253c',
|
||||
'\u2580',
|
||||
'\u2584',
|
||||
'\u2588',
|
||||
'\u258c',
|
||||
'\u2590',
|
||||
'\u2591',
|
||||
'\u2592',
|
||||
'\u2593',
|
||||
'\u2320',
|
||||
'\u25a0',
|
||||
'\u2219',
|
||||
'\u221a',
|
||||
'\u2248',
|
||||
'\u2264',
|
||||
'\u2265',
|
||||
'\u00a0',
|
||||
'\u2321',
|
||||
'\u00b0',
|
||||
'\u00b2',
|
||||
'\u00b7',
|
||||
'\u00f7',
|
||||
'\u2550',
|
||||
'\u2551',
|
||||
'\u2552',
|
||||
'\u0451',
|
||||
'\u0454',
|
||||
'\u2554',
|
||||
'\u0456',
|
||||
'\u0457',
|
||||
'\u2557',
|
||||
'\u2558',
|
||||
'\u2559',
|
||||
'\u255a',
|
||||
'\u255b',
|
||||
'\u0491',
|
||||
'\u045e',
|
||||
'\u255e',
|
||||
'\u255f',
|
||||
'\u2560',
|
||||
'\u2561',
|
||||
'\u0401',
|
||||
'\u0404',
|
||||
'\u2563',
|
||||
'\u0406',
|
||||
'\u0407',
|
||||
'\u2566',
|
||||
'\u2567',
|
||||
'\u2568',
|
||||
'\u2569',
|
||||
'\u256a',
|
||||
'\u0490',
|
||||
'\u040e',
|
||||
'\u00a9',
|
||||
'\u044e',
|
||||
'\u0430',
|
||||
'\u0431',
|
||||
'\u0446',
|
||||
'\u0434',
|
||||
'\u0435',
|
||||
'\u0444',
|
||||
'\u0433',
|
||||
'\u0445',
|
||||
'\u0438',
|
||||
'\u0439',
|
||||
'\u043a',
|
||||
'\u043b',
|
||||
'\u043c',
|
||||
'\u043d',
|
||||
'\u043e',
|
||||
'\u043f',
|
||||
'\u044f',
|
||||
'\u0440',
|
||||
'\u0441',
|
||||
'\u0442',
|
||||
'\u0443',
|
||||
'\u0436',
|
||||
'\u0432',
|
||||
'\u044c',
|
||||
'\u044b',
|
||||
'\u0437',
|
||||
'\u0448',
|
||||
'\u044d',
|
||||
'\u0449',
|
||||
'\u0447',
|
||||
'\u044a',
|
||||
'\u042e',
|
||||
'\u0410',
|
||||
'\u0411',
|
||||
'\u0426',
|
||||
'\u0414',
|
||||
'\u0415',
|
||||
'\u0424',
|
||||
'\u0413',
|
||||
'\u0425',
|
||||
'\u0418',
|
||||
'\u0419',
|
||||
'\u041a',
|
||||
'\u041b',
|
||||
'\u041c',
|
||||
'\u041d',
|
||||
'\u041e',
|
||||
'\u041f',
|
||||
'\u042f',
|
||||
'\u0420',
|
||||
'\u0421',
|
||||
'\u0422',
|
||||
'\u0423',
|
||||
'\u0416',
|
||||
'\u0412',
|
||||
'\u042c',
|
||||
'\u042b',
|
||||
'\u0417',
|
||||
'\u0428',
|
||||
'\u042d',
|
||||
'\u0429',
|
||||
'\u0427',
|
||||
'\u042a'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"koi8-ru",
|
||||
"koi8-u"
|
||||
};
|
||||
|
||||
private static final String NAME = "koi8-u";
|
||||
|
||||
static final Encoding INSTANCE = new Koi8U();
|
||||
|
||||
private Koi8U() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class MacCyrillic extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0410',
|
||||
'\u0411',
|
||||
'\u0412',
|
||||
'\u0413',
|
||||
'\u0414',
|
||||
'\u0415',
|
||||
'\u0416',
|
||||
'\u0417',
|
||||
'\u0418',
|
||||
'\u0419',
|
||||
'\u041a',
|
||||
'\u041b',
|
||||
'\u041c',
|
||||
'\u041d',
|
||||
'\u041e',
|
||||
'\u041f',
|
||||
'\u0420',
|
||||
'\u0421',
|
||||
'\u0422',
|
||||
'\u0423',
|
||||
'\u0424',
|
||||
'\u0425',
|
||||
'\u0426',
|
||||
'\u0427',
|
||||
'\u0428',
|
||||
'\u0429',
|
||||
'\u042a',
|
||||
'\u042b',
|
||||
'\u042c',
|
||||
'\u042d',
|
||||
'\u042e',
|
||||
'\u042f',
|
||||
'\u2020',
|
||||
'\u00b0',
|
||||
'\u0490',
|
||||
'\u00a3',
|
||||
'\u00a7',
|
||||
'\u2022',
|
||||
'\u00b6',
|
||||
'\u0406',
|
||||
'\u00ae',
|
||||
'\u00a9',
|
||||
'\u2122',
|
||||
'\u0402',
|
||||
'\u0452',
|
||||
'\u2260',
|
||||
'\u0403',
|
||||
'\u0453',
|
||||
'\u221e',
|
||||
'\u00b1',
|
||||
'\u2264',
|
||||
'\u2265',
|
||||
'\u0456',
|
||||
'\u00b5',
|
||||
'\u0491',
|
||||
'\u0408',
|
||||
'\u0404',
|
||||
'\u0454',
|
||||
'\u0407',
|
||||
'\u0457',
|
||||
'\u0409',
|
||||
'\u0459',
|
||||
'\u040a',
|
||||
'\u045a',
|
||||
'\u0458',
|
||||
'\u0405',
|
||||
'\u00ac',
|
||||
'\u221a',
|
||||
'\u0192',
|
||||
'\u2248',
|
||||
'\u2206',
|
||||
'\u00ab',
|
||||
'\u00bb',
|
||||
'\u2026',
|
||||
'\u00a0',
|
||||
'\u040b',
|
||||
'\u045b',
|
||||
'\u040c',
|
||||
'\u045c',
|
||||
'\u0455',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u00f7',
|
||||
'\u201e',
|
||||
'\u040e',
|
||||
'\u045e',
|
||||
'\u040f',
|
||||
'\u045f',
|
||||
'\u2116',
|
||||
'\u0401',
|
||||
'\u0451',
|
||||
'\u044f',
|
||||
'\u0430',
|
||||
'\u0431',
|
||||
'\u0432',
|
||||
'\u0433',
|
||||
'\u0434',
|
||||
'\u0435',
|
||||
'\u0436',
|
||||
'\u0437',
|
||||
'\u0438',
|
||||
'\u0439',
|
||||
'\u043a',
|
||||
'\u043b',
|
||||
'\u043c',
|
||||
'\u043d',
|
||||
'\u043e',
|
||||
'\u043f',
|
||||
'\u0440',
|
||||
'\u0441',
|
||||
'\u0442',
|
||||
'\u0443',
|
||||
'\u0444',
|
||||
'\u0445',
|
||||
'\u0446',
|
||||
'\u0447',
|
||||
'\u0448',
|
||||
'\u0449',
|
||||
'\u044a',
|
||||
'\u044b',
|
||||
'\u044c',
|
||||
'\u044d',
|
||||
'\u044e',
|
||||
'\u20ac'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"x-mac-cyrillic",
|
||||
"x-mac-ukrainian"
|
||||
};
|
||||
|
||||
private static final String NAME = "x-mac-cyrillic";
|
||||
|
||||
static final Encoding INSTANCE = new MacCyrillic();
|
||||
|
||||
private MacCyrillic() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Macintosh extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c7',
|
||||
'\u00c9',
|
||||
'\u00d1',
|
||||
'\u00d6',
|
||||
'\u00dc',
|
||||
'\u00e1',
|
||||
'\u00e0',
|
||||
'\u00e2',
|
||||
'\u00e4',
|
||||
'\u00e3',
|
||||
'\u00e5',
|
||||
'\u00e7',
|
||||
'\u00e9',
|
||||
'\u00e8',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ed',
|
||||
'\u00ec',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u00f1',
|
||||
'\u00f3',
|
||||
'\u00f2',
|
||||
'\u00f4',
|
||||
'\u00f6',
|
||||
'\u00f5',
|
||||
'\u00fa',
|
||||
'\u00f9',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u2020',
|
||||
'\u00b0',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a7',
|
||||
'\u2022',
|
||||
'\u00b6',
|
||||
'\u00df',
|
||||
'\u00ae',
|
||||
'\u00a9',
|
||||
'\u2122',
|
||||
'\u00b4',
|
||||
'\u00a8',
|
||||
'\u2260',
|
||||
'\u00c6',
|
||||
'\u00d8',
|
||||
'\u221e',
|
||||
'\u00b1',
|
||||
'\u2264',
|
||||
'\u2265',
|
||||
'\u00a5',
|
||||
'\u00b5',
|
||||
'\u2202',
|
||||
'\u2211',
|
||||
'\u220f',
|
||||
'\u03c0',
|
||||
'\u222b',
|
||||
'\u00aa',
|
||||
'\u00ba',
|
||||
'\u03a9',
|
||||
'\u00e6',
|
||||
'\u00f8',
|
||||
'\u00bf',
|
||||
'\u00a1',
|
||||
'\u00ac',
|
||||
'\u221a',
|
||||
'\u0192',
|
||||
'\u2248',
|
||||
'\u2206',
|
||||
'\u00ab',
|
||||
'\u00bb',
|
||||
'\u2026',
|
||||
'\u00a0',
|
||||
'\u00c0',
|
||||
'\u00c3',
|
||||
'\u00d5',
|
||||
'\u0152',
|
||||
'\u0153',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u00f7',
|
||||
'\u25ca',
|
||||
'\u00ff',
|
||||
'\u0178',
|
||||
'\u2044',
|
||||
'\u20ac',
|
||||
'\u2039',
|
||||
'\u203a',
|
||||
'\ufb01',
|
||||
'\ufb02',
|
||||
'\u2021',
|
||||
'\u00b7',
|
||||
'\u201a',
|
||||
'\u201e',
|
||||
'\u2030',
|
||||
'\u00c2',
|
||||
'\u00ca',
|
||||
'\u00c1',
|
||||
'\u00cb',
|
||||
'\u00c8',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u00cc',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\uf8ff',
|
||||
'\u00d2',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00d9',
|
||||
'\u0131',
|
||||
'\u02c6',
|
||||
'\u02dc',
|
||||
'\u00af',
|
||||
'\u02d8',
|
||||
'\u02d9',
|
||||
'\u02da',
|
||||
'\u00b8',
|
||||
'\u02dd',
|
||||
'\u02db',
|
||||
'\u02c7'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csmacintosh",
|
||||
"mac",
|
||||
"macintosh",
|
||||
"x-mac-roman"
|
||||
};
|
||||
|
||||
private static final String NAME = "macintosh";
|
||||
|
||||
static final Encoding INSTANCE = new Macintosh();
|
||||
|
||||
private Macintosh() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Replacement extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csiso2022kr",
|
||||
"hz-gb-2312",
|
||||
"iso-2022-cn",
|
||||
"iso-2022-cn-ext",
|
||||
"iso-2022-kr"
|
||||
};
|
||||
|
||||
private static final String NAME = "replacement";
|
||||
|
||||
static final Replacement INSTANCE = new Replacement();
|
||||
|
||||
private Replacement() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new ReplacementDecoder(this);
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 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.encoding;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
class ReplacementDecoder extends Decoder {
|
||||
|
||||
private boolean haveEmitted = false;
|
||||
|
||||
ReplacementDecoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
|
||||
for (;;) {
|
||||
if (!in.hasRemaining()) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (haveEmitted) {
|
||||
in.position(in.limit());
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
in.position(in.limit());
|
||||
haveEmitted = true;
|
||||
if (this.report) {
|
||||
return CoderResult.malformedForLength(1);
|
||||
}
|
||||
out.put('\uFFFD');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.nio.charset.CharsetDecoder#implFlush(java.nio.CharBuffer)
|
||||
*/
|
||||
@Override protected CoderResult implFlush(CharBuffer out) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.implFlush(out);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.nio.charset.CharsetDecoder#implReset()
|
||||
*/
|
||||
@Override protected void implReset() {
|
||||
// TODO Auto-generated method stub
|
||||
super.implReset();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class ShiftJis extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"csshiftjis",
|
||||
"ms932",
|
||||
"ms_kanji",
|
||||
"shift-jis",
|
||||
"shift_jis",
|
||||
"sjis",
|
||||
"windows-31j",
|
||||
"x-sjis"
|
||||
};
|
||||
|
||||
private static final String NAME = "shift_jis";
|
||||
|
||||
static final ShiftJis INSTANCE = new ShiftJis();
|
||||
|
||||
private ShiftJis() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class UserDefined extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"x-user-defined"
|
||||
};
|
||||
|
||||
private static final String NAME = "x-user-defined";
|
||||
|
||||
static final UserDefined INSTANCE = new UserDefined();
|
||||
|
||||
private UserDefined() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new UserDefinedDecoder(this);
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.encoding;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
class UserDefinedDecoder extends Decoder {
|
||||
|
||||
UserDefinedDecoder(Charset cs) {
|
||||
super(cs, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
|
||||
// TODO figure out if it's worthwhile to optimize the case where both
|
||||
// buffers are array-backed.
|
||||
for (;;) {
|
||||
if (!in.hasRemaining()) {
|
||||
return CoderResult.UNDERFLOW;
|
||||
}
|
||||
if (!out.hasRemaining()) {
|
||||
return CoderResult.OVERFLOW;
|
||||
}
|
||||
int b = (int)in.get();
|
||||
if (b >= 0) {
|
||||
out.put((char)b);
|
||||
} else {
|
||||
out.put((char)(b + 128 + 0xF780));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Utf16Be extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"utf-16be"
|
||||
};
|
||||
|
||||
private static final String NAME = "utf-16be";
|
||||
|
||||
static final Utf16Be INSTANCE = new Utf16Be();
|
||||
|
||||
private Utf16Be() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Utf16Le extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"utf-16",
|
||||
"utf-16le"
|
||||
};
|
||||
|
||||
private static final String NAME = "utf-16le";
|
||||
|
||||
static final Utf16Le INSTANCE = new Utf16Le();
|
||||
|
||||
private Utf16Le() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
class Utf8 extends Encoding {
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"unicode-1-1-utf-8",
|
||||
"utf-8",
|
||||
"utf8"
|
||||
};
|
||||
|
||||
private static final String NAME = "utf-8";
|
||||
|
||||
static final Utf8 INSTANCE = new Utf8();
|
||||
|
||||
private Utf8() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return Charset.forName(NAME).newDecoder();
|
||||
}
|
||||
|
||||
@Override public CharsetEncoder newEncoder() {
|
||||
return Charset.forName(NAME).newEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1250 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0083',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u0088',
|
||||
'\u2030',
|
||||
'\u0160',
|
||||
'\u2039',
|
||||
'\u015a',
|
||||
'\u0164',
|
||||
'\u017d',
|
||||
'\u0179',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u0098',
|
||||
'\u2122',
|
||||
'\u0161',
|
||||
'\u203a',
|
||||
'\u015b',
|
||||
'\u0165',
|
||||
'\u017e',
|
||||
'\u017a',
|
||||
'\u00a0',
|
||||
'\u02c7',
|
||||
'\u02d8',
|
||||
'\u0141',
|
||||
'\u00a4',
|
||||
'\u0104',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u015e',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u017b',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u02db',
|
||||
'\u0142',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u0105',
|
||||
'\u015f',
|
||||
'\u00bb',
|
||||
'\u013d',
|
||||
'\u02dd',
|
||||
'\u013e',
|
||||
'\u017c',
|
||||
'\u0154',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u0102',
|
||||
'\u00c4',
|
||||
'\u0139',
|
||||
'\u0106',
|
||||
'\u00c7',
|
||||
'\u010c',
|
||||
'\u00c9',
|
||||
'\u0118',
|
||||
'\u00cb',
|
||||
'\u011a',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u010e',
|
||||
'\u0110',
|
||||
'\u0143',
|
||||
'\u0147',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u0150',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u0158',
|
||||
'\u016e',
|
||||
'\u00da',
|
||||
'\u0170',
|
||||
'\u00dc',
|
||||
'\u00dd',
|
||||
'\u0162',
|
||||
'\u00df',
|
||||
'\u0155',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u0103',
|
||||
'\u00e4',
|
||||
'\u013a',
|
||||
'\u0107',
|
||||
'\u00e7',
|
||||
'\u010d',
|
||||
'\u00e9',
|
||||
'\u0119',
|
||||
'\u00eb',
|
||||
'\u011b',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u010f',
|
||||
'\u0111',
|
||||
'\u0144',
|
||||
'\u0148',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u0151',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u0159',
|
||||
'\u016f',
|
||||
'\u00fa',
|
||||
'\u0171',
|
||||
'\u00fc',
|
||||
'\u00fd',
|
||||
'\u0163',
|
||||
'\u02d9'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1250",
|
||||
"windows-1250",
|
||||
"x-cp1250"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1250";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1250();
|
||||
|
||||
private Windows1250() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1251 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u0402',
|
||||
'\u0403',
|
||||
'\u201a',
|
||||
'\u0453',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u20ac',
|
||||
'\u2030',
|
||||
'\u0409',
|
||||
'\u2039',
|
||||
'\u040a',
|
||||
'\u040c',
|
||||
'\u040b',
|
||||
'\u040f',
|
||||
'\u0452',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u0098',
|
||||
'\u2122',
|
||||
'\u0459',
|
||||
'\u203a',
|
||||
'\u045a',
|
||||
'\u045c',
|
||||
'\u045b',
|
||||
'\u045f',
|
||||
'\u00a0',
|
||||
'\u040e',
|
||||
'\u045e',
|
||||
'\u0408',
|
||||
'\u00a4',
|
||||
'\u0490',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u0401',
|
||||
'\u00a9',
|
||||
'\u0404',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u0407',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u0406',
|
||||
'\u0456',
|
||||
'\u0491',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u0451',
|
||||
'\u2116',
|
||||
'\u0454',
|
||||
'\u00bb',
|
||||
'\u0458',
|
||||
'\u0405',
|
||||
'\u0455',
|
||||
'\u0457',
|
||||
'\u0410',
|
||||
'\u0411',
|
||||
'\u0412',
|
||||
'\u0413',
|
||||
'\u0414',
|
||||
'\u0415',
|
||||
'\u0416',
|
||||
'\u0417',
|
||||
'\u0418',
|
||||
'\u0419',
|
||||
'\u041a',
|
||||
'\u041b',
|
||||
'\u041c',
|
||||
'\u041d',
|
||||
'\u041e',
|
||||
'\u041f',
|
||||
'\u0420',
|
||||
'\u0421',
|
||||
'\u0422',
|
||||
'\u0423',
|
||||
'\u0424',
|
||||
'\u0425',
|
||||
'\u0426',
|
||||
'\u0427',
|
||||
'\u0428',
|
||||
'\u0429',
|
||||
'\u042a',
|
||||
'\u042b',
|
||||
'\u042c',
|
||||
'\u042d',
|
||||
'\u042e',
|
||||
'\u042f',
|
||||
'\u0430',
|
||||
'\u0431',
|
||||
'\u0432',
|
||||
'\u0433',
|
||||
'\u0434',
|
||||
'\u0435',
|
||||
'\u0436',
|
||||
'\u0437',
|
||||
'\u0438',
|
||||
'\u0439',
|
||||
'\u043a',
|
||||
'\u043b',
|
||||
'\u043c',
|
||||
'\u043d',
|
||||
'\u043e',
|
||||
'\u043f',
|
||||
'\u0440',
|
||||
'\u0441',
|
||||
'\u0442',
|
||||
'\u0443',
|
||||
'\u0444',
|
||||
'\u0445',
|
||||
'\u0446',
|
||||
'\u0447',
|
||||
'\u0448',
|
||||
'\u0449',
|
||||
'\u044a',
|
||||
'\u044b',
|
||||
'\u044c',
|
||||
'\u044d',
|
||||
'\u044e',
|
||||
'\u044f'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1251",
|
||||
"windows-1251",
|
||||
"x-cp1251"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1251";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1251();
|
||||
|
||||
private Windows1251() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1252 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0192',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u02c6',
|
||||
'\u2030',
|
||||
'\u0160',
|
||||
'\u2039',
|
||||
'\u0152',
|
||||
'\u008d',
|
||||
'\u017d',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u02dc',
|
||||
'\u2122',
|
||||
'\u0161',
|
||||
'\u203a',
|
||||
'\u0153',
|
||||
'\u009d',
|
||||
'\u017e',
|
||||
'\u0178',
|
||||
'\u00a0',
|
||||
'\u00a1',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u00aa',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u00ba',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u00bf',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u00c3',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u00cc',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u00d0',
|
||||
'\u00d1',
|
||||
'\u00d2',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u00d8',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u00dd',
|
||||
'\u00de',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u00e3',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ec',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u00f0',
|
||||
'\u00f1',
|
||||
'\u00f2',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u00f8',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u00fd',
|
||||
'\u00fe',
|
||||
'\u00ff'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"ansi_x3.4-1968",
|
||||
"ascii",
|
||||
"cp1252",
|
||||
"cp819",
|
||||
"csisolatin1",
|
||||
"ibm819",
|
||||
"iso-8859-1",
|
||||
"iso-ir-100",
|
||||
"iso8859-1",
|
||||
"iso88591",
|
||||
"iso_8859-1",
|
||||
"iso_8859-1:1987",
|
||||
"l1",
|
||||
"latin1",
|
||||
"us-ascii",
|
||||
"windows-1252",
|
||||
"x-cp1252"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1252";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1252();
|
||||
|
||||
private Windows1252() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1253 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0192',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u0088',
|
||||
'\u2030',
|
||||
'\u008a',
|
||||
'\u2039',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u0098',
|
||||
'\u2122',
|
||||
'\u009a',
|
||||
'\u203a',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0385',
|
||||
'\u0386',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\ufffd',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u2015',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u0384',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u0388',
|
||||
'\u0389',
|
||||
'\u038a',
|
||||
'\u00bb',
|
||||
'\u038c',
|
||||
'\u00bd',
|
||||
'\u038e',
|
||||
'\u038f',
|
||||
'\u0390',
|
||||
'\u0391',
|
||||
'\u0392',
|
||||
'\u0393',
|
||||
'\u0394',
|
||||
'\u0395',
|
||||
'\u0396',
|
||||
'\u0397',
|
||||
'\u0398',
|
||||
'\u0399',
|
||||
'\u039a',
|
||||
'\u039b',
|
||||
'\u039c',
|
||||
'\u039d',
|
||||
'\u039e',
|
||||
'\u039f',
|
||||
'\u03a0',
|
||||
'\u03a1',
|
||||
'\ufffd',
|
||||
'\u03a3',
|
||||
'\u03a4',
|
||||
'\u03a5',
|
||||
'\u03a6',
|
||||
'\u03a7',
|
||||
'\u03a8',
|
||||
'\u03a9',
|
||||
'\u03aa',
|
||||
'\u03ab',
|
||||
'\u03ac',
|
||||
'\u03ad',
|
||||
'\u03ae',
|
||||
'\u03af',
|
||||
'\u03b0',
|
||||
'\u03b1',
|
||||
'\u03b2',
|
||||
'\u03b3',
|
||||
'\u03b4',
|
||||
'\u03b5',
|
||||
'\u03b6',
|
||||
'\u03b7',
|
||||
'\u03b8',
|
||||
'\u03b9',
|
||||
'\u03ba',
|
||||
'\u03bb',
|
||||
'\u03bc',
|
||||
'\u03bd',
|
||||
'\u03be',
|
||||
'\u03bf',
|
||||
'\u03c0',
|
||||
'\u03c1',
|
||||
'\u03c2',
|
||||
'\u03c3',
|
||||
'\u03c4',
|
||||
'\u03c5',
|
||||
'\u03c6',
|
||||
'\u03c7',
|
||||
'\u03c8',
|
||||
'\u03c9',
|
||||
'\u03ca',
|
||||
'\u03cb',
|
||||
'\u03cc',
|
||||
'\u03cd',
|
||||
'\u03ce',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1253",
|
||||
"windows-1253",
|
||||
"x-cp1253"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1253";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1253();
|
||||
|
||||
private Windows1253() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1254 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0192',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u02c6',
|
||||
'\u2030',
|
||||
'\u0160',
|
||||
'\u2039',
|
||||
'\u0152',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u02dc',
|
||||
'\u2122',
|
||||
'\u0161',
|
||||
'\u203a',
|
||||
'\u0153',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u0178',
|
||||
'\u00a0',
|
||||
'\u00a1',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u00aa',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u00ba',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u00bf',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u00c3',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u00cc',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u011e',
|
||||
'\u00d1',
|
||||
'\u00d2',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u00d8',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u0130',
|
||||
'\u015e',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u00e3',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u00ec',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u011f',
|
||||
'\u00f1',
|
||||
'\u00f2',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u00f8',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u0131',
|
||||
'\u015f',
|
||||
'\u00ff'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1254",
|
||||
"csisolatin5",
|
||||
"iso-8859-9",
|
||||
"iso-ir-148",
|
||||
"iso8859-9",
|
||||
"iso88599",
|
||||
"iso_8859-9",
|
||||
"iso_8859-9:1989",
|
||||
"l5",
|
||||
"latin5",
|
||||
"windows-1254",
|
||||
"x-cp1254"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1254";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1254();
|
||||
|
||||
private Windows1254() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1255 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0192',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u02c6',
|
||||
'\u2030',
|
||||
'\u008a',
|
||||
'\u2039',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u02dc',
|
||||
'\u2122',
|
||||
'\u009a',
|
||||
'\u203a',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u00a1',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u20aa',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u00d7',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u00f7',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u00bf',
|
||||
'\u05b0',
|
||||
'\u05b1',
|
||||
'\u05b2',
|
||||
'\u05b3',
|
||||
'\u05b4',
|
||||
'\u05b5',
|
||||
'\u05b6',
|
||||
'\u05b7',
|
||||
'\u05b8',
|
||||
'\u05b9',
|
||||
'\ufffd',
|
||||
'\u05bb',
|
||||
'\u05bc',
|
||||
'\u05bd',
|
||||
'\u05be',
|
||||
'\u05bf',
|
||||
'\u05c0',
|
||||
'\u05c1',
|
||||
'\u05c2',
|
||||
'\u05c3',
|
||||
'\u05f0',
|
||||
'\u05f1',
|
||||
'\u05f2',
|
||||
'\u05f3',
|
||||
'\u05f4',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u05d0',
|
||||
'\u05d1',
|
||||
'\u05d2',
|
||||
'\u05d3',
|
||||
'\u05d4',
|
||||
'\u05d5',
|
||||
'\u05d6',
|
||||
'\u05d7',
|
||||
'\u05d8',
|
||||
'\u05d9',
|
||||
'\u05da',
|
||||
'\u05db',
|
||||
'\u05dc',
|
||||
'\u05dd',
|
||||
'\u05de',
|
||||
'\u05df',
|
||||
'\u05e0',
|
||||
'\u05e1',
|
||||
'\u05e2',
|
||||
'\u05e3',
|
||||
'\u05e4',
|
||||
'\u05e5',
|
||||
'\u05e6',
|
||||
'\u05e7',
|
||||
'\u05e8',
|
||||
'\u05e9',
|
||||
'\u05ea',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u200e',
|
||||
'\u200f',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1255",
|
||||
"windows-1255",
|
||||
"x-cp1255"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1255";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1255();
|
||||
|
||||
private Windows1255() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1256 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u067e',
|
||||
'\u201a',
|
||||
'\u0192',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u02c6',
|
||||
'\u2030',
|
||||
'\u0679',
|
||||
'\u2039',
|
||||
'\u0152',
|
||||
'\u0686',
|
||||
'\u0698',
|
||||
'\u0688',
|
||||
'\u06af',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u06a9',
|
||||
'\u2122',
|
||||
'\u0691',
|
||||
'\u203a',
|
||||
'\u0153',
|
||||
'\u200c',
|
||||
'\u200d',
|
||||
'\u06ba',
|
||||
'\u00a0',
|
||||
'\u060c',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u06be',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u061b',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u061f',
|
||||
'\u06c1',
|
||||
'\u0621',
|
||||
'\u0622',
|
||||
'\u0623',
|
||||
'\u0624',
|
||||
'\u0625',
|
||||
'\u0626',
|
||||
'\u0627',
|
||||
'\u0628',
|
||||
'\u0629',
|
||||
'\u062a',
|
||||
'\u062b',
|
||||
'\u062c',
|
||||
'\u062d',
|
||||
'\u062e',
|
||||
'\u062f',
|
||||
'\u0630',
|
||||
'\u0631',
|
||||
'\u0632',
|
||||
'\u0633',
|
||||
'\u0634',
|
||||
'\u0635',
|
||||
'\u0636',
|
||||
'\u00d7',
|
||||
'\u0637',
|
||||
'\u0638',
|
||||
'\u0639',
|
||||
'\u063a',
|
||||
'\u0640',
|
||||
'\u0641',
|
||||
'\u0642',
|
||||
'\u0643',
|
||||
'\u00e0',
|
||||
'\u0644',
|
||||
'\u00e2',
|
||||
'\u0645',
|
||||
'\u0646',
|
||||
'\u0647',
|
||||
'\u0648',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u0649',
|
||||
'\u064a',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u064b',
|
||||
'\u064c',
|
||||
'\u064d',
|
||||
'\u064e',
|
||||
'\u00f4',
|
||||
'\u064f',
|
||||
'\u0650',
|
||||
'\u00f7',
|
||||
'\u0651',
|
||||
'\u00f9',
|
||||
'\u0652',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u200e',
|
||||
'\u200f',
|
||||
'\u06d2'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1256",
|
||||
"windows-1256",
|
||||
"x-cp1256"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1256";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1256();
|
||||
|
||||
private Windows1256() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1257 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0083',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u0088',
|
||||
'\u2030',
|
||||
'\u008a',
|
||||
'\u2039',
|
||||
'\u008c',
|
||||
'\u00a8',
|
||||
'\u02c7',
|
||||
'\u00b8',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u0098',
|
||||
'\u2122',
|
||||
'\u009a',
|
||||
'\u203a',
|
||||
'\u009c',
|
||||
'\u00af',
|
||||
'\u02db',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\ufffd',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\ufffd',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00d8',
|
||||
'\u00a9',
|
||||
'\u0156',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00c6',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00f8',
|
||||
'\u00b9',
|
||||
'\u0157',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u00e6',
|
||||
'\u0104',
|
||||
'\u012e',
|
||||
'\u0100',
|
||||
'\u0106',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u0118',
|
||||
'\u0112',
|
||||
'\u010c',
|
||||
'\u00c9',
|
||||
'\u0179',
|
||||
'\u0116',
|
||||
'\u0122',
|
||||
'\u0136',
|
||||
'\u012a',
|
||||
'\u013b',
|
||||
'\u0160',
|
||||
'\u0143',
|
||||
'\u0145',
|
||||
'\u00d3',
|
||||
'\u014c',
|
||||
'\u00d5',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u0172',
|
||||
'\u0141',
|
||||
'\u015a',
|
||||
'\u016a',
|
||||
'\u00dc',
|
||||
'\u017b',
|
||||
'\u017d',
|
||||
'\u00df',
|
||||
'\u0105',
|
||||
'\u012f',
|
||||
'\u0101',
|
||||
'\u0107',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u0119',
|
||||
'\u0113',
|
||||
'\u010d',
|
||||
'\u00e9',
|
||||
'\u017a',
|
||||
'\u0117',
|
||||
'\u0123',
|
||||
'\u0137',
|
||||
'\u012b',
|
||||
'\u013c',
|
||||
'\u0161',
|
||||
'\u0144',
|
||||
'\u0146',
|
||||
'\u00f3',
|
||||
'\u014d',
|
||||
'\u00f5',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u0173',
|
||||
'\u0142',
|
||||
'\u015b',
|
||||
'\u016b',
|
||||
'\u00fc',
|
||||
'\u017c',
|
||||
'\u017e',
|
||||
'\u02d9'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1257",
|
||||
"windows-1257",
|
||||
"x-cp1257"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1257";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1257();
|
||||
|
||||
private Windows1257() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows1258 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u201a',
|
||||
'\u0192',
|
||||
'\u201e',
|
||||
'\u2026',
|
||||
'\u2020',
|
||||
'\u2021',
|
||||
'\u02c6',
|
||||
'\u2030',
|
||||
'\u008a',
|
||||
'\u2039',
|
||||
'\u0152',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u02dc',
|
||||
'\u2122',
|
||||
'\u009a',
|
||||
'\u203a',
|
||||
'\u0153',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u0178',
|
||||
'\u00a0',
|
||||
'\u00a1',
|
||||
'\u00a2',
|
||||
'\u00a3',
|
||||
'\u00a4',
|
||||
'\u00a5',
|
||||
'\u00a6',
|
||||
'\u00a7',
|
||||
'\u00a8',
|
||||
'\u00a9',
|
||||
'\u00aa',
|
||||
'\u00ab',
|
||||
'\u00ac',
|
||||
'\u00ad',
|
||||
'\u00ae',
|
||||
'\u00af',
|
||||
'\u00b0',
|
||||
'\u00b1',
|
||||
'\u00b2',
|
||||
'\u00b3',
|
||||
'\u00b4',
|
||||
'\u00b5',
|
||||
'\u00b6',
|
||||
'\u00b7',
|
||||
'\u00b8',
|
||||
'\u00b9',
|
||||
'\u00ba',
|
||||
'\u00bb',
|
||||
'\u00bc',
|
||||
'\u00bd',
|
||||
'\u00be',
|
||||
'\u00bf',
|
||||
'\u00c0',
|
||||
'\u00c1',
|
||||
'\u00c2',
|
||||
'\u0102',
|
||||
'\u00c4',
|
||||
'\u00c5',
|
||||
'\u00c6',
|
||||
'\u00c7',
|
||||
'\u00c8',
|
||||
'\u00c9',
|
||||
'\u00ca',
|
||||
'\u00cb',
|
||||
'\u0300',
|
||||
'\u00cd',
|
||||
'\u00ce',
|
||||
'\u00cf',
|
||||
'\u0110',
|
||||
'\u00d1',
|
||||
'\u0309',
|
||||
'\u00d3',
|
||||
'\u00d4',
|
||||
'\u01a0',
|
||||
'\u00d6',
|
||||
'\u00d7',
|
||||
'\u00d8',
|
||||
'\u00d9',
|
||||
'\u00da',
|
||||
'\u00db',
|
||||
'\u00dc',
|
||||
'\u01af',
|
||||
'\u0303',
|
||||
'\u00df',
|
||||
'\u00e0',
|
||||
'\u00e1',
|
||||
'\u00e2',
|
||||
'\u0103',
|
||||
'\u00e4',
|
||||
'\u00e5',
|
||||
'\u00e6',
|
||||
'\u00e7',
|
||||
'\u00e8',
|
||||
'\u00e9',
|
||||
'\u00ea',
|
||||
'\u00eb',
|
||||
'\u0301',
|
||||
'\u00ed',
|
||||
'\u00ee',
|
||||
'\u00ef',
|
||||
'\u0111',
|
||||
'\u00f1',
|
||||
'\u0323',
|
||||
'\u00f3',
|
||||
'\u00f4',
|
||||
'\u01a1',
|
||||
'\u00f6',
|
||||
'\u00f7',
|
||||
'\u00f8',
|
||||
'\u00f9',
|
||||
'\u00fa',
|
||||
'\u00fb',
|
||||
'\u00fc',
|
||||
'\u01b0',
|
||||
'\u20ab',
|
||||
'\u00ff'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"cp1258",
|
||||
"windows-1258",
|
||||
"x-cp1258"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-1258";
|
||||
|
||||
static final Encoding INSTANCE = new Windows1258();
|
||||
|
||||
private Windows1258() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new InfallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2013-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using generate-encoding-data.py
|
||||
*/
|
||||
|
||||
package nu.validator.encoding;
|
||||
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
class Windows874 extends Encoding {
|
||||
|
||||
private static final char[] TABLE = {
|
||||
'\u20ac',
|
||||
'\u0081',
|
||||
'\u0082',
|
||||
'\u0083',
|
||||
'\u0084',
|
||||
'\u2026',
|
||||
'\u0086',
|
||||
'\u0087',
|
||||
'\u0088',
|
||||
'\u0089',
|
||||
'\u008a',
|
||||
'\u008b',
|
||||
'\u008c',
|
||||
'\u008d',
|
||||
'\u008e',
|
||||
'\u008f',
|
||||
'\u0090',
|
||||
'\u2018',
|
||||
'\u2019',
|
||||
'\u201c',
|
||||
'\u201d',
|
||||
'\u2022',
|
||||
'\u2013',
|
||||
'\u2014',
|
||||
'\u0098',
|
||||
'\u0099',
|
||||
'\u009a',
|
||||
'\u009b',
|
||||
'\u009c',
|
||||
'\u009d',
|
||||
'\u009e',
|
||||
'\u009f',
|
||||
'\u00a0',
|
||||
'\u0e01',
|
||||
'\u0e02',
|
||||
'\u0e03',
|
||||
'\u0e04',
|
||||
'\u0e05',
|
||||
'\u0e06',
|
||||
'\u0e07',
|
||||
'\u0e08',
|
||||
'\u0e09',
|
||||
'\u0e0a',
|
||||
'\u0e0b',
|
||||
'\u0e0c',
|
||||
'\u0e0d',
|
||||
'\u0e0e',
|
||||
'\u0e0f',
|
||||
'\u0e10',
|
||||
'\u0e11',
|
||||
'\u0e12',
|
||||
'\u0e13',
|
||||
'\u0e14',
|
||||
'\u0e15',
|
||||
'\u0e16',
|
||||
'\u0e17',
|
||||
'\u0e18',
|
||||
'\u0e19',
|
||||
'\u0e1a',
|
||||
'\u0e1b',
|
||||
'\u0e1c',
|
||||
'\u0e1d',
|
||||
'\u0e1e',
|
||||
'\u0e1f',
|
||||
'\u0e20',
|
||||
'\u0e21',
|
||||
'\u0e22',
|
||||
'\u0e23',
|
||||
'\u0e24',
|
||||
'\u0e25',
|
||||
'\u0e26',
|
||||
'\u0e27',
|
||||
'\u0e28',
|
||||
'\u0e29',
|
||||
'\u0e2a',
|
||||
'\u0e2b',
|
||||
'\u0e2c',
|
||||
'\u0e2d',
|
||||
'\u0e2e',
|
||||
'\u0e2f',
|
||||
'\u0e30',
|
||||
'\u0e31',
|
||||
'\u0e32',
|
||||
'\u0e33',
|
||||
'\u0e34',
|
||||
'\u0e35',
|
||||
'\u0e36',
|
||||
'\u0e37',
|
||||
'\u0e38',
|
||||
'\u0e39',
|
||||
'\u0e3a',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\u0e3f',
|
||||
'\u0e40',
|
||||
'\u0e41',
|
||||
'\u0e42',
|
||||
'\u0e43',
|
||||
'\u0e44',
|
||||
'\u0e45',
|
||||
'\u0e46',
|
||||
'\u0e47',
|
||||
'\u0e48',
|
||||
'\u0e49',
|
||||
'\u0e4a',
|
||||
'\u0e4b',
|
||||
'\u0e4c',
|
||||
'\u0e4d',
|
||||
'\u0e4e',
|
||||
'\u0e4f',
|
||||
'\u0e50',
|
||||
'\u0e51',
|
||||
'\u0e52',
|
||||
'\u0e53',
|
||||
'\u0e54',
|
||||
'\u0e55',
|
||||
'\u0e56',
|
||||
'\u0e57',
|
||||
'\u0e58',
|
||||
'\u0e59',
|
||||
'\u0e5a',
|
||||
'\u0e5b',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd',
|
||||
'\ufffd'
|
||||
};
|
||||
|
||||
private static final String[] LABELS = {
|
||||
"dos-874",
|
||||
"iso-8859-11",
|
||||
"iso8859-11",
|
||||
"iso885911",
|
||||
"tis-620",
|
||||
"windows-874"
|
||||
};
|
||||
|
||||
private static final String NAME = "windows-874";
|
||||
|
||||
static final Encoding INSTANCE = new Windows874();
|
||||
|
||||
private Windows874() {
|
||||
super(NAME, LABELS);
|
||||
}
|
||||
|
||||
@Override public CharsetDecoder newDecoder() {
|
||||
return new FallibleSingleByteDecoder(this, TABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 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.annotation;
|
||||
|
||||
public @interface Auto {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 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.annotation;
|
||||
|
||||
public @interface CharacterName {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 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.annotation;
|
||||
|
||||
/**
|
||||
* Marker for translating into the C++ const keyword on the declaration in
|
||||
* question.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface Const {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* The type for attribute IDness. (In Java, an interned string
|
||||
* <code>"CDATA"</code> or <code>"ID"</code>.)
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface IdType {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.annotation;
|
||||
|
||||
/**
|
||||
* Translates into the C++ inline keyword.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface Inline {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.annotation;
|
||||
|
||||
/**
|
||||
* Marks a string type as being the literal string type (typically const char*)
|
||||
* in C++.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface Literal {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* The local name of an element or attribute. Must be comparable with
|
||||
* <code>==</code> (interned <code>String</code> in Java).
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface Local {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* The array type marked with this annotation won't have its
|
||||
* <code>.length</code> read.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface NoLength {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* The namespace URI type. (In Java, an interned <code>String</code>.)
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface NsUri {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* The type for namespace prefixes. (In Java, an interned <code>String</code>.)
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface Prefix {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* The type for qualified names. (In Java, an interned <code>String</code>.)
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface QName {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.annotation;
|
||||
|
||||
/**
|
||||
* Marks a method as virtualy in C++.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public @interface Virtual {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head><title>Package Overview</title>
|
||||
<!--
|
||||
Copyright (c) 2008 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.
|
||||
-->
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<p>This package provides annotations for facilitating automated translation
|
||||
of the source code into other programming languages.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 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.common;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An interface for providing a method for reading a stream of bytes one byte at
|
||||
* a time.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface ByteReadable {
|
||||
/**
|
||||
* Returns the value of the next byte as an integer from 0 to 0xFF or -1 if
|
||||
* the stream has ended.
|
||||
*
|
||||
* @return integer from 0 to 0xFF or -1 on EOF
|
||||
* @throws IOException
|
||||
*/
|
||||
public int readByte() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2008 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.common;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* An interface for receiving notifications of UTF-16 code units read from a character stream.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface CharacterHandler {
|
||||
|
||||
/**
|
||||
* Receive notification of a run of UTF-16 code units.
|
||||
* @param ch the buffer
|
||||
* @param start start index in the buffer
|
||||
* @param length the number of characters to process starting from <code>start</code>
|
||||
* @throws SAXException if things go wrong
|
||||
*/
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException;
|
||||
|
||||
/**
|
||||
* Signals the end of the stream. Can be used for cleanup. Doesn't mean that the stream ended successfully.
|
||||
*
|
||||
* @throws SAXException if things go wrong
|
||||
*/
|
||||
public void end() throws SAXException;
|
||||
|
||||
/**
|
||||
* Signals the start of the stream. Can be used for setup.
|
||||
*
|
||||
* @throws SAXException if things go wrong
|
||||
*/
|
||||
public void start() throws SAXException;
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
*
|
||||
* 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.common;
|
||||
|
||||
/**
|
||||
* Used for indicating desired behavior with legacy doctypes.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public enum DoctypeExpectation {
|
||||
/**
|
||||
* Be a pure HTML5 parser.
|
||||
*/
|
||||
HTML,
|
||||
|
||||
/**
|
||||
* Require the HTML 4.01 Transitional public id. Turn on HTML4-specific
|
||||
* additional errors regardless of doctype.
|
||||
*/
|
||||
HTML401_TRANSITIONAL,
|
||||
|
||||
/**
|
||||
* Require the HTML 4.01 Transitional public id and a system id. Turn on
|
||||
* HTML4-specific additional errors regardless of doctype.
|
||||
*/
|
||||
HTML401_STRICT,
|
||||
|
||||
/**
|
||||
* Treat the doctype required by HTML 5, doctypes with the HTML 4.01 Strict
|
||||
* public id and doctypes with the HTML 4.01 Transitional public id and a
|
||||
* system id as non-errors. Turn on HTML4-specific additional errors if the
|
||||
* public id is the HTML 4.01 Strict or Transitional public id.
|
||||
*/
|
||||
AUTO,
|
||||
|
||||
/**
|
||||
* Never enable HTML4-specific error checks. Never report any doctype
|
||||
* condition as an error. (Doctype tokens in wrong places will be
|
||||
* reported as errors, though.) The application may decide what to log
|
||||
* in response to calls to <code>DocumentModeHanler</code>. This mode
|
||||
* in meant for doing surveys on existing content.
|
||||
*/
|
||||
NO_DOCTYPE_ERRORS
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2008 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.common;
|
||||
|
||||
/**
|
||||
* Represents the HTML document compatibility mode.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public enum DocumentMode {
|
||||
/**
|
||||
* The Standards Mode
|
||||
*/
|
||||
STANDARDS_MODE,
|
||||
|
||||
/**
|
||||
* The Limited Quirks Mode aka. The Almost Standards Mode
|
||||
*/
|
||||
ALMOST_STANDARDS_MODE,
|
||||
|
||||
/**
|
||||
* The Quirks Mode
|
||||
*/
|
||||
QUIRKS_MODE
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
*
|
||||
* 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.common;
|
||||
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* A callback interface for receiving notification about the document mode.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface DocumentModeHandler {
|
||||
|
||||
/**
|
||||
* Receive notification of the document mode.
|
||||
*
|
||||
* @param mode the document mode
|
||||
* @param publicIdentifier the public id of the doctype or <code>null</code> if unavailable
|
||||
* @param systemIdentifier the system id of the doctype or <code>null</code> if unavailable
|
||||
* @param html4SpecificAdditionalErrorChecks <code>true</code> if HTML 4-specific checks were enabled, <code>false</code> otherwise
|
||||
* @throws SAXException if things go wrong
|
||||
*/
|
||||
public void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws SAXException;
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.common;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* An interface for communicating about character encoding names with the
|
||||
* environment of the parser.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface EncodingDeclarationHandler {
|
||||
|
||||
/**
|
||||
* Indicates that the parser has found an internal encoding declaration with
|
||||
* the charset value <code>charset</code>.
|
||||
*
|
||||
* @param charset
|
||||
* the charset name found.
|
||||
* @return <code>true</code> if the value of <code>charset</code> was an
|
||||
* encoding name for a supported ASCII-superset encoding.
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public boolean internalEncodingDeclaration(String charset) throws SAXException;
|
||||
|
||||
/**
|
||||
* Queries the environment for the encoding in use (for error reporting).
|
||||
*
|
||||
* @return the encoding in use
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public String getCharacterEncoding() throws SAXException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.common;
|
||||
|
||||
/**
|
||||
* Indicates a request for character encoding sniffer choice.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public enum Heuristics {
|
||||
|
||||
/**
|
||||
* Perform no heuristic sniffing.
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* Use both jchardet and ICU4J.
|
||||
*/
|
||||
ALL,
|
||||
|
||||
/**
|
||||
* Use jchardet only.
|
||||
*/
|
||||
CHARDET,
|
||||
|
||||
/**
|
||||
* Use ICU4J only.
|
||||
*/
|
||||
ICU
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.common;
|
||||
|
||||
/**
|
||||
* A placeholder type that translates into the type of the C++ class that
|
||||
* implements an interning service for local names (<code>@Local</code> in
|
||||
* Java).
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface Interner {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* 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.common;
|
||||
|
||||
import nu.validator.htmlparser.annotation.Const;
|
||||
import nu.validator.htmlparser.annotation.NoLength;
|
||||
import nu.validator.htmlparser.impl.ElementName;
|
||||
import nu.validator.htmlparser.impl.HtmlAttributes;
|
||||
import nu.validator.htmlparser.impl.Tokenizer;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* <code>Tokenizer</code> reports tokens through this interface.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface TokenHandler {
|
||||
|
||||
/**
|
||||
* This method is called at the start of tokenization before any other
|
||||
* methods on this interface are called. Implementations should hold the
|
||||
* reference to the <code>Tokenizer</code> in order to set the content
|
||||
* model flag and in order to be able to query for <code>Locator</code>
|
||||
* data.
|
||||
*
|
||||
* @param self
|
||||
* the <code>Tokenizer</code>.
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void startTokenization(Tokenizer self) throws SAXException;
|
||||
|
||||
/**
|
||||
* If this handler implementation cares about comments, return
|
||||
* <code>true</code>. If not, return <code>false</code>.
|
||||
*
|
||||
* @return whether this handler wants comments
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public boolean wantsComments() throws SAXException;
|
||||
|
||||
/**
|
||||
* Receive a doctype token.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param publicIdentifier
|
||||
* the public id
|
||||
* @param systemIdentifier
|
||||
* the system id
|
||||
* @param forceQuirks
|
||||
* whether the token is correct
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void doctype(String name, String publicIdentifier,
|
||||
String systemIdentifier, boolean forceQuirks) throws SAXException;
|
||||
|
||||
/**
|
||||
* Receive a start tag token.
|
||||
*
|
||||
* @param eltName
|
||||
* the tag name
|
||||
* @param attributes
|
||||
* the attributes
|
||||
* @param selfClosing
|
||||
* TODO
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void startTag(ElementName eltName, HtmlAttributes attributes,
|
||||
boolean selfClosing) throws SAXException;
|
||||
|
||||
/**
|
||||
* Receive an end tag token.
|
||||
*
|
||||
* @param eltName
|
||||
* the tag name
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void endTag(ElementName eltName) throws SAXException;
|
||||
|
||||
/**
|
||||
* Receive a comment token. The data is junk if the
|
||||
* <code>wantsComments()</code> returned <code>false</code>.
|
||||
*
|
||||
* @param buf
|
||||
* a buffer holding the data
|
||||
* @param start the offset into the buffer
|
||||
* @param length
|
||||
* the number of code units to read
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void comment(@NoLength char[] buf, int start, int length) throws SAXException;
|
||||
|
||||
/**
|
||||
* Receive character tokens. This method has the same semantics as the SAX
|
||||
* method of the same name.
|
||||
*
|
||||
* @param buf
|
||||
* a buffer holding the data
|
||||
* @param start
|
||||
* offset into the buffer
|
||||
* @param length
|
||||
* the number of code units to read
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
|
||||
*/
|
||||
public void characters(@Const @NoLength char[] buf, int start, int length)
|
||||
throws SAXException;
|
||||
|
||||
/**
|
||||
* Reports a U+0000 that's being turned into a U+FFFD.
|
||||
*
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void zeroOriginatingReplacementCharacter() throws SAXException;
|
||||
|
||||
/**
|
||||
* The end-of-file token.
|
||||
*
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void eof() throws SAXException;
|
||||
|
||||
/**
|
||||
* The perform final cleanup.
|
||||
*
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public void endTokenization() throws SAXException;
|
||||
|
||||
/**
|
||||
* Checks if the CDATA sections are allowed.
|
||||
*
|
||||
* @return <code>true</code> if CDATA sections are allowed
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
public boolean cdataSectionAllowed() throws SAXException;
|
||||
|
||||
/**
|
||||
* Notifies the token handler of the worst case amount of data to be
|
||||
* reported via <code>characters()</code> and
|
||||
* <code>zeroOriginatingReplacementCharacter()</code>.
|
||||
*
|
||||
* @param inputLength the maximum number of chars that can be reported
|
||||
* via <code>characters()</code> and
|
||||
* <code>zeroOriginatingReplacementCharacter()</code> before a new call to
|
||||
* this method.
|
||||
*/
|
||||
public void ensureBufferSpace(int inputLength) throws SAXException;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 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.common;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* An interface for intercepting information about the state transitions that
|
||||
* the tokenizer is making.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public interface TransitionHandler {
|
||||
|
||||
/**
|
||||
* This method is called for every tokenizer state transition.
|
||||
*
|
||||
* @param from
|
||||
* the state the tokenizer is transitioning from
|
||||
* @param to
|
||||
* the state being transitioned to
|
||||
* @param reconsume
|
||||
* <code>true</code> if the current input character is going to
|
||||
* be reconsumed in the new state
|
||||
* @param pos
|
||||
* the current index into the input stream
|
||||
* @throws SAXException
|
||||
* if something went wrong
|
||||
*/
|
||||
void transition(int from, int to, boolean reconsume, int pos)
|
||||
throws SAXException;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
*
|
||||
* 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.common;
|
||||
|
||||
/**
|
||||
* Policy for XML 1.0 violations.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public enum XmlViolationPolicy {
|
||||
/**
|
||||
* Conform to HTML 5, allow XML 1.0 to be violated.
|
||||
*/
|
||||
ALLOW,
|
||||
|
||||
/**
|
||||
* Halt when something cannot be mapped to XML 1.0.
|
||||
*/
|
||||
FATAL,
|
||||
|
||||
/**
|
||||
* Be non-conforming and alter the infoset to fit
|
||||
* XML 1.0 when something would otherwise not be
|
||||
* mappable to XML 1.0.
|
||||
*/
|
||||
ALTER_INFOSET
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head><title>Package Overview</title>
|
||||
<!--
|
||||
Copyright (c) 2007 Henri Sivonen
|
||||
|
||||
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.
|
||||
-->
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<p>This package provides common interfaces and enumerations.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,357 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* 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.dom;
|
||||
|
||||
import nu.validator.htmlparser.common.DocumentMode;
|
||||
import nu.validator.htmlparser.impl.CoalescingTreeBuilder;
|
||||
import nu.validator.htmlparser.impl.HtmlAttributes;
|
||||
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.Text;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* The tree builder glue for building a tree through the public DOM APIs.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
class DOMTreeBuilder extends CoalescingTreeBuilder<Element> {
|
||||
|
||||
/**
|
||||
* The DOM impl.
|
||||
*/
|
||||
private DOMImplementation implementation;
|
||||
|
||||
/**
|
||||
* The current doc.
|
||||
*/
|
||||
private Document document;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*
|
||||
* @param implementation
|
||||
* the DOM impl.
|
||||
*/
|
||||
protected DOMTreeBuilder(DOMImplementation implementation) {
|
||||
super();
|
||||
this.implementation = implementation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#addAttributesToElement(java.lang.Object,
|
||||
* nu.validator.htmlparser.impl.HtmlAttributes)
|
||||
*/
|
||||
@Override protected void addAttributesToElement(Element element,
|
||||
HtmlAttributes attributes) throws SAXException {
|
||||
try {
|
||||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
String localName = attributes.getLocalNameNoBoundsCheck(i);
|
||||
String uri = attributes.getURINoBoundsCheck(i);
|
||||
if (!element.hasAttributeNS(uri, localName)) {
|
||||
element.setAttributeNS(uri, localName,
|
||||
attributes.getValueNoBoundsCheck(i));
|
||||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.CoalescingTreeBuilder#appendCharacters(java.lang.Object,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override protected void appendCharacters(Element parent, String text)
|
||||
throws SAXException {
|
||||
try {
|
||||
Node lastChild = parent.getLastChild();
|
||||
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
|
||||
Text lastAsText = (Text) lastChild;
|
||||
lastAsText.setData(lastAsText.getData() + text);
|
||||
return;
|
||||
}
|
||||
parent.appendChild(document.createTextNode(text));
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#appendChildrenToNewParent(java.lang.Object,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override protected void appendChildrenToNewParent(Element oldParent,
|
||||
Element newParent) throws SAXException {
|
||||
try {
|
||||
while (oldParent.hasChildNodes()) {
|
||||
newParent.appendChild(oldParent.getFirstChild());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.CoalescingTreeBuilder#appendComment(java.lang.Object,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override protected void appendComment(Element parent, String comment)
|
||||
throws SAXException {
|
||||
try {
|
||||
parent.appendChild(document.createComment(comment));
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.CoalescingTreeBuilder#appendCommentToDocument(java.lang.String)
|
||||
*/
|
||||
@Override protected void appendCommentToDocument(String comment)
|
||||
throws SAXException {
|
||||
try {
|
||||
document.appendChild(document.createComment(comment));
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#createElement(String, String, nu.validator.htmlparser.impl.HtmlAttributes, Object)
|
||||
*/
|
||||
@Override protected Element createElement(String ns, String name,
|
||||
HtmlAttributes attributes, Element intendedParent) throws SAXException {
|
||||
try {
|
||||
Element rv = document.createElementNS(ns, name);
|
||||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
rv.setAttributeNS(attributes.getURINoBoundsCheck(i),
|
||||
attributes.getLocalNameNoBoundsCheck(i),
|
||||
attributes.getValueNoBoundsCheck(i));
|
||||
if (attributes.getTypeNoBoundsCheck(i) == "ID") {
|
||||
rv.setIdAttributeNS(null, attributes.getLocalName(i), true);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
throw new RuntimeException("Unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#createHtmlElementSetAsRoot(nu.validator.htmlparser.impl.HtmlAttributes)
|
||||
*/
|
||||
@Override protected Element createHtmlElementSetAsRoot(
|
||||
HtmlAttributes attributes) throws SAXException {
|
||||
try {
|
||||
Element rv = document.createElementNS(
|
||||
"http://www.w3.org/1999/xhtml", "html");
|
||||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
rv.setAttributeNS(attributes.getURINoBoundsCheck(i),
|
||||
attributes.getLocalNameNoBoundsCheck(i),
|
||||
attributes.getValueNoBoundsCheck(i));
|
||||
}
|
||||
document.appendChild(rv);
|
||||
return rv;
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
throw new RuntimeException("Unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#appendElement(java.lang.Object,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override protected void appendElement(Element child, Element newParent)
|
||||
throws SAXException {
|
||||
try {
|
||||
newParent.appendChild(child);
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#hasChildren(java.lang.Object)
|
||||
*/
|
||||
@Override protected boolean hasChildren(Element element)
|
||||
throws SAXException {
|
||||
try {
|
||||
return element.hasChildNodes();
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
throw new RuntimeException("Unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#createElement(String,
|
||||
* java.lang.String, org.xml.sax.Attributes, java.lang.Object)
|
||||
*/
|
||||
@Override protected Element createElement(String ns, String name,
|
||||
HtmlAttributes attributes, Element form, Element intendedParent) throws SAXException {
|
||||
try {
|
||||
Element rv = createElement(ns, name, attributes, intendedParent);
|
||||
rv.setUserData("nu.validator.form-pointer", form, null);
|
||||
return rv;
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#start()
|
||||
*/
|
||||
@Override protected void start(boolean fragment) throws SAXException {
|
||||
document = implementation.createDocument(null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#documentMode(nu.validator.htmlparser.common.DocumentMode,
|
||||
* java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
protected void documentMode(DocumentMode mode, String publicIdentifier,
|
||||
String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
|
||||
throws SAXException {
|
||||
document.setUserData("nu.validator.document-mode", mode, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document.
|
||||
*
|
||||
* @return the document
|
||||
*/
|
||||
Document getDocument() {
|
||||
Document rv = document;
|
||||
document = null;
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the document fragment.
|
||||
*
|
||||
* @return the document fragment
|
||||
*/
|
||||
DocumentFragment getDocumentFragment() {
|
||||
DocumentFragment rv = document.createDocumentFragment();
|
||||
Node rootElt = document.getFirstChild();
|
||||
while (rootElt.hasChildNodes()) {
|
||||
rv.appendChild(rootElt.getFirstChild());
|
||||
}
|
||||
document = null;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Element createAndInsertFosterParentedElement(String ns, String name,
|
||||
HtmlAttributes attributes, Element table, Element stackParent) throws SAXException {
|
||||
try {
|
||||
Node parent = table.getParentNode();
|
||||
Element child = createElement(ns, name, attributes, parent != null ? (Element) parent : stackParent);
|
||||
|
||||
if (parent != null) { // always an element if not null
|
||||
parent.insertBefore(child, table);
|
||||
} else {
|
||||
stackParent.appendChild(child);
|
||||
}
|
||||
|
||||
return child;
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
throw new RuntimeException("Unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void insertFosterParentedCharacters(String text,
|
||||
Element table, Element stackParent) throws SAXException {
|
||||
try {
|
||||
Node parent = table.getParentNode();
|
||||
if (parent != null) { // always an element if not null
|
||||
Node previousSibling = table.getPreviousSibling();
|
||||
if (previousSibling != null
|
||||
&& previousSibling.getNodeType() == Node.TEXT_NODE) {
|
||||
Text lastAsText = (Text) previousSibling;
|
||||
lastAsText.setData(lastAsText.getData() + text);
|
||||
return;
|
||||
}
|
||||
parent.insertBefore(document.createTextNode(text), table);
|
||||
return;
|
||||
}
|
||||
Node lastChild = stackParent.getLastChild();
|
||||
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
|
||||
Text lastAsText = (Text) lastChild;
|
||||
lastAsText.setData(lastAsText.getData() + text);
|
||||
return;
|
||||
}
|
||||
stackParent.appendChild(document.createTextNode(text));
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void insertFosterParentedChild(Element child,
|
||||
Element table, Element stackParent) throws SAXException {
|
||||
try {
|
||||
Node parent = table.getParentNode();
|
||||
if (parent != null) { // always an element if not null
|
||||
parent.insertBefore(child, table);
|
||||
} else {
|
||||
stackParent.appendChild(child);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void detachFromParent(Element element)
|
||||
throws SAXException {
|
||||
try {
|
||||
Node parent = element.getParentNode();
|
||||
if (parent != null) {
|
||||
parent.removeChild(element);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
fatal(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.dom;
|
||||
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public class Dom2Sax {
|
||||
|
||||
private static String emptyIfNull(String namespaceURI) {
|
||||
return namespaceURI == null ? "" : namespaceURI;
|
||||
}
|
||||
|
||||
private final NamedNodeMapAttributes attributes = new NamedNodeMapAttributes();
|
||||
|
||||
private final ContentHandler contentHandler;
|
||||
|
||||
private final LexicalHandler lexicalHandler;
|
||||
|
||||
/**
|
||||
* @param contentHandler
|
||||
* @param lexicalHandler
|
||||
*/
|
||||
public Dom2Sax(ContentHandler contentHandler, LexicalHandler lexicalHandler) {
|
||||
if (contentHandler == null) {
|
||||
throw new IllegalArgumentException("ContentHandler must not be null.");
|
||||
}
|
||||
this.contentHandler = contentHandler;
|
||||
this.lexicalHandler = lexicalHandler;
|
||||
}
|
||||
|
||||
public void parse(Node node) throws SAXException {
|
||||
Node current = node;
|
||||
Node next;
|
||||
char[] buf;
|
||||
for (;;) {
|
||||
switch (current.getNodeType()) {
|
||||
case Node.ELEMENT_NODE:
|
||||
attributes.setNamedNodeMap(current.getAttributes());
|
||||
// To work around severe bogosity in the default DOM
|
||||
// impl, use the node name if local name is null.
|
||||
String localName = current.getLocalName();
|
||||
contentHandler.startElement(
|
||||
emptyIfNull(current.getNamespaceURI()),
|
||||
localName == null ? current.getNodeName()
|
||||
: localName, null, attributes);
|
||||
attributes.clear();
|
||||
break;
|
||||
case Node.TEXT_NODE:
|
||||
buf = current.getNodeValue().toCharArray();
|
||||
contentHandler.characters(buf, 0, buf.length);
|
||||
break;
|
||||
case Node.CDATA_SECTION_NODE:
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.startCDATA();
|
||||
}
|
||||
buf = current.getNodeValue().toCharArray();
|
||||
contentHandler.characters(buf, 0, buf.length);
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.endCDATA();
|
||||
}
|
||||
break;
|
||||
case Node.COMMENT_NODE:
|
||||
if (lexicalHandler != null) {
|
||||
buf = current.getNodeValue().toCharArray();
|
||||
lexicalHandler.comment(buf, 0, buf.length);
|
||||
}
|
||||
break;
|
||||
case Node.DOCUMENT_NODE:
|
||||
contentHandler.startDocument();
|
||||
break;
|
||||
case Node.DOCUMENT_TYPE_NODE:
|
||||
if (lexicalHandler != null) {
|
||||
DocumentType doctype = (DocumentType) current;
|
||||
lexicalHandler.startDTD(doctype.getName(),
|
||||
doctype.getPublicId(), doctype.getSystemId());
|
||||
lexicalHandler.endDTD();
|
||||
}
|
||||
break;
|
||||
case Node.PROCESSING_INSTRUCTION_NODE:
|
||||
contentHandler.processingInstruction(current.getNodeName(), current.getNodeValue());
|
||||
break;
|
||||
case Node.ENTITY_REFERENCE_NODE:
|
||||
contentHandler.skippedEntity(current.getNodeName());
|
||||
break;
|
||||
}
|
||||
if ((next = current.getFirstChild()) != null) {
|
||||
current = next;
|
||||
continue;
|
||||
}
|
||||
for (;;) {
|
||||
switch (current.getNodeType()) {
|
||||
case Node.ELEMENT_NODE:
|
||||
// To work around severe bogosity in the default DOM
|
||||
// impl, use the node name if local name is null.
|
||||
String localName = current.getLocalName();
|
||||
contentHandler.endElement(
|
||||
emptyIfNull(current.getNamespaceURI()),
|
||||
localName == null ? current.getNodeName()
|
||||
: localName, null);
|
||||
break;
|
||||
case Node.DOCUMENT_NODE:
|
||||
contentHandler.endDocument();
|
||||
break;
|
||||
}
|
||||
if (current == node) {
|
||||
return;
|
||||
}
|
||||
if ((next = current.getNextSibling()) != null) {
|
||||
current = next;
|
||||
break;
|
||||
}
|
||||
current = current.getParentNode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NamedNodeMapAttributes implements Attributes {
|
||||
|
||||
private NamedNodeMap map;
|
||||
|
||||
private int length;
|
||||
|
||||
public void setNamedNodeMap(NamedNodeMap attributes) {
|
||||
this.map = attributes;
|
||||
this.length = attributes.getLength();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.map = null;
|
||||
}
|
||||
|
||||
public int getIndex(String qName) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
Node n = map.item(i);
|
||||
if (n.getNodeName().equals(qName)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getIndex(String uri, String localName) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
Node n = map.item(i);
|
||||
if (n.getLocalName().equals(localName) && emptyIfNull(n.getNamespaceURI()).equals(uri)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public String getLocalName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return map.item(index).getLocalName();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getQName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return map.item(index).getNodeName();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getType(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return "id".equals(map.item(index).getLocalName()) ? "ID" : "CDATA";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getType(String qName) {
|
||||
int index = getIndex(qName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getType(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getType(String uri, String localName) {
|
||||
int index = getIndex(uri, localName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getType(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getURI(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return emptyIfNull(map.item(index).getNamespaceURI());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return map.item(index).getNodeValue();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String qName) {
|
||||
int index = getIndex(qName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String uri, String localName) {
|
||||
int index = getIndex(uri, localName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,736 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2008 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.dom;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import nu.validator.htmlparser.common.CharacterHandler;
|
||||
import nu.validator.htmlparser.common.DoctypeExpectation;
|
||||
import nu.validator.htmlparser.common.DocumentModeHandler;
|
||||
import nu.validator.htmlparser.common.Heuristics;
|
||||
import nu.validator.htmlparser.common.TokenHandler;
|
||||
import nu.validator.htmlparser.common.TransitionHandler;
|
||||
import nu.validator.htmlparser.common.XmlViolationPolicy;
|
||||
import nu.validator.htmlparser.impl.ErrorReportingTokenizer;
|
||||
import nu.validator.htmlparser.impl.Tokenizer;
|
||||
import nu.validator.htmlparser.io.Driver;
|
||||
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* This class implements an HTML5 parser that exposes data through the DOM
|
||||
* interface.
|
||||
*
|
||||
* <p>By default, when using the constructor without arguments, the
|
||||
* this parser coerces XML 1.0-incompatible infosets into XML 1.0-compatible
|
||||
* infosets. This corresponds to <code>ALTER_INFOSET</code> as the general
|
||||
* XML violation policy. To make the parser support non-conforming HTML fully
|
||||
* per the HTML 5 spec while on the other hand potentially violating the SAX2
|
||||
* API contract, set the general XML violation policy to <code>ALLOW</code>.
|
||||
* This does not work with a standard DOM implementation.
|
||||
* It is possible to treat XML 1.0 infoset violations as fatal by setting
|
||||
* the general XML violation policy to <code>FATAL</code>.
|
||||
*
|
||||
* <p>The doctype is not represented in the tree.
|
||||
*
|
||||
* <p>The document mode is represented as user data <code>DocumentMode</code>
|
||||
* object with the key <code>nu.validator.document-mode</code> on the document
|
||||
* node.
|
||||
*
|
||||
* <p>The form pointer is also stored as user data with the key
|
||||
* <code>nu.validator.form-pointer</code>.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public class HtmlDocumentBuilder extends DocumentBuilder {
|
||||
|
||||
/**
|
||||
* Returns the JAXP DOM implementation.
|
||||
*
|
||||
* @return the JAXP DOM implementation
|
||||
*/
|
||||
private static DOMImplementation jaxpDOMImplementation() {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder builder;
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return builder.getDOMImplementation();
|
||||
}
|
||||
|
||||
/**
|
||||
* The tokenizer.
|
||||
*/
|
||||
private Driver driver;
|
||||
|
||||
/**
|
||||
* The tree builder.
|
||||
*/
|
||||
private final DOMTreeBuilder treeBuilder;
|
||||
|
||||
/**
|
||||
* The DOM impl.
|
||||
*/
|
||||
private final DOMImplementation implementation;
|
||||
|
||||
/**
|
||||
* The entity resolver.
|
||||
*/
|
||||
private EntityResolver entityResolver;
|
||||
|
||||
private ErrorHandler errorHandler = null;
|
||||
|
||||
private DocumentModeHandler documentModeHandler = null;
|
||||
|
||||
private DoctypeExpectation doctypeExpectation = DoctypeExpectation.HTML;
|
||||
|
||||
private boolean checkingNormalization = false;
|
||||
|
||||
private boolean scriptingEnabled = false;
|
||||
|
||||
private final List<CharacterHandler> characterHandlers = new LinkedList<CharacterHandler>();
|
||||
|
||||
private XmlViolationPolicy contentSpacePolicy = XmlViolationPolicy.FATAL;
|
||||
|
||||
private XmlViolationPolicy contentNonXmlCharPolicy = XmlViolationPolicy.FATAL;
|
||||
|
||||
private XmlViolationPolicy commentPolicy = XmlViolationPolicy.FATAL;
|
||||
|
||||
private XmlViolationPolicy namePolicy = XmlViolationPolicy.FATAL;
|
||||
|
||||
private XmlViolationPolicy streamabilityViolationPolicy = XmlViolationPolicy.ALLOW;
|
||||
|
||||
private boolean html4ModeCompatibleWithXhtml1Schemata = false;
|
||||
|
||||
private boolean mappingLangToXmlLang = false;
|
||||
|
||||
private XmlViolationPolicy xmlnsPolicy = XmlViolationPolicy.FATAL;
|
||||
|
||||
private boolean reportingDoctype = true;
|
||||
|
||||
private ErrorHandler treeBuilderErrorHandler = null;
|
||||
|
||||
private Heuristics heuristics = Heuristics.NONE;
|
||||
|
||||
private TransitionHandler transitionHandler = null;
|
||||
|
||||
/**
|
||||
* Instantiates the document builder with a specific DOM
|
||||
* implementation and XML violation policy.
|
||||
*
|
||||
* @param implementation
|
||||
* the DOM implementation
|
||||
* @param xmlPolicy the policy
|
||||
*/
|
||||
public HtmlDocumentBuilder(DOMImplementation implementation,
|
||||
XmlViolationPolicy xmlPolicy) {
|
||||
this.implementation = implementation;
|
||||
this.treeBuilder = new DOMTreeBuilder(implementation);
|
||||
this.driver = null;
|
||||
setXmlPolicy(xmlPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the document builder with a specific DOM implementation
|
||||
* and the infoset-altering XML violation policy.
|
||||
*
|
||||
* @param implementation
|
||||
* the DOM implementation
|
||||
*/
|
||||
public HtmlDocumentBuilder(DOMImplementation implementation) {
|
||||
this(implementation, XmlViolationPolicy.ALTER_INFOSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the document builder with the JAXP DOM implementation
|
||||
* and the infoset-altering XML violation policy.
|
||||
*/
|
||||
public HtmlDocumentBuilder() {
|
||||
this(XmlViolationPolicy.ALTER_INFOSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the document builder with the JAXP DOM implementation
|
||||
* and a specific XML violation policy.
|
||||
* @param xmlPolicy the policy
|
||||
*/
|
||||
public HtmlDocumentBuilder(XmlViolationPolicy xmlPolicy) {
|
||||
this(jaxpDOMImplementation(), xmlPolicy);
|
||||
}
|
||||
|
||||
|
||||
private Tokenizer newTokenizer(TokenHandler handler,
|
||||
boolean newAttributesEachTime) {
|
||||
if (errorHandler == null && transitionHandler == null
|
||||
&& contentNonXmlCharPolicy == XmlViolationPolicy.ALLOW) {
|
||||
return new Tokenizer(handler, newAttributesEachTime);
|
||||
} else {
|
||||
return new ErrorReportingTokenizer(handler, newAttributesEachTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class wraps different tree builders depending on configuration. This
|
||||
* method does the work of hiding this from the user of the class.
|
||||
*/
|
||||
private void lazyInit() {
|
||||
if (driver == null) {
|
||||
this.driver = new Driver(newTokenizer(treeBuilder, false));
|
||||
this.driver.setErrorHandler(errorHandler);
|
||||
this.driver.setTransitionHandler(transitionHandler);
|
||||
this.treeBuilder.setErrorHandler(treeBuilderErrorHandler);
|
||||
this.driver.setCheckingNormalization(checkingNormalization);
|
||||
this.driver.setCommentPolicy(commentPolicy);
|
||||
this.driver.setContentNonXmlCharPolicy(contentNonXmlCharPolicy);
|
||||
this.driver.setContentSpacePolicy(contentSpacePolicy);
|
||||
this.driver.setHtml4ModeCompatibleWithXhtml1Schemata(html4ModeCompatibleWithXhtml1Schemata);
|
||||
this.driver.setMappingLangToXmlLang(mappingLangToXmlLang);
|
||||
this.driver.setXmlnsPolicy(xmlnsPolicy);
|
||||
this.driver.setHeuristics(heuristics);
|
||||
for (CharacterHandler characterHandler : characterHandlers) {
|
||||
this.driver.addCharacterHandler(characterHandler);
|
||||
}
|
||||
this.treeBuilder.setDoctypeExpectation(doctypeExpectation);
|
||||
this.treeBuilder.setDocumentModeHandler(documentModeHandler);
|
||||
this.treeBuilder.setScriptingEnabled(scriptingEnabled);
|
||||
this.treeBuilder.setReportingDoctype(reportingDoctype);
|
||||
this.treeBuilder.setNamePolicy(namePolicy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenizes the input source.
|
||||
*
|
||||
* @param is the source
|
||||
* @throws SAXException if stuff goes wrong
|
||||
* @throws IOException if IO goes wrong
|
||||
* @throws MalformedURLException if the system ID is malformed and the entity resolver is <code>null</code>
|
||||
*/
|
||||
private void tokenize(InputSource is) throws SAXException, IOException,
|
||||
MalformedURLException {
|
||||
if (is == null) {
|
||||
throw new IllegalArgumentException("Null input.");
|
||||
}
|
||||
if (is.getByteStream() == null && is.getCharacterStream() == null) {
|
||||
String systemId = is.getSystemId();
|
||||
if (systemId == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"No byte stream, no character stream nor URI.");
|
||||
}
|
||||
if (entityResolver != null) {
|
||||
is = entityResolver.resolveEntity(is.getPublicId(), systemId);
|
||||
}
|
||||
if (is.getByteStream() == null || is.getCharacterStream() == null) {
|
||||
is = new InputSource();
|
||||
is.setSystemId(systemId);
|
||||
is.setByteStream(new URL(systemId).openStream());
|
||||
}
|
||||
}
|
||||
if (driver == null) lazyInit();
|
||||
driver.tokenize(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DOM implementation
|
||||
* @return the DOM implementation
|
||||
* @see javax.xml.parsers.DocumentBuilder#getDOMImplementation()
|
||||
*/
|
||||
@Override public DOMImplementation getDOMImplementation() {
|
||||
return implementation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code>.
|
||||
* @return <code>true</code>
|
||||
* @see javax.xml.parsers.DocumentBuilder#isNamespaceAware()
|
||||
*/
|
||||
@Override public boolean isNamespaceAware() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>false</code>
|
||||
* @return <code>false</code>
|
||||
* @see javax.xml.parsers.DocumentBuilder#isValidating()
|
||||
*/
|
||||
@Override public boolean isValidating() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For API compatibility.
|
||||
* @see javax.xml.parsers.DocumentBuilder#newDocument()
|
||||
*/
|
||||
@Override public Document newDocument() {
|
||||
return implementation.createDocument(null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a document from a SAX <code>InputSource</code>.
|
||||
* @param is the source
|
||||
* @return the doc
|
||||
* @throws SAXException if stuff goes wrong
|
||||
* @throws IOException if IO goes wrong
|
||||
* @see javax.xml.parsers.DocumentBuilder#parse(org.xml.sax.InputSource)
|
||||
*/
|
||||
@Override public Document parse(InputSource is) throws SAXException,
|
||||
IOException {
|
||||
treeBuilder.setFragmentContext(null);
|
||||
tokenize(is);
|
||||
return treeBuilder.getDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a document fragment from a SAX <code>InputSource</code> with
|
||||
* an HTML element as the fragment context.
|
||||
* @param is the source
|
||||
* @param context the context element name (HTML namespace assumed)
|
||||
* @return the document fragment
|
||||
* @throws SAXException if stuff goes wrong
|
||||
* @throws IOException if IO goes wrong
|
||||
*/
|
||||
public DocumentFragment parseFragment(InputSource is, String context)
|
||||
throws IOException, SAXException {
|
||||
treeBuilder.setFragmentContext(context.intern());
|
||||
tokenize(is);
|
||||
return treeBuilder.getDocumentFragment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a document fragment from a SAX <code>InputSource</code>.
|
||||
* @param is the source
|
||||
* @param contextLocal the local name of the context element
|
||||
* @param contextNamespace the namespace of the context element
|
||||
* @return the document fragment
|
||||
* @throws SAXException if stuff goes wrong
|
||||
* @throws IOException if IO goes wrong
|
||||
*/
|
||||
public DocumentFragment parseFragment(InputSource is, String contextLocal,
|
||||
String contextNamespace) throws IOException, SAXException {
|
||||
treeBuilder.setFragmentContext(contextLocal.intern(),
|
||||
contextNamespace.intern(), null, false);
|
||||
tokenize(is);
|
||||
return treeBuilder.getDocumentFragment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entity resolver for URI-only inputs.
|
||||
* @param resolver the resolver
|
||||
* @see javax.xml.parsers.DocumentBuilder#setEntityResolver(org.xml.sax.EntityResolver)
|
||||
*/
|
||||
@Override public void setEntityResolver(EntityResolver resolver) {
|
||||
this.entityResolver = resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the error handler.
|
||||
* @param errorHandler the handler
|
||||
* @see javax.xml.parsers.DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler)
|
||||
*/
|
||||
@Override public void setErrorHandler(ErrorHandler errorHandler) {
|
||||
treeBuilder.setErrorHandler(errorHandler);
|
||||
if (driver != null) {
|
||||
driver.setErrorHandler(errorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTransitionHander(TransitionHandler handler) {
|
||||
transitionHandler = handler;
|
||||
driver = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether NFC normalization of source is being checked.
|
||||
* @return <code>true</code> if NFC normalization of source is being checked.
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#isCheckingNormalization()
|
||||
*/
|
||||
public boolean isCheckingNormalization() {
|
||||
return checkingNormalization;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the checking of the NFC normalization of source.
|
||||
* @param enable <code>true</code> to check normalization
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setCheckingNormalization(boolean)
|
||||
*/
|
||||
public void setCheckingNormalization(boolean enable) {
|
||||
this.checkingNormalization = enable;
|
||||
if (driver != null) {
|
||||
driver.setCheckingNormalization(checkingNormalization);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the policy for consecutive hyphens in comments.
|
||||
* @param commentPolicy the policy
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setCommentPolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
|
||||
*/
|
||||
public void setCommentPolicy(XmlViolationPolicy commentPolicy) {
|
||||
this.commentPolicy = commentPolicy;
|
||||
if (driver != null) {
|
||||
driver.setCommentPolicy(commentPolicy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the policy for non-XML characters except white space.
|
||||
* @param contentNonXmlCharPolicy the policy
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setContentNonXmlCharPolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
|
||||
*/
|
||||
public void setContentNonXmlCharPolicy(
|
||||
XmlViolationPolicy contentNonXmlCharPolicy) {
|
||||
this.contentNonXmlCharPolicy = contentNonXmlCharPolicy;
|
||||
driver = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the policy for non-XML white space.
|
||||
* @param contentSpacePolicy the policy
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setContentSpacePolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
|
||||
*/
|
||||
public void setContentSpacePolicy(XmlViolationPolicy contentSpacePolicy) {
|
||||
this.contentSpacePolicy = contentSpacePolicy;
|
||||
if (driver != null) {
|
||||
driver.setContentSpacePolicy(contentSpacePolicy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the parser considers scripting to be enabled for noscript treatment.
|
||||
*
|
||||
* @return <code>true</code> if enabled
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#isScriptingEnabled()
|
||||
*/
|
||||
public boolean isScriptingEnabled() {
|
||||
return scriptingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the parser considers scripting to be enabled for noscript treatment.
|
||||
* @param scriptingEnabled <code>true</code> to enable
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#setScriptingEnabled(boolean)
|
||||
*/
|
||||
public void setScriptingEnabled(boolean scriptingEnabled) {
|
||||
this.scriptingEnabled = scriptingEnabled;
|
||||
if (treeBuilder != null) {
|
||||
treeBuilder.setScriptingEnabled(scriptingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the doctype expectation.
|
||||
*
|
||||
* @return the doctypeExpectation
|
||||
*/
|
||||
public DoctypeExpectation getDoctypeExpectation() {
|
||||
return doctypeExpectation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the doctype expectation.
|
||||
*
|
||||
* @param doctypeExpectation
|
||||
* the doctypeExpectation to set
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#setDoctypeExpectation(nu.validator.htmlparser.common.DoctypeExpectation)
|
||||
*/
|
||||
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation) {
|
||||
this.doctypeExpectation = doctypeExpectation;
|
||||
if (treeBuilder != null) {
|
||||
treeBuilder.setDoctypeExpectation(doctypeExpectation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document mode handler.
|
||||
*
|
||||
* @return the documentModeHandler
|
||||
*/
|
||||
public DocumentModeHandler getDocumentModeHandler() {
|
||||
return documentModeHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the document mode handler.
|
||||
*
|
||||
* @param documentModeHandler
|
||||
* the documentModeHandler to set
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#setDocumentModeHandler(nu.validator.htmlparser.common.DocumentModeHandler)
|
||||
*/
|
||||
public void setDocumentModeHandler(DocumentModeHandler documentModeHandler) {
|
||||
this.documentModeHandler = documentModeHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the streamabilityViolationPolicy.
|
||||
*
|
||||
* @return the streamabilityViolationPolicy
|
||||
*/
|
||||
public XmlViolationPolicy getStreamabilityViolationPolicy() {
|
||||
return streamabilityViolationPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the streamabilityViolationPolicy.
|
||||
*
|
||||
* @param streamabilityViolationPolicy
|
||||
* the streamabilityViolationPolicy to set
|
||||
*/
|
||||
public void setStreamabilityViolationPolicy(
|
||||
XmlViolationPolicy streamabilityViolationPolicy) {
|
||||
this.streamabilityViolationPolicy = streamabilityViolationPolicy;
|
||||
driver = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the HTML 4 mode reports boolean attributes in a way that repeats
|
||||
* the name in the value.
|
||||
* @param html4ModeCompatibleWithXhtml1Schemata
|
||||
*/
|
||||
public void setHtml4ModeCompatibleWithXhtml1Schemata(
|
||||
boolean html4ModeCompatibleWithXhtml1Schemata) {
|
||||
this.html4ModeCompatibleWithXhtml1Schemata = html4ModeCompatibleWithXhtml1Schemata;
|
||||
if (driver != null) {
|
||||
driver.setHtml4ModeCompatibleWithXhtml1Schemata(html4ModeCompatibleWithXhtml1Schemata);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>Locator</code> during parse.
|
||||
* @return the <code>Locator</code>
|
||||
*/
|
||||
public Locator getDocumentLocator() {
|
||||
return driver.getDocumentLocator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the HTML 4 mode reports boolean attributes in a way that repeats
|
||||
* the name in the value.
|
||||
*
|
||||
* @return the html4ModeCompatibleWithXhtml1Schemata
|
||||
*/
|
||||
public boolean isHtml4ModeCompatibleWithXhtml1Schemata() {
|
||||
return html4ModeCompatibleWithXhtml1Schemata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether <code>lang</code> is mapped to <code>xml:lang</code>.
|
||||
* @param mappingLangToXmlLang
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setMappingLangToXmlLang(boolean)
|
||||
*/
|
||||
public void setMappingLangToXmlLang(boolean mappingLangToXmlLang) {
|
||||
this.mappingLangToXmlLang = mappingLangToXmlLang;
|
||||
if (driver != null) {
|
||||
driver.setMappingLangToXmlLang(mappingLangToXmlLang);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether <code>lang</code> is mapped to <code>xml:lang</code>.
|
||||
*
|
||||
* @return the mappingLangToXmlLang
|
||||
*/
|
||||
public boolean isMappingLangToXmlLang() {
|
||||
return mappingLangToXmlLang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the <code>xmlns</code> attribute on the root element is
|
||||
* passed to through. (FATAL not allowed.)
|
||||
* @param xmlnsPolicy
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setXmlnsPolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
|
||||
*/
|
||||
public void setXmlnsPolicy(XmlViolationPolicy xmlnsPolicy) {
|
||||
if (xmlnsPolicy == XmlViolationPolicy.FATAL) {
|
||||
throw new IllegalArgumentException("Can't use FATAL here.");
|
||||
}
|
||||
this.xmlnsPolicy = xmlnsPolicy;
|
||||
if (driver != null) {
|
||||
driver.setXmlnsPolicy(xmlnsPolicy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the xmlnsPolicy.
|
||||
*
|
||||
* @return the xmlnsPolicy
|
||||
*/
|
||||
public XmlViolationPolicy getXmlnsPolicy() {
|
||||
return xmlnsPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the commentPolicy.
|
||||
*
|
||||
* @return the commentPolicy
|
||||
*/
|
||||
public XmlViolationPolicy getCommentPolicy() {
|
||||
return commentPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contentNonXmlCharPolicy.
|
||||
*
|
||||
* @return the contentNonXmlCharPolicy
|
||||
*/
|
||||
public XmlViolationPolicy getContentNonXmlCharPolicy() {
|
||||
return contentNonXmlCharPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contentSpacePolicy.
|
||||
*
|
||||
* @return the contentSpacePolicy
|
||||
*/
|
||||
public XmlViolationPolicy getContentSpacePolicy() {
|
||||
return contentSpacePolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reportingDoctype
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#setReportingDoctype(boolean)
|
||||
*/
|
||||
public void setReportingDoctype(boolean reportingDoctype) {
|
||||
this.reportingDoctype = reportingDoctype;
|
||||
if (treeBuilder != null) {
|
||||
treeBuilder.setReportingDoctype(reportingDoctype);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reportingDoctype.
|
||||
*
|
||||
* @return the reportingDoctype
|
||||
*/
|
||||
public boolean isReportingDoctype() {
|
||||
return reportingDoctype;
|
||||
}
|
||||
|
||||
/**
|
||||
* The policy for non-NCName element and attribute names.
|
||||
* @param namePolicy
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setNamePolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
|
||||
*/
|
||||
public void setNamePolicy(XmlViolationPolicy namePolicy) {
|
||||
this.namePolicy = namePolicy;
|
||||
if (driver != null) {
|
||||
driver.setNamePolicy(namePolicy);
|
||||
treeBuilder.setNamePolicy(namePolicy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the encoding sniffing heuristics.
|
||||
*
|
||||
* @param heuristics the heuristics to set
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#setHeuristics(nu.validator.htmlparser.common.Heuristics)
|
||||
*/
|
||||
public void setHeuristics(Heuristics heuristics) {
|
||||
this.heuristics = heuristics;
|
||||
if (driver != null) {
|
||||
driver.setHeuristics(heuristics);
|
||||
}
|
||||
}
|
||||
|
||||
public Heuristics getHeuristics() {
|
||||
return this.heuristics;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a catch-all convenience method for setting name, xmlns, content space,
|
||||
* content non-XML char and comment policies in one go. This does not affect the
|
||||
* streamability policy or doctype reporting.
|
||||
*
|
||||
* @param xmlPolicy
|
||||
*/
|
||||
public void setXmlPolicy(XmlViolationPolicy xmlPolicy) {
|
||||
setNamePolicy(xmlPolicy);
|
||||
setXmlnsPolicy(xmlPolicy == XmlViolationPolicy.FATAL ? XmlViolationPolicy.ALTER_INFOSET : xmlPolicy);
|
||||
setContentSpacePolicy(xmlPolicy);
|
||||
setContentNonXmlCharPolicy(xmlPolicy);
|
||||
setCommentPolicy(xmlPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* The policy for non-NCName element and attribute names.
|
||||
*
|
||||
* @return the namePolicy
|
||||
*/
|
||||
public XmlViolationPolicy getNamePolicy() {
|
||||
return namePolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does nothing.
|
||||
* @deprecated
|
||||
*/
|
||||
public void setBogusXmlnsPolicy(
|
||||
XmlViolationPolicy bogusXmlnsPolicy) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>XmlViolationPolicy.ALTER_INFOSET</code>.
|
||||
* @deprecated
|
||||
* @return <code>XmlViolationPolicy.ALTER_INFOSET</code>
|
||||
*/
|
||||
public XmlViolationPolicy getBogusXmlnsPolicy() {
|
||||
return XmlViolationPolicy.ALTER_INFOSET;
|
||||
}
|
||||
|
||||
public void addCharacterHandler(CharacterHandler characterHandler) {
|
||||
this.characterHandlers.add(characterHandler);
|
||||
if (driver != null) {
|
||||
driver.addCharacterHandler(characterHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether comment nodes appear in the tree.
|
||||
* @param ignoreComments <code>true</code> to ignore comments
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#setIgnoringComments(boolean)
|
||||
*/
|
||||
public void setIgnoringComments(boolean ignoreComments) {
|
||||
treeBuilder.setIgnoringComments(ignoreComments);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head><title>Package Overview</title>
|
||||
<!--
|
||||
Copyright (c) 2007 Henri Sivonen
|
||||
|
||||
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.
|
||||
-->
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<p>This package provides an HTML5 parser that exposes the document using the DOM API.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.extra;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
|
||||
import nu.validator.htmlparser.io.Encoding;
|
||||
|
||||
import org.mozilla.intl.chardet.nsDetector;
|
||||
import org.mozilla.intl.chardet.nsICharsetDetectionObserver;
|
||||
import org.mozilla.intl.chardet.nsPSMDetector;
|
||||
|
||||
import com.ibm.icu.text.CharsetDetector;
|
||||
|
||||
public class ChardetSniffer implements nsICharsetDetectionObserver {
|
||||
|
||||
private final byte[] source;
|
||||
|
||||
private final int length;
|
||||
|
||||
private Encoding returnValue = null;
|
||||
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
public ChardetSniffer(final byte[] source, final int length) {
|
||||
this.source = source;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public Encoding sniff() throws IOException {
|
||||
nsDetector detector = new nsDetector(nsPSMDetector.ALL);
|
||||
detector.Init(this);
|
||||
detector.DoIt(source, length, false);
|
||||
detector.DataEnd();
|
||||
if (returnValue != null && returnValue != Encoding.WINDOWS1252 && returnValue.isAsciiSuperset()) {
|
||||
return returnValue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] detectable = CharsetDetector.getAllDetectableCharsets();
|
||||
for (int i = 0; i < detectable.length; i++) {
|
||||
String charset = detectable[i];
|
||||
System.out.println(charset);
|
||||
}
|
||||
}
|
||||
|
||||
public void Notify(String charsetName) {
|
||||
try {
|
||||
Encoding enc = Encoding.forName(charsetName);
|
||||
Encoding actual = enc.getActualHtmlEncoding();
|
||||
if (actual != null) {
|
||||
enc = actual;
|
||||
}
|
||||
returnValue = enc;
|
||||
} catch (UnsupportedCharsetException e) {
|
||||
returnValue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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.extra;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import nu.validator.htmlparser.common.ByteReadable;
|
||||
import nu.validator.htmlparser.io.Encoding;
|
||||
|
||||
import com.ibm.icu.text.CharsetDetector;
|
||||
import com.ibm.icu.text.CharsetMatch;
|
||||
|
||||
public class IcuDetectorSniffer extends InputStream {
|
||||
|
||||
private final ByteReadable source;
|
||||
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
public IcuDetectorSniffer(final ByteReadable source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return source.readByte();
|
||||
}
|
||||
|
||||
public Encoding sniff() throws IOException {
|
||||
try {
|
||||
CharsetDetector detector = new CharsetDetector();
|
||||
detector.setText(this);
|
||||
CharsetMatch match = detector.detect();
|
||||
Encoding enc = Encoding.forName(match.getName());
|
||||
Encoding actual = enc.getActualHtmlEncoding();
|
||||
if (actual != null) {
|
||||
enc = actual;
|
||||
}
|
||||
if (enc != Encoding.WINDOWS1252 && enc.isAsciiSuperset()) {
|
||||
return enc;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] detectable = CharsetDetector.getAllDetectableCharsets();
|
||||
for (int i = 0; i < detectable.length; i++) {
|
||||
String charset = detectable[i];
|
||||
System.out.println(charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 Henri Sivonen
|
||||
* Copyright (c) 2007 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.extra;
|
||||
|
||||
import nu.validator.htmlparser.common.CharacterHandler;
|
||||
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.text.Normalizer;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
/**
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public final class NormalizationChecker implements CharacterHandler {
|
||||
|
||||
private ErrorHandler errorHandler;
|
||||
|
||||
private Locator locator;
|
||||
|
||||
/**
|
||||
* A thread-safe set of composing characters as per Charmod Norm.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final UnicodeSet COMPOSING_CHARACTERS = (UnicodeSet) new UnicodeSet(
|
||||
"[[:nfc_qc=maybe:][:^ccc=0:]]").freeze();
|
||||
|
||||
// see http://sourceforge.net/mailarchive/message.php?msg_id=37279908
|
||||
|
||||
/**
|
||||
* A buffer for holding sequences overlap the SAX buffer boundary.
|
||||
*/
|
||||
private char[] buf = new char[128];
|
||||
|
||||
/**
|
||||
* A holder for the original buffer (for the memory leak prevention
|
||||
* mechanism).
|
||||
*/
|
||||
private char[] bufHolder = null;
|
||||
|
||||
/**
|
||||
* The current used length of the buffer, i.e. the index of the first slot
|
||||
* that does not hold current data.
|
||||
*/
|
||||
private int pos;
|
||||
|
||||
/**
|
||||
* Indicates whether the checker the next call to <code>characters()</code>
|
||||
* is the first call in a run.
|
||||
*/
|
||||
private boolean atStartOfRun;
|
||||
|
||||
/**
|
||||
* Indicates whether the current run has already caused an error.
|
||||
*/
|
||||
private boolean alreadyComplainedAboutThisRun;
|
||||
|
||||
/**
|
||||
* Emit an error. The locator is used.
|
||||
*
|
||||
* @param message the error message
|
||||
* @throws SAXException if something goes wrong
|
||||
*/
|
||||
public void err(String message) throws SAXException {
|
||||
if (errorHandler != null) {
|
||||
SAXParseException spe = new SAXParseException(message, locator);
|
||||
errorHandler.error(spe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the argument is a composing BMP character
|
||||
* or a surrogate and <code>false</code> otherwise.
|
||||
*
|
||||
* @param c a UTF-16 code unit
|
||||
* @return <code>true</code> if the argument is a composing BMP character
|
||||
* or a surrogate and <code>false</code> otherwise
|
||||
*/
|
||||
private static boolean isComposingCharOrSurrogate(char c) {
|
||||
if (UCharacter.isHighSurrogate(c) || UCharacter.isLowSurrogate(c)) {
|
||||
return true;
|
||||
}
|
||||
return isComposingChar(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the argument is a composing character
|
||||
* and <code>false</code> otherwise.
|
||||
*
|
||||
* @param c a Unicode code point
|
||||
* @return <code>true</code> if the argument is a composing character
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
private static boolean isComposingChar(int c) {
|
||||
return COMPOSING_CHARACTERS.contains(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with mode selection.
|
||||
*
|
||||
* @param sourceTextMode whether the source text-related messages
|
||||
* should be enabled.
|
||||
*/
|
||||
public NormalizationChecker(Locator locator) {
|
||||
super();
|
||||
start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.common.CharacterHandler#start()
|
||||
*/
|
||||
public void start() {
|
||||
atStartOfRun = true;
|
||||
alreadyComplainedAboutThisRun = false;
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.common.CharacterHandler#characters(char[], int, int)
|
||||
*/
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException {
|
||||
if (alreadyComplainedAboutThisRun) {
|
||||
return;
|
||||
}
|
||||
if (atStartOfRun) {
|
||||
char c = ch[start];
|
||||
if (pos == 1) {
|
||||
// there's a single high surrogate in buf
|
||||
if (isComposingChar(UCharacter.getCodePoint(buf[0], c))) {
|
||||
err("Text run starts with a composing character.");
|
||||
}
|
||||
atStartOfRun = false;
|
||||
} else {
|
||||
if (length == 1 && UCharacter.isHighSurrogate(c)) {
|
||||
buf[0] = c;
|
||||
pos = 1;
|
||||
return;
|
||||
} else {
|
||||
if (UCharacter.isHighSurrogate(c)) {
|
||||
if (isComposingChar(UCharacter.getCodePoint(c,
|
||||
ch[start + 1]))) {
|
||||
err("Text run starts with a composing character.");
|
||||
}
|
||||
} else {
|
||||
if (isComposingCharOrSurrogate(c)) {
|
||||
err("Text run starts with a composing character.");
|
||||
}
|
||||
}
|
||||
atStartOfRun = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int i = start;
|
||||
int stop = start + length;
|
||||
if (pos > 0) {
|
||||
// there's stuff in buf
|
||||
while (i < stop && isComposingCharOrSurrogate(ch[i])) {
|
||||
i++;
|
||||
}
|
||||
appendToBuf(ch, start, i);
|
||||
if (i == stop) {
|
||||
return;
|
||||
} else {
|
||||
if (!Normalizer.isNormalized(buf, 0, pos, Normalizer.NFC, 0)) {
|
||||
errAboutTextRun();
|
||||
}
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
if (i < stop) {
|
||||
start = i;
|
||||
i = stop - 1;
|
||||
while (i > start && isComposingCharOrSurrogate(ch[i])) {
|
||||
i--;
|
||||
}
|
||||
if (i > start) {
|
||||
if (!Normalizer.isNormalized(ch, start, i, Normalizer.NFC, 0)) {
|
||||
errAboutTextRun();
|
||||
}
|
||||
}
|
||||
appendToBuf(ch, i, stop);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits an error stating that the current text run or the source
|
||||
* text is not in NFC.
|
||||
*
|
||||
* @throws SAXException if the <code>ErrorHandler</code> throws
|
||||
*/
|
||||
private void errAboutTextRun() throws SAXException {
|
||||
err("Source text is not in Unicode Normalization Form C.");
|
||||
alreadyComplainedAboutThisRun = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a slice of an UTF-16 code unit array to the internal
|
||||
* buffer.
|
||||
*
|
||||
* @param ch the array from which to copy
|
||||
* @param start the index of the first element that is copied
|
||||
* @param end the index of the first element that is not copied
|
||||
*/
|
||||
private void appendToBuf(char[] ch, int start, int end) {
|
||||
if (start == end) {
|
||||
return;
|
||||
}
|
||||
int neededBufLen = pos + (end - start);
|
||||
if (neededBufLen > buf.length) {
|
||||
char[] newBuf = new char[neededBufLen];
|
||||
System.arraycopy(buf, 0, newBuf, 0, pos);
|
||||
if (bufHolder == null) {
|
||||
bufHolder = buf; // keep the original around
|
||||
}
|
||||
buf = newBuf;
|
||||
}
|
||||
System.arraycopy(ch, start, buf, pos, end - start);
|
||||
pos += (end - start);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.common.CharacterHandler#end()
|
||||
*/
|
||||
public void end() throws SAXException {
|
||||
if (!alreadyComplainedAboutThisRun
|
||||
&& !Normalizer.isNormalized(buf, 0, pos, Normalizer.NFC, 0)) {
|
||||
errAboutTextRun();
|
||||
}
|
||||
if (bufHolder != null) {
|
||||
// restore the original small buffer to avoid leaking
|
||||
// memory if this checker is recycled
|
||||
buf = bufHolder;
|
||||
bufHolder = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setErrorHandler(ErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* A common superclass for tree builders that coalesce their text nodes.
|
||||
*
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public abstract class CoalescingTreeBuilder<T> extends TreeBuilder<T> {
|
||||
|
||||
protected final void accumulateCharacters(@NoLength char[] buf, int start,
|
||||
int length) throws SAXException {
|
||||
System.arraycopy(buf, start, charBuffer, charBufferLen, length);
|
||||
charBufferLen += length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#appendCharacters(java.lang.Object, char[], int, int)
|
||||
*/
|
||||
@Override protected final void appendCharacters(T parent, char[] buf, int start,
|
||||
int length) throws SAXException {
|
||||
appendCharacters(parent, new String(buf, start, length));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#appendIsindexPrompt(java.lang.Object)
|
||||
*/
|
||||
@Override protected void appendIsindexPrompt(T parent) throws SAXException {
|
||||
appendCharacters(parent, "This is a searchable index. Enter search keywords: ");
|
||||
}
|
||||
|
||||
protected abstract void appendCharacters(T parent, String text) throws SAXException;
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#appendComment(java.lang.Object, char[], int, int)
|
||||
*/
|
||||
@Override final protected void appendComment(T parent, char[] buf, int start,
|
||||
int length) throws SAXException {
|
||||
appendComment(parent, new String(buf, start, length));
|
||||
}
|
||||
|
||||
protected abstract void appendComment(T parent, String comment) throws SAXException;
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#appendCommentToDocument(char[], int, int)
|
||||
*/
|
||||
@Override protected final void appendCommentToDocument(char[] buf, int start,
|
||||
int length) throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
appendCommentToDocument(new String(buf, start, length));
|
||||
}
|
||||
|
||||
protected abstract void appendCommentToDocument(String comment) throws SAXException;
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilder#insertFosterParentedCharacters(char[], int, int, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override protected final void insertFosterParentedCharacters(char[] buf, int start,
|
||||
int length, T table, T stackParent) throws SAXException {
|
||||
insertFosterParentedCharacters(new String(buf, start, length), table, stackParent);
|
||||
}
|
||||
|
||||
protected abstract void insertFosterParentedCharacters(String text, T table, T stackParent) throws SAXException;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+772
@@ -0,0 +1,772 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2013 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.NoLength;
|
||||
import nu.validator.htmlparser.common.TokenHandler;
|
||||
import nu.validator.htmlparser.common.TransitionHandler;
|
||||
import nu.validator.htmlparser.common.XmlViolationPolicy;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
public class ErrorReportingTokenizer extends Tokenizer {
|
||||
|
||||
/**
|
||||
* Magic value for UTF-16 operations.
|
||||
*/
|
||||
private static final int SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00);
|
||||
|
||||
/**
|
||||
* The policy for non-space non-XML characters.
|
||||
*/
|
||||
private XmlViolationPolicy contentNonXmlCharPolicy = XmlViolationPolicy.ALTER_INFOSET;
|
||||
|
||||
/**
|
||||
* Keeps track of PUA warnings.
|
||||
*/
|
||||
private boolean alreadyWarnedAboutPrivateUseCharacters;
|
||||
|
||||
/**
|
||||
* The current line number in the current resource being parsed. (First line
|
||||
* is 1.) Passed on as locator data.
|
||||
*/
|
||||
private int line;
|
||||
|
||||
private int linePrev;
|
||||
|
||||
/**
|
||||
* The current column number in the current resource being tokenized. (First
|
||||
* column is 1, counted by UTF-16 code units.) Passed on as locator data.
|
||||
*/
|
||||
private int col;
|
||||
|
||||
private int colPrev;
|
||||
|
||||
private boolean nextCharOnNewLine;
|
||||
|
||||
private char prev;
|
||||
|
||||
private HashMap<String, String> errorProfileMap = null;
|
||||
|
||||
private TransitionHandler transitionHandler = null;
|
||||
|
||||
private int transitionBaseOffset = 0;
|
||||
|
||||
/**
|
||||
* @param tokenHandler
|
||||
* @param newAttributesEachTime
|
||||
*/
|
||||
public ErrorReportingTokenizer(TokenHandler tokenHandler,
|
||||
boolean newAttributesEachTime) {
|
||||
super(tokenHandler, newAttributesEachTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tokenHandler
|
||||
*/
|
||||
public ErrorReportingTokenizer(TokenHandler tokenHandler) {
|
||||
super(tokenHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.xml.sax.Locator#getLineNumber()
|
||||
*/
|
||||
public int getLineNumber() {
|
||||
if (line > 0) {
|
||||
return line;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.xml.sax.Locator#getColumnNumber()
|
||||
*/
|
||||
public int getColumnNumber() {
|
||||
if (col > 0) {
|
||||
return col;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the contentNonXmlCharPolicy.
|
||||
*
|
||||
* @param contentNonXmlCharPolicy
|
||||
* the contentNonXmlCharPolicy to set
|
||||
*/
|
||||
public void setContentNonXmlCharPolicy(
|
||||
XmlViolationPolicy contentNonXmlCharPolicy) {
|
||||
this.contentNonXmlCharPolicy = contentNonXmlCharPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the errorProfile.
|
||||
*
|
||||
* @param errorProfile
|
||||
*/
|
||||
public void setErrorProfile(HashMap<String, String> errorProfileMap) {
|
||||
this.errorProfileMap = errorProfileMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports on an event based on profile selected.
|
||||
*
|
||||
* @param profile
|
||||
* the profile this message belongs to
|
||||
* @param message
|
||||
* the message itself
|
||||
* @throws SAXException
|
||||
*/
|
||||
public void note(String profile, String message) throws SAXException {
|
||||
if (errorProfileMap == null)
|
||||
return;
|
||||
String level = errorProfileMap.get(profile);
|
||||
if ("warn".equals(level)) {
|
||||
warn(message);
|
||||
} else if ("err".equals(level)) {
|
||||
err(message);
|
||||
// } else if ("info".equals(level)) {
|
||||
// info(message);
|
||||
}
|
||||
}
|
||||
|
||||
protected void startErrorReporting() throws SAXException {
|
||||
line = linePrev = 0;
|
||||
col = colPrev = 1;
|
||||
nextCharOnNewLine = true;
|
||||
prev = '\u0000';
|
||||
alreadyWarnedAboutPrivateUseCharacters = false;
|
||||
transitionBaseOffset = 0;
|
||||
}
|
||||
|
||||
@Inline protected void silentCarriageReturn() {
|
||||
nextCharOnNewLine = true;
|
||||
lastCR = true;
|
||||
}
|
||||
|
||||
@Inline protected void silentLineFeed() {
|
||||
nextCharOnNewLine = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line.
|
||||
*
|
||||
* @return the line
|
||||
*/
|
||||
public int getLine() {
|
||||
return line;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the col.
|
||||
*
|
||||
* @return the col
|
||||
*/
|
||||
public int getCol() {
|
||||
return col;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nextCharOnNewLine.
|
||||
*
|
||||
* @return the nextCharOnNewLine
|
||||
*/
|
||||
public boolean isNextCharOnNewLine() {
|
||||
return nextCharOnNewLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes coalesced character tokens.
|
||||
*
|
||||
* @param buf
|
||||
* TODO
|
||||
* @param pos
|
||||
* TODO
|
||||
*
|
||||
* @throws SAXException
|
||||
*/
|
||||
@Override protected void flushChars(char[] buf, int pos)
|
||||
throws SAXException {
|
||||
if (pos > cstart) {
|
||||
int currLine = line;
|
||||
int currCol = col;
|
||||
line = linePrev;
|
||||
col = colPrev;
|
||||
tokenHandler.characters(buf, cstart, pos - cstart);
|
||||
line = currLine;
|
||||
col = currCol;
|
||||
}
|
||||
cstart = 0x7fffffff;
|
||||
}
|
||||
|
||||
@Override protected char checkChar(@NoLength char[] buf, int pos)
|
||||
throws SAXException {
|
||||
linePrev = line;
|
||||
colPrev = col;
|
||||
if (nextCharOnNewLine) {
|
||||
line++;
|
||||
col = 1;
|
||||
nextCharOnNewLine = false;
|
||||
} else {
|
||||
col++;
|
||||
}
|
||||
|
||||
char c = buf[pos];
|
||||
switch (c) {
|
||||
case '\u0000':
|
||||
err("Saw U+0000 in stream.");
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
break;
|
||||
case '\u000C':
|
||||
if (contentNonXmlCharPolicy == XmlViolationPolicy.FATAL) {
|
||||
fatal("This document is not mappable to XML 1.0 without data loss due to "
|
||||
+ toUPlusString(c)
|
||||
+ " which is not a legal XML 1.0 character.");
|
||||
} else {
|
||||
if (contentNonXmlCharPolicy == XmlViolationPolicy.ALTER_INFOSET) {
|
||||
c = buf[pos] = ' ';
|
||||
}
|
||||
warn("This document is not mappable to XML 1.0 without data loss due to "
|
||||
+ toUPlusString(c)
|
||||
+ " which is not a legal XML 1.0 character.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ((c & 0xFC00) == 0xDC00) {
|
||||
// Got a low surrogate. See if prev was high
|
||||
// surrogate
|
||||
if ((prev & 0xFC00) == 0xD800) {
|
||||
int intVal = (prev << 10) + c + SURROGATE_OFFSET;
|
||||
if ((intVal & 0xFFFE) == 0xFFFE) {
|
||||
err("Astral non-character.");
|
||||
}
|
||||
if (isAstralPrivateUse(intVal)) {
|
||||
warnAboutPrivateUseChar();
|
||||
}
|
||||
}
|
||||
} else if ((c < ' ' || ((c & 0xFFFE) == 0xFFFE))) {
|
||||
switch (contentNonXmlCharPolicy) {
|
||||
case FATAL:
|
||||
fatal("Forbidden code point " + toUPlusString(c)
|
||||
+ ".");
|
||||
break;
|
||||
case ALTER_INFOSET:
|
||||
c = buf[pos] = '\uFFFD';
|
||||
// fall through
|
||||
case ALLOW:
|
||||
err("Forbidden code point " + toUPlusString(c)
|
||||
+ ".");
|
||||
}
|
||||
} else if ((c >= '\u007F') && (c <= '\u009F')
|
||||
|| (c >= '\uFDD0') && (c <= '\uFDEF')) {
|
||||
err("Forbidden code point " + toUPlusString(c) + ".");
|
||||
} else if (isPrivateUse(c)) {
|
||||
warnAboutPrivateUseChar();
|
||||
}
|
||||
}
|
||||
prev = c;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SAXException
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#transition(int, int, boolean,
|
||||
* int)
|
||||
*/
|
||||
@Override protected int transition(int from, int to, boolean reconsume,
|
||||
int pos) throws SAXException {
|
||||
if (transitionHandler != null) {
|
||||
transitionHandler.transition(from, to, reconsume,
|
||||
transitionBaseOffset + pos);
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
private String toUPlusString(int c) {
|
||||
String hexString = Integer.toHexString(c);
|
||||
switch (hexString.length()) {
|
||||
case 1:
|
||||
return "U+000" + hexString;
|
||||
case 2:
|
||||
return "U+00" + hexString;
|
||||
case 3:
|
||||
return "U+0" + hexString;
|
||||
default:
|
||||
return "U+" + hexString;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits a warning about private use characters if the warning has not been
|
||||
* emitted yet.
|
||||
*
|
||||
* @throws SAXException
|
||||
*/
|
||||
private void warnAboutPrivateUseChar() throws SAXException {
|
||||
if (!alreadyWarnedAboutPrivateUseCharacters) {
|
||||
warn("Document uses the Unicode Private Use Area(s), which should not be used in publicly exchanged documents. (Charmod C073)");
|
||||
alreadyWarnedAboutPrivateUseCharacters = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if the argument is a BMP PUA character.
|
||||
*
|
||||
* @param c
|
||||
* the UTF-16 code unit to check
|
||||
* @return <code>true</code> if PUA character
|
||||
*/
|
||||
private boolean isPrivateUse(char c) {
|
||||
return c >= '\uE000' && c <= '\uF8FF';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if the argument is an astral PUA character.
|
||||
*
|
||||
* @param c
|
||||
* the code point to check
|
||||
* @return <code>true</code> if astral private use
|
||||
*/
|
||||
private boolean isAstralPrivateUse(int c) {
|
||||
return (c >= 0xF0000 && c <= 0xFFFFD)
|
||||
|| (c >= 0x100000 && c <= 0x10FFFD);
|
||||
}
|
||||
|
||||
@Override protected void errGarbageAfterLtSlash() throws SAXException {
|
||||
err("Garbage after \u201C</\u201D.");
|
||||
}
|
||||
|
||||
@Override protected void errLtSlashGt() throws SAXException {
|
||||
err("Saw \u201C</>\u201D. Probable causes: Unescaped \u201C<\u201D (escape as \u201C<\u201D) or mistyped end tag.");
|
||||
}
|
||||
|
||||
@Override protected void errWarnLtSlashInRcdata() throws SAXException {
|
||||
if (html4) {
|
||||
err((stateSave == Tokenizer.DATA ? "CDATA" : "RCDATA")
|
||||
+ " element \u201C"
|
||||
+ endTagExpectation
|
||||
+ "\u201D contained the string \u201C</\u201D, but it was not the start of the end tag. (HTML4-only error)");
|
||||
} else {
|
||||
warn((stateSave == Tokenizer.DATA ? "CDATA" : "RCDATA")
|
||||
+ " element \u201C"
|
||||
+ endTagExpectation
|
||||
+ "\u201D contained the string \u201C</\u201D, but this did not close the element.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errHtml4LtSlashInRcdata(char folded)
|
||||
throws SAXException {
|
||||
if (html4 && (index > 0 || (folded >= 'a' && folded <= 'z'))
|
||||
&& ElementName.IFRAME != endTagExpectation) {
|
||||
err((stateSave == Tokenizer.DATA ? "CDATA" : "RCDATA")
|
||||
+ " element \u201C"
|
||||
+ endTagExpectation.name
|
||||
+ "\u201D contained the string \u201C</\u201D, but it was not the start of the end tag. (HTML4-only error)");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errCharRefLacksSemicolon() throws SAXException {
|
||||
err("Character reference was not terminated by a semicolon.");
|
||||
}
|
||||
|
||||
@Override protected void errNoDigitsInNCR() throws SAXException {
|
||||
err("No digits after \u201C" + strBufToString() + "\u201D.");
|
||||
}
|
||||
|
||||
@Override protected void errGtInSystemId() throws SAXException {
|
||||
err("\u201C>\u201D in system identifier.");
|
||||
}
|
||||
|
||||
@Override protected void errGtInPublicId() throws SAXException {
|
||||
err("\u201C>\u201D in public identifier.");
|
||||
}
|
||||
|
||||
@Override protected void errNamelessDoctype() throws SAXException {
|
||||
err("Nameless doctype.");
|
||||
}
|
||||
|
||||
@Override protected void errConsecutiveHyphens() throws SAXException {
|
||||
err("Consecutive hyphens did not terminate a comment. \u201C--\u201D is not permitted inside a comment, but e.g. \u201C- -\u201D is.");
|
||||
}
|
||||
|
||||
@Override protected void errPrematureEndOfComment() throws SAXException {
|
||||
err("Premature end of comment. Use \u201C-->\u201D to end a comment properly.");
|
||||
}
|
||||
|
||||
@Override protected void errBogusComment() throws SAXException {
|
||||
err("Bogus comment.");
|
||||
}
|
||||
|
||||
@Override protected void errUnquotedAttributeValOrNull(char c)
|
||||
throws SAXException {
|
||||
switch (c) {
|
||||
case '<':
|
||||
err("\u201C<\u201D in an unquoted attribute value. Probable cause: Missing \u201C>\u201D immediately before.");
|
||||
return;
|
||||
case '`':
|
||||
err("\u201C`\u201D in an unquoted attribute value. Probable cause: Using the wrong character as a quote.");
|
||||
return;
|
||||
case '\uFFFD':
|
||||
return;
|
||||
default:
|
||||
err("\u201C"
|
||||
+ c
|
||||
+ "\u201D in an unquoted attribute value. Probable causes: Attributes running together or a URL query string in an unquoted attribute value.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errSlashNotFollowedByGt() throws SAXException {
|
||||
err("A slash was not immediately followed by \u201C>\u201D.");
|
||||
}
|
||||
|
||||
@Override protected void errHtml4XmlVoidSyntax() throws SAXException {
|
||||
if (html4) {
|
||||
err("The \u201C/>\u201D syntax on void elements is not allowed. (This is an HTML4-only error.)");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errNoSpaceBetweenAttributes() throws SAXException {
|
||||
err("No space between attributes.");
|
||||
}
|
||||
|
||||
@Override protected void errHtml4NonNameInUnquotedAttribute(char c)
|
||||
throws SAXException {
|
||||
if (html4
|
||||
&& !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
||||
|| (c >= '0' && c <= '9') || c == '.' || c == '-'
|
||||
|| c == '_' || c == ':')) {
|
||||
err("Non-name character in an unquoted attribute value. (This is an HTML4-only error.)");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errLtOrEqualsOrGraveInUnquotedAttributeOrNull(
|
||||
char c) throws SAXException {
|
||||
switch (c) {
|
||||
case '=':
|
||||
err("\u201C=\u201D at the start of an unquoted attribute value. Probable cause: Stray duplicate equals sign.");
|
||||
return;
|
||||
case '<':
|
||||
err("\u201C<\u201D at the start of an unquoted attribute value. Probable cause: Missing \u201C>\u201D immediately before.");
|
||||
return;
|
||||
case '`':
|
||||
err("\u201C`\u201D at the start of an unquoted attribute value. Probable cause: Using the wrong character as a quote.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errAttributeValueMissing() throws SAXException {
|
||||
err("Attribute value missing.");
|
||||
}
|
||||
|
||||
@Override protected void errBadCharBeforeAttributeNameOrNull(char c)
|
||||
throws SAXException {
|
||||
if (c == '<') {
|
||||
err("Saw \u201C<\u201D when expecting an attribute name. Probable cause: Missing \u201C>\u201D immediately before.");
|
||||
} else if (c == '=') {
|
||||
errEqualsSignBeforeAttributeName();
|
||||
} else if (c != '\uFFFD') {
|
||||
errQuoteBeforeAttributeName(c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errEqualsSignBeforeAttributeName()
|
||||
throws SAXException {
|
||||
err("Saw \u201C=\u201D when expecting an attribute name. Probable cause: Attribute name missing.");
|
||||
}
|
||||
|
||||
@Override protected void errBadCharAfterLt(char c) throws SAXException {
|
||||
err("Bad character \u201C"
|
||||
+ c
|
||||
+ "\u201D after \u201C<\u201D. Probable cause: Unescaped \u201C<\u201D. Try escaping it as \u201C<\u201D.");
|
||||
}
|
||||
|
||||
@Override protected void errLtGt() throws SAXException {
|
||||
err("Saw \u201C<>\u201D. Probable causes: Unescaped \u201C<\u201D (escape as \u201C<\u201D) or mistyped start tag.");
|
||||
}
|
||||
|
||||
@Override protected void errProcessingInstruction() throws SAXException {
|
||||
err("Saw \u201C<?\u201D. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)");
|
||||
}
|
||||
|
||||
@Override protected void errUnescapedAmpersandInterpretedAsCharacterReference()
|
||||
throws SAXException {
|
||||
if (errorHandler == null) {
|
||||
return;
|
||||
}
|
||||
SAXParseException spe = new SAXParseException(
|
||||
"The string following \u201C&\u201D was interpreted as a character reference. (\u201C&\u201D probably should have been escaped as \u201C&\u201D.)",
|
||||
ampersandLocation);
|
||||
errorHandler.error(spe);
|
||||
}
|
||||
|
||||
@Override protected void errNotSemicolonTerminated() throws SAXException {
|
||||
err("Named character reference was not terminated by a semicolon. (Or \u201C&\u201D should have been escaped as \u201C&\u201D.)");
|
||||
}
|
||||
|
||||
@Override protected void errNoNamedCharacterMatch() throws SAXException {
|
||||
if (errorHandler == null) {
|
||||
return;
|
||||
}
|
||||
SAXParseException spe = new SAXParseException(
|
||||
"\u201C&\u201D did not start a character reference. (\u201C&\u201D probably should have been escaped as \u201C&\u201D.)",
|
||||
ampersandLocation);
|
||||
errorHandler.error(spe);
|
||||
}
|
||||
|
||||
@Override protected void errQuoteBeforeAttributeName(char c)
|
||||
throws SAXException {
|
||||
err("Saw \u201C"
|
||||
+ c
|
||||
+ "\u201D when expecting an attribute name. Probable cause: \u201C=\u201D missing immediately before.");
|
||||
}
|
||||
|
||||
@Override protected void errQuoteOrLtInAttributeNameOrNull(char c)
|
||||
throws SAXException {
|
||||
if (c == '<') {
|
||||
err("\u201C<\u201D in attribute name. Probable cause: \u201C>\u201D missing immediately before.");
|
||||
} else if (c != '\uFFFD') {
|
||||
err("Quote \u201C"
|
||||
+ c
|
||||
+ "\u201D in attribute name. Probable cause: Matching quote missing somewhere earlier.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void errExpectedPublicId() throws SAXException {
|
||||
err("Expected a public identifier but the doctype ended.");
|
||||
}
|
||||
|
||||
@Override protected void errBogusDoctype() throws SAXException {
|
||||
err("Bogus doctype.");
|
||||
}
|
||||
|
||||
@Override protected void maybeWarnPrivateUseAstral() throws SAXException {
|
||||
if (errorHandler != null && isAstralPrivateUse(value)) {
|
||||
warnAboutPrivateUseChar();
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void maybeWarnPrivateUse(char ch) throws SAXException {
|
||||
if (errorHandler != null && isPrivateUse(ch)) {
|
||||
warnAboutPrivateUseChar();
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void maybeErrAttributesOnEndTag(HtmlAttributes attrs)
|
||||
throws SAXException {
|
||||
if (attrs.getLength() != 0) {
|
||||
/*
|
||||
* When an end tag token is emitted with attributes, that is a parse
|
||||
* error.
|
||||
*/
|
||||
err("End tag had attributes.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void maybeErrSlashInEndTag(boolean selfClosing)
|
||||
throws SAXException {
|
||||
if (selfClosing && endTag) {
|
||||
err("Stray \u201C/\u201D at the end of an end tag.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected char errNcrNonCharacter(char ch) throws SAXException {
|
||||
switch (contentNonXmlCharPolicy) {
|
||||
case FATAL:
|
||||
fatal("Character reference expands to a non-character ("
|
||||
+ toUPlusString((char) value) + ").");
|
||||
break;
|
||||
case ALTER_INFOSET:
|
||||
ch = '\uFFFD';
|
||||
// fall through
|
||||
case ALLOW:
|
||||
err("Character reference expands to a non-character ("
|
||||
+ toUPlusString((char) value) + ").");
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.Tokenizer#errAstralNonCharacter(int)
|
||||
*/
|
||||
@Override protected void errAstralNonCharacter(int ch) throws SAXException {
|
||||
err("Character reference expands to an astral non-character ("
|
||||
+ toUPlusString(value) + ").");
|
||||
}
|
||||
|
||||
@Override protected void errNcrSurrogate() throws SAXException {
|
||||
err("Character reference expands to a surrogate.");
|
||||
}
|
||||
|
||||
@Override protected char errNcrControlChar(char ch) throws SAXException {
|
||||
switch (contentNonXmlCharPolicy) {
|
||||
case FATAL:
|
||||
fatal("Character reference expands to a control character ("
|
||||
+ toUPlusString((char) value) + ").");
|
||||
break;
|
||||
case ALTER_INFOSET:
|
||||
ch = '\uFFFD';
|
||||
// fall through
|
||||
case ALLOW:
|
||||
err("Character reference expands to a control character ("
|
||||
+ toUPlusString((char) value) + ").");
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
@Override protected void errNcrCr() throws SAXException {
|
||||
err("A numeric character reference expanded to carriage return.");
|
||||
}
|
||||
|
||||
@Override protected void errNcrInC1Range() throws SAXException {
|
||||
err("A numeric character reference expanded to the C1 controls range.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInPublicId() throws SAXException {
|
||||
err("End of file inside public identifier.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInComment() throws SAXException {
|
||||
err("End of file inside comment.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInDoctype() throws SAXException {
|
||||
err("End of file inside doctype.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInAttributeValue() throws SAXException {
|
||||
err("End of file reached when inside an attribute value. Ignoring tag.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInAttributeName() throws SAXException {
|
||||
err("End of file occurred in an attribute name. Ignoring tag.");
|
||||
}
|
||||
|
||||
@Override protected void errEofWithoutGt() throws SAXException {
|
||||
err("Saw end of file without the previous tag ending with \u201C>\u201D. Ignoring tag.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInTagName() throws SAXException {
|
||||
err("End of file seen when looking for tag name. Ignoring tag.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInEndTag() throws SAXException {
|
||||
err("End of file inside end tag. Ignoring tag.");
|
||||
}
|
||||
|
||||
@Override protected void errEofAfterLt() throws SAXException {
|
||||
err("End of file after \u201C<\u201D.");
|
||||
}
|
||||
|
||||
@Override protected void errNcrOutOfRange() throws SAXException {
|
||||
err("Character reference outside the permissible Unicode range.");
|
||||
}
|
||||
|
||||
@Override protected void errNcrUnassigned() throws SAXException {
|
||||
err("Character reference expands to a permanently unassigned code point.");
|
||||
}
|
||||
|
||||
@Override protected void errDuplicateAttribute() throws SAXException {
|
||||
err("Duplicate attribute \u201C"
|
||||
+ attributeName.getLocal(AttributeName.HTML) + "\u201D.");
|
||||
}
|
||||
|
||||
@Override protected void errEofInSystemId() throws SAXException {
|
||||
err("End of file inside system identifier.");
|
||||
}
|
||||
|
||||
@Override protected void errExpectedSystemId() throws SAXException {
|
||||
err("Expected a system identifier but the doctype ended.");
|
||||
}
|
||||
|
||||
@Override protected void errMissingSpaceBeforeDoctypeName()
|
||||
throws SAXException {
|
||||
err("Missing space before doctype name.");
|
||||
}
|
||||
|
||||
@Override protected void errHyphenHyphenBang() throws SAXException {
|
||||
err("\u201C--!\u201D found in comment.");
|
||||
}
|
||||
|
||||
@Override protected void errNcrControlChar() throws SAXException {
|
||||
err("Character reference expands to a control character ("
|
||||
+ toUPlusString((char) value) + ").");
|
||||
}
|
||||
|
||||
@Override protected void errNcrZero() throws SAXException {
|
||||
err("Character reference expands to zero.");
|
||||
}
|
||||
|
||||
@Override protected void errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
|
||||
throws SAXException {
|
||||
err("No space between the doctype \u201CSYSTEM\u201D keyword and the quote.");
|
||||
}
|
||||
|
||||
@Override protected void errNoSpaceBetweenPublicAndSystemIds()
|
||||
throws SAXException {
|
||||
err("No space between the doctype public and system identifiers.");
|
||||
}
|
||||
|
||||
@Override protected void errNoSpaceBetweenDoctypePublicKeywordAndQuote()
|
||||
throws SAXException {
|
||||
err("No space between the doctype \u201CPUBLIC\u201D keyword and the quote.");
|
||||
}
|
||||
|
||||
@Override protected void noteAttributeWithoutValue() throws SAXException {
|
||||
note("xhtml2", "Attribute without value");
|
||||
}
|
||||
|
||||
@Override protected void noteUnquotedAttributeValue() throws SAXException {
|
||||
note("xhtml1", "Unquoted attribute value.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transitionHandler.
|
||||
*
|
||||
* @param transitionHandler
|
||||
* the transitionHandler to set
|
||||
*/
|
||||
public void setTransitionHandler(TransitionHandler transitionHandler) {
|
||||
this.transitionHandler = transitionHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an offset to be added to the position reported to
|
||||
* <code>TransitionHandler</code>.
|
||||
*
|
||||
* @param offset
|
||||
* the offset
|
||||
*/
|
||||
public void setTransitionBaseOffset(int offset) {
|
||||
this.transitionBaseOffset = offset;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* compressed returnValue:
|
||||
* int returnState = returnValue >> 33
|
||||
* boolean breakOuterState = ((returnValue >> 32) & 0x1) != 0)
|
||||
* int pos = returnValue & 0xFFFFFFFF // same as (int)returnValue
|
||||
*/
|
||||
@SuppressWarnings("unused") private long workAroundHotSpotHugeMethodLimit(
|
||||
int state, char c, int pos, @NoLength char[] buf,
|
||||
boolean reconsume, int returnState, int endPos) throws SAXException {
|
||||
stateloop: for (;;) {
|
||||
switch (state) {
|
||||
// BEGIN HOTSPOT WORKAROUND
|
||||
default:
|
||||
long returnStateAndPos = workAroundHotSpotHugeMethodLimit(
|
||||
state, c, pos, buf, reconsume, returnState, endPos);
|
||||
pos = (int)returnStateAndPos; // 5.1.3 in the Java spec
|
||||
returnState = (int)(returnStateAndPos >> 33);
|
||||
state = stateSave;
|
||||
if ( (pos == endPos) || ( (((int)(returnStateAndPos >> 32)) & 0x1) != 0) ) {
|
||||
break stateloop;
|
||||
}
|
||||
continue stateloop;
|
||||
// END HOTSPOT WORKAROUND
|
||||
default:
|
||||
assert !reconsume : "Must not reconsume when returning from HotSpot workaround.";
|
||||
stateSave = state;
|
||||
return (((long)returnState) << 33) | pos;
|
||||
}
|
||||
}
|
||||
assert !reconsume : "Must not reconsume when returning from HotSpot workaround.";
|
||||
stateSave = state;
|
||||
return (((long)returnState) << 33) | (1L << 32) | pos ;
|
||||
}
|
||||
@@ -0,0 +1,618 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2008-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.Auto;
|
||||
import nu.validator.htmlparser.annotation.IdType;
|
||||
import nu.validator.htmlparser.annotation.Local;
|
||||
import nu.validator.htmlparser.annotation.NsUri;
|
||||
import nu.validator.htmlparser.annotation.Prefix;
|
||||
import nu.validator.htmlparser.annotation.QName;
|
||||
import nu.validator.htmlparser.common.Interner;
|
||||
import nu.validator.htmlparser.common.XmlViolationPolicy;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Be careful with this class. QName is the name in from HTML tokenization.
|
||||
* Otherwise, please refer to the interface doc.
|
||||
*
|
||||
* @version $Id: AttributesImpl.java 206 2008-03-20 14:09:29Z hsivonen $
|
||||
* @author hsivonen
|
||||
*/
|
||||
public final class HtmlAttributes implements Attributes {
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
private static final AttributeName[] EMPTY_ATTRIBUTENAMES = new AttributeName[0];
|
||||
|
||||
private static final String[] EMPTY_STRINGS = new String[0];
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
public static final HtmlAttributes EMPTY_ATTRIBUTES = new HtmlAttributes(
|
||||
AttributeName.HTML);
|
||||
|
||||
private int mode;
|
||||
|
||||
private int length;
|
||||
|
||||
private @Auto AttributeName[] names;
|
||||
|
||||
private @Auto String[] values; // XXX perhaps make this @NoLength?
|
||||
|
||||
// CPPONLY: private @Auto int[] lines; // XXX perhaps make this @NoLength?
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
private String idValue;
|
||||
|
||||
private int xmlnsLength;
|
||||
|
||||
private AttributeName[] xmlnsNames;
|
||||
|
||||
private String[] xmlnsValues;
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
public HtmlAttributes(int mode) {
|
||||
this.mode = mode;
|
||||
this.length = 0;
|
||||
/*
|
||||
* The length of 5 covers covers 98.3% of elements
|
||||
* according to Hixie, but lets round to the next power of two for
|
||||
* jemalloc.
|
||||
*/
|
||||
this.names = new AttributeName[8];
|
||||
this.values = new String[8];
|
||||
// CPPONLY: this.lines = new int[8];
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
this.idValue = null;
|
||||
|
||||
this.xmlnsLength = 0;
|
||||
|
||||
this.xmlnsNames = HtmlAttributes.EMPTY_ATTRIBUTENAMES;
|
||||
|
||||
this.xmlnsValues = HtmlAttributes.EMPTY_STRINGS;
|
||||
|
||||
// ]NOCPP]
|
||||
}
|
||||
/*
|
||||
public HtmlAttributes(HtmlAttributes other) {
|
||||
this.mode = other.mode;
|
||||
this.length = other.length;
|
||||
this.names = new AttributeName[other.length];
|
||||
this.values = new String[other.length];
|
||||
// [NOCPP[
|
||||
this.idValue = other.idValue;
|
||||
this.xmlnsLength = other.xmlnsLength;
|
||||
this.xmlnsNames = new AttributeName[other.xmlnsLength];
|
||||
this.xmlnsValues = new String[other.xmlnsLength];
|
||||
// ]NOCPP]
|
||||
}
|
||||
*/
|
||||
|
||||
void destructor() {
|
||||
clear(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only use with a static argument
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public int getIndex(AttributeName name) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (names[i] == name) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only use with static argument.
|
||||
*
|
||||
* @see org.xml.sax.Attributes#getValue(java.lang.String)
|
||||
*/
|
||||
public String getValue(AttributeName name) {
|
||||
int index = getIndex(name);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValueNoBoundsCheck(index);
|
||||
}
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of <code>getLocalName(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the local name at index
|
||||
*/
|
||||
public @Local String getLocalNameNoBoundsCheck(int index) {
|
||||
// CPPONLY: assert index < length && index >= 0: "Index out of bounds";
|
||||
return names[index].getLocal(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of <code>getURI(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the namespace URI at index
|
||||
*/
|
||||
public @NsUri String getURINoBoundsCheck(int index) {
|
||||
// CPPONLY: assert index < length && index >= 0: "Index out of bounds";
|
||||
return names[index].getUri(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of <code>getPrefix(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the namespace prefix at index
|
||||
*/
|
||||
public @Prefix String getPrefixNoBoundsCheck(int index) {
|
||||
// CPPONLY: assert index < length && index >= 0: "Index out of bounds";
|
||||
return names[index].getPrefix(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of <code>getValue(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the attribute value at index
|
||||
*/
|
||||
public String getValueNoBoundsCheck(int index) {
|
||||
// CPPONLY: assert index < length && index >= 0: "Index out of bounds";
|
||||
return values[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of <code>getAttributeName(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the attribute name at index
|
||||
*/
|
||||
public AttributeName getAttributeNameNoBoundsCheck(int index) {
|
||||
// CPPONLY: assert index < length && index >= 0: "Index out of bounds";
|
||||
return names[index];
|
||||
}
|
||||
|
||||
// CPPONLY: /**
|
||||
// CPPONLY: * Obtains a line number without bounds check.
|
||||
// CPPONLY: * @param index a valid attribute index
|
||||
// CPPONLY: * @return the line number at index or -1 if unknown
|
||||
// CPPONLY: */
|
||||
// CPPONLY: public int getLineNoBoundsCheck(int index) {
|
||||
// CPPONLY: assert index < length && index >= 0: "Index out of bounds";
|
||||
// CPPONLY: return lines[index];
|
||||
// CPPONLY: }
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
/**
|
||||
* Variant of <code>getQName(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the QName at index
|
||||
*/
|
||||
public @QName String getQNameNoBoundsCheck(int index) {
|
||||
return names[index].getQName(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of <code>getType(int index)</code> without bounds check.
|
||||
* @param index a valid attribute index
|
||||
* @return the attribute type at index
|
||||
*/
|
||||
public @IdType String getTypeNoBoundsCheck(int index) {
|
||||
return (names[index] == AttributeName.ID) ? "ID" : "CDATA";
|
||||
}
|
||||
|
||||
public int getIndex(String qName) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (names[i].getQName(mode).equals(qName)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getIndex(String uri, String localName) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (names[i].getLocal(mode).equals(localName)
|
||||
&& names[i].getUri(mode).equals(uri)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public @IdType String getType(String qName) {
|
||||
int index = getIndex(qName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getType(index);
|
||||
}
|
||||
}
|
||||
|
||||
public @IdType String getType(String uri, String localName) {
|
||||
int index = getIndex(uri, localName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getType(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String qName) {
|
||||
int index = getIndex(qName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String uri, String localName) {
|
||||
int index = getIndex(uri, localName);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public @Local String getLocalName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getLocal(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @QName String getQName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getQName(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @IdType String getType(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return (names[index] == AttributeName.ID) ? "ID" : "CDATA";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeName getAttributeName(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @NsUri String getURI(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getUri(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @Prefix String getPrefix(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return names[index].getPrefix(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(int index) {
|
||||
if (index < length && index >= 0) {
|
||||
return values[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return idValue;
|
||||
}
|
||||
|
||||
public int getXmlnsLength() {
|
||||
return xmlnsLength;
|
||||
}
|
||||
|
||||
public @Local String getXmlnsLocalName(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsNames[index].getLocal(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public @NsUri String getXmlnsURI(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsNames[index].getUri(mode);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getXmlnsValue(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsValues[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getXmlnsIndex(AttributeName name) {
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
if (xmlnsNames[i] == name) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public String getXmlnsValue(AttributeName name) {
|
||||
int index = getXmlnsIndex(name);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
} else {
|
||||
return getXmlnsValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeName getXmlnsAttributeName(int index) {
|
||||
if (index < xmlnsLength && index >= 0) {
|
||||
return xmlnsNames[index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
void addAttribute(AttributeName name, String value
|
||||
// [NOCPP[
|
||||
, XmlViolationPolicy xmlnsPolicy
|
||||
// ]NOCPP]
|
||||
// CPPONLY: , int line
|
||||
) throws SAXException {
|
||||
// [NOCPP[
|
||||
if (name == AttributeName.ID) {
|
||||
idValue = value;
|
||||
}
|
||||
|
||||
if (name.isXmlns()) {
|
||||
if (xmlnsNames.length == xmlnsLength) {
|
||||
int newLen = xmlnsLength == 0 ? 2 : xmlnsLength << 1;
|
||||
AttributeName[] newNames = new AttributeName[newLen];
|
||||
System.arraycopy(xmlnsNames, 0, newNames, 0, xmlnsNames.length);
|
||||
xmlnsNames = newNames;
|
||||
String[] newValues = new String[newLen];
|
||||
System.arraycopy(xmlnsValues, 0, newValues, 0, xmlnsValues.length);
|
||||
xmlnsValues = newValues;
|
||||
}
|
||||
xmlnsNames[xmlnsLength] = name;
|
||||
xmlnsValues[xmlnsLength] = value;
|
||||
xmlnsLength++;
|
||||
switch (xmlnsPolicy) {
|
||||
case FATAL:
|
||||
// this is ugly
|
||||
throw new SAXException("Saw an xmlns attribute.");
|
||||
case ALTER_INFOSET:
|
||||
return;
|
||||
case ALLOW:
|
||||
// fall through
|
||||
}
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
if (names.length == length) {
|
||||
int newLen = length << 1; // The first growth covers virtually
|
||||
// 100% of elements according to
|
||||
// Hixie
|
||||
AttributeName[] newNames = new AttributeName[newLen];
|
||||
System.arraycopy(names, 0, newNames, 0, names.length);
|
||||
names = newNames;
|
||||
String[] newValues = new String[newLen];
|
||||
System.arraycopy(values, 0, newValues, 0, values.length);
|
||||
values = newValues;
|
||||
// CPPONLY: int[] newLines = new int[newLen];
|
||||
// CPPONLY: System.arraycopy(lines, 0, newLines, 0, lines.length);
|
||||
// CPPONLY: lines = newLines;
|
||||
}
|
||||
names[length] = name;
|
||||
values[length] = value;
|
||||
// CPPONLY: lines[length] = line;
|
||||
length++;
|
||||
}
|
||||
|
||||
void clear(int m) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
names[i].release();
|
||||
names[i] = null;
|
||||
Portability.releaseString(values[i]);
|
||||
values[i] = null;
|
||||
}
|
||||
length = 0;
|
||||
mode = m;
|
||||
// [NOCPP[
|
||||
idValue = null;
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
xmlnsNames[i] = null;
|
||||
xmlnsValues[i] = null;
|
||||
}
|
||||
xmlnsLength = 0;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used in C++ to release special <code>isindex</code>
|
||||
* attribute values whose ownership is not transferred.
|
||||
*/
|
||||
void releaseValue(int i) {
|
||||
Portability.releaseString(values[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only used for <code>AttributeName</code> ownership transfer
|
||||
* in the isindex case to avoid freeing custom names twice in C++.
|
||||
*/
|
||||
void clearWithoutReleasingContents() {
|
||||
for (int i = 0; i < length; i++) {
|
||||
names[i] = null;
|
||||
values[i] = null;
|
||||
}
|
||||
length = 0;
|
||||
}
|
||||
|
||||
boolean contains(AttributeName name) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (name.equalsAnother(names[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// [NOCPP[
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
if (name.equalsAnother(xmlnsNames[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// ]NOCPP]
|
||||
return false;
|
||||
}
|
||||
|
||||
public void adjustForMath() {
|
||||
mode = AttributeName.MATHML;
|
||||
}
|
||||
|
||||
public void adjustForSvg() {
|
||||
mode = AttributeName.SVG;
|
||||
}
|
||||
|
||||
public HtmlAttributes cloneAttributes(Interner interner)
|
||||
throws SAXException {
|
||||
assert (length == 0
|
||||
// [NOCPP[
|
||||
&& xmlnsLength == 0
|
||||
// ]NOCPP]
|
||||
)
|
||||
|| mode == 0 || mode == 3;
|
||||
HtmlAttributes clone = new HtmlAttributes(0);
|
||||
for (int i = 0; i < length; i++) {
|
||||
clone.addAttribute(names[i].cloneAttributeName(interner),
|
||||
Portability.newStringFromString(values[i])
|
||||
// [NOCPP[
|
||||
, XmlViolationPolicy.ALLOW
|
||||
// ]NOCPP]
|
||||
// CPPONLY: , lines[i]
|
||||
);
|
||||
}
|
||||
// [NOCPP[
|
||||
for (int i = 0; i < xmlnsLength; i++) {
|
||||
clone.addAttribute(xmlnsNames[i], xmlnsValues[i],
|
||||
XmlViolationPolicy.ALLOW);
|
||||
}
|
||||
// ]NOCPP]
|
||||
return clone; // XXX!!!
|
||||
}
|
||||
|
||||
public boolean equalsAnother(HtmlAttributes other) {
|
||||
assert mode == 0 || mode == 3 : "Trying to compare attributes in foreign content.";
|
||||
int otherLength = other.getLength();
|
||||
if (length != otherLength) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length; i++) {
|
||||
// Work around the limitations of C++
|
||||
boolean found = false;
|
||||
// The comparing just the local names is OK, since these attribute
|
||||
// holders are both supposed to belong to HTML formatting elements
|
||||
@Local String ownLocal = names[i].getLocal(AttributeName.HTML);
|
||||
for (int j = 0; j < otherLength; j++) {
|
||||
if (ownLocal == other.names[j].getLocal(AttributeName.HTML)) {
|
||||
found = true;
|
||||
if (!Portability.stringEqualsString(values[i], other.values[j])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
void processNonNcNames(TreeBuilder<?> treeBuilder, XmlViolationPolicy namePolicy) throws SAXException {
|
||||
for (int i = 0; i < length; i++) {
|
||||
AttributeName attName = names[i];
|
||||
if (!attName.isNcName(mode)) {
|
||||
String name = attName.getLocal(mode);
|
||||
switch (namePolicy) {
|
||||
case ALTER_INFOSET:
|
||||
names[i] = AttributeName.create(NCName.escapeName(name));
|
||||
// fall through
|
||||
case ALLOW:
|
||||
if (attName != AttributeName.XML_LANG) {
|
||||
treeBuilder.warn("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
|
||||
}
|
||||
break;
|
||||
case FATAL:
|
||||
treeBuilder.fatal("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void merge(HtmlAttributes attributes) throws SAXException {
|
||||
int len = attributes.getLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
AttributeName name = attributes.getAttributeNameNoBoundsCheck(i);
|
||||
if (!contains(name)) {
|
||||
addAttribute(name, attributes.getValueNoBoundsCheck(i), XmlViolationPolicy.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 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 org.xml.sax.Locator;
|
||||
|
||||
public class LocatorImpl implements Locator {
|
||||
|
||||
private final String systemId;
|
||||
|
||||
private final String publicId;
|
||||
|
||||
private final int column;
|
||||
|
||||
private final int line;
|
||||
|
||||
public LocatorImpl(Locator locator) {
|
||||
this.systemId = locator.getSystemId();
|
||||
this.publicId = locator.getPublicId();
|
||||
this.column = locator.getColumnNumber();
|
||||
this.line = locator.getLineNumber();
|
||||
}
|
||||
|
||||
public final int getColumnNumber() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public final int getLineNumber() {
|
||||
return line;
|
||||
}
|
||||
|
||||
public final String getPublicId() {
|
||||
return publicId;
|
||||
}
|
||||
|
||||
public final String getSystemId() {
|
||||
return systemId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,854 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* 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 java.io.IOException;
|
||||
|
||||
import nu.validator.htmlparser.annotation.Auto;
|
||||
import nu.validator.htmlparser.annotation.Inline;
|
||||
import nu.validator.htmlparser.common.ByteReadable;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public abstract class MetaScanner {
|
||||
|
||||
/**
|
||||
* Constant for "charset".
|
||||
*/
|
||||
private static final char[] CHARSET = { 'h', 'a', 'r', 's', 'e', 't' };
|
||||
|
||||
/**
|
||||
* Constant for "content".
|
||||
*/
|
||||
private static final char[] CONTENT = { 'o', 'n', 't', 'e', 'n', 't' };
|
||||
|
||||
/**
|
||||
* Constant for "http-equiv".
|
||||
*/
|
||||
private static final char[] HTTP_EQUIV = { 't', 't', 'p', '-', 'e', 'q',
|
||||
'u', 'i', 'v' };
|
||||
|
||||
/**
|
||||
* Constant for "content-type".
|
||||
*/
|
||||
private static final char[] CONTENT_TYPE = { 'c', 'o', 'n', 't', 'e', 'n',
|
||||
't', '-', 't', 'y', 'p', 'e' };
|
||||
|
||||
private static final int NO = 0;
|
||||
|
||||
private static final int M = 1;
|
||||
|
||||
private static final int E = 2;
|
||||
|
||||
private static final int T = 3;
|
||||
|
||||
private static final int A = 4;
|
||||
|
||||
private static final int DATA = 0;
|
||||
|
||||
private static final int TAG_OPEN = 1;
|
||||
|
||||
private static final int SCAN_UNTIL_GT = 2;
|
||||
|
||||
private static final int TAG_NAME = 3;
|
||||
|
||||
private static final int BEFORE_ATTRIBUTE_NAME = 4;
|
||||
|
||||
private static final int ATTRIBUTE_NAME = 5;
|
||||
|
||||
private static final int AFTER_ATTRIBUTE_NAME = 6;
|
||||
|
||||
private static final int BEFORE_ATTRIBUTE_VALUE = 7;
|
||||
|
||||
private static final int ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
|
||||
|
||||
private static final int ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
|
||||
|
||||
private static final int ATTRIBUTE_VALUE_UNQUOTED = 10;
|
||||
|
||||
private static final int AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
|
||||
|
||||
private static final int MARKUP_DECLARATION_OPEN = 13;
|
||||
|
||||
private static final int MARKUP_DECLARATION_HYPHEN = 14;
|
||||
|
||||
private static final int COMMENT_START = 15;
|
||||
|
||||
private static final int COMMENT_START_DASH = 16;
|
||||
|
||||
private static final int COMMENT = 17;
|
||||
|
||||
private static final int COMMENT_END_DASH = 18;
|
||||
|
||||
private static final int COMMENT_END = 19;
|
||||
|
||||
private static final int SELF_CLOSING_START_TAG = 20;
|
||||
|
||||
private static final int HTTP_EQUIV_NOT_SEEN = 0;
|
||||
|
||||
private static final int HTTP_EQUIV_CONTENT_TYPE = 1;
|
||||
|
||||
private static final int HTTP_EQUIV_OTHER = 2;
|
||||
|
||||
/**
|
||||
* The data source.
|
||||
*/
|
||||
protected ByteReadable readable;
|
||||
|
||||
/**
|
||||
* The state of the state machine that recognizes the tag name "meta".
|
||||
*/
|
||||
private int metaState = NO;
|
||||
|
||||
/**
|
||||
* The current position in recognizing the attribute name "content".
|
||||
*/
|
||||
private int contentIndex = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* The current position in recognizing the attribute name "charset".
|
||||
*/
|
||||
private int charsetIndex = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* The current position in recognizing the attribute name "http-equive".
|
||||
*/
|
||||
private int httpEquivIndex = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* The current position in recognizing the attribute value "content-type".
|
||||
*/
|
||||
private int contentTypeIndex = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* The tokenizer state.
|
||||
*/
|
||||
protected int stateSave = DATA;
|
||||
|
||||
/**
|
||||
* The currently filled length of strBuf.
|
||||
*/
|
||||
private int strBufLen;
|
||||
|
||||
/**
|
||||
* Accumulation buffer for attribute values.
|
||||
*/
|
||||
private @Auto char[] strBuf;
|
||||
|
||||
private String content;
|
||||
|
||||
private String charset;
|
||||
|
||||
private int httpEquivState;
|
||||
|
||||
// CPPONLY: private TreeBuilder treeBuilder;
|
||||
|
||||
public MetaScanner(
|
||||
// CPPONLY: TreeBuilder tb
|
||||
) {
|
||||
this.readable = null;
|
||||
this.metaState = NO;
|
||||
this.contentIndex = Integer.MAX_VALUE;
|
||||
this.charsetIndex = Integer.MAX_VALUE;
|
||||
this.httpEquivIndex = Integer.MAX_VALUE;
|
||||
this.contentTypeIndex = Integer.MAX_VALUE;
|
||||
this.stateSave = DATA;
|
||||
this.strBufLen = 0;
|
||||
this.strBuf = new char[36];
|
||||
this.content = null;
|
||||
this.charset = null;
|
||||
this.httpEquivState = HTTP_EQUIV_NOT_SEEN;
|
||||
// CPPONLY: this.treeBuilder = tb;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") private void destructor() {
|
||||
Portability.releaseString(content);
|
||||
Portability.releaseString(charset);
|
||||
}
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
/**
|
||||
* Reads a byte from the data source.
|
||||
*
|
||||
* -1 means end.
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
protected int read() throws IOException {
|
||||
return readable.readByte();
|
||||
}
|
||||
|
||||
// ]NOCPP]
|
||||
|
||||
// WARNING When editing this, makes sure the bytecode length shown by javap
|
||||
// stays under 8000 bytes!
|
||||
/**
|
||||
* The runs the meta scanning algorithm.
|
||||
*/
|
||||
protected final void stateLoop(int state)
|
||||
throws SAXException, IOException {
|
||||
int c = -1;
|
||||
boolean reconsume = false;
|
||||
stateloop: for (;;) {
|
||||
switch (state) {
|
||||
case DATA:
|
||||
dataloop: for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '<':
|
||||
state = MetaScanner.TAG_OPEN;
|
||||
break dataloop; // FALL THROUGH continue
|
||||
// stateloop;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
|
||||
case TAG_OPEN:
|
||||
tagopenloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case 'm':
|
||||
case 'M':
|
||||
metaState = M;
|
||||
state = MetaScanner.TAG_NAME;
|
||||
break tagopenloop;
|
||||
// continue stateloop;
|
||||
case '!':
|
||||
state = MetaScanner.MARKUP_DECLARATION_OPEN;
|
||||
continue stateloop;
|
||||
case '?':
|
||||
case '/':
|
||||
state = MetaScanner.SCAN_UNTIL_GT;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
|
||||
metaState = NO;
|
||||
state = MetaScanner.TAG_NAME;
|
||||
break tagopenloop;
|
||||
// continue stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALL THROUGH DON'T REORDER
|
||||
case TAG_NAME:
|
||||
tagnameloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
break tagnameloop;
|
||||
// continue stateloop;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
case 'e':
|
||||
case 'E':
|
||||
if (metaState == M) {
|
||||
metaState = E;
|
||||
} else {
|
||||
metaState = NO;
|
||||
}
|
||||
continue;
|
||||
case 't':
|
||||
case 'T':
|
||||
if (metaState == E) {
|
||||
metaState = T;
|
||||
} else {
|
||||
metaState = NO;
|
||||
}
|
||||
continue;
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (metaState == T) {
|
||||
metaState = A;
|
||||
} else {
|
||||
metaState = NO;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
metaState = NO;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case BEFORE_ATTRIBUTE_NAME:
|
||||
beforeattributenameloop: for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
/*
|
||||
* Consume the next input character:
|
||||
*/
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
continue;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = DATA;
|
||||
continue stateloop;
|
||||
case 'c':
|
||||
case 'C':
|
||||
contentIndex = 0;
|
||||
charsetIndex = 0;
|
||||
httpEquivIndex = Integer.MAX_VALUE;
|
||||
contentTypeIndex = Integer.MAX_VALUE;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
break beforeattributenameloop;
|
||||
case 'h':
|
||||
case 'H':
|
||||
contentIndex = Integer.MAX_VALUE;
|
||||
charsetIndex = Integer.MAX_VALUE;
|
||||
httpEquivIndex = 0;
|
||||
contentTypeIndex = Integer.MAX_VALUE;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
break beforeattributenameloop;
|
||||
default:
|
||||
contentIndex = Integer.MAX_VALUE;
|
||||
charsetIndex = Integer.MAX_VALUE;
|
||||
httpEquivIndex = Integer.MAX_VALUE;
|
||||
contentTypeIndex = Integer.MAX_VALUE;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
break beforeattributenameloop;
|
||||
// continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case ATTRIBUTE_NAME:
|
||||
attributenameloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
state = MetaScanner.AFTER_ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '=':
|
||||
strBufLen = 0;
|
||||
contentTypeIndex = 0;
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_VALUE;
|
||||
break attributenameloop;
|
||||
// continue stateloop;
|
||||
case '>':
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
if (metaState == A) {
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
c += 0x20;
|
||||
}
|
||||
if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) {
|
||||
++contentIndex;
|
||||
} else {
|
||||
contentIndex = Integer.MAX_VALUE;
|
||||
}
|
||||
if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) {
|
||||
++charsetIndex;
|
||||
} else {
|
||||
charsetIndex = Integer.MAX_VALUE;
|
||||
}
|
||||
if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
|
||||
++httpEquivIndex;
|
||||
} else {
|
||||
httpEquivIndex = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case BEFORE_ATTRIBUTE_VALUE:
|
||||
beforeattributevalueloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
continue;
|
||||
case '"':
|
||||
state = MetaScanner.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
|
||||
break beforeattributevalueloop;
|
||||
// continue stateloop;
|
||||
case '\'':
|
||||
state = MetaScanner.ATTRIBUTE_VALUE_SINGLE_QUOTED;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
handleCharInAttributeValue(c);
|
||||
state = MetaScanner.ATTRIBUTE_VALUE_UNQUOTED;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
|
||||
attributevaluedoublequotedloop: for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '"':
|
||||
handleAttributeValue();
|
||||
state = MetaScanner.AFTER_ATTRIBUTE_VALUE_QUOTED;
|
||||
break attributevaluedoublequotedloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
handleCharInAttributeValue(c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case AFTER_ATTRIBUTE_VALUE_QUOTED:
|
||||
afterattributevaluequotedloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
case '/':
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
break afterattributevaluequotedloop;
|
||||
// continue stateloop;
|
||||
case '>':
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case SELF_CLOSING_START_TAG:
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '>':
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
// XXX reorder point
|
||||
case ATTRIBUTE_VALUE_UNQUOTED:
|
||||
for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
|
||||
case '\u000C':
|
||||
handleAttributeValue();
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
handleAttributeValue();
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
handleCharInAttributeValue(c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case AFTER_ATTRIBUTE_NAME:
|
||||
for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\u000C':
|
||||
continue;
|
||||
case '/':
|
||||
handleAttributeValue();
|
||||
state = MetaScanner.SELF_CLOSING_START_TAG;
|
||||
continue stateloop;
|
||||
case '=':
|
||||
strBufLen = 0;
|
||||
contentTypeIndex = 0;
|
||||
state = MetaScanner.BEFORE_ATTRIBUTE_VALUE;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
handleAttributeValue();
|
||||
if (handleTag()) {
|
||||
break stateloop;
|
||||
}
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
case 'c':
|
||||
case 'C':
|
||||
contentIndex = 0;
|
||||
charsetIndex = 0;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
default:
|
||||
contentIndex = Integer.MAX_VALUE;
|
||||
charsetIndex = Integer.MAX_VALUE;
|
||||
state = MetaScanner.ATTRIBUTE_NAME;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case MARKUP_DECLARATION_OPEN:
|
||||
markupdeclarationopenloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.MARKUP_DECLARATION_HYPHEN;
|
||||
break markupdeclarationopenloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.SCAN_UNTIL_GT;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case MARKUP_DECLARATION_HYPHEN:
|
||||
markupdeclarationhyphenloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_START;
|
||||
break markupdeclarationhyphenloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.SCAN_UNTIL_GT;
|
||||
reconsume = true;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT_START:
|
||||
commentstartloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_START_DASH;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
break commentstartloop;
|
||||
// continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT:
|
||||
commentloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_END_DASH;
|
||||
break commentloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT_END_DASH:
|
||||
commentenddashloop: for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_END;
|
||||
break commentenddashloop;
|
||||
// continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// FALLTHRU DON'T REORDER
|
||||
case COMMENT_END:
|
||||
for (;;) {
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
case '-':
|
||||
continue;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
continue stateloop;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case COMMENT_START_DASH:
|
||||
c = read();
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '-':
|
||||
state = MetaScanner.COMMENT_END;
|
||||
continue stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
state = MetaScanner.COMMENT;
|
||||
continue stateloop;
|
||||
}
|
||||
// XXX reorder point
|
||||
case ATTRIBUTE_VALUE_SINGLE_QUOTED:
|
||||
for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '\'':
|
||||
handleAttributeValue();
|
||||
state = MetaScanner.AFTER_ATTRIBUTE_VALUE_QUOTED;
|
||||
continue stateloop;
|
||||
default:
|
||||
handleCharInAttributeValue(c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// XXX reorder point
|
||||
case SCAN_UNTIL_GT:
|
||||
for (;;) {
|
||||
if (reconsume) {
|
||||
reconsume = false;
|
||||
} else {
|
||||
c = read();
|
||||
}
|
||||
switch (c) {
|
||||
case -1:
|
||||
break stateloop;
|
||||
case '>':
|
||||
state = MetaScanner.DATA;
|
||||
continue stateloop;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stateSave = state;
|
||||
}
|
||||
|
||||
private void handleCharInAttributeValue(int c) {
|
||||
if (metaState == A) {
|
||||
if (contentIndex == CONTENT.length || charsetIndex == CHARSET.length) {
|
||||
addToBuffer(c);
|
||||
} else if (httpEquivIndex == HTTP_EQUIV.length) {
|
||||
if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
|
||||
++contentTypeIndex;
|
||||
} else {
|
||||
contentTypeIndex = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inline private int toAsciiLowerCase(int c) {
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
return c + 0x20;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a character to the accumulation buffer.
|
||||
* @param c the character to add
|
||||
*/
|
||||
private void addToBuffer(int c) {
|
||||
if (strBufLen == strBuf.length) {
|
||||
char[] newBuf = new char[strBuf.length + (strBuf.length << 1)];
|
||||
System.arraycopy(strBuf, 0, newBuf, 0, strBuf.length);
|
||||
strBuf = newBuf;
|
||||
}
|
||||
strBuf[strBufLen++] = (char)c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to extract a charset name from the accumulation buffer.
|
||||
* @return <code>true</code> if successful
|
||||
* @throws SAXException
|
||||
*/
|
||||
private void handleAttributeValue() throws SAXException {
|
||||
if (metaState != A) {
|
||||
return;
|
||||
}
|
||||
if (contentIndex == CONTENT.length && content == null) {
|
||||
content = Portability.newStringFromBuffer(strBuf, 0, strBufLen
|
||||
// CPPONLY: , treeBuilder
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (charsetIndex == CHARSET.length && charset == null) {
|
||||
charset = Portability.newStringFromBuffer(strBuf, 0, strBufLen
|
||||
// CPPONLY: , treeBuilder
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (httpEquivIndex == HTTP_EQUIV.length
|
||||
&& httpEquivState == HTTP_EQUIV_NOT_SEEN) {
|
||||
httpEquivState = (contentTypeIndex == CONTENT_TYPE.length) ? HTTP_EQUIV_CONTENT_TYPE
|
||||
: HTTP_EQUIV_OTHER;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleTag() throws SAXException {
|
||||
boolean stop = handleTagInner();
|
||||
Portability.releaseString(content);
|
||||
content = null;
|
||||
Portability.releaseString(charset);
|
||||
charset = null;
|
||||
httpEquivState = HTTP_EQUIV_NOT_SEEN;
|
||||
return stop;
|
||||
}
|
||||
|
||||
private boolean handleTagInner() throws SAXException {
|
||||
if (charset != null && tryCharset(charset)) {
|
||||
return true;
|
||||
}
|
||||
if (content != null && httpEquivState == HTTP_EQUIV_CONTENT_TYPE) {
|
||||
String extract = TreeBuilder.extractCharsetFromContent(content
|
||||
// CPPONLY: , treeBuilder
|
||||
);
|
||||
if (extract == null) {
|
||||
return false;
|
||||
}
|
||||
boolean success = tryCharset(extract);
|
||||
Portability.releaseString(extract);
|
||||
return success;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to switch to an encoding.
|
||||
*
|
||||
* @param encoding
|
||||
* @return <code>true</code> if successful
|
||||
* @throws SAXException
|
||||
*/
|
||||
protected abstract boolean tryCharset(String encoding) throws SAXException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,495 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2009 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;
|
||||
|
||||
public final class NCName {
|
||||
// [NOCPP[
|
||||
|
||||
private static final int SURROGATE_OFFSET = 0x10000 - (0xD800 << 10) - 0xDC00;
|
||||
|
||||
private static final char[] HEX_TABLE = "0123456789ABCDEF".toCharArray();
|
||||
|
||||
public static boolean isNCNameStart(char c) {
|
||||
return ((c >= '\u0041' && c <= '\u005A')
|
||||
|| (c >= '\u0061' && c <= '\u007A')
|
||||
|| (c >= '\u00C0' && c <= '\u00D6')
|
||||
|| (c >= '\u00D8' && c <= '\u00F6')
|
||||
|| (c >= '\u00F8' && c <= '\u00FF')
|
||||
|| (c >= '\u0100' && c <= '\u0131')
|
||||
|| (c >= '\u0134' && c <= '\u013E')
|
||||
|| (c >= '\u0141' && c <= '\u0148')
|
||||
|| (c >= '\u014A' && c <= '\u017E')
|
||||
|| (c >= '\u0180' && c <= '\u01C3')
|
||||
|| (c >= '\u01CD' && c <= '\u01F0')
|
||||
|| (c >= '\u01F4' && c <= '\u01F5')
|
||||
|| (c >= '\u01FA' && c <= '\u0217')
|
||||
|| (c >= '\u0250' && c <= '\u02A8')
|
||||
|| (c >= '\u02BB' && c <= '\u02C1') || (c == '\u0386')
|
||||
|| (c >= '\u0388' && c <= '\u038A') || (c == '\u038C')
|
||||
|| (c >= '\u038E' && c <= '\u03A1')
|
||||
|| (c >= '\u03A3' && c <= '\u03CE')
|
||||
|| (c >= '\u03D0' && c <= '\u03D6') || (c == '\u03DA')
|
||||
|| (c == '\u03DC') || (c == '\u03DE') || (c == '\u03E0')
|
||||
|| (c >= '\u03E2' && c <= '\u03F3')
|
||||
|| (c >= '\u0401' && c <= '\u040C')
|
||||
|| (c >= '\u040E' && c <= '\u044F')
|
||||
|| (c >= '\u0451' && c <= '\u045C')
|
||||
|| (c >= '\u045E' && c <= '\u0481')
|
||||
|| (c >= '\u0490' && c <= '\u04C4')
|
||||
|| (c >= '\u04C7' && c <= '\u04C8')
|
||||
|| (c >= '\u04CB' && c <= '\u04CC')
|
||||
|| (c >= '\u04D0' && c <= '\u04EB')
|
||||
|| (c >= '\u04EE' && c <= '\u04F5')
|
||||
|| (c >= '\u04F8' && c <= '\u04F9')
|
||||
|| (c >= '\u0531' && c <= '\u0556') || (c == '\u0559')
|
||||
|| (c >= '\u0561' && c <= '\u0586')
|
||||
|| (c >= '\u05D0' && c <= '\u05EA')
|
||||
|| (c >= '\u05F0' && c <= '\u05F2')
|
||||
|| (c >= '\u0621' && c <= '\u063A')
|
||||
|| (c >= '\u0641' && c <= '\u064A')
|
||||
|| (c >= '\u0671' && c <= '\u06B7')
|
||||
|| (c >= '\u06BA' && c <= '\u06BE')
|
||||
|| (c >= '\u06C0' && c <= '\u06CE')
|
||||
|| (c >= '\u06D0' && c <= '\u06D3') || (c == '\u06D5')
|
||||
|| (c >= '\u06E5' && c <= '\u06E6')
|
||||
|| (c >= '\u0905' && c <= '\u0939') || (c == '\u093D')
|
||||
|| (c >= '\u0958' && c <= '\u0961')
|
||||
|| (c >= '\u0985' && c <= '\u098C')
|
||||
|| (c >= '\u098F' && c <= '\u0990')
|
||||
|| (c >= '\u0993' && c <= '\u09A8')
|
||||
|| (c >= '\u09AA' && c <= '\u09B0') || (c == '\u09B2')
|
||||
|| (c >= '\u09B6' && c <= '\u09B9')
|
||||
|| (c >= '\u09DC' && c <= '\u09DD')
|
||||
|| (c >= '\u09DF' && c <= '\u09E1')
|
||||
|| (c >= '\u09F0' && c <= '\u09F1')
|
||||
|| (c >= '\u0A05' && c <= '\u0A0A')
|
||||
|| (c >= '\u0A0F' && c <= '\u0A10')
|
||||
|| (c >= '\u0A13' && c <= '\u0A28')
|
||||
|| (c >= '\u0A2A' && c <= '\u0A30')
|
||||
|| (c >= '\u0A32' && c <= '\u0A33')
|
||||
|| (c >= '\u0A35' && c <= '\u0A36')
|
||||
|| (c >= '\u0A38' && c <= '\u0A39')
|
||||
|| (c >= '\u0A59' && c <= '\u0A5C') || (c == '\u0A5E')
|
||||
|| (c >= '\u0A72' && c <= '\u0A74')
|
||||
|| (c >= '\u0A85' && c <= '\u0A8B') || (c == '\u0A8D')
|
||||
|| (c >= '\u0A8F' && c <= '\u0A91')
|
||||
|| (c >= '\u0A93' && c <= '\u0AA8')
|
||||
|| (c >= '\u0AAA' && c <= '\u0AB0')
|
||||
|| (c >= '\u0AB2' && c <= '\u0AB3')
|
||||
|| (c >= '\u0AB5' && c <= '\u0AB9') || (c == '\u0ABD')
|
||||
|| (c == '\u0AE0') || (c >= '\u0B05' && c <= '\u0B0C')
|
||||
|| (c >= '\u0B0F' && c <= '\u0B10')
|
||||
|| (c >= '\u0B13' && c <= '\u0B28')
|
||||
|| (c >= '\u0B2A' && c <= '\u0B30')
|
||||
|| (c >= '\u0B32' && c <= '\u0B33')
|
||||
|| (c >= '\u0B36' && c <= '\u0B39') || (c == '\u0B3D')
|
||||
|| (c >= '\u0B5C' && c <= '\u0B5D')
|
||||
|| (c >= '\u0B5F' && c <= '\u0B61')
|
||||
|| (c >= '\u0B85' && c <= '\u0B8A')
|
||||
|| (c >= '\u0B8E' && c <= '\u0B90')
|
||||
|| (c >= '\u0B92' && c <= '\u0B95')
|
||||
|| (c >= '\u0B99' && c <= '\u0B9A') || (c == '\u0B9C')
|
||||
|| (c >= '\u0B9E' && c <= '\u0B9F')
|
||||
|| (c >= '\u0BA3' && c <= '\u0BA4')
|
||||
|| (c >= '\u0BA8' && c <= '\u0BAA')
|
||||
|| (c >= '\u0BAE' && c <= '\u0BB5')
|
||||
|| (c >= '\u0BB7' && c <= '\u0BB9')
|
||||
|| (c >= '\u0C05' && c <= '\u0C0C')
|
||||
|| (c >= '\u0C0E' && c <= '\u0C10')
|
||||
|| (c >= '\u0C12' && c <= '\u0C28')
|
||||
|| (c >= '\u0C2A' && c <= '\u0C33')
|
||||
|| (c >= '\u0C35' && c <= '\u0C39')
|
||||
|| (c >= '\u0C60' && c <= '\u0C61')
|
||||
|| (c >= '\u0C85' && c <= '\u0C8C')
|
||||
|| (c >= '\u0C8E' && c <= '\u0C90')
|
||||
|| (c >= '\u0C92' && c <= '\u0CA8')
|
||||
|| (c >= '\u0CAA' && c <= '\u0CB3')
|
||||
|| (c >= '\u0CB5' && c <= '\u0CB9') || (c == '\u0CDE')
|
||||
|| (c >= '\u0CE0' && c <= '\u0CE1')
|
||||
|| (c >= '\u0D05' && c <= '\u0D0C')
|
||||
|| (c >= '\u0D0E' && c <= '\u0D10')
|
||||
|| (c >= '\u0D12' && c <= '\u0D28')
|
||||
|| (c >= '\u0D2A' && c <= '\u0D39')
|
||||
|| (c >= '\u0D60' && c <= '\u0D61')
|
||||
|| (c >= '\u0E01' && c <= '\u0E2E') || (c == '\u0E30')
|
||||
|| (c >= '\u0E32' && c <= '\u0E33')
|
||||
|| (c >= '\u0E40' && c <= '\u0E45')
|
||||
|| (c >= '\u0E81' && c <= '\u0E82') || (c == '\u0E84')
|
||||
|| (c >= '\u0E87' && c <= '\u0E88') || (c == '\u0E8A')
|
||||
|| (c == '\u0E8D') || (c >= '\u0E94' && c <= '\u0E97')
|
||||
|| (c >= '\u0E99' && c <= '\u0E9F')
|
||||
|| (c >= '\u0EA1' && c <= '\u0EA3') || (c == '\u0EA5')
|
||||
|| (c == '\u0EA7') || (c >= '\u0EAA' && c <= '\u0EAB')
|
||||
|| (c >= '\u0EAD' && c <= '\u0EAE') || (c == '\u0EB0')
|
||||
|| (c >= '\u0EB2' && c <= '\u0EB3') || (c == '\u0EBD')
|
||||
|| (c >= '\u0EC0' && c <= '\u0EC4')
|
||||
|| (c >= '\u0F40' && c <= '\u0F47')
|
||||
|| (c >= '\u0F49' && c <= '\u0F69')
|
||||
|| (c >= '\u10A0' && c <= '\u10C5')
|
||||
|| (c >= '\u10D0' && c <= '\u10F6') || (c == '\u1100')
|
||||
|| (c >= '\u1102' && c <= '\u1103')
|
||||
|| (c >= '\u1105' && c <= '\u1107') || (c == '\u1109')
|
||||
|| (c >= '\u110B' && c <= '\u110C')
|
||||
|| (c >= '\u110E' && c <= '\u1112') || (c == '\u113C')
|
||||
|| (c == '\u113E') || (c == '\u1140') || (c == '\u114C')
|
||||
|| (c == '\u114E') || (c == '\u1150')
|
||||
|| (c >= '\u1154' && c <= '\u1155') || (c == '\u1159')
|
||||
|| (c >= '\u115F' && c <= '\u1161') || (c == '\u1163')
|
||||
|| (c == '\u1165') || (c == '\u1167') || (c == '\u1169')
|
||||
|| (c >= '\u116D' && c <= '\u116E')
|
||||
|| (c >= '\u1172' && c <= '\u1173') || (c == '\u1175')
|
||||
|| (c == '\u119E') || (c == '\u11A8') || (c == '\u11AB')
|
||||
|| (c >= '\u11AE' && c <= '\u11AF')
|
||||
|| (c >= '\u11B7' && c <= '\u11B8') || (c == '\u11BA')
|
||||
|| (c >= '\u11BC' && c <= '\u11C2') || (c == '\u11EB')
|
||||
|| (c == '\u11F0') || (c == '\u11F9')
|
||||
|| (c >= '\u1E00' && c <= '\u1E9B')
|
||||
|| (c >= '\u1EA0' && c <= '\u1EF9')
|
||||
|| (c >= '\u1F00' && c <= '\u1F15')
|
||||
|| (c >= '\u1F18' && c <= '\u1F1D')
|
||||
|| (c >= '\u1F20' && c <= '\u1F45')
|
||||
|| (c >= '\u1F48' && c <= '\u1F4D')
|
||||
|| (c >= '\u1F50' && c <= '\u1F57') || (c == '\u1F59')
|
||||
|| (c == '\u1F5B') || (c == '\u1F5D')
|
||||
|| (c >= '\u1F5F' && c <= '\u1F7D')
|
||||
|| (c >= '\u1F80' && c <= '\u1FB4')
|
||||
|| (c >= '\u1FB6' && c <= '\u1FBC') || (c == '\u1FBE')
|
||||
|| (c >= '\u1FC2' && c <= '\u1FC4')
|
||||
|| (c >= '\u1FC6' && c <= '\u1FCC')
|
||||
|| (c >= '\u1FD0' && c <= '\u1FD3')
|
||||
|| (c >= '\u1FD6' && c <= '\u1FDB')
|
||||
|| (c >= '\u1FE0' && c <= '\u1FEC')
|
||||
|| (c >= '\u1FF2' && c <= '\u1FF4')
|
||||
|| (c >= '\u1FF6' && c <= '\u1FFC') || (c == '\u2126')
|
||||
|| (c >= '\u212A' && c <= '\u212B') || (c == '\u212E')
|
||||
|| (c >= '\u2180' && c <= '\u2182')
|
||||
|| (c >= '\u3041' && c <= '\u3094')
|
||||
|| (c >= '\u30A1' && c <= '\u30FA')
|
||||
|| (c >= '\u3105' && c <= '\u312C')
|
||||
|| (c >= '\uAC00' && c <= '\uD7A3')
|
||||
|| (c >= '\u4E00' && c <= '\u9FA5') || (c == '\u3007')
|
||||
|| (c >= '\u3021' && c <= '\u3029') || (c == '_'));
|
||||
}
|
||||
|
||||
public static boolean isNCNameTrail(char c) {
|
||||
return ((c >= '\u0030' && c <= '\u0039')
|
||||
|| (c >= '\u0660' && c <= '\u0669')
|
||||
|| (c >= '\u06F0' && c <= '\u06F9')
|
||||
|| (c >= '\u0966' && c <= '\u096F')
|
||||
|| (c >= '\u09E6' && c <= '\u09EF')
|
||||
|| (c >= '\u0A66' && c <= '\u0A6F')
|
||||
|| (c >= '\u0AE6' && c <= '\u0AEF')
|
||||
|| (c >= '\u0B66' && c <= '\u0B6F')
|
||||
|| (c >= '\u0BE7' && c <= '\u0BEF')
|
||||
|| (c >= '\u0C66' && c <= '\u0C6F')
|
||||
|| (c >= '\u0CE6' && c <= '\u0CEF')
|
||||
|| (c >= '\u0D66' && c <= '\u0D6F')
|
||||
|| (c >= '\u0E50' && c <= '\u0E59')
|
||||
|| (c >= '\u0ED0' && c <= '\u0ED9')
|
||||
|| (c >= '\u0F20' && c <= '\u0F29')
|
||||
|| (c >= '\u0041' && c <= '\u005A')
|
||||
|| (c >= '\u0061' && c <= '\u007A')
|
||||
|| (c >= '\u00C0' && c <= '\u00D6')
|
||||
|| (c >= '\u00D8' && c <= '\u00F6')
|
||||
|| (c >= '\u00F8' && c <= '\u00FF')
|
||||
|| (c >= '\u0100' && c <= '\u0131')
|
||||
|| (c >= '\u0134' && c <= '\u013E')
|
||||
|| (c >= '\u0141' && c <= '\u0148')
|
||||
|| (c >= '\u014A' && c <= '\u017E')
|
||||
|| (c >= '\u0180' && c <= '\u01C3')
|
||||
|| (c >= '\u01CD' && c <= '\u01F0')
|
||||
|| (c >= '\u01F4' && c <= '\u01F5')
|
||||
|| (c >= '\u01FA' && c <= '\u0217')
|
||||
|| (c >= '\u0250' && c <= '\u02A8')
|
||||
|| (c >= '\u02BB' && c <= '\u02C1') || (c == '\u0386')
|
||||
|| (c >= '\u0388' && c <= '\u038A') || (c == '\u038C')
|
||||
|| (c >= '\u038E' && c <= '\u03A1')
|
||||
|| (c >= '\u03A3' && c <= '\u03CE')
|
||||
|| (c >= '\u03D0' && c <= '\u03D6') || (c == '\u03DA')
|
||||
|| (c == '\u03DC') || (c == '\u03DE') || (c == '\u03E0')
|
||||
|| (c >= '\u03E2' && c <= '\u03F3')
|
||||
|| (c >= '\u0401' && c <= '\u040C')
|
||||
|| (c >= '\u040E' && c <= '\u044F')
|
||||
|| (c >= '\u0451' && c <= '\u045C')
|
||||
|| (c >= '\u045E' && c <= '\u0481')
|
||||
|| (c >= '\u0490' && c <= '\u04C4')
|
||||
|| (c >= '\u04C7' && c <= '\u04C8')
|
||||
|| (c >= '\u04CB' && c <= '\u04CC')
|
||||
|| (c >= '\u04D0' && c <= '\u04EB')
|
||||
|| (c >= '\u04EE' && c <= '\u04F5')
|
||||
|| (c >= '\u04F8' && c <= '\u04F9')
|
||||
|| (c >= '\u0531' && c <= '\u0556') || (c == '\u0559')
|
||||
|| (c >= '\u0561' && c <= '\u0586')
|
||||
|| (c >= '\u05D0' && c <= '\u05EA')
|
||||
|| (c >= '\u05F0' && c <= '\u05F2')
|
||||
|| (c >= '\u0621' && c <= '\u063A')
|
||||
|| (c >= '\u0641' && c <= '\u064A')
|
||||
|| (c >= '\u0671' && c <= '\u06B7')
|
||||
|| (c >= '\u06BA' && c <= '\u06BE')
|
||||
|| (c >= '\u06C0' && c <= '\u06CE')
|
||||
|| (c >= '\u06D0' && c <= '\u06D3') || (c == '\u06D5')
|
||||
|| (c >= '\u06E5' && c <= '\u06E6')
|
||||
|| (c >= '\u0905' && c <= '\u0939') || (c == '\u093D')
|
||||
|| (c >= '\u0958' && c <= '\u0961')
|
||||
|| (c >= '\u0985' && c <= '\u098C')
|
||||
|| (c >= '\u098F' && c <= '\u0990')
|
||||
|| (c >= '\u0993' && c <= '\u09A8')
|
||||
|| (c >= '\u09AA' && c <= '\u09B0') || (c == '\u09B2')
|
||||
|| (c >= '\u09B6' && c <= '\u09B9')
|
||||
|| (c >= '\u09DC' && c <= '\u09DD')
|
||||
|| (c >= '\u09DF' && c <= '\u09E1')
|
||||
|| (c >= '\u09F0' && c <= '\u09F1')
|
||||
|| (c >= '\u0A05' && c <= '\u0A0A')
|
||||
|| (c >= '\u0A0F' && c <= '\u0A10')
|
||||
|| (c >= '\u0A13' && c <= '\u0A28')
|
||||
|| (c >= '\u0A2A' && c <= '\u0A30')
|
||||
|| (c >= '\u0A32' && c <= '\u0A33')
|
||||
|| (c >= '\u0A35' && c <= '\u0A36')
|
||||
|| (c >= '\u0A38' && c <= '\u0A39')
|
||||
|| (c >= '\u0A59' && c <= '\u0A5C') || (c == '\u0A5E')
|
||||
|| (c >= '\u0A72' && c <= '\u0A74')
|
||||
|| (c >= '\u0A85' && c <= '\u0A8B') || (c == '\u0A8D')
|
||||
|| (c >= '\u0A8F' && c <= '\u0A91')
|
||||
|| (c >= '\u0A93' && c <= '\u0AA8')
|
||||
|| (c >= '\u0AAA' && c <= '\u0AB0')
|
||||
|| (c >= '\u0AB2' && c <= '\u0AB3')
|
||||
|| (c >= '\u0AB5' && c <= '\u0AB9') || (c == '\u0ABD')
|
||||
|| (c == '\u0AE0') || (c >= '\u0B05' && c <= '\u0B0C')
|
||||
|| (c >= '\u0B0F' && c <= '\u0B10')
|
||||
|| (c >= '\u0B13' && c <= '\u0B28')
|
||||
|| (c >= '\u0B2A' && c <= '\u0B30')
|
||||
|| (c >= '\u0B32' && c <= '\u0B33')
|
||||
|| (c >= '\u0B36' && c <= '\u0B39') || (c == '\u0B3D')
|
||||
|| (c >= '\u0B5C' && c <= '\u0B5D')
|
||||
|| (c >= '\u0B5F' && c <= '\u0B61')
|
||||
|| (c >= '\u0B85' && c <= '\u0B8A')
|
||||
|| (c >= '\u0B8E' && c <= '\u0B90')
|
||||
|| (c >= '\u0B92' && c <= '\u0B95')
|
||||
|| (c >= '\u0B99' && c <= '\u0B9A') || (c == '\u0B9C')
|
||||
|| (c >= '\u0B9E' && c <= '\u0B9F')
|
||||
|| (c >= '\u0BA3' && c <= '\u0BA4')
|
||||
|| (c >= '\u0BA8' && c <= '\u0BAA')
|
||||
|| (c >= '\u0BAE' && c <= '\u0BB5')
|
||||
|| (c >= '\u0BB7' && c <= '\u0BB9')
|
||||
|| (c >= '\u0C05' && c <= '\u0C0C')
|
||||
|| (c >= '\u0C0E' && c <= '\u0C10')
|
||||
|| (c >= '\u0C12' && c <= '\u0C28')
|
||||
|| (c >= '\u0C2A' && c <= '\u0C33')
|
||||
|| (c >= '\u0C35' && c <= '\u0C39')
|
||||
|| (c >= '\u0C60' && c <= '\u0C61')
|
||||
|| (c >= '\u0C85' && c <= '\u0C8C')
|
||||
|| (c >= '\u0C8E' && c <= '\u0C90')
|
||||
|| (c >= '\u0C92' && c <= '\u0CA8')
|
||||
|| (c >= '\u0CAA' && c <= '\u0CB3')
|
||||
|| (c >= '\u0CB5' && c <= '\u0CB9') || (c == '\u0CDE')
|
||||
|| (c >= '\u0CE0' && c <= '\u0CE1')
|
||||
|| (c >= '\u0D05' && c <= '\u0D0C')
|
||||
|| (c >= '\u0D0E' && c <= '\u0D10')
|
||||
|| (c >= '\u0D12' && c <= '\u0D28')
|
||||
|| (c >= '\u0D2A' && c <= '\u0D39')
|
||||
|| (c >= '\u0D60' && c <= '\u0D61')
|
||||
|| (c >= '\u0E01' && c <= '\u0E2E') || (c == '\u0E30')
|
||||
|| (c >= '\u0E32' && c <= '\u0E33')
|
||||
|| (c >= '\u0E40' && c <= '\u0E45')
|
||||
|| (c >= '\u0E81' && c <= '\u0E82') || (c == '\u0E84')
|
||||
|| (c >= '\u0E87' && c <= '\u0E88') || (c == '\u0E8A')
|
||||
|| (c == '\u0E8D') || (c >= '\u0E94' && c <= '\u0E97')
|
||||
|| (c >= '\u0E99' && c <= '\u0E9F')
|
||||
|| (c >= '\u0EA1' && c <= '\u0EA3') || (c == '\u0EA5')
|
||||
|| (c == '\u0EA7') || (c >= '\u0EAA' && c <= '\u0EAB')
|
||||
|| (c >= '\u0EAD' && c <= '\u0EAE') || (c == '\u0EB0')
|
||||
|| (c >= '\u0EB2' && c <= '\u0EB3') || (c == '\u0EBD')
|
||||
|| (c >= '\u0EC0' && c <= '\u0EC4')
|
||||
|| (c >= '\u0F40' && c <= '\u0F47')
|
||||
|| (c >= '\u0F49' && c <= '\u0F69')
|
||||
|| (c >= '\u10A0' && c <= '\u10C5')
|
||||
|| (c >= '\u10D0' && c <= '\u10F6') || (c == '\u1100')
|
||||
|| (c >= '\u1102' && c <= '\u1103')
|
||||
|| (c >= '\u1105' && c <= '\u1107') || (c == '\u1109')
|
||||
|| (c >= '\u110B' && c <= '\u110C')
|
||||
|| (c >= '\u110E' && c <= '\u1112') || (c == '\u113C')
|
||||
|| (c == '\u113E') || (c == '\u1140') || (c == '\u114C')
|
||||
|| (c == '\u114E') || (c == '\u1150')
|
||||
|| (c >= '\u1154' && c <= '\u1155') || (c == '\u1159')
|
||||
|| (c >= '\u115F' && c <= '\u1161') || (c == '\u1163')
|
||||
|| (c == '\u1165') || (c == '\u1167') || (c == '\u1169')
|
||||
|| (c >= '\u116D' && c <= '\u116E')
|
||||
|| (c >= '\u1172' && c <= '\u1173') || (c == '\u1175')
|
||||
|| (c == '\u119E') || (c == '\u11A8') || (c == '\u11AB')
|
||||
|| (c >= '\u11AE' && c <= '\u11AF')
|
||||
|| (c >= '\u11B7' && c <= '\u11B8') || (c == '\u11BA')
|
||||
|| (c >= '\u11BC' && c <= '\u11C2') || (c == '\u11EB')
|
||||
|| (c == '\u11F0') || (c == '\u11F9')
|
||||
|| (c >= '\u1E00' && c <= '\u1E9B')
|
||||
|| (c >= '\u1EA0' && c <= '\u1EF9')
|
||||
|| (c >= '\u1F00' && c <= '\u1F15')
|
||||
|| (c >= '\u1F18' && c <= '\u1F1D')
|
||||
|| (c >= '\u1F20' && c <= '\u1F45')
|
||||
|| (c >= '\u1F48' && c <= '\u1F4D')
|
||||
|| (c >= '\u1F50' && c <= '\u1F57') || (c == '\u1F59')
|
||||
|| (c == '\u1F5B') || (c == '\u1F5D')
|
||||
|| (c >= '\u1F5F' && c <= '\u1F7D')
|
||||
|| (c >= '\u1F80' && c <= '\u1FB4')
|
||||
|| (c >= '\u1FB6' && c <= '\u1FBC') || (c == '\u1FBE')
|
||||
|| (c >= '\u1FC2' && c <= '\u1FC4')
|
||||
|| (c >= '\u1FC6' && c <= '\u1FCC')
|
||||
|| (c >= '\u1FD0' && c <= '\u1FD3')
|
||||
|| (c >= '\u1FD6' && c <= '\u1FDB')
|
||||
|| (c >= '\u1FE0' && c <= '\u1FEC')
|
||||
|| (c >= '\u1FF2' && c <= '\u1FF4')
|
||||
|| (c >= '\u1FF6' && c <= '\u1FFC') || (c == '\u2126')
|
||||
|| (c >= '\u212A' && c <= '\u212B') || (c == '\u212E')
|
||||
|| (c >= '\u2180' && c <= '\u2182')
|
||||
|| (c >= '\u3041' && c <= '\u3094')
|
||||
|| (c >= '\u30A1' && c <= '\u30FA')
|
||||
|| (c >= '\u3105' && c <= '\u312C')
|
||||
|| (c >= '\uAC00' && c <= '\uD7A3')
|
||||
|| (c >= '\u4E00' && c <= '\u9FA5') || (c == '\u3007')
|
||||
|| (c >= '\u3021' && c <= '\u3029') || (c == '_') || (c == '.')
|
||||
|| (c == '-') || (c >= '\u0300' && c <= '\u0345')
|
||||
|| (c >= '\u0360' && c <= '\u0361')
|
||||
|| (c >= '\u0483' && c <= '\u0486')
|
||||
|| (c >= '\u0591' && c <= '\u05A1')
|
||||
|| (c >= '\u05A3' && c <= '\u05B9')
|
||||
|| (c >= '\u05BB' && c <= '\u05BD') || (c == '\u05BF')
|
||||
|| (c >= '\u05C1' && c <= '\u05C2') || (c == '\u05C4')
|
||||
|| (c >= '\u064B' && c <= '\u0652') || (c == '\u0670')
|
||||
|| (c >= '\u06D6' && c <= '\u06DC')
|
||||
|| (c >= '\u06DD' && c <= '\u06DF')
|
||||
|| (c >= '\u06E0' && c <= '\u06E4')
|
||||
|| (c >= '\u06E7' && c <= '\u06E8')
|
||||
|| (c >= '\u06EA' && c <= '\u06ED')
|
||||
|| (c >= '\u0901' && c <= '\u0903') || (c == '\u093C')
|
||||
|| (c >= '\u093E' && c <= '\u094C') || (c == '\u094D')
|
||||
|| (c >= '\u0951' && c <= '\u0954')
|
||||
|| (c >= '\u0962' && c <= '\u0963')
|
||||
|| (c >= '\u0981' && c <= '\u0983') || (c == '\u09BC')
|
||||
|| (c == '\u09BE') || (c == '\u09BF')
|
||||
|| (c >= '\u09C0' && c <= '\u09C4')
|
||||
|| (c >= '\u09C7' && c <= '\u09C8')
|
||||
|| (c >= '\u09CB' && c <= '\u09CD') || (c == '\u09D7')
|
||||
|| (c >= '\u09E2' && c <= '\u09E3') || (c == '\u0A02')
|
||||
|| (c == '\u0A3C') || (c == '\u0A3E') || (c == '\u0A3F')
|
||||
|| (c >= '\u0A40' && c <= '\u0A42')
|
||||
|| (c >= '\u0A47' && c <= '\u0A48')
|
||||
|| (c >= '\u0A4B' && c <= '\u0A4D')
|
||||
|| (c >= '\u0A70' && c <= '\u0A71')
|
||||
|| (c >= '\u0A81' && c <= '\u0A83') || (c == '\u0ABC')
|
||||
|| (c >= '\u0ABE' && c <= '\u0AC5')
|
||||
|| (c >= '\u0AC7' && c <= '\u0AC9')
|
||||
|| (c >= '\u0ACB' && c <= '\u0ACD')
|
||||
|| (c >= '\u0B01' && c <= '\u0B03') || (c == '\u0B3C')
|
||||
|| (c >= '\u0B3E' && c <= '\u0B43')
|
||||
|| (c >= '\u0B47' && c <= '\u0B48')
|
||||
|| (c >= '\u0B4B' && c <= '\u0B4D')
|
||||
|| (c >= '\u0B56' && c <= '\u0B57')
|
||||
|| (c >= '\u0B82' && c <= '\u0B83')
|
||||
|| (c >= '\u0BBE' && c <= '\u0BC2')
|
||||
|| (c >= '\u0BC6' && c <= '\u0BC8')
|
||||
|| (c >= '\u0BCA' && c <= '\u0BCD') || (c == '\u0BD7')
|
||||
|| (c >= '\u0C01' && c <= '\u0C03')
|
||||
|| (c >= '\u0C3E' && c <= '\u0C44')
|
||||
|| (c >= '\u0C46' && c <= '\u0C48')
|
||||
|| (c >= '\u0C4A' && c <= '\u0C4D')
|
||||
|| (c >= '\u0C55' && c <= '\u0C56')
|
||||
|| (c >= '\u0C82' && c <= '\u0C83')
|
||||
|| (c >= '\u0CBE' && c <= '\u0CC4')
|
||||
|| (c >= '\u0CC6' && c <= '\u0CC8')
|
||||
|| (c >= '\u0CCA' && c <= '\u0CCD')
|
||||
|| (c >= '\u0CD5' && c <= '\u0CD6')
|
||||
|| (c >= '\u0D02' && c <= '\u0D03')
|
||||
|| (c >= '\u0D3E' && c <= '\u0D43')
|
||||
|| (c >= '\u0D46' && c <= '\u0D48')
|
||||
|| (c >= '\u0D4A' && c <= '\u0D4D') || (c == '\u0D57')
|
||||
|| (c == '\u0E31') || (c >= '\u0E34' && c <= '\u0E3A')
|
||||
|| (c >= '\u0E47' && c <= '\u0E4E') || (c == '\u0EB1')
|
||||
|| (c >= '\u0EB4' && c <= '\u0EB9')
|
||||
|| (c >= '\u0EBB' && c <= '\u0EBC')
|
||||
|| (c >= '\u0EC8' && c <= '\u0ECD')
|
||||
|| (c >= '\u0F18' && c <= '\u0F19') || (c == '\u0F35')
|
||||
|| (c == '\u0F37') || (c == '\u0F39') || (c == '\u0F3E')
|
||||
|| (c == '\u0F3F') || (c >= '\u0F71' && c <= '\u0F84')
|
||||
|| (c >= '\u0F86' && c <= '\u0F8B')
|
||||
|| (c >= '\u0F90' && c <= '\u0F95') || (c == '\u0F97')
|
||||
|| (c >= '\u0F99' && c <= '\u0FAD')
|
||||
|| (c >= '\u0FB1' && c <= '\u0FB7') || (c == '\u0FB9')
|
||||
|| (c >= '\u20D0' && c <= '\u20DC') || (c == '\u20E1')
|
||||
|| (c >= '\u302A' && c <= '\u302F') || (c == '\u3099')
|
||||
|| (c == '\u309A') || (c == '\u00B7') || (c == '\u02D0')
|
||||
|| (c == '\u02D1') || (c == '\u0387') || (c == '\u0640')
|
||||
|| (c == '\u0E46') || (c == '\u0EC6') || (c == '\u3005')
|
||||
|| (c >= '\u3031' && c <= '\u3035')
|
||||
|| (c >= '\u309D' && c <= '\u309E') || (c >= '\u30FC' && c <= '\u30FE'));
|
||||
}
|
||||
|
||||
public static boolean isNCName(String str) {
|
||||
if (str == null) {
|
||||
return false;
|
||||
} else {
|
||||
int len = str.length();
|
||||
switch (len) {
|
||||
case 0:
|
||||
return false;
|
||||
case 1:
|
||||
return NCName.isNCNameStart(str.charAt(0));
|
||||
default:
|
||||
if (!NCName.isNCNameStart(str.charAt(0))) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 1; i < len; i++) {
|
||||
if (!NCName.isNCNameTrail(str.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void appendUHexTo(StringBuilder sb, int c) {
|
||||
sb.append('U');
|
||||
for (int i = 0; i < 6; i++) {
|
||||
sb.append(HEX_TABLE[(c & 0xF00000) >> 20]);
|
||||
c <<= 4;
|
||||
}
|
||||
}
|
||||
|
||||
public static String escapeName(String str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
if ((c & 0xFC00) == 0xD800) {
|
||||
char next = str.charAt(++i);
|
||||
appendUHexTo(sb, (c << 10) + next + SURROGATE_OFFSET);
|
||||
} else if (i == 0 && !isNCNameStart(c)) {
|
||||
appendUHexTo(sb, c);
|
||||
} else if (i != 0 && !isNCNameTrail(c)) {
|
||||
appendUHexTo(sb, c);
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString().intern();
|
||||
}
|
||||
// ]NOCPP]
|
||||
}
|
||||
@@ -0,0 +1,944 @@
|
||||
/*
|
||||
* 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 nu.validator.htmlparser.annotation.CharacterName;
|
||||
import nu.validator.htmlparser.annotation.NoLength;
|
||||
|
||||
/**
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public final class NamedCharacters {
|
||||
|
||||
static final @NoLength @CharacterName String[] NAMES = { "lig", "lig;",
|
||||
"P", "P;", "cute", "cute;", "reve;", "irc", "irc;", "y;", "r;",
|
||||
"rave", "rave;", "pha;", "acr;", "d;", "gon;", "pf;",
|
||||
"plyFunction;", "ing", "ing;", "cr;", "sign;", "ilde", "ilde;",
|
||||
"ml", "ml;", "ckslash;", "rv;", "rwed;", "y;", "cause;",
|
||||
"rnoullis;", "ta;", "r;", "pf;", "eve;", "cr;", "mpeq;", "cy;",
|
||||
"PY", "PY;", "cute;", "p;", "pitalDifferentialD;", "yleys;",
|
||||
"aron;", "edil", "edil;", "irc;", "onint;", "ot;", "dilla;",
|
||||
"nterDot;", "r;", "i;", "rcleDot;", "rcleMinus;", "rclePlus;",
|
||||
"rcleTimes;", "ockwiseContourIntegral;", "oseCurlyDoubleQuote;",
|
||||
"oseCurlyQuote;", "lon;", "lone;", "ngruent;", "nint;",
|
||||
"ntourIntegral;", "pf;", "product;",
|
||||
"unterClockwiseContourIntegral;", "oss;", "cr;", "p;", "pCap;",
|
||||
";", "otrahd;", "cy;", "cy;", "cy;", "gger;", "rr;", "shv;",
|
||||
"aron;", "y;", "l;", "lta;", "r;", "acriticalAcute;",
|
||||
"acriticalDot;", "acriticalDoubleAcute;", "acriticalGrave;",
|
||||
"acriticalTilde;", "amond;", "fferentialD;", "pf;", "t;", "tDot;",
|
||||
"tEqual;", "ubleContourIntegral;", "ubleDot;", "ubleDownArrow;",
|
||||
"ubleLeftArrow;", "ubleLeftRightArrow;", "ubleLeftTee;",
|
||||
"ubleLongLeftArrow;", "ubleLongLeftRightArrow;",
|
||||
"ubleLongRightArrow;", "ubleRightArrow;", "ubleRightTee;",
|
||||
"ubleUpArrow;", "ubleUpDownArrow;", "ubleVerticalBar;", "wnArrow;",
|
||||
"wnArrowBar;", "wnArrowUpArrow;", "wnBreve;", "wnLeftRightVector;",
|
||||
"wnLeftTeeVector;", "wnLeftVector;", "wnLeftVectorBar;",
|
||||
"wnRightTeeVector;", "wnRightVector;", "wnRightVectorBar;",
|
||||
"wnTee;", "wnTeeArrow;", "wnarrow;", "cr;", "trok;", "G;", "H",
|
||||
"H;", "cute", "cute;", "aron;", "irc", "irc;", "y;", "ot;", "r;",
|
||||
"rave", "rave;", "ement;", "acr;", "ptySmallSquare;",
|
||||
"ptyVerySmallSquare;", "gon;", "pf;", "silon;", "ual;",
|
||||
"ualTilde;", "uilibrium;", "cr;", "im;", "a;", "ml", "ml;",
|
||||
"ists;", "ponentialE;", "y;", "r;", "lledSmallSquare;",
|
||||
"lledVerySmallSquare;", "pf;", "rAll;", "uriertrf;", "cr;", "cy;",
|
||||
"", ";", "mma;", "mmad;", "reve;", "edil;", "irc;", "y;", "ot;",
|
||||
"r;", ";", "pf;", "eaterEqual;", "eaterEqualLess;",
|
||||
"eaterFullEqual;", "eaterGreater;", "eaterLess;",
|
||||
"eaterSlantEqual;", "eaterTilde;", "cr;", ";", "RDcy;", "cek;",
|
||||
"t;", "irc;", "r;", "lbertSpace;", "pf;", "rizontalLine;", "cr;",
|
||||
"trok;", "mpDownHump;", "mpEqual;", "cy;", "lig;", "cy;", "cute",
|
||||
"cute;", "irc", "irc;", "y;", "ot;", "r;", "rave", "rave;", ";",
|
||||
"acr;", "aginaryI;", "plies;", "t;", "tegral;", "tersection;",
|
||||
"visibleComma;", "visibleTimes;", "gon;", "pf;", "ta;", "cr;",
|
||||
"ilde;", "kcy;", "ml", "ml;", "irc;", "y;", "r;", "pf;", "cr;",
|
||||
"ercy;", "kcy;", "cy;", "cy;", "ppa;", "edil;", "y;", "r;", "pf;",
|
||||
"cr;", "cy;", "", ";", "cute;", "mbda;", "ng;", "placetrf;", "rr;",
|
||||
"aron;", "edil;", "y;", "ftAngleBracket;", "ftArrow;",
|
||||
"ftArrowBar;", "ftArrowRightArrow;", "ftCeiling;",
|
||||
"ftDoubleBracket;", "ftDownTeeVector;", "ftDownVector;",
|
||||
"ftDownVectorBar;", "ftFloor;", "ftRightArrow;", "ftRightVector;",
|
||||
"ftTee;", "ftTeeArrow;", "ftTeeVector;", "ftTriangle;",
|
||||
"ftTriangleBar;", "ftTriangleEqual;", "ftUpDownVector;",
|
||||
"ftUpTeeVector;", "ftUpVector;", "ftUpVectorBar;", "ftVector;",
|
||||
"ftVectorBar;", "ftarrow;", "ftrightarrow;", "ssEqualGreater;",
|
||||
"ssFullEqual;", "ssGreater;", "ssLess;", "ssSlantEqual;",
|
||||
"ssTilde;", "r;", ";", "eftarrow;", "idot;", "ngLeftArrow;",
|
||||
"ngLeftRightArrow;", "ngRightArrow;", "ngleftarrow;",
|
||||
"ngleftrightarrow;", "ngrightarrow;", "pf;", "werLeftArrow;",
|
||||
"werRightArrow;", "cr;", "h;", "trok;", ";", "p;", "y;",
|
||||
"diumSpace;", "llintrf;", "r;", "nusPlus;", "pf;", "cr;", ";",
|
||||
"cy;", "cute;", "aron;", "edil;", "y;", "gativeMediumSpace;",
|
||||
"gativeThickSpace;", "gativeThinSpace;", "gativeVeryThinSpace;",
|
||||
"stedGreaterGreater;", "stedLessLess;", "wLine;", "r;", "Break;",
|
||||
"nBreakingSpace;", "pf;", "t;", "tCongruent;", "tCupCap;",
|
||||
"tDoubleVerticalBar;", "tElement;", "tEqual;", "tEqualTilde;",
|
||||
"tExists;", "tGreater;", "tGreaterEqual;", "tGreaterFullEqual;",
|
||||
"tGreaterGreater;", "tGreaterLess;", "tGreaterSlantEqual;",
|
||||
"tGreaterTilde;", "tHumpDownHump;", "tHumpEqual;",
|
||||
"tLeftTriangle;", "tLeftTriangleBar;", "tLeftTriangleEqual;",
|
||||
"tLess;", "tLessEqual;", "tLessGreater;", "tLessLess;",
|
||||
"tLessSlantEqual;", "tLessTilde;", "tNestedGreaterGreater;",
|
||||
"tNestedLessLess;", "tPrecedes;", "tPrecedesEqual;",
|
||||
"tPrecedesSlantEqual;", "tReverseElement;", "tRightTriangle;",
|
||||
"tRightTriangleBar;", "tRightTriangleEqual;", "tSquareSubset;",
|
||||
"tSquareSubsetEqual;", "tSquareSuperset;", "tSquareSupersetEqual;",
|
||||
"tSubset;", "tSubsetEqual;", "tSucceeds;", "tSucceedsEqual;",
|
||||
"tSucceedsSlantEqual;", "tSucceedsTilde;", "tSuperset;",
|
||||
"tSupersetEqual;", "tTilde;", "tTildeEqual;", "tTildeFullEqual;",
|
||||
"tTildeTilde;", "tVerticalBar;", "cr;", "ilde", "ilde;", ";",
|
||||
"lig;", "cute", "cute;", "irc", "irc;", "y;", "blac;", "r;",
|
||||
"rave", "rave;", "acr;", "ega;", "icron;", "pf;",
|
||||
"enCurlyDoubleQuote;", "enCurlyQuote;", ";", "cr;", "lash",
|
||||
"lash;", "ilde", "ilde;", "imes;", "ml", "ml;", "erBar;",
|
||||
"erBrace;", "erBracket;", "erParenthesis;", "rtialD;", "y;", "r;",
|
||||
"i;", ";", "usMinus;", "incareplane;", "pf;", ";", "ecedes;",
|
||||
"ecedesEqual;", "ecedesSlantEqual;", "ecedesTilde;", "ime;",
|
||||
"oduct;", "oportion;", "oportional;", "cr;", "i;", "OT", "OT;",
|
||||
"r;", "pf;", "cr;", "arr;", "G", "G;", "cute;", "ng;", "rr;",
|
||||
"rrtl;", "aron;", "edil;", "y;", ";", "verseElement;",
|
||||
"verseEquilibrium;", "verseUpEquilibrium;", "r;", "o;",
|
||||
"ghtAngleBracket;", "ghtArrow;", "ghtArrowBar;",
|
||||
"ghtArrowLeftArrow;", "ghtCeiling;", "ghtDoubleBracket;",
|
||||
"ghtDownTeeVector;", "ghtDownVector;", "ghtDownVectorBar;",
|
||||
"ghtFloor;", "ghtTee;", "ghtTeeArrow;", "ghtTeeVector;",
|
||||
"ghtTriangle;", "ghtTriangleBar;", "ghtTriangleEqual;",
|
||||
"ghtUpDownVector;", "ghtUpTeeVector;", "ghtUpVector;",
|
||||
"ghtUpVectorBar;", "ghtVector;", "ghtVectorBar;", "ghtarrow;",
|
||||
"pf;", "undImplies;", "ightarrow;", "cr;", "h;", "leDelayed;",
|
||||
"CHcy;", "cy;", "FTcy;", "cute;", ";", "aron;", "edil;", "irc;",
|
||||
"y;", "r;", "ortDownArrow;", "ortLeftArrow;", "ortRightArrow;",
|
||||
"ortUpArrow;", "gma;", "allCircle;", "pf;", "rt;", "uare;",
|
||||
"uareIntersection;", "uareSubset;", "uareSubsetEqual;",
|
||||
"uareSuperset;", "uareSupersetEqual;", "uareUnion;", "cr;", "ar;",
|
||||
"b;", "bset;", "bsetEqual;", "cceeds;", "cceedsEqual;",
|
||||
"cceedsSlantEqual;", "cceedsTilde;", "chThat;", "m;", "p;",
|
||||
"perset;", "persetEqual;", "pset;", "ORN", "ORN;", "ADE;", "Hcy;",
|
||||
"cy;", "b;", "u;", "aron;", "edil;", "y;", "r;", "erefore;",
|
||||
"eta;", "ickSpace;", "inSpace;", "lde;", "ldeEqual;",
|
||||
"ldeFullEqual;", "ldeTilde;", "pf;", "ipleDot;", "cr;", "trok;",
|
||||
"cute", "cute;", "rr;", "rrocir;", "rcy;", "reve;", "irc", "irc;",
|
||||
"y;", "blac;", "r;", "rave", "rave;", "acr;", "derBar;",
|
||||
"derBrace;", "derBracket;", "derParenthesis;", "ion;", "ionPlus;",
|
||||
"gon;", "pf;", "Arrow;", "ArrowBar;", "ArrowDownArrow;",
|
||||
"DownArrow;", "Equilibrium;", "Tee;", "TeeArrow;", "arrow;",
|
||||
"downarrow;", "perLeftArrow;", "perRightArrow;", "si;", "silon;",
|
||||
"ing;", "cr;", "ilde;", "ml", "ml;", "ash;", "ar;", "y;", "ash;",
|
||||
"ashl;", "e;", "rbar;", "rt;", "rticalBar;", "rticalLine;",
|
||||
"rticalSeparator;", "rticalTilde;", "ryThinSpace;", "r;", "pf;",
|
||||
"cr;", "dash;", "irc;", "dge;", "r;", "pf;", "cr;", "r;", ";",
|
||||
"pf;", "cr;", "cy;", "cy;", "cy;", "cute", "cute;", "irc;", "y;",
|
||||
"r;", "pf;", "cr;", "ml;", "cy;", "cute;", "aron;", "y;", "ot;",
|
||||
"roWidthSpace;", "ta;", "r;", "pf;", "cr;", "cute", "cute;",
|
||||
"reve;", ";", "E;", "d;", "irc", "irc;", "ute", "ute;", "y;",
|
||||
"lig", "lig;", ";", "r;", "rave", "rave;", "efsym;", "eph;",
|
||||
"pha;", "acr;", "alg;", "p", "p;", "d;", "dand;", "dd;", "dslope;",
|
||||
"dv;", "g;", "ge;", "gle;", "gmsd;", "gmsdaa;", "gmsdab;",
|
||||
"gmsdac;", "gmsdad;", "gmsdae;", "gmsdaf;", "gmsdag;", "gmsdah;",
|
||||
"grt;", "grtvb;", "grtvbd;", "gsph;", "gst;", "gzarr;", "gon;",
|
||||
"pf;", ";", "E;", "acir;", "e;", "id;", "os;", "prox;", "proxeq;",
|
||||
"ing", "ing;", "cr;", "t;", "ymp;", "ympeq;", "ilde", "ilde;",
|
||||
"ml", "ml;", "conint;", "int;", "ot;", "ckcong;", "ckepsilon;",
|
||||
"ckprime;", "cksim;", "cksimeq;", "rvee;", "rwed;", "rwedge;",
|
||||
"rk;", "rktbrk;", "ong;", "y;", "quo;", "caus;", "cause;",
|
||||
"mptyv;", "psi;", "rnou;", "ta;", "th;", "tween;", "r;", "gcap;",
|
||||
"gcirc;", "gcup;", "godot;", "goplus;", "gotimes;", "gsqcup;",
|
||||
"gstar;", "gtriangledown;", "gtriangleup;", "guplus;", "gvee;",
|
||||
"gwedge;", "arow;", "acklozenge;", "acksquare;", "acktriangle;",
|
||||
"acktriangledown;", "acktriangleleft;", "acktriangleright;",
|
||||
"ank;", "k12;", "k14;", "k34;", "ock;", "e;", "equiv;", "ot;",
|
||||
"pf;", "t;", "ttom;", "wtie;", "xDL;", "xDR;", "xDl;", "xDr;",
|
||||
"xH;", "xHD;", "xHU;", "xHd;", "xHu;", "xUL;", "xUR;", "xUl;",
|
||||
"xUr;", "xV;", "xVH;", "xVL;", "xVR;", "xVh;", "xVl;", "xVr;",
|
||||
"xbox;", "xdL;", "xdR;", "xdl;", "xdr;", "xh;", "xhD;", "xhU;",
|
||||
"xhd;", "xhu;", "xminus;", "xplus;", "xtimes;", "xuL;", "xuR;",
|
||||
"xul;", "xur;", "xv;", "xvH;", "xvL;", "xvR;", "xvh;", "xvl;",
|
||||
"xvr;", "rime;", "eve;", "vbar", "vbar;", "cr;", "emi;", "im;",
|
||||
"ime;", "ol;", "olb;", "olhsub;", "ll;", "llet;", "mp;", "mpE;",
|
||||
"mpe;", "mpeq;", "cute;", "p;", "pand;", "pbrcup;", "pcap;",
|
||||
"pcup;", "pdot;", "ps;", "ret;", "ron;", "aps;", "aron;", "edil",
|
||||
"edil;", "irc;", "ups;", "upssm;", "ot;", "dil", "dil;", "mptyv;",
|
||||
"nt", "nt;", "nterdot;", "r;", "cy;", "eck;", "eckmark;", "i;",
|
||||
"r;", "rE;", "rc;", "rceq;", "rclearrowleft;", "rclearrowright;",
|
||||
"rcledR;", "rcledS;", "rcledast;", "rcledcirc;", "rcleddash;",
|
||||
"re;", "rfnint;", "rmid;", "rscir;", "ubs;", "ubsuit;", "lon;",
|
||||
"lone;", "loneq;", "mma;", "mmat;", "mp;", "mpfn;", "mplement;",
|
||||
"mplexes;", "ng;", "ngdot;", "nint;", "pf;", "prod;", "py", "py;",
|
||||
"pysr;", "arr;", "oss;", "cr;", "ub;", "ube;", "up;", "upe;",
|
||||
"dot;", "darrl;", "darrr;", "epr;", "esc;", "larr;", "larrp;",
|
||||
"p;", "pbrcap;", "pcap;", "pcup;", "pdot;", "por;", "ps;", "rarr;",
|
||||
"rarrm;", "rlyeqprec;", "rlyeqsucc;", "rlyvee;", "rlywedge;",
|
||||
"rren", "rren;", "rvearrowleft;", "rvearrowright;", "vee;", "wed;",
|
||||
"conint;", "int;", "lcty;", "rr;", "ar;", "gger;", "leth;", "rr;",
|
||||
"sh;", "shv;", "karow;", "lac;", "aron;", "y;", ";", "agger;",
|
||||
"arr;", "otseq;", "g", "g;", "lta;", "mptyv;", "isht;", "r;",
|
||||
"arl;", "arr;", "am;", "amond;", "amondsuit;", "ams;", "e;",
|
||||
"gamma;", "sin;", "v;", "vide", "vide;", "videontimes;", "vonx;",
|
||||
"cy;", "corn;", "crop;", "llar;", "pf;", "t;", "teq;", "teqdot;",
|
||||
"tminus;", "tplus;", "tsquare;", "ublebarwedge;", "wnarrow;",
|
||||
"wndownarrows;", "wnharpoonleft;", "wnharpoonright;", "bkarow;",
|
||||
"corn;", "crop;", "cr;", "cy;", "ol;", "trok;", "dot;", "ri;",
|
||||
"rif;", "arr;", "har;", "angle;", "cy;", "igrarr;", "Dot;", "ot;",
|
||||
"cute", "cute;", "ster;", "aron;", "ir;", "irc", "irc;", "olon;",
|
||||
"y;", "ot;", ";", "Dot;", "r;", ";", "rave", "rave;", "s;",
|
||||
"sdot;", ";", "inters;", "l;", "s;", "sdot;", "acr;", "pty;",
|
||||
"ptyset;", "ptyv;", "sp13;", "sp14;", "sp;", "g;", "sp;", "gon;",
|
||||
"pf;", "ar;", "arsl;", "lus;", "si;", "silon;", "siv;", "circ;",
|
||||
"colon;", "sim;", "slantgtr;", "slantless;", "uals;", "uest;",
|
||||
"uiv;", "uivDD;", "vparsl;", "Dot;", "arr;", "cr;", "dot;", "im;",
|
||||
"a;", "h", "h;", "ml", "ml;", "ro;", "cl;", "ist;", "pectation;",
|
||||
"ponentiale;", "llingdotseq;", "y;", "male;", "ilig;", "lig;",
|
||||
"llig;", "r;", "lig;", "lig;", "at;", "lig;", "tns;", "of;", "pf;",
|
||||
"rall;", "rk;", "rkv;", "artint;", "ac12", "ac12;", "ac13;",
|
||||
"ac14", "ac14;", "ac15;", "ac16;", "ac18;", "ac23;", "ac25;",
|
||||
"ac34", "ac34;", "ac35;", "ac38;", "ac45;", "ac56;", "ac58;",
|
||||
"ac78;", "asl;", "own;", "cr;", ";", "l;", "cute;", "mma;",
|
||||
"mmad;", "p;", "reve;", "irc;", "y;", "ot;", ";", "l;", "q;",
|
||||
"qq;", "qslant;", "s;", "scc;", "sdot;", "sdoto;", "sdotol;",
|
||||
"sl;", "sles;", "r;", ";", "g;", "mel;", "cy;", ";", "E;", "a;",
|
||||
"j;", "E;", "ap;", "approx;", "e;", "eq;", "eqq;", "sim;", "pf;",
|
||||
"ave;", "cr;", "im;", "ime;", "iml;", "", ";", "cc;", "cir;",
|
||||
"dot;", "lPar;", "quest;", "rapprox;", "rarr;", "rdot;",
|
||||
"reqless;", "reqqless;", "rless;", "rsim;", "ertneqq;", "nE;",
|
||||
"rr;", "irsp;", "lf;", "milt;", "rdcy;", "rr;", "rrcir;", "rrw;",
|
||||
"ar;", "irc;", "arts;", "artsuit;", "llip;", "rcon;", "r;",
|
||||
"searow;", "swarow;", "arr;", "mtht;", "okleftarrow;",
|
||||
"okrightarrow;", "pf;", "rbar;", "cr;", "lash;", "trok;", "bull;",
|
||||
"phen;", "cute", "cute;", ";", "irc", "irc;", "y;", "cy;", "xcl",
|
||||
"xcl;", "f;", "r;", "rave", "rave;", ";", "iint;", "int;", "nfin;",
|
||||
"ota;", "lig;", "acr;", "age;", "agline;", "agpart;", "ath;",
|
||||
"of;", "ped;", ";", "care;", "fin;", "fintie;", "odot;", "t;",
|
||||
"tcal;", "tegers;", "tercal;", "tlarhk;", "tprod;", "cy;", "gon;",
|
||||
"pf;", "ta;", "rod;", "uest", "uest;", "cr;", "in;", "inE;",
|
||||
"indot;", "ins;", "insv;", "inv;", ";", "ilde;", "kcy;", "ml",
|
||||
"ml;", "irc;", "y;", "r;", "ath;", "pf;", "cr;", "ercy;", "kcy;",
|
||||
"ppa;", "ppav;", "edil;", "y;", "r;", "reen;", "cy;", "cy;", "pf;",
|
||||
"cr;", "arr;", "rr;", "tail;", "arr;", ";", "g;", "ar;", "cute;",
|
||||
"emptyv;", "gran;", "mbda;", "ng;", "ngd;", "ngle;", "p;", "quo",
|
||||
"quo;", "rr;", "rrb;", "rrbfs;", "rrfs;", "rrhk;", "rrlp;",
|
||||
"rrpl;", "rrsim;", "rrtl;", "t;", "tail;", "te;", "tes;", "arr;",
|
||||
"brk;", "race;", "rack;", "rke;", "rksld;", "rkslu;", "aron;",
|
||||
"edil;", "eil;", "ub;", "y;", "ca;", "quo;", "quor;", "rdhar;",
|
||||
"rushar;", "sh;", ";", "ftarrow;", "ftarrowtail;",
|
||||
"ftharpoondown;", "ftharpoonup;", "ftleftarrows;", "ftrightarrow;",
|
||||
"ftrightarrows;", "ftrightharpoons;", "ftrightsquigarrow;",
|
||||
"ftthreetimes;", "g;", "q;", "qq;", "qslant;", "s;", "scc;",
|
||||
"sdot;", "sdoto;", "sdotor;", "sg;", "sges;", "ssapprox;",
|
||||
"ssdot;", "sseqgtr;", "sseqqgtr;", "ssgtr;", "sssim;", "isht;",
|
||||
"loor;", "r;", ";", "E;", "ard;", "aru;", "arul;", "blk;", "cy;",
|
||||
";", "arr;", "corner;", "hard;", "tri;", "idot;", "oust;",
|
||||
"oustache;", "E;", "ap;", "approx;", "e;", "eq;", "eqq;", "sim;",
|
||||
"ang;", "arr;", "brk;", "ngleftarrow;", "ngleftrightarrow;",
|
||||
"ngmapsto;", "ngrightarrow;", "oparrowleft;", "oparrowright;",
|
||||
"par;", "pf;", "plus;", "times;", "wast;", "wbar;", "z;", "zenge;",
|
||||
"zf;", "ar;", "arlt;", "arr;", "corner;", "har;", "hard;", "m;",
|
||||
"tri;", "aquo;", "cr;", "h;", "im;", "ime;", "img;", "qb;", "quo;",
|
||||
"quor;", "trok;", "", ";", "cc;", "cir;", "dot;", "hree;", "imes;",
|
||||
"larr;", "quest;", "rPar;", "ri;", "rie;", "rif;", "rdshar;",
|
||||
"ruhar;", "ertneqq;", "nE;", "Dot;", "cr", "cr;", "le;", "lt;",
|
||||
"ltese;", "p;", "psto;", "pstodown;", "pstoleft;", "pstoup;",
|
||||
"rker;", "omma;", "y;", "ash;", "asuredangle;", "r;", "o;", "cro",
|
||||
"cro;", "d;", "dast;", "dcir;", "ddot", "ddot;", "nus;", "nusb;",
|
||||
"nusd;", "nusdu;", "cp;", "dr;", "plus;", "dels;", "pf;", ";",
|
||||
"cr;", "tpos;", ";", "ltimap;", "map;", "g;", "t;", "tv;",
|
||||
"eftarrow;", "eftrightarrow;", "l;", "t;", "tv;", "ightarrow;",
|
||||
"Dash;", "dash;", "bla;", "cute;", "ng;", "p;", "pE;", "pid;",
|
||||
"pos;", "pprox;", "tur;", "tural;", "turals;", "sp", "sp;", "ump;",
|
||||
"umpe;", "ap;", "aron;", "edil;", "ong;", "ongdot;", "up;", "y;",
|
||||
"ash;", ";", "Arr;", "arhk;", "arr;", "arrow;", "dot;", "quiv;",
|
||||
"sear;", "sim;", "xist;", "xists;", "r;", "E;", "e;", "eq;",
|
||||
"eqq;", "eqslant;", "es;", "sim;", "t;", "tr;", "Arr;", "arr;",
|
||||
"par;", ";", "s;", "sd;", "v;", "cy;", "Arr;", "E;", "arr;", "dr;",
|
||||
"e;", "eftarrow;", "eftrightarrow;", "eq;", "eqq;", "eqslant;",
|
||||
"es;", "ess;", "sim;", "t;", "tri;", "trie;", "id;", "pf;", "t",
|
||||
"t;", "tin;", "tinE;", "tindot;", "tinva;", "tinvb;", "tinvc;",
|
||||
"tni;", "tniva;", "tnivb;", "tnivc;", "ar;", "arallel;", "arsl;",
|
||||
"art;", "olint;", "r;", "rcue;", "re;", "rec;", "receq;", "Arr;",
|
||||
"arr;", "arrc;", "arrw;", "ightarrow;", "tri;", "trie;", "c;",
|
||||
"ccue;", "ce;", "cr;", "hortmid;", "hortparallel;", "im;", "ime;",
|
||||
"imeq;", "mid;", "par;", "qsube;", "qsupe;", "ub;", "ubE;", "ube;",
|
||||
"ubset;", "ubseteq;", "ubseteqq;", "ucc;", "ucceq;", "up;", "upE;",
|
||||
"upe;", "upset;", "upseteq;", "upseteqq;", "gl;", "ilde", "ilde;",
|
||||
"lg;", "riangleleft;", "rianglelefteq;", "riangleright;",
|
||||
"rianglerighteq;", ";", "m;", "mero;", "msp;", "Dash;", "Harr;",
|
||||
"ap;", "dash;", "ge;", "gt;", "infin;", "lArr;", "le;", "lt;",
|
||||
"ltrie;", "rArr;", "rtrie;", "sim;", "Arr;", "arhk;", "arr;",
|
||||
"arrow;", "near;", ";", "cute", "cute;", "st;", "ir;", "irc",
|
||||
"irc;", "y;", "ash;", "blac;", "iv;", "ot;", "sold;", "lig;",
|
||||
"cir;", "r;", "on;", "rave", "rave;", "t;", "bar;", "m;", "nt;",
|
||||
"arr;", "cir;", "cross;", "ine;", "t;", "acr;", "ega;", "icron;",
|
||||
"id;", "inus;", "pf;", "ar;", "erp;", "lus;", ";", "arr;", "d;",
|
||||
"der;", "derof;", "df", "df;", "dm", "dm;", "igof;", "or;",
|
||||
"slope;", "v;", "cr;", "lash", "lash;", "ol;", "ilde", "ilde;",
|
||||
"imes;", "imesas;", "ml", "ml;", "bar;", "r;", "ra", "ra;",
|
||||
"rallel;", "rsim;", "rsl;", "rt;", "y;", "rcnt;", "riod;", "rmil;",
|
||||
"rp;", "rtenk;", "r;", "i;", "iv;", "mmat;", "one;", ";",
|
||||
"tchfork;", "v;", "anck;", "anckh;", "ankv;", "us;", "usacir;",
|
||||
"usb;", "uscir;", "usdo;", "usdu;", "use;", "usmn", "usmn;",
|
||||
"ussim;", "ustwo;", ";", "intint;", "pf;", "und", "und;", ";",
|
||||
"E;", "ap;", "cue;", "e;", "ec;", "ecapprox;", "eccurlyeq;",
|
||||
"eceq;", "ecnapprox;", "ecneqq;", "ecnsim;", "ecsim;", "ime;",
|
||||
"imes;", "nE;", "nap;", "nsim;", "od;", "ofalar;", "ofline;",
|
||||
"ofsurf;", "op;", "opto;", "sim;", "urel;", "cr;", "i;", "ncsp;",
|
||||
"r;", "nt;", "pf;", "rime;", "cr;", "aternions;", "atint;", "est;",
|
||||
"esteq;", "ot", "ot;", "arr;", "rr;", "tail;", "arr;", "ar;",
|
||||
"ce;", "cute;", "dic;", "emptyv;", "ng;", "ngd;", "nge;", "ngle;",
|
||||
"quo", "quo;", "rr;", "rrap;", "rrb;", "rrbfs;", "rrc;", "rrfs;",
|
||||
"rrhk;", "rrlp;", "rrpl;", "rrsim;", "rrtl;", "rrw;", "tail;",
|
||||
"tio;", "tionals;", "arr;", "brk;", "race;", "rack;", "rke;",
|
||||
"rksld;", "rkslu;", "aron;", "edil;", "eil;", "ub;", "y;", "ca;",
|
||||
"ldhar;", "quo;", "quor;", "sh;", "al;", "aline;", "alpart;",
|
||||
"als;", "ct;", "g", "g;", "isht;", "loor;", "r;", "ard;", "aru;",
|
||||
"arul;", "o;", "ov;", "ghtarrow;", "ghtarrowtail;",
|
||||
"ghtharpoondown;", "ghtharpoonup;", "ghtleftarrows;",
|
||||
"ghtleftharpoons;", "ghtrightarrows;", "ghtsquigarrow;",
|
||||
"ghtthreetimes;", "ng;", "singdotseq;", "arr;", "har;", "m;",
|
||||
"oust;", "oustache;", "mid;", "ang;", "arr;", "brk;", "par;",
|
||||
"pf;", "plus;", "times;", "ar;", "argt;", "polint;", "arr;",
|
||||
"aquo;", "cr;", "h;", "qb;", "quo;", "quor;", "hree;", "imes;",
|
||||
"ri;", "rie;", "rif;", "riltri;", "luhar;", ";", "cute;", "quo;",
|
||||
";", "E;", "ap;", "aron;", "cue;", "e;", "edil;", "irc;", "nE;",
|
||||
"nap;", "nsim;", "polint;", "sim;", "y;", "ot;", "otb;", "ote;",
|
||||
"Arr;", "arhk;", "arr;", "arrow;", "ct", "ct;", "mi;", "swar;",
|
||||
"tminus;", "tmn;", "xt;", "r;", "rown;", "arp;", "chcy;", "cy;",
|
||||
"ortmid;", "ortparallel;", "y", "y;", "gma;", "gmaf;", "gmav;",
|
||||
"m;", "mdot;", "me;", "meq;", "mg;", "mgE;", "ml;", "mlE;", "mne;",
|
||||
"mplus;", "mrarr;", "arr;", "allsetminus;", "ashp;", "eparsl;",
|
||||
"id;", "ile;", "t;", "te;", "tes;", "ftcy;", "l;", "lb;", "lbar;",
|
||||
"pf;", "ades;", "adesuit;", "ar;", "cap;", "caps;", "cup;",
|
||||
"cups;", "sub;", "sube;", "subset;", "subseteq;", "sup;", "supe;",
|
||||
"supset;", "supseteq;", "u;", "uare;", "uarf;", "uf;", "arr;",
|
||||
"cr;", "etmn;", "mile;", "tarf;", "ar;", "arf;", "raightepsilon;",
|
||||
"raightphi;", "rns;", "b;", "bE;", "bdot;", "be;", "bedot;",
|
||||
"bmult;", "bnE;", "bne;", "bplus;", "brarr;", "bset;", "bseteq;",
|
||||
"bseteqq;", "bsetneq;", "bsetneqq;", "bsim;", "bsub;", "bsup;",
|
||||
"cc;", "ccapprox;", "cccurlyeq;", "cceq;", "ccnapprox;", "ccneqq;",
|
||||
"ccnsim;", "ccsim;", "m;", "ng;", "p1", "p1;", "p2", "p2;", "p3",
|
||||
"p3;", "p;", "pE;", "pdot;", "pdsub;", "pe;", "pedot;", "phsol;",
|
||||
"phsub;", "plarr;", "pmult;", "pnE;", "pne;", "pplus;", "pset;",
|
||||
"pseteq;", "pseteqq;", "psetneq;", "psetneqq;", "psim;", "psub;",
|
||||
"psup;", "Arr;", "arhk;", "arr;", "arrow;", "nwar;", "lig", "lig;",
|
||||
"rget;", "u;", "rk;", "aron;", "edil;", "y;", "ot;", "lrec;", "r;",
|
||||
"ere4;", "erefore;", "eta;", "etasym;", "etav;", "ickapprox;",
|
||||
"icksim;", "insp;", "kap;", "ksim;", "orn", "orn;", "lde;", "mes",
|
||||
"mes;", "mesb;", "mesbar;", "mesd;", "nt;", "ea;", "p;", "pbot;",
|
||||
"pcir;", "pf;", "pfork;", "sa;", "rime;", "ade;", "iangle;",
|
||||
"iangledown;", "iangleleft;", "ianglelefteq;", "iangleq;",
|
||||
"iangleright;", "ianglerighteq;", "idot;", "ie;", "iminus;",
|
||||
"iplus;", "isb;", "itime;", "pezium;", "cr;", "cy;", "hcy;",
|
||||
"trok;", "ixt;", "oheadleftarrow;", "oheadrightarrow;", "rr;",
|
||||
"ar;", "cute", "cute;", "rr;", "rcy;", "reve;", "irc", "irc;",
|
||||
"y;", "arr;", "blac;", "har;", "isht;", "r;", "rave", "rave;",
|
||||
"arl;", "arr;", "blk;", "corn;", "corner;", "crop;", "tri;",
|
||||
"acr;", "l", "l;", "gon;", "pf;", "arrow;", "downarrow;",
|
||||
"harpoonleft;", "harpoonright;", "lus;", "si;", "sih;", "silon;",
|
||||
"uparrows;", "corn;", "corner;", "crop;", "ing;", "tri;", "cr;",
|
||||
"dot;", "ilde;", "ri;", "rif;", "arr;", "ml", "ml;", "angle;",
|
||||
"rr;", "ar;", "arv;", "ash;", "ngrt;", "repsilon;", "rkappa;",
|
||||
"rnothing;", "rphi;", "rpi;", "rpropto;", "rr;", "rrho;",
|
||||
"rsigma;", "rsubsetneq;", "rsubsetneqq;", "rsupsetneq;",
|
||||
"rsupsetneqq;", "rtheta;", "rtriangleleft;", "rtriangleright;",
|
||||
"y;", "ash;", "e;", "ebar;", "eeq;", "llip;", "rbar;", "rt;", "r;",
|
||||
"tri;", "sub;", "sup;", "pf;", "rop;", "tri;", "cr;", "ubnE;",
|
||||
"ubne;", "upnE;", "upne;", "igzag;", "irc;", "dbar;", "dge;",
|
||||
"dgeq;", "ierp;", "r;", "pf;", ";", ";", "eath;", "cr;", "ap;",
|
||||
"irc;", "up;", "tri;", "r;", "Arr;", "arr;", ";", "Arr;", "arr;",
|
||||
"ap;", "is;", "dot;", "pf;", "plus;", "time;", "Arr;", "arr;",
|
||||
"cr;", "qcup;", "plus;", "tri;", "ee;", "edge;", "cute", "cute;",
|
||||
"cy;", "irc;", "y;", "n", "n;", "r;", "cy;", "pf;", "cr;", "cy;",
|
||||
"ml", "ml;", "cute;", "aron;", "y;", "ot;", "etrf;", "ta;", "r;",
|
||||
"cy;", "grarr;", "pf;", "cr;", "j;", "nj;", };
|
||||
|
||||
static final @NoLength char[][] VALUES = { { '\u00c6' }, { '\u00c6' },
|
||||
{ '\u0026' }, { '\u0026' }, { '\u00c1' }, { '\u00c1' },
|
||||
{ '\u0102' }, { '\u00c2' }, { '\u00c2' }, { '\u0410' },
|
||||
{ '\ud835', '\udd04' }, { '\u00c0' }, { '\u00c0' }, { '\u0391' },
|
||||
{ '\u0100' }, { '\u2a53' }, { '\u0104' }, { '\ud835', '\udd38' },
|
||||
{ '\u2061' }, { '\u00c5' }, { '\u00c5' }, { '\ud835', '\udc9c' },
|
||||
{ '\u2254' }, { '\u00c3' }, { '\u00c3' }, { '\u00c4' },
|
||||
{ '\u00c4' }, { '\u2216' }, { '\u2ae7' }, { '\u2306' },
|
||||
{ '\u0411' }, { '\u2235' }, { '\u212c' }, { '\u0392' },
|
||||
{ '\ud835', '\udd05' }, { '\ud835', '\udd39' }, { '\u02d8' },
|
||||
{ '\u212c' }, { '\u224e' }, { '\u0427' }, { '\u00a9' },
|
||||
{ '\u00a9' }, { '\u0106' }, { '\u22d2' }, { '\u2145' },
|
||||
{ '\u212d' }, { '\u010c' }, { '\u00c7' }, { '\u00c7' },
|
||||
{ '\u0108' }, { '\u2230' }, { '\u010a' }, { '\u00b8' },
|
||||
{ '\u00b7' }, { '\u212d' }, { '\u03a7' }, { '\u2299' },
|
||||
{ '\u2296' }, { '\u2295' }, { '\u2297' }, { '\u2232' },
|
||||
{ '\u201d' }, { '\u2019' }, { '\u2237' }, { '\u2a74' },
|
||||
{ '\u2261' }, { '\u222f' }, { '\u222e' }, { '\u2102' },
|
||||
{ '\u2210' }, { '\u2233' }, { '\u2a2f' }, { '\ud835', '\udc9e' },
|
||||
{ '\u22d3' }, { '\u224d' }, { '\u2145' }, { '\u2911' },
|
||||
{ '\u0402' }, { '\u0405' }, { '\u040f' }, { '\u2021' },
|
||||
{ '\u21a1' }, { '\u2ae4' }, { '\u010e' }, { '\u0414' },
|
||||
{ '\u2207' }, { '\u0394' }, { '\ud835', '\udd07' }, { '\u00b4' },
|
||||
{ '\u02d9' }, { '\u02dd' }, { '\u0060' }, { '\u02dc' },
|
||||
{ '\u22c4' }, { '\u2146' }, { '\ud835', '\udd3b' }, { '\u00a8' },
|
||||
{ '\u20dc' }, { '\u2250' }, { '\u222f' }, { '\u00a8' },
|
||||
{ '\u21d3' }, { '\u21d0' }, { '\u21d4' }, { '\u2ae4' },
|
||||
{ '\u27f8' }, { '\u27fa' }, { '\u27f9' }, { '\u21d2' },
|
||||
{ '\u22a8' }, { '\u21d1' }, { '\u21d5' }, { '\u2225' },
|
||||
{ '\u2193' }, { '\u2913' }, { '\u21f5' }, { '\u0311' },
|
||||
{ '\u2950' }, { '\u295e' }, { '\u21bd' }, { '\u2956' },
|
||||
{ '\u295f' }, { '\u21c1' }, { '\u2957' }, { '\u22a4' },
|
||||
{ '\u21a7' }, { '\u21d3' }, { '\ud835', '\udc9f' }, { '\u0110' },
|
||||
{ '\u014a' }, { '\u00d0' }, { '\u00d0' }, { '\u00c9' },
|
||||
{ '\u00c9' }, { '\u011a' }, { '\u00ca' }, { '\u00ca' },
|
||||
{ '\u042d' }, { '\u0116' }, { '\ud835', '\udd08' }, { '\u00c8' },
|
||||
{ '\u00c8' }, { '\u2208' }, { '\u0112' }, { '\u25fb' },
|
||||
{ '\u25ab' }, { '\u0118' }, { '\ud835', '\udd3c' }, { '\u0395' },
|
||||
{ '\u2a75' }, { '\u2242' }, { '\u21cc' }, { '\u2130' },
|
||||
{ '\u2a73' }, { '\u0397' }, { '\u00cb' }, { '\u00cb' },
|
||||
{ '\u2203' }, { '\u2147' }, { '\u0424' }, { '\ud835', '\udd09' },
|
||||
{ '\u25fc' }, { '\u25aa' }, { '\ud835', '\udd3d' }, { '\u2200' },
|
||||
{ '\u2131' }, { '\u2131' }, { '\u0403' }, { '\u003e' },
|
||||
{ '\u003e' }, { '\u0393' }, { '\u03dc' }, { '\u011e' },
|
||||
{ '\u0122' }, { '\u011c' }, { '\u0413' }, { '\u0120' },
|
||||
{ '\ud835', '\udd0a' }, { '\u22d9' }, { '\ud835', '\udd3e' },
|
||||
{ '\u2265' }, { '\u22db' }, { '\u2267' }, { '\u2aa2' },
|
||||
{ '\u2277' }, { '\u2a7e' }, { '\u2273' }, { '\ud835', '\udca2' },
|
||||
{ '\u226b' }, { '\u042a' }, { '\u02c7' }, { '\u005e' },
|
||||
{ '\u0124' }, { '\u210c' }, { '\u210b' }, { '\u210d' },
|
||||
{ '\u2500' }, { '\u210b' }, { '\u0126' }, { '\u224e' },
|
||||
{ '\u224f' }, { '\u0415' }, { '\u0132' }, { '\u0401' },
|
||||
{ '\u00cd' }, { '\u00cd' }, { '\u00ce' }, { '\u00ce' },
|
||||
{ '\u0418' }, { '\u0130' }, { '\u2111' }, { '\u00cc' },
|
||||
{ '\u00cc' }, { '\u2111' }, { '\u012a' }, { '\u2148' },
|
||||
{ '\u21d2' }, { '\u222c' }, { '\u222b' }, { '\u22c2' },
|
||||
{ '\u2063' }, { '\u2062' }, { '\u012e' }, { '\ud835', '\udd40' },
|
||||
{ '\u0399' }, { '\u2110' }, { '\u0128' }, { '\u0406' },
|
||||
{ '\u00cf' }, { '\u00cf' }, { '\u0134' }, { '\u0419' },
|
||||
{ '\ud835', '\udd0d' }, { '\ud835', '\udd41' },
|
||||
{ '\ud835', '\udca5' }, { '\u0408' }, { '\u0404' }, { '\u0425' },
|
||||
{ '\u040c' }, { '\u039a' }, { '\u0136' }, { '\u041a' },
|
||||
{ '\ud835', '\udd0e' }, { '\ud835', '\udd42' },
|
||||
{ '\ud835', '\udca6' }, { '\u0409' }, { '\u003c' }, { '\u003c' },
|
||||
{ '\u0139' }, { '\u039b' }, { '\u27ea' }, { '\u2112' },
|
||||
{ '\u219e' }, { '\u013d' }, { '\u013b' }, { '\u041b' },
|
||||
{ '\u27e8' }, { '\u2190' }, { '\u21e4' }, { '\u21c6' },
|
||||
{ '\u2308' }, { '\u27e6' }, { '\u2961' }, { '\u21c3' },
|
||||
{ '\u2959' }, { '\u230a' }, { '\u2194' }, { '\u294e' },
|
||||
{ '\u22a3' }, { '\u21a4' }, { '\u295a' }, { '\u22b2' },
|
||||
{ '\u29cf' }, { '\u22b4' }, { '\u2951' }, { '\u2960' },
|
||||
{ '\u21bf' }, { '\u2958' }, { '\u21bc' }, { '\u2952' },
|
||||
{ '\u21d0' }, { '\u21d4' }, { '\u22da' }, { '\u2266' },
|
||||
{ '\u2276' }, { '\u2aa1' }, { '\u2a7d' }, { '\u2272' },
|
||||
{ '\ud835', '\udd0f' }, { '\u22d8' }, { '\u21da' }, { '\u013f' },
|
||||
{ '\u27f5' }, { '\u27f7' }, { '\u27f6' }, { '\u27f8' },
|
||||
{ '\u27fa' }, { '\u27f9' }, { '\ud835', '\udd43' }, { '\u2199' },
|
||||
{ '\u2198' }, { '\u2112' }, { '\u21b0' }, { '\u0141' },
|
||||
{ '\u226a' }, { '\u2905' }, { '\u041c' }, { '\u205f' },
|
||||
{ '\u2133' }, { '\ud835', '\udd10' }, { '\u2213' },
|
||||
{ '\ud835', '\udd44' }, { '\u2133' }, { '\u039c' }, { '\u040a' },
|
||||
{ '\u0143' }, { '\u0147' }, { '\u0145' }, { '\u041d' },
|
||||
{ '\u200b' }, { '\u200b' }, { '\u200b' }, { '\u200b' },
|
||||
{ '\u226b' }, { '\u226a' }, { '\n' }, { '\ud835', '\udd11' },
|
||||
{ '\u2060' }, { '\u00a0' }, { '\u2115' }, { '\u2aec' },
|
||||
{ '\u2262' }, { '\u226d' }, { '\u2226' }, { '\u2209' },
|
||||
{ '\u2260' }, { '\u2242', '\u0338' }, { '\u2204' }, { '\u226f' },
|
||||
{ '\u2271' }, { '\u2267', '\u0338' }, { '\u226b', '\u0338' },
|
||||
{ '\u2279' }, { '\u2a7e', '\u0338' }, { '\u2275' },
|
||||
{ '\u224e', '\u0338' }, { '\u224f', '\u0338' }, { '\u22ea' },
|
||||
{ '\u29cf', '\u0338' }, { '\u22ec' }, { '\u226e' }, { '\u2270' },
|
||||
{ '\u2278' }, { '\u226a', '\u0338' }, { '\u2a7d', '\u0338' },
|
||||
{ '\u2274' }, { '\u2aa2', '\u0338' }, { '\u2aa1', '\u0338' },
|
||||
{ '\u2280' }, { '\u2aaf', '\u0338' }, { '\u22e0' }, { '\u220c' },
|
||||
{ '\u22eb' }, { '\u29d0', '\u0338' }, { '\u22ed' },
|
||||
{ '\u228f', '\u0338' }, { '\u22e2' }, { '\u2290', '\u0338' },
|
||||
{ '\u22e3' }, { '\u2282', '\u20d2' }, { '\u2288' }, { '\u2281' },
|
||||
{ '\u2ab0', '\u0338' }, { '\u22e1' }, { '\u227f', '\u0338' },
|
||||
{ '\u2283', '\u20d2' }, { '\u2289' }, { '\u2241' }, { '\u2244' },
|
||||
{ '\u2247' }, { '\u2249' }, { '\u2224' }, { '\ud835', '\udca9' },
|
||||
{ '\u00d1' }, { '\u00d1' }, { '\u039d' }, { '\u0152' },
|
||||
{ '\u00d3' }, { '\u00d3' }, { '\u00d4' }, { '\u00d4' },
|
||||
{ '\u041e' }, { '\u0150' }, { '\ud835', '\udd12' }, { '\u00d2' },
|
||||
{ '\u00d2' }, { '\u014c' }, { '\u03a9' }, { '\u039f' },
|
||||
{ '\ud835', '\udd46' }, { '\u201c' }, { '\u2018' }, { '\u2a54' },
|
||||
{ '\ud835', '\udcaa' }, { '\u00d8' }, { '\u00d8' }, { '\u00d5' },
|
||||
{ '\u00d5' }, { '\u2a37' }, { '\u00d6' }, { '\u00d6' },
|
||||
{ '\u203e' }, { '\u23de' }, { '\u23b4' }, { '\u23dc' },
|
||||
{ '\u2202' }, { '\u041f' }, { '\ud835', '\udd13' }, { '\u03a6' },
|
||||
{ '\u03a0' }, { '\u00b1' }, { '\u210c' }, { '\u2119' },
|
||||
{ '\u2abb' }, { '\u227a' }, { '\u2aaf' }, { '\u227c' },
|
||||
{ '\u227e' }, { '\u2033' }, { '\u220f' }, { '\u2237' },
|
||||
{ '\u221d' }, { '\ud835', '\udcab' }, { '\u03a8' }, { '\u0022' },
|
||||
{ '\u0022' }, { '\ud835', '\udd14' }, { '\u211a' },
|
||||
{ '\ud835', '\udcac' }, { '\u2910' }, { '\u00ae' }, { '\u00ae' },
|
||||
{ '\u0154' }, { '\u27eb' }, { '\u21a0' }, { '\u2916' },
|
||||
{ '\u0158' }, { '\u0156' }, { '\u0420' }, { '\u211c' },
|
||||
{ '\u220b' }, { '\u21cb' }, { '\u296f' }, { '\u211c' },
|
||||
{ '\u03a1' }, { '\u27e9' }, { '\u2192' }, { '\u21e5' },
|
||||
{ '\u21c4' }, { '\u2309' }, { '\u27e7' }, { '\u295d' },
|
||||
{ '\u21c2' }, { '\u2955' }, { '\u230b' }, { '\u22a2' },
|
||||
{ '\u21a6' }, { '\u295b' }, { '\u22b3' }, { '\u29d0' },
|
||||
{ '\u22b5' }, { '\u294f' }, { '\u295c' }, { '\u21be' },
|
||||
{ '\u2954' }, { '\u21c0' }, { '\u2953' }, { '\u21d2' },
|
||||
{ '\u211d' }, { '\u2970' }, { '\u21db' }, { '\u211b' },
|
||||
{ '\u21b1' }, { '\u29f4' }, { '\u0429' }, { '\u0428' },
|
||||
{ '\u042c' }, { '\u015a' }, { '\u2abc' }, { '\u0160' },
|
||||
{ '\u015e' }, { '\u015c' }, { '\u0421' }, { '\ud835', '\udd16' },
|
||||
{ '\u2193' }, { '\u2190' }, { '\u2192' }, { '\u2191' },
|
||||
{ '\u03a3' }, { '\u2218' }, { '\ud835', '\udd4a' }, { '\u221a' },
|
||||
{ '\u25a1' }, { '\u2293' }, { '\u228f' }, { '\u2291' },
|
||||
{ '\u2290' }, { '\u2292' }, { '\u2294' }, { '\ud835', '\udcae' },
|
||||
{ '\u22c6' }, { '\u22d0' }, { '\u22d0' }, { '\u2286' },
|
||||
{ '\u227b' }, { '\u2ab0' }, { '\u227d' }, { '\u227f' },
|
||||
{ '\u220b' }, { '\u2211' }, { '\u22d1' }, { '\u2283' },
|
||||
{ '\u2287' }, { '\u22d1' }, { '\u00de' }, { '\u00de' },
|
||||
{ '\u2122' }, { '\u040b' }, { '\u0426' }, { '\u0009' },
|
||||
{ '\u03a4' }, { '\u0164' }, { '\u0162' }, { '\u0422' },
|
||||
{ '\ud835', '\udd17' }, { '\u2234' }, { '\u0398' },
|
||||
{ '\u205f', '\u200a' }, { '\u2009' }, { '\u223c' }, { '\u2243' },
|
||||
{ '\u2245' }, { '\u2248' }, { '\ud835', '\udd4b' }, { '\u20db' },
|
||||
{ '\ud835', '\udcaf' }, { '\u0166' }, { '\u00da' }, { '\u00da' },
|
||||
{ '\u219f' }, { '\u2949' }, { '\u040e' }, { '\u016c' },
|
||||
{ '\u00db' }, { '\u00db' }, { '\u0423' }, { '\u0170' },
|
||||
{ '\ud835', '\udd18' }, { '\u00d9' }, { '\u00d9' }, { '\u016a' },
|
||||
{ '\u005f' }, { '\u23df' }, { '\u23b5' }, { '\u23dd' },
|
||||
{ '\u22c3' }, { '\u228e' }, { '\u0172' }, { '\ud835', '\udd4c' },
|
||||
{ '\u2191' }, { '\u2912' }, { '\u21c5' }, { '\u2195' },
|
||||
{ '\u296e' }, { '\u22a5' }, { '\u21a5' }, { '\u21d1' },
|
||||
{ '\u21d5' }, { '\u2196' }, { '\u2197' }, { '\u03d2' },
|
||||
{ '\u03a5' }, { '\u016e' }, { '\ud835', '\udcb0' }, { '\u0168' },
|
||||
{ '\u00dc' }, { '\u00dc' }, { '\u22ab' }, { '\u2aeb' },
|
||||
{ '\u0412' }, { '\u22a9' }, { '\u2ae6' }, { '\u22c1' },
|
||||
{ '\u2016' }, { '\u2016' }, { '\u2223' }, { '\u007c' },
|
||||
{ '\u2758' }, { '\u2240' }, { '\u200a' }, { '\ud835', '\udd19' },
|
||||
{ '\ud835', '\udd4d' }, { '\ud835', '\udcb1' }, { '\u22aa' },
|
||||
{ '\u0174' }, { '\u22c0' }, { '\ud835', '\udd1a' },
|
||||
{ '\ud835', '\udd4e' }, { '\ud835', '\udcb2' },
|
||||
{ '\ud835', '\udd1b' }, { '\u039e' }, { '\ud835', '\udd4f' },
|
||||
{ '\ud835', '\udcb3' }, { '\u042f' }, { '\u0407' }, { '\u042e' },
|
||||
{ '\u00dd' }, { '\u00dd' }, { '\u0176' }, { '\u042b' },
|
||||
{ '\ud835', '\udd1c' }, { '\ud835', '\udd50' },
|
||||
{ '\ud835', '\udcb4' }, { '\u0178' }, { '\u0416' }, { '\u0179' },
|
||||
{ '\u017d' }, { '\u0417' }, { '\u017b' }, { '\u200b' },
|
||||
{ '\u0396' }, { '\u2128' }, { '\u2124' }, { '\ud835', '\udcb5' },
|
||||
{ '\u00e1' }, { '\u00e1' }, { '\u0103' }, { '\u223e' },
|
||||
{ '\u223e', '\u0333' }, { '\u223f' }, { '\u00e2' }, { '\u00e2' },
|
||||
{ '\u00b4' }, { '\u00b4' }, { '\u0430' }, { '\u00e6' },
|
||||
{ '\u00e6' }, { '\u2061' }, { '\ud835', '\udd1e' }, { '\u00e0' },
|
||||
{ '\u00e0' }, { '\u2135' }, { '\u2135' }, { '\u03b1' },
|
||||
{ '\u0101' }, { '\u2a3f' }, { '\u0026' }, { '\u0026' },
|
||||
{ '\u2227' }, { '\u2a55' }, { '\u2a5c' }, { '\u2a58' },
|
||||
{ '\u2a5a' }, { '\u2220' }, { '\u29a4' }, { '\u2220' },
|
||||
{ '\u2221' }, { '\u29a8' }, { '\u29a9' }, { '\u29aa' },
|
||||
{ '\u29ab' }, { '\u29ac' }, { '\u29ad' }, { '\u29ae' },
|
||||
{ '\u29af' }, { '\u221f' }, { '\u22be' }, { '\u299d' },
|
||||
{ '\u2222' }, { '\u00c5' }, { '\u237c' }, { '\u0105' },
|
||||
{ '\ud835', '\udd52' }, { '\u2248' }, { '\u2a70' }, { '\u2a6f' },
|
||||
{ '\u224a' }, { '\u224b' }, { '\'' }, { '\u2248' }, { '\u224a' },
|
||||
{ '\u00e5' }, { '\u00e5' }, { '\ud835', '\udcb6' }, { '\u002a' },
|
||||
{ '\u2248' }, { '\u224d' }, { '\u00e3' }, { '\u00e3' },
|
||||
{ '\u00e4' }, { '\u00e4' }, { '\u2233' }, { '\u2a11' },
|
||||
{ '\u2aed' }, { '\u224c' }, { '\u03f6' }, { '\u2035' },
|
||||
{ '\u223d' }, { '\u22cd' }, { '\u22bd' }, { '\u2305' },
|
||||
{ '\u2305' }, { '\u23b5' }, { '\u23b6' }, { '\u224c' },
|
||||
{ '\u0431' }, { '\u201e' }, { '\u2235' }, { '\u2235' },
|
||||
{ '\u29b0' }, { '\u03f6' }, { '\u212c' }, { '\u03b2' },
|
||||
{ '\u2136' }, { '\u226c' }, { '\ud835', '\udd1f' }, { '\u22c2' },
|
||||
{ '\u25ef' }, { '\u22c3' }, { '\u2a00' }, { '\u2a01' },
|
||||
{ '\u2a02' }, { '\u2a06' }, { '\u2605' }, { '\u25bd' },
|
||||
{ '\u25b3' }, { '\u2a04' }, { '\u22c1' }, { '\u22c0' },
|
||||
{ '\u290d' }, { '\u29eb' }, { '\u25aa' }, { '\u25b4' },
|
||||
{ '\u25be' }, { '\u25c2' }, { '\u25b8' }, { '\u2423' },
|
||||
{ '\u2592' }, { '\u2591' }, { '\u2593' }, { '\u2588' },
|
||||
{ '\u003d', '\u20e5' }, { '\u2261', '\u20e5' }, { '\u2310' },
|
||||
{ '\ud835', '\udd53' }, { '\u22a5' }, { '\u22a5' }, { '\u22c8' },
|
||||
{ '\u2557' }, { '\u2554' }, { '\u2556' }, { '\u2553' },
|
||||
{ '\u2550' }, { '\u2566' }, { '\u2569' }, { '\u2564' },
|
||||
{ '\u2567' }, { '\u255d' }, { '\u255a' }, { '\u255c' },
|
||||
{ '\u2559' }, { '\u2551' }, { '\u256c' }, { '\u2563' },
|
||||
{ '\u2560' }, { '\u256b' }, { '\u2562' }, { '\u255f' },
|
||||
{ '\u29c9' }, { '\u2555' }, { '\u2552' }, { '\u2510' },
|
||||
{ '\u250c' }, { '\u2500' }, { '\u2565' }, { '\u2568' },
|
||||
{ '\u252c' }, { '\u2534' }, { '\u229f' }, { '\u229e' },
|
||||
{ '\u22a0' }, { '\u255b' }, { '\u2558' }, { '\u2518' },
|
||||
{ '\u2514' }, { '\u2502' }, { '\u256a' }, { '\u2561' },
|
||||
{ '\u255e' }, { '\u253c' }, { '\u2524' }, { '\u251c' },
|
||||
{ '\u2035' }, { '\u02d8' }, { '\u00a6' }, { '\u00a6' },
|
||||
{ '\ud835', '\udcb7' }, { '\u204f' }, { '\u223d' }, { '\u22cd' },
|
||||
{ '\\' }, { '\u29c5' }, { '\u27c8' }, { '\u2022' }, { '\u2022' },
|
||||
{ '\u224e' }, { '\u2aae' }, { '\u224f' }, { '\u224f' },
|
||||
{ '\u0107' }, { '\u2229' }, { '\u2a44' }, { '\u2a49' },
|
||||
{ '\u2a4b' }, { '\u2a47' }, { '\u2a40' }, { '\u2229', '\ufe00' },
|
||||
{ '\u2041' }, { '\u02c7' }, { '\u2a4d' }, { '\u010d' },
|
||||
{ '\u00e7' }, { '\u00e7' }, { '\u0109' }, { '\u2a4c' },
|
||||
{ '\u2a50' }, { '\u010b' }, { '\u00b8' }, { '\u00b8' },
|
||||
{ '\u29b2' }, { '\u00a2' }, { '\u00a2' }, { '\u00b7' },
|
||||
{ '\ud835', '\udd20' }, { '\u0447' }, { '\u2713' }, { '\u2713' },
|
||||
{ '\u03c7' }, { '\u25cb' }, { '\u29c3' }, { '\u02c6' },
|
||||
{ '\u2257' }, { '\u21ba' }, { '\u21bb' }, { '\u00ae' },
|
||||
{ '\u24c8' }, { '\u229b' }, { '\u229a' }, { '\u229d' },
|
||||
{ '\u2257' }, { '\u2a10' }, { '\u2aef' }, { '\u29c2' },
|
||||
{ '\u2663' }, { '\u2663' }, { '\u003a' }, { '\u2254' },
|
||||
{ '\u2254' }, { '\u002c' }, { '\u0040' }, { '\u2201' },
|
||||
{ '\u2218' }, { '\u2201' }, { '\u2102' }, { '\u2245' },
|
||||
{ '\u2a6d' }, { '\u222e' }, { '\ud835', '\udd54' }, { '\u2210' },
|
||||
{ '\u00a9' }, { '\u00a9' }, { '\u2117' }, { '\u21b5' },
|
||||
{ '\u2717' }, { '\ud835', '\udcb8' }, { '\u2acf' }, { '\u2ad1' },
|
||||
{ '\u2ad0' }, { '\u2ad2' }, { '\u22ef' }, { '\u2938' },
|
||||
{ '\u2935' }, { '\u22de' }, { '\u22df' }, { '\u21b6' },
|
||||
{ '\u293d' }, { '\u222a' }, { '\u2a48' }, { '\u2a46' },
|
||||
{ '\u2a4a' }, { '\u228d' }, { '\u2a45' }, { '\u222a', '\ufe00' },
|
||||
{ '\u21b7' }, { '\u293c' }, { '\u22de' }, { '\u22df' },
|
||||
{ '\u22ce' }, { '\u22cf' }, { '\u00a4' }, { '\u00a4' },
|
||||
{ '\u21b6' }, { '\u21b7' }, { '\u22ce' }, { '\u22cf' },
|
||||
{ '\u2232' }, { '\u2231' }, { '\u232d' }, { '\u21d3' },
|
||||
{ '\u2965' }, { '\u2020' }, { '\u2138' }, { '\u2193' },
|
||||
{ '\u2010' }, { '\u22a3' }, { '\u290f' }, { '\u02dd' },
|
||||
{ '\u010f' }, { '\u0434' }, { '\u2146' }, { '\u2021' },
|
||||
{ '\u21ca' }, { '\u2a77' }, { '\u00b0' }, { '\u00b0' },
|
||||
{ '\u03b4' }, { '\u29b1' }, { '\u297f' }, { '\ud835', '\udd21' },
|
||||
{ '\u21c3' }, { '\u21c2' }, { '\u22c4' }, { '\u22c4' },
|
||||
{ '\u2666' }, { '\u2666' }, { '\u00a8' }, { '\u03dd' },
|
||||
{ '\u22f2' }, { '\u00f7' }, { '\u00f7' }, { '\u00f7' },
|
||||
{ '\u22c7' }, { '\u22c7' }, { '\u0452' }, { '\u231e' },
|
||||
{ '\u230d' }, { '\u0024' }, { '\ud835', '\udd55' }, { '\u02d9' },
|
||||
{ '\u2250' }, { '\u2251' }, { '\u2238' }, { '\u2214' },
|
||||
{ '\u22a1' }, { '\u2306' }, { '\u2193' }, { '\u21ca' },
|
||||
{ '\u21c3' }, { '\u21c2' }, { '\u2910' }, { '\u231f' },
|
||||
{ '\u230c' }, { '\ud835', '\udcb9' }, { '\u0455' }, { '\u29f6' },
|
||||
{ '\u0111' }, { '\u22f1' }, { '\u25bf' }, { '\u25be' },
|
||||
{ '\u21f5' }, { '\u296f' }, { '\u29a6' }, { '\u045f' },
|
||||
{ '\u27ff' }, { '\u2a77' }, { '\u2251' }, { '\u00e9' },
|
||||
{ '\u00e9' }, { '\u2a6e' }, { '\u011b' }, { '\u2256' },
|
||||
{ '\u00ea' }, { '\u00ea' }, { '\u2255' }, { '\u044d' },
|
||||
{ '\u0117' }, { '\u2147' }, { '\u2252' }, { '\ud835', '\udd22' },
|
||||
{ '\u2a9a' }, { '\u00e8' }, { '\u00e8' }, { '\u2a96' },
|
||||
{ '\u2a98' }, { '\u2a99' }, { '\u23e7' }, { '\u2113' },
|
||||
{ '\u2a95' }, { '\u2a97' }, { '\u0113' }, { '\u2205' },
|
||||
{ '\u2205' }, { '\u2205' }, { '\u2004' }, { '\u2005' },
|
||||
{ '\u2003' }, { '\u014b' }, { '\u2002' }, { '\u0119' },
|
||||
{ '\ud835', '\udd56' }, { '\u22d5' }, { '\u29e3' }, { '\u2a71' },
|
||||
{ '\u03b5' }, { '\u03b5' }, { '\u03f5' }, { '\u2256' },
|
||||
{ '\u2255' }, { '\u2242' }, { '\u2a96' }, { '\u2a95' },
|
||||
{ '\u003d' }, { '\u225f' }, { '\u2261' }, { '\u2a78' },
|
||||
{ '\u29e5' }, { '\u2253' }, { '\u2971' }, { '\u212f' },
|
||||
{ '\u2250' }, { '\u2242' }, { '\u03b7' }, { '\u00f0' },
|
||||
{ '\u00f0' }, { '\u00eb' }, { '\u00eb' }, { '\u20ac' },
|
||||
{ '\u0021' }, { '\u2203' }, { '\u2130' }, { '\u2147' },
|
||||
{ '\u2252' }, { '\u0444' }, { '\u2640' }, { '\ufb03' },
|
||||
{ '\ufb00' }, { '\ufb04' }, { '\ud835', '\udd23' }, { '\ufb01' },
|
||||
{ '\u0066', '\u006a' }, { '\u266d' }, { '\ufb02' }, { '\u25b1' },
|
||||
{ '\u0192' }, { '\ud835', '\udd57' }, { '\u2200' }, { '\u22d4' },
|
||||
{ '\u2ad9' }, { '\u2a0d' }, { '\u00bd' }, { '\u00bd' },
|
||||
{ '\u2153' }, { '\u00bc' }, { '\u00bc' }, { '\u2155' },
|
||||
{ '\u2159' }, { '\u215b' }, { '\u2154' }, { '\u2156' },
|
||||
{ '\u00be' }, { '\u00be' }, { '\u2157' }, { '\u215c' },
|
||||
{ '\u2158' }, { '\u215a' }, { '\u215d' }, { '\u215e' },
|
||||
{ '\u2044' }, { '\u2322' }, { '\ud835', '\udcbb' }, { '\u2267' },
|
||||
{ '\u2a8c' }, { '\u01f5' }, { '\u03b3' }, { '\u03dd' },
|
||||
{ '\u2a86' }, { '\u011f' }, { '\u011d' }, { '\u0433' },
|
||||
{ '\u0121' }, { '\u2265' }, { '\u22db' }, { '\u2265' },
|
||||
{ '\u2267' }, { '\u2a7e' }, { '\u2a7e' }, { '\u2aa9' },
|
||||
{ '\u2a80' }, { '\u2a82' }, { '\u2a84' }, { '\u22db', '\ufe00' },
|
||||
{ '\u2a94' }, { '\ud835', '\udd24' }, { '\u226b' }, { '\u22d9' },
|
||||
{ '\u2137' }, { '\u0453' }, { '\u2277' }, { '\u2a92' },
|
||||
{ '\u2aa5' }, { '\u2aa4' }, { '\u2269' }, { '\u2a8a' },
|
||||
{ '\u2a8a' }, { '\u2a88' }, { '\u2a88' }, { '\u2269' },
|
||||
{ '\u22e7' }, { '\ud835', '\udd58' }, { '\u0060' }, { '\u210a' },
|
||||
{ '\u2273' }, { '\u2a8e' }, { '\u2a90' }, { '\u003e' },
|
||||
{ '\u003e' }, { '\u2aa7' }, { '\u2a7a' }, { '\u22d7' },
|
||||
{ '\u2995' }, { '\u2a7c' }, { '\u2a86' }, { '\u2978' },
|
||||
{ '\u22d7' }, { '\u22db' }, { '\u2a8c' }, { '\u2277' },
|
||||
{ '\u2273' }, { '\u2269', '\ufe00' }, { '\u2269', '\ufe00' },
|
||||
{ '\u21d4' }, { '\u200a' }, { '\u00bd' }, { '\u210b' },
|
||||
{ '\u044a' }, { '\u2194' }, { '\u2948' }, { '\u21ad' },
|
||||
{ '\u210f' }, { '\u0125' }, { '\u2665' }, { '\u2665' },
|
||||
{ '\u2026' }, { '\u22b9' }, { '\ud835', '\udd25' }, { '\u2925' },
|
||||
{ '\u2926' }, { '\u21ff' }, { '\u223b' }, { '\u21a9' },
|
||||
{ '\u21aa' }, { '\ud835', '\udd59' }, { '\u2015' },
|
||||
{ '\ud835', '\udcbd' }, { '\u210f' }, { '\u0127' }, { '\u2043' },
|
||||
{ '\u2010' }, { '\u00ed' }, { '\u00ed' }, { '\u2063' },
|
||||
{ '\u00ee' }, { '\u00ee' }, { '\u0438' }, { '\u0435' },
|
||||
{ '\u00a1' }, { '\u00a1' }, { '\u21d4' }, { '\ud835', '\udd26' },
|
||||
{ '\u00ec' }, { '\u00ec' }, { '\u2148' }, { '\u2a0c' },
|
||||
{ '\u222d' }, { '\u29dc' }, { '\u2129' }, { '\u0133' },
|
||||
{ '\u012b' }, { '\u2111' }, { '\u2110' }, { '\u2111' },
|
||||
{ '\u0131' }, { '\u22b7' }, { '\u01b5' }, { '\u2208' },
|
||||
{ '\u2105' }, { '\u221e' }, { '\u29dd' }, { '\u0131' },
|
||||
{ '\u222b' }, { '\u22ba' }, { '\u2124' }, { '\u22ba' },
|
||||
{ '\u2a17' }, { '\u2a3c' }, { '\u0451' }, { '\u012f' },
|
||||
{ '\ud835', '\udd5a' }, { '\u03b9' }, { '\u2a3c' }, { '\u00bf' },
|
||||
{ '\u00bf' }, { '\ud835', '\udcbe' }, { '\u2208' }, { '\u22f9' },
|
||||
{ '\u22f5' }, { '\u22f4' }, { '\u22f3' }, { '\u2208' },
|
||||
{ '\u2062' }, { '\u0129' }, { '\u0456' }, { '\u00ef' },
|
||||
{ '\u00ef' }, { '\u0135' }, { '\u0439' }, { '\ud835', '\udd27' },
|
||||
{ '\u0237' }, { '\ud835', '\udd5b' }, { '\ud835', '\udcbf' },
|
||||
{ '\u0458' }, { '\u0454' }, { '\u03ba' }, { '\u03f0' },
|
||||
{ '\u0137' }, { '\u043a' }, { '\ud835', '\udd28' }, { '\u0138' },
|
||||
{ '\u0445' }, { '\u045c' }, { '\ud835', '\udd5c' },
|
||||
{ '\ud835', '\udcc0' }, { '\u21da' }, { '\u21d0' }, { '\u291b' },
|
||||
{ '\u290e' }, { '\u2266' }, { '\u2a8b' }, { '\u2962' },
|
||||
{ '\u013a' }, { '\u29b4' }, { '\u2112' }, { '\u03bb' },
|
||||
{ '\u27e8' }, { '\u2991' }, { '\u27e8' }, { '\u2a85' },
|
||||
{ '\u00ab' }, { '\u00ab' }, { '\u2190' }, { '\u21e4' },
|
||||
{ '\u291f' }, { '\u291d' }, { '\u21a9' }, { '\u21ab' },
|
||||
{ '\u2939' }, { '\u2973' }, { '\u21a2' }, { '\u2aab' },
|
||||
{ '\u2919' }, { '\u2aad' }, { '\u2aad', '\ufe00' }, { '\u290c' },
|
||||
{ '\u2772' }, { '\u007b' }, { '\u005b' }, { '\u298b' },
|
||||
{ '\u298f' }, { '\u298d' }, { '\u013e' }, { '\u013c' },
|
||||
{ '\u2308' }, { '\u007b' }, { '\u043b' }, { '\u2936' },
|
||||
{ '\u201c' }, { '\u201e' }, { '\u2967' }, { '\u294b' },
|
||||
{ '\u21b2' }, { '\u2264' }, { '\u2190' }, { '\u21a2' },
|
||||
{ '\u21bd' }, { '\u21bc' }, { '\u21c7' }, { '\u2194' },
|
||||
{ '\u21c6' }, { '\u21cb' }, { '\u21ad' }, { '\u22cb' },
|
||||
{ '\u22da' }, { '\u2264' }, { '\u2266' }, { '\u2a7d' },
|
||||
{ '\u2a7d' }, { '\u2aa8' }, { '\u2a7f' }, { '\u2a81' },
|
||||
{ '\u2a83' }, { '\u22da', '\ufe00' }, { '\u2a93' }, { '\u2a85' },
|
||||
{ '\u22d6' }, { '\u22da' }, { '\u2a8b' }, { '\u2276' },
|
||||
{ '\u2272' }, { '\u297c' }, { '\u230a' }, { '\ud835', '\udd29' },
|
||||
{ '\u2276' }, { '\u2a91' }, { '\u21bd' }, { '\u21bc' },
|
||||
{ '\u296a' }, { '\u2584' }, { '\u0459' }, { '\u226a' },
|
||||
{ '\u21c7' }, { '\u231e' }, { '\u296b' }, { '\u25fa' },
|
||||
{ '\u0140' }, { '\u23b0' }, { '\u23b0' }, { '\u2268' },
|
||||
{ '\u2a89' }, { '\u2a89' }, { '\u2a87' }, { '\u2a87' },
|
||||
{ '\u2268' }, { '\u22e6' }, { '\u27ec' }, { '\u21fd' },
|
||||
{ '\u27e6' }, { '\u27f5' }, { '\u27f7' }, { '\u27fc' },
|
||||
{ '\u27f6' }, { '\u21ab' }, { '\u21ac' }, { '\u2985' },
|
||||
{ '\ud835', '\udd5d' }, { '\u2a2d' }, { '\u2a34' }, { '\u2217' },
|
||||
{ '\u005f' }, { '\u25ca' }, { '\u25ca' }, { '\u29eb' },
|
||||
{ '\u0028' }, { '\u2993' }, { '\u21c6' }, { '\u231f' },
|
||||
{ '\u21cb' }, { '\u296d' }, { '\u200e' }, { '\u22bf' },
|
||||
{ '\u2039' }, { '\ud835', '\udcc1' }, { '\u21b0' }, { '\u2272' },
|
||||
{ '\u2a8d' }, { '\u2a8f' }, { '\u005b' }, { '\u2018' },
|
||||
{ '\u201a' }, { '\u0142' }, { '\u003c' }, { '\u003c' },
|
||||
{ '\u2aa6' }, { '\u2a79' }, { '\u22d6' }, { '\u22cb' },
|
||||
{ '\u22c9' }, { '\u2976' }, { '\u2a7b' }, { '\u2996' },
|
||||
{ '\u25c3' }, { '\u22b4' }, { '\u25c2' }, { '\u294a' },
|
||||
{ '\u2966' }, { '\u2268', '\ufe00' }, { '\u2268', '\ufe00' },
|
||||
{ '\u223a' }, { '\u00af' }, { '\u00af' }, { '\u2642' },
|
||||
{ '\u2720' }, { '\u2720' }, { '\u21a6' }, { '\u21a6' },
|
||||
{ '\u21a7' }, { '\u21a4' }, { '\u21a5' }, { '\u25ae' },
|
||||
{ '\u2a29' }, { '\u043c' }, { '\u2014' }, { '\u2221' },
|
||||
{ '\ud835', '\udd2a' }, { '\u2127' }, { '\u00b5' }, { '\u00b5' },
|
||||
{ '\u2223' }, { '\u002a' }, { '\u2af0' }, { '\u00b7' },
|
||||
{ '\u00b7' }, { '\u2212' }, { '\u229f' }, { '\u2238' },
|
||||
{ '\u2a2a' }, { '\u2adb' }, { '\u2026' }, { '\u2213' },
|
||||
{ '\u22a7' }, { '\ud835', '\udd5e' }, { '\u2213' },
|
||||
{ '\ud835', '\udcc2' }, { '\u223e' }, { '\u03bc' }, { '\u22b8' },
|
||||
{ '\u22b8' }, { '\u22d9', '\u0338' }, { '\u226b', '\u20d2' },
|
||||
{ '\u226b', '\u0338' }, { '\u21cd' }, { '\u21ce' },
|
||||
{ '\u22d8', '\u0338' }, { '\u226a', '\u20d2' },
|
||||
{ '\u226a', '\u0338' }, { '\u21cf' }, { '\u22af' }, { '\u22ae' },
|
||||
{ '\u2207' }, { '\u0144' }, { '\u2220', '\u20d2' }, { '\u2249' },
|
||||
{ '\u2a70', '\u0338' }, { '\u224b', '\u0338' }, { '\u0149' },
|
||||
{ '\u2249' }, { '\u266e' }, { '\u266e' }, { '\u2115' },
|
||||
{ '\u00a0' }, { '\u00a0' }, { '\u224e', '\u0338' },
|
||||
{ '\u224f', '\u0338' }, { '\u2a43' }, { '\u0148' }, { '\u0146' },
|
||||
{ '\u2247' }, { '\u2a6d', '\u0338' }, { '\u2a42' }, { '\u043d' },
|
||||
{ '\u2013' }, { '\u2260' }, { '\u21d7' }, { '\u2924' },
|
||||
{ '\u2197' }, { '\u2197' }, { '\u2250', '\u0338' }, { '\u2262' },
|
||||
{ '\u2928' }, { '\u2242', '\u0338' }, { '\u2204' }, { '\u2204' },
|
||||
{ '\ud835', '\udd2b' }, { '\u2267', '\u0338' }, { '\u2271' },
|
||||
{ '\u2271' }, { '\u2267', '\u0338' }, { '\u2a7e', '\u0338' },
|
||||
{ '\u2a7e', '\u0338' }, { '\u2275' }, { '\u226f' }, { '\u226f' },
|
||||
{ '\u21ce' }, { '\u21ae' }, { '\u2af2' }, { '\u220b' },
|
||||
{ '\u22fc' }, { '\u22fa' }, { '\u220b' }, { '\u045a' },
|
||||
{ '\u21cd' }, { '\u2266', '\u0338' }, { '\u219a' }, { '\u2025' },
|
||||
{ '\u2270' }, { '\u219a' }, { '\u21ae' }, { '\u2270' },
|
||||
{ '\u2266', '\u0338' }, { '\u2a7d', '\u0338' },
|
||||
{ '\u2a7d', '\u0338' }, { '\u226e' }, { '\u2274' }, { '\u226e' },
|
||||
{ '\u22ea' }, { '\u22ec' }, { '\u2224' }, { '\ud835', '\udd5f' },
|
||||
{ '\u00ac' }, { '\u00ac' }, { '\u2209' }, { '\u22f9', '\u0338' },
|
||||
{ '\u22f5', '\u0338' }, { '\u2209' }, { '\u22f7' }, { '\u22f6' },
|
||||
{ '\u220c' }, { '\u220c' }, { '\u22fe' }, { '\u22fd' },
|
||||
{ '\u2226' }, { '\u2226' }, { '\u2afd', '\u20e5' },
|
||||
{ '\u2202', '\u0338' }, { '\u2a14' }, { '\u2280' }, { '\u22e0' },
|
||||
{ '\u2aaf', '\u0338' }, { '\u2280' }, { '\u2aaf', '\u0338' },
|
||||
{ '\u21cf' }, { '\u219b' }, { '\u2933', '\u0338' },
|
||||
{ '\u219d', '\u0338' }, { '\u219b' }, { '\u22eb' }, { '\u22ed' },
|
||||
{ '\u2281' }, { '\u22e1' }, { '\u2ab0', '\u0338' },
|
||||
{ '\ud835', '\udcc3' }, { '\u2224' }, { '\u2226' }, { '\u2241' },
|
||||
{ '\u2244' }, { '\u2244' }, { '\u2224' }, { '\u2226' },
|
||||
{ '\u22e2' }, { '\u22e3' }, { '\u2284' }, { '\u2ac5', '\u0338' },
|
||||
{ '\u2288' }, { '\u2282', '\u20d2' }, { '\u2288' },
|
||||
{ '\u2ac5', '\u0338' }, { '\u2281' }, { '\u2ab0', '\u0338' },
|
||||
{ '\u2285' }, { '\u2ac6', '\u0338' }, { '\u2289' },
|
||||
{ '\u2283', '\u20d2' }, { '\u2289' }, { '\u2ac6', '\u0338' },
|
||||
{ '\u2279' }, { '\u00f1' }, { '\u00f1' }, { '\u2278' },
|
||||
{ '\u22ea' }, { '\u22ec' }, { '\u22eb' }, { '\u22ed' },
|
||||
{ '\u03bd' }, { '\u0023' }, { '\u2116' }, { '\u2007' },
|
||||
{ '\u22ad' }, { '\u2904' }, { '\u224d', '\u20d2' }, { '\u22ac' },
|
||||
{ '\u2265', '\u20d2' }, { '\u003e', '\u20d2' }, { '\u29de' },
|
||||
{ '\u2902' }, { '\u2264', '\u20d2' }, { '\u003c', '\u20d2' },
|
||||
{ '\u22b4', '\u20d2' }, { '\u2903' }, { '\u22b5', '\u20d2' },
|
||||
{ '\u223c', '\u20d2' }, { '\u21d6' }, { '\u2923' }, { '\u2196' },
|
||||
{ '\u2196' }, { '\u2927' }, { '\u24c8' }, { '\u00f3' },
|
||||
{ '\u00f3' }, { '\u229b' }, { '\u229a' }, { '\u00f4' },
|
||||
{ '\u00f4' }, { '\u043e' }, { '\u229d' }, { '\u0151' },
|
||||
{ '\u2a38' }, { '\u2299' }, { '\u29bc' }, { '\u0153' },
|
||||
{ '\u29bf' }, { '\ud835', '\udd2c' }, { '\u02db' }, { '\u00f2' },
|
||||
{ '\u00f2' }, { '\u29c1' }, { '\u29b5' }, { '\u03a9' },
|
||||
{ '\u222e' }, { '\u21ba' }, { '\u29be' }, { '\u29bb' },
|
||||
{ '\u203e' }, { '\u29c0' }, { '\u014d' }, { '\u03c9' },
|
||||
{ '\u03bf' }, { '\u29b6' }, { '\u2296' }, { '\ud835', '\udd60' },
|
||||
{ '\u29b7' }, { '\u29b9' }, { '\u2295' }, { '\u2228' },
|
||||
{ '\u21bb' }, { '\u2a5d' }, { '\u2134' }, { '\u2134' },
|
||||
{ '\u00aa' }, { '\u00aa' }, { '\u00ba' }, { '\u00ba' },
|
||||
{ '\u22b6' }, { '\u2a56' }, { '\u2a57' }, { '\u2a5b' },
|
||||
{ '\u2134' }, { '\u00f8' }, { '\u00f8' }, { '\u2298' },
|
||||
{ '\u00f5' }, { '\u00f5' }, { '\u2297' }, { '\u2a36' },
|
||||
{ '\u00f6' }, { '\u00f6' }, { '\u233d' }, { '\u2225' },
|
||||
{ '\u00b6' }, { '\u00b6' }, { '\u2225' }, { '\u2af3' },
|
||||
{ '\u2afd' }, { '\u2202' }, { '\u043f' }, { '\u0025' },
|
||||
{ '\u002e' }, { '\u2030' }, { '\u22a5' }, { '\u2031' },
|
||||
{ '\ud835', '\udd2d' }, { '\u03c6' }, { '\u03d5' }, { '\u2133' },
|
||||
{ '\u260e' }, { '\u03c0' }, { '\u22d4' }, { '\u03d6' },
|
||||
{ '\u210f' }, { '\u210e' }, { '\u210f' }, { '\u002b' },
|
||||
{ '\u2a23' }, { '\u229e' }, { '\u2a22' }, { '\u2214' },
|
||||
{ '\u2a25' }, { '\u2a72' }, { '\u00b1' }, { '\u00b1' },
|
||||
{ '\u2a26' }, { '\u2a27' }, { '\u00b1' }, { '\u2a15' },
|
||||
{ '\ud835', '\udd61' }, { '\u00a3' }, { '\u00a3' }, { '\u227a' },
|
||||
{ '\u2ab3' }, { '\u2ab7' }, { '\u227c' }, { '\u2aaf' },
|
||||
{ '\u227a' }, { '\u2ab7' }, { '\u227c' }, { '\u2aaf' },
|
||||
{ '\u2ab9' }, { '\u2ab5' }, { '\u22e8' }, { '\u227e' },
|
||||
{ '\u2032' }, { '\u2119' }, { '\u2ab5' }, { '\u2ab9' },
|
||||
{ '\u22e8' }, { '\u220f' }, { '\u232e' }, { '\u2312' },
|
||||
{ '\u2313' }, { '\u221d' }, { '\u221d' }, { '\u227e' },
|
||||
{ '\u22b0' }, { '\ud835', '\udcc5' }, { '\u03c8' }, { '\u2008' },
|
||||
{ '\ud835', '\udd2e' }, { '\u2a0c' }, { '\ud835', '\udd62' },
|
||||
{ '\u2057' }, { '\ud835', '\udcc6' }, { '\u210d' }, { '\u2a16' },
|
||||
{ '\u003f' }, { '\u225f' }, { '\u0022' }, { '\u0022' },
|
||||
{ '\u21db' }, { '\u21d2' }, { '\u291c' }, { '\u290f' },
|
||||
{ '\u2964' }, { '\u223d', '\u0331' }, { '\u0155' }, { '\u221a' },
|
||||
{ '\u29b3' }, { '\u27e9' }, { '\u2992' }, { '\u29a5' },
|
||||
{ '\u27e9' }, { '\u00bb' }, { '\u00bb' }, { '\u2192' },
|
||||
{ '\u2975' }, { '\u21e5' }, { '\u2920' }, { '\u2933' },
|
||||
{ '\u291e' }, { '\u21aa' }, { '\u21ac' }, { '\u2945' },
|
||||
{ '\u2974' }, { '\u21a3' }, { '\u219d' }, { '\u291a' },
|
||||
{ '\u2236' }, { '\u211a' }, { '\u290d' }, { '\u2773' },
|
||||
{ '\u007d' }, { '\u005d' }, { '\u298c' }, { '\u298e' },
|
||||
{ '\u2990' }, { '\u0159' }, { '\u0157' }, { '\u2309' },
|
||||
{ '\u007d' }, { '\u0440' }, { '\u2937' }, { '\u2969' },
|
||||
{ '\u201d' }, { '\u201d' }, { '\u21b3' }, { '\u211c' },
|
||||
{ '\u211b' }, { '\u211c' }, { '\u211d' }, { '\u25ad' },
|
||||
{ '\u00ae' }, { '\u00ae' }, { '\u297d' }, { '\u230b' },
|
||||
{ '\ud835', '\udd2f' }, { '\u21c1' }, { '\u21c0' }, { '\u296c' },
|
||||
{ '\u03c1' }, { '\u03f1' }, { '\u2192' }, { '\u21a3' },
|
||||
{ '\u21c1' }, { '\u21c0' }, { '\u21c4' }, { '\u21cc' },
|
||||
{ '\u21c9' }, { '\u219d' }, { '\u22cc' }, { '\u02da' },
|
||||
{ '\u2253' }, { '\u21c4' }, { '\u21cc' }, { '\u200f' },
|
||||
{ '\u23b1' }, { '\u23b1' }, { '\u2aee' }, { '\u27ed' },
|
||||
{ '\u21fe' }, { '\u27e7' }, { '\u2986' }, { '\ud835', '\udd63' },
|
||||
{ '\u2a2e' }, { '\u2a35' }, { '\u0029' }, { '\u2994' },
|
||||
{ '\u2a12' }, { '\u21c9' }, { '\u203a' }, { '\ud835', '\udcc7' },
|
||||
{ '\u21b1' }, { '\u005d' }, { '\u2019' }, { '\u2019' },
|
||||
{ '\u22cc' }, { '\u22ca' }, { '\u25b9' }, { '\u22b5' },
|
||||
{ '\u25b8' }, { '\u29ce' }, { '\u2968' }, { '\u211e' },
|
||||
{ '\u015b' }, { '\u201a' }, { '\u227b' }, { '\u2ab4' },
|
||||
{ '\u2ab8' }, { '\u0161' }, { '\u227d' }, { '\u2ab0' },
|
||||
{ '\u015f' }, { '\u015d' }, { '\u2ab6' }, { '\u2aba' },
|
||||
{ '\u22e9' }, { '\u2a13' }, { '\u227f' }, { '\u0441' },
|
||||
{ '\u22c5' }, { '\u22a1' }, { '\u2a66' }, { '\u21d8' },
|
||||
{ '\u2925' }, { '\u2198' }, { '\u2198' }, { '\u00a7' },
|
||||
{ '\u00a7' }, { '\u003b' }, { '\u2929' }, { '\u2216' },
|
||||
{ '\u2216' }, { '\u2736' }, { '\ud835', '\udd30' }, { '\u2322' },
|
||||
{ '\u266f' }, { '\u0449' }, { '\u0448' }, { '\u2223' },
|
||||
{ '\u2225' }, { '\u00ad' }, { '\u00ad' }, { '\u03c3' },
|
||||
{ '\u03c2' }, { '\u03c2' }, { '\u223c' }, { '\u2a6a' },
|
||||
{ '\u2243' }, { '\u2243' }, { '\u2a9e' }, { '\u2aa0' },
|
||||
{ '\u2a9d' }, { '\u2a9f' }, { '\u2246' }, { '\u2a24' },
|
||||
{ '\u2972' }, { '\u2190' }, { '\u2216' }, { '\u2a33' },
|
||||
{ '\u29e4' }, { '\u2223' }, { '\u2323' }, { '\u2aaa' },
|
||||
{ '\u2aac' }, { '\u2aac', '\ufe00' }, { '\u044c' }, { '\u002f' },
|
||||
{ '\u29c4' }, { '\u233f' }, { '\ud835', '\udd64' }, { '\u2660' },
|
||||
{ '\u2660' }, { '\u2225' }, { '\u2293' }, { '\u2293', '\ufe00' },
|
||||
{ '\u2294' }, { '\u2294', '\ufe00' }, { '\u228f' }, { '\u2291' },
|
||||
{ '\u228f' }, { '\u2291' }, { '\u2290' }, { '\u2292' },
|
||||
{ '\u2290' }, { '\u2292' }, { '\u25a1' }, { '\u25a1' },
|
||||
{ '\u25aa' }, { '\u25aa' }, { '\u2192' }, { '\ud835', '\udcc8' },
|
||||
{ '\u2216' }, { '\u2323' }, { '\u22c6' }, { '\u2606' },
|
||||
{ '\u2605' }, { '\u03f5' }, { '\u03d5' }, { '\u00af' },
|
||||
{ '\u2282' }, { '\u2ac5' }, { '\u2abd' }, { '\u2286' },
|
||||
{ '\u2ac3' }, { '\u2ac1' }, { '\u2acb' }, { '\u228a' },
|
||||
{ '\u2abf' }, { '\u2979' }, { '\u2282' }, { '\u2286' },
|
||||
{ '\u2ac5' }, { '\u228a' }, { '\u2acb' }, { '\u2ac7' },
|
||||
{ '\u2ad5' }, { '\u2ad3' }, { '\u227b' }, { '\u2ab8' },
|
||||
{ '\u227d' }, { '\u2ab0' }, { '\u2aba' }, { '\u2ab6' },
|
||||
{ '\u22e9' }, { '\u227f' }, { '\u2211' }, { '\u266a' },
|
||||
{ '\u00b9' }, { '\u00b9' }, { '\u00b2' }, { '\u00b2' },
|
||||
{ '\u00b3' }, { '\u00b3' }, { '\u2283' }, { '\u2ac6' },
|
||||
{ '\u2abe' }, { '\u2ad8' }, { '\u2287' }, { '\u2ac4' },
|
||||
{ '\u27c9' }, { '\u2ad7' }, { '\u297b' }, { '\u2ac2' },
|
||||
{ '\u2acc' }, { '\u228b' }, { '\u2ac0' }, { '\u2283' },
|
||||
{ '\u2287' }, { '\u2ac6' }, { '\u228b' }, { '\u2acc' },
|
||||
{ '\u2ac8' }, { '\u2ad4' }, { '\u2ad6' }, { '\u21d9' },
|
||||
{ '\u2926' }, { '\u2199' }, { '\u2199' }, { '\u292a' },
|
||||
{ '\u00df' }, { '\u00df' }, { '\u2316' }, { '\u03c4' },
|
||||
{ '\u23b4' }, { '\u0165' }, { '\u0163' }, { '\u0442' },
|
||||
{ '\u20db' }, { '\u2315' }, { '\ud835', '\udd31' }, { '\u2234' },
|
||||
{ '\u2234' }, { '\u03b8' }, { '\u03d1' }, { '\u03d1' },
|
||||
{ '\u2248' }, { '\u223c' }, { '\u2009' }, { '\u2248' },
|
||||
{ '\u223c' }, { '\u00fe' }, { '\u00fe' }, { '\u02dc' },
|
||||
{ '\u00d7' }, { '\u00d7' }, { '\u22a0' }, { '\u2a31' },
|
||||
{ '\u2a30' }, { '\u222d' }, { '\u2928' }, { '\u22a4' },
|
||||
{ '\u2336' }, { '\u2af1' }, { '\ud835', '\udd65' }, { '\u2ada' },
|
||||
{ '\u2929' }, { '\u2034' }, { '\u2122' }, { '\u25b5' },
|
||||
{ '\u25bf' }, { '\u25c3' }, { '\u22b4' }, { '\u225c' },
|
||||
{ '\u25b9' }, { '\u22b5' }, { '\u25ec' }, { '\u225c' },
|
||||
{ '\u2a3a' }, { '\u2a39' }, { '\u29cd' }, { '\u2a3b' },
|
||||
{ '\u23e2' }, { '\ud835', '\udcc9' }, { '\u0446' }, { '\u045b' },
|
||||
{ '\u0167' }, { '\u226c' }, { '\u219e' }, { '\u21a0' },
|
||||
{ '\u21d1' }, { '\u2963' }, { '\u00fa' }, { '\u00fa' },
|
||||
{ '\u2191' }, { '\u045e' }, { '\u016d' }, { '\u00fb' },
|
||||
{ '\u00fb' }, { '\u0443' }, { '\u21c5' }, { '\u0171' },
|
||||
{ '\u296e' }, { '\u297e' }, { '\ud835', '\udd32' }, { '\u00f9' },
|
||||
{ '\u00f9' }, { '\u21bf' }, { '\u21be' }, { '\u2580' },
|
||||
{ '\u231c' }, { '\u231c' }, { '\u230f' }, { '\u25f8' },
|
||||
{ '\u016b' }, { '\u00a8' }, { '\u00a8' }, { '\u0173' },
|
||||
{ '\ud835', '\udd66' }, { '\u2191' }, { '\u2195' }, { '\u21bf' },
|
||||
{ '\u21be' }, { '\u228e' }, { '\u03c5' }, { '\u03d2' },
|
||||
{ '\u03c5' }, { '\u21c8' }, { '\u231d' }, { '\u231d' },
|
||||
{ '\u230e' }, { '\u016f' }, { '\u25f9' }, { '\ud835', '\udcca' },
|
||||
{ '\u22f0' }, { '\u0169' }, { '\u25b5' }, { '\u25b4' },
|
||||
{ '\u21c8' }, { '\u00fc' }, { '\u00fc' }, { '\u29a7' },
|
||||
{ '\u21d5' }, { '\u2ae8' }, { '\u2ae9' }, { '\u22a8' },
|
||||
{ '\u299c' }, { '\u03f5' }, { '\u03f0' }, { '\u2205' },
|
||||
{ '\u03d5' }, { '\u03d6' }, { '\u221d' }, { '\u2195' },
|
||||
{ '\u03f1' }, { '\u03c2' }, { '\u228a', '\ufe00' },
|
||||
{ '\u2acb', '\ufe00' }, { '\u228b', '\ufe00' },
|
||||
{ '\u2acc', '\ufe00' }, { '\u03d1' }, { '\u22b2' }, { '\u22b3' },
|
||||
{ '\u0432' }, { '\u22a2' }, { '\u2228' }, { '\u22bb' },
|
||||
{ '\u225a' }, { '\u22ee' }, { '\u007c' }, { '\u007c' },
|
||||
{ '\ud835', '\udd33' }, { '\u22b2' }, { '\u2282', '\u20d2' },
|
||||
{ '\u2283', '\u20d2' }, { '\ud835', '\udd67' }, { '\u221d' },
|
||||
{ '\u22b3' }, { '\ud835', '\udccb' }, { '\u2acb', '\ufe00' },
|
||||
{ '\u228a', '\ufe00' }, { '\u2acc', '\ufe00' },
|
||||
{ '\u228b', '\ufe00' }, { '\u299a' }, { '\u0175' }, { '\u2a5f' },
|
||||
{ '\u2227' }, { '\u2259' }, { '\u2118' }, { '\ud835', '\udd34' },
|
||||
{ '\ud835', '\udd68' }, { '\u2118' }, { '\u2240' }, { '\u2240' },
|
||||
{ '\ud835', '\udccc' }, { '\u22c2' }, { '\u25ef' }, { '\u22c3' },
|
||||
{ '\u25bd' }, { '\ud835', '\udd35' }, { '\u27fa' }, { '\u27f7' },
|
||||
{ '\u03be' }, { '\u27f8' }, { '\u27f5' }, { '\u27fc' },
|
||||
{ '\u22fb' }, { '\u2a00' }, { '\ud835', '\udd69' }, { '\u2a01' },
|
||||
{ '\u2a02' }, { '\u27f9' }, { '\u27f6' }, { '\ud835', '\udccd' },
|
||||
{ '\u2a06' }, { '\u2a04' }, { '\u25b3' }, { '\u22c1' },
|
||||
{ '\u22c0' }, { '\u00fd' }, { '\u00fd' }, { '\u044f' },
|
||||
{ '\u0177' }, { '\u044b' }, { '\u00a5' }, { '\u00a5' },
|
||||
{ '\ud835', '\udd36' }, { '\u0457' }, { '\ud835', '\udd6a' },
|
||||
{ '\ud835', '\udcce' }, { '\u044e' }, { '\u00ff' }, { '\u00ff' },
|
||||
{ '\u017a' }, { '\u017e' }, { '\u0437' }, { '\u017c' },
|
||||
{ '\u2128' }, { '\u03b6' }, { '\ud835', '\udd37' }, { '\u0436' },
|
||||
{ '\u21dd' }, { '\ud835', '\udd6b' }, { '\ud835', '\udccf' },
|
||||
{ '\u200d' }, { '\u200c' }, };
|
||||
|
||||
final static char[][] WINDOWS_1252 = { { '\u20AC' }, { '\u0081' },
|
||||
{ '\u201A' }, { '\u0192' }, { '\u201E' }, { '\u2026' },
|
||||
{ '\u2020' }, { '\u2021' }, { '\u02C6' }, { '\u2030' },
|
||||
{ '\u0160' }, { '\u2039' }, { '\u0152' }, { '\u008D' },
|
||||
{ '\u017D' }, { '\u008F' }, { '\u0090' }, { '\u2018' },
|
||||
{ '\u2019' }, { '\u201C' }, { '\u201D' }, { '\u2022' },
|
||||
{ '\u2013' }, { '\u2014' }, { '\u02DC' }, { '\u2122' },
|
||||
{ '\u0161' }, { '\u203A' }, { '\u0153' }, { '\u009D' },
|
||||
{ '\u017E' }, { '\u0178' } };
|
||||
|
||||
}
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
/*
|
||||
* 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 nu.validator.htmlparser.annotation.NoLength;
|
||||
|
||||
/**
|
||||
* @version $Id$
|
||||
* @author hsivonen
|
||||
*/
|
||||
public final class NamedCharactersAccel {
|
||||
|
||||
static final @NoLength int[][] HILO_ACCEL = {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 12386493, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 40174181, 0, 0, 0, 0, 60162966, 0, 0, 0,
|
||||
75367550, 0, 0, 0, 82183396, 0, 0, 0, 0, 0, 115148507, 0,
|
||||
0, 135989275, 139397199, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28770743, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
82248935, 0, 0, 0, 0, 0, 115214046, 0, 0, 0, 139528272, 0,
|
||||
0, 0, 0, },
|
||||
null,
|
||||
{ 0, 0, 0, 4980811, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 38470219, 0, 0, 0, 0, 0, 0, 0, 0, 64553944, 0, 0, 0, 0,
|
||||
0, 0, 0, 92145022, 0, 0, 0, 0, 0, 0, 0, 0, 139593810, 0, 0,
|
||||
0, 0, },
|
||||
{ 65536, 0, 0, 0, 0, 0, 0, 0, 13172937, 0, 0, 0, 0, 0, 25297282, 0,
|
||||
0, 28901816, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
71500866, 0, 0, 0, 0, 82380008, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, },
|
||||
null,
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
94897574, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 2555943, 0, 0, 0, 0, 0, 0, 0, 15532269, 0, 0, 0, 0, 0, 0,
|
||||
0, 31785444, 34406924, 0, 0, 0, 0, 0, 40895088, 0, 0, 0,
|
||||
60228503, 0, 0, 0, 0, 0, 0, 0, 82445546, 0, 0, 0, 0, 0,
|
||||
115279583, 0, 0, 136054812, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 40239718, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 5046349, 0, 0, 10944679, 0, 13238474, 0, 15597806,
|
||||
16056565, 0, 20578618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, },
|
||||
null,
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
95225257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 196610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 8454273, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 46072511, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 2687016, 0, 0, 0, 0, 0, 13304011, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 31850982, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
null,
|
||||
null,
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
34472462, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 95290798, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 5111886, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
34603535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 105776718, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 8585346, 0, 11075752, 0, 0, 0, 0, 16187638, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28508594, 0, 0,
|
||||
0, 0, 0, 0, 0, 40305255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
95421871, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ 0, 0, 0, 5177423, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ 327684, 1900571, 2949162, 5374032, 8716420, 0, 11206826,
|
||||
12517566, 13435084, 0, 15663343, 16515320, 19988785,
|
||||
20644155, 25428355, 27197855, 0, 29163962, 31916519,
|
||||
34734609, 36045347, 0, 0, 0, 40436328, 40960625, 41615994,
|
||||
46596800, 54264627, 60556184, 64750554, 68879387, 71763012,
|
||||
75826303, 77268122, 0, 81462490, 83952875, 92865919,
|
||||
96142769, 105973327, 110167691, 0, 116917984, 121833283,
|
||||
132253665, 136251421, 140707923, 0, 0, 144574620,
|
||||
145361066, },
|
||||
{ 393222, 0, 0, 0, 0, 0, 11272364, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 36176423, 38535756, 0, 0, 0, 0, 41681532, 46727880,
|
||||
0, 60687261, 0, 0, 71828552, 75891846, 0, 0, 0, 84411650,
|
||||
0, 96404924, 0, 0, 0, 117376761, 121898820, 132319203,
|
||||
136382496, 0, 0, 0, 0, 0, },
|
||||
{ 589831, 1966110, 3276846, 5505107, 8978566, 10420383, 11468973,
|
||||
12583104, 13631694, 15139046, 15794416, 16711933, 20054322,
|
||||
20840764, 25624965, 27263392, 0, 29360574, 32244200,
|
||||
34931219, 36373033, 38601293, 39584348, 0, 40567402,
|
||||
41091698, 42205821, 46858954, 54723389, 60818335, 65143773,
|
||||
68944924, 71959625, 75957383, 77530268, 80938194, 81593564,
|
||||
84739337, 92997002, 96863680, 106235474, 110233234, 0,
|
||||
117704448, 122816325, 132515812, 136579106, 140773476,
|
||||
142149753, 143001732, 144705695, 145492139, },
|
||||
{ 0, 0, 3342387, 0, 9044106, 0, 11534512, 0, 13697233, 0, 0, 0, 0,
|
||||
0, 25690504, 0, 0, 0, 0, 0, 36438572, 38732366, 0, 0, 0,
|
||||
41157236, 0, 46924492, 54788932, 61080481, 65209315, 0,
|
||||
72025163, 0, 0, 0, 0, 85132558, 93062540, 96929223,
|
||||
106563158, 0, 0, 118032133, 123012947, 132581351,
|
||||
136775717, 140839013, 0, 143067271, 0, 145557677, },
|
||||
{ 0, 2162719, 3473460, 5636181, 0, 0, 0, 0, 0, 0, 0, 18809088,
|
||||
20185395, 21299519, 0, 0, 0, 29622721, 0, 0, 0, 39256656,
|
||||
39649885, 0, 0, 41288309, 42336901, 47448781, 55182149,
|
||||
61342629, 65274852, 69010461, 72811596, 76219528, 77726880,
|
||||
0, 0, 86967572, 93128077, 97650120, 106628699, 110560915,
|
||||
0, 118490890, 123733846, 132646888, 0, 141232230,
|
||||
142411898, 0, 144836769, 145688750, },
|
||||
{ 655370, 2228258, 3538998, 5701719, 9109643, 10485920, 11600049,
|
||||
12648641, 13762770, 15204584, 15859954, 18874656, 20250933,
|
||||
21365062, 25756041, 27328929, 28574132, 29688261, 32309741,
|
||||
34996758, 36504109, 39322200, 39715422, 39912033, 40632940,
|
||||
41353847, 42467975, 47514325, 55247691, 61473705, 65405925,
|
||||
69272606, 72877144, 76285068, 77857955, 81003732, 81659102,
|
||||
87164208, 93193614, 97715667, 106759772, 110626456,
|
||||
114296528, 118687505, 123864929, 132712425, 136906792,
|
||||
141297772, 142477438, 143132808, 144902307, 145754288, },
|
||||
{ 786443, 0, 0, 0, 9240716, 0, 11665586, 0, 13893843, 0, 0, 0, 0,
|
||||
0, 25887114, 0, 0, 0, 0, 0, 36635182, 0, 0, 0, 0, 0,
|
||||
42599049, 0, 0, 0, 65733607, 0, 73008217, 0, 77989029, 0,
|
||||
81724639, 87295283, 0, 98305492, 107021918, 0, 0, 0, 0, 0,
|
||||
137037866, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 3604535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27394466, 0,
|
||||
29753798, 32571886, 35258903, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
55509836, 61604779, 0, 0, 0, 0, 0, 0, 81790176, 87557429,
|
||||
93259151, 98502109, 107152994, 110888601, 0, 119015188,
|
||||
124323683, 133498858, 137234476, 0, 0, 143263881, 0,
|
||||
145819825, },
|
||||
{ 0, 0, 3866680, 6160472, 0, 10616993, 0, 12714178, 0, 0, 0, 0,
|
||||
20316470, 0, 0, 27460003, 0, 31261127, 32637426, 35521051,
|
||||
0, 0, 0, 39977570, 0, 0, 0, 48366294, 56492880, 62391213,
|
||||
0, 69338146, 73073755, 0, 78316711, 0, 0, 0, 93980048,
|
||||
98764256, 107218532, 111085213, 114362065, 119736089,
|
||||
125241194, 133957622, 0, 0, 0, 143329419, 144967844,
|
||||
145885362, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 62456761, 0, 69403683, 73139292, 0,
|
||||
78382252, 0, 81855713, 87622969, 0, 98829796, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 48431843, 0, 0, 0, 0, 0, 76416141, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 851981, 0, 4063292, 0, 9306254, 0, 0, 0, 0, 0, 0, 19005729, 0, 0,
|
||||
0, 27525540, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42795659,
|
||||
49152740, 56623967, 62587834, 66061292, 69600292, 73401437,
|
||||
0, 0, 0, 0, 87950650, 94111131, 99878373, 107546213,
|
||||
112002720, 0, 119932708, 125306744, 0, 137496623,
|
||||
141363309, 0, 143460492, 0, 0, },
|
||||
{ 917518, 0, 0, 0, 9502863, 0, 0, 0, 14155989, 0, 0, 19071267, 0,
|
||||
0, 26083724, 0, 0, 0, 32702963, 0, 36700720, 0, 0, 0, 0, 0,
|
||||
43057806, 0, 0, 0, 66520049, 0, 0, 0, 78841005, 81069269,
|
||||
0, 88147263, 0, 99943925, 107873898, 112068270, 0,
|
||||
120063783, 125831033, 0, 137693235, 0, 0, 143526030, 0, 0, },
|
||||
{ 983055, 0, 0, 0, 0, 0, 0, 0, 14483673, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 37093937, 0, 0, 0, 0, 0, 44565138, 49349359, 0, 0,
|
||||
66651128, 69665831, 73860193, 0, 79561908, 0, 0, 88606018,
|
||||
94176669, 0, 0, 0, 0, 120129321, 0, 0, 0, 141494382, 0,
|
||||
143591567, 0, 0, },
|
||||
{ 1114128, 2293795, 4587583, 8257631, 9633938, 10813603, 11731123,
|
||||
12845251, 14680286, 15270121, 15925491, 19661092, 20382007,
|
||||
24969543, 26149263, 27656613, 28639669, 31392222, 32768500,
|
||||
35586591, 37225015, 39387737, 39780959, 40043107, 40698477,
|
||||
41419384, 44696233, 52495090, 57738081, 63439804, 66782202,
|
||||
69927976, 73925736, 76809359, 79824063, 81134806, 81921250,
|
||||
89785673, 94307742, 100795894, 107939439, 112330415,
|
||||
114427602, 120588074, 126158721, 134416381, 137824310,
|
||||
141559920, 142542975, 143853712, 145033381, 145950899, },
|
||||
{ 1179666, 0, 0, 0, 9699476, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26280336,
|
||||
0, 0, 0, 0, 0, 38076985, 0, 0, 0, 0, 0, 45220523, 52560674,
|
||||
0, 0, 67175420, 69993516, 0, 0, 79889603, 0, 0, 89916763,
|
||||
94373280, 101451267, 108136048, 0, 114493139, 120784689,
|
||||
126355334, 134481924, 138414136, 141625457, 142608512, 0,
|
||||
0, 0, },
|
||||
{ 0, 0, 0, 0, 9896085, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
33292789, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67830786, 0, 0,
|
||||
0, 80020676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127403913, 0, 0, 0,
|
||||
0, 0, 0, 0, },
|
||||
{ 1310739, 2359332, 4653127, 0, 0, 0, 12189876, 0, 0, 0, 0, 0, 0,
|
||||
0, 26345874, 28246439, 0, 31457760, 0, 35652128, 38142534,
|
||||
0, 0, 0, 0, 0, 45351603, 52757283, 57869170, 63636425,
|
||||
67961868, 71304237, 73991273, 0, 0, 0, 0, 90309981, 0,
|
||||
101910029, 108988019, 114034355, 0, 120850228, 127469465,
|
||||
135464965, 138741825, 141690994, 142739585, 143984788, 0,
|
||||
0, },
|
||||
{ 1441813, 2424869, 4718664, 8388735, 10027160, 10879142, 12255419,
|
||||
12976325, 14745825, 15401194, 15991028, 19857709, 20447544,
|
||||
25035134, 26542483, 28377520, 28705206, 31588833, 33358333,
|
||||
35783201, 38208071, 39453274, 39846496, 40108644, 40764014,
|
||||
41484921, 45613749, 53216038, 58196852, 63898572, 68158478,
|
||||
71369793, 74253418, 77005973, 80479430, 81265879, 81986787,
|
||||
90965347, 94504353, 103679508, 109250176, 114165453,
|
||||
114558676, 121243445, 127731610, 135727124, 138807366,
|
||||
142018675, 142805123, 144115862, 145098918, 146016436, },
|
||||
{ 1572887, 0, 0, 0, 10092698, 0, 12320956, 0, 14811362, 0, 0,
|
||||
19923248, 0, 25166207, 26739094, 0, 0, 0, 33423870, 0,
|
||||
38273608, 0, 0, 0, 0, 0, 45744825, 0, 58262393, 64095184,
|
||||
68355089, 0, 75170926, 0, 80610509, 0, 0, 91817325, 0,
|
||||
104203823, 109512324, 0, 0, 121636667, 128059294, 0,
|
||||
139069511, 0, 0, 0, 0, 0, },
|
||||
{ 1703961, 2490406, 4849737, 0, 10223771, 0, 0, 13107399, 15007971,
|
||||
15466732, 0, 0, 20513081, 25231745, 26870169, 0, 0,
|
||||
31654371, 34275839, 0, 38404681, 0, 0, 0, 40829551, 0,
|
||||
45875899, 53609261, 59900794, 64226259, 68551700, 0, 0, 0,
|
||||
80807119, 81331417, 0, 91948410, 94700963, 104465975,
|
||||
109643400, 114230991, 114951893, 121702209, 131663779, 0,
|
||||
139266123, 0, 0, 144246936, 145295527, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27132315, 0, 0, 0, 0,
|
||||
0, 0, 39518811, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75302012, 0,
|
||||
0, 0, 0, 92079484, 0, 105383483, 109708938, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 144312474, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 46006973, 0, 60031891, 64291797, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 105711177, 0, 0, 0, 0, 131991514, 135923736,
|
||||
139331662, 0, 0, 144378011, 0, 146147509, },
|
||||
{ 0, 0, 0, 0, 10354845, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68813847, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 121767746, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 60097429, 0, 0, 0, 0, 77137048, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 64422870, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 132122591, 0, 0, 142084216, 0, 0, 0, 0, }, };
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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 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 {
|
||||
|
||||
// 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 offset, int length, Interner interner) {
|
||||
return new String(buf, offset, length).intern();
|
||||
}
|
||||
|
||||
public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length
|
||||
// CPPONLY: , TreeBuilder treeBuilder
|
||||
) {
|
||||
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();
|
||||
}
|
||||
|
||||
public static @Local String newLocalFromLocal(@Local String local, Interner interner) {
|
||||
return local;
|
||||
}
|
||||
|
||||
// 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 offset, int length) {
|
||||
if (local.length() != length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (local.charAt(i) != buf[offset + 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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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;
|
||||
|
||||
public class PushedLocation {
|
||||
private final int line;
|
||||
|
||||
private final int linePrev;
|
||||
|
||||
private final int col;
|
||||
|
||||
private final int colPrev;
|
||||
|
||||
private final boolean nextCharOnNewLine;
|
||||
|
||||
private final String publicId;
|
||||
|
||||
private final String systemId;
|
||||
|
||||
private final PushedLocation next;
|
||||
|
||||
/**
|
||||
* @param line
|
||||
* @param linePrev
|
||||
* @param col
|
||||
* @param colPrev
|
||||
* @param nextCharOnNewLine
|
||||
* @param publicId
|
||||
* @param systemId
|
||||
* @param next
|
||||
*/
|
||||
public PushedLocation(int line, int linePrev, int col, int colPrev,
|
||||
boolean nextCharOnNewLine, String publicId, String systemId,
|
||||
PushedLocation next) {
|
||||
this.line = line;
|
||||
this.linePrev = linePrev;
|
||||
this.col = col;
|
||||
this.colPrev = colPrev;
|
||||
this.nextCharOnNewLine = nextCharOnNewLine;
|
||||
this.publicId = publicId;
|
||||
this.systemId = systemId;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line.
|
||||
*
|
||||
* @return the line
|
||||
*/
|
||||
public int getLine() {
|
||||
return line;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the linePrev.
|
||||
*
|
||||
* @return the linePrev
|
||||
*/
|
||||
public int getLinePrev() {
|
||||
return linePrev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the col.
|
||||
*
|
||||
* @return the col
|
||||
*/
|
||||
public int getCol() {
|
||||
return col;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the colPrev.
|
||||
*
|
||||
* @return the colPrev
|
||||
*/
|
||||
public int getColPrev() {
|
||||
return colPrev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nextCharOnNewLine.
|
||||
*
|
||||
* @return the nextCharOnNewLine
|
||||
*/
|
||||
public boolean isNextCharOnNewLine() {
|
||||
return nextCharOnNewLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the publicId.
|
||||
*
|
||||
* @return the publicId
|
||||
*/
|
||||
public String getPublicId() {
|
||||
return publicId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the systemId.
|
||||
*
|
||||
* @return the systemId
|
||||
*/
|
||||
public String getSystemId() {
|
||||
return systemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next.
|
||||
*
|
||||
* @return the next
|
||||
*/
|
||||
public PushedLocation getNext() {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* 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> {
|
||||
final int flags;
|
||||
|
||||
final @Local String name;
|
||||
|
||||
final @Local String popName;
|
||||
|
||||
final @NsUri String ns;
|
||||
|
||||
final T node;
|
||||
|
||||
// Only used on the list of formatting elements
|
||||
HtmlAttributes attributes;
|
||||
|
||||
private int refcount = 1;
|
||||
|
||||
// [NOCPP[
|
||||
|
||||
private final 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]
|
||||
|
||||
/**
|
||||
* Constructor for copying. This doesn't take another <code>StackNode</code>
|
||||
* because in C++ the caller is reponsible for reobtaining the local names
|
||||
* from another interner.
|
||||
*
|
||||
* @param flags
|
||||
* @param ns
|
||||
* @param name
|
||||
* @param node
|
||||
* @param popName
|
||||
* @param attributes
|
||||
*/
|
||||
StackNode(int flags, @NsUri String ns, @Local String name, T node,
|
||||
@Local String popName, HtmlAttributes attributes
|
||||
// [NOCPP[
|
||||
, TaintableLocatorImpl locator
|
||||
// ]NOCPP]
|
||||
) {
|
||||
this.flags = flags;
|
||||
this.name = name;
|
||||
this.popName = popName;
|
||||
this.ns = ns;
|
||||
this.node = node;
|
||||
this.attributes = attributes;
|
||||
this.refcount = 1;
|
||||
// [NOCPP[
|
||||
this.locator = locator;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* Short hand for well-known HTML elements.
|
||||
*
|
||||
* @param elementName
|
||||
* @param node
|
||||
*/
|
||||
StackNode(ElementName elementName, T node
|
||||
// [NOCPP[
|
||||
, TaintableLocatorImpl locator
|
||||
// ]NOCPP]
|
||||
) {
|
||||
this.flags = elementName.getFlags();
|
||||
this.name = elementName.name;
|
||||
this.popName = elementName.name;
|
||||
this.ns = "http://www.w3.org/1999/xhtml";
|
||||
this.node = node;
|
||||
this.attributes = null;
|
||||
this.refcount = 1;
|
||||
assert !elementName.isCustom() : "Don't use this constructor for custom elements.";
|
||||
// [NOCPP[
|
||||
this.locator = locator;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for HTML formatting elements.
|
||||
*
|
||||
* @param elementName
|
||||
* @param node
|
||||
* @param attributes
|
||||
*/
|
||||
StackNode(ElementName elementName, T node, HtmlAttributes attributes
|
||||
// [NOCPP[
|
||||
, TaintableLocatorImpl locator
|
||||
// ]NOCPP]
|
||||
) {
|
||||
this.flags = elementName.getFlags();
|
||||
this.name = elementName.name;
|
||||
this.popName = elementName.name;
|
||||
this.ns = "http://www.w3.org/1999/xhtml";
|
||||
this.node = node;
|
||||
this.attributes = attributes;
|
||||
this.refcount = 1;
|
||||
assert !elementName.isCustom() : "Don't use this constructor for custom elements.";
|
||||
// [NOCPP[
|
||||
this.locator = locator;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* The common-case HTML constructor.
|
||||
*
|
||||
* @param elementName
|
||||
* @param node
|
||||
* @param popName
|
||||
*/
|
||||
StackNode(ElementName elementName, T node, @Local String popName
|
||||
// [NOCPP[
|
||||
, TaintableLocatorImpl locator
|
||||
// ]NOCPP]
|
||||
) {
|
||||
this.flags = elementName.getFlags();
|
||||
this.name = elementName.name;
|
||||
this.popName = popName;
|
||||
this.ns = "http://www.w3.org/1999/xhtml";
|
||||
this.node = node;
|
||||
this.attributes = null;
|
||||
this.refcount = 1;
|
||||
// [NOCPP[
|
||||
this.locator = locator;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for SVG elements. Note that the order of the arguments is
|
||||
* what distinguishes this from the HTML constructor. 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
|
||||
*/
|
||||
StackNode(ElementName elementName, @Local String popName, T node
|
||||
// [NOCPP[
|
||||
, TaintableLocatorImpl locator
|
||||
// ]NOCPP]
|
||||
) {
|
||||
this.flags = prepareSvgFlags(elementName.getFlags());
|
||||
this.name = elementName.name;
|
||||
this.popName = popName;
|
||||
this.ns = "http://www.w3.org/2000/svg";
|
||||
this.node = node;
|
||||
this.attributes = null;
|
||||
this.refcount = 1;
|
||||
// [NOCPP[
|
||||
this.locator = locator;
|
||||
// ]NOCPP]
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for MathML.
|
||||
*
|
||||
* @param elementName
|
||||
* @param node
|
||||
* @param popName
|
||||
* @param markAsIntegrationPoint
|
||||
*/
|
||||
StackNode(ElementName elementName, T node, @Local String popName,
|
||||
boolean markAsIntegrationPoint
|
||||
// [NOCPP[
|
||||
, TaintableLocatorImpl locator
|
||||
// ]NOCPP]
|
||||
) {
|
||||
this.flags = prepareMathFlags(elementName.getFlags(),
|
||||
markAsIntegrationPoint);
|
||||
this.name = elementName.name;
|
||||
this.popName = popName;
|
||||
this.ns = "http://www.w3.org/1998/Math/MathML";
|
||||
this.node = node;
|
||||
this.attributes = null;
|
||||
this.refcount = 1;
|
||||
// [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() {
|
||||
Portability.delete(attributes);
|
||||
}
|
||||
|
||||
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() {
|
||||
refcount--;
|
||||
if (refcount == 0) {
|
||||
Portability.delete(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* 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 T deepTreeSurrogateParent;
|
||||
|
||||
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, T deepTreeSurrogateParent, 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.deepTreeSurrogateParent = deepTreeSurrogateParent;
|
||||
this.mode = mode;
|
||||
this.originalMode = originalMode;
|
||||
this.framesetOk = framesetOk;
|
||||
this.needToDropLF = needToDropLF;
|
||||
this.quirks = quirks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
|
||||
*/
|
||||
public StackNode<T>[] getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
|
||||
*/
|
||||
public int[] getTemplateModeStack() {
|
||||
return templateModeStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
|
||||
*/
|
||||
public StackNode<T>[] getListOfActiveFormattingElements() {
|
||||
return listOfActiveFormattingElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
|
||||
*/
|
||||
public T getFormPointer() {
|
||||
return formPointer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the headPointer.
|
||||
*
|
||||
* @return the headPointer
|
||||
*/
|
||||
public T getHeadPointer() {
|
||||
return headPointer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the deepTreeSurrogateParent.
|
||||
*
|
||||
* @return the deepTreeSurrogateParent
|
||||
*/
|
||||
public T getDeepTreeSurrogateParent() {
|
||||
return deepTreeSurrogateParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mode.
|
||||
*
|
||||
* @return the mode
|
||||
*/
|
||||
public int getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the originalMode.
|
||||
*
|
||||
* @return the originalMode
|
||||
*/
|
||||
public int getOriginalMode() {
|
||||
return originalMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the framesetOk.
|
||||
*
|
||||
* @return the framesetOk
|
||||
*/
|
||||
public boolean isFramesetOk() {
|
||||
return framesetOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the needToDropLF.
|
||||
*
|
||||
* @return the needToDropLF
|
||||
*/
|
||||
public boolean isNeedToDropLF() {
|
||||
return needToDropLF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quirks.
|
||||
*
|
||||
* @return the quirks
|
||||
*/
|
||||
public boolean isQuirks() {
|
||||
return quirks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
|
||||
*/
|
||||
public int getListOfActiveFormattingElementsLength() {
|
||||
return listOfActiveFormattingElements.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
|
||||
*/
|
||||
public int getStackLength() {
|
||||
return stack.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
|
||||
*/
|
||||
public int getTemplateModeStackLength() {
|
||||
return templateModeStack.length;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") private void destructor() {
|
||||
for (int i = 0; i < stack.length; i++) {
|
||||
stack[i].release();
|
||||
}
|
||||
for (int i = 0; i < listOfActiveFormattingElements.length; i++) {
|
||||
if (listOfActiveFormattingElements[i] != null) {
|
||||
listOfActiveFormattingElements[i].release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 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 org.xml.sax.Locator;
|
||||
|
||||
public class TaintableLocatorImpl extends LocatorImpl {
|
||||
|
||||
private boolean tainted;
|
||||
|
||||
public TaintableLocatorImpl(Locator locator) {
|
||||
super(locator);
|
||||
this.tainted = false;
|
||||
}
|
||||
|
||||
public void markTainted() {
|
||||
tainted = true;
|
||||
}
|
||||
|
||||
public boolean isTainted() {
|
||||
return tainted;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user