Commit Graph
40 Commits
Author SHA1 Message Date
Marek Safar aad016fd87 Clean up few more warnings 2010-10-15 15:20:25 +01:00
Miguel de Icaza 183e538e52 2010-07-20 Miguel de Icaza <[email protected]>
* parser.cs (ParseEscape): Now parses with some context, whether
	we are parsing inside a character range which can not contain
	back-references or when we are parsing on a string context which
	can contain back references.

	This fixes bug #577346 which exposed a bug parsing this:

	new Regex("[\\177-\\377]")



svn path=/trunk/mcs/; revision=160626
2010-07-20 17:31:31 +00:00
Rodrigo Kumpera 37ab7f11e3 2010-06-21 Rodrigo Kumpera <[email protected]>
* parser.cs: Handle repetition of position assertions.

	Fixes #610587.

svn path=/trunk/mcs/; revision=159287
2010-06-21 20:18:20 +00:00
Raja R Harinath 66fee73c0a Final piece of explicit numeric group support
* parser.cs (gap): New.
(GetMapping): Return it.
(ResolveReferences): Collect explicit numeric groups which may not
match their indices.
(HandleExplicitNumericGroups): New.  Process the above list to
assign appropriate indices, and compute the correct value of 'gap'.

svn path=/trunk/mcs/; revision=140290
2009-08-19 20:43:01 +00:00
Raja R Harinath 6dac1251cd * syntax.cs (CapturingGroup.Index): Rename from Number to clarify semantics.
(CapturingGroup.CompareTo): New.
* parser.cs, syntax.cs: Update to changes.

svn path=/trunk/mcs/; revision=140289
2009-08-19 20:42:36 +00:00
Raja R Harinath a21d173159 Introduce 'gap' concept into all the variants of regex
* arch.cs (IMachineFactory::Gap): New property.
* compiler.cs (InterpreterFactory): Update to changes.
* RxCompiler.cs (RxInterpreterFactory): Likewise.
* JvmReMachineFactory.cs: Likewise.
* parser.cs (GetMapping): Return the 'gap' index.  Move creation
of mapping dictionary ...
* Regex.cs (CreateMachineFactory): ... here.  Update to changes.

svn path=/trunk/mcs/; revision=140285
2009-08-19 20:41:03 +00:00
Raja R Harinath 4735fd50bc * parser.cs (GetMapping): Extend duplicate check for numeric groups too.
svn path=/trunk/mcs/; revision=140097
2009-08-17 19:26:40 +00:00
Raja R Harinath 51c4ad074a * parser.cs (ResolveReferences): Handle some cases of explicitly-named numeric groups.
svn path=/trunk/mcs/; revision=140096
2009-08-17 19:26:18 +00:00
Raja R Harinath 1c27a86429 * parser.cs (ResolveReferences): Rearrange slightly to prepare for future changes.
svn path=/trunk/mcs/; revision=140095
2009-08-17 19:25:50 +00:00
Raja R Harinath 1163a482f7 regexp backreferences: Implement fallback to octal numbers, and ECMAScript semantics.
* syntax.cs (BackslashNumber.ResolveReference): Implement fallback
to octal numbers, and ECMAScript semantics.
* parser.cs (ResolveReferences): Use it.
* RegexMatchTests.cs (RegexTrial0054..60): New.

svn path=/trunk/mcs/; revision=139657
2009-08-10 16:25:10 +00:00
Raja R Harinath 54481772e9 Distinguish between the potentially ambiguous \nnn and the non-ambiguous \k<...> back-references
* syntax.cs (BackslashNumber): New class.
* parser.cs (ParseSpecial): Create it instead of 'Reference' if a
numeric backreference is seen.

svn path=/trunk/mcs/; revision=139656
2009-08-10 16:24:45 +00:00
Raja R Harinath 88c39f81b9 Regex.IsMatch("abcab", @"(?<ab>ab)c\1")
* System.Text.RegularExpressions/parser.cs (ResolveReferences):
Allow named groups to be referred-to by their group numbers too.
* RegexMatchTests.cs (RegexTrial0053): New.

svn path=/trunk/mcs/; revision=139655
2009-08-10 16:24:21 +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
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 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
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 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
Raja R Harinath a001119e72 * parser.cs (Parser.ConsumeWhitespace): Add bounds check.
svn path=/trunk/mcs/; revision=45960
2005-06-14 12:20:57 +00:00
Raja R Harinath 9819d57368 More low-hanging fruit.
* parser.cs (Parser.Unescape): If the string doesn't contain any
'\' character, don't allocate a new string.

svn path=/trunk/mcs/; revision=44800
2005-05-20 08:50:48 +00:00
Gonzalo Paniagua Javier 1d9c9e2441 Fix warnings
svn path=/trunk/mcs/; revision=43368
2005-04-21 00:47:25 +00:00
Gonzalo Paniagua Javier b6d1f20bbe 2005-02-27 Gonzalo Paniagua Javier <[email protected]>
* parser.cs: stuff inside {} might not be a quantifier. Fixes
	bug #69193.


svn path=/trunk/mcs/; revision=41253
2005-02-27 09:49:14 +00:00
Miguel de Icaza 19e3d1f3fc 2005-01-08 Miguel de Icaza <[email protected]>
* syntax.cs: Applied patch from [email protected] to fix bug
	#71077.

	* parser.cs: Turns out that \digit sequences are octal sequences
	(no leading zero is needed);  And the three octal digit rule
	applies to the leading zero as well.

	This fixes the Unescape method.

