forked from jasder/antlr
open visibility slightly so we can override to fix bugs etc...
This commit is contained in:
parent
bd8a367398
commit
2fbd297063
|
@ -20,13 +20,13 @@ import java.nio.charset.CodingErrorAction;
|
||||||
* intermediate representation, so this optimizes the common case of
|
* intermediate representation, so this optimizes the common case of
|
||||||
* decoding a UTF-8 file for parsing as Unicode code points.
|
* decoding a UTF-8 file for parsing as Unicode code points.
|
||||||
*/
|
*/
|
||||||
public final class UTF8CodePointDecoder {
|
public class UTF8CodePointDecoder {
|
||||||
private static final int SUBSTITUTION_CHARACTER = 0xFFFD;
|
private static final int SUBSTITUTION_CHARACTER = 0xFFFD;
|
||||||
private static final byte NVAL = (byte) 0xFF;
|
private static final byte NVAL = (byte) 0xFF;
|
||||||
|
|
||||||
// Table mapping UTF-8 leading byte to the length of the trailing
|
// Table mapping UTF-8 leading byte to the length of the trailing
|
||||||
// sequence.
|
// sequence.
|
||||||
private static final byte[] UTF8_LEADING_BYTE_LENGTHS = new byte[] {
|
protected static final byte[] UTF8_LEADING_BYTE_LENGTHS = new byte[] {
|
||||||
// [0x00, 0x7F] -> 0 trailing bytes
|
// [0x00, 0x7F] -> 0 trailing bytes
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
@ -74,17 +74,17 @@ public final class UTF8CodePointDecoder {
|
||||||
|
|
||||||
// Table mapping UTF-8 sequence length to valid Unicode code point
|
// Table mapping UTF-8 sequence length to valid Unicode code point
|
||||||
// ranges for that sequence length.
|
// ranges for that sequence length.
|
||||||
private static final Interval[] UTF8_VALID_INTERVALS = new Interval[] {
|
protected static final Interval[] UTF8_VALID_INTERVALS = new Interval[] {
|
||||||
Interval.of(0x00, 0x7F),
|
Interval.of(0x00, 0x7F),
|
||||||
Interval.of(0x80, 0x7FF),
|
Interval.of(0x80, 0x7FF),
|
||||||
Interval.of(0x800, 0xFFFF),
|
Interval.of(0x800, 0xFFFF),
|
||||||
Interval.of(0x10000, 0x10FFFF)
|
Interval.of(0x10000, 0x10FFFF)
|
||||||
};
|
};
|
||||||
|
|
||||||
private final CodingErrorAction decodingErrorAction;
|
protected final CodingErrorAction decodingErrorAction;
|
||||||
private int decodingTrailBytesNeeded;
|
protected int decodingTrailBytesNeeded;
|
||||||
private int decodingCurrentCodePoint;
|
protected int decodingCurrentCodePoint;
|
||||||
private Interval validDecodedCodePointRange;
|
protected Interval validDecodedCodePointRange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@link UTF8CodePointDecoder} with a specified
|
* Constructs a new {@link UTF8CodePointDecoder} with a specified
|
||||||
|
|
Loading…
Reference in New Issue