public static bool TryParse(string input, out ViaHeaderValue 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);
        }
        static bool TryParseElement(Lexer lexer, out ViaHeaderValue parsedValue, out Token t)
        {
            parsedValue = null;

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

            var            next  = lexer.Scan();
            ViaHeaderValue value = new ViaHeaderValue();

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

                value.ProtocolName    = lexer.GetStringValue(t);
                value.ProtocolVersion = lexer.GetStringValue(next);

                next = lexer.Scan();
            }
            else
            {
                value.ProtocolVersion = lexer.GetStringValue(t);
            }

            if (next != Token.Type.Token)
            {
                return(false);
            }

            if (lexer.PeekChar() == ':')
            {
                lexer.EatChar();

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

            value.ReceivedBy = lexer.GetStringValue(next, t);

            string comment;

            if (lexer.ScanCommentOptional(out comment, out t))
            {
                t = lexer.Scan();
            }

            value.Comment = comment;
            parsedValue   = value;
            return(true);
        }