Commit Graph
140 Commits
Author SHA1 Message Date
Arina Itkes 0368fce4da Fix for bug 9751. Regression on regular expressions should not be happened.
svn path=/trunk/mcs/; revision=94682
2008-02-03 13:21:12 +00:00
Arina Itkes 63b1cf2a21 Compilation fix
svn path=/trunk/mcs/; revision=94231
2008-01-29 07:01:37 +00:00
Arina Itkes cdd27b35e3 Fix for 9749. Support of backslash and bracket characters into character class for IBM JVM.
svn path=/trunk/mcs/; revision=94128
2008-01-28 13:52:28 +00:00
Arina Itkes c48b260406 Fix for bug 9720. Patterns are fixed for correct working with IBM Java virtual machine too.
svn path=/trunk/mcs/; revision=93371
2008-01-21 08:38:15 +00:00
Arina Itkes 357ee9ae90 New test for groups with same name. Fix for JvmReMachine.
svn path=/trunk/mcs/; revision=91864
2007-12-24 15:40:41 +00:00
Arina Itkes 7c81b3ab52 Changes in ChangeLog moved to their place
svn path=/trunk/mcs/; revision=90650
2007-12-04 11:01:39 +00:00
Arina Itkes 074e54f3f8 Max value of m for a construct {n,m} is 2147483647.
svn path=/trunk/mcs/; revision=90629
2007-12-04 10:35:14 +00:00
Arina Itkes 8efbd8956d Regular expressions fixes for new tests failures
svn path=/trunk/mcs/; revision=90418
2007-11-29 09:50:47 +00:00
Arina Itkes 0998f6db36 Fix bug for regular expression with more than one same group names.
svn path=/trunk/mcs/; revision=90268
2007-11-25 14:18:23 +00:00
Arina Itkes 77901e4ac9 Fix: Not replace an escaped left bracket inside of captured group.
svn path=/trunk/mcs/; revision=90172
2007-11-22 17:36:27 +00:00
Arina Itkes d4f77cb153 Fixed wrong conversion from replacement string "\\" to "\" (bug#9460)
svn path=/trunk/mcs/; revision=89884
2007-11-18 12:16:45 +00:00
Arina Itkes 337cf121e0 Removed machine initialization that was removed from Regex.
svn path=/trunk/mcs/; revision=89882
2007-11-18 08:59:54 +00:00
Miguel de Icaza 3cfcca3926 2007-11-12 Atsushi Enomoto <[email protected]>
* System.dll.sources : added S.R.InteropSvcs.ComTypes types.

svn path=/trunk/mcs/; revision=89684
2007-11-15 16:50:05 +00:00
Raja R Harinath 01dbfb50d5 Fix 324390
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
2007-11-08 03:31:44 +00:00
Raja R Harinath b35097bc0b Support RegexOptions.RightToLeft in Replace().
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
2007-11-06 22:03:35 +00:00
Raja R Harinath baf4cdef81 In System.Text.RegularExpressions:
* 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
2007-11-06 19:28:12 +00:00
Gert Driesen 083af1ff31 * GroupTest.cs: Improved test for null argument check.
* 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
2007-11-01 21:17:50 +00:00
Arina Itkes 9d7c2d7c36 - Change Log updated for revisions 88065, 88356 and 88375
- Original Copyright is set on extracted by refactoring class BaseMachine.

svn path=/trunk/mcs/; revision=88390
2007-10-29 15:46:34 +00:00
Arina Itkes 36147b8fc4 Fix:
- Fixing category construct
- Moving category construct to Mono machine
- Fix grouping meta data for ExplicitCapture options
- Moving machine creation to ctor
- Fix of Result method

svn path=/trunk/mcs/; revision=88376
2007-10-29 12:24:10 +00:00
Arina Itkes 232e79acdf Moving creation of Regex machine to ctor.
svn path=/trunk/mcs/; revision=88375
2007-10-29 12:20:38 +00:00
Arina Itkes 4f48041bbd Fix for Result method of Match. Throwing an exception if Result method was called on a failed Match.
svn path=/trunk/mcs/; revision=88356
2007-10-29 09:20:00 +00:00
Juraj Skripsky e1559f84d7 2007-10-24 Juraj Skripsky <[email protected]>
* Regex.cs: Store and re-use IMachine, no need to re-instantiate
	it every time we're matching.


svn path=/trunk/mcs/; revision=88076
2007-10-24 15:33:49 +00:00
Arina Itkes 74955d262a - Added new machine that implements IMachine interface. It executes parsing with java regular expressions.
svn path=/trunk/mcs/; revision=88066
2007-10-24 14:21:01 +00:00
Arina Itkes 61d27ad7fc - Refactoring of Interpreter with extracting of base abstract class that executes some methods that were moved from Regex and Match classes.
- Added a field that maps group numbers to group names in Regex for improvement of performance of GroupNameFromNumber method.

svn path=/trunk/mcs/; revision=88065
2007-10-24 14:18:57 +00:00
Gert Driesen bf1bbd952a * RegexTest.cs: Removed. Test was already moved to the appropriate
location.

