0
|
1 |
"
|
4
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
53
|
3 |
All Rights Reserved
|
0
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Object subclass:#ParseNode
|
19
|
14 |
instanceVariableNames:'type comments parenthized'
|
0
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'System-Compiler-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
ParseNode comment:'
|
4
|
21 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
53
|
22 |
All Rights Reserved
|
33
|
23 |
|
103
|
24 |
$Header: /cvs/stx/stx/libcomp/ParseNode.st,v 1.11 1995-08-11 16:03:30 claus Exp $
|
20
|
25 |
'!
|
0
|
26 |
|
20
|
27 |
!ParseNode class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
53
|
32 |
All Rights Reserved
|
20
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
103
|
45 |
$Header: /cvs/stx/stx/libcomp/ParseNode.st,v 1.11 1995-08-11 16:03:30 claus Exp $
|
20
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
node for parse-trees; abstract class
|
|
52 |
"
|
|
53 |
! !
|
0
|
54 |
|
|
55 |
!ParseNode class methodsFor:'instance creation'!
|
|
56 |
|
|
57 |
type:t
|
|
58 |
^ (self basicNew) type:t
|
|
59 |
! !
|
|
60 |
|
|
61 |
!ParseNode methodsFor:'queries'!
|
|
62 |
|
|
63 |
isConstant
|
13
|
64 |
"return true, if this is a node for a constant"
|
|
65 |
|
|
66 |
^ false
|
|
67 |
!
|
|
68 |
|
53
|
69 |
isGlobal
|
|
70 |
"return true, if this is a node for a global variable"
|
|
71 |
|
|
72 |
^ false
|
|
73 |
!
|
|
74 |
|
19
|
75 |
isPrimary
|
|
76 |
"return true, if this is a node for a primary (i.e. non-send)"
|
|
77 |
|
|
78 |
^ false
|
|
79 |
!
|
|
80 |
|
13
|
81 |
isSuper
|
|
82 |
"return true, if this is a super-node"
|
|
83 |
|
|
84 |
^ false
|
|
85 |
!
|
|
86 |
|
|
87 |
isReturnNode
|
|
88 |
"return true, if this is a node for a return expression"
|
|
89 |
|
0
|
90 |
^ false
|
|
91 |
!
|
|
92 |
|
62
|
93 |
isBlockNode
|
|
94 |
"return true, if this is a node for a block"
|
|
95 |
|
|
96 |
^ false
|
|
97 |
!
|
|
98 |
|
19
|
99 |
isAssignment
|
|
100 |
"return true, if this is a node for an assignment"
|
|
101 |
|
|
102 |
^ false
|
|
103 |
!
|
|
104 |
|
0
|
105 |
isMessage
|
13
|
106 |
"return true, if this is a node for a message expression"
|
|
107 |
|
0
|
108 |
^ false
|
|
109 |
!
|
|
110 |
|
|
111 |
isBinaryMessage
|
13
|
112 |
"return true, if this is a node for a binary send"
|
|
113 |
|
0
|
114 |
^ false
|
|
115 |
!
|
|
116 |
|
|
117 |
isUnaryMessage
|
13
|
118 |
"return true, if this is a node for a unary send"
|
|
119 |
|
0
|
120 |
^ false
|
|
121 |
! !
|
|
122 |
|
|
123 |
!ParseNode methodsFor:'accessing'!
|
|
124 |
|
|
125 |
type
|
13
|
126 |
"return the nodes type"
|
|
127 |
|
0
|
128 |
^ type
|
|
129 |
!
|
|
130 |
|
|
131 |
lineNumber:dummy
|
13
|
132 |
"set linenumber - ignored here"
|
0
|
133 |
|
|
134 |
^ self
|
19
|
135 |
!
|
|
136 |
|
|
137 |
parenthized:aBoolean
|
|
138 |
parenthized := aBoolean
|
|
139 |
!
|
|
140 |
|
|
141 |
parenthized
|
|
142 |
^ parenthized
|
0
|
143 |
! !
|
|
144 |
|
|
145 |
!ParseNode methodsFor:'private'!
|
|
146 |
|
|
147 |
type:t
|
13
|
148 |
"set the nodes type"
|
|
149 |
|
0
|
150 |
type := t
|
|
151 |
! !
|
|
152 |
|
|
153 |
!ParseNode methodsFor:'printing'!
|
|
154 |
|
|
155 |
printString
|
|
156 |
|stream|
|
|
157 |
|
|
158 |
stream := WriteStream on:String new.
|
|
159 |
self printOn:stream indent:0.
|
|
160 |
^ stream contents
|
|
161 |
!
|
|
162 |
|
|
163 |
printOn:aStream
|
|
164 |
self printOn:aStream indent:0
|
|
165 |
! !
|
|
166 |
|
|
167 |
!ParseNode methodsFor:'checks'!
|
|
168 |
|
|
169 |
plausibilityCheck
|
|
170 |
^ nil
|
|
171 |
! !
|
|
172 |
|
|
173 |
!ParseNode methodsFor:'evaluation'!
|
|
174 |
|
|
175 |
evaluateForCascade
|
|
176 |
^ self evaluate
|
|
177 |
! !
|
|
178 |
|
|
179 |
!ParseNode methodsFor:'code generation'!
|
|
180 |
|
|
181 |
codeForSideEffectOn:aStream inBlock:b
|
|
182 |
"generate code for this statement - value not needed"
|
|
183 |
|
|
184 |
self codeOn:aStream inBlock:b.
|
|
185 |
aStream nextPut:#drop
|
|
186 |
! !
|