author | Jan Vrany <jan.vrany@labware.com> |
Thu, 27 Oct 2022 14:53:59 +0100 | |
branch | jv |
changeset 4735 | 3b11fb3ede98 |
parent 4730 | 2e7755434a0f |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
4730
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
3 |
COPYRIGHT (c) 2021 Patrik Svestka |
104 | 4 |
All Rights Reserved |
0 | 5 |
|
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
1080 | 13 |
"{ Package: 'stx:libcomp' }" |
14 |
||
3623 | 15 |
"{ NameSpace: Smalltalk }" |
16 |
||
0 | 17 |
ParseNode subclass:#PrimaryNode |
2504 | 18 |
instanceVariableNames:'value line charIndex' |
261 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'System-Compiler-Support' |
|
0 | 22 |
! |
23 |
||
20 | 24 |
!PrimaryNode class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
4730
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
29 |
COPYRIGHT (c) 2021 Patrik Svestka |
104 | 30 |
All Rights Reserved |
20 | 31 |
|
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
node for parse-trees, representing primaries (variables & literals) |
|
261 | 44 |
This is a helper class for the compiler. |
263 | 45 |
|
46 |
[author:] |
|
47 |
Claus Gittinger |
|
20 | 48 |
" |
49 |
! ! |
|
0 | 50 |
|
51 |
!PrimaryNode methodsFor:'accessing'! |
|
52 |
||
2504 | 53 |
charIndex |
4474 | 54 |
<resource: #obsolete> |
2504 | 55 |
^ charIndex |
56 |
! |
|
57 |
||
58 |
charIndex:something |
|
4474 | 59 |
<resource: #obsolete> |
2504 | 60 |
charIndex := something. |
61 |
! |
|
62 |
||
63 |
line |
|
64 |
^ line |
|
65 |
! |
|
66 |
||
67 |
line:something |
|
68 |
line := something. |
|
69 |
! |
|
70 |
||
4730
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
71 |
lineNumber |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
72 |
|
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
73 |
"Compatibility" |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
74 |
|
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
75 |
^ self line |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
76 |
|
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
77 |
"Created: / 24-11-2021 / 10:02:30 / Patrik Svestka <patrik.svestka@gmail.com>" |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
78 |
! |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
79 |
|
1786 | 80 |
type:t value:val |
81 |
type := t. |
|
82 |
value := val |
|
83 |
! |
|
84 |
||
0 | 85 |
value |
86 |
^ value |
|
1786 | 87 |
! |
88 |
||
89 |
value:val |
|
90 |
value := val |
|
0 | 91 |
! ! |
92 |
||
93 |
!PrimaryNode methodsFor:'code generation'! |
|
94 |
||
104 | 95 |
codeStoreOn:aStream inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler |
19 | 96 |
^ self subclassResponsibility |
0 | 97 |
! ! |
98 |
||
4236 | 99 |
!PrimaryNode methodsFor:'enumeration'! |
100 |
||
101 |
allSubNodesDo:aBlock |
|
102 |
"no subnodes" |
|
103 |
||
104 |
^ self |
|
105 |
! ! |
|
3623 | 106 |
|
1035 | 107 |
!PrimaryNode methodsFor:'evaluation'! |
140 | 108 |
|
109 |
store:aValue |
|
110 |
^ self subclassResponsibility |
|
111 |
! ! |
|
112 |
||
1080 | 113 |
!PrimaryNode methodsFor:'printing & storing'! |
0 | 114 |
|
115 |
printOn:aStream indent:i |
|
19 | 116 |
^ self subclassResponsibility |
0 | 117 |
! ! |
140 | 118 |
|
119 |
!PrimaryNode methodsFor:'queries'! |
|
120 |
||
2317 | 121 |
precedence |
122 |
^ 200 |
|
123 |
||
124 |
"Created: / 20-04-2005 / 14:12:04 / cg" |
|
125 |
! ! |
|
126 |
||
127 |
!PrimaryNode methodsFor:'testing'! |
|
128 |
||
1586 | 129 |
isArgument |
130 |
^ false |
|
131 |
! |
|
132 |
||
3623 | 133 |
isBlockArg |
134 |
"return false here; to be redefined in subclass(es)" |
|
135 |
||
136 |
^ false |
|
137 |
! |
|
138 |
||
139 |
isBlockVariable |
|
140 |
"return false here; to be redefined in subclass(es)" |
|
141 |
||
142 |
^ false |
|
143 |
! |
|
144 |
||
1586 | 145 |
isClassVariable |
146 |
^ false |
|
147 |
! |
|
148 |
||
149 |
isInstanceVariable |
|
150 |
^ false |
|
151 |
! |
|
152 |
||
3852 | 153 |
isInstanceVariableNamed:name |
154 |
^ false |
|
155 |
! |
|
156 |
||
1586 | 157 |
isLocal |
158 |
^ false |
|
159 |
! |
|
160 |
||
161 |
isMethodArg |
|
162 |
^ false |
|
163 |
! |
|
164 |
||
3623 | 165 |
isPoolVariable |
166 |
"return false here; to be redefined in subclass(es)" |
|
167 |
||
168 |
^ false |
|
169 |
! |
|
170 |
||
140 | 171 |
isPrimary |
172 |
"return true, if this is a node for a primary (i.e. non-send)" |
|
173 |
||
174 |
^ true |
|
1586 | 175 |
! |
176 |
||
177 |
isUndeclared |
|
178 |
^ false |
|
140 | 179 |
! ! |
180 |
||
148 | 181 |
!PrimaryNode class methodsFor:'documentation'! |
182 |
||
2504 | 183 |
version_CVS |
3852 | 184 |
^ '$Header$' |
2317 | 185 |
! |
186 |
||
4730
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
187 |
version_HG |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
188 |
|
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
189 |
^ '$Changeset: <not expanded> $' |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
190 |
! |
2e7755434a0f
Adding #lineNumber accessor for compatibility reasons.
Patrik Svestka <patrik.svestka@gmail.com>
parents:
4723
diff
changeset
|
191 |
|
2504 | 192 |
version_SVN |
3623 | 193 |
^ '$ Id $' |
148 | 194 |
! ! |
3623 | 195 |