Patch quoted strings in snbt

This commit is contained in:
zontreck 2024-07-02 19:23:14 -07:00
parent ee60a52249
commit 8077bbfa1f
2 changed files with 5 additions and 1 deletions

View file

@ -413,6 +413,7 @@ class StringReader {
final String _buffer; final String _buffer;
int _position = 0; int _position = 0;
int _lastPostion = 0; int _lastPostion = 0;
bool _quotedString = false;
StringReader(this._buffer); StringReader(this._buffer);
@ -444,6 +445,7 @@ class StringReader {
// Skip any whitespace characters // Skip any whitespace characters
void skipWhitespace() { void skipWhitespace() {
if (_quotedString) return; // We need whitespace for strings
while (canRead && isWhitespace(_buffer[_position])) { while (canRead && isWhitespace(_buffer[_position])) {
_position++; _position++;
} }
@ -465,6 +467,7 @@ class StringReader {
// Read a string enclosed in double quotes // Read a string enclosed in double quotes
String readQuotedString() { String readQuotedString() {
_quotedString = true;
if (next() != '"') { if (next() != '"') {
throw Exception('Expected double quotes at the start of a string'); throw Exception('Expected double quotes at the start of a string');
} }
@ -476,6 +479,7 @@ class StringReader {
} }
result.write(char); result.write(char);
} }
_quotedString = false;
return result.toString(); return result.toString();
} }

View file

@ -1,6 +1,6 @@
name: libac_dart name: libac_dart
description: "Aria's Creations code library" description: "Aria's Creations code library"
version: 1.0.33 version: 1.0.35
homepage: "https://zontreck.com" homepage: "https://zontreck.com"