public RxNode <TLetter> MapCodepoints(bool negate, RangeSet <Codepoint> codepointRanges, bool caseSensitive)
 {
     if (!caseSensitive)
     {
         codepointRanges = new RangeSet <Codepoint>(codepointRanges.Expand().SelectMany(this.GenerateCaseInsensitiveCodepoints).Condense());
     }
     if (negate)
     {
         codepointRanges = Codepoints.Valid - codepointRanges;
     }
     if (codepointRanges.Count == 0)
     {
         return(RxEmpty <TLetter> .Default);
     }
     return(MapCodepoints(codepointRanges));
 }
Exemplo n.º 2
0
        public static RangeSet <Codepoint> CaseInsensitive(this RangeSet <Codepoint> input)
        {
            var result = input;

            foreach (var c in input.Expand())
            {
                if (Codepoint.IsUpper(c))
                {
                    result |= Codepoint.ToLowerInvariant(c);
                }
                else if (Codepoint.IsLower(c))
                {
                    result |= Codepoint.ToUpperInvariant(c);
                }
            }
            return(result);
        }