Fix stringified value and key writing for quotes

This commit is contained in:
zontreck 2024-07-02 20:27:41 -07:00
parent 8077bbfa1f
commit 3e7bae969e
3 changed files with 21 additions and 3 deletions

View file

@ -227,7 +227,7 @@ abstract class Tag {
if (getKey() == "") {
return false;
} else {
String letters = "abcdefghijklmnopqrstuvwxyz";
String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0; i < getKey().length; i++) {
String digit = getKey().substring(i, i + 1);
if (letters.indexOf(digit) == -1) {
@ -238,6 +238,21 @@ abstract class Tag {
}
}
bool shouldQuote(String value) {
if (value == "") {
return false;
} else {
String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0; i < value.length; i++) {
String digit = value.substring(i, i + 1);
if (letters.indexOf(digit) == -1) {
return true;
}
}
return false;
}
}
void writeStringifiedValue(StringBuilder builder, int indent, bool isList);
void readStringifiedValue(StringReader reader);