public SetError ( object expectedMessage = null, [ callerName = null ) : bool | ||
expectedMessage | object |
/// Optional object. Its |
callerName | [ | Name of the caller (automatically injected by the compiler). |
return | bool |
/// <summary> /// Matches a DateTime in the <see cref="FileNameUniqueTimeUtcFormat"/> format. /// </summary> /// <param name="this">This <see cref="StringMatcher"/>.</param> /// <param name="time">Result time on success; otherwise <see cref="Util.UtcMinValue"/>.</param> /// <returns>True if the time has been matched.</returns> public static bool MatchFileNameUniqueTimeUtcFormat(this StringMatcher @this, out DateTime time) { time = Util.UtcMinValue; Debug.Assert(FileNameUniqueTimeUtcFormat.Replace("\\", "").Length == 27); return(@this.Length >= 27 && DateTime.TryParseExact(@this.Text.Substring(@this.StartIndex, 27), FileUtil.FileNameUniqueTimeUtcFormat, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out time) ? @this.Forward(27) : @this.SetError()); }
public virtual bool VisitTerminal() { _m.MatchWhiteSpaces(0); return(_m.TryMatchJSONQuotedString(true) || _m.TryMatchDoubleValue() || _m.TryMatchString("true") || _m.TryMatchString("false") ? true : _m.SetError()); }
/// <summary> /// Matches a <see cref="DateTimeStamp"/>. /// </summary> /// <param name="this">This <see cref="StringMatcher"/>.</param> /// <param name="time">Resulting time stamp on successful match; <see cref="DateTimeStamp.Unknown"/> otherwise.</param> /// <returns>True if the time stamp has been matched.</returns> static public bool MatchDateTimeStamp(this StringMatcher @this, out DateTimeStamp time) { time = DateTimeStamp.Unknown; int savedIndex = @this.StartIndex; DateTime t; if ([email protected](out t)) { return(@this.SetError()); } byte uniquifier = 0; if (@this.MatchChar('(')) { int unique; if ([email protected](out unique, 0, 255) || [email protected](')')) { return(@this.BackwardAddError(savedIndex)); } uniquifier = (byte)unique; } time = new DateTimeStamp(t, uniquifier); return(@this.Forward(0)); }