There is (still?) an allowUnderscoreAssignment preference setting in the compiler (lowercase) category from Parser&gt;&gt;initialize?<br><br>Alex<br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 09:25,  <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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Andreas Raab uploaded a new version of Compiler to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Compiler-ar.137.mcz" target="_blank">http://source.squeak.org/trunk/Compiler-ar.137.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Compiler-ar.137<br>
Author: ar<br>
Time: 24 March 2010, 1:25:23.067 am<br>
UUID: 090fc365-fe3c-6741-a731-3222d6ab6afa<br>
Ancestors: Compiler-nice.136<br>
<br>
Underscore assignments and underscore selector preferences and implementation. The defaults are set to be compatible with past usage, i.e., allowUnderscoreAssignment is true and allowUnderscoreSelectors is false. Might consider changing this after 4.1.<br>


<br>
=============== Diff against Compiler-nice.136 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Scanner&gt;&gt;allowUnderscoreSelectors (in category &#39;private&#39;) -----<br>
+ allowUnderscoreSelectors<br>
+       &quot;Query preference&quot;<br>
+       ^self class prefAllowUnderscoreSelectors!<br>
<br>
Item was changed:<br>
  ----- Method: Scanner class&gt;&gt;initialize (in category &#39;initialization&#39;) -----<br>
  initialize<br>
        | newTable |<br>
        newTable := Array new: 256 withAll: #xBinary. &quot;default&quot;<br>
        newTable atAll: #(9 10 12 13 32 ) put: #xDelimiter. &quot;tab lf ff cr space&quot;<br>
        newTable atAll: ($0 asciiValue to: $9 asciiValue) put: #xDigit.<br>
<br>
        1 to: 255<br>
                do: [:index |<br>
                        (Character value: index) isLetter<br>
                                ifTrue: [newTable at: index put: #xLetter]].<br>
<br>
        newTable at: 30 put: #doIt.<br>
        newTable at: $&quot; asciiValue put: #xDoubleQuote.<br>
        newTable at: $# asciiValue put: #xLitQuote.<br>
        newTable at: $$ asciiValue put: #xDollar.<br>
        newTable at: $&#39; asciiValue put: #xSingleQuote.<br>
        newTable at: $: asciiValue put: #xColon.<br>
        newTable at: $( asciiValue put: #leftParenthesis.<br>
        newTable at: $) asciiValue put: #rightParenthesis.<br>
        newTable at: $. asciiValue put: #period.<br>
        newTable at: $; asciiValue put: #semicolon.<br>
        newTable at: $[ asciiValue put: #leftBracket.<br>
        newTable at: $] asciiValue put: #rightBracket.<br>
        newTable at: ${ asciiValue put: #leftBrace.<br>
        newTable at: $} asciiValue put: #rightBrace.<br>
        newTable at: $^ asciiValue put: #upArrow.<br>
+       newTable at: $_ asciiValue put: #xUnderscore.<br>
-       newTable at: $_ asciiValue put: #leftArrow.<br>
        newTable at: $| asciiValue put: #verticalBar.<br>
        TypeTable := newTable &quot;bon voyage!!&quot;<br>
<br>
        &quot;Scanner initialize&quot;!<br>
<br>
Item was added:<br>
+ ----- Method: Parser&gt;&gt;allowUnderscoreAssignments (in category &#39;private&#39;) -----<br>
+ allowUnderscoreAssignments<br>
+       &quot;Query class + preference&quot;<br>
+       ^encoder classEncoding allowUnderscoreAssignments<br>
+               ifNil:[super allowUnderscoreAssignments]!<br>
<br>
Item was added:<br>
+ ----- Method: Scanner&gt;&gt;allowUnderscoreAssignments (in category &#39;private&#39;) -----<br>
+ allowUnderscoreAssignments<br>
+       &quot;Query preference&quot;<br>
+       ^self class prefAllowUnderscoreAssignments!<br>
<br>
Item was added:<br>
+ ----- Method: Scanner class&gt;&gt;prefAllowUnderscoreAssignments: (in category &#39;preferences&#39;) -----<br>
+ prefAllowUnderscoreAssignments: aBool<br>
+       &quot;Accessor for the system-wide preference&quot;<br>
+       AllowUnderscoreAssignments := aBool!<br>
<br>
Item was added:<br>
+ ----- Method: Scanner class&gt;&gt;prefAllowUnderscoreAssignments (in category &#39;preferences&#39;) -----<br>
+ prefAllowUnderscoreAssignments<br>
+       &quot;Accessor for the system-wide preference&quot;<br>
+       &lt;preference: &#39;Allow underscore assignments&#39;<br>
+               category: &#39;Compiler&#39;<br>
+               description: &#39;When true, underscore can be used as assignment operator&#39;<br>
+               type: #Boolean&gt;<br>
+       ^AllowUnderscoreAssignments ifNil:[true]!<br>
<br>
Item was added:<br>
+ ----- Method: Scanner class&gt;&gt;prefAllowUnderscoreSelectors: (in category &#39;preferences&#39;) -----<br>
+ prefAllowUnderscoreSelectors: aBool<br>
+       &quot;Accessor for the system-wide preference&quot;<br>
+       AllowUnderscoreSelectors := aBool!<br>
<br>
Item was changed:<br>
  ----- Method: Scanner&gt;&gt;xUnderscore (in category &#39;multi-character scans&#39;) -----<br>
  xUnderscore<br>
+       self allowUnderscoreAssignments ifTrue:[ | type |<br>
+               &quot;Figure out if x _foo (no space between _ and foo)<br>
+               should be a selector or assignment&quot;<br>
+               (((type := self typeTableAt: aheadChar) == #xLetter<br>
+                       or:[type == #xDigit or:[type == #xUnderscore]])<br>
+                       and:[self allowUnderscoreSelectors]) ifFalse:[<br>
+                               self step.<br>
+                               tokenType := #leftArrow.<br>
+                               ^token := #&#39;:=&#39;<br>
+               ].<br>
+       ].<br>
+       self allowUnderscoreSelectors ifTrue:[^self xLetter].<br>
+       ^self xIllegal<br>
+ !<br>
-       Preferences allowUnderscoreAssignment ifFalse:[^self xIllegal].<br>
-       self step.<br>
-       tokenType := #leftArrow.<br>
-       ^token := #&#39;:=&#39;!<br>
<br>
Item was changed:<br>
  ----- Method: Scanner&gt;&gt;xLetter (in category &#39;multi-character scans&#39;) -----<br>
  xLetter<br>
        &quot;Form a word or keyword.&quot;<br>
<br>
        | type |<br>
        buffer reset.<br>
+       [(type := self typeTableAt: hereChar) == #xLetter<br>
+               or: [type == #xDigit<br>
+               or: [type == #xUnderscore and:[self allowUnderscoreSelectors]]]] whileTrue:<br>
-       [(type := self typeTableAt: hereChar) == #xLetter or: [type == #xDigit]]<br>
-               whileTrue:<br>
                        [&quot;open code step for speed&quot;<br>
                        buffer nextPut: hereChar.<br>
                        hereChar := aheadChar.<br>
                        aheadChar := source atEnd<br>
                                                        ifTrue: [30 asCharacter &quot;doit&quot;]<br>
                                                        ifFalse: [source next]].<br>
        tokenType := (type == #colon or: [type == #xColon and: [aheadChar ~~ $=]])<br>
                                        ifTrue:<br>
                                                [buffer nextPut: self step.<br>
                                                &quot;Allow any number of embedded colons in literal symbols&quot;<br>
                                                [(self typeTableAt: hereChar) == #xColon] whileTrue:<br>
                                                        [buffer nextPut: self step].<br>
                                                #keyword]<br>
                                        ifFalse:<br>
                                                [type == #leftParenthesis<br>
                                                        ifTrue:<br>
                                                                [buffer nextPut: self step; nextPut: $).<br>
                                                                 #positionalMessage]<br>
                                                        ifFalse:[#word]].<br>
        token := buffer contents!<br>
<br>
Item was changed:<br>
  Object subclass: #Scanner<br>
        instanceVariableNames: &#39;source mark hereChar aheadChar token tokenType currentComment buffer typeTable&#39;<br>
+       classVariableNames: &#39;AllowUnderscoreAssignments AllowUnderscoreSelectors TypeTable&#39;<br>
-       classVariableNames: &#39;TypeTable&#39;<br>
        poolDictionaries: &#39;&#39;<br>
        category: &#39;Compiler-Kernel&#39;!<br>
<br>
  !Scanner commentStamp: &#39;&lt;historical&gt;&#39; prior: 0!<br>
  I scan a string or text, picking out Smalltalk syntactic tokens. I look one character ahead. I put each token found into the instance variable, token, and its type (a Symbol) into the variable, tokenType. At the end of the input stream, I pretend to see an endless sequence of special characters called doits.!<br>


<br>
Item was added:<br>
+ ----- Method: Scanner class&gt;&gt;prefAllowUnderscoreSelectors (in category &#39;preferences&#39;) -----<br>
+ prefAllowUnderscoreSelectors<br>
+       &quot;Accessor for the system-wide preference&quot;<br>
+       &lt;preference: &#39;Allow underscore selectors&#39;<br>
+               category: &#39;Compiler&#39;<br>
+               description: &#39;When true, underscore can be used in selectors and varibable names&#39;<br>
+               type: #Boolean&gt;<br>
+       ^AllowUnderscoreSelectors ifNil:[false]!<br>
<br>
Item was added:<br>
+ ----- Method: Parser&gt;&gt;allowUnderscoreSelectors (in category &#39;private&#39;) -----<br>
+ allowUnderscoreSelectors<br>
+       &quot;Query class + preference&quot;<br>
+       ^encoder classEncoding allowUnderscoreSelectors<br>
+               ifNil:[super allowUnderscoreSelectors]!<br>
<br>
<br>
</blockquote></div><br>