Пример #1
0
        private RegExp ParseCharClassExp()
        {
            if (this.Match('['))
            {
                bool negate = false;
                if (this.Match('^'))
                {
                    negate = true;
                }

                RegExp e = this.ParseCharClasses();
                if (negate)
                {
                    e = RegExp.MakeIntersection(RegExp.MakeAnyChar(), RegExp.MakeComplement(e));
                }

                if (!this.Match(']'))
                {
                    throw new ArgumentException("expected ']' at position " + pos);
                }

                return(e);
            }

            return(this.ParseSimpleExp());
        }
Пример #2
0
        private RegExp ParseInterExp()
        {
            RegExp e = this.ParseConcatExp();

            if (this.Check(RegExpSyntaxOptions.Intersection) && this.Match('&'))
            {
                e = RegExp.MakeIntersection(e, this.ParseInterExp());
            }

            return(e);
        }