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