2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System / System.Text.RegularExpressions / ChangeLog
1 2007-10-21  Gert Driesen  <drieseng@users.sourceforge.net>
2
3         * RegexTest.cs: Removed. Test was already moved to the appropriate
4         location. 
5
6 2007-06-21  Juraj Skripsky <js@hotfeet.ch>
7
8         * quicksearch.ch: Optimization. Add byte array as skip table for
9         chars <= 255, falling back to the hashtable for chars > 255 and
10         skip distances > 255.
11
12 2007-04-18  Raja R Harinath  <rharinath@novell.com>
13
14         Fix #80554
15         * parser.cs (ResolveReferences): Don't throw an expression if a
16         capture assertion reference cannot be resolved.
17         (ParseGroupingConstruct): Provide fallback expression to a capture
18         assertion.
19         * syntax.cs (CaptureAssertion): If the bareword doesn't refer to
20         the name of a capture group, fallback to treating it as a literal
21         expression.
22
23 2007-04-04  Raja R Harinath  <rharinath@novell.com>
24
25         * interpreter.cs (Eval) <OpCode.Reference>: Distribute for loop
26         inside if.
27         for () if (a) s1; else s2; => if (a) for () s1; else for () s2;
28
29 2007-04-03  Raja R Harinath  <rharinath@novell.com>
30
31         * Regex.cs (~Regex): Don't define in NET_2_0 profile.
32
33 2007-01-02  Raja R Harinath  <rharinath@novell.com>
34
35         Fix #79472
36         * parser.cs (Parser.GetMapping): Use the actual group numbers to
37         build the mapping.
38
39 2006-09-28  Andrew Skiba  <andrews@mainsoft.com>
40
41         * Regex.cs: TARGET_JVM
42
43 2006-05-30  Gert Driesen  <drieseng@users.sourceforge.net>
44
45         * CaptureCollection.cs: Removed virtual keyword to fix API mismatches.
46         * MatchCollection.cs: Removed virtual keyword to fix API mismatches.
47         * GroupCollection.cs: Removed virtual keyword to fix API mismatches.
48
49 2006-05-08  Raja R Harinath  <rharinath@novell.com>
50
51         Fix #78278
52         Remove 65535-limit on number of repetitions matched by a pattern.
53         We still have a 65535 limit on the length of a pattern and the
54         number of groups in a pattern.
55         * compiler.cs (PatternCompiler.EmitCount): New.  Emits an int as
56         two ushorts into the program stream.
57         (EmitInfo, EmitRepeat, EmitFastRepeat): Use it to emit integers
58         rather than shorts.
59         * interpreter.cs (Intepreter.ReadProgramCount): Read an int
60         emitted into the program stream.
61         (Interpreter): Use it.  Update counts.
62         (Interpreter.Eval) [OpCode.Repeat, OpCode.FastRepeat]: Likewise.
63         * parser.cs (ParseGroup): Pass 0x7ffffff as the max value for '*'
64         and '+' repetition patterns.
65         * arch.cs (Info, Repeat, FastRepeat): Update description.
66
67 2006-04-18  Raja R Harinath  <rharinath@novell.com>
68
69         Treat fixed repetitions of simple regexes as simple too.
70         * syntax.cs (Expression.IsComplex): Make abstract.
71         (Group.IsComplex, Alternation.IsComplex): Move ...
72         (CompositeExpression.IsComplex): ... here.
73         (Group.GetAnchorInfo): Reduce allocations.  Avoid creating another
74         ArrayList, and use a StringBuilder to build up the string.
75         (Repetition.GetAnchorInfo): Use a StringBuilder to build up the string.
76         (ExpressionAssertion.IsComplex): Override.
77
78 2006-04-17  Florian Gross  <flgr@ccan.de>
79             Raja R Harinath  <rharinath@novell.com>
80
81         * syntax.cs (CharacterClass.Compile): Emit categories after the
82         character intervals so that the evaluator can pick up the
83         'IgnoreCase' flag.
84
85 2006-04-07  Raja R Harinath  <rharinath@novell.com>
86
87         Fix #78007
88         * interpreter.cs (Interpreter.Eval) [Anchor, Position.StartOfString]:
89         Don't reset 'ptr' to 0 during forward scan.
90
91         Fix #76345
92         * interpreter.cs (Interpreter.FastEval) [FastRepeat]: If the first
93         tail operation has a 'negate' flag, avoid the "match next char"
94         optimization.
95
96         Fix #69269
97         * arch.cs (OpCode.NotCategory): New.  Stands for matching a
98         character _not_ from the given category.
99         * debug.cs (DisassembleBlock): Handle it.
100         * compiler.cs (ICompiler.EmitNotCategory): New.
101         (Compiler.EmitNotCategory): New.  Emit OpCode.NotCategory.
102         * syntax.cs (CharacterClass.Compile): Don't conflate negation of
103         the character class and negation of the category.  Use
104         EmitNotCategory.
105         * interpreter.cs (Interpreter.Eval): Pass OpCode.NotCategory to
106         EvalChar.
107         (Interpreter.EvalChar): Handle it.
108
109 2006-04-06  Raja R Harinath  <rharinath@novell.com>
110
111         Fix #77487
112         * interpreter.cs (Eval) [Until, FastUntil]: Set 'deep' to null
113         when evaluating the tail.  Ensure that backtracks don't confuse
114         the recursion vs. iteration detector.
115
116 2006-04-03  Raja R Harinath  <rharinath@novell.com>
117
118         * interpreter.cs (Eval) [Until, lazy]: Avoid extra evaluation on a
119         degenerate match.
120
121 2006-03-30  Raja R Harinath  <harinath@gmail.com>
122
123         Fix #77626
124         * parser.cs (Parser.ParseCharacterClass): Don't automatically
125         assume there's a range when we see '-'.  Ensure that we have seen
126         at least one other character, and that we aren't already parsing a
127         range.  Handle some more errors.
128
129 2005-12-19  Kornél Pál  <kornelpal@hotmail.com>
130
131         * Regex.cs: Added support for regular expressions compiled to
132           assemblies by compiling the pattern. This solution ignores existing
133           CIL code but provides full support for regular expression classes
134           compiled by MS.NET.
135
136 2005-11-21  Sebastien Pouliot  <sebastien@ximian.com> 
137
138         * CaptureCollection.cs: Fixed length check.
139         * Group.cs: Added missing validation for Synchronized method.
140         * Match.cs: Added missing validation for Synchronized and Result 
141         methods.
142         * MatchEvaluator.cs: Added [Serializable] for 2.0 profile.
143         * RegexCompilationInfo.cs: Added missing property validation.
144         * Regex.cs: Implemented UseOptionC and UseOptionR protected methods
145         (now documented). Fixed API for 2.0 profile.
146         * RegexRunner.cs: Stubbed CharInClass for 2.0 profile.
147
148 2005-11-17  Sebastien Pouliot  <sebastien@ximian.com> 
149  
150         * Match.cs: Removed the ": base ()" on the private ctor as it is
151         unrequired and cause an extra public ctor to added (bug #76736).
152         * MatchCollection.cs: Add missing virtual to indexer property.
153
154 2005-09-23  Raja R Harinath  <rharinath@novell.com>
155
156         * interpreter.cs (Interpreter.Eval) [OpCode.Until]: Invert the
157         sense of a test to reflect the code re-organization.
158
159 2005-09-22  Raja R Harinath  <rharinath@novell.com>
160
161         Fix #72152, #72989.
162         * interpreter.cs (Interpreter.Eval) [OpCode.Until]: Avoid some
163         cases of recursion when dealing with eager quantifiers too.  We
164         now avoid recursion when handling the innermost quantifier.
165         (Interpreter.IntStack, Interpreter.stack): New.  Stack to help
166         implement backtracking in eager quantifiers.
167
168 2005-09-21  Raja R Harinath  <rharinath@novell.com>
169
170         * interpreter.cs (Interpreter.Eval) [OpCode.Until]: Avoid some
171         cases of recursion when dealing with the minimum count and lazy
172         quantifiers.
173
174 2005-08-23  Raja R Harinath  <rharinath@novell.com>
175
176         * regex.cs: Remove.  Split into ...
177         * MatchEvaluator.cs, Regex.cs, RegexCompilationInfo.cs, 
178         RegexOptions.cs: ... these.  Now every publicly exposed type in
179         this namespace has its own file.
180
181 2005-07-21  Florian Gross  <flgr@ccan.de>
182
183         * Fixed a bug in category.cs that caused ECMAScript \d to fail.
184
185 2005-07-13  Raja R Harinath  <rharinath@novell.com>
186
187         Make even more lazier.
188         * MatchCollection.cs (TryToGet): Don't generate match i+1 when
189         we're looking for match i.  Change post-conditions.
190         (FullList): New helper property.  Ensures the list is fully populated.
191         (Count, CopyTo): Use it.
192         (Enumerator.Current): Update to new post-conditions of TryToGet.
193         (Enumerator.MoveNext): Likewise.  Don't modify index if we're
194         beyond the end.
195
196 2005-07-08  Raja R Harinath  <rharinath@novell.com>
197
198         * MatchCollection.cs: Convert to incremental mode.
199         * regex.cs (Regex.Matches): Update.  Pass responsibility of
200         generating all matches to MatchCollection.
201
202 2005-06-14  Raja R Harinath  <harinath@gmail.com>
203
204         * parser.cs (Parser.ConsumeWhitespace): Add bounds check.
205
206         Fix #74753.
207         * Match.cs (Match) [zero-argument variant]: Make private.
208         * GroupCollection (Item) [string variant]: Don't look for the
209         group number in an empty match.
210
211 2005-06-10  Raja R Harinath  <rharinath@novell.com>
212
213         * interpreter.cs (Interpreter.GenerateMatch): Avoid allocating two
214         intermediate arrays to build the final result.
215         (Interpreter.GetGroupInfo, Interpreter.PopulateGroup): New helper
216         functions.
217         * CaptureCollection.cs (list): Change from ArrayList to list.
218         (SetValue): New internal helper, used by Interpreter.PopulateGroup.
219         (Enumerator): Remove helper class.
220         (IEnumerator.GetEnumerator): Just use list.GetEnumerator.
221         * GroupCollection.cs: Likewise.
222         * Group.cs (Group): Move responsibility of populating 'Captures'
223         to Interpreter.PopulateGroup.
224         * Match.cs (Match): Move responsibility of populating 'Groups' to
225         Interpreter.GenerateMatch.
226
227 2005-05-25  Raja R Harinath  <rharinath@novell.com>
228
229         * replace.cs (ReplacementEvaluator.Compile): Rewrite to avoid
230         creating several intermediate strings.  Simplify internal
231         intermediate representation.
232         (ReplacementEvaluator.EvaluateAppend): New.  Version of Evaluate
233         that builds the result directly on a passed-in StringBuilder.
234         (ReplacementEvaluator.Evaluate): Just a wrapper around
235         EvaluateAppend.
236         * regex.cs (MatchAppendEvaluator): New internal delegate.
237         (Regex.Replace): Use MatchAppendEvaluator.
238         (Regex.Adapter): New class used to adapt a MatchEvaluator to a
239         MatchAppendEvaluator.
240
241 2005-05-24  Raja R Harinath  <rharinath@novell.com>
242
243         * replace.cs (ReplacementEvaluator.CompileTerm): Fix group
244         returned by $+.
245
246 2005-05-20  Ben Maurer  <bmaurer@ximian.com>
247
248         * regex.cs: Some memory allocation optimizations.
249
250 2005-05-20  Raja R Harinath  <rharinath@novell.com>
251
252         Fix #74735.
253         * replace.cs (ReplacementEvaluator.Compile): Allow CompileTerm to
254         fail and yet have advanced the pointer.  Append the scanned-over
255         portion to the "literal" being built.
256         (ReplacementEvaluator.CompileTerm): Don't throw any exceptions.
257         If a term cannot be recognized, just return null.
258
259         * compiler.cs (InterpreterFactory.GroupCount): Fix.  The 0'th
260         index corresponds to Opcode.Info.
261
262         * parser.cs (Parser.Unescape): If the string doesn't contain any
263         '\' character, don't allocate a new string.
264
265         * replace.cs (ReplacementEvalutator.Term.AppendResult): Rename
266         from GetResult.  Append to a passed-in StringBuilder rather than
267         return a string.
268         (ReplacementEvaluator.Evaluate): Update.
269         
270         * Capture.cs, Group.cs, Match.cs: New files split out of ...
271         * match.cs: ... this.  Remove.
272
273 2005-02-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
274
275         * parser.cs: stuff inside {} might not be a quantifier. Fixes
276         bug #69193.
277
278 2005-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
279
280         * quicksearch.cs: handle IgnoreCase when getting the shift distance.
281         Fixes bug #69065. Patch by mei@work.email.ne.jp.
282
283 2005-01-08  Miguel de Icaza  <miguel@ximian.com>
284
285         * syntax.cs: Applied patch from mei@work.email.ne.jp to fix bug
286         #71077.
287
288         * parser.cs: Turns out that \digit sequences are octal sequences
289         (no leading zero is needed);  And the three octal digit rule
290         applies to the leading zero as well.
291
292         This fixes the Unescape method.
293
294 2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
295
296         * regex.cs: use NextMatch to move on to the next match. Fixes bug
297         #57274.
298
299 2004-11-09  Atsushi Enomoto  <atsushi@ximian.com>
300
301         * parser.cs : cast.
302
303 2004-11-08  Ben Maurer  <bmaurer@ximian.com>
304
305         * replace.cs, parser.cs: Use stringbuilder for allocation sanity.
306
307 2004-10-21  Joerg Rosenkranz  <joergr@voelcker.com>
308
309         * regex.cs: Fixed a bug introduced with the last patch which
310         prevented any replacements when a postive count is given.
311         This also happens in all overloads without count parameter.
312
313 2004-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
314
315         * regex.cs: in Replace, when count is negative, replacement continues
316         to the end of the string.
317
318         Fixes bug #68398. Patch by Jon Larimer.
319
320 2004-06-10  Gert Driesen <drieseng@users.sourceforge.net>
321
322         * RegexRunner.cs: fixed case mismatch of methods
323
324 2004-06-10  Gert Driesen <drieseng@users.sourceforge.net>
325
326         * RegexRunner.cs: marked TODO, added missing protected internal
327         fields, throw NotImplementedException in all methods
328
329 2004-06-10  Gert Driesen <drieseng@users.sourceforge.net>
330
331         * RegexRunnerFactory.cs: removed comment, no longer throw exception
332         from ctor
333         * regex.cs: fixed public API signature by renaming protected 
334         internal fields and adding destructor, added MonoTODO attribute to
335         fields and method that are not yet implemented, changed not 
336         implemented methods to throw NotImplementedException instead of
337         Exception, fixed names of field that are serialized
338
339 2004-06-06  Jambunathan K <kjambunathan@novell.com>
340         
341         * parser.cs: Fixed issues with Regex.Unescape() identified as part of
342         debugging bug #58256. The original problem reported was about
343         inconsistency between the way we treat replacement patterns and the 
344         way microsoft treats the replacement patterns in Regex.Replace(). MS
345         implementation is buggy and doesn't honour escape sequences in the
346         replacement patterns, even though the SDK claims otherwise.
347
348         
349 2004-06-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
350
351         * syntax.cs: re-applied my patch from 2004-05-27 plus a fix which is
352         emitting a Category.All if both a category and its negated value are
353         present.
354
355 2004-06-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
356
357         * syntax.cs: reverting my previous patch. It causes bigger problems.
358
359 2004-05-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
360
361         * category.cs: added LastValue field to mark the end of enum Category.
362         * syntax.cs: in CharacterClass, use Category.LastValue to get the size
363         of the array needed. Use a BitArray instead of bool[].
364         In AddCategory(), don't set the opposite category as false. Fixes
365         bug #59150. All tests pass.
366
367 2004-05-25  Jackson Harper  <jackson@ximian.com>
368
369         * parser.cs: Allow creating a regular expression using {,n} as the
370         specified. The min bounds is set to -1, I am not completely sure
371         if that is what it is supposed to be but MS does not set it to 0
372         based on testing. Patch by dave-gnome-bugs@earth.li. Fixes bug #56761.
373
374 2004-05-12  Dick Porter  <dick@ximian.com>
375
376         * regex.cs: 
377         * quicksearch.cs: 
378         * RegexRunnerFactory.cs: 
379         * RegexRunner.cs: More public API difference fixes.
380
381         * GroupCollection.cs: 
382         * MatchCollection.cs: 
383         * CaptureCollection.cs: Moved GroupCollection, MatchCollection and
384         CaptureCollection so that they no longer inherit from the
385         non-standard RegexCollectionBase class.  Fixes the API difference.
386
387 2004-04-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
388
389         * arch.cs:
390         * compiler.cs:
391         * interpreter.cs:
392         * parser.cs:
393         * syntax.cs:
394         Patch by Eric Durand Tremblay.
395         1) Capture inner group when named.
396         2) Resolved parse error caused by not capturing inner group
397         3) Resolved incorrect capture group
398         4) Now, not capturing anything when unnamed ( correct behavior)
399
400
401 2004-04-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
402
403         * arch.cs:
404         * compiler.cs:
405         * interpreter.cs:
406         * parser.cs:
407         * syntax.cs: converted to unix line endings.
408
409 2004-03-30  Lluis Sanchez Gual <lluis@ximian.com>
410
411         * collections.cs: In the indexer, return an empty group if the requested
412         group is not found.
413         * match.cs: Added default constructor for Group.
414         
415 2004-03-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
416
417         * parser.cs: fixed group numbering.
418
419 2004-03-22  Jackson Harper  <jackson@ximian.com>
420
421         * parser.cs: Use the group number as the name in mapping. Patch by
422         Gert Driesen.
423         * regex.cs: Fix off by one error. Patch by Gert Driesen.
424
425 2004-03-17  Francois Beauchemin <beauche@softhome.net>
426         * syntax.cs, interpreter.cs, quicksearch.cs, regex.cs, compiler.cs : 
427                 Revised support for RigthToLeft. 
428                 quicksearch has now an reverse option.          
429                 This fixes bug #54537 
430  
431         * regex.cs, compiler.cs :
432                 Some code to support CILCompiler.               
433         * regex.cs : 
434                 Added some undocumented of MS.
435  
436 2004-03-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
437
438         * parser.cs: allow a @"\0" escape sequence. Fixes bug #54797.
439
440 2004-02-01  Miguel de Icaza  <miguel@ximian.com>
441
442         * syntax.cs, interval.cs: Applied patch from Marco Cravairo
443         through Francois Beauchemin who reviewed on the mailing list.
444         This fixes bug #45976
445
446 2004-01-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
447
448         * parser.cs: an opening brace without a
449         quantifier do not cause a parse error. Fixes bug #52924.
450
451 2004-01-07  Lluis Sanchez Gual <lluis@ximian.com>
452
453         * regex.cs: In Split(), if the last match is at the end of the string, 
454         an empty string must be added to the array of results.
455
456 2003-12-15  Sanjay Gupta <gsanjay@novell.com>
457         * match.cs: Check for null value before Substring method call.  
458         Fixes bug #52034.
459
460 2003-11-21  Juraj Skripsky <js@hotfeet.ch>
461
462         * quicksearch.cs: Create and use hashtable only for "long" search 
463         strings. 
464
465         (Search): Use simple scan for a single-character search strings.
466         
467         (GetChar): Simplify case sensitivity handling.
468
469 2003-11-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
470
471         * interpreter.cs: when evaluating a degenerate match, restore the
472         RepeatContext if fail. Fixes bug #42529.
473
474 2003-11-22  Jackson Harper <jackson@ximian.com>
475
476         * regex.cs: Add CultureInvariant flag to RegexOptions.
477         
478 2003-11-20  Juraj Skripsky <js@hotfeet.ch>
479
480         * quicksearch.cs: Use a hashtable instead of an array for the
481         shift table to improve the memory usage.  
482
483 2003-11-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
484
485         * regex.cs:
486         (Split): include capture groups in the results, if any. Fixes bug
487         #51146.
488
489 2003-07-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
490
491         * regex.cs: patch from Eric Lindvall <eric@5stops.com> that fixes bug
492         #44830.
493
494 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
495
496         * category.cs (CategoryUtils.CategoryFromName): Use StartsWith
497         ("Is") instead of a substring for (0,2) which was throwing an
498         exception causing Category.None to be returned
499
500 2003-01-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
501
502         * collections.cs: fixed bug #30091.
503
504 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
505
506         * regex.cs: fixed little mistake (closes #35860).
507
508 2002-11-12 Jackson Harper <jackson@latitudegeo.com>
509
510         * arch.cs compiler.cs regex.cs: Added mapping attribute to MachineFactories
511
512 2002-11-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
513
514         * parser.cs: detect illegal \ at end of pattern. Fixes 31334.
515
516 2002-10-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
517
518         * parser.cs: applied fix from Tim Haynes (thaynes@openlinksw.com) to
519         solve bug #32807. Also modified GetMapping to return the same as MS.
520
521 2002-08-28  Juli Mallett  <jmallett@FreeBSD.org>
522
523         * arch.cs, compiler.cs: Give the interpreter machine a property
524         for the retrieval of the group count.
525
526         * regex.cs: Use the new GroupCount property of the factory to
527         initialise the current group count, and restructure code to compile
528         the pattern only the first time it is needed (essentially backing
529         out the previous revision of regex.cs, to use the new code.)
530
531 2002-08-14  Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
532
533         * regex.cs: Added the ctr for ISerializable implementation and
534         implemented the GetObjectData function.
535
536 2002-07-30  Juli Mallett  <jmallett@FreeBSD.org>
537
538         * regex.cs: Fixed bug where the expression would not be
539         re-evaluated for grouping purposes when factory caches were
540         used, resulting in no groups being recognised after one call
541         with a given pattern and no change in options.
542
543 2002-05-13  Dan Lewis  <dihlewis@yahoo.co.uk>
544
545         * regex.cs: Fixed bug in split.
546
547 2002-05-08  Dan Lewis  <dihlewis@yahoo.co.uk>
548
549         * interpreter.cs: Moved to an array-based stack representation
550         for faster captures.
551
552         * match.cs, collections.cs: Decoupled capture representation from
553         interpreter internals.
554
555         * cache.cs: Changed Key type from struct to class for speed.
556
557 2002-04-06  Dan Lewis  <dihlewis@yahoo.co.uk>
558
559         * cache.cs: Object methods should be overridden with "override".
560
561 2002-04-04  Dan Lewis  <dihlewis@yahoo.co.uk>
562
563         * RegexRunner.cs, RegexRunnerFactory.cs: MS support classes. Stubs
564         added for completeness.
565
566         * regex.cs, match.cs, collections.cs: Serializable attribute.
567
568 2002-04-04  Dan Lewis  <dihlewis@yahoo.co.uk>
569
570         * regex.cs: Added static Matches and IsMatch methods.
571
572 2002-04-03  Dan Lewis  <dihlewis@yahoo.co.uk>
573
574         * ChangeLog: Added changelog.
575
576         * cache.cs: Fixed bug in MRUList.Evict.