Patch quoted strings in snbt
This commit is contained in:
parent
ee60a52249
commit
8077bbfa1f
2 changed files with 5 additions and 1 deletions
|
@ -413,6 +413,7 @@ class StringReader {
|
|||
final String _buffer;
|
||||
int _position = 0;
|
||||
int _lastPostion = 0;
|
||||
bool _quotedString = false;
|
||||
|
||||
StringReader(this._buffer);
|
||||
|
||||
|
@ -444,6 +445,7 @@ class StringReader {
|
|||
|
||||
// Skip any whitespace characters
|
||||
void skipWhitespace() {
|
||||
if (_quotedString) return; // We need whitespace for strings
|
||||
while (canRead && isWhitespace(_buffer[_position])) {
|
||||
_position++;
|
||||
}
|
||||
|
@ -465,6 +467,7 @@ class StringReader {
|
|||
|
||||
// Read a string enclosed in double quotes
|
||||
String readQuotedString() {
|
||||
_quotedString = true;
|
||||
if (next() != '"') {
|
||||
throw Exception('Expected double quotes at the start of a string');
|
||||
}
|
||||
|
@ -476,6 +479,7 @@ class StringReader {
|
|||
}
|
||||
result.write(char);
|
||||
}
|
||||
_quotedString = false;
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue