--- a/ParseNode.st Sun Aug 11 14:18:03 2019 +0200
+++ b/ParseNode.st Sun Aug 11 14:19:07 2019 +0200
@@ -55,6 +55,74 @@
^ (self basicNew) type:t
! !
+!ParseNode methodsFor:'RBParser compatibility'!
+
+children
+ ^ ParseNodeVisitor collectChildrenOf:self
+!
+
+containedBy:anInterval
+ startPosition isNil ifTrue:[^ false].
+ endPosition isNil ifTrue:[^ false].
+ ^ anInterval first <= startPosition and:[anInterval last >= endPosition]
+!
+
+intersectsInterval: anInterval
+ |myStart myStop ivStart ivStop|
+
+ myStart := startPosition.
+ myStop := endPosition.
+ ivStart := anInterval first.
+ ivStop := anInterval last.
+ (myStart notNil and:[ivStop < myStart]) ifTrue:[^ false].
+ (myStop notNil and:[ivStart > myStop]) ifTrue:[^ false].
+ ^ true
+!
+
+nodesDo:aBlock
+ aBlock value: self.
+ self children do: [:each | each nodesDo: aBlock]
+!
+
+start
+ "for RBToken compat."
+
+ ^ self startPosition
+!
+
+whichNodeIntersects: anInterval
+ | selectedChildren nChildren |
+
+ (self intersectsInterval: anInterval) ifFalse: [^nil].
+
+ selectedChildren := self children select:[:each |
+ each intersectsInterval: anInterval
+ ].
+
+ nChildren := selectedChildren size.
+ nChildren == 0 ifTrue:[
+ ^ self "/ I intersect
+ ].
+ nChildren == 1 ifTrue:[
+ ^ selectedChildren first whichNodeIntersects: anInterval
+ ].
+"/ self halt:'should this happen ?'.
+ ^ self "/ I intersect
+!
+
+whichNodeIsContainedBy: anInterval
+ | selectedChildren |
+
+ (self intersectsInterval: anInterval) ifFalse: [^nil].
+ (self containedBy: anInterval) ifTrue: [^self].
+
+ selectedChildren := self children
+ select: [:each | each intersectsInterval: anInterval].
+ ^ selectedChildren size == 1
+ ifTrue: [selectedChildren first whichNodeIsContainedBy: anInterval]
+ ifFalse: [nil]
+! !
+
!ParseNode methodsFor:'accessing'!
enclosingBlock
@@ -184,6 +252,7 @@
^ type
! !
+
!ParseNode methodsFor:'attributes access'!
objectAttributes
@@ -438,6 +507,8 @@
"Created: / 22-02-2011 / 16:29:50 / Jakub <zelenja7@fel.cvut.cz>"
! !
+
+
!ParseNode methodsFor:'printing & storing'!
printOn:aStream
@@ -681,6 +752,18 @@
^ self isConstant
!
+isLiteralArray
+ "for compatibility with RB-AST"
+
+ ^ false
+!
+
+isLiteralCString
+ "for compatibility with RB-AST"
+
+ ^ false
+!
+
isLocalVariable
^ false
!
@@ -729,12 +812,6 @@
^ false
!
-isSelector
- ^ false
-
- "Created: / 28-02-2019 / 10:25:05 / Stefan Vogel"
-!
-
isSelf
"return true, if this is a self-node"