* replace.cs (NeedsGroupsOrCaptures): New property. Determines whenever the
replacement process needs access to the groups or captures properties of the
Match object.
* Group.cs: Add an internal ctor which avoids allocations.
* Match.cs: Ditto.
* BaseMachine.cs interpreter.cs: Add an optimization to avoid fully creating
Match objects during Replace () if the replacement string is simple.
svn path=/trunk/mcs/; revision=95394
In b/class/System/System.Text.RegularExpressions:
* BaseMachine.cs (Replace): Use either LTRReplace or RTLReplace
based on regex.
(LTRReplace): Make internal and rename the MatchAppendEvaluator
version of Replace to this.
(RTLReplace): New.
* Regex.cs (Replace): Use LTRReplace and RTLReplace from BaseMachine.
* replace.cs (ReplacementEvaluator.Evaluate): Optimize simple case.
Based on patch by Stephane Delcroix.
In b/class/System/Test/System.Text.RegularExpressions:
* MatchTest.cs (Match_Backref): New.
* RegexReplace.cs (direction, testcase.direction): New.
(testcase..ctor): Allow specifying the direction of the replace.
(ReplaceTests): Test replace in both directions.
(EvaluatorTests): New test based on #321036.
svn path=/trunk/mcs/; revision=89034
* replace.cs (Compile): Don't unescape string.
In Test/System.Text.RegularExpressions:
* RegexReplace.cs (tests): New test from #317092.
(ReplaceTests): Don't catch an AssertException.
svn path=/trunk/mcs/; revision=89021
creating several intermediate strings. Simplify internal
intermediate representation.
(ReplacementEvaluator.EvaluateAppend): New. Version of Evaluate
that builds the result directly on a passed-in StringBuilder.
(ReplacementEvaluator.Evaluate): Just a wrapper around
EvaluateAppend.
* regex.cs (MatchAppendEvaluator): New internal delegate.
(Regex.Replace): Use MatchAppendEvaluator.
(Regex.Adapter): New class used to adapt a MatchEvaluator to a
MatchAppendEvaluator.
Rationale: We avoid allocating a lot of memory in the
Replace (..., string, ...) case. We penalize the
Replace (..., MatchEvaluator, ...) version slightly,
but that is already a slow case.
svn path=/trunk/mcs/; revision=44994
* RegexReplace.cs: Add testcase for $+.
In System.Text.RegularExpressions:
* replace.cs (ReplacementEvaluator.CompileTerm): Fix group
returned by $+.
svn path=/trunk/mcs/; revision=44925
* System_test.dll.sources: Add
System.Text.RegularExpressions/RegexReplace.cs.
In System.Text.RegularExpressions:
Fix#74735.
* replace.cs (ReplacementEvaluator.Compile): Allow CompileTerm to
fail and yet have advanced the pointer. Append the scanned-over
portion to the "literal" being built.
(ReplacementEvaluator.CompileTerm): Don't throw any exceptions.
If a term cannot be recognized, just return null.
In Test/System.Text.RegularExpressions:
* RegexReplace.cs: New file. Most of the tests were inspired by
#74735.
svn path=/trunk/mcs/; revision=44813
* replace.cs (ReplacementEvalutator.Term.AppendResult): Renamed
from GetResult. Modified to append to a passed-in StringBuilder
rather than return a string.
(ReplacementEvaluator.Evaluate): Update.
svn path=/trunk/mcs/; revision=44795
* Capture.cs, Group.cs, Match.cs: New files split out of ...
* match.cs: ... this. Remove.
In .:
* System.dll.sources: Update to reflect split-up of
System.Text.RegularExpressions/match.cs.
svn path=/trunk/mcs/; revision=44793
Carlos' bug seems to stem from my failure to interpolate
the "$$" substitution pattern properly.
This fixes bug #48666
svn path=/trunk/mcs/; revision=18492