X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FParse.cs;h=ca98353067cf4f55e0ad499aa235082d1e4e32a7;hp=be11a9ac506046827f06441b31f67aea3adab07c;hb=236bc590ff21370c1139a8c01ff35f7b30af743d;hpb=8438a35a901cf43ef85f226f58b5627b376a23c4 diff --git a/CarFire/CarFire/CarFire/Parse.cs b/CarFire/CarFire/CarFire/Parse.cs index be11a9a..ca98353 100644 --- a/CarFire/CarFire/CarFire/Parse.cs +++ b/CarFire/CarFire/CarFire/Parse.cs @@ -10,7 +10,7 @@ namespace CarFire /// /// Class with handy static methods taking strings and returning objects /// parsed from those strings. For all of these functions, white space is - /// generally ignored, but any superfluous characters will make the parse fail. + /// generally ignored, but superfluous characters are not allowed. /// public class Parse { @@ -30,7 +30,7 @@ namespace CarFire /// Parses a comment of an INI file. /// /// Text. - /// The comment. + /// The comment, or null if parsing failed. public static string IniComment(string line) { Match match = Regex.Match(line, @"^;\s*(.*)\s*$"); @@ -126,8 +126,8 @@ namespace CarFire /// /// An enumeration. /// Text. - /// The constant, or default(T) if parsing failed. - public static T Constant(string atom) + /// The constant, or null if parsing failed. + public static T? Constant(string atom) where T : struct { try { @@ -137,7 +137,7 @@ namespace CarFire catch (System.Exception ex) #pragma warning restore 0168 { - return default(T); + return null; } } @@ -181,7 +181,7 @@ namespace CarFire /// Parses a function. /// /// Text. - /// An array two strings containing the function name and + /// An array with two strings containing the function name and /// parameter-list, in that order, or null if parsing failed. public static string[] Function(string atom) {