CSV-70 Improve readability of CSVLexer
Simplify; remove while(true) loop git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1306079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c2cfeaf58
commit
ba26844c7b
|
@ -133,27 +133,21 @@ class CSVLexer extends Lexer {
|
|||
* @throws IOException on stream access error
|
||||
*/
|
||||
private Token simpleTokenLexer(Token tkn, int c) throws IOException {
|
||||
while (true) {
|
||||
while (tkn.type == INVALID) {
|
||||
if (isEndOfLine(c)) {
|
||||
// end of record
|
||||
tkn.type = EORECORD;
|
||||
break;
|
||||
} else if (isEndOfFile(c)) {
|
||||
// end of file
|
||||
tkn.type = EOF;
|
||||
tkn.isReady = true; // There is data at EOF
|
||||
break;
|
||||
} else if (isDelimiter(c)) {
|
||||
// end of token
|
||||
tkn.type = TOKEN;
|
||||
break;
|
||||
} else if (isEscape(c)) {
|
||||
tkn.content.append((char) readEscape());
|
||||
c = in.read(); // continue
|
||||
} else {
|
||||
tkn.content.append((char) c);
|
||||
c = in.read(); // continue
|
||||
}
|
||||
|
||||
c = in.read();
|
||||
}
|
||||
|
||||
if (surroundingSpacesIgnored) {
|
||||
|
|
Loading…
Reference in New Issue