public override ParseState Select(string attribute, bool required = false)
        {
            var value = GetProperty(attribute);

            if (value != null)
            {
                return(new JsonParseState(value, Parser, attribute, this));
            }

            if (required)
            {
                throw ParseException.MissingAttribute(this, attribute);
            }

            return(null);
        }
        public override TValue Require <TValue>(string attribute, bool mainParameter = false)
        {
            var prop = GetProperty(attribute);

            if (prop == null && mainParameter)
            {
                prop = GetProperty(null);
            }

            if (prop == null)
            {
                throw ParseException.MissingAttribute(this, attribute);
            }

            return(TryGet <TValue>(attribute, mainParameter: mainParameter));
        }
        public override IEnumerable <ParseState> SelectMany(string attribute = null, bool required = false)
        {
            var prop = GetProperty(attribute);

            var value = prop is JObject ? new JArray(prop) : prop as JArray;

            if (value != null)
            {
                foreach (var item in value)
                {
                    if (item.Type != JTokenType.Comment)
                    {
                        yield return(new JsonParseState(item, Parser, attribute, this));
                    }
                }
                yield break;
            }

            if (required)
            {
                throw ParseException.MissingAttribute(this, attribute);
            }
        }