[squeak-dev] The Trunk: Compiler-ul.204.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Apr 1 23:07:24 UTC 2011
Levente Uzonyi uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ul.204.mcz
==================== Summary ====================
Name: Compiler-ul.204
Author: ul
Time: 2 April 2011, 12:53:54.869 am
UUID: 9a4461b2-a9c8-1a4e-82bc-40d15ff7ac7c
Ancestors: Compiler-ul.203
Scanner changes:
- added a new class variable DoItCharacter. All checks for doIt characters (30) should use this. (part 2)
- reuse buffer in #xDoubleQuote instead of a custom stream
=============== Diff against Compiler-ul.203 ===============
Item was changed:
----- Method: Scanner>>scanToken (in category 'expression types') -----
scanToken
[(tokenType := self typeTableAt: hereChar) == #xDelimiter]
whileTrue: [self step]. "Skip delimiters fast, there almost always is one."
+ mark := (aheadChar == DoItCharacter and: [source atEnd])
- mark := (aheadChar asciiValue = 30 and: [source atEnd])
ifTrue: [source position]
ifFalse: [source position - 1].
(tokenType at: 1) == $x "x as first letter"
ifTrue: [self perform: tokenType "means perform to compute token & type"]
ifFalse: [token := self step asSymbol "else just unique the first char"].
^token!
Item was changed:
----- Method: Scanner>>step (in category 'expression types') -----
step
| c |
c := hereChar.
hereChar := aheadChar.
source atEnd
+ ifTrue: [aheadChar := DoItCharacter]
- ifTrue: [aheadChar := 30 asCharacter "doit"]
ifFalse: [aheadChar := source next].
^c!
Item was changed:
----- Method: Scanner>>xDigit (in category 'multi-character scans') -----
xDigit
"Form a number."
tokenType := #number.
+ (aheadChar == DoItCharacter and: [source atEnd
+ and: [source skip: -1. source next ~~ DoItCharacter]])
- (aheadChar asciiValue = 30 and: [source atEnd
- and: [source skip: -1. source next asciiValue ~= 30]])
ifTrue: [source skip: -1 "Read off the end last time"]
ifFalse: [source skip: -2].
token := (SqNumberParser on: source)
failBlock: [:errorString :position | self notify: errorString at:position];
nextNumber.
self step; step!
Item was changed:
----- Method: Scanner>>xDoubleQuote (in category 'multi-character scans') -----
xDoubleQuote
"Collect a comment."
"wod 1/10/98: Allow 'empty' comments by testing the first character
for $"" rather than blindly adding it to the comment being collected."
+
+ buffer reset.
+ self step.
+ [ hereChar == $" ] whileFalse: [
+ (hereChar == DoItCharacter and: [ source atEnd ]) ifTrue: [
+ ^self offEnd: 'Unmatched comment quote' ].
+ buffer nextPut: self step ].
+ self step.
+ (currentComment ifNil: [
+ currentComment := OrderedCollection new ])
+ add: buffer contents.
+ self scanToken!
- | aStream stopChar |
- stopChar := 30 asCharacter.
- aStream := WriteStream on: (String new: 200).
- self step.
- [hereChar == $"]
- whileFalse:
- [(hereChar == stopChar and: [source atEnd])
- ifTrue: [^self offEnd: 'Unmatched comment quote'].
- aStream nextPut: self step.].
- self step.
- currentComment == nil
- ifTrue: [currentComment := OrderedCollection with: aStream
- contents]
- ifFalse: [currentComment add: aStream contents].
- self scanToken!
Item was changed:
----- Method: Scanner>>xSingleQuote (in category 'multi-character scans') -----
xSingleQuote
"String."
self step.
buffer reset.
[hereChar == $'
and: [aheadChar == $'
ifTrue: [self step. false]
ifFalse: [true]]]
whileFalse:
[buffer nextPut: self step.
+ (hereChar == DoItCharacter and: [source atEnd])
- (hereChar asciiValue = 30 and: [source atEnd])
ifTrue: [^self offEnd: 'Unmatched string quote']].
self step.
token := buffer contents.
tokenType := #string!
More information about the Squeak-dev
mailing list
|