<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-05-19 23:21 GMT+02:00 Rein, Patrick <span dir="ltr">&lt;<a href="mailto:Patrick.Rein@hpi.de" target="_blank">Patrick.Rein@hpi.de</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div 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: 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 copied separately and result in two different objects. As a result the copied structure does not include any back references. The postCopy callbacks do not solve that issue but do,
 to my understanding at that point, only implement the recursion of the copying. veryDeepCopy however produces the same node structure 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. 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 reasonable? :)<br>
</p>
<p><br>
</p>
<p>Bests<br>
</p>
<p>Patrick</p>
<p><br></p></div></blockquote><div>Perfectly, i missed that point, thanks for explanations.<br>Still, copy should do something correct and i prefer the solution posted by Levente, even if it may sound more heavy than a clever veryDeepCopy.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><p>
</p>
<p><br>
</p>
<div style="color:rgb(33,33,33)">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> <a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a> &lt;<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>&gt; on behalf of Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&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> </div>
</div><div><div class="h5">
<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&#39;t it be a missing postCopy in RxmLookahead?<br>
<br>
postCopy<br>
    super postCopy.<br>
    lookahead := lookahead copy<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2016-05-19 20:49 GMT+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>
  ----- Method: RxMatcher&gt;&gt;makeQuantified:min:max: (in category &#39;private&#39;) -----<br>
  makeQuantified: anRxmLink min: min max: max<br>
        &quot;Perform recursive poor-man&#39;s transformation of the {&lt;min&gt;,&lt;max&gt;} quantifiers.&quot;<br>
        | aMatcher |<br>
<br>
        &quot;&lt;atom&gt;{,&lt;max&gt;}       ==&gt;  (&lt;atom&gt;{1,&lt;max&gt;})?&quot;<br>
        min = 0 ifTrue: [<br>
                ^ self makeOptional: (self makeQuantified: anRxmLink min: 1 max: max) ].<br>
<br>
        &quot;&lt;atom&gt;{&lt;min&gt;,}       ==&gt;  &lt;atom&gt;{&lt;min&gt;-1, &lt;min&gt;-1}&lt;atom&gt;+&quot;<br>
        max ifNil: [<br>
+               ^ (self makeQuantified: anRxmLink min: 1 max: min-1) pointTailTo: (self makePlus: anRxmLink veryDeepCopy) ].<br>
-               ^ (self makeQuantified: anRxmLink min: 1 max: min-1) pointTailTo: (self makePlus: anRxmLink copy) ].<br>
<br>
        &quot;&lt;atom&gt;{&lt;max&gt;,&lt;max&gt;}  ==&gt;  &lt;atom&gt;&lt;atom&gt; ... &lt;atom&gt;&quot;<br>
        min = max<br>
                ifTrue: [<br>
+                       aMatcher := anRxmLink veryDeepCopy.<br>
+                       (min-1) timesRepeat: [ aMatcher pointTailTo: anRxmLink veryDeepCopy ].<br>
-                       aMatcher := anRxmLink copy.<br>
-                       (min-1) timesRepeat: [ aMatcher pointTailTo: anRxmLink copy ].<br>
                        ^ aMatcher ].<br>
<br>
        &quot;&lt;atom&gt;{&lt;min&gt;,&lt;max&gt;}  ==&gt;  &lt;atom&gt;{&lt;min&gt;,&lt;min&gt;}(&lt;atom&gt;{1,&lt;max&gt;-1})?&quot;<br>
+       aMatcher := self makeOptional: anRxmLink veryDeepCopy.<br>
-       aMatcher := self makeOptional: anRxmLink copy.<br>
        (max - min - 1) timesRepeat: [<br>
+                aMatcher := self makeOptional: (anRxmLink veryDeepCopy pointTailTo: aMatcher) ].<br>
-                aMatcher := self makeOptional: (anRxmLink copy pointTailTo: aMatcher) ].<br>
        ^ (self makeQuantified: anRxmLink min: min max: min) pointTailTo: aMatcher!<br>
<br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>

<br><br>
<br></blockquote></div><br></div></div>