t { assert(parse("") is null); assert(parse("{}") == new Compound()); assert(parse("{a:true,b:false}") == new Compound(new Named!Byte("a", true), new Named!Byte("b", false))); assert(parse("[string,1]") is null); assert(parse("[]") == new List()); assert(parse("[,]") == new IntArray()); assert(parse("[1L, 2]") == new IntArray(1, 2)); // string assert(parse(`"a string"`) == new String("a string")); assert(parse(`"a \"quoted\" string"`) == new String("a \"quoted\" string")); assert(parse(`"a newline\nstring"`) == new String("a newline\\nstring")); assert(parse(`"\\\\\" \ "`) == new String(`\\" \ `)); assert(parse("test") == new String("test")); // numbers assert(parse("55") == new Int(55)); assert(parse("12b") == new Byte(12)); assert(parse("-4S") == new Short(-4)); assert(parse("2147483649") == new Long(2147483649L)); assert(parse("0L") == new Long(0)); assert(parse("12.1") == new Double(12.1)); assert(parse(".44f") == new Float(.44f)); assert(parse("12.1.1.1") == new Double(12.1)); assert(parse(".00D") == new Double(0)); // compound assert(parse(`{EntityData:{id:"minecraft:creeper"}}`) == new Compound(new Named!Compound("EntityData", new Named!String("id", "minecraft:creeper")))); assert(parse(`{Potion:"minecraft:long_strength"}`) == new Compound(new Named!String("Potion", "minecraft:long_strength")));
Parses a string into a tag.