mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
1061 lines
36 KiB
Java
1061 lines
36 KiB
Java
package com.airbnb.lottie.parser.moshi;
|
|
|
|
import com.airbnb.lottie.parser.moshi.JsonReader;
|
|
import java.io.EOFException;
|
|
import java.io.IOException;
|
|
import okio.Buffer;
|
|
import okio.BufferedSource;
|
|
import okio.ByteString;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public final class JsonUtf8Reader extends JsonReader {
|
|
private static final long MIN_INCOMPLETE_INTEGER = -922337203685477580L;
|
|
private static final int NUMBER_CHAR_DECIMAL = 3;
|
|
private static final int NUMBER_CHAR_DIGIT = 2;
|
|
private static final int NUMBER_CHAR_EXP_DIGIT = 7;
|
|
private static final int NUMBER_CHAR_EXP_E = 5;
|
|
private static final int NUMBER_CHAR_EXP_SIGN = 6;
|
|
private static final int NUMBER_CHAR_FRACTION_DIGIT = 4;
|
|
private static final int NUMBER_CHAR_NONE = 0;
|
|
private static final int NUMBER_CHAR_SIGN = 1;
|
|
private static final int PEEKED_BEGIN_ARRAY = 3;
|
|
private static final int PEEKED_BEGIN_OBJECT = 1;
|
|
private static final int PEEKED_BUFFERED = 11;
|
|
private static final int PEEKED_BUFFERED_NAME = 15;
|
|
private static final int PEEKED_DOUBLE_QUOTED = 9;
|
|
private static final int PEEKED_DOUBLE_QUOTED_NAME = 13;
|
|
private static final int PEEKED_END_ARRAY = 4;
|
|
private static final int PEEKED_END_OBJECT = 2;
|
|
private static final int PEEKED_EOF = 18;
|
|
private static final int PEEKED_FALSE = 6;
|
|
private static final int PEEKED_LONG = 16;
|
|
private static final int PEEKED_NONE = 0;
|
|
private static final int PEEKED_NULL = 7;
|
|
private static final int PEEKED_NUMBER = 17;
|
|
private static final int PEEKED_SINGLE_QUOTED = 8;
|
|
private static final int PEEKED_SINGLE_QUOTED_NAME = 12;
|
|
private static final int PEEKED_TRUE = 5;
|
|
private static final int PEEKED_UNQUOTED = 10;
|
|
private static final int PEEKED_UNQUOTED_NAME = 14;
|
|
private final Buffer buffer;
|
|
private int peeked = 0;
|
|
private long peekedLong;
|
|
private int peekedNumberLength;
|
|
private String peekedString;
|
|
private final BufferedSource source;
|
|
private static final ByteString SINGLE_QUOTE_OR_SLASH = ByteString.encodeUtf8("'\\");
|
|
private static final ByteString DOUBLE_QUOTE_OR_SLASH = ByteString.encodeUtf8("\"\\");
|
|
private static final ByteString UNQUOTED_STRING_TERMINALS = ByteString.encodeUtf8("{}[]:, \n\t\r\f/\\;#=");
|
|
private static final ByteString LINEFEED_OR_CARRIAGE_RETURN = ByteString.encodeUtf8("\n\r");
|
|
private static final ByteString CLOSING_BLOCK_COMMENT = ByteString.encodeUtf8("*/");
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public JsonUtf8Reader(BufferedSource bufferedSource) {
|
|
if (bufferedSource == null) {
|
|
throw new NullPointerException("source == null");
|
|
}
|
|
this.source = bufferedSource;
|
|
this.buffer = bufferedSource.getBufferField();
|
|
pushScope(6);
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public void beginArray() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 3) {
|
|
pushScope(1);
|
|
this.pathIndices[this.stackSize - 1] = 0;
|
|
this.peeked = 0;
|
|
return;
|
|
}
|
|
throw new JsonDataException("Expected BEGIN_ARRAY but was " + peek() + " at path " + getPath());
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public void endArray() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 4) {
|
|
this.stackSize--;
|
|
int[] iArr = this.pathIndices;
|
|
int i2 = this.stackSize - 1;
|
|
iArr[i2] = iArr[i2] + 1;
|
|
this.peeked = 0;
|
|
return;
|
|
}
|
|
throw new JsonDataException("Expected END_ARRAY but was " + peek() + " at path " + getPath());
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public void beginObject() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 1) {
|
|
pushScope(3);
|
|
this.peeked = 0;
|
|
return;
|
|
}
|
|
throw new JsonDataException("Expected BEGIN_OBJECT but was " + peek() + " at path " + getPath());
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public void endObject() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 2) {
|
|
this.stackSize--;
|
|
this.pathNames[this.stackSize] = null;
|
|
int[] iArr = this.pathIndices;
|
|
int i2 = this.stackSize - 1;
|
|
iArr[i2] = iArr[i2] + 1;
|
|
this.peeked = 0;
|
|
return;
|
|
}
|
|
throw new JsonDataException("Expected END_OBJECT but was " + peek() + " at path " + getPath());
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public boolean hasNext() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
return (i == 2 || i == 4 || i == 18) ? false : true;
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public JsonReader.Token peek() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
switch (i) {
|
|
case 1:
|
|
return JsonReader.Token.BEGIN_OBJECT;
|
|
case 2:
|
|
return JsonReader.Token.END_OBJECT;
|
|
case 3:
|
|
return JsonReader.Token.BEGIN_ARRAY;
|
|
case 4:
|
|
return JsonReader.Token.END_ARRAY;
|
|
case 5:
|
|
case 6:
|
|
return JsonReader.Token.BOOLEAN;
|
|
case 7:
|
|
return JsonReader.Token.NULL;
|
|
case 8:
|
|
case 9:
|
|
case 10:
|
|
case 11:
|
|
return JsonReader.Token.STRING;
|
|
case 12:
|
|
case 13:
|
|
case 14:
|
|
case 15:
|
|
return JsonReader.Token.NAME;
|
|
case 16:
|
|
case 17:
|
|
return JsonReader.Token.NUMBER;
|
|
case 18:
|
|
return JsonReader.Token.END_DOCUMENT;
|
|
default:
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
|
|
private int doPeek() throws IOException {
|
|
int i = this.scopes[this.stackSize - 1];
|
|
if (i == 1) {
|
|
this.scopes[this.stackSize - 1] = 2;
|
|
} else if (i == 2) {
|
|
int nextNonWhitespace = nextNonWhitespace(true);
|
|
this.buffer.readByte();
|
|
if (nextNonWhitespace != 44) {
|
|
if (nextNonWhitespace != 59) {
|
|
if (nextNonWhitespace != 93) {
|
|
throw syntaxError("Unterminated array");
|
|
}
|
|
this.peeked = 4;
|
|
return 4;
|
|
}
|
|
checkLenient();
|
|
}
|
|
} else {
|
|
if (i == 3 || i == 5) {
|
|
this.scopes[this.stackSize - 1] = 4;
|
|
if (i == 5) {
|
|
int nextNonWhitespace2 = nextNonWhitespace(true);
|
|
this.buffer.readByte();
|
|
if (nextNonWhitespace2 != 44) {
|
|
if (nextNonWhitespace2 != 59) {
|
|
if (nextNonWhitespace2 != 125) {
|
|
throw syntaxError("Unterminated object");
|
|
}
|
|
this.peeked = 2;
|
|
return 2;
|
|
}
|
|
checkLenient();
|
|
}
|
|
}
|
|
int nextNonWhitespace3 = nextNonWhitespace(true);
|
|
if (nextNonWhitespace3 == 34) {
|
|
this.buffer.readByte();
|
|
this.peeked = 13;
|
|
return 13;
|
|
}
|
|
if (nextNonWhitespace3 == 39) {
|
|
this.buffer.readByte();
|
|
checkLenient();
|
|
this.peeked = 12;
|
|
return 12;
|
|
}
|
|
if (nextNonWhitespace3 != 125) {
|
|
checkLenient();
|
|
if (!isLiteral((char) nextNonWhitespace3)) {
|
|
throw syntaxError("Expected name");
|
|
}
|
|
this.peeked = 14;
|
|
return 14;
|
|
}
|
|
if (i != 5) {
|
|
this.buffer.readByte();
|
|
this.peeked = 2;
|
|
return 2;
|
|
}
|
|
throw syntaxError("Expected name");
|
|
}
|
|
if (i == 4) {
|
|
this.scopes[this.stackSize - 1] = 5;
|
|
int nextNonWhitespace4 = nextNonWhitespace(true);
|
|
this.buffer.readByte();
|
|
if (nextNonWhitespace4 != 58) {
|
|
if (nextNonWhitespace4 == 61) {
|
|
checkLenient();
|
|
if (this.source.request(1L) && this.buffer.getByte(0L) == 62) {
|
|
this.buffer.readByte();
|
|
}
|
|
} else {
|
|
throw syntaxError("Expected ':'");
|
|
}
|
|
}
|
|
} else if (i == 6) {
|
|
this.scopes[this.stackSize - 1] = 7;
|
|
} else if (i == 7) {
|
|
if (nextNonWhitespace(false) == -1) {
|
|
this.peeked = 18;
|
|
return 18;
|
|
}
|
|
checkLenient();
|
|
} else if (i == 8) {
|
|
throw new IllegalStateException("JsonReader is closed");
|
|
}
|
|
}
|
|
int nextNonWhitespace5 = nextNonWhitespace(true);
|
|
if (nextNonWhitespace5 == 34) {
|
|
this.buffer.readByte();
|
|
this.peeked = 9;
|
|
return 9;
|
|
}
|
|
if (nextNonWhitespace5 == 39) {
|
|
checkLenient();
|
|
this.buffer.readByte();
|
|
this.peeked = 8;
|
|
return 8;
|
|
}
|
|
if (nextNonWhitespace5 != 44 && nextNonWhitespace5 != 59) {
|
|
if (nextNonWhitespace5 == 91) {
|
|
this.buffer.readByte();
|
|
this.peeked = 3;
|
|
return 3;
|
|
}
|
|
if (nextNonWhitespace5 != 93) {
|
|
if (nextNonWhitespace5 == 123) {
|
|
this.buffer.readByte();
|
|
this.peeked = 1;
|
|
return 1;
|
|
}
|
|
int peekKeyword = peekKeyword();
|
|
if (peekKeyword != 0) {
|
|
return peekKeyword;
|
|
}
|
|
int peekNumber = peekNumber();
|
|
if (peekNumber != 0) {
|
|
return peekNumber;
|
|
}
|
|
if (!isLiteral(this.buffer.getByte(0L))) {
|
|
throw syntaxError("Expected value");
|
|
}
|
|
checkLenient();
|
|
this.peeked = 10;
|
|
return 10;
|
|
}
|
|
if (i == 1) {
|
|
this.buffer.readByte();
|
|
this.peeked = 4;
|
|
return 4;
|
|
}
|
|
}
|
|
if (i == 1 || i == 2) {
|
|
checkLenient();
|
|
this.peeked = 7;
|
|
return 7;
|
|
}
|
|
throw syntaxError("Unexpected value");
|
|
}
|
|
|
|
private int peekKeyword() throws IOException {
|
|
String str;
|
|
String str2;
|
|
int i;
|
|
byte b = this.buffer.getByte(0L);
|
|
if (b == 116 || b == 84) {
|
|
str = "true";
|
|
str2 = "TRUE";
|
|
i = 5;
|
|
} else if (b == 102 || b == 70) {
|
|
str = "false";
|
|
str2 = "FALSE";
|
|
i = 6;
|
|
} else {
|
|
if (b != 110 && b != 78) {
|
|
return 0;
|
|
}
|
|
str = "null";
|
|
str2 = "NULL";
|
|
i = 7;
|
|
}
|
|
int length = str.length();
|
|
int i2 = 1;
|
|
while (i2 < length) {
|
|
int i3 = i2 + 1;
|
|
if (!this.source.request(i3)) {
|
|
return 0;
|
|
}
|
|
byte b2 = this.buffer.getByte(i2);
|
|
if (b2 != str.charAt(i2) && b2 != str2.charAt(i2)) {
|
|
return 0;
|
|
}
|
|
i2 = i3;
|
|
}
|
|
if (this.source.request(length + 1) && isLiteral(this.buffer.getByte(length))) {
|
|
return 0;
|
|
}
|
|
this.buffer.skip(length);
|
|
this.peeked = i;
|
|
return i;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:50:0x0081, code lost:
|
|
|
|
if (isLiteral(r11) != false) goto L69;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:51:0x0083, code lost:
|
|
|
|
if (r6 != 2) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:52:0x0085, code lost:
|
|
|
|
if (r7 == false) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:54:0x008b, code lost:
|
|
|
|
if (r8 != Long.MIN_VALUE) goto L52;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:55:0x008d, code lost:
|
|
|
|
if (r10 == false) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:57:0x0091, code lost:
|
|
|
|
if (r8 != 0) goto L55;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:58:0x0093, code lost:
|
|
|
|
if (r10 != false) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:59:0x0095, code lost:
|
|
|
|
if (r10 == false) goto L57;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:60:0x0098, code lost:
|
|
|
|
r8 = -r8;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:61:0x0099, code lost:
|
|
|
|
r16.peekedLong = r8;
|
|
r16.buffer.skip(r5);
|
|
r16.peeked = 16;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:62:0x00a5, code lost:
|
|
|
|
return 16;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:63:0x00a6, code lost:
|
|
|
|
if (r6 == 2) goto L67;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:65:0x00a9, code lost:
|
|
|
|
if (r6 == 4) goto L67;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:67:0x00ac, code lost:
|
|
|
|
if (r6 != 7) goto L66;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:68:0x00af, code lost:
|
|
|
|
return 0;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:69:0x00b0, code lost:
|
|
|
|
r16.peekedNumberLength = r5;
|
|
r16.peeked = 17;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:70:0x00b6, code lost:
|
|
|
|
return 17;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:71:0x00b7, code lost:
|
|
|
|
return 0;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private int peekNumber() throws java.io.IOException {
|
|
/*
|
|
Method dump skipped, instructions count: 220
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.airbnb.lottie.parser.moshi.JsonUtf8Reader.peekNumber():int");
|
|
}
|
|
|
|
private boolean isLiteral(int i) throws IOException {
|
|
if (i == 9 || i == 10 || i == 12 || i == 13 || i == 32) {
|
|
return false;
|
|
}
|
|
if (i != 35) {
|
|
if (i == 44) {
|
|
return false;
|
|
}
|
|
if (i != 47 && i != 61) {
|
|
if (i == 123 || i == 125 || i == 58) {
|
|
return false;
|
|
}
|
|
if (i != 59) {
|
|
switch (i) {
|
|
case 91:
|
|
case 93:
|
|
return false;
|
|
case 92:
|
|
break;
|
|
default:
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
checkLenient();
|
|
return false;
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public String nextName() throws IOException {
|
|
String str;
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 14) {
|
|
str = nextUnquotedValue();
|
|
} else if (i == 13) {
|
|
str = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);
|
|
} else if (i == 12) {
|
|
str = nextQuotedValue(SINGLE_QUOTE_OR_SLASH);
|
|
} else {
|
|
if (i != 15) {
|
|
throw new JsonDataException("Expected a name but was " + peek() + " at path " + getPath());
|
|
}
|
|
str = this.peekedString;
|
|
}
|
|
this.peeked = 0;
|
|
this.pathNames[this.stackSize - 1] = str;
|
|
return str;
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public int selectName(JsonReader.Options options) throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i < 12 || i > 15) {
|
|
return -1;
|
|
}
|
|
if (i == 15) {
|
|
return findName(this.peekedString, options);
|
|
}
|
|
int select = this.source.select(options.doubleQuoteSuffix);
|
|
if (select != -1) {
|
|
this.peeked = 0;
|
|
this.pathNames[this.stackSize - 1] = options.strings[select];
|
|
return select;
|
|
}
|
|
String str = this.pathNames[this.stackSize - 1];
|
|
String nextName = nextName();
|
|
int findName = findName(nextName, options);
|
|
if (findName == -1) {
|
|
this.peeked = 15;
|
|
this.peekedString = nextName;
|
|
this.pathNames[this.stackSize - 1] = str;
|
|
}
|
|
return findName;
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public void skipName() throws IOException {
|
|
if (this.failOnUnknown) {
|
|
throw new JsonDataException("Cannot skip unexpected " + peek() + " at " + getPath());
|
|
}
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 14) {
|
|
skipUnquotedValue();
|
|
} else if (i == 13) {
|
|
skipQuotedValue(DOUBLE_QUOTE_OR_SLASH);
|
|
} else if (i == 12) {
|
|
skipQuotedValue(SINGLE_QUOTE_OR_SLASH);
|
|
} else if (i != 15) {
|
|
throw new JsonDataException("Expected a name but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.peeked = 0;
|
|
this.pathNames[this.stackSize - 1] = "null";
|
|
}
|
|
|
|
private int findName(String str, JsonReader.Options options) {
|
|
int length = options.strings.length;
|
|
for (int i = 0; i < length; i++) {
|
|
if (str.equals(options.strings[i])) {
|
|
this.peeked = 0;
|
|
this.pathNames[this.stackSize - 1] = str;
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public String nextString() throws IOException {
|
|
String readUtf8;
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 10) {
|
|
readUtf8 = nextUnquotedValue();
|
|
} else if (i == 9) {
|
|
readUtf8 = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);
|
|
} else if (i == 8) {
|
|
readUtf8 = nextQuotedValue(SINGLE_QUOTE_OR_SLASH);
|
|
} else if (i == 11) {
|
|
readUtf8 = this.peekedString;
|
|
this.peekedString = null;
|
|
} else if (i == 16) {
|
|
readUtf8 = Long.toString(this.peekedLong);
|
|
} else if (i == 17) {
|
|
readUtf8 = this.buffer.readUtf8(this.peekedNumberLength);
|
|
} else {
|
|
throw new JsonDataException("Expected a string but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.peeked = 0;
|
|
int[] iArr = this.pathIndices;
|
|
int i2 = this.stackSize - 1;
|
|
iArr[i2] = iArr[i2] + 1;
|
|
return readUtf8;
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public boolean nextBoolean() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 5) {
|
|
this.peeked = 0;
|
|
int[] iArr = this.pathIndices;
|
|
int i2 = this.stackSize - 1;
|
|
iArr[i2] = iArr[i2] + 1;
|
|
return true;
|
|
}
|
|
if (i == 6) {
|
|
this.peeked = 0;
|
|
int[] iArr2 = this.pathIndices;
|
|
int i3 = this.stackSize - 1;
|
|
iArr2[i3] = iArr2[i3] + 1;
|
|
return false;
|
|
}
|
|
throw new JsonDataException("Expected a boolean but was " + peek() + " at path " + getPath());
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public double nextDouble() throws IOException {
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 16) {
|
|
this.peeked = 0;
|
|
int[] iArr = this.pathIndices;
|
|
int i2 = this.stackSize - 1;
|
|
iArr[i2] = iArr[i2] + 1;
|
|
return this.peekedLong;
|
|
}
|
|
if (i == 17) {
|
|
this.peekedString = this.buffer.readUtf8(this.peekedNumberLength);
|
|
} else if (i == 9) {
|
|
this.peekedString = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);
|
|
} else if (i == 8) {
|
|
this.peekedString = nextQuotedValue(SINGLE_QUOTE_OR_SLASH);
|
|
} else if (i == 10) {
|
|
this.peekedString = nextUnquotedValue();
|
|
} else if (i != 11) {
|
|
throw new JsonDataException("Expected a double but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.peeked = 11;
|
|
try {
|
|
double parseDouble = Double.parseDouble(this.peekedString);
|
|
if (!this.lenient && (Double.isNaN(parseDouble) || Double.isInfinite(parseDouble))) {
|
|
throw new JsonEncodingException("JSON forbids NaN and infinities: " + parseDouble + " at path " + getPath());
|
|
}
|
|
this.peekedString = null;
|
|
this.peeked = 0;
|
|
int[] iArr2 = this.pathIndices;
|
|
int i3 = this.stackSize - 1;
|
|
iArr2[i3] = iArr2[i3] + 1;
|
|
return parseDouble;
|
|
} catch (NumberFormatException unused) {
|
|
throw new JsonDataException("Expected a double but was " + this.peekedString + " at path " + getPath());
|
|
}
|
|
}
|
|
|
|
private String nextQuotedValue(ByteString byteString) throws IOException {
|
|
StringBuilder sb = null;
|
|
while (true) {
|
|
long indexOfElement = this.source.indexOfElement(byteString);
|
|
if (indexOfElement == -1) {
|
|
throw syntaxError("Unterminated string");
|
|
}
|
|
if (this.buffer.getByte(indexOfElement) != 92) {
|
|
if (sb == null) {
|
|
String readUtf8 = this.buffer.readUtf8(indexOfElement);
|
|
this.buffer.readByte();
|
|
return readUtf8;
|
|
}
|
|
sb.append(this.buffer.readUtf8(indexOfElement));
|
|
this.buffer.readByte();
|
|
return sb.toString();
|
|
}
|
|
if (sb == null) {
|
|
sb = new StringBuilder();
|
|
}
|
|
sb.append(this.buffer.readUtf8(indexOfElement));
|
|
this.buffer.readByte();
|
|
sb.append(readEscapeCharacter());
|
|
}
|
|
}
|
|
|
|
private String nextUnquotedValue() throws IOException {
|
|
long indexOfElement = this.source.indexOfElement(UNQUOTED_STRING_TERMINALS);
|
|
Buffer buffer = this.buffer;
|
|
return indexOfElement != -1 ? buffer.readUtf8(indexOfElement) : buffer.readUtf8();
|
|
}
|
|
|
|
private void skipQuotedValue(ByteString byteString) throws IOException {
|
|
while (true) {
|
|
long indexOfElement = this.source.indexOfElement(byteString);
|
|
if (indexOfElement == -1) {
|
|
throw syntaxError("Unterminated string");
|
|
}
|
|
if (this.buffer.getByte(indexOfElement) == 92) {
|
|
this.buffer.skip(indexOfElement + 1);
|
|
readEscapeCharacter();
|
|
} else {
|
|
this.buffer.skip(indexOfElement + 1);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void skipUnquotedValue() throws IOException {
|
|
long indexOfElement = this.source.indexOfElement(UNQUOTED_STRING_TERMINALS);
|
|
Buffer buffer = this.buffer;
|
|
if (indexOfElement == -1) {
|
|
indexOfElement = buffer.size();
|
|
}
|
|
buffer.skip(indexOfElement);
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public int nextInt() throws IOException {
|
|
String nextQuotedValue;
|
|
int i = this.peeked;
|
|
if (i == 0) {
|
|
i = doPeek();
|
|
}
|
|
if (i == 16) {
|
|
long j = this.peekedLong;
|
|
int i2 = (int) j;
|
|
if (j != i2) {
|
|
throw new JsonDataException("Expected an int but was " + this.peekedLong + " at path " + getPath());
|
|
}
|
|
this.peeked = 0;
|
|
int[] iArr = this.pathIndices;
|
|
int i3 = this.stackSize - 1;
|
|
iArr[i3] = iArr[i3] + 1;
|
|
return i2;
|
|
}
|
|
if (i == 17) {
|
|
this.peekedString = this.buffer.readUtf8(this.peekedNumberLength);
|
|
} else if (i == 9 || i == 8) {
|
|
if (i == 9) {
|
|
nextQuotedValue = nextQuotedValue(DOUBLE_QUOTE_OR_SLASH);
|
|
} else {
|
|
nextQuotedValue = nextQuotedValue(SINGLE_QUOTE_OR_SLASH);
|
|
}
|
|
this.peekedString = nextQuotedValue;
|
|
try {
|
|
int parseInt = Integer.parseInt(nextQuotedValue);
|
|
this.peeked = 0;
|
|
int[] iArr2 = this.pathIndices;
|
|
int i4 = this.stackSize - 1;
|
|
iArr2[i4] = iArr2[i4] + 1;
|
|
return parseInt;
|
|
} catch (NumberFormatException unused) {
|
|
}
|
|
} else if (i != 11) {
|
|
throw new JsonDataException("Expected an int but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.peeked = 11;
|
|
try {
|
|
double parseDouble = Double.parseDouble(this.peekedString);
|
|
int i5 = (int) parseDouble;
|
|
if (i5 != parseDouble) {
|
|
throw new JsonDataException("Expected an int but was " + this.peekedString + " at path " + getPath());
|
|
}
|
|
this.peekedString = null;
|
|
this.peeked = 0;
|
|
int[] iArr3 = this.pathIndices;
|
|
int i6 = this.stackSize - 1;
|
|
iArr3[i6] = iArr3[i6] + 1;
|
|
return i5;
|
|
} catch (NumberFormatException unused2) {
|
|
throw new JsonDataException("Expected an int but was " + this.peekedString + " at path " + getPath());
|
|
}
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() throws IOException {
|
|
this.peeked = 0;
|
|
this.scopes[0] = 8;
|
|
this.stackSize = 1;
|
|
this.buffer.clear();
|
|
this.source.close();
|
|
}
|
|
|
|
@Override // com.airbnb.lottie.parser.moshi.JsonReader
|
|
public void skipValue() throws IOException {
|
|
if (this.failOnUnknown) {
|
|
throw new JsonDataException("Cannot skip unexpected " + peek() + " at " + getPath());
|
|
}
|
|
int i = 0;
|
|
do {
|
|
int i2 = this.peeked;
|
|
if (i2 == 0) {
|
|
i2 = doPeek();
|
|
}
|
|
if (i2 == 3) {
|
|
pushScope(1);
|
|
} else if (i2 == 1) {
|
|
pushScope(3);
|
|
} else {
|
|
if (i2 == 4) {
|
|
i--;
|
|
if (i < 0) {
|
|
throw new JsonDataException("Expected a value but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.stackSize--;
|
|
} else if (i2 == 2) {
|
|
i--;
|
|
if (i < 0) {
|
|
throw new JsonDataException("Expected a value but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.stackSize--;
|
|
} else if (i2 == 14 || i2 == 10) {
|
|
skipUnquotedValue();
|
|
} else if (i2 == 9 || i2 == 13) {
|
|
skipQuotedValue(DOUBLE_QUOTE_OR_SLASH);
|
|
} else if (i2 == 8 || i2 == 12) {
|
|
skipQuotedValue(SINGLE_QUOTE_OR_SLASH);
|
|
} else if (i2 == 17) {
|
|
this.buffer.skip(this.peekedNumberLength);
|
|
} else if (i2 == 18) {
|
|
throw new JsonDataException("Expected a value but was " + peek() + " at path " + getPath());
|
|
}
|
|
this.peeked = 0;
|
|
}
|
|
i++;
|
|
this.peeked = 0;
|
|
} while (i != 0);
|
|
int[] iArr = this.pathIndices;
|
|
int i3 = this.stackSize - 1;
|
|
iArr[i3] = iArr[i3] + 1;
|
|
this.pathNames[this.stackSize - 1] = "null";
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:14:0x0025, code lost:
|
|
|
|
r6.buffer.skip(r1);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x002d, code lost:
|
|
|
|
if (r2 != 47) goto L43;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:18:0x0074, code lost:
|
|
|
|
if (r2 != 35) goto L48;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:19:0x0076, code lost:
|
|
|
|
checkLenient();
|
|
skipToEndOfLine();
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:23:0x007d, code lost:
|
|
|
|
return r2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:27:0x0037, code lost:
|
|
|
|
if (r6.source.request(2) != false) goto L20;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:28:0x003a, code lost:
|
|
|
|
checkLenient();
|
|
r3 = r6.buffer.getByte(1);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:29:0x0047, code lost:
|
|
|
|
if (r3 == 42) goto L40;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:31:0x005a, code lost:
|
|
|
|
r6.buffer.readByte();
|
|
r6.buffer.readByte();
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:32:0x0068, code lost:
|
|
|
|
if (skipToEndOfBlockComment() == false) goto L46;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:35:0x0071, code lost:
|
|
|
|
throw syntaxError("Unterminated comment");
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:38:0x0049, code lost:
|
|
|
|
if (r3 == 47) goto L24;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:39:0x004c, code lost:
|
|
|
|
r6.buffer.readByte();
|
|
r6.buffer.readByte();
|
|
skipToEndOfLine();
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:42:0x004b, code lost:
|
|
|
|
return r2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:44:0x0039, code lost:
|
|
|
|
return r2;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private int nextNonWhitespace(boolean r7) throws java.io.IOException {
|
|
/*
|
|
r6 = this;
|
|
r0 = 0
|
|
L1:
|
|
r1 = r0
|
|
L2:
|
|
okio.BufferedSource r2 = r6.source
|
|
int r3 = r1 + 1
|
|
long r4 = (long) r3
|
|
boolean r2 = r2.request(r4)
|
|
if (r2 == 0) goto L80
|
|
okio.Buffer r2 = r6.buffer
|
|
long r4 = (long) r1
|
|
byte r2 = r2.getByte(r4)
|
|
r4 = 10
|
|
if (r2 == r4) goto L7e
|
|
r4 = 32
|
|
if (r2 == r4) goto L7e
|
|
r4 = 13
|
|
if (r2 == r4) goto L7e
|
|
r4 = 9
|
|
if (r2 != r4) goto L25
|
|
goto L7e
|
|
L25:
|
|
okio.Buffer r3 = r6.buffer
|
|
long r4 = (long) r1
|
|
r3.skip(r4)
|
|
r1 = 47
|
|
if (r2 != r1) goto L72
|
|
okio.BufferedSource r3 = r6.source
|
|
r4 = 2
|
|
boolean r3 = r3.request(r4)
|
|
if (r3 != 0) goto L3a
|
|
return r2
|
|
L3a:
|
|
r6.checkLenient()
|
|
okio.Buffer r3 = r6.buffer
|
|
r4 = 1
|
|
byte r3 = r3.getByte(r4)
|
|
r4 = 42
|
|
if (r3 == r4) goto L5a
|
|
if (r3 == r1) goto L4c
|
|
return r2
|
|
L4c:
|
|
okio.Buffer r1 = r6.buffer
|
|
r1.readByte()
|
|
okio.Buffer r1 = r6.buffer
|
|
r1.readByte()
|
|
r6.skipToEndOfLine()
|
|
goto L1
|
|
L5a:
|
|
okio.Buffer r1 = r6.buffer
|
|
r1.readByte()
|
|
okio.Buffer r1 = r6.buffer
|
|
r1.readByte()
|
|
boolean r1 = r6.skipToEndOfBlockComment()
|
|
if (r1 == 0) goto L6b
|
|
goto L1
|
|
L6b:
|
|
java.lang.String r7 = "Unterminated comment"
|
|
com.airbnb.lottie.parser.moshi.JsonEncodingException r6 = r6.syntaxError(r7)
|
|
throw r6
|
|
L72:
|
|
r1 = 35
|
|
if (r2 != r1) goto L7d
|
|
r6.checkLenient()
|
|
r6.skipToEndOfLine()
|
|
goto L1
|
|
L7d:
|
|
return r2
|
|
L7e:
|
|
r1 = r3
|
|
goto L2
|
|
L80:
|
|
if (r7 != 0) goto L84
|
|
r6 = -1
|
|
return r6
|
|
L84:
|
|
java.io.EOFException r6 = new java.io.EOFException
|
|
java.lang.String r7 = "End of input"
|
|
r6.<init>(r7)
|
|
throw r6
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.airbnb.lottie.parser.moshi.JsonUtf8Reader.nextNonWhitespace(boolean):int");
|
|
}
|
|
|
|
private void checkLenient() throws IOException {
|
|
if (!this.lenient) {
|
|
throw syntaxError("Use JsonReader.setLenient(true) to accept malformed JSON");
|
|
}
|
|
}
|
|
|
|
private void skipToEndOfLine() throws IOException {
|
|
long indexOfElement = this.source.indexOfElement(LINEFEED_OR_CARRIAGE_RETURN);
|
|
Buffer buffer = this.buffer;
|
|
buffer.skip(indexOfElement != -1 ? indexOfElement + 1 : buffer.size());
|
|
}
|
|
|
|
private boolean skipToEndOfBlockComment() throws IOException {
|
|
long indexOf = this.source.indexOf(CLOSING_BLOCK_COMMENT);
|
|
boolean z = indexOf != -1;
|
|
Buffer buffer = this.buffer;
|
|
buffer.skip(z ? indexOf + r1.size() : buffer.size());
|
|
return z;
|
|
}
|
|
|
|
public String toString() {
|
|
return "JsonReader(" + this.source + ")";
|
|
}
|
|
|
|
private char readEscapeCharacter() throws IOException {
|
|
int i;
|
|
if (!this.source.request(1L)) {
|
|
throw syntaxError("Unterminated escape sequence");
|
|
}
|
|
byte readByte = this.buffer.readByte();
|
|
if (readByte == 10 || readByte == 34 || readByte == 39 || readByte == 47 || readByte == 92) {
|
|
return (char) readByte;
|
|
}
|
|
if (readByte == 98) {
|
|
return '\b';
|
|
}
|
|
if (readByte == 102) {
|
|
return '\f';
|
|
}
|
|
if (readByte == 110) {
|
|
return '\n';
|
|
}
|
|
if (readByte == 114) {
|
|
return '\r';
|
|
}
|
|
if (readByte == 116) {
|
|
return '\t';
|
|
}
|
|
if (readByte == 117) {
|
|
if (!this.source.request(4L)) {
|
|
throw new EOFException("Unterminated escape sequence at path " + getPath());
|
|
}
|
|
char c = 0;
|
|
for (int i2 = 0; i2 < 4; i2++) {
|
|
byte b = this.buffer.getByte(i2);
|
|
char c2 = (char) (c << 4);
|
|
if (b >= 48 && b <= 57) {
|
|
i = b - 48;
|
|
} else if (b >= 97 && b <= 102) {
|
|
i = b - 87;
|
|
} else {
|
|
if (b < 65 || b > 70) {
|
|
throw syntaxError("\\u" + this.buffer.readUtf8(4L));
|
|
}
|
|
i = b - 55;
|
|
}
|
|
c = (char) (c2 + i);
|
|
}
|
|
this.buffer.skip(4L);
|
|
return c;
|
|
}
|
|
if (this.lenient) {
|
|
return (char) readByte;
|
|
}
|
|
throw syntaxError("Invalid escape sequence: \\" + ((char) readByte));
|
|
}
|
|
}
|