--- a/Scanner.st Wed Apr 10 15:48:43 1996 +0200
+++ b/Scanner.st Fri Apr 12 18:29:54 1996 +0200
@@ -11,16 +11,16 @@
"
Object subclass:#Scanner
- instanceVariableNames:'source collectedSource token tokenType tokenPosition tokenValue
- tokenName tokenLineNr tokenRadix hereChar peekChar peekChar2
- requestor exitBlock errorFlag ignoreErrors ignoreWarnings
- saveComments currentComments warnSTXSpecialComment
- warnUnderscoreInIdentifier warnOldStyleAssignment outStream
- outCol'
- classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings
- WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier'
- poolDictionaries:''
- category:'System-Compiler'
+ instanceVariableNames:'source collectedSource token tokenType tokenPosition tokenValue
+ tokenName tokenLineNr tokenRadix hereChar peekChar peekChar2
+ requestor exitBlock errorFlag ignoreErrors ignoreWarnings
+ saveComments currentComments warnSTXSpecialComment
+ warnUnderscoreInIdentifier warnOldStyleAssignment outStream
+ outCol'
+ classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings
+ WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier'
+ poolDictionaries:''
+ category:'System-Compiler'
!
!Scanner class methodsFor:'documentation'!
@@ -882,35 +882,37 @@
firstChar := source next.
secondChar := source peek.
- (firstChar == $-) ifTrue:[
- secondChar isDigit ifTrue:[
- self nextNumber.
- tokenValue := tokenValue negated.
- ^ tokenType
- ]
+ ((firstChar == $-) and:[secondChar notNil]) ifTrue:[
+ secondChar isDigit ifTrue:[
+ self nextNumber.
+ tokenValue := tokenValue negated.
+ ^ tokenType
+ ]
].
string := firstChar asString.
secondChar notNil ifTrue:[
- ((TypeArray at:(secondChar asciiValue)) == #special) ifTrue:[
- (secondChar == $-) ifTrue:[
- "special- look if minus belongs to number following"
- p := source position.
- source next.
- thirdChar := source peek.
- source position:p.
- thirdChar isDigit ifTrue:[
- tokenName := string.
- tokenType := #BinaryOperator.
- ^ tokenType
- ]
- ].
- source next.
- string := string copyWith:secondChar
- ].
+ ((TypeArray at:(secondChar asciiValue)) == #special) ifTrue:[
+ (secondChar == $-) ifTrue:[
+ "special- look if minus belongs to number following"
+ p := source position.
+ source next.
+ thirdChar := source peek.
+ source position:p.
+ thirdChar isDigit ifTrue:[
+ tokenName := string.
+ tokenType := #BinaryOperator.
+ ^ tokenType
+ ]
+ ].
+ source next.
+ string := string copyWith:secondChar
+ ].
].
tokenName := string.
tokenType := #BinaryOperator.
^ tokenType
+
+ "Modified: 12.4.1996 / 15:05:19 / cg"
!
nextString
@@ -1119,6 +1121,6 @@
!Scanner class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.38 1995-12-03 12:13:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.39 1996-04-12 16:29:54 cg Exp $'
! !
Scanner initialize!