コード例 #1
0
ファイル: RegExp.cs プロジェクト: tralivali1234/AutoFixture
        /// <summary>
        ///   Initializes a new instance of the <see cref = "RegExp" /> class from a string.
        /// </summary>
        /// <param name = "s">A string with the regular expression.</param>
        /// <param name = "syntaxFlags">Boolean 'or' of optional syntax constructs to be enabled.</param>
        internal RegExp(string s, RegExpSyntaxOptions syntaxFlags)
        {
            this.b     = RegExp.ReplaceShorthandCharacterClasses(s);
            this.flags = syntaxFlags;
            RegExp e;

            if (s.Length == 0)
            {
                e = RegExp.MakeString(string.Empty);
            }
            else
            {
                e = this.ParseUnionExp();
                if (this.pos < this.b.Length)
                {
                    throw new ArgumentException("end-of-string expected at position " + this.pos);
                }
            }

            this.kind   = e.kind;
            this.exp1   = e.exp1;
            this.exp2   = e.exp2;
            this.s      = e.s;
            this.c      = e.c;
            this.min    = e.min;
            this.max    = e.max;
            this.digits = e.digits;
            this.from   = e.from;
            this.to     = e.to;
            this.b      = null;
        }