<div dir="ltr"><div>Hi Christoph,</div><div><br></div><div>thanks for the swift notice! Upon checking just now, it seemed to me as if your patch was displayed incomplete on the ML. Looking at the test you checked in, however, it looks iike you added support for \x escapes as well, which is something I realized only a couple hours after making the commit I should have added as well. So yours might very well be preferable to mine :)</div><div><br></div><div>Best,</div><div>Tom<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 18, 2021 at 2:27 PM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div>


<div dir="ltr">
<div id="gmail-m_-6296299035307814760x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p>Hi Tom,</p>
<p><br>
</p>
<p>this looks similar to <span>Regex-Core-ct.68. :-) I will compare both patches later in-depth, maybe we can merge the best of both approaches.</span></p>
<p><span><br>
</span></p>
<p><span>(For the future, maybe someone should build a tiny tool that automatically warns you when you start editing a class/protocol/method for that there already open patches in The Inbox ... :D)</span></p>
<p><span><br>
</span></p>
<p><span>Best,</span></p>
<p><span>Christoph</span></p>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-6296299035307814760x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>><br>
<b>Gesendet:</b> Montag, 18. Oktober 2021 12:55:02<br>
<b>An:</b> <a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a><br>
<b>Betreff:</b> [squeak-dev] The Inbox: Regex-Core-tobe.62.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div>A new version of Regex-Core was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Regex-Core-tobe.62.mcz" target="_blank">http://source.squeak.org/inbox/Regex-Core-tobe.62.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Regex-Core-tobe.62<br>
Author: tobe<br>
Time: 18 October 2021, 12:55:00.939602 pm<br>
UUID: 02286bc7-4450-4843-9988-40b1dc9bfa70<br>
Ancestors: Regex-Core-mt.61<br>
<br>
Add support for \uXXXX for specifying unicode code points<br>
<br>
=============== Diff against Regex-Core-mt.61 ===============<br>
<br>
Item was changed:<br>
  ----- Method: RxCharSetParser>>parseEscapeChar (in category 'parsing') -----<br>
  parseEscapeChar<br>
  <br>
+        | first last |<br>
-        | first |<br>
         self match: $\.<br>
         first := (RxsPredicate forEscapedLetter: lookahead)<br>
+                ifNil: [<br>
+                         (lookahead = $u and: [RxsPredicate matchesUnicodeSymbol: (source peek: 4)])<br>
+                                ifTrue: [RxsCharacter with: (RxsPredicate unicodeCharacterFrom: self)]<br>
+                                ifFalse: [RxsCharacter with: lookahead]].<br>
-                ifNil: [ RxsCharacter with: lookahead ].<br>
         self next == $- ifFalse: [^ elements add: first].<br>
         self next ifNil: [<br>
                 elements add: first.<br>
                 ^ self addChar: $-].<br>
+        last := lookahead = $\<br>
+                ifTrue: [<br>
+                        self next.<br>
+                        (RxsPredicate forEscapedLetter: lookahead)<br>
+                                ifNil: [<br>
+                                         (lookahead = $u and: [RxsPredicate matchesUnicodeSymbol: (source peek: 4)])<br>
+                                                ifTrue: [RxsCharacter with: (RxsPredicate unicodeCharacterFrom: self)]<br>
+                                                ifFalse: [RxsCharacter with: lookahead]]]<br>
+                ifFalse: [ | char |<br>
+                        char := RxsCharacter with: lookahead.<br>
+                        self next.<br>
+                        char].<br>
+        self addRangeFrom: first character to: last character!<br>
-        self addRangeFrom: first character to: lookahead.<br>
-        self next!<br>
<br>
Item was changed:<br>
  ----- Method: RxParser>>ifSpecial:then: (in category 'private') -----<br>
  ifSpecial: aCharacter then: aBlock<br>
         "If the character is such that it defines a special node when follows a $\,<br>
         then create that node and evaluate aBlock with the node as the parameter.<br>
         Otherwise just return."<br>
  <br>
         | classAndSelector |<br>
+        classAndSelector := BackslashSpecials at: aCharacter ifAbsent: [<br>
+                " check if we have four hex digits for a unicode code symbol following "<br>
+                (aCharacter = $u and: [RxsPredicate matchesUnicodeSymbol: (input peek: 4)]) ifTrue: [<br>
+                        ^ aBlock value: (RxsPredicate forUnicodeFrom: self)].<br>
+                ^self].<br>
-        classAndSelector := BackslashSpecials at: aCharacter ifAbsent: [^self].<br>
         ^aBlock value: (classAndSelector key new perform: classAndSelector value)!<br>
<br>
Item was added:<br>
+ ----- Method: RxsPredicate class>>forUnicodeFrom: (in category 'instance creation') -----<br>
+ forUnicodeFrom: aParser<br>
+ <br>
+        ^RxsPredicate new beCharacter: (self unicodeCharacterFrom: aParser)!<br>
<br>
Item was added:<br>
+ ----- Method: RxsPredicate class>>matchesUnicodeSymbol: (in category 'helper') -----<br>
+ matchesUnicodeSymbol: aString<br>
+ <br>
+        ^aString size = 4 and: [aString allSatisfy: [:c | c asLowercase between: $0 and: $f]]!<br>
<br>
Item was added:<br>
+ ----- Method: RxsPredicate class>>unicodeCharacterFrom: (in category 'helper') -----<br>
+ unicodeCharacterFrom: aParser<br>
+ <br>
+        ^Character value: (Integer readFrom: aParser next asString, aParser next, aParser next, aParser next base: 16)!<br>
<br>
<br>
</div>
</span></font>
</div>

<br>
</blockquote></div>