Skip to content

Commit 2aecfa0

Browse files
Fix checkstyle complaint about "modifying a control variable"
1 parent 2e76ca4 commit 2aecfa0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/org/sosy_lab/java_smt/basicimpl/Tokenizer.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ public static List<String> tokenize(String input) {
3636
boolean inQuoted = false;
3737

3838
int level = 0;
39+
int pos = 0;
3940

4041
StringBuilder token = new StringBuilder();
41-
for (int i = 0; i < input.length(); i++) {
42-
char c = input.charAt(i);
42+
while (pos < input.length()) {
43+
char c = input.charAt(pos);
4344
if (inComment) {
4445
if (c == '\n') {
4546
// End of a comment
@@ -57,7 +58,7 @@ public static List<String> tokenize(String input) {
5758
// We have a double quote: Check that it's not followed by another and actually closes
5859
// the string.
5960
Optional<Character> n =
60-
(i == input.length() - 1) ? Optional.empty() : Optional.of(input.charAt(i + 1));
61+
(pos == input.length() - 1) ? Optional.empty() : Optional.of(input.charAt(pos + 1));
6162
if (n.isEmpty() || n.orElseThrow() != '"') {
6263
// Close the string
6364
token.append(c);
@@ -66,7 +67,7 @@ public static List<String> tokenize(String input) {
6667
// Add both quotes to the token and skip one character ahead
6768
token.append(c);
6869
token.append(n.orElseThrow());
69-
i++;
70+
pos++;
7071
}
7172
} else {
7273
token.append(c);
@@ -128,6 +129,7 @@ public static List<String> tokenize(String input) {
128129
}
129130
}
130131
}
132+
pos++;
131133
}
132134
if (level != 0) {
133135
// Throw an exception if the brackets don't match

0 commit comments

Comments
 (0)