#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Tue, 27 Aug 2019 15:09:23 +0200
changeset 4534 cc486485b1ae
parent 4533 762aeeab0661
child 4535 518bbc0a04aa
#FEATURE by exept class: ParseNode added: #bestNodeFor: RBParser compat.
ParseNode.st
--- a/ParseNode.st	Tue Aug 27 10:30:54 2019 +0200
+++ b/ParseNode.st	Tue Aug 27 15:09:23 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -57,6 +55,18 @@
 
 !ParseNode methodsFor:'RBParser compatibility'!
 
+bestNodeFor: anInterval 
+    (self intersectsInterval: anInterval) ifFalse: [^nil].
+    (self containedBy: anInterval) ifTrue: [^self].
+
+    self childrenDo:[:each | 
+        | node |
+        node := each bestNodeFor: anInterval.
+        node notNil ifTrue: [^node]
+    ].
+    ^ nil
+!
+
 children
     |children|