class: CharacterArray
authorClaus Gittinger <cg@exept.de>
Fri, 04 Jan 2013 16:28:41 +0100
changeset 14629 6491c3b25cd5
parent 14628 d6bf1fd719f6
child 14630 c84d8830c33e
class: CharacterArray changed: #partsIfSelector
CharacterArray.st
--- a/CharacterArray.st	Fri Jan 04 14:38:39 2013 +0100
+++ b/CharacterArray.st	Fri Jan 04 16:28:41 2013 +0100
@@ -326,7 +326,6 @@
     "
 ! !
 
-
 !CharacterArray class methodsFor:'pattern matching'!
 
 matchEscapeCharacter
@@ -678,7 +677,6 @@
     ^ self == CharacterArray
 ! !
 
-
 !CharacterArray methodsFor:'Compatibility-ANSI'!
 
 addLineDelimiters
@@ -4313,7 +4311,6 @@
 ! !
 
 
-
 !CharacterArray methodsFor:'padded copying'!
 
 centerPaddedTo:newSize
@@ -4838,7 +4835,6 @@
     "Modified: 17.4.1997 / 12:50:23 / cg"
 ! !
 
-
 !CharacterArray methodsFor:'special string converting'!
 
 expandPlaceholdersWith:argArrayOrDictionary
@@ -5643,7 +5639,6 @@
     "
 ! !
 
-
 !CharacterArray methodsFor:'substring searching'!
 
 findString:subString
@@ -6083,7 +6078,11 @@
 !
 
 partsIfSelector
-    "treat the receiver as a message selector, return a collection of parts."
+    "treat the receiver as a message selector, return a collection of parts.
+     Notice: this is more tolerant than Smalltalk's syntax would suggest;
+     especially it allows for empty keyword parts between colons.
+     This is not (and should not be checked here), to allow parsing of
+     degenerate selectors as appearing with objectiveC."
 
     |idx1 "{ Class: SmallInteger }"
      coll idx2 sz|
@@ -6092,13 +6091,13 @@
     idx1 := 1.
     sz := self size.
     [true] whileTrue:[
-	idx2 := self indexOf:$: startingAt:idx1 + 1.
-	(idx2 == 0 or:[idx2 == sz]) ifTrue:[
-	    coll add:(self copyFrom:idx1).
-	    ^ coll
-	].
-	coll add:(self copyFrom:idx1 to:idx2).
-	idx1 := idx2 + 1
+        idx2 := self indexOf:$: startingAt:idx1.
+        (idx2 == 0 or:[idx2 == sz]) ifTrue:[
+            coll add:(self copyFrom:idx1).
+            ^ coll
+        ].
+        coll add:(self copyFrom:idx1 to:idx2).
+        idx1 := idx2 + 1
     ].
 
     "
@@ -6129,11 +6128,11 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.485 2012-12-19 09:26:56 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.486 2013-01-04 15:28:41 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.485 2012-12-19 09:26:56 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.486 2013-01-04 15:28:41 cg Exp $'
 ! !