CharacterArray.st
changeset 9038 d75b89570ec0
parent 9019 bf8954c06aef
child 9049 9f7bb304c353
--- a/CharacterArray.st	Wed Dec 21 17:43:07 2005 +0100
+++ b/CharacterArray.st	Wed Dec 21 18:00:25 2005 +0100
@@ -4881,29 +4881,29 @@
 numArgs
     "treating the receiver as a message selector, return how many arguments would it take"
 
-    |binopChars firstChar|
-
-    (self size > 2) ifFalse:[
-	binopChars := Scanner binarySelectorCharacters.
-	firstChar := self at:1.
-
-	(self size == 1) ifTrue:[
-	    (binopChars includes:firstChar) ifFalse:[^ 0].
-	    ^ 1
-	].
-	(binopChars includes:firstChar) ifTrue:[
-	    (binopChars includes:(self at:2)) ifTrue:[^ 1]
-	]
+    |binopChars|
+
+    (self size <= Scanner maxBinarySelectorSize) ifTrue:[
+        binopChars := Scanner binarySelectorCharacters.
+        (self contains:[:someChar | (binopChars includes:someChar) not]) ifFalse:[
+            ^ 1
+        ].
     ].
     ^ self occurrencesOf:$:
 
     "
-     'foo:bar:' numArgs
-     #foo:bar: numArgs
-     'hello' numArgs
-     '+' numArgs
-     '|' numArgs
-     '?' numArgs
+     'foo:bar:' numArgs 
+     #foo:bar: numArgs  
+     'hello' numArgs    
+     '+' numArgs        
+     '++' numArgs       
+     '+++' numArgs      
+     '|' numArgs        
+     '?' numArgs        
+     '_' numArgs        
+     '_:' numArgs        
+     '_:_:' numArgs        
+     '<->' numArgs        
     "
 
     "Modified: 4.1.1997 / 14:16:14 / cg"
@@ -5031,7 +5031,7 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.326 2005-12-15 21:40:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.327 2005-12-21 17:00:25 cg Exp $'
 ! !
 
 CharacterArray initialize!