diff options
author | Jo Shields <directhex@apebox.org> | 2014-02-19 22:12:43 +0000 |
---|---|---|
committer | Jo Shields <directhex@apebox.org> | 2014-02-19 22:12:43 +0000 |
commit | 9972bf87b4f27d9c8f358ef8414ac1ab957a2f0f (patch) | |
tree | 5bb230c1d698659115f918e243c1d4b0aa4c7f51 /mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs | |
parent | d0a215f5626219ff7927f576588a777e5331c7be (diff) | |
download | mono-upstream/3.2.8+dfsg.tar.gz |
Imported Upstream version 3.2.8+dfsgupstream/3.2.8+dfsg
Diffstat (limited to 'mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs')
-rw-r--r-- | mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs b/mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs index fc58299cf0..5c65339ef7 100644 --- a/mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs +++ b/mcs/class/System.Net.Http/System.Net.Http.Headers/WarningHeaderValue.cs @@ -27,6 +27,7 @@ // using System.Globalization; +using System.Collections.Generic; namespace System.Net.Http.Headers { @@ -100,13 +101,28 @@ namespace System.Net.Http.Headers throw new FormatException (input); } - + public static bool TryParse (string input, out WarningHeaderValue 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; + } - var lexer = new Lexer (input); - var t = lexer.Scan (); + internal static bool TryParse (string input, int minimalCount, out List<WarningHeaderValue> result) + { + return CollectionParser.TryParse (input, minimalCount, TryParseElement, out result); + } + + static bool TryParseElement (Lexer lexer, out WarningHeaderValue parsedValue, out Token t) + { + parsedValue = null; + + t = lexer.Scan (); if (t != Token.Type.Token) return false; @@ -148,9 +164,6 @@ namespace System.Net.Http.Headers t = lexer.Scan (); } - if (t != Token.Type.End) - return false; - parsedValue = value; return true; } |