Beispiel #1
0
        internal System.Text.RegularExpressions.Match Run(bool quick, int prevlen, string input, int beginning, int length, int startat)
        {
            RegexRunner runner = null;

            if ((startat < 0) || (startat > input.Length))
            {
                throw new ArgumentOutOfRangeException("start", SR.GetString("BeginIndexNotNegative"));
            }
            if ((length < 0) || (length > input.Length))
            {
                throw new ArgumentOutOfRangeException("length", SR.GetString("LengthNotNegative"));
            }
            runner = (RegexRunner)this.runnerref.Get();
            if (runner == null)
            {
                if (this.factory != null)
                {
                    runner = this.factory.CreateInstance();
                }
                else
                {
                    runner = new RegexInterpreter(this.code, this.UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
                }
            }
            System.Text.RegularExpressions.Match match = runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick);
            this.runnerref.Release(runner);
            return(match);
        }
Beispiel #2
0
        /*
         * Internal worker called by all the public APIs
         */
        internal Match Run(bool quick, int prevlen, string input, int beginning, int length, int startat)
        {
            Match       match;
            RegexRunner runner = null;

            if (startat < 0 || startat > input.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(startat), SR.BeginIndexNotNegative);
            }

            if (length < 0 || length > input.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(length), SR.LengthNotNegative);
            }

            // There may be a cached runner; grab ownership of it if we can.

            runner = (RegexRunner)_runnerref.Get();

            // Create a RegexRunner instance if we need to

            if (runner == null)
            {
                // Use the compiled RegexRunner factory if the code was compiled to MSIL

                if (factory != null)
                {
                    runner = factory.CreateInstance();
                }
                else
                {
                    runner = new RegexInterpreter(_code, UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
                }
            }

            try
            {
                // Do the scan starting at the requested position
                match = runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick, internalMatchTimeout);
            }
            finally
            {
                // Release or fill the cache slot
                _runnerref.Release(runner);
            }

#if DEBUG
            if (Debug && match != null)
            {
                match.Dump();
            }
#endif
            return(match);
        }
        internal System.Text.RegularExpressions.Match Run(bool quick, int prevlen, string input, int beginning, int length, int startat)
        {
            RegexRunner runner = null;

            if ((startat < 0) || (startat > input.Length))
            {
                throw new ArgumentOutOfRangeException();
            }
            if ((length < 0) || (length > input.Length))
            {
                throw new ArgumentOutOfRangeException();
            }
            runner = new RegexInterpreter(this.code, this.UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
            return(runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick));
        }
Beispiel #4
0
        // Internal worker called by all the public APIs
        internal Match Run(bool quick, int prevlen, String input, int beginning, int length, int startat)
        {
            Match       match;
            RegexRunner runner = null;

            if (startat < 0 || startat > input.Length)
            {
                throw new ArgumentOutOfRangeException("start", ""); //XXX: SR.GetString(SR.BeginIndexNotNegative));
            }
            if (length < 0 || length > input.Length)
            {
                throw new ArgumentOutOfRangeException("length", ""); //XXX: SR.GetString(SR.LengthNotNegative));
            }
            // There may be a cached runner; grab ownership of it if we can.

            runner = (RegexRunner)runnerref.Get();

            // Create a RegexRunner instance if we need to

            if (runner == null)
            {
                // Use the compiled RegexRunner factory if the code was compiled to MSIL

//                if (factory != null)
//                    runner = factory.CreateInstance();
//                else
                runner = new RegexInterpreter(code, UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
            }

            // Do the scan starting at the requested position

            match = runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick);

            // Release or fill the cache slot

            runnerref.Release(runner);

#if DBG
            if (UseOptionDebug())
            {
                match.Dump();
            }
#endif
            return(match);
        }
 internal System.Text.RegularExpressions.Match Run(bool quick, int prevlen, string input, int beginning, int length, int startat)
 {
     RegexRunner runner = null;
     if ((startat < 0) || (startat > input.Length))
     {
         throw new ArgumentOutOfRangeException("start", SR.GetString("BeginIndexNotNegative"));
     }
     if ((length < 0) || (length > input.Length))
     {
         throw new ArgumentOutOfRangeException("length", SR.GetString("LengthNotNegative"));
     }
     runner = (RegexRunner) this.runnerref.Get();
     if (runner == null)
     {
         if (this.factory != null)
         {
             runner = this.factory.CreateInstance();
         }
         else
         {
             runner = new RegexInterpreter(this.code, this.UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
         }
     }
     System.Text.RegularExpressions.Match match = runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick);
     this.runnerref.Release(runner);
     return match;
 }
        /*
         * Internal worker called by all the public APIs
         */
        internal Match Run(bool quick, int prevlen, String input, int beginning, int length, int startat) {
            Match match;
            RegexRunner runner = null;

            if (startat < 0 || startat > input.Length)
                throw new ArgumentOutOfRangeException("start", SR.GetString(SR.BeginIndexNotNegative));

            if (length < 0 || length > input.Length)
                throw new ArgumentOutOfRangeException("length", SR.GetString(SR.LengthNotNegative));

            // There may be a cached runner; grab ownership of it if we can.

            runner = (RegexRunner)runnerref.Get();

            // Create a RegexRunner instance if we need to

            if (runner == null) {
                // Use the compiled RegexRunner factory if the code was compiled to MSIL

                if (factory != null)
                    runner = factory.CreateInstance();
                else
                    runner = new RegexInterpreter(code, UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
            }

            // Do the scan starting at the requested position

            match = runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick);

            // Release or fill the cache slot

            runnerref.Release(runner);

#if DBG
            if (Debug && match != null)
                match.Dump();
#endif
            return match;
        }
Beispiel #7
0
 internal System.Text.RegularExpressions.Match Run(bool quick, int prevlen, string input, int beginning, int length, int startat)
 {
     RegexRunner runner = null;
     if ((startat < 0) || (startat > input.Length))
     {
         throw new ArgumentOutOfRangeException();
     }
     if ((length < 0) || (length > input.Length))
     {
         throw new ArgumentOutOfRangeException();
     }
     runner = new RegexInterpreter(this.code, this.UseOptionInvariant() ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
     return runner.Scan(this, input, beginning, beginning + length, startat, prevlen, quick);
 }