From ba26844c7bca3e42036f626cd61de9d40550b76f Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Wed, 28 Mar 2012 00:34:27 +0000 Subject: [PATCH] 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 --- src/main/java/org/apache/commons/csv/CSVLexer.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVLexer.java b/src/main/java/org/apache/commons/csv/CSVLexer.java index cbff87d4..254933f0 100644 --- a/src/main/java/org/apache/commons/csv/CSVLexer.java +++ b/src/main/java/org/apache/commons/csv/CSVLexer.java @@ -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) {