System.Text.RegularExpressions.RegexNode.ReduceSet C# (CSharp) Method

ReduceSet() private method

Simple optimization. If a set is a singleton, an inverse singleton, or empty, it's transformed accordingly.
private ReduceSet ( ) : RegexNode
return RegexNode
        internal RegexNode ReduceSet()
        {
            // Extract empty-set, one and not-one case as special

            if (RegexCharClass.IsEmpty(_str))
            {
                _type = Nothing;
                _str = null;
            }
            else if (RegexCharClass.IsSingleton(_str))
            {
                _ch = RegexCharClass.SingletonChar(_str);
                _str = null;
                _type += (One - Set);
            }
            else if (RegexCharClass.IsSingletonInverse(_str))
            {
                _ch = RegexCharClass.SingletonChar(_str);
                _str = null;
                _type += (Notone - Set);
            }

            return this;
        }