File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ Token nextToken(Token tkn) throws IOException {
4949 * is to call 'readAgain' on the stream...
5050 */
5151 int c = in .read ();
52+
53+ if ((lastChar == '\n' || lastChar == '\r' || lastChar == ExtendedBufferedReader .UNDEFINED ) && isCommentStart (c )) {
54+ in .readLine ();
55+ tkn .type = COMMENT ;
56+ return tkn ;
57+ }
58+
5259 boolean eol = isEndOfLine (c );
5360 c = in .readAgain ();
5461
@@ -86,12 +93,8 @@ Token nextToken(Token tkn) throws IOException {
8693 }
8794 }
8895
89- // ok, start of token reached: comment, encapsulated, or token
90- if (isCommentStart (c )) { // TODO should only match at start of line
91- // ignore everything till end of line and continue (incr linecount)
92- in .readLine ();
93- tkn .type = COMMENT ;
94- } else if (isDelimiter (c )) {
96+ // ok, start of token reached: encapsulated, or token
97+ if (isDelimiter (c )) {
9598 // empty token return TOKEN("")
9699 tkn .type = TOKEN ;
97100 } else if (eol ) {
You can’t perform that action at this time.
0 commit comments