changeset 4471 | 970c73f20faf |
parent 4368 | 5a11adf556d7 |
child 4501 | d8b0a5d31348 |
4470:8e9fd99e36d9 | 4471:970c73f20faf |
---|---|
53 |
53 |
54 type:t |
54 type:t |
55 ^ (self basicNew) type:t |
55 ^ (self basicNew) type:t |
56 ! ! |
56 ! ! |
57 |
57 |
58 !ParseNode methodsFor:'RBParser compatibility'! |
|
59 |
|
60 children |
|
61 ^ ParseNodeVisitor collectChildrenOf:self |
|
62 ! |
|
63 |
|
64 containedBy:anInterval |
|
65 startPosition isNil ifTrue:[^ false]. |
|
66 endPosition isNil ifTrue:[^ false]. |
|
67 ^ anInterval first <= startPosition and:[anInterval last >= endPosition] |
|
68 ! |
|
69 |
|
70 intersectsInterval: anInterval |
|
71 |myStart myStop ivStart ivStop| |
|
72 |
|
73 myStart := startPosition. |
|
74 myStop := endPosition. |
|
75 ivStart := anInterval first. |
|
76 ivStop := anInterval last. |
|
77 (myStart notNil and:[ivStop < myStart]) ifTrue:[^ false]. |
|
78 (myStop notNil and:[ivStart > myStop]) ifTrue:[^ false]. |
|
79 ^ true |
|
80 ! |
|
81 |
|
82 nodesDo:aBlock |
|
83 aBlock value: self. |
|
84 self children do: [:each | each nodesDo: aBlock] |
|
85 ! |
|
86 |
|
87 start |
|
88 "for RBToken compat." |
|
89 |
|
90 ^ self startPosition |
|
91 ! |
|
92 |
|
93 whichNodeIntersects: anInterval |
|
94 | selectedChildren nChildren | |
|
95 |
|
96 (self intersectsInterval: anInterval) ifFalse: [^nil]. |
|
97 |
|
98 selectedChildren := self children select:[:each | |
|
99 each intersectsInterval: anInterval |
|
100 ]. |
|
101 |
|
102 nChildren := selectedChildren size. |
|
103 nChildren == 0 ifTrue:[ |
|
104 ^ self "/ I intersect |
|
105 ]. |
|
106 nChildren == 1 ifTrue:[ |
|
107 ^ selectedChildren first whichNodeIntersects: anInterval |
|
108 ]. |
|
109 "/ self halt:'should this happen ?'. |
|
110 ^ self "/ I intersect |
|
111 ! |
|
112 |
|
113 whichNodeIsContainedBy: anInterval |
|
114 | selectedChildren | |
|
115 |
|
116 (self intersectsInterval: anInterval) ifFalse: [^nil]. |
|
117 (self containedBy: anInterval) ifTrue: [^self]. |
|
118 |
|
119 selectedChildren := self children |
|
120 select: [:each | each intersectsInterval: anInterval]. |
|
121 ^ selectedChildren size == 1 |
|
122 ifTrue: [selectedChildren first whichNodeIsContainedBy: anInterval] |
|
123 ifFalse: [nil] |
|
124 ! ! |
|
125 |
|
58 !ParseNode methodsFor:'accessing'! |
126 !ParseNode methodsFor:'accessing'! |
59 |
127 |
60 enclosingBlock |
128 enclosingBlock |
61 "Return closest enclosing block node or nil" |
129 "Return closest enclosing block node or nil" |
62 |
130 |
181 type |
249 type |
182 "return the nodes type" |
250 "return the nodes type" |
183 |
251 |
184 ^ type |
252 ^ type |
185 ! ! |
253 ! ! |
254 |
|
186 |
255 |
187 !ParseNode methodsFor:'attributes access'! |
256 !ParseNode methodsFor:'attributes access'! |
188 |
257 |
189 objectAttributes |
258 objectAttributes |
190 |
259 |
436 ^false. |
505 ^false. |
437 |
506 |
438 "Created: / 22-02-2011 / 16:29:50 / Jakub <zelenja7@fel.cvut.cz>" |
507 "Created: / 22-02-2011 / 16:29:50 / Jakub <zelenja7@fel.cvut.cz>" |
439 ! ! |
508 ! ! |
440 |
509 |
510 |
|
511 |
|
441 !ParseNode methodsFor:'printing & storing'! |
512 !ParseNode methodsFor:'printing & storing'! |
442 |
513 |
443 printOn:aStream |
514 printOn:aStream |
444 "append a user printed representation of the receiver to aStream. |
515 "append a user printed representation of the receiver to aStream. |
445 The format is suitable for a human - not meant to be read back." |
516 The format is suitable for a human - not meant to be read back." |
679 "for compatibility with RB-AST" |
750 "for compatibility with RB-AST" |
680 |
751 |
681 ^ self isConstant |
752 ^ self isConstant |
682 ! |
753 ! |
683 |
754 |
755 isLiteralArray |
|
756 "for compatibility with RB-AST" |
|
757 |
|
758 ^ false |
|
759 ! |
|
760 |
|
761 isLiteralCString |
|
762 "for compatibility with RB-AST" |
|
763 |
|
764 ^ false |
|
765 ! |
|
766 |
|
684 isLocalVariable |
767 isLocalVariable |
685 ^ false |
768 ^ false |
686 ! |
769 ! |
687 |
770 |
688 isMessage |
771 isMessage |
725 |
808 |
726 isReturnNode |
809 isReturnNode |
727 "return true, if this is a node for a return expression" |
810 "return true, if this is a node for a return expression" |
728 |
811 |
729 ^ false |
812 ^ false |
730 ! |
|
731 |
|
732 isSelector |
|
733 ^ false |
|
734 |
|
735 "Created: / 28-02-2019 / 10:25:05 / Stefan Vogel" |
|
736 ! |
813 ! |
737 |
814 |
738 isSelf |
815 isSelf |
739 "return true, if this is a self-node" |
816 "return true, if this is a self-node" |
740 |
817 |