SmallSense__TokenStream.st
changeset 238 d5a32e41181f
parent 233 fb33bd6466a4
child 249 8bc64027b189
--- a/SmallSense__TokenStream.st	Fri Jun 13 15:44:47 2014 +0100
+++ b/SmallSense__TokenStream.st	Sat Jun 14 00:35:03 2014 +0100
@@ -203,17 +203,38 @@
 
 position: anInteger
     (positionMax - anInteger) > (tokens size) ifTrue:[
-        self error:'Not that much tokens in backlog!! Icrease it and try again'
+        Stream positionErrorSignal raiseErrorString:'Not that much tokens in backlog!! Icrease it and try again'.
+        ^ self.
     ].
     position := anInteger.
 
-    "Modified: / 07-08-2013 / 01:34:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-06-2014 / 16:54:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+position: tokenPosition sourcePosition: sourcePosition
+    position := positionMax := tokenPosition.
+    tokens := tokens class new: tokens size.
+    full := false.
+
+    scanner sourceStream position: sourcePosition.
+    positionOfCursor notNil ifTrue:[
+        sourcePosition < positionOfCursor ifTrue:[
+            scanner sourceStream readLimit: (positionOfCursor min: scannerSourceReadLimit).
+            caretTokenReported := false.
+        ].
+    ].
+
+    "Created: / 13-06-2014 / 17:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 reset
-    self position: 0.
+    (positionMax) > (tokens size) ifFalse:[
+        scanner sourceStream reset.    
+    ].
+    position := 0.
 
     "Created: / 14-05-2014 / 16:19:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-06-2014 / 16:47:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 skipSeparators