Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.181.mcz ==================== Summary ==================== Name: Compiler-nice.181 Author: nice Time: 19 November 2010, 5:32:20.688 pm UUID: 86d69779-755f-0548-8a95-11173c3b8370 Ancestors: Compiler-eem.180 Let (Scanner isLiteralSymbol: #<) be true =============== Diff against Compiler-eem.180 =============== Item was changed: ----- Method: Scanner class>>isLiteralSymbol: (in category 'testing') ----- isLiteralSymbol: aSymbol "Test whether a symbol can be stored as # followed by its characters. Symbols created internally with asSymbol may not have this property, e.g. '3' asSymbol." | i ascii type next last | i := aSymbol size. i = 0 ifTrue: [^ false]. "TypeTable should have been origined at 0 rather than 1 ..." ascii := (aSymbol at: 1) asciiValue. type := TypeTable at: ascii ifAbsent: [^false]. type == #xLetter ifTrue: [ next := last := nil. [i > 1] whileTrue: [ascii := (aSymbol at: i) asciiValue. type := TypeTable at: ascii ifAbsent: [^false]. (type == #xLetter or: [type == #xDigit or: [type == #xColon and: [ next == nil ifTrue: [last := #xColon. true] ifFalse: [last == #xColon and: [next ~~ #xDigit and: [next ~~ #xColon]]]]]]) ifFalse: [^ false]. next := type. i := i - 1]. + ^ true]. + type == #xBinary ifTrue: + [^(2 to: i) allSatisfy: [:j | - ^ true]. - type == #xBinary ifTrue: [^i = 1]. "Here we could extend to - ^(2 to: i) allSatisfy: [:j | ascii := (aSymbol at: j) asciiValue. + (TypeTable at: ascii ifAbsent: []) == #xBinary]]. - (TypeTable at: ascii ifAbsent: []) == #xBinary]" type == #verticalBar ifTrue: [^i = 1]. ^false! |
Thanks, Nicholas!
On Fri, Nov 19, 2010 at 8:32 AM, <[hidden email]> wrote: Nicolas Cellier uploaded a new version of Compiler to project The Trunk: |
Free forum by Nabble | Edit this page |