author | Claus Gittinger <cg@exept.de> |
Wed, 29 Oct 2003 11:45:21 +0100 | |
changeset 1472 | d69fc5970cd7 |
parent 1462 | bf3d40b72bf3 |
child 1598 | cf7e99bd8ce3 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
135
aa4f7b8f121e
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
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 |
||
1147 | 13 |
"{ Package: 'stx:libcomp' }" |
14 |
||
0 | 15 |
Object subclass:#Variable |
1312 | 16 |
instanceVariableNames:'value name used type domain' |
261 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'System-Compiler-Support' |
|
0 | 20 |
! |
21 |
||
20 | 22 |
!Variable class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
135
aa4f7b8f121e
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
27 |
All Rights Reserved |
20 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
node for parse-trees, representing variables |
|
261 | 41 |
This is a helper class for the compiler. |
263 | 42 |
|
43 |
[author:] |
|
44 |
Claus Gittinger |
|
20 | 45 |
" |
46 |
! ! |
|
0 | 47 |
|
48 |
!Variable class methodsFor:'instance creation'! |
|
49 |
||
50 |
name:name |
|
11 | 51 |
"return a new node for a variable named name" |
0 | 52 |
^ (self new) name:name |
1382 | 53 |
! |
54 |
||
55 |
type:type name:name |
|
56 |
^ (self new) type:type name:name |
|
0 | 57 |
! ! |
58 |
||
59 |
!Variable methodsFor:'accessing'! |
|
60 |
||
140 | 61 |
name |
62 |
"return the name of the variable" |
|
11 | 63 |
|
140 | 64 |
^ name |
0 | 65 |
! |
66 |
||
67 |
name:aString |
|
11 | 68 |
"set the name of the variable" |
69 |
||
0 | 70 |
name := aString |
71 |
! |
|
72 |
||
1382 | 73 |
type:typeSymbol name:aString |
74 |
type := typeSymbol. |
|
75 |
name := aString |
|
76 |
! |
|
77 |
||
140 | 78 |
used |
79 |
"return the flag marking that this variable has been used" |
|
11 | 80 |
|
140 | 81 |
^ used |
82 |
! |
|
83 |
||
84 |
used:aBoolean |
|
85 |
"set/clear the flag marking that this variable has been used" |
|
86 |
||
87 |
used := aBoolean |
|
0 | 88 |
! |
89 |
||
90 |
value |
|
11 | 91 |
"return the value of the variable" |
92 |
||
0 | 93 |
^ value |
94 |
! |
|
95 |
||
140 | 96 |
value:v |
97 |
"set the value of the (simulated) variable" |
|
98 |
||
99 |
value := v |
|
100 |
! |
|
101 |
||
31 | 102 |
variableValue |
103 |
"return the value of the variable" |
|
104 |
||
105 |
^ value |
|
140 | 106 |
! ! |
11 | 107 |
|
1035 | 108 |
!Variable methodsFor:'enumerating'! |
542 | 109 |
|
110 |
nodeDo:anEnumerator |
|
111 |
"helper for parse tree walking" |
|
112 |
||
113 |
^ anEnumerator doVariable:self name:name |
|
114 |
||
115 |
"Created: 19.6.1997 / 17:11:48 / cg" |
|
116 |
! ! |
|
117 |
||
1312 | 118 |
!Variable methodsFor:'special'! |
119 |
||
120 |
domain |
|
121 |
^ domain |
|
122 |
! |
|
123 |
||
124 |
domain:aDomain |
|
125 |
type := #FDVariable. |
|
126 |
domain := aDomain. |
|
127 |
! |
|
128 |
||
129 |
expressionForSetup |
|
130 |
|newDom| |
|
131 |
||
132 |
type isNil ifTrue:[^ nil]. |
|
133 |
type == #FDVariable ifTrue:[ |
|
134 |
"/ finite domain setup |
|
135 |
"/ var := FDVariable new domain:<domain-setup-message>. |
|
136 |
"/ var name:<name> |
|
137 |
||
138 |
newDom := domain instanceCreationMessage. |
|
139 |
||
140 |
^ MessageNode |
|
141 |
receiver:(VariableNode globalNamed:#FDVariable) |
|
142 |
selector:#'domain:name:' |
|
143 |
arg1:newDom |
|
144 |
arg2:(ConstantNode value:name). |
|
145 |
]. |
|
1462 | 146 |
self shouldImplement. |
1312 | 147 |
! |
148 |
||
149 |
type |
|
150 |
^ type |
|
151 |
! ! |
|
152 |
||
148 | 153 |
!Variable class methodsFor:'documentation'! |
154 |
||
155 |
version |
|
1462 | 156 |
^ '$Header: /cvs/stx/stx/libcomp/Variable.st,v 1.19 2003-10-07 13:38:23 stefan Exp $' |
148 | 157 |
! ! |