author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 12:53:39 +0000 | |
branch | jv |
changeset 12123 | 4bde08cebd48 |
parent 10632 | 9e4b40a83d6a |
child 12125 | 0c49a3b13e43 |
permissions | -rw-r--r-- |
10021 | 1 |
" |
10068 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
3 |
All Rights Reserved |
|
10021 | 4 |
|
10068 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
10021 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
Magnitude subclass:#SyntaxElement |
|
29 |
instanceVariableNames:'start stop type value next prev' |
|
30 |
classVariableNames:'' |
|
31 |
poolDictionaries:'' |
|
32 |
category:'Interface-CodeView-Syntax' |
|
33 |
! |
|
34 |
||
35 |
!SyntaxElement class methodsFor:'documentation'! |
|
36 |
||
37 |
copyright |
|
38 |
" |
|
10068 | 39 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
40 |
All Rights Reserved |
|
41 |
||
42 |
Permission is hereby granted, free of charge, to any person |
|
43 |
obtaining a copy of this software and associated documentation |
|
44 |
files (the 'Software'), to deal in the Software without |
|
45 |
restriction, including without limitation the rights to use, |
|
46 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
47 |
copies of the Software, and to permit persons to whom the |
|
48 |
Software is furnished to do so, subject to the following |
|
49 |
conditions: |
|
10021 | 50 |
|
10068 | 51 |
The above copyright notice and this permission notice shall be |
52 |
included in all copies or substantial portions of the Software. |
|
53 |
||
54 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
55 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
56 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
57 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
58 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
59 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
60 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
61 |
OTHER DEALINGS IN THE SOFTWARE. |
|
10021 | 62 |
" |
63 |
! ! |
|
64 |
||
65 |
!SyntaxElement class methodsFor:'instance creation'! |
|
66 |
||
67 |
from: start to: stop |
|
68 |
||
69 |
^self new |
|
70 |
start: start; |
|
71 |
stop: stop. |
|
72 |
||
73 |
"Created: / 14-02-2010 / 13:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! |
|
75 |
||
76 |
from: start to: stop type: type |
|
77 |
||
78 |
^self new |
|
79 |
start: start; |
|
80 |
stop: stop; |
|
81 |
type: type |
|
82 |
||
83 |
"Created: / 14-02-2010 / 14:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
84 |
! |
|
85 |
||
86 |
from: start to: stop type: type value: value |
|
87 |
||
88 |
^self new |
|
89 |
start: start; |
|
90 |
stop: stop; |
|
91 |
type: type; |
|
92 |
value: value |
|
93 |
||
94 |
"Created: / 14-02-2010 / 17:41:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
95 |
! ! |
|
96 |
||
97 |
!SyntaxElement methodsFor:'accessing'! |
|
98 |
||
99 |
next |
|
100 |
^ next |
|
101 |
! |
|
102 |
||
103 |
next:aSyntaxElement |
|
104 |
next := aSyntaxElement. |
|
105 |
next prev: self. |
|
106 |
||
107 |
"Modified: / 14-02-2010 / 17:44:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
108 |
! |
|
109 |
||
110 |
prev |
|
111 |
^ prev |
|
112 |
! |
|
113 |
||
114 |
prev:aSyntaxElement |
|
115 |
prev := aSyntaxElement. |
|
116 |
! |
|
117 |
||
118 |
start |
|
119 |
^ start |
|
120 |
! |
|
121 |
||
122 |
start:anInteger |
|
123 |
start := anInteger. |
|
124 |
! |
|
125 |
||
126 |
stop |
|
127 |
^ stop |
|
128 |
! |
|
129 |
||
130 |
stop:anInteger |
|
131 |
stop := anInteger. |
|
132 |
! |
|
133 |
||
134 |
type |
|
135 |
^ type |
|
136 |
! |
|
137 |
||
138 |
type:aSymbol |
|
139 |
type := aSymbol. |
|
140 |
! |
|
141 |
||
142 |
value |
|
143 |
^ value |
|
144 |
! |
|
145 |
||
146 |
value:anObject |
|
147 |
value := anObject. |
|
148 |
! ! |
|
149 |
||
150 |
!SyntaxElement methodsFor:'comparing'! |
|
151 |
||
152 |
< anObject |
|
153 |
||
154 |
anObject isNumber ifTrue:[^stop < anObject]. |
|
155 |
anObject class == self class ifFalse:[^false]. |
|
156 |
||
157 |
^stop < anObject start |
|
158 |
||
159 |
"Created: / 14-02-2010 / 13:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
160 |
! |
|
161 |
||
162 |
= anObject |
|
163 |
||
164 |
anObject class == self class ifFalse:[^false]. |
|
165 |
||
166 |
^start == (anObject start) and: |
|
167 |
[stop == (anObject stop) and: |
|
168 |
[type == (anObject type)]]. |
|
169 |
||
170 |
"Created: / 14-02-2010 / 13:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
171 |
! |
|
172 |
||
173 |
hash |
|
174 |
||
175 |
^start hash bitXor:[stop hash bitXor:[type hash]]. |
|
176 |
||
177 |
"Created: / 14-02-2010 / 13:30:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
178 |
! ! |
|
179 |
||
180 |
!SyntaxElement methodsFor:'double dispatching'! |
|
181 |
||
182 |
lessFromInteger:anInteger |
|
183 |
||
184 |
^stop < anInteger |
|
185 |
||
186 |
"Created: / 14-02-2010 / 13:49:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
187 |
! ! |
|
188 |
||
189 |
!SyntaxElement methodsFor:'printing & storing'! |
|
190 |
||
191 |
printOn:aStream |
|
192 |
"append a printed representation if the receiver to the argument, aStream" |
|
193 |
||
194 |
super printOn:aStream. |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10632
diff
changeset
|
195 |
aStream nextPut:$(. |
10021 | 196 |
type printOn: aStream. |
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10632
diff
changeset
|
197 |
aStream nextPut:$:. |
10021 | 198 |
value printOn:aStream. |
199 |
aStream nextPut:$). |
|
200 |
||
201 |
"Modified: / 25-06-2010 / 13:20:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
202 |
! ! |
|
203 |
||
204 |
!SyntaxElement class methodsFor:'documentation'! |
|
205 |
||
206 |
version_CVS |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10632
diff
changeset
|
207 |
^ '§Header: /cvs/stx/stx/libtool/SyntaxElement.st,v 1.2 2011/07/03 17:48:11 cg Exp §' |
10021 | 208 |
! |
209 |
||
210 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10632
diff
changeset
|
211 |
^ '$Id: SyntaxElement.st 7582 2010-06-25 13:26:33Z vranyj1 $' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10632
diff
changeset
|
212 |
! ! |