CharacterArray.st
changeset 15773 af4f1efbe9f0
parent 15750 2df87ab00226
child 15788 ca8a67212c35
child 18099 8195a332b211
--- a/CharacterArray.st	Wed Sep 25 20:42:33 2013 +0200
+++ b/CharacterArray.st	Sat Sep 28 14:09:00 2013 +0200
@@ -5085,6 +5085,22 @@
     "Modified: 12.5.1996 / 20:32:05 / cg"
 !
 
+isKeyword
+    "return true, if the receiver is a keyword message selector"
+
+    ^ self includes:$:
+
+    "
+     #at:put: isKeyword
+     #at: isKeyword
+     #+ isKeyword
+     #size isKeyword
+    "
+
+    "Created: / 1.11.1997 / 12:34:55 / cg"
+    "Modified: / 1.11.1997 / 12:36:37 / cg"
+!
+
 isLowercaseFirst
     "return true, if the first character is a lowercase character."
 
@@ -5107,6 +5123,32 @@
     "
 !
 
+keywords
+    "assuming the receiver is a keyword message selector,
+     return the individual keywords (i.e. break it up at colons)
+     and return these as a collection.
+     For binary and unary selectors, the result may be nonsense (an array containing the receiver)."
+
+    |coll s part|
+
+    coll := OrderedCollection new.
+    s := ReadStream on:self.
+    [s atEnd] whileFalse:[
+	part := s through:$:.
+	coll add:part
+    ].
+    ^ coll asArray
+
+    "
+     #at:put: keywords
+     #at: keywords
+     #+ keywords
+     #size keywords
+    "
+
+    "Modified (Comment): / 30-06-2011 / 17:46:21 / cg"
+!
+
 knownAsSymbol
     "for now, only single character strings are allowed as symbols.
      This method is redefined in String."
@@ -6718,11 +6760,11 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.515 2013-09-05 11:41:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.516 2013-09-28 12:09:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.515 2013-09-05 11:41:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.516 2013-09-28 12:09:00 cg Exp $'
 ! !