@@ -42,7 +42,7 @@ final class Lexer implements Closeable {
4242 private static final String LF_STRING = Character .toString (LF );
4343
4444 /**
45- * Constant char to use for disabling comments, escapes and encapsulation. The value -2 is used because it
45+ * Constant char to use for disabling comments, escapes, and encapsulation. The value -2 is used because it
4646 * won't be confused with an EOF signal (-1), and because the Unicode value {@code FFFE} would be encoded as two
4747 * chars (using surrogates) and thus there should never be a collision with a real text char.
4848 */
@@ -146,9 +146,9 @@ boolean isDelimiter(final int ch) throws IOException {
146146 }
147147
148148 /**
149- * Tests if the given character indicates end of file.
149+ * Tests if the given character indicates the end of the file.
150150 *
151- * @return true if the given character indicates end of file.
151+ * @return true if the given character indicates the end of the file.
152152 */
153153 boolean isEndOfFile (final int ch ) {
154154 return ch == END_OF_STREAM ;
@@ -168,7 +168,7 @@ boolean isEscape(final int ch) {
168168 *
169169 * For example, for delimiter "[|]" and escape '!', return true if the next characters constitute "![!|!]".
170170 *
171- * @return true if the next characters constitute a escape delimiter.
171+ * @return true if the next characters constitute an escape delimiter.
172172 * @throws IOException If an I/O error occurs.
173173 */
174174 boolean isEscapeDelimiter () throws IOException {
@@ -194,7 +194,7 @@ boolean isQuoteChar(final int ch) {
194194 }
195195
196196 /**
197- * Tests if the current character represents the start of a line: a CR, LF or is at the start of the file.
197+ * Tests if the current character represents the start of a line: a CR, LF, or is at the start of the file.
198198 *
199199 * @param ch the character to check
200200 * @return true if the character is at the start of a line.
@@ -214,13 +214,13 @@ private char mapNullToDisabled(final Character c) {
214214 * </p>
215215 *
216216 * @param token
217- * an existing Token object to reuse. The caller is responsible to initialize the Token.
217+ * an existing Token object to reuse. The caller is responsible for initializing the Token.
218218 * @return the next token found.
219219 * @throws IOException on stream access error.
220220 */
221221 Token nextToken (final Token token ) throws IOException {
222222
223- // get the last read char (required for empty line detection)
223+ // Get the last read char (required for empty line detection)
224224 int lastChar = reader .getLastChar ();
225225
226226 // read the next char and set eol
@@ -234,11 +234,11 @@ Token nextToken(final Token token) throws IOException {
234234 // empty line detection: eol AND (last char was EOL or beginning)
235235 if (ignoreEmptyLines ) {
236236 while (eol && isStartOfLine (lastChar )) {
237- // go on char ahead ...
237+ // Go on char ahead ...
238238 lastChar = c ;
239239 c = reader .read ();
240240 eol = readEndOfLine (c );
241- // reached end of file without any content (empty line at the end)
241+ // reached the end of the file without any content (empty line at the end)
242242 if (isEndOfFile (c )) {
243243 token .type = EOF ;
244244 // don't set token.isReady here because no content
@@ -247,7 +247,7 @@ Token nextToken(final Token token) throws IOException {
247247 }
248248 }
249249
250- // did we reach eof during the last iteration already ? EOF
250+ // Did we reach EOF during the last iteration already? EOF
251251 if (isEndOfFile (lastChar ) || !isLastTokenDelimiter && isEndOfFile (c )) {
252252 token .type = EOF ;
253253 // don't set token.isReady here because no content
@@ -267,7 +267,7 @@ Token nextToken(final Token token) throws IOException {
267267 return token ;
268268 }
269269
270- // important : make sure a new char gets consumed in each iteration
270+ // Important : make sure a new char gets consumed in each iteration
271271 while (token .type == INVALID ) {
272272 // ignore whitespaces at beginning of a token
273273 if (ignoreSurroundingSpaces ) {
@@ -305,12 +305,12 @@ Token nextToken(final Token token) throws IOException {
305305 /**
306306 * Parses an encapsulated token.
307307 * <p>
308- * Encapsulated tokens are surrounded by the given encapsulating- string. The encapsulator itself might be included
308+ * Encapsulated tokens are surrounded by the given encapsulating string. The encapsulator itself might be included
309309 * in the token using a doubling syntax (as "", '') or using escaping (as in \", \'). Whitespaces before and after
310- * an encapsulated token are ignored. The token is finished when one of the following conditions become true:
310+ * an encapsulated token is ignored. The token is finished when one of the following conditions becomes true:
311311 * </p>
312312 * <ul>
313- * <li>an unescaped encapsulator has been reached, and is followed by optional whitespace then:</li>
313+ * <li>An unescaped encapsulator has been reached and is followed by optional whitespace then:</li>
314314 * <ul>
315315 * <li>delimiter (TOKEN)</li>
316316 * <li>end of line (EORECORD)</li>
@@ -321,11 +321,12 @@ Token nextToken(final Token token) throws IOException {
321321 * the current token
322322 * @return a valid token object
323323 * @throws IOException
324- * on invalid state: EOF before closing encapsulator or invalid character before delimiter or EOL
324+ * Thrown when in an invalid state: EOF before closing encapsulator or invalid character before
325+ * delimiter or EOL.
325326 */
326327 private Token parseEncapsulatedToken (final Token token ) throws IOException {
327328 token .isQuoted = true ;
328- // save current line number in case needed for IOE
329+ // Save current line number in case needed for IOE
329330 final long startLineNumber = getCurrentLineNumber ();
330331 int c ;
331332 while (true ) {
@@ -385,13 +386,13 @@ private Token parseEncapsulatedToken(final Token token) throws IOException {
385386 /**
386387 * Parses a simple token.
387388 * <p>
388- * Simple token are tokens which are not surrounded by encapsulators. A simple token might contain escaped
389- * delimiters (as \, or \;). The token is finished when one of the following conditions become true:
389+ * Simple tokens are tokens that are not surrounded by encapsulators. A simple token might contain escaped
390+ * delimiters (as \, or \;). The token is finished when one of the following conditions becomes true:
390391 * </p>
391392 * <ul>
392- * <li>end of line has been reached (EORECORD)</li>
393- * <li>end of stream has been reached (EOF)</li>
394- * <li>an unescaped delimiter has been reached (TOKEN)</li>
393+ * <li>The end of line has been reached (EORECORD)</li>
394+ * <li>The end of stream has been reached (EOF)</li>
395+ * <li>An unescaped delimiter has been reached (TOKEN)</li>
395396 * </ul>
396397 *
397398 * @param token
0 commit comments