Esempio n. 1
0
        private static string GetPattern(EnumLanguage language = EnumLanguage.NONE)
        {
            string pattern = "";

            switch (language)
            {
            case EnumLanguage.CY:
                pattern = String.Concat(
                    START,
                    maybe(DateCirca.Pattern(language) + SPACE),
                    maybe(oneof(Lookup <EnumDatePrefix> .Patterns(language), "prefix") + SPACE),
                    oneof(Lookup <EnumOrdinal> .Patterns(language), "ordinal"),
                    SPACE,
                    "mileniwm",
                    maybe(SPACE + oneof(Lookup <EnumDateSuffix> .Patterns(language), "suffix")),
                    END
                    );
                break;

            case EnumLanguage.FR:
                pattern = String.Concat(
                    START,
                    maybe(DateCirca.Pattern(language) + SPACE),
                    maybe(oneof(Lookup <EnumDatePrefix> .Patterns(language), "prefix") + SPACE),
                    oneof(Lookup <EnumOrdinal> .Patterns(language), "ordinal"),
                    SPACE,
                    "millénaire",
                    maybe(SPACE + oneof(Lookup <EnumDateSuffix> .Patterns(language), "suffix")),
                    END
                    );
                break;

            case EnumLanguage.IT:
                pattern = String.Concat(
                    START,                                         // ^
                    maybe(DateCirca.Pattern(language) + SPACE),    // (?:(?:C(?:\.|irca)|Intorno al)\s)?
                    maybe(oneof(Lookup <EnumDatePrefix> .Patterns(language), "prefix") + SPACE),
                    oneof(new string[] {
                    @"millennio\s" + oneof(Lookup <EnumOrdinal> .Patterns(language), "ordinal"),
                    oneof(Lookup <EnumOrdinal> .Patterns(language), "ordinal") + @"\smillennio"
                }),
                    maybe(SPACE + oneof(Lookup <EnumDateSuffix> .Patterns(language), "suffix")), // (?:\s(?<suffix>a\.?C\.?|d\.?C\.?))?
                    END                                                                          // $
                    );
                break;

            default:
                pattern = String.Concat(
                    START,                                                                       // ^
                    maybe(DateCirca.Pattern(language) + SPACE),
                    maybe(oneof(Lookup <EnumDatePrefix> .Patterns(language), "prefix") + SPACE), // (?:
                    oneof(Lookup <EnumOrdinal> .Patterns(language), "ordinal"),
                    SPACE,
                    "millennium",
                    maybe(SPACE + oneof(Lookup <EnumDateSuffix> .Patterns(language), "suffix")),
                    END
                    );
                break;
            }
            return(pattern);
        }