Before r1397883, the Lexer operated only on char fields; it's now been
converted to use Character, which means that unboxing is needed.

Also, the Character fields need to be checked for null before use.

It has just occurred to me that there is a genuine illegal char value
for everything except the delimiter - that is, the delimiter itself.
It does not make sense for there to be no delimiter, nor does it make
sense for any other meta-character to be the same as the delimiter.

So rather than having

    Character escape;
...
    boolean isEscape(final int c) {
        return escape != null && c == escape.charValue();
    }

one could use the simpler (and more efficient)

    char escape;
...
    boolean isEscape(final int c) { // similarly for isEncapsulator etc.
        return escape != delimiter;
    }

This would have the added bonus of automatically disallowing delimiter
as the escape (or encapsulator etc.) because they would not be
recognised.
[At present the code does not check this]

The Lexer ctor would need to be changed to convert a null escape
Character (comment etc) to the delimiter.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to