[Pkg] The Trunk: Compiler-ul.206.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Apr 3 00:57:23 UTC 2011


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

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

Name: Compiler-ul.206
Author: ul
Time: 3 April 2011, 2:18:08.993 am
UUID: 8cf4ce89-32f6-f04c-bbd5-8cb82cce271f
Ancestors: Compiler-nice.205

- fixed Scanner's comment
- removed unsent obsolete method from Scanner
- refactored Scanner >> #scanLitWord a bit
- changed the postscript to recompile the senders of #repeat, just in case someone has broken methods

=============== Diff against Compiler-nice.205 ===============

Item was changed:
  Object subclass: #Scanner
  	instanceVariableNames: 'source mark hereChar aheadChar token tokenType currentComment buffer typeTable'
  	classVariableNames: 'AllowUnderscoreAssignments AllowUnderscoreSelectors DoItCharacter TypeTable'
  	poolDictionaries: ''
  	category: 'Compiler-Kernel'!
  
+ !Scanner commentStamp: 'ul 4/3/2011 02:04' prior: 0!
- !Scanner commentStamp: 'ul 3/27/2011 23:24' prior: 0!
  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.
  
  Instance Variables
  	aheadChar:		<Character>
  	buffer:		<WriteStream>
  	currentComment:		<OrderedCollection>
  	hereChar:		<Character>
  	mark:		<Integer>
  	source:		<ReadStream>
  	token:		<Symbol|String|NumberCharacter|Boolean|nil>
  	tokenType:		<Symbol>
  	typeTable:		<Array>
  
  aheadChar
  	- the next character in the input stream
  
  buffer
  	- a reusable WriteStream on a String which is used for building strings. Shouldn't be used from multiple methods without resetting.
  
  currentComment
  	- an OrderedCollection of strings which contain all comments between the current token and the previous token or the beginning of the source.
  
  hereChar
  	- the current character
  
  mark
  	- the position of the current token in the source stream
  
  source
+ 	- the input stream of characters
- 	- xxxxx
  
  token
  	- the current token
  
  tokenType
  	- the type of the current token. The possible token types are: #binary, #character, #colon, #doIt, #keyword, #leftArrow, #leftBrace, #leftBracket, #leftParenthesis, #literal, #period, #rightBrace, #rightBracket, #rightParenthesis, #semicolon, #string, #upArrow, #verticalBar, #word, #xBinary, #xColon, #xDelimiter, #xDigit, #xDollar, #xDoubleQuote, #xLetter, #xLitQuote, #xSingleQuote, #xUnderscore
  
  typeTable
  	- an array that maps each an evaluable tokenType to each character with asciiValue between 0 and 255!

Item was removed:
- ----- Method: Scanner>>checkpoint (in category 'expression types') -----
- checkpoint
- 	"Return a copy of all changeable state.  See revertToCheckpoint:"
- 
- 	^ {self clone. source clone. currentComment copy}!

Item was removed:
- ----- Method: Scanner>>errorMultibyteCharacter (in category 'error handling') -----
- errorMultibyteCharacter
- 
- 	self error: 'multi-byte character is found at unexpected place'.
- !

Item was removed:
- ----- Method: Scanner>>nextLiteral (in category 'expression types') -----
- nextLiteral
- 	"Same as advance, but -4 comes back as a number instead of two tokens"
- 
- 	| prevToken |
- 	prevToken := self advance.
- 	(prevToken == #- and: [token isKindOf: Number])
- 		ifTrue: 
- 			[^self advance negated].
- 	^prevToken!

Item was removed:
- ----- Method: Scanner>>revertToCheckpoint: (in category 'expression types') -----
- revertToCheckpoint: checkpoint
- 	"Revert to the state when checkpoint was made."
- 
- 	| myCopy |
- 	myCopy := checkpoint first.
- 	1 to: self class instSize do:
- 		[:i | self instVarAt: i put: (myCopy instVarAt: i)].
- 	source := checkpoint second.
- 	currentComment := checkpoint third!

Item was changed:
  ----- Method: Scanner>>scanLitWord (in category 'expression types') -----
  scanLitWord
  	"Accumulate keywords and asSymbol the result."
  
+ 	token := (String streamContents: [ :stream |
+ 		stream nextPutAll: token.
+ 		[ (self typeTableAt: hereChar) == #xLetter ] whileTrue: [
- 	| t |
- 	[(self typeTableAt: hereChar) == #xLetter]
- 		whileTrue: 
- 			[t := token.
  			self xLetter.
+ 			stream nextPutAll: token ] ]) asSymbol!
- 			token := t , token].
- 	token := token asSymbol!

Item was changed:
  (PackageInfo named: 'Compiler') postscript: '"Recompile methods which send #repeat."
+ CurrentReadOnlySourceFiles cacheDuring: [
+ 	(SystemNavigation default allCallsOn: #repeat) do: [ :methodReference |
+ 		methodReference actualClass recompile:  methodReference selector ] ]'!
- (SystemNavigation default allCallsOn: #repeat) do: [ :each |
- 	each actualClass recompile: each selector ].'!



More information about the Packages mailing list