svn path=/trunk/mcs/; revision=87867
2007-10-21 13:29:41 +00:00
Jb Evain d3c17dd1eb use 2.1 compatible Enum.Parse method
svn path=/trunk/mcs/; revision=84350
2007-08-18 10:20:58 +00:00
Juraj Skripsky 5e5f78f18c 2007-06-21 Juraj Skripsky <[email protected]>
* 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
2007-06-21 14:31:00 +00:00
Raja R Harinath 05c754d952 In System.Text.RegularExpressions:
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
2007-04-18 14:52:01 +00:00
Raja R Harinath b27e2a88ae * interpreter.cs (Eval) <OpCode.Reference>: Distribute for loop inside if.
for () if (a) s1; else s2; => if (a) for () s1; else for () s2;

svn path=/trunk/mcs/; revision=75393
2007-04-04 14:46:59 +00:00
Raja R Harinath 1b0f319466 * Regex.cs (~Regex): Don't define in NET_2_0 profile.
svn path=/trunk/mcs/; revision=75338
2007-04-03 11:43:49 +00:00
Konstantin Triger a83c9ab209 TARGET_JVM: ifdef unsupported stuff
svn path=/trunk/mcs/; revision=71593
2007-01-24 14:32:12 +00:00
Raja R Harinath 24bba3fcc8 In System.Text.RegularExpressions:
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
2007-01-02 17:52:33 +00:00
Andrew Skiba 692e5cf88b revert unnecessary TARGET_JVM
svn path=/trunk/mcs/; revision=66184
2006-10-03 12:50:13 +00:00
Andrew Skiba 7f0db39bd5 TARGET_JVM
svn path=/trunk/mcs/; revision=66033
2006-09-28 13:45:23 +00:00
Gert Driesen d4accb58b4 * CaptureCollection.cs: Removed virtual keyword to fix API mismatches.
* MatchCollection.cs: Removed virtual keyword to fix API mismatches.
* GroupCollection.cs: Removed virtual keyword to fix API mismatches.

svn path=/trunk/mcs/; revision=61254
2006-05-30 10:01:00 +00:00
Raja R Harinath 083ccb79d8 In System.Text.RegularExpressions:
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
2006-05-08 13:44:23 +00:00
Raja R Harinath c6ea88f745 Treat fixed repetitions of simple regexes as simple too.
* 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-18 09:59:13 +00:00
Raja R Harinath a0072aeec0 In System.Text.RegularExpressions:
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
2006-04-17 14:05:46 +00:00
Raja R Harinath d96a4c42b2 In System.Text.RegularExpressions:
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
2006-04-07 13:44:55 +00:00
Raja R Harinath 4d94dda2bf In System.Text.RegularExpressions:
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
2006-04-07 12:01:44 +00:00
Raja R Harinath aeacac9505 In System.Text.RegularExpressions:
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
2006-04-07 10:00:23 +00:00
Raja R Harinath 91300ea498 Fix #77487
* 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
2006-04-06 14:29:06 +00:00
Raja R Harinath 5c74d8a989 * interpreter.cs (Eval) [Until, lazy]: Avoid extra evaluation on a
degenerate match.

svn path=/trunk/mcs/; revision=58954
2006-04-03 14:04:53 +00:00
Raja R Harinath 5718114083 In System.Text.RegularExpressions:
* 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
2006-03-30 16:37:29 +00:00
Raja R Harinath 0117c762c6 In System.Text.RegularExpressions:
* 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
2006-03-30 12:29:51 +00:00
Raja R Harinath 41c152eba7 In System.Text.RegularExpressions:
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
2006-03-30 10:18:44 +00:00
Kornél Pál d993e00c33 * Regex.cs: Added support for regular expressions compiled to assemblies by compiling the pattern. This solution ignores existing CIL code but provides full support for regular expression classes compiled by MS.NET.
svn path=/trunk/mcs/; revision=54917
2005-12-29 19:34:27 +00:00
Sebastien Pouliot 1a7ff3d408 2005-11-21 Sebastien Pouliot <[email protected]>
* CaptureCollection.cs: Fixed length check.
	* Group.cs: Added missing validation for Synchronized method.
	* Match.cs: Added missing validation for Synchronized and Result 
	methods.
	* MatchEvaluator.cs: Added [Serializable] for 2.0 profile.
	* RegexCompilationInfo.cs: Added missing property validation.
	* Regex.cs: Implemented UseOptionC and UseOptionR protected methods
	(now documented). Fixed API for 2.0 profile.
	* RegexRunner.cs: Stubbed CharInClass for 2.0 profile.


svn path=/trunk/mcs/; revision=53312
2005-11-21 18:33:35 +00:00
Sebastien Pouliot 43a0fba6b1 2005-11-17 Sebastien Pouliot <[email protected]>
* MatchCollection.cs: Add missing virtual to indexer property.

svn path=/trunk/mcs/; revision=53208
2005-11-17 20:24:47 +00:00
Sebastien Pouliot 048be78654 2005-11-17 Sebastien Pouliot <[email protected]>
* 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
2005-11-17 20:20:13 +00:00