author | Claus Gittinger <cg@exept.de> |
Tue, 08 Aug 2006 23:38:47 +0200 | |
changeset 1802 | e0b32dc71dac |
parent 1757 | c1edf49e8f9f |
child 1857 | 4d7e1edb44cd |
permissions | -rw-r--r-- |
662 | 1 |
" |
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
||
14 |
||
1110 | 15 |
"{ Package: 'stx:libcomp' }" |
16 |
||
662 | 17 |
Parser subclass:#SyntaxHighlighter |
1526 | 18 |
instanceVariableNames:'sourceText preferences currentSuperclasses currentSubclasses |
1802 | 19 |
fullSelectorCheck cachedLocalIdentifierEmphasis |
20 |
cachedLocalIdentifierColor cachedStringEmphasis cachedStringColor' |
|
662 | 21 |
classVariableNames:'' |
22 |
poolDictionaries:'' |
|
23 |
category:'System-Compiler' |
|
24 |
! |
|
25 |
||
26 |
!SyntaxHighlighter class methodsFor:'documentation'! |
|
27 |
||
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
31 |
All Rights Reserved |
|
32 |
||
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
||
41 |
||
681 | 42 |
! |
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
colors a method. |
|
47 |
" |
|
48 |
||
49 |
||
662 | 50 |
! ! |
51 |
||
52 |
!SyntaxHighlighter class methodsFor:'highlighting'! |
|
53 |
||
1527 | 54 |
formatClassDefinition:aString in:aClass |
55 |
"format (recolor) a class definition expression in a given class. |
|
56 |
Return the text containing font changes and color information." |
|
57 |
||
58 |
^ self formatExpression:aString in:aClass |
|
59 |
! |
|
60 |
||
684
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
61 |
formatExpression:aString in:aClass |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
62 |
"format (recolor) an expression in a given class. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
63 |
Return the text containing font changes and color information." |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
64 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
65 |
|parser tree text endPos| |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
66 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
67 |
aString isNil ifTrue:[^ nil]. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
68 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
69 |
parser := self for:(ReadStream on:aString string) in:aClass. |
1365 | 70 |
parser ignoreErrors:true. |
71 |
parser ignoreWarnings:true. |
|
684
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
72 |
parser sourceText:(text := aString string asText). |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
73 |
"/ use an array here - this can be changed much faster using #at:put: |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
74 |
text emphasisCollection:(Array new:aString size). |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
75 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
76 |
parser nextToken. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
77 |
tree := parser expression. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
78 |
"/ now, convert the emphasis-array to a runArray |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
79 |
text emphasisCollection:(text emphasis asRunArray). |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
80 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
81 |
tree == #Error ifTrue:[ |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
82 |
"/ mhmh - which is better ... |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
83 |
"/ alternative1: color rest after error in red |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
84 |
"/ text |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
85 |
"/ emphasizeFrom:(parser sourceStream position) |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
86 |
"/ to:text size |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
87 |
"/ with:(#color->Color red). |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
88 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
89 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
90 |
"/ alternative2: take original emphasis for rest |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
91 |
|
1371
de4c37ac12fc
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
1365
diff
changeset
|
92 |
endPos := parser sourceStream position1Based. |
684
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
93 |
endPos >= text size ifTrue:[ |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
94 |
^ text |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
95 |
]. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
96 |
^ (text copyTo:endPos) , (aString copyFrom:(endPos+1)) |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
97 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
98 |
"/ alternative3: no emphasis for rest. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
99 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
100 |
"/ ^ text "/ aString |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
101 |
]. |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
102 |
^ text |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
103 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
104 |
" |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
105 |
self |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
106 |
formatExpression:'(1 + 2) max:5' |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
107 |
in:UndefinedObject |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
108 |
" |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
109 |
|
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
110 |
"Modified: / 7.4.1998 / 09:57:19 / cg" |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
111 |
"Created: / 9.4.1998 / 16:57:16 / cg" |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
112 |
! |
dd691ac07f90
added entry to color an expression
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
113 |
|
662 | 114 |
formatMethod:aString in:aClass |
680
ebc432c71aec
much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
115 |
"format (recolor) a method in a given class. |
ebc432c71aec
much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
116 |
Return the text containing font changes and color information." |
662 | 117 |
|
1550 | 118 |
^ self formatMethod:aString in:aClass using:nil |
119 |
||
120 |
" |
|
121 |
self |
|
122 |
formatMethod:'foo |
|
123 |
^ self bar:''hello''. |
|
124 |
||
125 |
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , ' |
|
126 |
' |
|
127 |
in:UndefinedObject |
|
128 |
" |
|
129 |
||
130 |
"Modified: / 23.10.1998 / 22:48:45 / cg" |
|
131 |
! |
|
132 |
||
133 |
formatMethod:aString in:aClass using:preferencesOrNil |
|
134 |
"format (recolor) a method in a given class. |
|
135 |
Return the text containing font changes and color information." |
|
136 |
||
137 |
|highlighter tree text endPos eColor| |
|
662 | 138 |
|
139 |
aString isNil ifTrue:[^ nil]. |
|
140 |
||
1110 | 141 |
Error handle:[:ex | |
1396 | 142 |
('SyntaxHighlighter [info]: error during highlight: ' , ex description) infoPrintCR. |
1170 | 143 |
"/ ex suspendedContext fullPrintAll. |
689 | 144 |
^ aString |
145 |
] do:[ |
|
1550 | 146 |
highlighter := self for:(ReadStream on:aString string) in:aClass. |
147 |
preferencesOrNil notNil ifTrue:[highlighter preferences:preferencesOrNil]. |
|
148 |
highlighter ignoreErrors:true. |
|
149 |
highlighter ignoreWarnings:true. |
|
150 |
highlighter sourceText:(text := aString string asText). |
|
689 | 151 |
"/ use an array here - this can be changed much faster using #at:put: |
152 |
text emphasisCollection:(Array new:aString size). |
|
662 | 153 |
|
1550 | 154 |
tree := highlighter parseMethod. |
689 | 155 |
"/ now, convert the emphasis-array to a runArray |
156 |
text emphasisCollection:(text emphasis asRunArray). |
|
680
ebc432c71aec
much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
157 |
|
689 | 158 |
tree == #Error ifTrue:[ |
889 | 159 |
eColor := UserPreferences current errorColor. |
160 |
eColor notNil ifTrue:[ |
|
161 |
"/ mhmh - which is better ... |
|
162 |
"/ alternative1: color rest after error in red |
|
163 |
text |
|
1550 | 164 |
emphasizeFrom:(highlighter sourceStream position1Based) |
889 | 165 |
to:text size |
166 |
with:(#color->eColor). |
|
167 |
] ifFalse:[ |
|
168 |
"/ alternative2: take original emphasis for rest |
|
680
ebc432c71aec
much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
169 |
|
1550 | 170 |
endPos := highlighter sourceStream position1Based. |
889 | 171 |
endPos >= text size ifTrue:[ |
172 |
^ text |
|
173 |
]. |
|
174 |
^ (text copyTo:endPos) , (aString copyFrom:(endPos+1)) |
|
689 | 175 |
]. |
176 |
"/ alternative3: no emphasis for rest. |
|
678 | 177 |
]. |
689 | 178 |
^ text |
179 |
] |
|
662 | 180 |
" |
181 |
self |
|
182 |
formatMethod:'foo |
|
183 |
^ self bar:''hello''. |
|
184 |
||
185 |
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , ' |
|
186 |
' |
|
187 |
in:UndefinedObject |
|
188 |
" |
|
189 |
||
794
459868dcb591
highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
190 |
"Modified: / 23.10.1998 / 22:48:45 / cg" |
662 | 191 |
! ! |
192 |
||
193 |
!SyntaxHighlighter methodsFor:'accessing'! |
|
194 |
||
1550 | 195 |
preferences:something |
196 |
preferences := something. |
|
197 |
! |
|
198 |
||
662 | 199 |
sourceText |
200 |
"return the value of the instance variable 'sourceText' (automatically generated)" |
|
201 |
||
202 |
^ sourceText |
|
203 |
||
204 |
"Created: / 31.3.1998 / 11:49:05 / cg" |
|
205 |
! |
|
206 |
||
207 |
sourceText:something |
|
208 |
"set the value of the instance variable 'sourceText' (automatically generated)" |
|
209 |
||
210 |
sourceText := something. |
|
211 |
||
212 |
"Created: / 31.3.1998 / 11:49:05 / cg" |
|
213 |
! ! |
|
214 |
||
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
215 |
!SyntaxHighlighter methodsFor:'error handling'! |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
216 |
|
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
217 |
parseError:aMessage position:position to:endPos |
1174
30ff886ef43e
remove error output on Transcript
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
218 |
"/ Transcript showCR:aMessage. |
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
219 |
super parseError:aMessage position:position to:endPos. |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
220 |
|
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
221 |
self |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
222 |
markFrom:position to:endPos |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
223 |
withEmphasis:nil color:UserPreferences current errorColor |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
224 |
! |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
225 |
|
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
226 |
showErrorMessage:aMessage position:pos |
1174
30ff886ef43e
remove error output on Transcript
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
227 |
"/ Transcript showCR:aMessage. |
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
228 |
super showErrorMessage:aMessage position:pos. |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
229 |
|
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
230 |
self |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
231 |
markFrom:pos to:nil |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
232 |
withEmphasis:nil color:UserPreferences current errorColor |
978 | 233 |
! |
234 |
||
1169
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
235 |
syntaxError:aMessage position:position to:endPos |
1174
30ff886ef43e
remove error output on Transcript
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
236 |
"/ Transcript showCR:aMessage. |
1169
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
237 |
super syntaxError:aMessage position:position to:endPos. |
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
238 |
|
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
239 |
self |
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
240 |
markFrom:position to:endPos |
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
241 |
withEmphasis:nil color:UserPreferences current errorColor |
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
242 |
! |
7204e72c7c3c
better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents:
1159
diff
changeset
|
243 |
|
978 | 244 |
warning:msg position:pos1 to:pos2 |
979 | 245 |
"/ self markUnknownIdentifierFrom:pos1 to:pos2 |
246 |
||
978 | 247 |
"/ self |
248 |
"/ markFrom:pos1 to:pos2 |
|
249 |
"/ withEmphasis:nil color:UserPreferences current errorColor |
|
250 |
||
979 | 251 |
"Modified: / 25.9.1999 / 18:42:30 / cg" |
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
252 |
! ! |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
253 |
|
662 | 254 |
!SyntaxHighlighter methodsFor:'initialization'! |
255 |
||
256 |
initialize |
|
257 |
super initialize. |
|
258 |
||
990
cd1aa00086fd
dont care to fold constants during syntaxHighlight
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
259 |
foldConstants := false. |
1636
98afdcdacde8
compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents:
1553
diff
changeset
|
260 |
"/ parserFlags allowDollarInIdentifier:true. |
990
cd1aa00086fd
dont care to fold constants during syntaxHighlight
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
261 |
|
1526 | 262 |
preferences := UserPreferences current. |
868 | 263 |
|
1526 | 264 |
fullSelectorCheck := preferences fullSelectorCheck. |
662 | 265 |
|
266 |
"Created: / 31.3.1998 / 15:12:55 / cg" |
|
838 | 267 |
"Modified: / 5.1.1980 / 00:44:03 / cg" |
662 | 268 |
! ! |
269 |
||
788
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
270 |
!SyntaxHighlighter methodsFor:'misc'! |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
271 |
|
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
272 |
defineAsUndeclaredVariable:aName |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
273 |
"redefined to NOT declare undefined vars" |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
274 |
|
1308 | 275 |
^ VariableNode globalNamed:aName |
788
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
276 |
|
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
277 |
"Modified: / 19.10.1998 / 19:38:12 / cg" |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
278 |
! |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
279 |
|
884 | 280 |
isSyntaxHighlighter |
281 |
^ true |
|
282 |
||
283 |
! |
|
284 |
||
788
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
285 |
plausibilityCheck:aNode |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
286 |
"redefined to NOT do checks" |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
287 |
|
902 | 288 |
^ nil |
788
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
289 |
|
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
290 |
"Modified: / 19.10.1998 / 19:38:12 / cg" |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
291 |
"Created: / 19.10.1998 / 19:57:18 / cg" |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
292 |
! ! |
5307f69829c6
do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents:
689
diff
changeset
|
293 |
|
662 | 294 |
!SyntaxHighlighter methodsFor:'syntax detection'! |
295 |
||
296 |
markArgumentIdentifierFrom:pos1 to:pos2 |
|
297 |
self |
|
298 |
markFrom:pos1 to:pos2 |
|
1553 | 299 |
withEmphasis:(preferences argumentIdentifierEmphasis) |
300 |
color:(preferences argumentIdentifierColor) |
|
662 | 301 |
|
302 |
"Modified: / 31.3.1998 / 18:01:27 / cg" |
|
303 |
! |
|
304 |
||
884 | 305 |
markBadIdentifierFrom:pos1 to:pos2 |
306 |
self |
|
307 |
markFrom:pos1 to:pos2 |
|
1553 | 308 |
withEmphasis:(preferences badIdentifierEmphasis) |
309 |
color:(preferences badIdentifierColor) |
|
884 | 310 |
! |
311 |
||
662 | 312 |
markBooleanConstantFrom:pos1 to:pos2 |
313 |
self |
|
314 |
markFrom:pos1 to:pos2 |
|
1553 | 315 |
withEmphasis:(preferences booleanConstantEmphasis) |
316 |
color:(preferences booleanConstantColor) |
|
662 | 317 |
|
318 |
"Created: / 31.3.1998 / 18:09:01 / cg" |
|
665 | 319 |
"Modified: / 31.3.1998 / 19:36:44 / cg" |
662 | 320 |
! |
321 |
||
673 | 322 |
markBracketAt:pos |
323 |
self |
|
324 |
markFrom:pos to:pos |
|
1553 | 325 |
withEmphasis:(preferences bracketEmphasis) |
326 |
color:(preferences bracketColor) |
|
673 | 327 |
|
328 |
"Created: / 31.3.1998 / 18:09:01 / cg" |
|
329 |
"Modified: / 31.3.1998 / 19:36:44 / cg" |
|
330 |
! |
|
331 |
||
870 | 332 |
markClassVariableIdentifierFrom:pos1 to:pos2 |
333 |
self |
|
334 |
markFrom:pos1 to:pos2 |
|
1553 | 335 |
withEmphasis:(preferences classVariableIdentifierEmphasis) |
336 |
color:(preferences classVariableIdentifierColor) |
|
870 | 337 |
|
338 |
"Modified: / 31.3.1998 / 18:02:14 / cg" |
|
339 |
! |
|
340 |
||
662 | 341 |
markCommentFrom:pos1 to:pos2 |
342 |
self |
|
343 |
markFrom:pos1 to:pos2 |
|
1553 | 344 |
withEmphasis:(preferences commentEmphasis) |
345 |
color:(preferences commentColor) |
|
662 | 346 |
|
1550 | 347 |
" |
348 |
UserPreferences current commentEmphasis |
|
349 |
" |
|
350 |
"Modified: / 31.3.1998 / 18:01:55 / cg" |
|
662 | 351 |
! |
352 |
||
353 |
markConstantFrom:pos1 to:pos2 |
|
354 |
self |
|
355 |
markFrom:pos1 to:pos2 |
|
1553 | 356 |
withEmphasis:(preferences constantEmphasis) |
357 |
color:(preferences constantColor) |
|
662 | 358 |
|
359 |
"Modified: / 31.3.1998 / 18:01:44 / cg" |
|
360 |
"Created: / 31.3.1998 / 18:09:22 / cg" |
|
361 |
! |
|
362 |
||
987
49a05e400448
aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
363 |
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn |
49a05e400448
aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
364 |
|e p2 clr| |
49a05e400448
aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
365 |
|
49a05e400448
aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
366 |
clr := clrIn onDevice:Screen current. |
662 | 367 |
|
669 | 368 |
clr = Color black ifTrue:[ |
369 |
e := fontEmp |
|
370 |
] ifFalse:[ |
|
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
371 |
fontEmp isNil ifTrue:[ |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
372 |
e := (#color->clr) |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
373 |
] ifFalse:[ |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
374 |
e := Text addEmphasis:fontEmp to:(#color->clr). |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
375 |
] |
669 | 376 |
]. |
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
377 |
(p2 := pos2) isNil ifTrue:[ |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
378 |
p2 := sourceText size |
1143 | 379 |
] ifFalse:[ |
380 |
p2 := p2 min:sourceText size |
|
948
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
381 |
]. |
6ba29fe774f2
show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents:
902
diff
changeset
|
382 |
sourceText emphasizeFrom:pos1 to:p2 with:e |
662 | 383 |
|
384 |
"Created: / 31.3.1998 / 13:26:53 / cg" |
|
669 | 385 |
"Modified: / 1.4.1998 / 12:51:56 / cg" |
662 | 386 |
! |
387 |
||
822
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
388 |
markGlobalClassIdentifierFrom:pos1 to:pos2 |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
389 |
self |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
390 |
markFrom:pos1 to:pos2 |
1553 | 391 |
withEmphasis:(preferences globalClassIdentifierEmphasis) |
392 |
color:(preferences globalClassIdentifierColor) |
|
822
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
393 |
|
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
394 |
"Modified: / 31.3.1998 / 18:02:14 / cg" |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
395 |
"Created: / 4.3.1999 / 12:53:02 / cg" |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
396 |
! |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
397 |
|
662 | 398 |
markGlobalIdentifierFrom:pos1 to:pos2 |
399 |
self |
|
400 |
markFrom:pos1 to:pos2 |
|
1553 | 401 |
withEmphasis:(preferences globalIdentifierEmphasis) |
402 |
color:(preferences globalIdentifierColor) |
|
662 | 403 |
|
404 |
"Modified: / 31.3.1998 / 18:02:14 / cg" |
|
405 |
! |
|
406 |
||
407 |
markHereFrom:pos1 to:pos2 |
|
408 |
self |
|
409 |
markFrom:pos1 to:pos2 |
|
1553 | 410 |
withEmphasis:(preferences hereEmphasis) |
411 |
color:(preferences hereColor) |
|
662 | 412 |
|
413 |
"Modified: / 31.3.1998 / 18:02:25 / cg" |
|
414 |
! |
|
415 |
||
416 |
markIdentifierFrom:pos1 to:pos2 |
|
417 |
self |
|
418 |
markFrom:pos1 to:pos2 |
|
1553 | 419 |
withEmphasis:(preferences identifierEmphasis) |
420 |
color:(preferences identifierColor) |
|
662 | 421 |
|
422 |
"Modified: / 31.3.1998 / 18:02:39 / cg" |
|
423 |
"Created: / 31.3.1998 / 18:04:56 / cg" |
|
424 |
! |
|
425 |
||
686 | 426 |
markInstVarIdentifierFrom:pos1 to:pos2 |
427 |
self |
|
428 |
markFrom:pos1 to:pos2 |
|
1553 | 429 |
withEmphasis:(preferences instVarIdentifierEmphasis) |
430 |
color:(preferences instVarIdentifierColor) |
|
686 | 431 |
|
432 |
"Created: / 16.4.1998 / 18:35:40 / cg" |
|
433 |
"Modified: / 16.4.1998 / 18:37:30 / cg" |
|
434 |
! |
|
435 |
||
662 | 436 |
markLocalIdentifierFrom:pos1 to:pos2 |
1802 | 437 |
cachedLocalIdentifierEmphasis isNil ifTrue:[ |
438 |
cachedLocalIdentifierEmphasis := preferences localIdentifierEmphasis. |
|
439 |
cachedLocalIdentifierColor := preferences localIdentifierColor. |
|
440 |
]. |
|
662 | 441 |
self |
442 |
markFrom:pos1 to:pos2 |
|
1802 | 443 |
withEmphasis:cachedLocalIdentifierEmphasis |
444 |
color:cachedLocalIdentifierColor |
|
662 | 445 |
|
446 |
"Modified: / 31.3.1998 / 18:02:39 / cg" |
|
447 |
! |
|
448 |
||
449 |
markMethodSelectorFrom:pos1 to:pos2 |
|
450 |
self |
|
451 |
markFrom:pos1 to:pos2 |
|
1553 | 452 |
withEmphasis:(preferences methodSelectorEmphasis) |
453 |
color:(preferences methodSelectorColor) |
|
662 | 454 |
|
455 |
"Modified: / 31.3.1998 / 18:02:52 / cg" |
|
456 |
! |
|
457 |
||
1684 | 458 |
markNumberConstantFrom:pos1 to:pos2 |
459 |
self |
|
460 |
markFrom:pos1 to:pos2 |
|
461 |
withEmphasis:(preferences numberConstantEmphasis) |
|
462 |
color:(preferences numberConstantColor) |
|
463 |
||
464 |
"Modified: / 31.3.1998 / 18:01:44 / cg" |
|
465 |
"Created: / 31.3.1998 / 18:09:22 / cg" |
|
466 |
! |
|
467 |
||
1640
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
468 |
markParenthesisAt:pos |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
469 |
|colors clr em| |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
470 |
|
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
471 |
preferences emphasizeParenthesisLevel ifFalse:[^ self]. |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
472 |
|
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
473 |
colors := Array |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
474 |
with:(Color black) |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
475 |
with:(Color blue) |
1757 | 476 |
with:(Color green blendWith:(Color grey:30)) |
477 |
with:(Color red blendWith:(Color grey:30)) |
|
1640
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
478 |
with:(Color yellow darkened). |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
479 |
|
1757 | 480 |
clr := colors at:((parenthesisLevel-1) \\ colors size + 1). |
1640
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
481 |
em := #normal. |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
482 |
parenthesisLevel > 1 ifTrue:[ |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
483 |
em := #bold. |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
484 |
]. |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
485 |
self |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
486 |
markFrom:pos to:pos |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
487 |
withEmphasis:em |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
488 |
color:clr |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
489 |
! |
261459ccc704
emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
490 |
|
1553 | 491 |
markPoolVariableIdentifierFrom:pos1 to:pos2 |
492 |
self |
|
493 |
markFrom:pos1 to:pos2 |
|
494 |
withEmphasis:(preferences poolVariableIdentifierEmphasis) |
|
495 |
color:(preferences poolVariableIdentifierColor) |
|
496 |
! |
|
497 |
||
838 | 498 |
markReturnAt:pos |
499 |
self |
|
500 |
markFrom:pos to:pos |
|
1553 | 501 |
withEmphasis:(preferences returnEmphasis) |
502 |
color:(preferences returnColor) |
|
838 | 503 |
|
504 |
"Modified: / 31.3.1998 / 19:36:44 / cg" |
|
505 |
"Created: / 5.1.1980 / 00:44:27 / cg" |
|
506 |
! |
|
507 |
||
863 | 508 |
markSelector:selectorString from:pos1 to:pos2 receiverNode:aReceiverNode |
1498
9b4366551a2a
speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents:
1396
diff
changeset
|
509 |
|fg selectorSymbol check ok rec em| |
863 | 510 |
|
511 |
"/ uncommenting the code below |
|
512 |
"/ will suppress highlighting of common selectors ... |
|
513 |
"/ |
|
514 |
"/ (#( |
|
515 |
"/ 'ifTrue:' |
|
516 |
"/ 'ifFalse:' |
|
517 |
"/ 'not' |
|
518 |
"/ 'and:' |
|
519 |
"/ 'or:' |
|
520 |
"/ '=' |
|
521 |
"/ '==' |
|
522 |
"/ '~=' |
|
523 |
"/ '~~' |
|
524 |
"/ ) includes:sel) ifTrue:[ |
|
525 |
"/ ^ self |
|
526 |
"/ ]. |
|
527 |
||
1526 | 528 |
fg := preferences selectorColor. |
529 |
em := preferences selectorEmphasis. |
|
1498
9b4366551a2a
speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents:
1396
diff
changeset
|
530 |
selectorSymbol := selectorString asSymbolIfInterned. |
9b4366551a2a
speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents:
1396
diff
changeset
|
531 |
selectorSymbol isNil ifTrue:[ |
863 | 532 |
fg := Color red. |
1498
9b4366551a2a
speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents:
1396
diff
changeset
|
533 |
] ifFalse:[ |
863 | 534 |
fullSelectorCheck == true ifTrue:[ |
535 |
||
1498
9b4366551a2a
speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents:
1396
diff
changeset
|
536 |
check := [:cls | (cls includesSelector:selectorSymbol) |
9b4366551a2a
speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents:
1396
diff
changeset
|
537 |
or:[cls class includesSelector:selectorSymbol]]. |
863 | 538 |
|
539 |
ok := false. |
|
540 |
||
541 |
"/ limit search if possible |
|
542 |
(classToCompileFor notNil |
|
543 |
and:[aReceiverNode isSelf or:[aReceiverNode isSuper]]) ifTrue:[ |
|
544 |
currentSuperclasses isNil ifTrue:[ |
|
545 |
currentSuperclasses := classToCompileFor withAllSuperclasses. |
|
546 |
]. |
|
547 |
ok := currentSuperclasses contains:check. |
|
548 |
(ok not and:[aReceiverNode isSelf]) ifTrue:[ |
|
549 |
currentSubclasses isNil ifTrue:[ |
|
550 |
currentSubclasses := classToCompileFor allSubclasses. |
|
551 |
]. |
|
552 |
ok := currentSubclasses contains:check. |
|
553 |
]. |
|
554 |
] ifFalse:[ |
|
555 |
aReceiverNode isConstant ifTrue:[ |
|
556 |
ok := aReceiverNode evaluate class withAllSuperclasses contains:check. |
|
557 |
] ifFalse:[ |
|
558 |
(aReceiverNode isGlobal |
|
559 |
and:[(rec := aReceiverNode evaluate) isBehavior]) ifTrue:[ |
|
560 |
ok := rec class withAllSuperclasses contains:check. |
|
561 |
] ifFalse:[ |
|
562 |
ok := Smalltalk allClasses contains:check |
|
563 |
] |
|
564 |
] |
|
565 |
]. |
|
566 |
||
567 |
ok ifFalse:[ |
|
1526 | 568 |
em := preferences unimplementedSelectorEmphasis. |
569 |
fg := preferences unimplementedSelectorColor. |
|
863 | 570 |
] |
571 |
] |
|
572 |
]. |
|
573 |
self |
|
574 |
markFrom:pos1 to:pos2 |
|
1553 | 575 |
withEmphasis:em |
576 |
color:fg |
|
863 | 577 |
|
578 |
"Modified: / 1.4.1998 / 13:14:43 / cg" |
|
579 |
! |
|
580 |
||
662 | 581 |
markSelfFrom:pos1 to:pos2 |
582 |
self |
|
583 |
markFrom:pos1 to:pos2 |
|
1553 | 584 |
withEmphasis:(preferences selfEmphasis) |
585 |
color:(preferences selfColor) |
|
662 | 586 |
|
587 |
"Modified: / 31.3.1998 / 18:03:10 / cg" |
|
588 |
! |
|
589 |
||
590 |
markStringFrom:pos1 to:pos2 |
|
1802 | 591 |
cachedStringEmphasis isNil ifTrue:[ |
592 |
cachedStringEmphasis := preferences stringEmphasis. |
|
593 |
cachedStringColor := preferences stringColor. |
|
594 |
]. |
|
662 | 595 |
self |
596 |
markFrom:pos1 to:pos2 |
|
1802 | 597 |
withEmphasis:cachedStringEmphasis |
598 |
color:cachedStringColor |
|
662 | 599 |
|
600 |
"Modified: / 31.3.1998 / 18:03:18 / cg" |
|
601 |
! |
|
602 |
||
603 |
markSuperFrom:pos1 to:pos2 |
|
604 |
self |
|
605 |
markFrom:pos1 to:pos2 |
|
1553 | 606 |
withEmphasis:(preferences superEmphasis) |
607 |
color:(preferences superColor) |
|
662 | 608 |
|
609 |
"Modified: / 31.3.1998 / 18:03:26 / cg" |
|
610 |
! |
|
611 |
||
672 | 612 |
markSymbolFrom:pos1 to:pos2 |
613 |
self |
|
614 |
markFrom:pos1 to:pos2 |
|
1553 | 615 |
withEmphasis:(preferences symbolEmphasis) |
616 |
color:(preferences symbolColor) |
|
672 | 617 |
|
618 |
"Created: / 1.4.1998 / 12:56:47 / cg" |
|
619 |
"Modified: / 1.4.1998 / 12:58:00 / cg" |
|
620 |
! |
|
621 |
||
662 | 622 |
markThisContextFrom:pos1 to:pos2 |
623 |
self |
|
624 |
markFrom:pos1 to:pos2 |
|
1553 | 625 |
withEmphasis:(preferences thisContextEmphasis) |
626 |
color:(preferences thisContextColor) |
|
662 | 627 |
|
628 |
"Modified: / 31.3.1998 / 18:03:36 / cg" |
|
665 | 629 |
! |
630 |
||
631 |
markUnknownIdentifierFrom:pos1 to:pos2 |
|
632 |
self |
|
633 |
markFrom:pos1 to:pos2 |
|
1553 | 634 |
withEmphasis:(preferences unknownIdentifierEmphasis) |
635 |
color:(preferences unknownIdentifierColor) |
|
665 | 636 |
|
637 |
"Created: / 31.3.1998 / 19:09:26 / cg" |
|
638 |
"Modified: / 31.3.1998 / 19:10:30 / cg" |
|
686 | 639 |
! |
640 |
||
641 |
markVariable:v |
|
642 |
"support for syntaxColoring" |
|
643 |
||
644 |
|pos endPos| |
|
645 |
||
646 |
pos := tokenPosition. |
|
647 |
endPos := pos+tokenName size-1. |
|
648 |
self markVariable:v from:pos to:endPos |
|
649 |
||
650 |
"Modified: / 16.4.1998 / 18:49:51 / cg" |
|
651 |
! |
|
652 |
||
653 |
markVariable:v from:pos to:endPos |
|
654 |
"support for syntaxColoring" |
|
655 |
||
823 | 656 |
|type globalValue nameSym| |
686 | 657 |
|
658 |
type := v type. |
|
659 |
(type == #BlockArg |
|
660 |
or:[type == #MethodArg]) ifTrue:[ |
|
661 |
self markArgumentIdentifierFrom:pos to:endPos. |
|
662 |
^ self |
|
663 |
]. |
|
664 |
(type == #BlockVariable |
|
665 |
or:[type == #MethodVariable]) ifTrue:[ |
|
666 |
self markLocalIdentifierFrom:pos to:endPos. |
|
667 |
^ self |
|
668 |
]. |
|
669 |
(type == #GlobalVariable) ifTrue:[ |
|
823 | 670 |
nameSym := v name asSymbolIfInterned. |
671 |
nameSym notNil ifTrue:[ |
|
672 |
globalValue := Smalltalk at:nameSym ifAbsent:nil. |
|
673 |
]. |
|
822
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
674 |
globalValue isBehavior ifTrue:[ |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
675 |
self markGlobalClassIdentifierFrom:pos to:endPos. |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
676 |
] ifFalse:[ |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
677 |
self markGlobalIdentifierFrom:pos to:endPos. |
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
678 |
]. |
686 | 679 |
^ self |
680 |
]. |
|
1553 | 681 |
(type == #PoolVariable) ifTrue:[ |
682 |
self markPoolVariableIdentifierFrom:pos to:endPos. |
|
683 |
^ self |
|
684 |
]. |
|
870 | 685 |
(type == #ClassVariable) ifTrue:[ |
686 |
self markClassVariableIdentifierFrom:pos to:endPos. |
|
687 |
^ self |
|
688 |
]. |
|
686 | 689 |
(type == #InstanceVariable) ifTrue:[ |
690 |
self markInstVarIdentifierFrom:pos to:endPos. |
|
691 |
^ self |
|
692 |
]. |
|
693 |
||
694 |
self markIdentifierFrom:pos to:endPos. |
|
695 |
||
696 |
"Created: / 16.4.1998 / 18:49:34 / cg" |
|
822
a773bb72cbd6
added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
697 |
"Modified: / 4.3.1999 / 12:56:13 / cg" |
662 | 698 |
! ! |
699 |
||
700 |
!SyntaxHighlighter class methodsFor:'documentation'! |
|
701 |
||
702 |
version |
|
1802 | 703 |
^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.52 2006-08-08 21:38:47 cg Exp $' |
662 | 704 |
! ! |