<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Nicolas,<br>
</p>
<p><br>
</p>
<p>thanks for looking into this, as this is kind of tricky to get right on my own without any discussions. What I did is to look into the value of anRmxLink in #makeQuantified:min:max:&nbsp;before and after a copy. What happens is that the backward references in
 RxmBranch nodes back to other RxmLink nodes break as the references get only&nbsp;copied separately and result in two different objects. As a result the copied structure does not include any back references.&nbsp;The postCopy callbacks do not solve that issue but do,
 to my understanding at that point, only implement the recursion of the copying.&nbsp;veryDeepCopy however produces the same node structure&nbsp;which is what is actually needed for the quantified structures. This way the termiateWith: method works correctly and the
 generating of broken matcher structures is fixed.&nbsp;However, it changes the behavior slightly (as in the Regex-Tests-Core commit in the inbox) so I am not yet sure whether this is only a technical fix or also a correct fix of the behavior.<br>
</p>
<p><br>
</p>
<p>Does that sound somewhat&nbsp;reasonable? :)<br>
</p>
<p><br>
</p>
<p>Bests<br>
</p>
<p>Patrick</p>
<p><br>
</p>
<p><br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> squeak-dev-bounces@lists.squeakfoundation.org &lt;squeak-dev-bounces@lists.squeakfoundation.org&gt; on behalf of Nicolas Cellier &lt;nicolas.cellier.aka.nice@gmail.com&gt;<br>
<b>Sent:</b> Thursday, May 19, 2016 22:18<br>
<b>To:</b> The general-purpose Squeak developers list<br>
<b>Subject:</b> Re: [squeak-dev] The Trunk: Regex-Core-pre.51.mcz</font>
<div>&nbsp;</div>
</div>
<div>
<div dir="ltr">
<div>
<div>Hi Patrick,<br>
</div>
IMO copy should copy deep enough without the need to invoke veryDeepCopy.<br>
</div>
Wouldn't it be a missing postCopy in RxmLookahead?<br>
<br>
postCopy<br>
&nbsp;&nbsp;&nbsp; super postCopy.<br>
&nbsp;&nbsp;&nbsp; lookahead := lookahead copy<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2016-05-19 20:49 GMT&#43;02:00 <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Patrick Rein uploaded a new version of Regex-Core to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Regex-Core-pre.51.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk/Regex-Core-pre.51.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Regex-Core-pre.51<br>
Author: pre<br>
Time: 19 May 2016, 8:49:05.994548 pm<br>
UUID: 49e3e29a-cf96-4f42-a8f1-4af75dbb9bca<br>
Ancestors: Regex-Core-ul.50<br>
<br>
Fixes an erroring test of RxMatcher by replacing a copy with a veryDeepCopy to sustain the integrity of the RxmLink tree.<br>
<br>
=============== Diff against Regex-Core-ul.50 ===============<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: RxMatcher&gt;&gt;makeQuantified:min:max: (in category 'private') -----<br>
&nbsp; makeQuantified: anRxmLink min: min max: max<br>
&nbsp; &nbsp; &nbsp; &nbsp; &quot;Perform recursive poor-man's transformation of the {&lt;min&gt;,&lt;max&gt;} quantifiers.&quot;<br>
&nbsp; &nbsp; &nbsp; &nbsp; | aMatcher |<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &quot;&lt;atom&gt;{,&lt;max&gt;}&nbsp; &nbsp; &nbsp; &nbsp;==&gt;&nbsp; (&lt;atom&gt;{1,&lt;max&gt;})?&quot;<br>
&nbsp; &nbsp; &nbsp; &nbsp; min = 0 ifTrue: [<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^ self makeOptional: (self makeQuantified: anRxmLink min: 1 max: max) ].<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &quot;&lt;atom&gt;{&lt;min&gt;,}&nbsp; &nbsp; &nbsp; &nbsp;==&gt;&nbsp; &lt;atom&gt;{&lt;min&gt;-1, &lt;min&gt;-1}&lt;atom&gt;&#43;&quot;<br>
&nbsp; &nbsp; &nbsp; &nbsp; max ifNil: [<br>
&#43;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^ (self makeQuantified: anRxmLink min: 1 max: min-1) pointTailTo: (self makePlus: anRxmLink veryDeepCopy) ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^ (self makeQuantified: anRxmLink min: 1 max: min-1) pointTailTo: (self makePlus: anRxmLink copy) ].<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &quot;&lt;atom&gt;{&lt;max&gt;,&lt;max&gt;}&nbsp; ==&gt;&nbsp; &lt;atom&gt;&lt;atom&gt; ... &lt;atom&gt;&quot;<br>
&nbsp; &nbsp; &nbsp; &nbsp; min = max<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue: [<br>
&#43;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aMatcher := anRxmLink veryDeepCopy.<br>
&#43;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(min-1) timesRepeat: [ aMatcher pointTailTo: anRxmLink veryDeepCopy ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aMatcher := anRxmLink copy.<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(min-1) timesRepeat: [ aMatcher pointTailTo: anRxmLink copy ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^ aMatcher ].<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &quot;&lt;atom&gt;{&lt;min&gt;,&lt;max&gt;}&nbsp; ==&gt;&nbsp; &lt;atom&gt;{&lt;min&gt;,&lt;min&gt;}(&lt;atom&gt;{1,&lt;max&gt;-1})?&quot;<br>
&#43;&nbsp; &nbsp; &nbsp; &nbsp;aMatcher := self makeOptional: anRxmLink veryDeepCopy.<br>
-&nbsp; &nbsp; &nbsp; &nbsp;aMatcher := self makeOptional: anRxmLink copy.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (max - min - 1) timesRepeat: [<br>
&#43;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aMatcher := self makeOptional: (anRxmLink veryDeepCopy pointTailTo: aMatcher) ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aMatcher := self makeOptional: (anRxmLink copy pointTailTo: aMatcher) ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; ^ (self makeQuantified: anRxmLink min: min max: min) pointTailTo: aMatcher!<br>
<br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>