SmallSense__SmalltalkParseNodeFinder.st
changeset 161 5ff416530ac4
parent 157 c71d2e62ece2
child 176 df6d3225d1e4
--- a/SmallSense__SmalltalkParseNodeFinder.st	Wed Jan 29 10:41:11 2014 +0000
+++ b/SmallSense__SmalltalkParseNodeFinder.st	Wed Jan 29 10:42:31 2014 +0000
@@ -12,7 +12,7 @@
 
 !SmalltalkParseNodeFinder methodsFor:'finding'!
 
-findNodeIn: source tree: tree line: line column: col
+findNodeIn: source tree: tree comments: comments line: line column: col
 
     | sourceS |
     sourceS := source readStream.
@@ -22,19 +22,27 @@
             ^nil
         ].        
     ].
-    ^self findNodeIn: source tree: tree position: sourceS position + col
+    ^self findNodeIn: source tree: tree comments: comments position: sourceS position + col
 
-    "Created: / 26-11-2011 / 15:33:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 29-01-2014 / 10:20:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-findNodeIn: source tree: tree position: pos
+findNodeIn: source tree: tree comments: comments position: pos
+    | i s |
 
     position := pos - 1.
+    i := 1.
+    [ i < comments size and:[ (s :=comments at:i) notNil ] ] whileTrue:[ 
+        (pos >= s and:[ pos <= (s + (comments at: i + 1) - 1)]) ifTrue:[ 
+            ^ nil -> pos.
+        ].
+        i := i + 2.
+    ].
+
     self visit: tree.
     ^(match ? previous) ->  pos.
 
-    "Created: / 26-11-2011 / 15:37:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-01-2014 / 23:18:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 29-01-2014 / 10:20:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkParseNodeFinder methodsFor:'visiting'!