1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

AjayKemparaj: Tabs to spaces and minor java code fixups

This commit is contained in:
ajayk 2012-01-13 13:10:10 +05:30
parent 6394d92279
commit 9420bb7e8b
9 changed files with 435 additions and 435 deletions

View file

@ -40,12 +40,12 @@ SOFTWARE.
*/
public class JSONTokener {
private int character;
private boolean eof;
private int index;
private int line;
private char previous;
private final Reader reader;
private int character;
private boolean eof;
private int index;
private int line;
private char previous;
private final Reader reader;
private boolean usePrevious;
@ -121,7 +121,7 @@ public class JSONTokener {
}
public boolean end() {
return this.eof && !this.usePrevious;
return this.eof && !this.usePrevious;
}
@ -148,31 +148,31 @@ public class JSONTokener {
public char next() throws JSONException {
int c;
if (this.usePrevious) {
this.usePrevious = false;
this.usePrevious = false;
c = this.previous;
} else {
try {
c = this.reader.read();
} catch (IOException exception) {
throw new JSONException(exception);
}
try {
c = this.reader.read();
} catch (IOException exception) {
throw new JSONException(exception);
}
if (c <= 0) { // End of stream
this.eof = true;
c = 0;
}
if (c <= 0) { // End of stream
this.eof = true;
c = 0;
}
}
this.index += 1;
if (this.previous == '\r') {
this.line += 1;
this.character = c == '\n' ? 0 : 1;
} else if (c == '\n') {
this.line += 1;
this.character = 0;
} else {
this.character += 1;
}
this.previous = (char) c;
this.index += 1;
if (this.previous == '\r') {
this.line += 1;
this.character = c == '\n' ? 0 : 1;
} else if (c == '\n') {
this.line += 1;
this.character = 0;
} else {
this.character += 1;
}
this.previous = (char) c;
return this.previous;
}
@ -283,8 +283,8 @@ public class JSONTokener {
case '\'':
case '\\':
case '/':
sb.append(c);
break;
sb.append(c);
break;
default:
throw this.syntaxError("Illegal escape.");
}
@ -383,7 +383,7 @@ public class JSONTokener {
this.back();
string = sb.toString().trim();
if (string.equals("")) {
if ("".equals(string)) {
throw this.syntaxError("Missing value");
}
return JSONObject.stringToValue(string);
@ -441,6 +441,6 @@ public class JSONTokener {
*/
public String toString() {
return " at " + this.index + " [character " + this.character + " line " +
this.line + "]";
this.line + "]";
}
}