@@ -32,12 +32,19 @@ final class Lexer implements Closeable {
3232 private static final String CR_STRING = Character .toString (Constants .CR );
3333 private static final String LF_STRING = Character .toString (Constants .LF );
3434
35+ /**
36+ * Constant char to use for disabling comments, escapes, and encapsulation. The value -2 is used because it
37+ * won't be confused with an EOF signal (-1), and because the Unicode value {@code FFFE} would be encoded as two
38+ * chars (using surrogates) and thus there should never be a collision with a real text char.
39+ */
40+ private static final char DISABLED = '\ufffe' ;
41+
3542 private final char [] delimiter ;
3643 private final char [] delimiterBuf ;
3744 private final char [] escapeDelimiterBuf ;
38- private final int escape ;
39- private final int quoteChar ;
40- private final int commentStart ;
45+ private final char escape ;
46+ private final char quoteChar ;
47+ private final char commentStart ;
4148 private final boolean ignoreSurroundingSpaces ;
4249 private final boolean ignoreEmptyLines ;
4350 private final boolean lenientEof ;
@@ -190,8 +197,8 @@ boolean isStartOfLine(final int ch) {
190197 return ch == Constants .LF || ch == Constants .CR || ch == Constants .UNDEFINED ;
191198 }
192199
193- private int mapNullToDisabled (final Character c ) {
194- return c == null ? - 1 : c .charValue (); // Explicit unboxing is intentional
200+ private char mapNullToDisabled (final Character c ) {
201+ return c == null ? DISABLED : c .charValue (); // N.B. Explicit (un)boxing is intentional
195202 }
196203
197204 /**
@@ -505,5 +512,4 @@ void trimTrailingSpaces(final StringBuilder buffer) {
505512 buffer .setLength (length );
506513 }
507514 }
508-
509515}
0 commit comments