2005-01-08  Miguel de Icaza  <[email protected]>

	* RegexBugs.cs: Add new test.



svn path=/trunk/mcs/; revision=38517
2005-01-08 06:21:04 +00:00
Atsushi Eno a8f82f863f 2004-11-09 Atsushi Enomoto <[email protected]>
* parser.cs : cast.

svn path=/trunk/mcs/; revision=35883
2004-11-09 12:29:25 +00:00
Ben Maurer e2a91c4d71 2004-11-08 Ben Maurer <[email protected]>
* replace.cs, parser.cs: Use stringbuilder for allocation sanity.

svn path=/trunk/mcs/; revision=35869
2004-11-09 01:27:09 +00:00
Duncan Mak 24f5ef2c44 Add MIT license to System.dll
svn path=/trunk/mcs/; revision=30054
2004-06-21 18:02:11 +00:00
Jambunathan K 793a40c310 Fixed issues with Regex.Unescape() identified as part of
debugging bug #58256. The original problem reported was about
inconsistency between the way we treat replacement patterns and the
way microsoft treats the replacement patterns in Regex.Replace(). MS
implementation is buggy and doesn't honour escape sequences in the
replacement patterns, even though the SDK claims otherwise.

svn path=/trunk/mcs/; revision=28912
2004-06-06 15:01:33 +00:00
Jackson Harper 000a582758 * parser.cs: Allow creating a regular expression using {,n} as the
specified. The min bounds is set to -1, I am not completely sure
	if that is what it is supposed to be but MS does not set it to 0
	based on testing. Patch by [email protected]. Fixes bug
	#56761.

svn path=/trunk/mcs/; revision=28061
2004-05-25 17:29:44 +00:00
Gonzalo Paniagua Javier 3917ace10c 2004-04-19 Gonzalo Paniagua Javier <[email protected]>
* System.Text.RegularExpressions/arch.cs:
	* System.Text.RegularExpressions/compiler.cs:
	* System.Text.RegularExpressions/interpreter.cs:
	* System.Text.RegularExpressions/parser.cs:
	* System.Text.RegularExpressions/syntax.cs:
	* Test/System.Text.RegularExpressions/PerlTrials.cs:
	Patch by Eric Durand Tremblay.
	1) Capture inner group when named.
	2) Resolved parse error caused by not capturing inner group
	3) Resolved incorrect capture group
	4) Now, not capturing anything when unnamed ( correct behavior)

svn path=/trunk/mcs/; revision=25691
2004-04-19 17:07:46 +00:00
Gonzalo Paniagua Javier 2e689c7335 2004-04-19 Gonzalo Paniagua Javier <[email protected]>
* arch.cs:
	* compiler.cs:
	* interpreter.cs:
	* parser.cs:
	* syntax.cs: converted to unix line endings.

svn path=/trunk/mcs/; revision=25688
2004-04-19 16:54:36 +00:00
Gonzalo Paniagua Javier b55ee14579 2004-03-24 Gonzalo Paniagua Javier <[email protected]>
* parser.cs: fixed group numbering.

svn path=/trunk/mcs/; revision=24551
2004-03-24 23:27:24 +00:00
Jackson Harper edfe1fb025 * parser.cs: Use the group number as the name in mapping. Patch by Gert Driesen.
* regex.cs: Fix off by one error. Patch by Gert Driesen.

svn path=/trunk/mcs/; revision=24418
2004-03-22 16:09:39 +00:00
Gonzalo Paniagua Javier 206db19797 2004-03-16 Gonzalo Paniagua Javier <[email protected]>
* parser.cs: allow a @"\0" escape sequence. Fixes bug #54797.

svn path=/trunk/mcs/; revision=24181
2004-03-16 23:04:13 +00:00
Umadevi S 008455a13a fix for bug 41678 -Uma <[email protected]>
svn path=/trunk/mcs/; revision=22298
2004-01-20 13:25:46 +00:00
Gonzalo Paniagua Javier b0c1b57ccf 2004-01-16 Gonzalo Paniagua Javier <[email protected]>
* System.Text.RegularExpressions/parser.cs: an opening brace without a
	quantifier do not cause a parse error. Fixes bug #52924.
	* Test/System.Text.RegularExpressions/RegexBugs.cs: added test from
	bug #52924.

svn path=/trunk/mcs/; revision=22160
2004-01-16 09:20:09 +00:00
Gonzalo Paniagua Javier 99ed672e31 2002-11-06 Gonzalo Paniagua Javier <[email protected]>
* parser.cs: detect illegal \ at end of pattern. Fixes 31334.

svn path=/trunk/mcs/; revision=8854
2002-11-06 14:34:18 +00:00
Gonzalo Paniagua Javier 7bc8829800 2002-10-25 Gonzalo Paniagua Javier <[email protected]>
* parser.cs: applied fix from Tim Haynes ([email protected]) to
	solve bug #32807. Also modified GetMapping to return the same as MS.

svn path=/trunk/mcs/; revision=8549
2002-10-25 15:09:02 +00:00
Dan Lewis 34112f9810 added ecma character categories to parser.
svn path=/trunk/mcs/; revision=2243
2002-02-05 20:48:52 +00:00
Dan Lewis ad375c8180 Regex classes, initial revision.
svn path=/trunk/mcs/; revision=2205
2002-01-31 08:00:16 +00:00