public static DateTimeParser.LiteralRegionStates ProcessInsideInferredEscapedLiteral(ref string error, char currentChar, DateTimeParser.LiteralRegionStates literalRegionState, ref string currentValue, ref bool nothingDied) { if (currentChar == DateTimeParser.DateLiteralCharacter || currentChar == EscapeCharacter) { literalRegionState = DateTimeParser.LiteralRegionStates.InsideInferredLiteralRegion; currentValue += currentChar; } else { nothingDied = false; error = ErrorResource.BackSlashFormatError; } return(literalRegionState); }
public static int ProcessInsideInferredLiteral(Dictionary <char, List <int> > dateTimeFormatForwardLookups, Dictionary <string, List <IDateTimeFormatPartOptionTO> > dateTimeFormatPartOptions, List <IDateTimeFormatPartTO> formatParts, ref string error, char currentChar, char[] formatArray, int count, int forwardLookupLength, ref string currentValue, ref DateTimeParser.LiteralRegionStates literalRegionState) { string tmpCurrentValue; string tmpForwardLookupResult; if (currentChar == DateTimeParser.DateLiteralCharacter && CheckForDoubleEscapedLiteralCharacter(formatArray, count, out tmpForwardLookupResult, out error)) { forwardLookupLength = tmpForwardLookupResult.Length; currentValue += currentChar; } else if (currentChar == DateTimeParser.DateLiteralCharacter) { literalRegionState = DateTimeParser.LiteralRegionStates.InsideLiteralRegion; formatParts.Add(new DateTimeFormatPartTO(currentValue, true, "")); currentValue = ""; } else if (currentChar == EscapeCharacter) { literalRegionState = DateTimeParser.LiteralRegionStates.InsideInferredLiteralRegionWithEscape; } else if (TryGetDateTimeFormatPart(formatArray, count, currentChar, dateTimeFormatForwardLookups, dateTimeFormatPartOptions, out tmpCurrentValue, out error)) { literalRegionState = DateTimeParser.LiteralRegionStates.OutsideLiteralRegion; forwardLookupLength = tmpCurrentValue.Length; formatParts.Add(new DateTimeFormatPartTO(currentValue, true, "")); formatParts.Add(new DateTimeFormatPartTO(tmpCurrentValue, false, "")); currentValue = ""; } else { error = ""; currentValue += currentChar; } return(forwardLookupLength); }
public static int ProcessInsideLiteral(List <IDateTimeFormatPartTO> formatParts, ref string error, char currentChar, char[] formatArray, int count, int forwardLookupLength, ref string currentValue, ref DateTimeParser.LiteralRegionStates literalRegionState) { string tmpForwardLookupResult; if (currentChar == DateTimeParser.DateLiteralCharacter && CheckForDoubleEscapedLiteralCharacter(formatArray, count, out tmpForwardLookupResult, out error)) { forwardLookupLength = tmpForwardLookupResult.Length; currentValue += currentChar; } else if (currentChar == DateTimeParser.DateLiteralCharacter) { literalRegionState = DateTimeParser.LiteralRegionStates.OutsideLiteralRegion; formatParts.Add(new DateTimeFormatPartTO(currentValue, true, "")); currentValue = ""; } else if (currentChar == EscapeCharacter) { literalRegionState = DateTimeParser.LiteralRegionStates.InsideLiteralRegionWithEscape; } else { currentValue += currentChar; } return(forwardLookupLength); }