1 2009-09-07 Raja R Harinath <harinath@hurrynot.org>
3 Add some null checks and bounds checks.
4 * Regex.cs (default_startat): New. Replaces the fragment
5 'RightToLeft ? input.Length : 0' with a null-safe variant.
6 (Replace) <string variant>: Add null checks for argument strings.
8 (.ctor): Likewise. Validate regex options partially.
9 (Match): Add null check on string arguments, and bounds checks for
10 offset and length arguments.
12 2009-08-20 Raja R Harinath <harinath@hurrynot.org>
14 Final piece of explicit numeric group support
15 * parser.cs (gap): New.
16 (GetMapping): Return it.
17 (ResolveReferences): Collect explicit numeric groups which may not
19 (HandleExplicitNumericGroups): New. Process the above list to
20 assign appropriate indices, and compute the correct value of 'gap'.
22 2009-08-20 Raja R Harinath <harinath@hurrynot.org>
24 * syntax.cs (CapturingGroup.Index): Rename from Number to clarify
26 (CapturingGroup.CompareTo): New.
27 * parser.cs, syntax.cs: Update to changes.
29 2009-08-20 Raja R Harinath <harinath@hurrynot.org>
31 Implement some more group number/index distinction
32 * Regex.cs (gap, Gap): New.
33 (Init, InitNewRegex): Update it.
34 (GroupNumberFromName): If the 'name' is beyond the gap, it is an
35 explicit numeric group -- use the name as the group number.
36 (GetGroupIndex): Use a binary search to map a group number to its
37 index when we know that they don't match.
38 (GroupNumbers): Use group number, not group index, for explicit
40 * Match.cs (.ctor): Use the newly introduce 'Regex.Gap'.
42 2009-08-19 Raja R Harinath <harinath@hurrynot.org>
44 * Regex.cs (group_numbers): New.
45 (GetGroupNumbers): Move array initialization ...
46 (GroupNumbers): ... to new on-demand initializer.
48 2009-08-19 Raja R Harinath <harinath@hurrynot.org>
50 * Regex.cs (group_names): Rename from _groupNumbersToNameMap.
51 (GetGroupNamesArray): Use an IDictionaryEnumerator to walk the
52 mapping, since both the key and value are used in the loop.
54 2009-08-19 Raja R Harinath <harinath@hurrynot.org>
56 Introduce 'gap' concept into all the variants of regex
57 * arch.cs (IMachineFactory::Gap): New property.
58 * compiler.cs (InterpreterFactory): Update to changes.
59 * RxCompiler.cs (RxInterpreterFactory): Likewise.
60 * JvmReMachineFactory.cs: Likewise.
61 * parser.cs (GetMapping): Return the 'gap' index. Move creation
62 of mapping dictionary ...
63 * Regex.cs (CreateMachineFactory): ... here. Update to changes.
65 2009-08-18 Raja R Harinath <harinath@hurrynot.org>
67 Distinguish between the internal index of a group and group number.
68 * Regex.cs (GetGroupIndex): New.
69 (GroupNameFromNumber): Use it.
70 * GroupCollection.cs (.ctor): Introduce 'gap' argument. It is the
71 index of the first group whose group number differs from its index.
74 2009-08-18 Raja R Harinath <harinath@hurrynot.org>
76 * parser.cs (GetMapping): Extend duplicate check for numeric
79 2009-08-17 Raja R Harinath <harinath@hurrynot.org>
81 * parser.cs (ResolveReferences): Handle some cases of
82 explicitly-named numeric groups.
84 2009-08-17 Raja R Harinath <harinath@hurrynot.org>
86 * parser.cs (ResolveReferences): Rearrange slightly to prepare for
89 2009-08-17 Raja R Harinath <harinath@hurrynot.org>
91 * Regex.cs (GetGroupNumbers): List group numbers in ascending order.
92 (GetGroupNames): List names in order of group number.
94 2009-08-12 Raja R Harinath <harinath@hurrynot.org>
96 * syntax.cs (BackslashNumber.ResolveReference): Improve ECMAScript
97 semantics. Handle cases like "group 43 exists but group 4 doesn't".
99 2009-08-10 Raja R Harinath <harinath@hurrynot.org>
101 * syntax.cs (BackslashNumber.ResolveReference): Implement fallback
102 to octal numbers, and ECMAScript semantics.
103 * parser.cs (ResolveReferences): Use it.
105 2009-08-10 Raja R Harinath <harinath@hurrynot.org>
107 * syntax.cs (BackslashNumber): New class.
108 * parser.cs (ParseSpecial): Create it instead of 'Reference' if a
109 numeric backreference is seen.
111 2009-08-10 Raja R Harinath <harinath@hurrynot.org>
113 * parser.cs (ResolveReferences): Allow named groups to be
114 referred-to by their group numbers too.
116 2009-04-23 Sebastien Pouliot <sebastien@ximian.com>
118 * Regex.cs: Remove Compiler-related support for NET_2_1
119 * RegexOptions.cs: Remove Compile from values available on NET_2_1
121 2009-03-04 Zoltan Varga <vargaz@gmail.com>
123 * RxInterpreter.cs (ResetGroups): Avoid allocating larger than needed
126 2009-02-27 Jonathan Pryor <jpryor@novell.com>
128 * Regex.cs (Replace): Check that input & evaluator are not null, as
129 documented in MSDN (and the variance found while testing DbLinq).
131 2009-02-27 Zoltan Varga <vargaz@gmail.com>
133 * BaseMachine.cs (LTRReplace): Initialize the StringBuilder with an
134 appropriate initial length.
136 2009-02-24 Zoltan Varga <vargaz@gmail.com>
138 * CILCompiler.cs: Partially inline calls to Char.ToLower () to speed
139 up ignorecase matching.
141 2009-02-16 Jb Evain <jbevain@novell.com>
143 * Regex.cs: on the NET_2_1 profile, always use the old engine for now.
145 2009-02-14 Zoltan Varga <vargaz@gmail.com>
147 * Regex.cs: Add a MONO_NEW_RX variable to enable the new regex
150 2009-02-04 Zoltan Varga <vargaz@gmail.com>
152 * Regex.cs: Disable the new regex engine for now.
154 2009-01-14 Zoltan Varga <vargaz@gmail.com>
156 * CILCompiler.cs: Avoid throwing exceptions for a few more unhandled opcodes.
157 Implement the reverse/ignorecase versions of Reference. Fix the reverse
158 version of Bitmap. Error out if a Jump opcode jumps outside the current
159 pc range. This works around #466151.
161 2009-01-12 Jb Evain <jbevain@novell.com>
163 * RxInterpreter.cs: set trace_rx to false for NET_2_1.
164 * Regex.cs: set old_rx to false for NET_2_1.
166 2009-01-07 Zoltan Varga <vargaz@gmail.com>
168 * RxInterpreter.cs: Add support for constant strings in anchors. Fixes
171 2008-11-18 Gonzalo Paniagua Javier <gonzalo@novell.com>
173 * cache.cs: avoid infinite loop.
175 2008-11-14 Gonzalo Paniagua Javier <gonzalo@novell.com>
178 * Regex.cs: honor CacheSize value.
180 2008-11-13 Zoltan Varga <vargaz@gmail.com>
182 * RxInterpreter.cs: Fix pc computation in various opcodes. Fixes #443841.
184 2008-11-11 Zoltan Varga <vargaz@gmail.com>
186 * CILCompiler.cs: Implement Reference opcode.
188 2008-10-30 Zoltan Varga <vargaz@gmail.com>
190 * CILCompiler.cs: Implement SubExpression opcode.
192 * CILCompiler.cs: Save and restore strpos in the Test opcode. Fixes
195 2008-10-25 Zoltan Varga <vargaz@gmail.com>
197 * CILCompiler.cs: Implement Test opcode.
199 2008-10-25 Gonzalo Paniagua Javier <gonzalo@novell.com>
201 * RxInterpreter.cs: implement missing Unicode* opcodes and
202 StringReverseIgnoreCase.
204 2008-10-25 Zoltan Varga <vargaz@gmail.com>
206 * RxOp.cs: Remove unused Generic opcodes.
208 * RxCompiler.cs: Emit opcodes with flags using methods which can be
209 overriden by CILCompiler.cs, so we only have to override a few methods.
211 * CILCompiler.cs: Simplify based on the RxCompiler changes. Implement
212 UnicodeString opcode. Throw a NotImplementedException when an unsupported
213 opcode is encountered, since the IL compiler is now believed to be feature
216 2008-10-24 Zoltan Varga <vargaz@gmail.com>
218 * RxInterpreter.cs CILCompiler.cs gen-interp.cs: Fix the reading of short
219 values from the instruction stream.
221 * RxOp.cs: Add some missing unicode opcodes.
223 * gen-interp.cs RxInterpreter.cs: Generate Bitmap/UnicodeBitmap opcodes too.
225 * CILCompiler.cs (EmitEvalMethodBody): Add an 'end_pc' argument to mark the
226 end of the bytecode range which needs to be compiled. Use it to avoid
227 compiling the same bytecode multiple times in various opcodes. Fix
228 RxOp.Jump implementation. Add implementation for unicode opcodes.
230 2008-10-09 Zoltan Varga <vargaz@gmail.com>
232 * CILCompiler.cs: Implement NoBitmap/NoBitmapIgnoreCase. Fixes #432172.
234 2008-09-14 Zoltan Varga <vargaz@gmail.com>
236 * gen-interp.cs: New file to generate the all variants of the character
237 checking opcodes in RxInterpreter.cs.
239 * RxInterpreter.cs: Replace hand written code with code generated by
242 * RxInterpreter.cs: Fix the failure case of the No<XXX> opcodes. Fixes
245 2008-09-13 Zoltan Varga <vargaz@gmail.com>
247 * RxInterpreter.cs RxCompiler.cs: Implement some missing Category opcodes.
249 2008-09-07 Zoltan Varga <vargaz@gmail.com>
251 * CILCompiler.cs: Override ICompiler.EmitSet too so we set op_flags for
252 Bitmap opcodes too. Fixes #424073.
254 2008-09-06 Zoltan Varga <vargaz@gmail.com>
256 * Regex.cs: Make the new regex interpreter+compiler the default.
258 2008-08-31 Zoltan Varga <vargaz@gmail.com>
260 * RxInterpreter.cs: Port the Anchor+StartOfString optimization from the old
261 interpreter. Add credits.
263 * RxCompiler.cs (EmitString): Lowercase the string if ignore is true.
265 * CILCompiler.cs: Fix the setting of the match position in the
266 anchor+char optimization.
268 * CILCompiler.cs: Implement FastRepeatLazy.
270 * CILCompiler.cs: Get rid of commented out code. Also get rid of
271 frame.local_strpos_res, since the generated code already set Arg1 to
274 2008-08-30 Zoltan Varga <vargaz@gmail.com>
276 * CILCompiler.cs: Initialize all mi_ variables lazily.
278 * CILCompiler.cs: Implement FastRepeat.
280 * RxInterpreter.cs: Add back SetStartOfMatch, make it protected so as to
283 * CILCompiler.cs RxOp.cs: Merge lots of changes from RxInterpreter.cs,
286 2008-08-29 Zoltan Varga <vargaz@gmail.com>
288 * RxInterpreter.cs RxCompiler.cs RxOp.cs: Implement/fix this so all the
289 regex tests now run. The Repeat code is taken from the old interpreter.
291 2008-08-28 Zoltan Varga <vargaz@gmail.com>
293 * RxInterpreter.cs RxCompiler.cs RxOp.cs: Add support for
294 Category.AnySingleline.
296 2008-08-27 Zoltan Varga <vargaz@gmail.com>
298 * RxCompiler.cs: Use Array.Copy since Buffer.BlockCopy operates on bytes.
300 2008-07-31 Jb Evain <jbevain@novell.com>
302 * BaseMachine.cs: clean up for NET_2_1.
304 2008-06-05 Roei Erez <roeie@mainsoft.com>
306 * JvmReMachine.jvm.cs: Fix a bug in match that contains
307 empty group at the end.
309 2008-04-13 Jb Evain <jbevain@novell.com>
311 * Regex.cs: update undocumented fields for the 2.1 profile.
312 Merged from the Moonlight 2 branch.
314 2008-02-26 Zoltan Varga <vargaz@gmail.com>
316 * CILCompiler.cs: Implement StringIgnoreCase.
318 * CILCompiler.cs: Implement grouping support.
320 * CILCompiler.cs: Implement character groups.
322 2008-02-25 Zoltan Varga <vargaz@gmail.com>
324 * CILCompiler.cs: Implement lots of missing opcodes.
326 2008-02-18 Zoltan Varga <vargaz@gmail.com>
328 * CILCompiler.cs (EmitEvalMethodBody): Check for the not-yet supported
331 Thu Feb 14 19:03:00 CET 2008 Paolo Molaro <lupus@ximian.com>
333 * RxCompiler.cs, RxInterpreter.cs, RxOp.cs, CILCompiler.cs : support for word
334 boundary position opcodes, ignorecase backreference and more capture
337 Thu Feb 14 17:11:10 CET 2008 Paolo Molaro <lupus@ximian.com>
339 * RxCompiler.cs, RxInterpreter.cs, RxOp.cs: replace EcmaDigit with
340 Range, fixed matching of "" =~ /$/, implementedt TestCharGroup.
341 Fixes and other misc opcodes implemented.
343 2008-02-13 Zoltan Varga <vargaz@gmail.com>
345 * CILCompiler.cs: Restructure some code to avoid a branch inside a loop.
347 * CILCompiler.cs: Fix the unsafe string matching code.
349 * CILCompiler.cs: Improved version which emits only one method in most cases.
351 * CILCompiler.cs: Fix some comments.
353 * CILCompiler.cs: New file, extracted from RxCompiler.cs.
355 * RxInterpreter.cs RxCompiler.cs: First version of regex IL compiler.
357 Wed Feb 13 13:18:12 CET 2008 Paolo Molaro <lupus@ximian.com>
359 * RxCompiler.cs, RxInterpreter.cs, RxOp.cs: unicode categories and
360 some grouping/capture support.
362 Tue Feb 12 19:16:49 CET 2008 Paolo Molaro <lupus@ximian.com>
364 * RxCompiler.cs, RxInterpreter.cs, RxOp.cs: experimental new
367 2008-02-10 Zoltan Varga <vargaz@gmail.com>
369 * replace.cs (NeedsGroupsOrCaptures): New property. Determines whenever the
370 replacement process needs access to the groups or captures properties of the
373 * Group.cs: Add an internal ctor which avoids allocations.
377 * BaseMachine.cs interpreter.cs: Add an optimization to avoid fully creating
378 Match objects during Replace () if the replacement string is simple.
380 * BaseMachine.cs Regex.cs: Make LTRReplace and RTLReplace instance methods to
381 avoid creating two machines for each Regex.Replace () call.
383 * interpreter.cs (Eval): Remove a needless string allocation.
385 2007-12-04 Arina Itkes <arinai@mainsoft.com>
387 * parser.cs: Max value of m for a construct {n,m} is 2147483647.
389 2007-11-15 Miguel de Icaza <miguel@novell.com>
391 * Revert the patch from Juraj Skripsky as it made the class
392 non-thread safe (see #341986).
394 2007-11-08 Raja R Harinath <harinath@gmail.com>
397 * BaseMachine.cs (LTRReplace): Don't use non-advancement of 'ptr'
398 to deduce absence of matches -- a match can have length 0.
399 (RTLReplace): Likewise.
401 2007-11-07 Raja R Harinath <harinath@gmail.com>
403 Support RegexOptions.RightToLeft in Replace().
404 * BaseMachine.cs (Replace): Use either LTRReplace or RTLReplace
406 (LTRReplace): Make internal and rename the MatchAppendEvaluator
407 version of Replace to this.
409 * Regex.cs (Replace): Use LTRReplace and RTLReplace from BaseMachine.
410 * replace.cs (ReplacementEvaluator.Evaluate): Optimize simple case.
411 Based on patch by Stephane Delcroix.
413 * replace.cs (Compile): Don't unescape string.
415 2007-11-01 Gert Driesen <drieseng@users.sourceforge.net>
417 * Match.cs: Do not throw NotSupportedException on zero-length
418 replacement argument.
420 2007-10-29 Arina Itkes <arinai@mainsoft.com>
422 * Regex.cs: Moving creation of Regex machine to ctor.
423 It increases an initialization time of Regex but reduce a
424 process time while APIs calling. Also it solves the problem
425 of missed multi thread synchronization.
427 2007-10-29 Arina Itkes <arinai@mainsoft.com>
429 * Match.cs: Fix for Result method of Match. Throwing an exception
430 if Result method was called on a failed Match.
432 2007-10-24 Juraj Skripsky <js@hotfeet.ch>
434 * Regex.cs: Store and re-use IMachine, no need to re-instantiate
435 it every time we're matching.
437 2007-10-24 Arina Itkes <arinai@mainsoft.com>
439 * Regex.cs Match.cs arch.cs compiler.cs interpreter.cs
440 Refactoring of Interpreter with extracting of base abstract class
441 that executes some methods that were moved from Regex and Match classes.
442 Added a field that maps group numbers to group names in Regex for
443 improvement of performance of GroupNameFromNumber method.
445 2007-10-21 Gert Driesen <drieseng@users.sourceforge.net>
447 * RegexTest.cs: Removed. Test was already moved to the appropriate
450 2007-06-21 Juraj Skripsky <js@hotfeet.ch>
452 * quicksearch.ch: Optimization. Add byte array as skip table for
453 chars <= 255, falling back to the hashtable for chars > 255 and
454 skip distances > 255.
456 2007-04-18 Raja R Harinath <rharinath@novell.com>
459 * parser.cs (ResolveReferences): Don't throw an expression if a
460 capture assertion reference cannot be resolved.
461 (ParseGroupingConstruct): Provide fallback expression to a capture
463 * syntax.cs (CaptureAssertion): If the bareword doesn't refer to
464 the name of a capture group, fallback to treating it as a literal
467 2007-04-04 Raja R Harinath <rharinath@novell.com>
469 * interpreter.cs (Eval) <OpCode.Reference>: Distribute for loop
471 for () if (a) s1; else s2; => if (a) for () s1; else for () s2;
473 2007-04-03 Raja R Harinath <rharinath@novell.com>
475 * Regex.cs (~Regex): Don't define in NET_2_0 profile.
477 2007-01-02 Raja R Harinath <rharinath@novell.com>
480 * parser.cs (Parser.GetMapping): Use the actual group numbers to
483 2006-09-28 Andrew Skiba <andrews@mainsoft.com>
485 * Regex.cs: TARGET_JVM
487 2006-05-30 Gert Driesen <drieseng@users.sourceforge.net>
489 * CaptureCollection.cs: Removed virtual keyword to fix API mismatches.
490 * MatchCollection.cs: Removed virtual keyword to fix API mismatches.
491 * GroupCollection.cs: Removed virtual keyword to fix API mismatches.
493 2006-05-08 Raja R Harinath <rharinath@novell.com>
496 Remove 65535-limit on number of repetitions matched by a pattern.
497 We still have a 65535 limit on the length of a pattern and the
498 number of groups in a pattern.
499 * compiler.cs (PatternCompiler.EmitCount): New. Emits an int as
500 two ushorts into the program stream.
501 (EmitInfo, EmitRepeat, EmitFastRepeat): Use it to emit integers
503 * interpreter.cs (Intepreter.ReadProgramCount): Read an int
504 emitted into the program stream.
505 (Interpreter): Use it. Update counts.
506 (Interpreter.Eval) [OpCode.Repeat, OpCode.FastRepeat]: Likewise.
507 * parser.cs (ParseGroup): Pass 0x7ffffff as the max value for '*'
508 and '+' repetition patterns.
509 * arch.cs (Info, Repeat, FastRepeat): Update description.
511 2006-04-18 Raja R Harinath <rharinath@novell.com>
513 Treat fixed repetitions of simple regexes as simple too.
514 * syntax.cs (Expression.IsComplex): Make abstract.
515 (Group.IsComplex, Alternation.IsComplex): Move ...
516 (CompositeExpression.IsComplex): ... here.
517 (Group.GetAnchorInfo): Reduce allocations. Avoid creating another
518 ArrayList, and use a StringBuilder to build up the string.
519 (Repetition.GetAnchorInfo): Use a StringBuilder to build up the string.
520 (ExpressionAssertion.IsComplex): Override.
522 2006-04-17 Florian Gross <flgr@ccan.de>
523 Raja R Harinath <rharinath@novell.com>
525 * syntax.cs (CharacterClass.Compile): Emit categories after the
526 character intervals so that the evaluator can pick up the
529 2006-04-07 Raja R Harinath <rharinath@novell.com>
532 * interpreter.cs (Interpreter.Eval) [Anchor, Position.StartOfString]:
533 Don't reset 'ptr' to 0 during forward scan.
536 * interpreter.cs (Interpreter.FastEval) [FastRepeat]: If the first
537 tail operation has a 'negate' flag, avoid the "match next char"
541 * arch.cs (OpCode.NotCategory): New. Stands for matching a
542 character _not_ from the given category.
543 * debug.cs (DisassembleBlock): Handle it.
544 * compiler.cs (ICompiler.EmitNotCategory): New.
545 (Compiler.EmitNotCategory): New. Emit OpCode.NotCategory.
546 * syntax.cs (CharacterClass.Compile): Don't conflate negation of
547 the character class and negation of the category. Use
549 * interpreter.cs (Interpreter.Eval): Pass OpCode.NotCategory to
551 (Interpreter.EvalChar): Handle it.
553 2006-04-06 Raja R Harinath <rharinath@novell.com>
556 * interpreter.cs (Eval) [Until, FastUntil]: Set 'deep' to null
557 when evaluating the tail. Ensure that backtracks don't confuse
558 the recursion vs. iteration detector.
560 2006-04-03 Raja R Harinath <rharinath@novell.com>
562 * interpreter.cs (Eval) [Until, lazy]: Avoid extra evaluation on a
565 2006-03-30 Raja R Harinath <harinath@gmail.com>
568 * parser.cs (Parser.ParseCharacterClass): Don't automatically
569 assume there's a range when we see '-'. Ensure that we have seen
570 at least one other character, and that we aren't already parsing a
571 range. Handle some more errors.
573 2005-12-19 Kornél Pál <kornelpal@hotmail.com>
575 * Regex.cs: Added support for regular expressions compiled to
576 assemblies by compiling the pattern. This solution ignores existing
577 CIL code but provides full support for regular expression classes
580 2005-11-21 Sebastien Pouliot <sebastien@ximian.com>
582 * CaptureCollection.cs: Fixed length check.
583 * Group.cs: Added missing validation for Synchronized method.
584 * Match.cs: Added missing validation for Synchronized and Result
586 * MatchEvaluator.cs: Added [Serializable] for 2.0 profile.
587 * RegexCompilationInfo.cs: Added missing property validation.
588 * Regex.cs: Implemented UseOptionC and UseOptionR protected methods
589 (now documented). Fixed API for 2.0 profile.
590 * RegexRunner.cs: Stubbed CharInClass for 2.0 profile.
592 2005-11-17 Sebastien Pouliot <sebastien@ximian.com>
594 * Match.cs: Removed the ": base ()" on the private ctor as it is
595 unrequired and cause an extra public ctor to added (bug #76736).
596 * MatchCollection.cs: Add missing virtual to indexer property.
598 2005-09-23 Raja R Harinath <rharinath@novell.com>
600 * interpreter.cs (Interpreter.Eval) [OpCode.Until]: Invert the
601 sense of a test to reflect the code re-organization.
603 2005-09-22 Raja R Harinath <rharinath@novell.com>
606 * interpreter.cs (Interpreter.Eval) [OpCode.Until]: Avoid some
607 cases of recursion when dealing with eager quantifiers too. We
608 now avoid recursion when handling the innermost quantifier.
609 (Interpreter.IntStack, Interpreter.stack): New. Stack to help
610 implement backtracking in eager quantifiers.
612 2005-09-21 Raja R Harinath <rharinath@novell.com>
614 * interpreter.cs (Interpreter.Eval) [OpCode.Until]: Avoid some
615 cases of recursion when dealing with the minimum count and lazy
618 2005-08-23 Raja R Harinath <rharinath@novell.com>
620 * regex.cs: Remove. Split into ...
621 * MatchEvaluator.cs, Regex.cs, RegexCompilationInfo.cs,
622 RegexOptions.cs: ... these. Now every publicly exposed type in
623 this namespace has its own file.
625 2005-07-21 Florian Gross <flgr@ccan.de>
627 * Fixed a bug in category.cs that caused ECMAScript \d to fail.
629 2005-07-13 Raja R Harinath <rharinath@novell.com>
631 Make even more lazier.
632 * MatchCollection.cs (TryToGet): Don't generate match i+1 when
633 we're looking for match i. Change post-conditions.
634 (FullList): New helper property. Ensures the list is fully populated.
635 (Count, CopyTo): Use it.
636 (Enumerator.Current): Update to new post-conditions of TryToGet.
637 (Enumerator.MoveNext): Likewise. Don't modify index if we're
640 2005-07-08 Raja R Harinath <rharinath@novell.com>
642 * MatchCollection.cs: Convert to incremental mode.
643 * regex.cs (Regex.Matches): Update. Pass responsibility of
644 generating all matches to MatchCollection.
646 2005-06-14 Raja R Harinath <harinath@gmail.com>
648 * parser.cs (Parser.ConsumeWhitespace): Add bounds check.
651 * Match.cs (Match) [zero-argument variant]: Make private.
652 * GroupCollection (Item) [string variant]: Don't look for the
653 group number in an empty match.
655 2005-06-10 Raja R Harinath <rharinath@novell.com>
657 * interpreter.cs (Interpreter.GenerateMatch): Avoid allocating two
658 intermediate arrays to build the final result.
659 (Interpreter.GetGroupInfo, Interpreter.PopulateGroup): New helper
661 * CaptureCollection.cs (list): Change from ArrayList to list.
662 (SetValue): New internal helper, used by Interpreter.PopulateGroup.
663 (Enumerator): Remove helper class.
664 (IEnumerator.GetEnumerator): Just use list.GetEnumerator.
665 * GroupCollection.cs: Likewise.
666 * Group.cs (Group): Move responsibility of populating 'Captures'
667 to Interpreter.PopulateGroup.
668 * Match.cs (Match): Move responsibility of populating 'Groups' to
669 Interpreter.GenerateMatch.
671 2005-05-25 Raja R Harinath <rharinath@novell.com>
673 * replace.cs (ReplacementEvaluator.Compile): Rewrite to avoid
674 creating several intermediate strings. Simplify internal
675 intermediate representation.
676 (ReplacementEvaluator.EvaluateAppend): New. Version of Evaluate
677 that builds the result directly on a passed-in StringBuilder.
678 (ReplacementEvaluator.Evaluate): Just a wrapper around
680 * regex.cs (MatchAppendEvaluator): New internal delegate.
681 (Regex.Replace): Use MatchAppendEvaluator.
682 (Regex.Adapter): New class used to adapt a MatchEvaluator to a
683 MatchAppendEvaluator.
685 2005-05-24 Raja R Harinath <rharinath@novell.com>
687 * replace.cs (ReplacementEvaluator.CompileTerm): Fix group
690 2005-05-20 Ben Maurer <bmaurer@ximian.com>
692 * regex.cs: Some memory allocation optimizations.
694 2005-05-20 Raja R Harinath <rharinath@novell.com>
697 * replace.cs (ReplacementEvaluator.Compile): Allow CompileTerm to
698 fail and yet have advanced the pointer. Append the scanned-over
699 portion to the "literal" being built.
700 (ReplacementEvaluator.CompileTerm): Don't throw any exceptions.
701 If a term cannot be recognized, just return null.
703 * compiler.cs (InterpreterFactory.GroupCount): Fix. The 0'th
704 index corresponds to Opcode.Info.
706 * parser.cs (Parser.Unescape): If the string doesn't contain any
707 '\' character, don't allocate a new string.
709 * replace.cs (ReplacementEvalutator.Term.AppendResult): Rename
710 from GetResult. Append to a passed-in StringBuilder rather than
712 (ReplacementEvaluator.Evaluate): Update.
714 * Capture.cs, Group.cs, Match.cs: New files split out of ...
715 * match.cs: ... this. Remove.
717 2005-02-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
719 * parser.cs: stuff inside {} might not be a quantifier. Fixes
722 2005-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
724 * quicksearch.cs: handle IgnoreCase when getting the shift distance.
725 Fixes bug #69065. Patch by mei@work.email.ne.jp.
727 2005-01-08 Miguel de Icaza <miguel@ximian.com>
729 * syntax.cs: Applied patch from mei@work.email.ne.jp to fix bug
732 * parser.cs: Turns out that \digit sequences are octal sequences
733 (no leading zero is needed); And the three octal digit rule
734 applies to the leading zero as well.
736 This fixes the Unescape method.
738 2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
740 * regex.cs: use NextMatch to move on to the next match. Fixes bug
743 2004-11-09 Atsushi Enomoto <atsushi@ximian.com>
747 2004-11-08 Ben Maurer <bmaurer@ximian.com>
749 * replace.cs, parser.cs: Use stringbuilder for allocation sanity.
751 2004-10-21 Joerg Rosenkranz <joergr@voelcker.com>
753 * regex.cs: Fixed a bug introduced with the last patch which
754 prevented any replacements when a postive count is given.
755 This also happens in all overloads without count parameter.
757 2004-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
759 * regex.cs: in Replace, when count is negative, replacement continues
760 to the end of the string.
762 Fixes bug #68398. Patch by Jon Larimer.
764 2004-06-10 Gert Driesen <drieseng@users.sourceforge.net>
766 * RegexRunner.cs: fixed case mismatch of methods
768 2004-06-10 Gert Driesen <drieseng@users.sourceforge.net>
770 * RegexRunner.cs: marked TODO, added missing protected internal
771 fields, throw NotImplementedException in all methods
773 2004-06-10 Gert Driesen <drieseng@users.sourceforge.net>
775 * RegexRunnerFactory.cs: removed comment, no longer throw exception
777 * regex.cs: fixed public API signature by renaming protected
778 internal fields and adding destructor, added MonoTODO attribute to
779 fields and method that are not yet implemented, changed not
780 implemented methods to throw NotImplementedException instead of
781 Exception, fixed names of field that are serialized
783 2004-06-06 Jambunathan K <kjambunathan@novell.com>
785 * parser.cs: Fixed issues with Regex.Unescape() identified as part of
786 debugging bug #58256. The original problem reported was about
787 inconsistency between the way we treat replacement patterns and the
788 way microsoft treats the replacement patterns in Regex.Replace(). MS
789 implementation is buggy and doesn't honour escape sequences in the
790 replacement patterns, even though the SDK claims otherwise.
793 2004-06-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
795 * syntax.cs: re-applied my patch from 2004-05-27 plus a fix which is
796 emitting a Category.All if both a category and its negated value are
799 2004-06-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
801 * syntax.cs: reverting my previous patch. It causes bigger problems.
803 2004-05-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
805 * category.cs: added LastValue field to mark the end of enum Category.
806 * syntax.cs: in CharacterClass, use Category.LastValue to get the size
807 of the array needed. Use a BitArray instead of bool[].
808 In AddCategory(), don't set the opposite category as false. Fixes
809 bug #59150. All tests pass.
811 2004-05-25 Jackson Harper <jackson@ximian.com>
813 * parser.cs: Allow creating a regular expression using {,n} as the
814 specified. The min bounds is set to -1, I am not completely sure
815 if that is what it is supposed to be but MS does not set it to 0
816 based on testing. Patch by dave-gnome-bugs@earth.li. Fixes bug #56761.
818 2004-05-12 Dick Porter <dick@ximian.com>
822 * RegexRunnerFactory.cs:
823 * RegexRunner.cs: More public API difference fixes.
825 * GroupCollection.cs:
826 * MatchCollection.cs:
827 * CaptureCollection.cs: Moved GroupCollection, MatchCollection and
828 CaptureCollection so that they no longer inherit from the
829 non-standard RegexCollectionBase class. Fixes the API difference.
831 2004-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
838 Patch by Eric Durand Tremblay.
839 1) Capture inner group when named.
840 2) Resolved parse error caused by not capturing inner group
841 3) Resolved incorrect capture group
842 4) Now, not capturing anything when unnamed ( correct behavior)
845 2004-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
851 * syntax.cs: converted to unix line endings.
853 2004-03-30 Lluis Sanchez Gual <lluis@ximian.com>
855 * collections.cs: In the indexer, return an empty group if the requested
857 * match.cs: Added default constructor for Group.
859 2004-03-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
861 * parser.cs: fixed group numbering.
863 2004-03-22 Jackson Harper <jackson@ximian.com>
865 * parser.cs: Use the group number as the name in mapping. Patch by
867 * regex.cs: Fix off by one error. Patch by Gert Driesen.
869 2004-03-17 Francois Beauchemin <beauche@softhome.net>
870 * syntax.cs, interpreter.cs, quicksearch.cs, regex.cs, compiler.cs :
871 Revised support for RigthToLeft.
872 quicksearch has now an reverse option.
873 This fixes bug #54537
875 * regex.cs, compiler.cs :
876 Some code to support CILCompiler.
878 Added some undocumented of MS.
880 2004-03-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
882 * parser.cs: allow a @"\0" escape sequence. Fixes bug #54797.
884 2004-02-01 Miguel de Icaza <miguel@ximian.com>
886 * syntax.cs, interval.cs: Applied patch from Marco Cravairo
887 through Francois Beauchemin who reviewed on the mailing list.
888 This fixes bug #45976
890 2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
892 * parser.cs: an opening brace without a
893 quantifier do not cause a parse error. Fixes bug #52924.
895 2004-01-07 Lluis Sanchez Gual <lluis@ximian.com>
897 * regex.cs: In Split(), if the last match is at the end of the string,
898 an empty string must be added to the array of results.
900 2003-12-15 Sanjay Gupta <gsanjay@novell.com>
901 * match.cs: Check for null value before Substring method call.
904 2003-11-21 Juraj Skripsky <js@hotfeet.ch>
906 * quicksearch.cs: Create and use hashtable only for "long" search
909 (Search): Use simple scan for a single-character search strings.
911 (GetChar): Simplify case sensitivity handling.
913 2003-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
915 * interpreter.cs: when evaluating a degenerate match, restore the
916 RepeatContext if fail. Fixes bug #42529.
918 2003-11-22 Jackson Harper <jackson@ximian.com>
920 * regex.cs: Add CultureInvariant flag to RegexOptions.
922 2003-11-20 Juraj Skripsky <js@hotfeet.ch>
924 * quicksearch.cs: Use a hashtable instead of an array for the
925 shift table to improve the memory usage.
927 2003-11-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
930 (Split): include capture groups in the results, if any. Fixes bug
933 2003-07-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
935 * regex.cs: patch from Eric Lindvall <eric@5stops.com> that fixes bug
938 2003-03-05 Miguel de Icaza <miguel@ximian.com>
940 * category.cs (CategoryUtils.CategoryFromName): Use StartsWith
941 ("Is") instead of a substring for (0,2) which was throwing an
942 exception causing Category.None to be returned
944 2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
946 * collections.cs: fixed bug #30091.
948 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
950 * regex.cs: fixed little mistake (closes #35860).
952 2002-11-12 Jackson Harper <jackson@latitudegeo.com>
954 * arch.cs compiler.cs regex.cs: Added mapping attribute to MachineFactories
956 2002-11-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
958 * parser.cs: detect illegal \ at end of pattern. Fixes 31334.
960 2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
962 * parser.cs: applied fix from Tim Haynes (thaynes@openlinksw.com) to
963 solve bug #32807. Also modified GetMapping to return the same as MS.
965 2002-08-28 Juli Mallett <jmallett@FreeBSD.org>
967 * arch.cs, compiler.cs: Give the interpreter machine a property
968 for the retrieval of the group count.
970 * regex.cs: Use the new GroupCount property of the factory to
971 initialise the current group count, and restructure code to compile
972 the pattern only the first time it is needed (essentially backing
973 out the previous revision of regex.cs, to use the new code.)
975 2002-08-14 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
977 * regex.cs: Added the ctr for ISerializable implementation and
978 implemented the GetObjectData function.
980 2002-07-30 Juli Mallett <jmallett@FreeBSD.org>
982 * regex.cs: Fixed bug where the expression would not be
983 re-evaluated for grouping purposes when factory caches were
984 used, resulting in no groups being recognised after one call
985 with a given pattern and no change in options.
987 2002-05-13 Dan Lewis <dihlewis@yahoo.co.uk>
989 * regex.cs: Fixed bug in split.
991 2002-05-08 Dan Lewis <dihlewis@yahoo.co.uk>
993 * interpreter.cs: Moved to an array-based stack representation
996 * match.cs, collections.cs: Decoupled capture representation from
997 interpreter internals.
999 * cache.cs: Changed Key type from struct to class for speed.
1001 2002-04-06 Dan Lewis <dihlewis@yahoo.co.uk>
1003 * cache.cs: Object methods should be overridden with "override".
1005 2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
1007 * RegexRunner.cs, RegexRunnerFactory.cs: MS support classes. Stubs
1008 added for completeness.
1010 * regex.cs, match.cs, collections.cs: Serializable attribute.
1012 2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
1014 * regex.cs: Added static Matches and IsMatch methods.
1016 2002-04-03 Dan Lewis <dihlewis@yahoo.co.uk>
1018 * ChangeLog: Added changelog.
1020 * cache.cs: Fixed bug in MRUList.Evict.