author | Claus Gittinger <cg@exept.de> |
Fri, 06 Feb 2015 09:33:09 +0100 | |
changeset 3573 | 1f32e1038e8e |
parent 3561 | f04a8db1590f |
child 3599 | a999663bd83f |
permissions | -rw-r--r-- |
2506 | 1 |
" |
2 |
COPYRIGHT (c) 2006 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 |
" |
|
2371 | 12 |
"{ Package: 'stx:libcomp' }" |
13 |
||
3561
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
15 |
|
2371 | 16 |
Parser subclass:#AbstractSyntaxHighlighter |
2525 | 17 |
instanceVariableNames:'method sourceText preferences fullSelectorCheck' |
2371 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'System-Compiler' |
|
21 |
! |
|
22 |
||
2506 | 23 |
!AbstractSyntaxHighlighter class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
3345
718b64ff3db3
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3344
diff
changeset
|
37 |
! |
718b64ff3db3
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3344
diff
changeset
|
38 |
|
718b64ff3db3
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3344
diff
changeset
|
39 |
documentation |
718b64ff3db3
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3344
diff
changeset
|
40 |
" |
718b64ff3db3
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3344
diff
changeset
|
41 |
common superclass for (smalltalk-) syntax highlighting. |
718b64ff3db3
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3344
diff
changeset
|
42 |
" |
2506 | 43 |
! ! |
2371 | 44 |
|
45 |
!AbstractSyntaxHighlighter class methodsFor:'api highlighting'! |
|
46 |
||
47 |
formatClassDefinition:aString in:aClass |
|
48 |
"format (recolor) a class definition expression in a given class. |
|
49 |
Return the text containing font changes and color information." |
|
50 |
||
51 |
^ self formatExpression:aString in:aClass |
|
52 |
! |
|
53 |
||
2506 | 54 |
formatClassDefinition:aString in:aClass elementsInto: elements |
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 |
"Created: / 10-04-2011 / 18:18:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
61 |
! |
|
62 |
||
2371 | 63 |
formatExpression:aString in:aClass |
64 |
"format (recolor) an expression in a given class. |
|
65 |
Return the text containing font changes and color information." |
|
66 |
||
67 |
|parser tree text endPos| |
|
68 |
||
69 |
aString isNil ifTrue:[^ nil]. |
|
70 |
||
71 |
parser := self for:(ReadStream on:aString string) in:aClass. |
|
72 |
parser ignoreErrors:true. |
|
73 |
parser ignoreWarnings:true. |
|
74 |
parser sourceText:(text := aString string asText). |
|
75 |
"/ use an array here - this can be changed much faster using #at:put: |
|
76 |
text emphasisCollection:(Array new:aString size). |
|
77 |
||
78 |
parser nextToken. |
|
79 |
tree := parser expression. |
|
80 |
"/ now, convert the emphasis-array to a runArray |
|
81 |
text emphasisCollection:(text emphasis asRunArray). |
|
82 |
||
83 |
tree == #Error ifTrue:[ |
|
3469 | 84 |
"/ mhmh - which is better ... |
85 |
"/ alternative1: color rest after error in red |
|
86 |
"/ text |
|
87 |
"/ emphasizeFrom:(parser sourceStream position) |
|
88 |
"/ to:text size |
|
2371 | 89 |
"/ with:(#color->Color red). |
90 |
||
91 |
||
3469 | 92 |
"/ alternative2: take original emphasis for rest |
2371 | 93 |
|
3469 | 94 |
endPos := parser sourceStream position + 1. |
95 |
endPos >= text size ifTrue:[ |
|
96 |
^ text |
|
97 |
]. |
|
98 |
^ (text copyTo:endPos) , (aString copyFrom:(endPos+1)) |
|
2371 | 99 |
|
3469 | 100 |
"/ alternative3: no emphasis for rest. |
2371 | 101 |
|
102 |
"/ ^ text "/ aString |
|
103 |
]. |
|
104 |
^ text |
|
105 |
||
106 |
" |
|
107 |
self |
|
3469 | 108 |
formatExpression:'(1 + 2) max:5' |
109 |
in:UndefinedObject |
|
2371 | 110 |
" |
111 |
||
112 |
"Modified: / 7.4.1998 / 09:57:19 / cg" |
|
113 |
"Created: / 9.4.1998 / 16:57:16 / cg" |
|
114 |
! |
|
115 |
||
116 |
formatMethod:aString in:aClass |
|
3191 | 117 |
<resource: #obsolete> |
2371 | 118 |
"format (recolor) a method in a given class. |
119 |
Return the text containing font changes and color information." |
|
120 |
||
121 |
self obsoleteMethodWarning:'use #formatMethodSource:in:'. |
|
122 |
^ self formatMethod:nil source:aString in:aClass using:nil |
|
123 |
||
124 |
" |
|
125 |
self |
|
3469 | 126 |
formatMethod:'foo |
2371 | 127 |
^ self bar:''hello''. |
128 |
||
129 |
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , ' |
|
130 |
' |
|
3469 | 131 |
in:UndefinedObject |
2371 | 132 |
" |
133 |
||
134 |
"Modified: / 28-04-2010 / 13:03:04 / cg" |
|
135 |
! |
|
136 |
||
137 |
formatMethod:aString in:aClass using:preferencesOrNil |
|
3191 | 138 |
<resource: #obsolete> |
2371 | 139 |
"format (recolor) a method in a given class. |
140 |
Return the text containing font changes and color information." |
|
141 |
||
142 |
self obsoleteMethodWarning:'use #formatMethodSource:in:using:'. |
|
143 |
^ self formatMethod:nil source:aString in:aClass using:preferencesOrNil |
|
144 |
||
145 |
"Modified: / 28-04-2010 / 13:03:15 / cg" |
|
146 |
! |
|
147 |
||
148 |
formatMethod:methodOrNil source:aString in:aClass |
|
149 |
"format (recolor) a method in a given class. |
|
150 |
Return the text containing font changes and color information." |
|
151 |
||
152 |
^ self formatMethod:methodOrNil source:aString in:aClass using:nil |
|
153 |
||
154 |
" |
|
155 |
self |
|
3469 | 156 |
formatMethod:'foo |
2371 | 157 |
^ self bar:''hello''. |
158 |
||
159 |
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , ' |
|
160 |
' |
|
3469 | 161 |
in:UndefinedObject |
2371 | 162 |
" |
163 |
||
164 |
"Created: / 28-04-2010 / 13:44:24 / cg" |
|
165 |
! |
|
166 |
||
167 |
formatMethod:methodOrNil source:aString in:aClass using:preferencesOrNil |
|
168 |
"format (recolor) a method in a given class. |
|
169 |
Return the text containing font changes and color information." |
|
170 |
||
171 |
|highlighter tree text endPos eColor| |
|
172 |
||
173 |
aString isNil ifTrue:[^ nil]. |
|
174 |
||
175 |
Error handle:[:ex | |
|
3469 | 176 |
Transcript showCR:ex description. |
177 |
self breakPoint:#cg. |
|
3201
13eb554c3f26
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3191
diff
changeset
|
178 |
|
3469 | 179 |
ex creator isHandled ifTrue:[ |
180 |
ex reject. |
|
181 |
]. |
|
182 |
(ParseError handles:ex) ifFalse:[ |
|
183 |
"Parse error may happen when re-formatting incomplete code while editing" |
|
184 |
('SyntaxHighlighter [info]: error during highlight: ' , ex description) infoPrintCR. |
|
185 |
"/ ex suspendedContext fullPrintAll. |
|
186 |
]. |
|
187 |
^ aString |
|
2371 | 188 |
] do:[ |
3469 | 189 |
highlighter := self for:(ReadStream on:aString string) in:aClass. |
190 |
highlighter method:methodOrNil. |
|
191 |
preferencesOrNil notNil ifTrue:[highlighter preferences:preferencesOrNil]. |
|
192 |
"/ highlighter ignoreErrors:true. |
|
193 |
highlighter ignoreWarnings:true. |
|
194 |
highlighter sourceText:(text := aString string asText). |
|
2371 | 195 |
|
3469 | 196 |
"/ use an array here - this can be changed much faster using #at:put: |
197 |
text emphasisCollection:(Array new:aString size). |
|
2371 | 198 |
|
3469 | 199 |
tree := highlighter parseMethod. |
200 |
"/ now, convert the emphasis-array to a runArray |
|
201 |
text emphasisCollection:(text emphasis asRunArray). |
|
2371 | 202 |
|
3469 | 203 |
tree == #Error ifTrue:[ |
204 |
eColor := UserPreferences current errorColor. |
|
205 |
eColor notNil ifTrue:[ |
|
206 |
"/ mhmh - which is better ... |
|
207 |
"/ alternative1: color rest after error in red |
|
208 |
text |
|
209 |
emphasizeFrom:(highlighter sourceStream position + 1) |
|
210 |
to:text size |
|
211 |
with:(#color->eColor). |
|
212 |
] ifFalse:[ |
|
213 |
"/ alternative2: take original emphasis for rest |
|
2371 | 214 |
|
3469 | 215 |
endPos := highlighter sourceStream position + 1. |
216 |
endPos >= text size ifTrue:[ |
|
217 |
^ text |
|
218 |
]. |
|
219 |
^ (text copyTo:endPos) , (aString copyFrom:(endPos+1)) |
|
220 |
]. |
|
221 |
"/ alternative3: no emphasis for rest. |
|
222 |
]. |
|
223 |
^ text |
|
2371 | 224 |
] |
225 |
" |
|
226 |
self |
|
3469 | 227 |
formatMethod:'foo |
2371 | 228 |
^ self bar:''hello''. |
229 |
||
230 |
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , ' |
|
231 |
' |
|
3469 | 232 |
in:UndefinedObject |
2371 | 233 |
" |
234 |
||
235 |
"Created: / 28-04-2010 / 13:01:42 / cg" |
|
2527
a87cf2c8edf2
changed: #formatMethod:source:in:using:
Claus Gittinger <cg@exept.de>
parents:
2526
diff
changeset
|
236 |
"Modified: / 05-07-2011 / 11:22:20 / cg" |
2371 | 237 |
! |
238 |
||
2526
ecd1ee8f03bc
category of: #formatMethod:source:in:using:elementsInto:
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
239 |
formatMethod:aMethodOrNil source:aString in:aClass using:preferencesOrNil elementsInto: elements |
2568
44f3c6ce19f1
fixed #formatMethod:source:in:using:elementsInto:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
240 |
|
44f3c6ce19f1
fixed #formatMethod:source:in:using:elementsInto:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
241 |
^ self formatMethod:aMethodOrNil source:aString in:aClass using:preferencesOrNil |
2526
ecd1ee8f03bc
category of: #formatMethod:source:in:using:elementsInto:
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
242 |
|
ecd1ee8f03bc
category of: #formatMethod:source:in:using:elementsInto:
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
243 |
"Created: / 05-07-2011 / 10:41:14 / cg" |
2568
44f3c6ce19f1
fixed #formatMethod:source:in:using:elementsInto:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
244 |
"Modified: / 20-07-2011 / 16:29:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2526
ecd1ee8f03bc
category of: #formatMethod:source:in:using:elementsInto:
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
245 |
! |
ecd1ee8f03bc
category of: #formatMethod:source:in:using:elementsInto:
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
246 |
|
2371 | 247 |
formatMethodSource:aString in:aClass |
248 |
"format (recolor) a method in a given class. |
|
249 |
Return the text containing font changes and color information." |
|
250 |
||
251 |
^ self formatMethod:nil source:aString in:aClass using:nil |
|
252 |
||
253 |
" |
|
254 |
self |
|
3469 | 255 |
formatMethod:'foo |
2371 | 256 |
^ self bar:''hello''. |
257 |
||
258 |
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , ' |
|
259 |
' |
|
3469 | 260 |
in:UndefinedObject |
2371 | 261 |
" |
262 |
||
263 |
"Created: / 28-04-2010 / 12:58:13 / cg" |
|
264 |
! |
|
265 |
||
266 |
formatMethodSource:aString in:aClass using:preferencesOrNil |
|
267 |
"format (recolor) a method in a given class. |
|
268 |
Return the text containing font changes and color information." |
|
269 |
||
270 |
^ self formatMethod:nil source:aString in:aClass using:preferencesOrNil |
|
271 |
||
272 |
"Modified: / 28-04-2010 / 13:02:11 / cg" |
|
273 |
! ! |
|
274 |
||
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
275 |
!AbstractSyntaxHighlighter class methodsFor:'misc'! |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
276 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
277 |
collectionEnumerationSelectors |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
278 |
"these are considered wellknown, builtin selectors of very common |
3469 | 279 |
collection enumeration methods. |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
280 |
These are optionally shown with another color (dark green)" |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
281 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
282 |
^ #( |
3469 | 283 |
collect: |
284 |
select: |
|
285 |
inject:into: |
|
286 |
count: |
|
287 |
collect:thenSelect: |
|
288 |
select:thenCollect: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
289 |
) |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
290 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
291 |
"Created: / 14-02-2012 / 15:56:59 / cg" |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
292 |
! |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
293 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
294 |
controlFlowSelectors |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
295 |
"these are considered wellknown, builtin selectors of very common |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
296 |
control flow constructs. Correspond to syntax or special forms in other |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
297 |
languages. These are optionally shown with another color (blue)" |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
298 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
299 |
^ #( |
3469 | 300 |
ifTrue: ifFalse: |
301 |
ifTrue:ifFalse: ifFalse:ifTrue: |
|
302 |
ifNil: ifNotNil: |
|
303 |
ifNil:ifNotNil: ifNotNil:ifNil: |
|
304 |
and: or: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
305 |
|
3469 | 306 |
whileTrue: |
307 |
whileFalse: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
308 |
|
3469 | 309 |
to:do: |
310 |
downTo:do: |
|
311 |
to:by:do: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
312 |
|
3469 | 313 |
loop |
314 |
whileTrue |
|
315 |
whileFalse |
|
316 |
doWhile: |
|
317 |
doUntil: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
318 |
|
3469 | 319 |
do: |
320 |
doWithIndex: |
|
321 |
pairWiseDo: |
|
322 |
keysAndValuesDo: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
323 |
|
3469 | 324 |
withPriority:do: |
325 |
handle:do: |
|
326 |
on:do: |
|
327 |
catch: |
|
328 |
ignoreIn: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
329 |
|
3469 | 330 |
"/ newProcess |
331 |
fork: |
|
332 |
ensure: |
|
333 |
ifCurtailed: |
|
334 |
valueOnUnwindDo: |
|
335 |
valueNowOrOnUnwindDo: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
336 |
|
3469 | 337 |
caseOf: |
338 |
caseOf:otherwise: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
339 |
) |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
340 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
341 |
"Created: / 08-09-2006 / 15:56:47 / cg" |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
342 |
! |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
343 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
344 |
debugSelectors |
3235
6385bfe15842
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3231
diff
changeset
|
345 |
"these are considered harmful if left in a deployed application: |
6385bfe15842
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3231
diff
changeset
|
346 |
selectors for debugging which open a debugger (unless haltSignal is |
3469 | 347 |
caught or disabled, which end-user apps should do). |
3235
6385bfe15842
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3231
diff
changeset
|
348 |
These are optionally shown with another color (redish)" |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
349 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
350 |
^ #( |
3469 | 351 |
halt halt: |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
352 |
) |
3235
6385bfe15842
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3231
diff
changeset
|
353 |
|
6385bfe15842
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3231
diff
changeset
|
354 |
"Modified (comment): / 27-07-2013 / 11:45:07 / cg" |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
355 |
! |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
356 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
357 |
errorRaisingSelectors |
3469 | 358 |
"these are error raisers. |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
359 |
These are optionally shown with another color (red)" |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
360 |
|
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
361 |
^ #( |
3469 | 362 |
error error: |
363 |
raise raiseRequest: |
|
364 |
raiseErrorString: raiseRequestErrorString: |
|
365 |
raiseWith: raiseRequestWith: |
|
366 |
raiseWith:errorString: raiseRequestWith:errorString: |
|
367 |
subclassResponsibility |
|
368 |
obsoleteMethodWarning obsoleteMethodWarning: |
|
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
369 |
) |
3342
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
370 |
! |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
371 |
|
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
372 |
isControlFlowSelector:aSelector |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
373 |
"these are considered wellknown, builtin selectors of very common |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
374 |
control flow constructs. Correspond to syntax or special forms in other |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
375 |
languages. These are optionally shown with another color (blue)" |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
376 |
|
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
377 |
(self controlFlowSelectors includesIdentical:aSelector) ifTrue:[^ true]. |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
378 |
|
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
379 |
true "((aSelector startsWith:'with') or:[ aSelector startsWith:'all'])" ifTrue:[ |
3469 | 380 |
((aSelector endsWith:'do:') or:[ aSelector endsWith:'Do:']) ifTrue:[ |
381 |
^ true |
|
382 |
] |
|
3342
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
383 |
]. |
d7aec03dc509
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3264
diff
changeset
|
384 |
^ false. |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
385 |
! ! |
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
386 |
|
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
387 |
!AbstractSyntaxHighlighter class methodsFor:'utilities'! |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
388 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
389 |
mark:sourceText from:pos1 to:pos2 withAddedEmphasis:addedEmphasis |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
390 |
sourceText emphasisFrom:pos1 to:pos2 add:addedEmphasis |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
391 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
392 |
"Created: / 01-06-2012 / 21:43:36 / cg" |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
393 |
! |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
394 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
395 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn |
3352
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
396 |
self mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:nil |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
397 |
! |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
398 |
|
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
399 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:fontIn |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
400 |
|e p2 clr| |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
401 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
402 |
(clrIn isNil or:[clrIn = Color black]) ifTrue:[ |
3469 | 403 |
e := fontEmp |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
404 |
] ifFalse:[ |
3469 | 405 |
clr := clrIn onDevice:Screen current. |
406 |
fontEmp isNil ifTrue:[ |
|
407 |
e := (#color->clr) |
|
408 |
] ifFalse:[ |
|
409 |
e := Text addEmphasis:fontEmp to:(#color->clr). |
|
410 |
] |
|
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
411 |
]. |
3352
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
412 |
fontIn notNil ifTrue:[ |
3469 | 413 |
e := Text addEmphasis:e to:(#font->fontIn) |
3352
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
414 |
]. |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
415 |
|
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
416 |
(p2 := pos2) isNil ifTrue:[ |
3469 | 417 |
p2 := sourceText size |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
418 |
] ifFalse:[ |
3469 | 419 |
p2 := p2 min:sourceText size |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
420 |
]. |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
421 |
sourceText emphasizeFrom:pos1 to:p2 with:e |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
422 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
423 |
"Created: / 01-06-2012 / 21:42:41 / cg" |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
424 |
! |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
425 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
426 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
427 |
|e p2 clr fgClr| |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
428 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
429 |
fgClr := fgClr1 ? fgClr2. |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
430 |
(fgClr isNil or:[fgClr = Color black]) ifTrue:[ |
3469 | 431 |
e := fontEmp |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
432 |
] ifFalse:[ |
3469 | 433 |
clr := fgClr onDevice:Screen current. |
434 |
fontEmp isNil ifTrue:[ |
|
435 |
e := (#color->clr) |
|
436 |
] ifFalse:[ |
|
437 |
e := Text addEmphasis:fontEmp to:(#color->clr). |
|
438 |
] |
|
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
439 |
]. |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
440 |
bgClr notNil ifTrue:[ |
3469 | 441 |
e := Text addEmphasis:(#backgroundColor->bgClr) to:e. |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
442 |
]. |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
443 |
(p2 := pos2) isNil ifTrue:[ |
3469 | 444 |
p2 := sourceText size |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
445 |
] ifFalse:[ |
3469 | 446 |
p2 := p2 min:sourceText size |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
447 |
]. |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
448 |
sourceText emphasizeFrom:pos1 to:p2 with:e |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
449 |
|
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
450 |
"Created: / 01-06-2012 / 21:44:17 / cg" |
3561
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
451 |
! |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
452 |
|
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
453 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp ifNil:fontEmp2 color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
454 |
|e p2 clr fgClr| |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
455 |
|
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
456 |
fgClr := fgClr1 ? fgClr2. |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
457 |
(fgClr isNil or:[fgClr = Color black]) ifTrue:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
458 |
e := fontEmp ? fontEmp2 |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
459 |
] ifFalse:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
460 |
clr := fgClr onDevice:Screen current. |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
461 |
(fontEmp ? fontEmp2) isNil ifTrue:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
462 |
e := (#color->clr) |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
463 |
] ifFalse:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
464 |
e := Text addEmphasis:(fontEmp ? fontEmp2) to:(#color->clr). |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
465 |
] |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
466 |
]. |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
467 |
bgClr notNil ifTrue:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
468 |
e := Text addEmphasis:(#backgroundColor->bgClr) to:e. |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
469 |
]. |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
470 |
(p2 := pos2) isNil ifTrue:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
471 |
p2 := sourceText size |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
472 |
] ifFalse:[ |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
473 |
p2 := p2 min:sourceText size |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
474 |
]. |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
475 |
sourceText emphasizeFrom:pos1 to:p2 with:e |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
476 |
|
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
477 |
"Created: / 01-06-2012 / 21:44:17 / cg" |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
478 |
! ! |
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
479 |
|
2371 | 480 |
!AbstractSyntaxHighlighter methodsFor:'accessing'! |
481 |
||
482 |
method:aMethod |
|
2525 | 483 |
"the original method, if known (for subclasses which can make use of it)" |
484 |
||
485 |
method := aMethod. |
|
2371 | 486 |
|
487 |
"Created: / 28-04-2010 / 13:15:33 / cg" |
|
488 |
! |
|
489 |
||
490 |
preferences:something |
|
491 |
preferences := something. |
|
492 |
! |
|
493 |
||
494 |
sourceText |
|
495 |
^ sourceText |
|
496 |
||
497 |
"Created: / 31.3.1998 / 11:49:05 / cg" |
|
498 |
! |
|
499 |
||
500 |
sourceText:aString |
|
501 |
sourceText := aString. |
|
502 |
||
503 |
"Created: / 31-03-1998 / 11:49:05 / cg" |
|
504 |
"Modified: / 28-04-2010 / 13:22:27 / cg" |
|
505 |
! ! |
|
506 |
||
507 |
!AbstractSyntaxHighlighter methodsFor:'error handling'! |
|
508 |
||
509 |
parseError:aMessage position:position to:endPos |
|
510 |
"/ Transcript showCR:aMessage. |
|
511 |
super parseError:aMessage position:position to:endPos. |
|
512 |
||
3469 | 513 |
self |
514 |
markFrom:position to:endPos |
|
515 |
withEmphasis:nil color:UserPreferences current errorColor |
|
2371 | 516 |
! |
517 |
||
518 |
showErrorMessage:aMessage position:pos |
|
519 |
"/ Transcript showCR:aMessage. |
|
520 |
super showErrorMessage:aMessage position:pos. |
|
521 |
||
3469 | 522 |
self |
523 |
markFrom:pos to:nil |
|
524 |
withEmphasis:nil color:UserPreferences current errorColor |
|
2371 | 525 |
! |
526 |
||
527 |
syntaxError:aMessage position:position to:endPos |
|
528 |
"/ Transcript showCR:aMessage. |
|
529 |
super syntaxError:aMessage position:position to:endPos. |
|
530 |
||
3469 | 531 |
self |
532 |
markFrom:position to:endPos |
|
533 |
withEmphasis:nil color:UserPreferences current errorColor |
|
2371 | 534 |
! |
535 |
||
536 |
warning:msg position:pos1 to:pos2 |
|
537 |
"/ self markUnknownIdentifierFrom:pos1 to:pos2 |
|
538 |
||
539 |
"/ self |
|
3469 | 540 |
"/ markFrom:pos1 to:pos2 |
2371 | 541 |
"/ withEmphasis:nil color:UserPreferences current errorColor |
542 |
||
543 |
"Modified: / 25.9.1999 / 18:42:30 / cg" |
|
544 |
! ! |
|
545 |
||
546 |
!AbstractSyntaxHighlighter methodsFor:'initialization'! |
|
547 |
||
548 |
initialize |
|
549 |
super initialize. |
|
550 |
||
551 |
foldConstants := false. |
|
552 |
preferences := UserPreferences current. |
|
553 |
fullSelectorCheck := preferences fullSelectorCheck. |
|
554 |
||
555 |
"Created: / 31-03-1998 / 15:12:55 / cg" |
|
556 |
"Modified: / 28-04-2010 / 13:17:45 / cg" |
|
557 |
! ! |
|
558 |
||
559 |
!AbstractSyntaxHighlighter methodsFor:'misc'! |
|
560 |
||
2817
b92ea70a5a9f
added: #collectionEnumerationSelectors
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
561 |
collectionEnumerationSelectors |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
562 |
^ self class collectionEnumerationSelectors |
2817
b92ea70a5a9f
added: #collectionEnumerationSelectors
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
563 |
! |
b92ea70a5a9f
added: #collectionEnumerationSelectors
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
564 |
|
2371 | 565 |
controlFlowSelectors |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
566 |
^ self class controlFlowSelectors |
2371 | 567 |
! |
568 |
||
3228
e276f545e004
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
569 |
debugSelectors |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
570 |
^ self class debugSelectors |
3228
e276f545e004
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
571 |
! |
e276f545e004
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
572 |
|
2371 | 573 |
defineAsUndeclaredVariable:aName |
574 |
"redefined to NOT declare undefined vars" |
|
575 |
||
576 |
^ VariableNode globalNamed:aName |
|
577 |
||
578 |
"Modified: / 19.10.1998 / 19:38:12 / cg" |
|
579 |
! |
|
580 |
||
3228
e276f545e004
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
581 |
errorRaisingSelectors |
3231
44b2709db25e
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
582 |
^ self class errorRaisingSelectors |
3228
e276f545e004
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
583 |
! |
e276f545e004
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
584 |
|
2371 | 585 |
isSyntaxHighlighter |
586 |
^ true |
|
587 |
||
588 |
! |
|
589 |
||
590 |
plausibilityCheck:aNode |
|
591 |
"redefined to NOT do checks" |
|
592 |
||
593 |
^ nil |
|
594 |
||
595 |
"Modified: / 19.10.1998 / 19:38:12 / cg" |
|
596 |
"Created: / 19.10.1998 / 19:57:18 / cg" |
|
597 |
! ! |
|
598 |
||
599 |
!AbstractSyntaxHighlighter methodsFor:'syntax detection'! |
|
600 |
||
601 |
markFrom:pos1 to:pos2 withAddedEmphasis:addedEmphasis |
|
3469 | 602 |
self class |
603 |
mark:sourceText from:pos1 to:pos2 withAddedEmphasis:addedEmphasis |
|
2371 | 604 |
|
605 |
"Created: / 15-01-2008 / 11:48:18 / cg" |
|
606 |
! |
|
607 |
||
608 |
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn |
|
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
609 |
self class |
3469 | 610 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn |
2371 | 611 |
|
612 |
"Created: / 31-03-1998 / 13:26:53 / cg" |
|
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
613 |
"Modified: / 01-06-2012 / 21:43:04 / cg" |
2371 | 614 |
! |
615 |
||
3352
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
616 |
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:fontInOrNil |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
617 |
self class |
3469 | 618 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:fontInOrNil |
3352
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
619 |
|
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
620 |
"Created: / 31-03-1998 / 13:26:53 / cg" |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
621 |
"Modified: / 01-06-2012 / 21:43:04 / cg" |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
622 |
! |
42a5ad1adb52
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
623 |
|
2813
51e4b12f18dc
added: #markFrom:to:withEmphasis:color:ifNil:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
2688
diff
changeset
|
624 |
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr |
2872
f992970ef1cd
refactored mark code for reuse by other classes
Claus Gittinger <cg@exept.de>
parents:
2817
diff
changeset
|
625 |
self class |
3469 | 626 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr |
2813
51e4b12f18dc
added: #markFrom:to:withEmphasis:color:ifNil:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
2688
diff
changeset
|
627 |
|
51e4b12f18dc
added: #markFrom:to:withEmphasis:color:ifNil:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
2688
diff
changeset
|
628 |
"Created: / 13-02-2012 / 11:48:09 / cg" |
51e4b12f18dc
added: #markFrom:to:withEmphasis:color:ifNil:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
2688
diff
changeset
|
629 |
! |
51e4b12f18dc
added: #markFrom:to:withEmphasis:color:ifNil:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
2688
diff
changeset
|
630 |
|
3561
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
631 |
markFrom:pos1 to:pos2 withEmphasis:fontEmp ifNil:fontEmp2 color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
632 |
self class |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
633 |
mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp ifNil:fontEmp2 color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
634 |
|
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
635 |
"Created: / 13-02-2012 / 11:48:09 / cg" |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
636 |
! |
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
637 |
|
2371 | 638 |
markVariable:v |
639 |
|pos endPos| |
|
640 |
||
641 |
pos := tokenPosition. |
|
642 |
endPos := pos+tokenName size-1. |
|
3189
5a4bb1727d08
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
643 |
self markVariable:v from:pos to:endPos assigned:false |
2371 | 644 |
|
2464
595ec0d9efa9
comment/format in: #markVariable:
Claus Gittinger <cg@exept.de>
parents:
2392
diff
changeset
|
645 |
"Modified: / 30-11-2010 / 14:44:28 / cg" |
2371 | 646 |
! ! |
647 |
||
648 |
!AbstractSyntaxHighlighter class methodsFor:'documentation'! |
|
649 |
||
2663
e94fe6b650ad
changed: #controlFlowSelectors
Claus Gittinger <cg@exept.de>
parents:
2662
diff
changeset
|
650 |
version |
3561
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
651 |
^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.33 2015-02-01 21:53:37 cg Exp $' |
2663
e94fe6b650ad
changed: #controlFlowSelectors
Claus Gittinger <cg@exept.de>
parents:
2662
diff
changeset
|
652 |
! |
e94fe6b650ad
changed: #controlFlowSelectors
Claus Gittinger <cg@exept.de>
parents:
2662
diff
changeset
|
653 |
|
2371 | 654 |
version_CVS |
3561
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
655 |
^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.33 2015-02-01 21:53:37 cg Exp $' |
2506 | 656 |
! |
657 |
||
658 |
version_SVN |
|
3189
5a4bb1727d08
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
659 |
^ '$ Id $' |
2371 | 660 |
! ! |
3561
f04a8db1590f
class: AbstractSyntaxHighlighter
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
661 |