private static ReadResults ReadScores(EntitySelectorParser parser, IStringReader reader)
        {
            ReadResults readResults = reader.Expect('{');

            if (!readResults.Successful)
            {
                return(readResults);
            }

            reader.SkipWhitespace();
            while (reader.CanRead() && reader.Peek() != '}')
            {
                reader.SkipWhitespace();
                readResults = reader.ReadUnquotedString(out _);
                if (!readResults.Successful)
                {
                    return(readResults);
                }

                reader.SkipWhitespace();
                readResults = reader.Expect('=');
                if (!readResults.Successful)
                {
                    return(readResults);
                }

                reader.SkipWhitespace();
                readResults = new RangeParser <int>(reader).Read(int.TryParse, CommandError.InvalidInteger, int.MinValue, int.MaxValue, false, out Range <int> range);
                if (!readResults.Successful)
                {
                    return(readResults);
                }

                parser.AddArgument(new ParsedArgument <Range <int> >(range, false));
                reader.SkipWhitespace();
                if (reader.CanRead())
                {
                    char c = reader.Read();
                    if (c == ',')
                    {
                        continue;
                    }
                    if (c == '}')
                    {
                        return(ReadResults.Success());
                    }
                }
                return(ReadResults.Failure(CommandError.ExpectedCharacter('}').WithContext(reader)));
            }

            reader.SkipWhitespace();
            return(reader.Expect('}'));
        }
        private static ReadResults ReadAdvancements(EntitySelectorParser parser, IStringReader reader)
        {
            ReadResults readResults = reader.Expect('{');

            if (!readResults.Successful)
            {
                return(readResults);
            }

            reader.SkipWhitespace();
            while (reader.CanRead() && reader.Peek() != '}')
            {
                reader.SkipWhitespace();
                readResults = ResourceLocation.TryRead(reader, out ResourceLocation advancement);
                if (!readResults.Successful)
                {
                    return(readResults);
                }

                reader.SkipWhitespace();
                readResults = reader.Expect('=');
                if (!readResults.Successful)
                {
                    return(readResults);
                }

                reader.SkipWhitespace();
                if (reader.CanRead() && reader.Peek() == '{')
                {
                    reader.Skip();
                    reader.SkipWhitespace();
                    while (reader.CanRead() && reader.Peek() != '}')
                    {
                        reader.SkipWhitespace();
                        readResults = reader.ReadUnquotedString(out _);
                        if (!readResults.Successful)
                        {
                            return(readResults);
                        }

                        reader.SkipWhitespace();
                        readResults = reader.Expect('=');
                        if (!readResults.Successful)
                        {
                            return(readResults);
                        }

                        reader.SkipWhitespace();
                        readResults = reader.ReadBoolean(out _);
                        if (!readResults.Successful)
                        {
                            return(readResults);
                        }

                        reader.SkipWhitespace();
                        if (reader.CanRead())
                        {
                            char c = reader.Read();
                            if (c == ',')
                            {
                                continue;
                            }
                            if (c == '}')
                            {
                                break;
                            }
                        }
                    }
                }
                else
                {
                    readResults = reader.ReadBoolean(out _);
                    if (!readResults.Successful)
                    {
                        return(readResults);
                    }
                }

                parser.AddArgument(new ParsedArgument <Advancement>(new Advancement(advancement), false));
                reader.SkipWhitespace();
                if (reader.CanRead())
                {
                    char c = reader.Read();
                    if (c == ',')
                    {
                        continue;
                    }
                    if (c == '}')
                    {
                        return(ReadResults.Success());
                    }
                }
                return(ReadResults.Failure(CommandError.ExpectedCharacter('}').WithContext(reader)));
            }

            reader.SkipWhitespace();
            return(reader.Expect('}'));
        }