[squeak-dev] The Trunk: Compiler-nice.181.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Nov 19 16:32:46 UTC 2010
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!
More information about the Squeak-dev
mailing list
|