static bool TryParseElement(Lexer lexer, out TransferCodingHeaderValue parsedValue, out Token t)
        {
            parsedValue = null;

            t = lexer.Scan();
            if (t != Token.Type.Token)
            {
                return(false);
            }

            var result = new TransferCodingHeaderValue();

            result.value = lexer.GetStringValue(t);

            t = lexer.Scan();

            // Parameters parsing
            if (t == Token.Type.SeparatorSemicolon && (!NameValueHeaderValue.TryParseParameters(lexer, out result.parameters, out t) || t != Token.Type.End))
            {
                return(false);
            }

            parsedValue = result;
            return(true);
        }
 protected TransferCodingHeaderValue(TransferCodingHeaderValue source)
 {
     this.value = source.value;
     if (source.parameters != null)
     {
         foreach (var p in source.parameters)
         {
             Parameters.Add(new NameValueHeaderValue(p));
         }
     }
 }
        public static bool TryParse(string input, out TransferCodingHeaderValue parsedValue)
        {
            var   lexer = new Lexer(input);
            Token token;

            if (TryParseElement(lexer, out parsedValue, out token) && token == Token.Type.End)
            {
                return(true);
            }

            parsedValue = null;
            return(false);
        }