[squeak-dev] The Trunk: Compiler-ul.102.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 3 05:06:03 UTC 2009


Levente Uzonyi uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ul.102.mcz

==================== Summary ====================

Name: Compiler-ul.102
Author: ul
Time: 3 December 2009, 6:04:35 am
UUID: b4de7fcc-4713-aa42-ac62-f7f1de2b6c16
Ancestors: Compiler-ul.101

- lifted a missing change from Pharo for ByteArray literals
- ScannerTest >> #testLiteralSymbols and a test in DecompilerTestFailuresCollector pass now

=============== Diff against Compiler-nice.100 ===============

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 ascii type next |
  	i := aSymbol size.
  	i = 0 ifTrue: [^ false].
+ 
- 	i = 1 ifTrue: [^('$''"()#0123456789_' includes: (aSymbol at: 1)) not
- 		and: ["should be (TypeTable at: (aSymbol at: 1) charCode ifAbsent: [#xLetter]) ~~ #xDelimiter"
- 			(aSymbol at: 1) isSeparator not]].
- 	ascii := (aSymbol at: 1) charCode.
  	"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: [^i = 1]. "Here we could extend to
+ 		^(2 to: i) allSatisfy: [:j |
+ 			ascii := (aSymbol at: j) asciiValue.
+ 			(TypeTable at: ascii ifAbsent: []) == #xBinary]"
+ 	type == #verticalBar ifTrue: [^i = 1].
- 	ascii = 0 ifTrue: [^ false].
- 	type := TypeTable at: ascii ifAbsent: [#xLetter].
- 	(type == #xColon or: [type == #verticalBar or: [type == #xBinary]]) ifTrue:
- 		[^i = 1].
- 	type == #xLetter ifTrue:
- 		[next := nil.
- 		[i > 1] whileTrue:
- 			[ascii := (aSymbol at: i) charCode.
- 			ascii = 0 ifTrue: [^false].
- 			type := TypeTable at: ascii ifAbsent: [#xLetter].
- 			(type == #xLetter or: [type == #xDigit or: [type == #xColon]]) ifFalse:
- 				[^false].
- 			(next == #xDigit and: [type == #xColon]) ifTrue: [^false].
- 			next := type.
- 			i := i - 1].
- 		^true].
  	^false!




More information about the Squeak-dev mailing list