Rename end to pos, fix spelling, avoid new String()
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae43c2680a
commit
f0ef6dffb7
|
@ -70,7 +70,7 @@ import java.util.ListIterator;
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
* @author Gary D. Gregory
|
* @author Gary D. Gregory
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
* @version $Id: Tokenizer.java,v 1.8 2004/08/28 09:21:05 scolebourne Exp $
|
* @version $Id: Tokenizer.java,v 1.9 2004/08/28 11:46:19 scolebourne Exp $
|
||||||
*/
|
*/
|
||||||
public class Tokenizer implements ListIterator, Cloneable {
|
public class Tokenizer implements ListIterator, Cloneable {
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ public class Tokenizer implements ListIterator, Cloneable {
|
||||||
if (start == len && delim.isMatch(chars[start - 1])) {
|
if (start == len && delim.isMatch(chars[start - 1])) {
|
||||||
// Add the token, following the rules
|
// Add the token, following the rules
|
||||||
// in this object
|
// in this object
|
||||||
addToken(tokens, new String());
|
addToken(tokens, StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,12 +629,12 @@ public class Tokenizer implements ListIterator, Cloneable {
|
||||||
// Loop until we've found the end of the quoted
|
// Loop until we've found the end of the quoted
|
||||||
// string or the end of the input
|
// string or the end of the input
|
||||||
int cbufcnt = 0;
|
int cbufcnt = 0;
|
||||||
int end = start + 1;
|
int pos = start + 1;
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
boolean quoting = true;
|
boolean quoting = true;
|
||||||
int len = chars.length;
|
int len = chars.length;
|
||||||
|
|
||||||
while (end < len && !done) {
|
while (pos < len && !done) {
|
||||||
// Quoting mode can occur several times throughout
|
// Quoting mode can occur several times throughout
|
||||||
// a given string, so must switch between quoting
|
// a given string, so must switch between quoting
|
||||||
// and non-quoting until we encounter a non-quoted
|
// and non-quoting until we encounter a non-quoted
|
||||||
|
@ -645,21 +645,21 @@ public class Tokenizer implements ListIterator, Cloneable {
|
||||||
// followed by a second quote. If so, then we need
|
// followed by a second quote. If so, then we need
|
||||||
// to actually put the quote character into the token
|
// to actually put the quote character into the token
|
||||||
// rather than end the token.
|
// rather than end the token.
|
||||||
if (quote.isMatch(chars[end]) &&
|
if (quote.isMatch(chars[pos]) &&
|
||||||
end + 1 < len &&
|
pos + 1 < len &&
|
||||||
chars[end + 1] == chars[end]) {
|
chars[pos + 1] == chars[pos]) {
|
||||||
cbuf[cbufcnt++] = chars[end];
|
cbuf[cbufcnt++] = chars[pos];
|
||||||
end++;
|
pos++;
|
||||||
}
|
}
|
||||||
// End the quoting if we get to this condition
|
// End the quoting if we get to this condition
|
||||||
else if (quote.isMatch(chars[end])) {
|
else if (quote.isMatch(chars[pos])) {
|
||||||
quoting = false;
|
quoting = false;
|
||||||
}
|
}
|
||||||
// Otherwise, just put the character into the token
|
// Otherwise, just put the character into the token
|
||||||
else {
|
else {
|
||||||
cbuf[cbufcnt++] = chars[end];
|
cbuf[cbufcnt++] = chars[pos];
|
||||||
}
|
}
|
||||||
end++;
|
pos++;
|
||||||
}
|
}
|
||||||
// If we're not in quoting mode, if we encounter
|
// If we're not in quoting mode, if we encounter
|
||||||
// a delimiter, the token is ended. If we encounter
|
// a delimiter, the token is ended. If we encounter
|
||||||
|
@ -667,22 +667,22 @@ public class Tokenizer implements ListIterator, Cloneable {
|
||||||
// the character
|
// the character
|
||||||
else {
|
else {
|
||||||
// If we're
|
// If we're
|
||||||
if (delim.isMatch(chars[end])) {
|
if (delim.isMatch(chars[pos])) {
|
||||||
done = true;
|
done = true;
|
||||||
} else {
|
} else {
|
||||||
if (quote.isMatch(chars[end])) {
|
if (quote.isMatch(chars[pos])) {
|
||||||
quoting = true;
|
quoting = true;
|
||||||
} else {
|
} else {
|
||||||
cbuf[cbufcnt++] = chars[end];
|
cbuf[cbufcnt++] = chars[pos];
|
||||||
}
|
}
|
||||||
end++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
token.append(cbuf, 0, cbufcnt);
|
token.append(cbuf, 0, cbufcnt);
|
||||||
|
|
||||||
return end + 1;
|
return pos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -698,14 +698,14 @@ public class Tokenizer implements ListIterator, Cloneable {
|
||||||
int len = chars.length;
|
int len = chars.length;
|
||||||
// Skip ahead until we get to a delimiter character, or
|
// Skip ahead until we get to a delimiter character, or
|
||||||
// the end of the input
|
// the end of the input
|
||||||
int end = start + 1;
|
int pos = start + 1;
|
||||||
while (end < len && !delim.isMatch(chars[end])) {
|
while (pos < len && !delim.isMatch(chars[pos])) {
|
||||||
end++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
token.append(chars, start, Math.min(end, len) - start);
|
token.append(chars, start, Math.min(pos, len) - start);
|
||||||
|
|
||||||
return end + 1;
|
return pos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1001,7 +1001,7 @@ public class Tokenizer implements ListIterator, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not the given charatcer matches.
|
* Returns whether or not the given character matches.
|
||||||
*
|
*
|
||||||
* @param ch the character to match.
|
* @param ch the character to match.
|
||||||
* @return whether or not the given charatcer matches.
|
* @return whether or not the given charatcer matches.
|
||||||
|
|
Loading…
Reference in New Issue