We don't care if trailing LF has been consumed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1306797 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a5b76b6c20
commit
8462234502
|
@ -45,13 +45,13 @@ class CSVLexer extends Lexer {
|
||||||
|
|
||||||
// read the next char and set eol
|
// read the next char and set eol
|
||||||
int c = in.read();
|
int c = in.read();
|
||||||
|
/*
|
||||||
/* note: unfortunately isEndOfLine may consumes a character silently.
|
* Note:
|
||||||
* this has no effect outside of the method. so a simple workaround
|
* The following call will swallow LF if c == CR.
|
||||||
* is to call 'readAgain' on the stream...
|
* But we don't need to know if the last char
|
||||||
|
* was CR or LF - they are equivalent here.
|
||||||
*/
|
*/
|
||||||
boolean eol = isEndOfLine(c);
|
boolean eol = isEndOfLine(c);
|
||||||
c = in.readAgain();
|
|
||||||
|
|
||||||
// empty line detection: eol AND (last char was EOL or beginning)
|
// empty line detection: eol AND (last char was EOL or beginning)
|
||||||
if (emptyLinesIgnored) {
|
if (emptyLinesIgnored) {
|
||||||
|
@ -60,7 +60,6 @@ class CSVLexer extends Lexer {
|
||||||
lastChar = c;
|
lastChar = c;
|
||||||
c = in.read();
|
c = in.read();
|
||||||
eol = isEndOfLine(c);
|
eol = isEndOfLine(c);
|
||||||
c = in.readAgain();
|
|
||||||
// reached end of file without any content (empty line at the end)
|
// reached end of file without any content (empty line at the end)
|
||||||
if (isEndOfFile(c)) {
|
if (isEndOfFile(c)) {
|
||||||
tkn.type = EOF;
|
tkn.type = EOF;
|
||||||
|
|
Loading…
Reference in New Issue