@@ -72,7 +72,7 @@ Token nextToken(final Token token) throws IOException {
7272 // reached end of file without any content (empty line at the end)
7373 if (isEndOfFile (c )) {
7474 token .type = EOF ;
75- // don't set tkn .isReady here because no content
75+ // don't set token .isReady here because no content
7676 return token ;
7777 }
7878 }
@@ -81,7 +81,7 @@ Token nextToken(final Token token) throws IOException {
8181 // did we reach eof during the last iteration already ? EOF
8282 if (isEndOfFile (lastChar ) || (!isDelimiter (lastChar ) && isEndOfFile (c ))) {
8383 token .type = EOF ;
84- // don't set tkn .isReady here because no content
84+ // don't set token .isReady here because no content
8585 return token ;
8686 }
8787
@@ -108,14 +108,14 @@ Token nextToken(final Token token) throws IOException {
108108 token .type = TOKEN ;
109109 } else if (eol ) {
110110 // empty token return EORECORD("")
111- // noop: tkn .content.append("");
111+ // noop: token .content.append("");
112112 token .type = EORECORD ;
113113 } else if (isQuoteChar (c )) {
114114 // consume encapsulated token
115115 parseEncapsulatedToken (token );
116116 } else if (isEndOfFile (c )) {
117117 // end of file return EOF()
118- // noop: tkn .content.append("");
118+ // noop: token .content.append("");
119119 token .type = EOF ;
120120 token .isReady = true ; // there is data at EOF
121121 } else {
@@ -138,46 +138,46 @@ Token nextToken(final Token token) throws IOException {
138138 * <li>an unescaped delimiter has been reached (TOKEN)</li>
139139 * </ul>
140140 *
141- * @param tkn
141+ * @param token
142142 * the current token
143143 * @param c
144144 * the current character
145145 * @return the filled token
146146 * @throws IOException
147147 * on stream access error
148148 */
149- private Token parseSimpleToken (final Token tkn , int c ) throws IOException {
150- // Faster to use while(true)+break than while(tkn .type == INVALID)
149+ private Token parseSimpleToken (final Token token , int c ) throws IOException {
150+ // Faster to use while(true)+break than while(token .type == INVALID)
151151 while (true ) {
152152 if (readEndOfLine (c )) {
153- tkn .type = EORECORD ;
153+ token .type = EORECORD ;
154154 break ;
155155 } else if (isEndOfFile (c )) {
156- tkn .type = EOF ;
157- tkn .isReady = true ; // There is data at EOF
156+ token .type = EOF ;
157+ token .isReady = true ; // There is data at EOF
158158 break ;
159159 } else if (isDelimiter (c )) {
160- tkn .type = TOKEN ;
160+ token .type = TOKEN ;
161161 break ;
162162 } else if (isEscape (c )) {
163163 final int unescaped = readEscape ();
164164 if (unescaped == Constants .END_OF_STREAM ) { // unexpected char after escape
165- tkn .content .append ((char ) c ).append ((char ) in .getLastChar ());
165+ token .content .append ((char ) c ).append ((char ) in .getLastChar ());
166166 } else {
167- tkn .content .append ((char ) unescaped );
167+ token .content .append ((char ) unescaped );
168168 }
169169 c = in .read (); // continue
170170 } else {
171- tkn .content .append ((char ) c );
171+ token .content .append ((char ) c );
172172 c = in .read (); // continue
173173 }
174174 }
175175
176176 if (ignoreSurroundingSpaces ) {
177- trimTrailingSpaces (tkn .content );
177+ trimTrailingSpaces (token .content );
178178 }
179179
180- return tkn ;
180+ return token ;
181181 }
182182
183183 /**
@@ -194,13 +194,13 @@ private Token parseSimpleToken(final Token tkn, int c) throws IOException {
194194 * </ul>
195195 * <li>end of stream has been reached (EOF)</li> </ul>
196196 *
197- * @param tkn
197+ * @param token
198198 * the current token
199199 * @return a valid token object
200200 * @throws IOException
201201 * on invalid state: EOF before closing encapsulator or invalid character before delimiter or EOL
202202 */
203- private Token parseEncapsulatedToken (final Token tkn ) throws IOException {
203+ private Token parseEncapsulatedToken (final Token token ) throws IOException {
204204 // save current line number in case needed for IOE
205205 final long startLineNumber = getCurrentLineNumber ();
206206 int c ;
@@ -210,29 +210,29 @@ private Token parseEncapsulatedToken(final Token tkn) throws IOException {
210210 if (isEscape (c )) {
211211 final int unescaped = readEscape ();
212212 if (unescaped == Constants .END_OF_STREAM ) { // unexpected char after escape
213- tkn .content .append ((char ) c ).append ((char ) in .getLastChar ());
213+ token .content .append ((char ) c ).append ((char ) in .getLastChar ());
214214 } else {
215- tkn .content .append ((char ) unescaped );
215+ token .content .append ((char ) unescaped );
216216 }
217217 } else if (isQuoteChar (c )) {
218218 if (isQuoteChar (in .lookAhead ())) {
219219 // double or escaped encapsulator -> add single encapsulator to token
220220 c = in .read ();
221- tkn .content .append ((char ) c );
221+ token .content .append ((char ) c );
222222 } else {
223223 // token finish mark (encapsulator) reached: ignore whitespace till delimiter
224224 while (true ) {
225225 c = in .read ();
226226 if (isDelimiter (c )) {
227- tkn .type = TOKEN ;
228- return tkn ;
227+ token .type = TOKEN ;
228+ return token ;
229229 } else if (isEndOfFile (c )) {
230- tkn .type = EOF ;
231- tkn .isReady = true ; // There is data at EOF
232- return tkn ;
230+ token .type = EOF ;
231+ token .isReady = true ; // There is data at EOF
232+ return token ;
233233 } else if (readEndOfLine (c )) {
234- tkn .type = EORECORD ;
235- return tkn ;
234+ token .type = EORECORD ;
235+ return token ;
236236 } else if (!isWhitespace (c )) {
237237 // error invalid char between token and next delimiter
238238 throw new IOException ("(line " + getCurrentLineNumber () +
@@ -246,7 +246,7 @@ private Token parseEncapsulatedToken(final Token tkn) throws IOException {
246246 ") EOF reached before encapsulated token finished" );
247247 } else {
248248 // consume character
249- tkn .content .append ((char ) c );
249+ token .content .append ((char ) c );
250250 }
251251 }
252252 }
0 commit comments