private static IEnumerable<ICharacterClassPart> GetParts(string value)
{
switch (GetShorthand(value))
{
case Shorthand.Digit:
case Shorthand.NonDigit:
yield return new CharacterClassRange("0", "9", false);
break;
case Shorthand.WordCharacter:
case Shorthand.NonWordCharacter:
yield return new CharacterClassRange("a", "z", false);
yield return new CharacterClassRange("A", "Z", false);
yield return new CharacterClassRange("0", "9", false);
yield return new CharacterClassLiteralCharacters("_", false);
break;
case Shorthand.Whitespace:
case Shorthand.NonWhitespace:
yield return new CharacterClassLiteralCharacters(" \f\n\r\t\v", false);
break;
default:
throw new InvalidOperationException("Invalid shorthand value.");
}
}