Hi All,<div><br></div><div>   this quick hack (below) is perhaps wrong.  Perhaps we should simply accept underscores in selectors period, and not query the preference.  If so <br><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Scanner prefAllowUnderscoreSelectors ifFalse:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>[self class isBytes</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>ifTrue: [(self findSubstring: &#39;~&#39; in: self startingAt: 1 matchTable: Tokenish) &gt; 0 ifTrue: [^ -1]]</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>ifFalse: [2 to: self size do: [:i | (self at: i) tokenish ifFalse: [^ -1]]]].</div><div><br></div><div>should read</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Scanner prefAllowUnderscoreSelectors ifFalse:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>[2 to: self size do: [:i | ((self at: i) tokenish or: [(self at: i) == $_]) ifFalse: [^ -1]]].</div></div><div><br></div><div>Instead perhaps tokenish should be redefined to allow underscores?  I&#39;d appreciate input from those that have thought about this area carefully (I have not).</div>
<div><br></div><div class="gmail_quote">On Thu, Sep 29, 2011 at 12:42 PM,  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Eliot Miranda uploaded a new version of Collections to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Collections-eem.460.mcz" target="_blank">http://source.squeak.org/trunk/Collections-eem.460.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-eem.460<br>
Author: eem<br>
Time: 29 September 2011, 12:42:36.39 pm<br>
UUID: 0b90a58f-9354-4927-91f0-3432359541fe<br>
Ancestors: Collections-ul.459<br>
<br>
Fix String&gt;numArgs for prefAllowUnderscoreSelectors regime.<br>
<br>
=============== Diff against Collections-ul.459 ===============<br>
<br>
Item was changed:<br>
  ----- Method: String&gt;&gt;numArgs (in category &#39;accessing&#39;) -----<br>
  numArgs<br>
        &quot;Answer either the number of arguments that the receiver would take if considered a selector.  Answer -1 if it couldn&#39;t be a selector.  Note that currently this will answer -1 for anything begining with an uppercase letter even though the system will accept such symbols as selectors.  It is intended mostly for the assistance of spelling correction.&quot;<br>

<br>
        | firstChar numColons excess start ix |<br>
        self size = 0 ifTrue: [^ -1].<br>
        firstChar := self at: 1.<br>
        (firstChar isLetter or: [firstChar = $:]) ifTrue:<br>
                [&quot;Fast reject if any chars are non-alphanumeric<br>
                NOTE: fast only for Byte things - Broken for Wide&quot;<br>
+               Scanner prefAllowUnderscoreSelectors ifFalse:<br>
+                       [self class isBytes<br>
+                               ifTrue: [(self findSubstring: &#39;~&#39; in: self startingAt: 1 matchTable: Tokenish) &gt; 0 ifTrue: [^ -1]]<br>
+                               ifFalse: [2 to: self size do: [:i | (self at: i) tokenish ifFalse: [^ -1]]]].<br>
-               self class isBytes<br>
-                       ifTrue: [(self findSubstring: &#39;~&#39; in: self startingAt: 1 matchTable: Tokenish) &gt; 0 ifTrue: [^ -1]]<br>
-                       ifFalse: [2 to: self size do: [:i | (self at: i) tokenish ifFalse: [^ -1]]].<br>
                &quot;Fast colon count&quot;<br>
                numColons := 0.  start := 1.<br>
                [(ix := self indexOf: $: startingAt: start) &gt; 0]<br>
                        whileTrue:<br>
                                [numColons := numColons + 1.<br>
                                start := ix + 1].<br>
                numColons = 0 ifTrue: [^ 0].<br>
                firstChar = $:<br>
                        ifTrue: [excess := 2 &quot;Has an initial keyword, as #:if:then:else:&quot;]<br>
                        ifFalse: [excess := 0].<br>
                self last = $:<br>
                        ifTrue: [^ numColons - excess]<br>
                        ifFalse: [^ numColons - excess - 1 &quot;Has a final keywords as #nextPut::andCR&quot;]].<br>
        firstChar isSpecial ifTrue:<br>
                [self size = 1 ifTrue: [^ 1].<br>
                2 to: self size do: [:i | (self at: i) isSpecial ifFalse: [^ -1]].<br>
                ^ 1].<br>
        ^ -1.!<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>
</div>