Scanner.st
changeset 2481 ea879f38ff03
parent 2478 21ef13183fb5
child 2484 88c45a8910f2
--- a/Scanner.st	Sat Feb 05 11:40:47 2011 +0100
+++ b/Scanner.st	Mon Mar 14 16:00:53 2011 +0100
@@ -1940,6 +1940,12 @@
     "Created: / 17.2.1998 / 14:48:49 / cg"
 !
 
+eolIsWhiteSpace
+    ^ true
+
+    "Created: / 14-03-2011 / 14:11:46 / cg"
+!
+
 escapeCharacterFor:aCharacter
     "only if AllowExtendedSTXSyntax is true 
      For now: do not use, since stc does not support it.
@@ -2954,8 +2960,14 @@
                 peekChar == (Character cr) ifTrue:[
                     lineNr := lineNr + 1.
                 ].
+                hereChar := peekChar.
                 peekChar := peekChar2.
                 peekChar2 := nil.
+                self eolIsWhiteSpace ifFalse:[
+                    token := nil.
+                    tokenType := #EOL.
+                    ^ tokenType
+                ].
             ].
         ].
 
@@ -2970,13 +2982,20 @@
 
                 outStream notNil ifTrue:[
                     [
-                      hereChar := source peekOrNil.  
-                     (hereChar == Character space)
-                     or:[hereChar isSeparator]
+                        hereChar := source peekOrNil.  
+                        (hereChar == Character space)
+                        or:[hereChar isSeparator]
                     ] whileTrue:[
                         source next.
                         outStream space. 
                         outCol := outCol + 1.
+                        hereChar == (Character cr) ifTrue:[
+                            self eolIsWhiteSpace ifFalse:[
+                                token := nil.
+                                tokenType := #EOL.
+                                ^ tokenType
+                            ].
+                        ]
                     ]
                 ] ifFalse:[
                     hereChar := source skipSeparatorsExceptCR.
@@ -2988,7 +3007,12 @@
                     outStream notNil ifTrue:[
                         outStream cr.
                         outCol := 1
-                    ]
+                    ].
+                    self eolIsWhiteSpace ifFalse:[
+                        token := nil.
+                        tokenType := #EOL.
+                        ^ tokenType
+                    ].
                 ] ifFalse:[
                     hereChar == (Character return) ifTrue:[
                         outStream notNil ifTrue:[
@@ -3044,8 +3068,8 @@
         ]
     ].
 
-    "Modified: / 13.9.1995 / 12:56:14 / claus"
-    "Modified: / 22.10.1998 / 22:15:27 / cg"
+    "Modified: / 13-09-1995 / 12:56:14 / claus"
+    "Modified: / 14-03-2011 / 15:26:21 / cg"
 !
 
 nextToken:aCharacter
@@ -3287,11 +3311,11 @@
 !Scanner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.258 2011-01-30 12:06:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.259 2011-03-14 15:00:53 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.258 2011-01-30 12:06:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.259 2011-03-14 15:00:53 cg Exp $'
 ! !
 
 Scanner initialize!