Scanner.st
changeset 610 0aa21dd74161
parent 608 faa97ce2db56
child 620 15bd9a44f63f
--- a/Scanner.st	Tue Sep 16 04:53:35 1997 +0200
+++ b/Scanner.st	Thu Sep 18 22:54:49 1997 +0200
@@ -795,7 +795,7 @@
 
     errorFlag := false.
     tokenPosition := 1.
-    tokenLineNr := 1.
+    tokenLineNr := lineNr := 1.
     currentComments := nil.
     saveComments := false.
     ignoreErrors := false.
@@ -1055,7 +1055,7 @@
 !
 
 nextIdentifier
-    |nextChar string firstChar ok|
+    |nextChar string firstChar ok pos|
 
     hereChar == $_ ifTrue:[
         "/
@@ -1090,10 +1090,11 @@
     or:[nextChar == $$]) ifTrue:[
         ok := (nextChar == $_) ifTrue:[AllowUnderscoreInIdentifier] ifFalse:[AllowDollarInIdentifier].
         ok ifTrue:[
+	    pos := source position.
             nextChar == $_ ifTrue:[
-                self warnUnderscoreAt:(source position).
+                self warnUnderscoreAt:pos.
             ] ifFalse:[
-                self warnDollarAt:(source position).
+                self warnDollarAt:pos.
             ].
             [ok] whileTrue:[
                 string := string copyWith:nextChar.
@@ -1132,9 +1133,10 @@
     ].
 
     nextChar == $- ifTrue:[
+	pos := source position.
         self
             warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other systems'
-            position:(source position) to:source position.
+            position:pos to:pos.
     ].
 
     tokenName := token := string.
@@ -1198,9 +1200,9 @@
             value := value asFloat + (self nextMantissa:tokenRadix).
             nextChar := source peek
         ] ifFalse:[
-            nextChar == (Character cr) ifTrue:[
-                tokenLineNr := tokenLineNr + 1.
-            ].
+"/            nextChar == (Character cr) ifTrue:[
+"/                lineNr := lineNr + 1.
+"/            ].
             nextChar := peekChar := $..
         ]
     ].
@@ -1282,7 +1284,7 @@
         source next.
         tokenValue := token := string copyTo:(index - 1).
         tokenType := #Primitive.
-        tokenLineNr := tokenLineNr + (tokenValue occurrencesOf:(Character cr)).
+        lineNr := lineNr + (tokenValue occurrencesOf:(Character cr)).
         ^ tokenType
     ].
 
@@ -1367,7 +1369,7 @@
             ^ tokenType
         ].
         (nextChar == Character cr) ifTrue:[
-            tokenLineNr := tokenLineNr + 1
+            lineNr := lineNr + 1
         ].
         (nextChar == Character quote) ifTrue:[
             (source peek == Character quote) ifTrue:[
@@ -1401,7 +1403,7 @@
     peekChar notNil ifTrue:[
         peekChar isSeparator ifTrue:[
             peekChar == (Character cr) ifTrue:[
-                tokenLineNr := tokenLineNr + 1.
+                lineNr := lineNr + 1.
             ].
             peekChar := peekChar2.
             peekChar2 := nil.
@@ -1431,7 +1433,7 @@
             ].
 
             hereChar == (Character cr) ifTrue:[
-                tokenLineNr := tokenLineNr + 1.
+                lineNr := lineNr + 1.
                 source next.
                 outStream notNil ifTrue:[
                     outStream cr.
@@ -1464,6 +1466,7 @@
         ch := hereChar
     ].
     tokenPosition := source position.
+    tokenLineNr := lineNr.
 
     (v := ch asciiValue) == 0 ifTrue:[
         v := Character space asciiValue
@@ -1527,7 +1530,7 @@
             ].
             hereChar := source nextPeek.
         ].
-        tokenLineNr := tokenLineNr + 1.
+        lineNr := lineNr + 1.
         ignoreWarnings ifFalse:[
             warnSTXSpecialComment ifTrue:[
                 self warning:'end-of-line comments are a nonstandard feature of ST/X' 
@@ -1553,7 +1556,7 @@
 
         [hereChar notNil and:[hereChar ~~ (Character doubleQuote)]] whileTrue:[
             hereChar == (Character cr) ifTrue:[
-                tokenLineNr := tokenLineNr + 1.
+                lineNr := lineNr + 1.
             ].
             saveComments ifTrue:[
                 commentStream nextPut:hereChar
@@ -1587,6 +1590,6 @@
 !Scanner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.69 1997-09-06 23:28:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.70 1997-09-18 20:54:49 cg Exp $'
 ! !
 Scanner initialize!