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); }