In System/System.Text.RegularExpressions:
* BaseMachine.cs (LTRReplace): Don't use non-advancement of 'ptr'
to deduce absence of matches -- a match can have length 0.
(RTLReplace): Likewise.
In System/Test/System.Text.RegularExpressions:
* RegexReplace.cs (tests): New test from #324390.
svn path=/trunk/mcs/; revision=89176
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
* MatchTest.cs: Improved tests for null argument checks. Added and
fixed replacement tests.
* RegexMatchTest.cs: Marked tests that do not pass on MS as NotDotNet.
Fixed expected result for trial 5.
* RegexResultTests.cs: Fixed Assert.
* Match.cs: Do not throw NotSupportedException on zero-length
replacement argument.
svn path=/trunk/mcs/; revision=88685
* quicksearch.ch: Optimization. Add byte array as skip table for
chars <= 255, falling back to the hashtable for chars > 255 and
skip distances > 255.
svn path=/trunk/mcs/; revision=80478
Fix#80554
* parser.cs (ResolveReferences): Don't throw an expression if a
capture assertion reference cannot be resolved.
(ParseGroupingConstruct): Provide fallback expression to a capture
assertion.
* syntax.cs (CaptureAssertion): If the bareword doesn't refer to
the name of a capture group, fallback to treating it as a literal
expression.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (bug80554_trials): New tests based on #80554.
svn path=/trunk/mcs/; revision=75885
Fix#79472
* parser.cs (Parser.GetMapping): Use the actual group numbers to
build the mapping.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (GroupNumbers): New test based on #79472.
svn path=/trunk/mcs/; revision=70374
Fix#78278
Remove 65535-limit on number of repetitions matched by a pattern.
We still have a 65535 limit on the length of a pattern and the
number of groups in a pattern.
* compiler.cs (PatternCompiler.EmitCount): New. Emits an int as
two ushorts into the program stream.
(EmitInfo, EmitRepeat, EmitFastRepeat): Use it to emit integers
rather than shorts.
* interpreter.cs (Intepreter.ReadProgramCount): Read an int
emitted into the program stream.
(Interpreter): Use it. Update counts.
(Interpreter.Eval) [OpCode.Repeat, OpCode.FastRepeat]: Likewise.
* parser.cs (ParseGroup): Pass 0x7ffffff as the max value for '*'
and '+' repetition patterns.
* arch.cs (Info, Repeat, FastRepeat): Update description.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (Kill65535_1, Kill65535_2, No65535Limit): New tests
based on #78278.
svn path=/trunk/mcs/; revision=60401
* syntax.cs (Expression.IsComplex): Make abstract.
(Group.IsComplex, Alternation.IsComplex): Move ...
(CompositeExpression.IsComplex): ... here.
(Group.GetAnchorInfo): Reduce allocations. Avoid creating another
ArrayList, and use a StringBuilder to build up the string.
(Repetition.GetAnchorInfo): Use a StringBuilder to build up the string.
(ExpressionAssertion.IsComplex): Override.
svn path=/trunk/mcs/; revision=59583
2006-04-17 Florian Gross <[email protected]>
Raja R Harinath <[email protected]>
* syntax.cs (CharacterClass.Compile): Emit categories after the
character intervals so that the evaluator can pick up the
'IgnoreCase' flag.
In Test/System.Text.RegularExpressions:
2006-04-17 Florian Gross <[email protected]>
* RegexBugs.cs (CharClassWithIgnoreCase): Ensure that character
classes don't interfere with RegexOptions.IgnoreCase.
Started looking at some of Florian's patches, which I realized now that
he hadn't applied.
svn path=/trunk/mcs/; revision=59538
Fix#78007
* interpreter.cs (Interpreter.Eval) [Anchor, Position.StartOfString]:
Don't reset 'ptr' to 0 during forward scan.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (Bug78007): New test from #78007.
svn path=/trunk/mcs/; revision=59177
Fix#76345
* interpreter.cs (Interpreter.FastEval) [FastRepeat]: If the first
tail operation has a 'negate' flag, avoid the "match next char"
optimization.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (Bug76345): New test from #76345.
svn path=/trunk/mcs/; revision=59174
Fix#69269
* arch.cs (OpCode.NotCategory): New. Stands for matching a
character _not_ from the given category.
* debug.cs (DisassembleBlock): Handle it.
* compiler.cs (ICompiler.EmitNotCategory): New.
(Compiler.EmitNotCategory): New. Emit OpCode.NotCategory.
* syntax.cs (CharacterClass.Compile): Don't conflate negation of
the character class and negation of the category. Use
EmitNotCategory.
* interpreter.cs (Interpreter.Eval): Pass OpCode.NotCategory to
EvalChar.
(Interpreter.EvalChar): Handle it.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (Bug69269): New test from #69269.
svn path=/trunk/mcs/; revision=59173
* System.Text.RegularExpressions/interpreter.cs (Eval) [Until, FastUntil]:
Set 'deep' to null when evaluating the tail. Ensure that backtracks don't
confuse the recursion vs. iteration detector.
* Test/System.Text.RegularExpressions/RegexBugs.cs (Bug77487):
New test based on #77487.
svn path=/trunk/mcs/; revision=59114
* parser.cs (Parser.ParseCharacterClass): Handle some more errors.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (HangingHyphens1): New testcase for exceptions in character ranges.
svn path=/trunk/mcs/; revision=58806
* parser.cs (Parser.ParseCharacterClass): Don't automatically
assume there's a range when we see '-'. Ensure that we have seen
at least one other character, and that we aren't already parsing a
range.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (HangingHyphens): New tests from #77626, and
related bugs found by inspection.
svn path=/trunk/mcs/; revision=58776
Fix#77626
* parser.cs (Parser.ParseCharacterClass): Set 'last' when we find
that a '-' doesn't signify a range.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (HangingHyphens): New test from #77626.
svn path=/trunk/mcs/; revision=58774
* Match.cs: Removed the ": base ()" on the private ctor as it is
unrequired and cause an extra public ctor to added (bug #76736).
svn path=/trunk/mcs/; revision=53207
* interpreter.cs (Interpreter.Eval) [OpCode.Until]: Avoid some
cases of recursion when dealing with eager quantifiers too.
svn path=/trunk/mcs/; revision=50491
* System.dll.sources: Update.
In System.Text.RegularExpressions:
* regex.cs: Remove. Split into ...
* MatchEvaluator.cs, Regex.cs, RegexCompilationInfo.cs,
RegexOptions.cs: ... these. Now every publicly exposed type in
this namespace has its own file.
svn path=/trunk/mcs/; revision=48728
* MatchCollection.cs (TryToGet): Don't generate match i+1 when
we're looking for match i. Change post-conditions.
(FullList): New helper property. Ensures the list is fully populated.
(Count, CopyTo): Use it.
(Enumerator.Current): Update to new post-conditions of TryToGet.
(Enumerator.MoveNext): Likewise. Don't modify index if we're
beyond the end.
svn path=/trunk/mcs/; revision=47264
* MatchCollection.cs: Convert to incremental mode.
* regex.cs (Regex.Matches): Update. Pass responsibility of
generating all matches to MatchCollection.
In Test/System.Text.RegularExpressions:
* RegexTest.cs (Matches1, Matches2, ..., Matches10): Combine into ...
(Matches): ... this. Convert to use a data-driven approach. Use ...
(trials): ... this. New variable that lists the regexp, input
text and expected results.
(runTrial): New. Run a suite of MatchCollection tests on each trial.
Tests both incremental and non-incremental modes.
svn path=/trunk/mcs/; revision=47079
Fix#74753.
* Match.cs (Match) [zero-argument variant]: Make private.
* GroupCollection (Item) [string variant]: Don't look for the
group number in an empty match.
In Test/System.Text.RegularExpressions:
* RegexBugs.cs (NameLookupInEmptyMatch): New test from #74753.
svn path=/trunk/mcs/; revision=45958
intermediate arrays to build the final result.
(Interpreter.GetGroupInfo, Interpreter.PopulateGroup): New helper
functions.
* CaptureCollection.cs (list): Change from ArrayList to list.
(SetValue): New internal helper, used by Interpreter.PopulateGroup.
(Enumerator): Remove helper class.
(IEnumerator.GetEnumerator): Just use list.GetEnumerator.
* GroupCollection.cs: Likewise.
* Group.cs (Group): Move responsibility of populating 'Captures'
to Interpreter.PopulateGroup.
* Match.cs (Match): Move responsibility of populating 'Groups' to
Interpreter.GenerateMatch.
This reduced the time for 100000 iterations of the 'regex'[1] benchmark
from 63s to 53s.
svn path=/trunk/mcs/; revision=45757
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