author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 19 Jul 2017 09:42:32 +0200 | |
branch | jv |
changeset 17619 | edb119820fcb |
parent 17276 | 213d590bcf54 |
permissions | -rw-r--r-- |
9891 | 1 |
" |
2 |
COPYRIGHT (c) 2002 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 |
"{ Package: 'stx:libtool' }" |
|
13 |
||
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
List subclass:#TagList |
|
13342 | 17 |
instanceVariableNames:'rawList filteredList filter tagsValidForFile sortCriteria groupBy |
14346 | 18 |
showOnly flags tagTypesPresent usingDefaultCTags ctagsCommand |
19 |
ctagsIsExCtags ctagsIsExCtags5x remoteTarget' |
|
9891 | 20 |
classVariableNames:'Sorted CachedTagListsPerFile DefaultSortCriteria DefaultShowOnly |
21 |
TagsSuffixes DefaultGroupBy' |
|
22 |
poolDictionaries:'' |
|
23 |
category:'Interface-Tools-File-Tags' |
|
24 |
! |
|
25 |
||
26 |
!TagList class methodsFor:'documentation'! |
|
27 |
||
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 2002 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 |
" |
|
10054 | 42 |
! |
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
a list of tags as read & generated from parsing a source file. |
|
47 |
For some languages, naive parsing is supported right here; |
|
48 |
for other languages, external tools (ctags) are used. |
|
49 |
The tags are used bz the tagList or to navigate quickly to some |
|
50 |
function in the C-browser. |
|
51 |
" |
|
9891 | 52 |
! ! |
53 |
||
14482 | 54 |
!TagList class methodsFor:'accessing - suffixes'! |
9891 | 55 |
|
56 |
tagsSuffixes |
|
57 |
"flush with: |
|
58 |
TagsSuffixes := nil |
|
59 |
" |
|
60 |
TagsSuffixes notNil ifTrue:[ |
|
61 |
^ TagsSuffixes |
|
62 |
]. |
|
63 |
TagsSuffixes := IdentityDictionary new. |
|
64 |
||
65 |
TagsSuffixes at:#'text/asm' put:#( 's' 'asm' ). |
|
14482 | 66 |
TagsSuffixes at:#'text/c' put:#( 'c' 'h' 'ci' 'hi' 'sc' 'sth'). |
9891 | 67 |
TagsSuffixes at:#'text/cpp' put:#( 'cc' 'cpp' 'cxx' 'c++' 'hxx' 'hpp' 'h++'). |
16280 | 68 |
TagsSuffixes at:#'text/x-objcsrc' put:#( 'm'). |
9891 | 69 |
TagsSuffixes at:#'text/eiffel' put:#( 'e' 'eif' ). |
70 |
TagsSuffixes at:#'text/fortran' put:#( 'f' 'for' 'ftn' 'f77' 'f90' ). |
|
71 |
TagsSuffixes at:#'text/html' put:#( 'htm' 'html'). |
|
14482 | 72 |
TagsSuffixes at:#'text/java' put:#( 'java' 'jav' 'j'). |
9891 | 73 |
TagsSuffixes at:#'text/javaScript' put:#( 'js' ). |
74 |
TagsSuffixes at:#'text/javascript' put:#( 'js' ). |
|
75 |
TagsSuffixes at:#'application/x-javascript' put:#( 'js' ). |
|
11766 | 76 |
TagsSuffixes at:#'text/dart' put:#( 'dart' ). |
77 |
TagsSuffixes at:#'application/x-dart' put:#( 'dart' ). |
|
9891 | 78 |
TagsSuffixes at:#'text/make' put:#( 'makefile' 'make.proto' 'makefile.*' '*.mak' '*.bpr'). |
79 |
TagsSuffixes at:#'text/prolog' put:#( 'pl' ). |
|
80 |
TagsSuffixes at:#'text/python' put:#( 'py' ). |
|
81 |
TagsSuffixes at:#'text/php' put:#( 'php' ). |
|
82 |
TagsSuffixes at:#'text/lisp' put:#( 'lisp' 'el' 'lsp' 'cl'). |
|
83 |
TagsSuffixes at:#'text/lisp-arc' put:#( 'arc' ). |
|
84 |
TagsSuffixes at:#'text/scheme' put:#( 'scm' 'ss' 'brg'). |
|
85 |
TagsSuffixes at:#'text/oz' put:#( 'oz'). |
|
14345 | 86 |
TagsSuffixes at:#'text/lua' put:#( 'lua'). |
16181 | 87 |
TagsSuffixes at:#'text/smalltalk' put:#( 'st' 'ST' 'St' 'Prj'). |
9891 | 88 |
TagsSuffixes at:#'text/tcl' put:#( 'tcl' ). |
89 |
TagsSuffixes at:#'text/ruby' put:#( 'rb' ). |
|
90 |
TagsSuffixes at:#'text/yacc' put:#( 'y' ). |
|
11825 | 91 |
TagsSuffixes at:#'text/batch' put:#( 'bat' ). |
15685 | 92 |
TagsSuffixes at:#'text/xml-xsd' put:#( 'xsd' ). |
9891 | 93 |
^ TagsSuffixes |
94 |
||
11825 | 95 |
"Modified: / 28-09-2012 / 14:48:25 / cg" |
9891 | 96 |
! ! |
97 |
||
98 |
!TagList class methodsFor:'defaults'! |
|
99 |
||
100 |
arcLispSuffixes |
|
101 |
"returns a list of supported arc-lisp-suffixes" |
|
102 |
||
103 |
^ self tagsSuffixes at:#'text/lisp-arc' |
|
104 |
! |
|
105 |
||
106 |
assemblerSuffixes |
|
107 |
"returns a list of supported assembler-suffixes" |
|
108 |
||
109 |
^ self tagsSuffixes at:#'text/asm' |
|
110 |
! |
|
111 |
||
11825 | 112 |
batchSuffixes |
113 |
"returns a list of supported batchfile-suffixes |
|
114 |
" |
|
115 |
^ self tagsSuffixes at:#'text/batch' |
|
116 |
||
117 |
"Created: / 28-09-2012 / 14:48:41 / cg" |
|
118 |
! |
|
119 |
||
9891 | 120 |
cPlusPlusSuffixes |
121 |
"returns a list of supported c-suffixes" |
|
122 |
||
123 |
^ self tagsSuffixes at:#'text/cpp' |
|
124 |
! |
|
125 |
||
126 |
cSuffixes |
|
127 |
"returns a list of supported c-suffixes" |
|
128 |
||
129 |
^ self tagsSuffixes at:#'text/c' |
|
130 |
! |
|
131 |
||
132 |
commonLispSuffixes |
|
133 |
"returns a list of supported common-lisp-suffixes" |
|
134 |
||
135 |
^ self tagsSuffixes at:#'text/lisp' |
|
136 |
! |
|
137 |
||
11766 | 138 |
dartSuffixes |
139 |
"returns a list of supported dart-suffixes" |
|
140 |
||
141 |
^ self tagsSuffixes at:#'text/dart' |
|
142 |
||
143 |
"Created: / 22-08-2012 / 21:01:32 / cg" |
|
144 |
! |
|
145 |
||
9891 | 146 |
eiffelSuffixes |
147 |
"returns a list of supported eiffel-suffixes |
|
148 |
" |
|
149 |
^ self tagsSuffixes at:#'text/eiffel' |
|
150 |
! |
|
151 |
||
152 |
fortranSuffixes |
|
153 |
"returns a list of supported fortran-suffixes |
|
154 |
" |
|
155 |
^ self tagsSuffixes at:#'text/fortran' |
|
156 |
! |
|
157 |
||
158 |
htmlSuffixes |
|
159 |
"returns a list of supported html-suffixes |
|
160 |
" |
|
161 |
^ self tagsSuffixes at:#'text/html' |
|
162 |
||
163 |
"Created: / 20-04-2011 / 19:03:39 / cg" |
|
164 |
! |
|
165 |
||
166 |
isTagSearchableSuffix:aSuffix |
|
167 |
"returns true, if aSuffix looks ok for ctags |
|
168 |
" |
|
169 |
self tagsSuffixes keysAndValuesDo:[:tag :suffixes | |
|
170 |
(suffixes includes:aSuffix) ifTrue:[^ true]. |
|
171 |
]. |
|
172 |
"/ (self cSuffixes includes:aSuffix) ifTrue:[^ true]. |
|
173 |
"/ (self javaSuffixes includes:aSuffix) ifTrue:[^ true]. |
|
174 |
"/ (self fortranSuffixes includes:aSuffix) ifTrue:[^ true]. |
|
175 |
"/ (self eiffelSuffixes includes:aSuffix) ifTrue:[^ true]. |
|
176 |
"/ (self commonLispSuffixes includes:aSuffix) ifTrue:[^ true]. |
|
177 |
"/ (self schemeSuffixes includes:aSuffix) ifTrue:[^ true]. |
|
178 |
^ false |
|
179 |
! |
|
180 |
||
181 |
javaScriptSuffixes |
|
182 |
"returns a list of supported javaScript-suffixes" |
|
183 |
||
184 |
^ self tagsSuffixes at:#'text/javaScript' |
|
185 |
||
186 |
"Created: / 28-06-2010 / 12:44:58 / cg" |
|
187 |
! |
|
188 |
||
189 |
javaSuffixes |
|
190 |
"returns a list of supported java-suffixes |
|
191 |
" |
|
192 |
^ self tagsSuffixes at:#'text/java' |
|
193 |
! |
|
194 |
||
14345 | 195 |
luaSuffixes |
196 |
"returns a list of supported lua-suffixes |
|
197 |
" |
|
198 |
^ self tagsSuffixes at:#'text/lua' |
|
199 |
! |
|
200 |
||
9891 | 201 |
makeFilePatterns |
202 |
"returns a list of makefile match patterns |
|
203 |
" |
|
204 |
^ self tagsSuffixes at:#'text/make' |
|
205 |
! |
|
206 |
||
16280 | 207 |
objcSuffixes |
208 |
"returns a list of supported c-suffixes" |
|
209 |
||
210 |
^ self tagsSuffixes at:#'text/x-objcsrc' |
|
211 |
! |
|
212 |
||
9891 | 213 |
ozSuffixes |
214 |
"returns a list of supported oz-suffixes |
|
215 |
" |
|
216 |
^ self tagsSuffixes at:#'text/oz' |
|
217 |
! |
|
218 |
||
219 |
phpSuffixes |
|
220 |
"returns a list of supported php-suffixes" |
|
221 |
||
222 |
^ self tagsSuffixes at:#'text/php' |
|
223 |
! |
|
224 |
||
10840 | 225 |
pltSchemeLispSuffixes |
226 |
^ #('plt') |
|
227 |
||
228 |
"Created: / 21-10-2011 / 09:32:20 / cg" |
|
229 |
! |
|
230 |
||
9891 | 231 |
prologSuffixes |
232 |
"returns a list of supported prolog-suffixes |
|
233 |
" |
|
234 |
^ self tagsSuffixes at:#'text/prolog' |
|
235 |
! |
|
236 |
||
237 |
pythonSuffixes |
|
238 |
"returns a list of supported python-suffixes |
|
239 |
" |
|
240 |
^ self tagsSuffixes at:#'text/python' |
|
241 |
! |
|
242 |
||
10840 | 243 |
racketSchemeLispSuffixes |
244 |
^ #('rkt') |
|
245 |
||
246 |
"Created: / 21-10-2011 / 09:32:27 / cg" |
|
247 |
! |
|
248 |
||
9891 | 249 |
rubySuffixes |
250 |
"returns a list of supported ruby-suffixes |
|
251 |
" |
|
252 |
^ self tagsSuffixes at:#'text/ruby' |
|
253 |
! |
|
254 |
||
255 |
schemeSuffixes |
|
256 |
"returns a list of supported scheme-lisp-suffixes |
|
257 |
" |
|
258 |
^ self tagsSuffixes at:#'text/scheme' |
|
259 |
! |
|
260 |
||
261 |
smalltalkSuffixes |
|
262 |
"returns a list of supported smalltalk-suffixes |
|
263 |
" |
|
264 |
^ self tagsSuffixes at:#'text/smalltalk' |
|
265 |
! |
|
266 |
||
267 |
tclSuffixes |
|
268 |
"returns a list of supported tcl-suffixes |
|
269 |
" |
|
270 |
^ self tagsSuffixes at:#'text/tcl' |
|
271 |
! |
|
272 |
||
15685 | 273 |
xsdSuffixes |
274 |
"returns a list of supported xsd-suffixes |
|
275 |
" |
|
276 |
^ self tagsSuffixes at:#'text/xml-xsd' |
|
277 |
! |
|
278 |
||
9891 | 279 |
yaccSuffixes |
280 |
"returns a list of supported yacc-suffixes |
|
281 |
" |
|
282 |
^ self tagsSuffixes at:#'text/yacc' |
|
283 |
! ! |
|
284 |
||
285 |
!TagList class methodsFor:'queries'! |
|
286 |
||
287 |
isArcLispSuffix:suffix |
|
288 |
^ self isSuffix:suffix in:self arcLispSuffixes |
|
289 |
! |
|
290 |
||
291 |
isAssemblerSuffix:suffix |
|
292 |
^ self isSuffix:suffix in:self assemblerSuffixes |
|
293 |
! |
|
294 |
||
11825 | 295 |
isBatchSuffix:suffix |
296 |
^ self isSuffix:suffix in:self batchSuffixes |
|
297 |
||
298 |
"Created: / 28-09-2012 / 14:47:43 / cg" |
|
299 |
! |
|
300 |
||
14481 | 301 |
isCOrCPlusPlusSuffix:suffix |
302 |
^ (self isCSuffix:suffix) or:[self isCPlusPlusSuffix:suffix] |
|
303 |
! |
|
304 |
||
9891 | 305 |
isCPlusPlusSuffix:suffix |
306 |
^ self isSuffix:suffix in:self cPlusPlusSuffixes |
|
307 |
! |
|
308 |
||
309 |
isCSuffix:suffix |
|
310 |
^ self isSuffix:suffix in:self cSuffixes |
|
311 |
! |
|
312 |
||
313 |
isCommonLispSuffix:suffix |
|
314 |
^ self isSuffix:suffix in:self commonLispSuffixes |
|
315 |
! |
|
316 |
||
11766 | 317 |
isDartSuffix:suffix |
318 |
^ self isSuffix:suffix in:self dartSuffixes |
|
319 |
||
320 |
"Created: / 22-08-2012 / 21:01:10 / cg" |
|
321 |
! |
|
322 |
||
9891 | 323 |
isEiffelSuffix:suffix |
324 |
^ self isSuffix:suffix in:self eiffelSuffixes |
|
325 |
! |
|
326 |
||
327 |
isFortranSuffix:suffix |
|
328 |
^ self isSuffix:suffix in:self fortranSuffixes |
|
329 |
! |
|
330 |
||
331 |
isHTMLSuffix:suffix |
|
332 |
^ self isSuffix:suffix in:self htmlSuffixes |
|
333 |
||
334 |
"Created: / 20-04-2011 / 19:03:26 / cg" |
|
335 |
! |
|
336 |
||
337 |
isJavaScriptSuffix:suffix |
|
338 |
^ self isSuffix:suffix in:self javaScriptSuffixes |
|
339 |
||
340 |
"Created: / 28-06-2010 / 12:44:47 / cg" |
|
341 |
! |
|
342 |
||
343 |
isJavaSuffix:suffix |
|
344 |
^ self isSuffix:suffix in:self javaSuffixes |
|
345 |
! |
|
346 |
||
347 |
isLispSuffix:suffix |
|
348 |
^ (self isCommonLispSuffix:suffix) |
|
349 |
or:[(self isSchemeSuffix:suffix) |
|
10840 | 350 |
or:[(self isArcLispSuffix:suffix) |
351 |
or:[(self isPltSchemeLispSuffix:suffix) |
|
352 |
or:[(self isRacketSchemeLispSuffix:suffix)]]]] |
|
353 |
||
354 |
"Modified: / 21-10-2011 / 09:31:30 / cg" |
|
9891 | 355 |
! |
356 |
||
14345 | 357 |
isLuaSuffix:suffix |
358 |
^ self isSuffix:suffix in:self luaSuffixes |
|
359 |
! |
|
360 |
||
9891 | 361 |
isMakefileName:fileName |
362 |
|lcName| |
|
363 |
||
364 |
lcName := fileName asFilename baseName asLowercase. |
|
365 |
self makeFilePatterns do:[:aPattern | |
|
366 |
(aPattern match:lcName) ifTrue:[ ^ true ]. |
|
367 |
]. |
|
368 |
^ false |
|
369 |
! |
|
370 |
||
16280 | 371 |
isObjcSuffix:suffix |
372 |
^ self isSuffix:suffix in:self objcSuffixes |
|
373 |
! |
|
374 |
||
9891 | 375 |
isOzSuffix:suffix |
376 |
^ self isSuffix:suffix in:self ozSuffixes |
|
377 |
! |
|
378 |
||
379 |
isPhpSuffix:suffix |
|
380 |
^ self isSuffix:suffix in:self phpSuffixes |
|
381 |
! |
|
382 |
||
10840 | 383 |
isPltSchemeLispSuffix:suffix |
384 |
^ self isSuffix:suffix in:self pltSchemeLispSuffixes |
|
385 |
||
386 |
"Created: / 21-10-2011 / 09:30:56 / cg" |
|
387 |
! |
|
388 |
||
9891 | 389 |
isPrologSuffix:suffix |
390 |
^ self isSuffix:suffix in:self prologSuffixes |
|
391 |
! |
|
392 |
||
393 |
isPythonSuffix:suffix |
|
394 |
^ self isSuffix:suffix in:self pythonSuffixes |
|
395 |
! |
|
396 |
||
10840 | 397 |
isRacketSchemeLispSuffix:suffix |
398 |
^ self isSuffix:suffix in:self racketSchemeLispSuffixes |
|
399 |
||
400 |
"Created: / 21-10-2011 / 09:31:04 / cg" |
|
401 |
! |
|
402 |
||
9891 | 403 |
isRubySuffix:suffix |
404 |
^ self isSuffix:suffix in:self rubySuffixes |
|
405 |
! |
|
406 |
||
407 |
isSchemeSuffix:suffix |
|
408 |
^ self isSuffix:suffix in:self schemeSuffixes |
|
409 |
! |
|
410 |
||
411 |
isSmalltalkSuffix:suffix |
|
412 |
^ self isSuffix:suffix in:self smalltalkSuffixes |
|
413 |
! |
|
414 |
||
415 |
isTCLSuffix:suffix |
|
416 |
^ self isSuffix:suffix in:self tclSuffixes |
|
417 |
! |
|
418 |
||
15685 | 419 |
isXSDSuffix:suffix |
420 |
^ self isSuffix:suffix in:self xsdSuffixes |
|
421 |
! |
|
422 |
||
9891 | 423 |
isYaccSuffix:suffix |
424 |
^ self isSuffix:suffix in:self yaccSuffixes |
|
425 |
! ! |
|
426 |
||
427 |
!TagList class methodsFor:'queries basic'! |
|
428 |
||
429 |
isSuffix:suffix in:patterns |
|
430 |
|lcSuffix| |
|
431 |
||
432 |
lcSuffix := suffix asLowercase. |
|
433 |
^ patterns contains:[:pattern | pattern match:lcSuffix]. |
|
434 |
! |
|
435 |
||
436 |
tagMimeTypeForFile:aFile |
|
437 |
"returns the tag-mimetype for a file or nil |
|
438 |
" |
|
439 |
|suff file list name mimeMake| |
|
440 |
||
441 |
aFile isNil ifTrue:[^ nil]. |
|
442 |
||
443 |
file := aFile asFilename. |
|
14365 | 444 |
suff := file suffix. |
9891 | 445 |
|
446 |
suff size ~~ 0 ifTrue:[ |
|
447 |
suff := suff asLowercase. |
|
448 |
||
449 |
(suff = 'bak' or:[suff = 'sav']) ifTrue:[ |
|
450 |
file := file asFilename withoutSuffix. |
|
451 |
suff := file suffix. |
|
452 |
suff size ~~ 0 ifTrue:[ |
|
453 |
suff := suff asLowercase |
|
454 |
] |
|
455 |
] |
|
456 |
]. |
|
457 |
list := self tagsSuffixes. |
|
458 |
||
459 |
" hack to test for make-file patterns " |
|
460 |
name := file baseName asLowercase. |
|
461 |
mimeMake := #'text/make'. |
|
462 |
||
463 |
((list at:mimeMake) contains:[:pattern | pattern match:name]) ifTrue:[ |
|
464 |
^ mimeMake |
|
465 |
]. |
|
466 |
||
467 |
self tagsSuffixes keysAndValuesDo:[:mimeType :suffixes| |
|
14365 | 468 |
(suffixes includes:suff) ifTrue:[ |
469 |
^ mimeType |
|
470 |
] |
|
9891 | 471 |
]. |
14365 | 472 |
^ aFile asFilename mimeTypeOfContents |
473 |
"/ ^ nil |
|
9891 | 474 |
! ! |
475 |
||
476 |
!TagList class methodsFor:'tag generation'! |
|
477 |
||
478 |
cachedTagsFromFile:aFilename in:aTempDirectory |
|
479 |
"retrieve a cached tagList for a file" |
|
480 |
||
481 |
|tagList cached fileTime suffix| |
|
482 |
||
483 |
fileTime := aFilename modificationTime. |
|
484 |
||
485 |
CachedTagListsPerFile isNil ifTrue:[ |
|
486 |
CachedTagListsPerFile := Dictionary new. |
|
487 |
]. |
|
488 |
cached := CachedTagListsPerFile at:aFilename ifAbsent:nil. |
|
489 |
cached notNil ifTrue:[ |
|
490 |
fileTime > cached tagTimestamp ifFalse:[ |
|
491 |
^ cached tagList |
|
492 |
] |
|
493 |
]. |
|
494 |
suffix := aFilename suffix. |
|
495 |
||
496 |
"/ ((self isCSuffix:suffix) |
|
497 |
"/ or:[(self isJavaSuffix:suffix) |
|
498 |
"/ or:[(self isFortranSuffix:suffix) |
|
499 |
"/ or:[(self isEiffelSuffix:suffix)]]]) |
|
500 |
"/ ifFalse:[ |
|
501 |
"/ ^ #() |
|
502 |
"/ ]. |
|
503 |
tagList := self new. |
|
504 |
tagList showOnly:nil. |
|
505 |
tagList fromFile:aFilename in:aTempDirectory. |
|
14442 | 506 |
tagList do:[:eachTag | eachTag fileName:aFilename]. |
9891 | 507 |
|
508 |
CachedTagListsPerFile at:aFilename put:(CachedTags new tagList:tagList; tagTimestamp:fileTime; yourself). |
|
509 |
^ tagList |
|
510 |
||
511 |
"Modified: / 07-06-2010 / 12:13:25 / cg" |
|
512 |
! |
|
513 |
||
514 |
cachedTagsFromFile:aFilename in:aTempDirectory buildTargetHandler:aTargetHandler remote:aBoolean |
|
515 |
"retrieve a cached tagList for a file" |
|
516 |
||
517 |
^ self cachedTagsFromFile:aFilename in:aTempDirectory. |
|
518 |
! |
|
519 |
||
520 |
flushCachedTags |
|
521 |
CachedTagListsPerFile := nil |
|
522 |
||
523 |
" |
|
524 |
self flushCachedTags |
|
525 |
" |
|
526 |
! |
|
527 |
||
528 |
makeTargetTagsInFile:aMakefilePath |
|
529 |
"makefile tags: |
|
530 |
naive, q&d scan for lines ending with a colon |
|
531 |
" |
|
532 |
^ self makeTargetTagsInFile:aMakefilePath filter:nil |
|
533 |
! |
|
534 |
||
535 |
makeTargetTagsInFile:aMakefilePath filter:showOnly |
|
536 |
"makefile tags: |
|
537 |
naive, q&d scan for lines ending with a colon |
|
538 |
" |
|
539 |
|targets| |
|
540 |
||
541 |
Tag autoload. |
|
542 |
||
543 |
targets := OrderedCollection new. |
|
544 |
aMakefilePath asFilename contents keysAndValuesDo:[:lnr :line | |
|
545 |
|idxColon idxAssign varName target| |
|
546 |
||
547 |
line size > 0 ifTrue:[ |
|
548 |
line first isSeparator ifFalse:[ |
|
549 |
(line startsWith:$#) ifFalse:[ |
|
550 |
idxAssign := line indexOf:$=. |
|
551 |
idxAssign ~~ 0 ifTrue:[ |
|
552 |
showOnly ~~ #targets ifTrue:[ |
|
553 |
varName := line copyFrom:1 to:idxAssign - 1. |
|
554 |
targets add:(Tag::TVariable |
|
555 |
label:varName |
|
556 |
pattern:('/^',varName,'=') |
|
557 |
type:nil |
|
558 |
lineNumber:lnr) |
|
559 |
] |
|
560 |
] ifFalse:[ |
|
561 |
idxColon := line indexOf:$:. |
|
562 |
idxColon ~~ 0 ifTrue:[ |
|
563 |
target := line copyFrom:1 to:idxColon - 1. |
|
564 |
"/ ignore macro-targets |
|
565 |
||
566 |
(target includes:$$) ifFalse:[ |
|
567 |
(target startsWith:$.) ifFalse:[ |
|
568 |
"/ normal targets |
|
569 |
targets add:(Tag::TMakeTarget |
|
570 |
label:target |
|
571 |
pattern:('/^',target,':') |
|
572 |
type:nil |
|
573 |
lineNumber:lnr) |
|
574 |
] ifTrue:[ |
|
575 |
"/ rule-targets |
|
576 |
targets add:(Tag::TMakeRule |
|
577 |
label:target |
|
578 |
pattern:('/^',target,':') |
|
579 |
type:nil |
|
580 |
lineNumber:lnr) |
|
581 |
] |
|
582 |
] ifTrue:[ |
|
583 |
"/ rule-targets |
|
584 |
targets add:(Tag::TMakeTarget |
|
585 |
label:target |
|
586 |
pattern:('/^',target,':') |
|
587 |
type:nil |
|
588 |
lineNumber:lnr) |
|
589 |
]. |
|
590 |
] |
|
591 |
] |
|
592 |
] |
|
593 |
] |
|
594 |
] |
|
595 |
]. |
|
596 |
^ targets |
|
597 |
! ! |
|
598 |
||
13631 | 599 |
!TagList methodsFor:'accessing'! |
600 |
||
601 |
tagTypesPresent:aBoolean |
|
602 |
tagTypesPresent := aBoolean. |
|
603 |
! ! |
|
604 |
||
9891 | 605 |
!TagList methodsFor:'accessing-filters'! |
606 |
||
14579 | 607 |
anchorsOnly |
608 |
^ showOnly == #anchors |
|
609 |
! |
|
610 |
||
611 |
anchorsOnly:aBoolean |
|
612 |
showOnly := DefaultShowOnly := nil. |
|
613 |
aBoolean ifTrue:[ |
|
614 |
showOnly := "DefaultShowOnly :=" #anchors |
|
615 |
]. |
|
616 |
||
617 |
"Created: / 08-05-2011 / 10:11:39 / cg" |
|
618 |
! |
|
619 |
||
9891 | 620 |
classesFunctionsAndVariablesOnly |
621 |
^ showOnly == #classesFunctionsAndVariables |
|
622 |
||
623 |
"Modified: / 07-06-2010 / 14:18:09 / cg" |
|
624 |
! |
|
625 |
||
626 |
classesFunctionsAndVariablesOnly:aBoolean |
|
627 |
showOnly := nil. |
|
628 |
aBoolean ifTrue:[ |
|
629 |
showOnly := DefaultShowOnly := #classesFunctionsAndVariables |
|
630 |
]. |
|
631 |
||
632 |
"Modified: / 05-05-2011 / 15:21:53 / cg" |
|
633 |
! |
|
634 |
||
635 |
classesOnly |
|
636 |
^ showOnly == #classes |
|
637 |
||
638 |
"Modified: / 07-06-2010 / 14:18:12 / cg" |
|
639 |
! |
|
640 |
||
641 |
classesOnly:aBoolean |
|
642 |
showOnly := nil. |
|
643 |
aBoolean ifTrue:[ |
|
644 |
showOnly := DefaultShowOnly := #classes |
|
645 |
]. |
|
646 |
||
647 |
"Modified: / 05-05-2011 / 15:21:56 / cg" |
|
648 |
! |
|
649 |
||
11762 | 650 |
dartClassesAndMethodsOnly |
651 |
^ showOnly == #dartClassesAndMethods |
|
652 |
||
653 |
"Modified: / 07-06-2010 / 14:18:25 / cg" |
|
654 |
! |
|
655 |
||
656 |
dartClassesAndMethodsOnly:aBoolean |
|
657 |
showOnly := nil. |
|
658 |
aBoolean ifTrue:[ |
|
659 |
showOnly := DefaultShowOnly := #dartClassesAndMethods |
|
660 |
]. |
|
661 |
||
662 |
"Modified: / 05-05-2011 / 15:23:25 / cg" |
|
663 |
! |
|
664 |
||
665 |
dartClassesOnly |
|
666 |
^ showOnly == #dartClasses |
|
667 |
||
668 |
"Modified: / 07-06-2010 / 14:18:28 / cg" |
|
669 |
! |
|
670 |
||
671 |
dartClassesOnly:aBoolean |
|
672 |
showOnly := nil. |
|
673 |
aBoolean ifTrue:[ |
|
674 |
showOnly := DefaultShowOnly := #dartClasses |
|
675 |
]. |
|
676 |
||
677 |
"Modified: / 05-05-2011 / 15:23:29 / cg" |
|
678 |
! |
|
679 |
||
680 |
dartMethodsOnly |
|
681 |
^ showOnly == #dartMethods |
|
682 |
||
683 |
"Modified: / 07-06-2010 / 14:18:30 / cg" |
|
684 |
! |
|
685 |
||
686 |
dartMethodsOnly:aBoolean |
|
687 |
showOnly := nil. |
|
688 |
aBoolean ifTrue:[ |
|
689 |
showOnly := DefaultShowOnly := #dartMethods |
|
690 |
]. |
|
691 |
||
692 |
"Modified: / 05-05-2011 / 15:23:31 / cg" |
|
693 |
! |
|
694 |
||
9891 | 695 |
definesOnly |
696 |
^ showOnly == #defines |
|
697 |
||
698 |
"Modified: / 07-06-2010 / 14:18:15 / cg" |
|
699 |
! |
|
700 |
||
701 |
definesOnly:aBoolean |
|
702 |
showOnly := nil. |
|
703 |
aBoolean ifTrue:[ |
|
704 |
showOnly := DefaultShowOnly := #defines |
|
705 |
]. |
|
706 |
||
707 |
"Modified: / 05-05-2011 / 15:21:58 / cg" |
|
708 |
! |
|
709 |
||
9921 | 710 |
documentationOnly |
711 |
^ showOnly == #documentation |
|
712 |
||
713 |
"Created: / 08-05-2011 / 10:11:47 / cg" |
|
714 |
! |
|
715 |
||
716 |
documentationOnly:aBoolean |
|
717 |
showOnly := DefaultShowOnly := nil. |
|
718 |
aBoolean ifTrue:[ |
|
719 |
showOnly := "DefaultShowOnly :=" #documentation |
|
720 |
]. |
|
721 |
||
722 |
"Created: / 08-05-2011 / 10:11:39 / cg" |
|
723 |
! |
|
724 |
||
13311 | 725 |
filter:aStringOrNil |
726 |
(filter ? '') ~= (aStringOrNil ? '') ifTrue:[ |
|
727 |
filter := aStringOrNil. |
|
9891 | 728 |
rawList notNil ifTrue:[ |
729 |
self updateContentsFromRawList |
|
730 |
]. |
|
731 |
]. |
|
732 |
||
733 |
"Modified: / 05-05-2011 / 14:43:04 / cg" |
|
734 |
! |
|
735 |
||
14346 | 736 |
flagNamed:aSymbol |
737 |
^ flags at:aSymbol ifAbsent:false |
|
738 |
! |
|
739 |
||
740 |
flagNamed:aSymbol put:aBoolean |
|
741 |
flags at:aSymbol put:aBoolean |
|
742 |
! |
|
743 |
||
9891 | 744 |
functionsAndVariablesOnly |
745 |
^ showOnly == #functionsAndVariables |
|
746 |
||
747 |
"Modified: / 07-06-2010 / 14:18:05 / cg" |
|
748 |
! |
|
749 |
||
750 |
functionsAndVariablesOnly:aBoolean |
|
751 |
showOnly := nil. |
|
752 |
aBoolean ifTrue:[ |
|
753 |
showOnly := DefaultShowOnly := #functionsAndVariables |
|
754 |
]. |
|
755 |
||
756 |
"Modified: / 05-05-2011 / 15:22:01 / cg" |
|
757 |
! |
|
758 |
||
759 |
functionsOnly |
|
760 |
^ showOnly == #functions |
|
761 |
||
762 |
"Modified: / 07-06-2010 / 14:17:54 / cg" |
|
763 |
! |
|
764 |
||
765 |
functionsOnly:aBoolean |
|
766 |
showOnly := nil. |
|
767 |
aBoolean ifTrue:[ |
|
768 |
showOnly := DefaultShowOnly := #functions |
|
769 |
]. |
|
770 |
||
771 |
"Modified: / 05-05-2011 / 15:22:03 / cg" |
|
772 |
! |
|
773 |
||
14579 | 774 |
headlinesOnly |
775 |
^ showOnly == #headlines |
|
776 |
! |
|
777 |
||
778 |
headlinesOnly:aBoolean |
|
779 |
showOnly := DefaultShowOnly := nil. |
|
780 |
aBoolean ifTrue:[ |
|
781 |
showOnly := "DefaultShowOnly :=" #headlines |
|
782 |
]. |
|
783 |
! |
|
784 |
||
9891 | 785 |
hideClasses |
14346 | 786 |
^ self flagNamed:#hideClasses |
9891 | 787 |
! |
788 |
||
789 |
hideClasses:aBoolean |
|
14346 | 790 |
self flagNamed:#hideClasses put:aBoolean |
9891 | 791 |
|
792 |
"Modified: / 05-05-2011 / 15:22:08 / cg" |
|
793 |
! |
|
794 |
||
11762 | 795 |
hideDartClasses |
14346 | 796 |
^ self flagNamed:#hideDartClasses |
11762 | 797 |
! |
798 |
||
799 |
hideDartClasses:aBoolean |
|
14346 | 800 |
self flagNamed:#hideDartClasses put:aBoolean |
11762 | 801 |
|
802 |
"Modified: / 05-05-2011 / 15:22:32 / cg" |
|
803 |
! |
|
804 |
||
805 |
hideDartFields |
|
14346 | 806 |
^ self flagNamed:#hideDartFields |
11762 | 807 |
! |
808 |
||
809 |
hideDartFields:aBoolean |
|
14346 | 810 |
self flagNamed:#hideDartFields put:aBoolean |
11762 | 811 |
|
812 |
"Modified: / 05-05-2011 / 15:22:34 / cg" |
|
813 |
! |
|
814 |
||
815 |
hideDartInterfaces |
|
14346 | 816 |
^ self flagNamed:#hideDartInterfaces |
11762 | 817 |
! |
818 |
||
819 |
hideDartInterfaces:aBoolean |
|
14346 | 820 |
self flagNamed:#hideDartInterfaces put:aBoolean |
11762 | 821 |
|
822 |
"Modified: / 05-05-2011 / 15:22:38 / cg" |
|
823 |
! |
|
824 |
||
825 |
hideDartMethods |
|
14346 | 826 |
^ self flagNamed:#hideDartMethods |
11762 | 827 |
! |
828 |
||
829 |
hideDartMethods:aBoolean |
|
14346 | 830 |
self flagNamed:#hideDartMethods put:aBoolean. |
11762 | 831 |
|
832 |
"Modified: / 05-05-2011 / 15:22:40 / cg" |
|
833 |
! |
|
834 |
||
835 |
hideDartPackages |
|
14346 | 836 |
^ self flagNamed:#hideDartPackages |
11762 | 837 |
! |
838 |
||
839 |
hideDartPackages:aBoolean |
|
14346 | 840 |
self flagNamed:#hideDartPackages put:aBoolean. |
11762 | 841 |
|
842 |
"Modified: / 05-05-2011 / 15:22:41 / cg" |
|
843 |
! |
|
844 |
||
9891 | 845 |
hideDataLabels |
14346 | 846 |
^ self flagNamed:#hideDataLabels |
9891 | 847 |
! |
848 |
||
849 |
hideDataLabels:aBoolean |
|
14346 | 850 |
self flagNamed:#hideDataLabels put:aBoolean. |
9891 | 851 |
|
852 |
"Modified: / 05-05-2011 / 15:22:10 / cg" |
|
853 |
! |
|
854 |
||
855 |
hideDefines |
|
14346 | 856 |
^ self flagNamed:#hideDefines |
9891 | 857 |
! |
858 |
||
859 |
hideDefines:aBoolean |
|
14346 | 860 |
self flagNamed:#hideDefines put:aBoolean. |
9891 | 861 |
|
862 |
"Modified: / 05-05-2011 / 15:22:12 / cg" |
|
863 |
! |
|
864 |
||
9921 | 865 |
hideDocumentation |
14346 | 866 |
^ self flagNamed:#hideDocumentation |
9921 | 867 |
|
868 |
"Created: / 08-05-2011 / 10:11:02 / cg" |
|
869 |
! |
|
870 |
||
871 |
hideDocumentation:aBoolean |
|
14346 | 872 |
self flagNamed:#hideDocumentation put:aBoolean. |
9921 | 873 |
|
874 |
"Created: / 08-05-2011 / 10:11:06 / cg" |
|
875 |
! |
|
876 |
||
9891 | 877 |
hideFunctionProtoTypes |
14346 | 878 |
^ self flagNamed:#hideFunctionProtoTypes |
9891 | 879 |
! |
880 |
||
881 |
hideFunctionProtoTypes:aBoolean |
|
14346 | 882 |
self flagNamed:#hideFunctionProtoTypes put:aBoolean. |
9891 | 883 |
|
884 |
"Modified: / 05-05-2011 / 15:22:14 / cg" |
|
885 |
! |
|
886 |
||
887 |
hideFunctions |
|
14346 | 888 |
^ self flagNamed:#hideFunctions |
9891 | 889 |
! |
890 |
||
891 |
hideFunctions:aBoolean |
|
14346 | 892 |
self flagNamed:#hideFunctions put:aBoolean. |
9891 | 893 |
|
894 |
"Modified: / 05-05-2011 / 15:22:18 / cg" |
|
895 |
! |
|
896 |
||
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
897 |
hideHTMLHeaders |
14346 | 898 |
^ self flagNamed:#hideHTMLHeaders |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
899 |
|
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
900 |
"Created: / 12-09-2012 / 12:29:45 / cg" |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
901 |
! |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
902 |
|
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
903 |
hideHTMLHeaders:aBoolean |
14346 | 904 |
self flagNamed:#hideHTMLHeaders put:aBoolean. |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
905 |
|
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
906 |
"Created: / 12-09-2012 / 12:29:52 / cg" |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
907 |
! |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
908 |
|
9891 | 909 |
hideHTMLInput |
14346 | 910 |
^ self flagNamed:#hideHTMLInput |
9891 | 911 |
|
912 |
"Created: / 20-04-2011 / 19:01:04 / cg" |
|
913 |
! |
|
914 |
||
915 |
hideHTMLInput:aBoolean |
|
14346 | 916 |
self flagNamed:#hideHTMLInput put:aBoolean. |
9891 | 917 |
|
918 |
"Created: / 20-04-2011 / 19:01:32 / cg" |
|
919 |
"Modified: / 05-05-2011 / 15:22:21 / cg" |
|
920 |
! |
|
921 |
||
922 |
hideHTMLScript |
|
14346 | 923 |
^ self flagNamed:#hideHTMLScript |
9891 | 924 |
|
925 |
"Created: / 20-04-2011 / 19:00:32 / cg" |
|
926 |
! |
|
927 |
||
928 |
hideHTMLScript:aBoolean |
|
14346 | 929 |
self flagNamed:#hideHTMLScript put:aBoolean. |
9891 | 930 |
|
931 |
"Created: / 20-04-2011 / 19:01:32 / cg" |
|
932 |
"Modified: / 05-05-2011 / 15:22:23 / cg" |
|
933 |
! |
|
934 |
||
935 |
hideHTMLTable |
|
14346 | 936 |
^ self flagNamed:#hideHTMLTable |
9891 | 937 |
|
938 |
"Created: / 20-04-2011 / 19:01:23 / cg" |
|
939 |
! |
|
940 |
||
941 |
hideHTMLTable:aBoolean |
|
14346 | 942 |
self flagNamed:#hideHTMLTable put:aBoolean. |
9891 | 943 |
|
944 |
"Created: / 20-04-2011 / 19:01:48 / cg" |
|
945 |
"Modified: / 05-05-2011 / 15:22:26 / cg" |
|
946 |
! |
|
947 |
||
948 |
hideHTMLTextArea |
|
14346 | 949 |
^ self flagNamed:#hideHTMLTextArea |
9891 | 950 |
|
951 |
"Created: / 20-04-2011 / 19:00:55 / cg" |
|
952 |
! |
|
953 |
||
954 |
hideHTMLTextArea:aBoolean |
|
14346 | 955 |
self flagNamed:#hideHTMLTextArea put:aBoolean. |
9891 | 956 |
|
957 |
"Created: / 20-04-2011 / 19:01:58 / cg" |
|
958 |
"Modified: / 05-05-2011 / 15:22:28 / cg" |
|
959 |
! |
|
960 |
||
961 |
hideJavaClasses |
|
14346 | 962 |
^ self flagNamed:#hideJavaClasses |
9891 | 963 |
! |
964 |
||
965 |
hideJavaClasses:aBoolean |
|
14346 | 966 |
self flagNamed:#hideJavaClasses put:aBoolean |
9891 | 967 |
|
968 |
"Modified: / 05-05-2011 / 15:22:32 / cg" |
|
969 |
! |
|
970 |
||
971 |
hideJavaFields |
|
14347 | 972 |
^ self flagNamed:#hideJavaFields |
9891 | 973 |
! |
974 |
||
975 |
hideJavaFields:aBoolean |
|
14347 | 976 |
self flagNamed:#hideJavaFields put:aBoolean. |
9891 | 977 |
|
978 |
"Modified: / 05-05-2011 / 15:22:34 / cg" |
|
979 |
! |
|
980 |
||
981 |
hideJavaInterfaces |
|
14347 | 982 |
^ self flagNamed:#hideJavaInterfaces |
9891 | 983 |
! |
984 |
||
985 |
hideJavaInterfaces:aBoolean |
|
14347 | 986 |
self flagNamed:#hideJavaInterfaces put:aBoolean. |
9891 | 987 |
|
988 |
"Modified: / 05-05-2011 / 15:22:38 / cg" |
|
989 |
! |
|
990 |
||
991 |
hideJavaMethods |
|
14346 | 992 |
^ self flagNamed:#hideJavaMethods |
9891 | 993 |
! |
994 |
||
995 |
hideJavaMethods:aBoolean |
|
14346 | 996 |
self flagNamed:#hideJavaMethods put:aBoolean. |
9891 | 997 |
|
998 |
"Modified: / 05-05-2011 / 15:22:40 / cg" |
|
999 |
! |
|
1000 |
||
1001 |
hideJavaPackages |
|
14346 | 1002 |
^ self flagNamed:#hideJavaPackages |
9891 | 1003 |
! |
1004 |
||
1005 |
hideJavaPackages:aBoolean |
|
14346 | 1006 |
self flagNamed:#hideJavaPackages put:aBoolean. |
9891 | 1007 |
|
1008 |
"Modified: / 05-05-2011 / 15:22:41 / cg" |
|
1009 |
! |
|
1010 |
||
14385 | 1011 |
hideLabels |
1012 |
^ self flagNamed:#hideLabels |
|
1013 |
! |
|
1014 |
||
1015 |
hideLabels:aBoolean |
|
1016 |
self flagNamed:#hideLabels put:aBoolean. |
|
1017 |
||
1018 |
"Modified: / 05-05-2011 / 15:22:46 / cg" |
|
1019 |
! |
|
1020 |
||
9891 | 1021 |
hideLispConstants |
14346 | 1022 |
^ self flagNamed:#hideLispConstants |
9891 | 1023 |
! |
1024 |
||
1025 |
hideLispConstants:aBoolean |
|
14346 | 1026 |
self flagNamed:#hideLispConstants put:aBoolean. |
9891 | 1027 |
|
1028 |
"Modified: / 05-05-2011 / 15:22:46 / cg" |
|
1029 |
! |
|
1030 |
||
1031 |
hideLispEvaluations |
|
14346 | 1032 |
^ self flagNamed:#hideLispEvaluations |
9891 | 1033 |
! |
1034 |
||
1035 |
hideLispEvaluations:aBoolean |
|
14346 | 1036 |
self flagNamed:#hideLispEvaluations put:aBoolean. |
9891 | 1037 |
|
1038 |
"Modified: / 05-05-2011 / 15:22:49 / cg" |
|
1039 |
! |
|
1040 |
||
1041 |
hideLispMacros |
|
14346 | 1042 |
^ self flagNamed:#hideLispMacros |
9891 | 1043 |
! |
1044 |
||
1045 |
hideLispMacros:aBoolean |
|
14346 | 1046 |
self flagNamed:#hideLispMacros put:aBoolean. |
9891 | 1047 |
|
1048 |
"Modified: / 05-05-2011 / 15:22:50 / cg" |
|
1049 |
! |
|
1050 |
||
1051 |
hideLispMethods |
|
14346 | 1052 |
^ self flagNamed:#hideLispMethods |
9891 | 1053 |
! |
1054 |
||
1055 |
hideLispMethods:aBoolean |
|
14346 | 1056 |
self flagNamed:#hideLispMethods put:aBoolean. |
9891 | 1057 |
|
1058 |
"Modified: / 05-05-2011 / 15:22:53 / cg" |
|
1059 |
! |
|
1060 |
||
1061 |
hideLocalLabels |
|
14346 | 1062 |
^ self flagNamed:#hideLocalLabels |
9891 | 1063 |
! |
1064 |
||
11466 | 1065 |
hideLocalLabels2 |
14346 | 1066 |
^ self flagNamed:#hideLocalLabels2 |
11466 | 1067 |
|
1068 |
"Created: / 24-03-2012 / 23:23:15 / cg" |
|
1069 |
! |
|
1070 |
||
1071 |
hideLocalLabels2:aBoolean |
|
14346 | 1072 |
self flagNamed:#hideLocalLabels2 put:aBoolean. |
11466 | 1073 |
|
1074 |
"Modified: / 05-05-2011 / 15:22:54 / cg" |
|
1075 |
"Created: / 24-03-2012 / 23:23:20 / cg" |
|
1076 |
! |
|
1077 |
||
11502 | 1078 |
hideLocalLabels3 |
14346 | 1079 |
^ self flagNamed:#hideLocalLabels3 |
11502 | 1080 |
|
1081 |
"Created: / 13-05-2012 / 11:12:37 / cg" |
|
1082 |
! |
|
1083 |
||
1084 |
hideLocalLabels3:aBoolean |
|
14346 | 1085 |
self flagNamed:#hideLocalLabels3 put:aBoolean. |
11502 | 1086 |
|
1087 |
"Modified: / 05-05-2011 / 15:22:54 / cg" |
|
1088 |
"Created: / 13-05-2012 / 11:12:42 / cg" |
|
1089 |
! |
|
1090 |
||
9891 | 1091 |
hideLocalLabels:aBoolean |
14346 | 1092 |
self flagNamed:#hideLocalLabels put:aBoolean. |
9891 | 1093 |
|
1094 |
"Modified: / 05-05-2011 / 15:22:54 / cg" |
|
1095 |
! |
|
1096 |
||
14346 | 1097 |
hideLuaFunctions |
1098 |
^ self flagNamed:#hideLuaFunctions |
|
1099 |
! |
|
1100 |
||
1101 |
hideLuaFunctions:aBoolean |
|
1102 |
self flagNamed:#hideLuaFunctions put:aBoolean |
|
1103 |
! |
|
1104 |
||
11762 | 1105 |
hideMethods |
14346 | 1106 |
^ self flagNamed:#hideMethods |
11762 | 1107 |
|
1108 |
"Created: / 21-08-2012 / 21:02:24 / cg" |
|
1109 |
! |
|
1110 |
||
1111 |
hideMethods:aBoolean |
|
14346 | 1112 |
self flagNamed:#hideMethods put:aBoolean. |
11762 | 1113 |
|
1114 |
"Created: / 21-08-2012 / 21:01:38 / cg" |
|
1115 |
! |
|
1116 |
||
16280 | 1117 |
hideObjcClasses |
1118 |
^ self flagNamed:#hideObjcClasses |
|
1119 |
! |
|
1120 |
||
1121 |
hideObjcClasses:aBoolean |
|
1122 |
self flagNamed:#hideObjcClasses put:aBoolean. |
|
1123 |
! |
|
1124 |
||
1125 |
hideObjcMethods |
|
1126 |
^ self flagNamed:#hideObjcMethods |
|
1127 |
! |
|
1128 |
||
1129 |
hideObjcMethods:aBoolean |
|
1130 |
self flagNamed:#hideObjcMethods put:aBoolean. |
|
1131 |
! |
|
1132 |
||
9891 | 1133 |
hideOzClasses |
14346 | 1134 |
^ self flagNamed:#hideOzClasses |
9891 | 1135 |
! |
1136 |
||
1137 |
hideOzClasses:aBoolean |
|
14346 | 1138 |
self flagNamed:#hideOzClasses put:aBoolean. |
9891 | 1139 |
|
1140 |
"Modified: / 05-05-2011 / 15:22:58 / cg" |
|
1141 |
! |
|
1142 |
||
1143 |
hideOzFunctions |
|
14346 | 1144 |
^ self flagNamed:#hideOzFunctions |
9891 | 1145 |
! |
1146 |
||
1147 |
hideOzFunctions:aBoolean |
|
14346 | 1148 |
self flagNamed:#hideOzFunctions put:aBoolean. |
9891 | 1149 |
|
1150 |
"Modified: / 05-05-2011 / 15:23:00 / cg" |
|
1151 |
! |
|
1152 |
||
1153 |
hideOzMethods |
|
14346 | 1154 |
^ self flagNamed:#hideOzMethods |
9891 | 1155 |
! |
1156 |
||
1157 |
hideOzMethods:aBoolean |
|
14346 | 1158 |
self flagNamed:#hideOzMethods put:aBoolean. |
9891 | 1159 |
|
1160 |
"Modified: / 05-05-2011 / 15:23:02 / cg" |
|
1161 |
! |
|
1162 |
||
1163 |
hidePythonClasses |
|
14346 | 1164 |
^ self flagNamed:#hidePythonClasses |
9891 | 1165 |
! |
1166 |
||
1167 |
hidePythonClasses:aBoolean |
|
14346 | 1168 |
self flagNamed:#hidePythonClasses put:aBoolean. |
9891 | 1169 |
|
1170 |
"Modified: / 05-05-2011 / 15:23:05 / cg" |
|
1171 |
! |
|
1172 |
||
1173 |
hidePythonFunctions |
|
14346 | 1174 |
^ self flagNamed:#hidePythonFunctions |
9891 | 1175 |
! |
1176 |
||
1177 |
hidePythonFunctions:aBoolean |
|
14346 | 1178 |
self flagNamed:#hidePythonFunctions put:aBoolean. |
9891 | 1179 |
|
1180 |
"Modified: / 05-05-2011 / 15:23:07 / cg" |
|
1181 |
! |
|
1182 |
||
1183 |
hidePythonMethods |
|
14346 | 1184 |
^ self flagNamed:#hidePythonMethods |
9891 | 1185 |
! |
1186 |
||
1187 |
hidePythonMethods:aBoolean |
|
14346 | 1188 |
self flagNamed:#hidePythonMethods put:aBoolean. |
9891 | 1189 |
|
1190 |
"Modified: / 05-05-2011 / 15:23:09 / cg" |
|
1191 |
! |
|
1192 |
||
1193 |
hideStatic |
|
14346 | 1194 |
^ self flagNamed:#hideStatic |
9891 | 1195 |
! |
1196 |
||
1197 |
hideStatic:aBoolean |
|
14346 | 1198 |
self flagNamed:#hideStatic put:aBoolean. |
9891 | 1199 |
|
1200 |
"Modified: / 05-05-2011 / 15:23:11 / cg" |
|
1201 |
! |
|
1202 |
||
1203 |
hideStructMembers |
|
14346 | 1204 |
^ self flagNamed:#hideStructMembers |
9891 | 1205 |
! |
1206 |
||
1207 |
hideStructMembers:aBoolean |
|
14346 | 1208 |
self flagNamed:#hideStructMembers put:aBoolean. |
9891 | 1209 |
|
1210 |
"Modified: / 05-05-2011 / 15:23:15 / cg" |
|
1211 |
! |
|
1212 |
||
1213 |
hideStructures |
|
14346 | 1214 |
^ self flagNamed:#hideStructures |
9891 | 1215 |
! |
1216 |
||
1217 |
hideStructures:aBoolean |
|
14346 | 1218 |
self flagNamed:#hideStructures put:aBoolean. |
9891 | 1219 |
|
1220 |
"Modified: / 05-05-2011 / 15:23:17 / cg" |
|
1221 |
! |
|
1222 |
||
1223 |
hideTextLabels |
|
14346 | 1224 |
^ self flagNamed:#hideTextLabels |
9891 | 1225 |
! |
1226 |
||
1227 |
hideTextLabels:aBoolean |
|
14346 | 1228 |
self flagNamed:#hideTextLabels put:aBoolean. |
9891 | 1229 |
|
1230 |
"Modified: / 05-05-2011 / 15:23:19 / cg" |
|
1231 |
! |
|
1232 |
||
1233 |
hideTypedefs |
|
14346 | 1234 |
^ self flagNamed:#hideTypedefs |
9891 | 1235 |
! |
1236 |
||
1237 |
hideTypedefs:aBoolean |
|
14346 | 1238 |
self flagNamed:#hideTypedefs put:aBoolean. |
9891 | 1239 |
|
1240 |
"Modified: / 05-05-2011 / 15:23:21 / cg" |
|
1241 |
! |
|
1242 |
||
1243 |
hideVariables |
|
14346 | 1244 |
^ self flagNamed:#hideVariables |
9891 | 1245 |
! |
1246 |
||
1247 |
hideVariables:aBoolean |
|
14346 | 1248 |
self flagNamed:#hideVariables put:aBoolean. |
9891 | 1249 |
|
1250 |
"Modified: / 05-05-2011 / 15:23:23 / cg" |
|
1251 |
! |
|
1252 |
||
1253 |
javaClassesAndMethodsOnly |
|
1254 |
^ showOnly == #javaClassesAndMethods |
|
1255 |
||
1256 |
"Modified: / 07-06-2010 / 14:18:25 / cg" |
|
1257 |
! |
|
1258 |
||
1259 |
javaClassesAndMethodsOnly:aBoolean |
|
1260 |
showOnly := nil. |
|
1261 |
aBoolean ifTrue:[ |
|
1262 |
showOnly := DefaultShowOnly := #javaClassesAndMethods |
|
1263 |
]. |
|
1264 |
||
1265 |
"Modified: / 05-05-2011 / 15:23:25 / cg" |
|
1266 |
! |
|
1267 |
||
1268 |
javaClassesOnly |
|
1269 |
^ showOnly == #javaClasses |
|
1270 |
||
1271 |
"Modified: / 07-06-2010 / 14:18:28 / cg" |
|
1272 |
! |
|
1273 |
||
1274 |
javaClassesOnly:aBoolean |
|
1275 |
showOnly := nil. |
|
1276 |
aBoolean ifTrue:[ |
|
1277 |
showOnly := DefaultShowOnly := #javaClasses |
|
1278 |
]. |
|
1279 |
||
1280 |
"Modified: / 05-05-2011 / 15:23:29 / cg" |
|
1281 |
! |
|
1282 |
||
1283 |
javaMethodsOnly |
|
1284 |
^ showOnly == #javaMethods |
|
1285 |
||
1286 |
"Modified: / 07-06-2010 / 14:18:30 / cg" |
|
1287 |
! |
|
1288 |
||
1289 |
javaMethodsOnly:aBoolean |
|
1290 |
showOnly := nil. |
|
1291 |
aBoolean ifTrue:[ |
|
1292 |
showOnly := DefaultShowOnly := #javaMethods |
|
1293 |
]. |
|
1294 |
||
1295 |
"Modified: / 05-05-2011 / 15:23:31 / cg" |
|
1296 |
! |
|
1297 |
||
1298 |
macrosOnly |
|
1299 |
^ showOnly == #macros |
|
1300 |
||
1301 |
"Created: / 07-06-2010 / 12:09:22 / cg" |
|
1302 |
"Modified: / 07-06-2010 / 14:18:33 / cg" |
|
1303 |
! |
|
1304 |
||
1305 |
macrosOnly:aBoolean |
|
1306 |
showOnly := nil. |
|
1307 |
aBoolean ifTrue:[ |
|
1308 |
showOnly := DefaultShowOnly := #macros |
|
1309 |
]. |
|
1310 |
||
1311 |
"Created: / 07-06-2010 / 12:09:34 / cg" |
|
1312 |
"Modified: / 05-05-2011 / 15:23:33 / cg" |
|
1313 |
! |
|
1314 |
||
1315 |
methodsOnly |
|
1316 |
^ showOnly == #methods |
|
1317 |
||
1318 |
"Created: / 07-06-2010 / 12:12:26 / cg" |
|
1319 |
"Modified: / 07-06-2010 / 14:18:38 / cg" |
|
1320 |
! |
|
1321 |
||
1322 |
methodsOnly:aBoolean |
|
1323 |
showOnly := nil. |
|
1324 |
aBoolean ifTrue:[ |
|
1325 |
showOnly := DefaultShowOnly := #methods |
|
1326 |
]. |
|
1327 |
||
1328 |
"Created: / 07-06-2010 / 12:12:30 / cg" |
|
1329 |
"Modified: / 05-05-2011 / 15:23:35 / cg" |
|
1330 |
! |
|
1331 |
||
1332 |
ozClassesOnly |
|
1333 |
^ showOnly == #ozClasses |
|
1334 |
||
1335 |
"Modified: / 07-06-2010 / 14:18:41 / cg" |
|
1336 |
! |
|
1337 |
||
1338 |
ozClassesOnly:aBoolean |
|
1339 |
showOnly := nil. |
|
1340 |
aBoolean ifTrue:[ |
|
1341 |
showOnly := DefaultShowOnly := #ozClasses |
|
1342 |
]. |
|
1343 |
||
1344 |
"Modified: / 05-05-2011 / 15:23:38 / cg" |
|
1345 |
! |
|
1346 |
||
1347 |
ozFunctionsOnly |
|
1348 |
^ showOnly == #ozFunctions |
|
1349 |
||
1350 |
"Modified: / 07-06-2010 / 14:18:44 / cg" |
|
1351 |
! |
|
1352 |
||
1353 |
ozFunctionsOnly:aBoolean |
|
1354 |
showOnly := nil. |
|
1355 |
aBoolean ifTrue:[ |
|
1356 |
showOnly := DefaultShowOnly := #ozFunctions |
|
1357 |
]. |
|
1358 |
self updateContentsFromRawList. |
|
1359 |
||
1360 |
"Modified: / 05-05-2011 / 15:18:51 / cg" |
|
1361 |
! |
|
1362 |
||
1363 |
ozMethodsOnly |
|
1364 |
^ showOnly == #ozMethods |
|
1365 |
||
1366 |
"Modified: / 07-06-2010 / 14:18:47 / cg" |
|
1367 |
! |
|
1368 |
||
1369 |
ozMethodsOnly:aBoolean |
|
1370 |
showOnly := nil. |
|
1371 |
aBoolean ifTrue:[ |
|
1372 |
showOnly := DefaultShowOnly := #ozMethods |
|
1373 |
]. |
|
1374 |
||
1375 |
"Modified: / 05-05-2011 / 15:23:44 / cg" |
|
1376 |
! |
|
1377 |
||
1378 |
pythonClassesOnly |
|
1379 |
^ showOnly == #pythonClasses |
|
1380 |
||
1381 |
"Modified: / 07-06-2010 / 14:18:52 / cg" |
|
1382 |
! |
|
1383 |
||
1384 |
pythonClassesOnly:aBoolean |
|
1385 |
showOnly := nil. |
|
1386 |
aBoolean ifTrue:[ |
|
1387 |
showOnly := DefaultShowOnly := #pythonClasses |
|
1388 |
]. |
|
1389 |
||
1390 |
"Modified: / 05-05-2011 / 15:23:46 / cg" |
|
1391 |
! |
|
1392 |
||
1393 |
pythonFunctionsOnly |
|
1394 |
^ showOnly == #pythonFunctions |
|
1395 |
||
1396 |
"Modified: / 07-06-2010 / 14:18:55 / cg" |
|
1397 |
! |
|
1398 |
||
1399 |
pythonFunctionsOnly:aBoolean |
|
1400 |
showOnly := nil. |
|
1401 |
aBoolean ifTrue:[ |
|
1402 |
showOnly := DefaultShowOnly := #pythonFunctions |
|
1403 |
]. |
|
1404 |
||
1405 |
"Modified: / 05-05-2011 / 15:23:48 / cg" |
|
1406 |
! |
|
1407 |
||
1408 |
pythonMethodsOnly |
|
1409 |
^ showOnly == #pythonMethods |
|
1410 |
||
1411 |
"Modified: / 07-06-2010 / 14:18:58 / cg" |
|
1412 |
! |
|
1413 |
||
1414 |
pythonMethodsOnly:aBoolean |
|
1415 |
showOnly := nil. |
|
1416 |
aBoolean ifTrue:[ |
|
1417 |
showOnly := DefaultShowOnly := #pythonMethods |
|
1418 |
]. |
|
1419 |
||
1420 |
"Modified: / 05-05-2011 / 15:23:51 / cg" |
|
1421 |
! |
|
1422 |
||
1423 |
showOnly |
|
1424 |
tagTypesPresent == false ifTrue:[ |
|
1425 |
^ nil "/ showing everything |
|
1426 |
]. |
|
1427 |
^ showOnly "? DefaultShowOnly" |
|
1428 |
||
1429 |
"Modified: / 20-06-2010 / 01:44:13 / cg" |
|
1430 |
! |
|
1431 |
||
1432 |
showOnly:aSymbol |
|
1433 |
showOnly := aSymbol |
|
1434 |
||
1435 |
"Modified: / 05-05-2011 / 15:23:55 / cg" |
|
1436 |
! |
|
1437 |
||
1438 |
structsOnly |
|
1439 |
^ showOnly == #structs |
|
1440 |
||
1441 |
"Created: / 25-06-2010 / 10:42:27 / cg" |
|
1442 |
! |
|
1443 |
||
1444 |
structsOnly:aBoolean |
|
1445 |
showOnly := DefaultShowOnly := nil. |
|
1446 |
aBoolean ifTrue:[ |
|
1447 |
showOnly := "DefaultShowOnly :=" #structs |
|
1448 |
]. |
|
1449 |
||
1450 |
"Created: / 25-06-2010 / 10:42:39 / cg" |
|
1451 |
"Modified: / 05-05-2011 / 15:23:58 / cg" |
|
1452 |
! |
|
1453 |
||
1454 |
targetsOnly |
|
1455 |
^ showOnly == #targets |
|
1456 |
||
1457 |
"Modified: / 07-06-2010 / 14:19:03 / cg" |
|
1458 |
! |
|
1459 |
||
1460 |
targetsOnly:aBoolean |
|
1461 |
showOnly := DefaultShowOnly := nil. |
|
1462 |
aBoolean ifTrue:[ |
|
1463 |
showOnly := DefaultShowOnly := #targets |
|
1464 |
]. |
|
1465 |
||
1466 |
"Modified: / 05-05-2011 / 15:24:02 / cg" |
|
1467 |
! |
|
1468 |
||
1469 |
typesOnly |
|
1470 |
^ showOnly == #types |
|
1471 |
||
1472 |
"Modified: / 07-06-2010 / 14:19:06 / cg" |
|
1473 |
! |
|
1474 |
||
1475 |
typesOnly:aBoolean |
|
1476 |
showOnly := DefaultShowOnly := nil. |
|
1477 |
aBoolean ifTrue:[ |
|
1478 |
showOnly := "DefaultShowOnly :=" #types |
|
1479 |
]. |
|
1480 |
||
1481 |
"Modified: / 05-05-2011 / 15:24:04 / cg" |
|
1482 |
! |
|
1483 |
||
1484 |
variablesOnly |
|
1485 |
^ showOnly == #variables |
|
1486 |
||
1487 |
"Modified: / 07-06-2010 / 14:19:09 / cg" |
|
1488 |
! |
|
1489 |
||
1490 |
variablesOnly:aBoolean |
|
1491 |
showOnly := nil. |
|
1492 |
aBoolean ifTrue:[ |
|
1493 |
showOnly := DefaultShowOnly := #variables |
|
1494 |
]. |
|
1495 |
||
1496 |
"Modified: / 05-05-2011 / 15:24:06 / cg" |
|
1497 |
! ! |
|
1498 |
||
1499 |
!TagList methodsFor:'accessing-presentation'! |
|
1500 |
||
1501 |
groupBy |
|
1502 |
^ groupBy |
|
1503 |
||
1504 |
"Created: / 05-05-2011 / 14:31:37 / cg" |
|
1505 |
"Modified: / 05-05-2011 / 15:34:14 / cg" |
|
1506 |
! |
|
1507 |
||
1508 |
groupBy:aSymbolOrNil |
|
1509 |
groupBy ~~ aSymbolOrNil ifTrue:[ |
|
1510 |
groupBy := DefaultGroupBy := aSymbolOrNil. |
|
1511 |
self updateContentsFromFilteredList |
|
1512 |
]. |
|
1513 |
||
1514 |
"Created: / 05-05-2011 / 14:32:00 / cg" |
|
1515 |
! |
|
1516 |
||
1517 |
groupedByType |
|
1518 |
^ self groupBy == #byType |
|
1519 |
||
1520 |
"Created: / 05-05-2011 / 14:32:53 / cg" |
|
1521 |
! |
|
1522 |
||
1523 |
groupedByType:aBoolean |
|
1524 |
aBoolean == true ifTrue:[ |
|
1525 |
self groupBy:#byType |
|
1526 |
] ifFalse:[ |
|
1527 |
self groupBy:nil |
|
1528 |
]. |
|
1529 |
||
1530 |
"Created: / 05-05-2011 / 14:33:05 / cg" |
|
1531 |
! |
|
1532 |
||
1533 |
sortCriteria |
|
1534 |
^ sortCriteria ? DefaultSortCriteria |
|
1535 |
! |
|
1536 |
||
1537 |
sortCriteria:aSymbolOrNil |
|
1538 |
sortCriteria ~~ aSymbolOrNil ifTrue:[ |
|
1539 |
sortCriteria := DefaultSortCriteria := aSymbolOrNil. |
|
1540 |
Sorted := sortCriteria. |
|
1541 |
self updateContentsFromFilteredList |
|
1542 |
]. |
|
1543 |
||
1544 |
"Modified: / 05-05-2011 / 14:50:18 / cg" |
|
1545 |
! |
|
1546 |
||
1547 |
sorted |
|
1548 |
"backward compatibility" |
|
1549 |
||
1550 |
^ self sortCriteria notNil |
|
1551 |
! |
|
1552 |
||
1553 |
sorted:aBoolean |
|
1554 |
"backward compatibility" |
|
1555 |
||
1556 |
aBoolean ifTrue:[ |
|
1557 |
self sortCriteria:#byName |
|
1558 |
] ifFalse:[ |
|
1559 |
self sortCriteria:nil |
|
1560 |
]. |
|
1561 |
! |
|
1562 |
||
1563 |
sortedByLineNumber |
|
1564 |
^ self sortCriteria isNil |
|
1565 |
or:[ self sortCriteria == #lineNumber ] |
|
1566 |
||
1567 |
"Modified: / 05-05-2011 / 14:30:33 / cg" |
|
1568 |
! |
|
1569 |
||
1570 |
sortedByLineNumber:aBoolean |
|
1571 |
aBoolean == true ifTrue:[ |
|
1572 |
self sortCriteria:#lineNumber |
|
1573 |
]. |
|
1574 |
||
1575 |
"Modified: / 27-06-2010 / 21:31:44 / cg" |
|
1576 |
! |
|
1577 |
||
1578 |
sortedByName |
|
1579 |
^ self sortCriteria == #byName |
|
1580 |
! |
|
1581 |
||
1582 |
sortedByName:aBoolean |
|
1583 |
aBoolean == true ifTrue:[ |
|
1584 |
self sortCriteria:#byName |
|
1585 |
]. |
|
1586 |
! |
|
1587 |
||
1588 |
sortedByNameIgnoringCase |
|
1589 |
^ self sortCriteria == #byNameIgnoringCase |
|
1590 |
! |
|
1591 |
||
1592 |
sortedByNameIgnoringCase:aBoolean |
|
1593 |
aBoolean == true ifTrue:[ |
|
1594 |
self sortCriteria:#byNameIgnoringCase |
|
1595 |
]. |
|
1596 |
! |
|
1597 |
||
1598 |
sortedByNameIgnoringLeadingUnderscores |
|
1599 |
^ self sortCriteria == #byNameIgnoringLeadingUnderscores |
|
1600 |
! |
|
1601 |
||
1602 |
sortedByNameIgnoringLeadingUnderscores:aBoolean |
|
1603 |
aBoolean == true ifTrue:[ |
|
1604 |
self sortCriteria:#byNameIgnoringLeadingUnderscores |
|
1605 |
]. |
|
1606 |
! |
|
1607 |
||
1608 |
sortedByNameIgnoringLeadingUnderscoresAndCase |
|
1609 |
^ self sortCriteria == #byNameIgnoringLeadingUnderscoresAndCase |
|
1610 |
! |
|
1611 |
||
1612 |
sortedByNameIgnoringLeadingUnderscoresAndCase:aBoolean |
|
1613 |
aBoolean == true ifTrue:[ |
|
1614 |
self sortCriteria:#byNameIgnoringLeadingUnderscoresAndCase |
|
1615 |
]. |
|
1616 |
! |
|
1617 |
||
1618 |
sortedByType |
|
1619 |
^ self sortCriteria == #byType |
|
1620 |
! |
|
1621 |
||
1622 |
sortedByType:aBoolean |
|
1623 |
aBoolean == true ifTrue:[ |
|
1624 |
self sortCriteria:#byType |
|
1625 |
]. |
|
1626 |
! |
|
1627 |
||
1628 |
tagTypesPresent |
|
1629 |
^ tagTypesPresent |
|
1630 |
! ! |
|
1631 |
||
14346 | 1632 |
!TagList methodsFor:'initialization'! |
1633 |
||
1634 |
initContents:n |
|
1635 |
"Invoked when a new instance is created." |
|
1636 |
||
1637 |
super initContents:n. |
|
14387 | 1638 |
flags isNil ifTrue:[ |
1639 |
flags := IdentityDictionary new. |
|
1640 |
]. |
|
14346 | 1641 |
! |
1642 |
||
1643 |
initialize |
|
1644 |
"Invoked when a new instance is created." |
|
1645 |
||
1646 |
flags := IdentityDictionary new. |
|
1647 |
! ! |
|
1648 |
||
9891 | 1649 |
!TagList methodsFor:'private'! |
1650 |
||
1651 |
applyFilterToList:aList |
|
14564 | 1652 |
|filters| |
1653 |
||
1654 |
filters := filter splitByAny:',;'. |
|
1655 |
filters size == 1 ifTrue:[ |
|
1656 |
filter includesMatchCharacters ifFalse:[ |
|
1657 |
^ aList select:[:tag | tag label includesString:filter caseSensitive:false] |
|
1658 |
]. |
|
11722
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1659 |
]. |
14564 | 1660 |
|
1661 |
^ aList |
|
1662 |
select:[:tag | |
|
1663 |
filters |
|
1664 |
contains:[:someFilter | |
|
1665 |
someFilter includesMatchCharacters ifTrue:[ |
|
1666 |
someFilter match:tag label caseSensitive:false |
|
1667 |
] ifFalse:[ |
|
1668 |
tag label includesString:someFilter caseSensitive:false |
|
1669 |
]. |
|
1670 |
]. |
|
1671 |
]. |
|
9891 | 1672 |
! |
1673 |
||
1674 |
getCtagsVersion |
|
1675 |
" parse major and minor version from ctags by operating system command |
|
1676 |
cehck for the 'Exuberant Ctags' string being present |
|
1677 |
return an Array with mafor and minor part of version or nil if not available" |
|
1678 |
||
1679 |
| stream string index majorVersion minorVersion indexOfPoint| |
|
1680 |
||
1681 |
stream := WriteStream on:''. |
|
1682 |
OperatingSystem |
|
1683 |
executeCommand:'ctags --version' |
|
1684 |
inputFrom:nil |
|
1685 |
outputTo:stream |
|
1686 |
errorTo:stream |
|
1687 |
inDirectory:nil |
|
1688 |
onError:[:status| false]. |
|
1689 |
string := stream contents. |
|
1690 |
index := string findString:'Exuberant Ctags' ifAbsent:[nil]. |
|
1691 |
index notNil ifTrue:[ |
|
15328 | 1692 |
string := (string copyFrom:(index + ('Exuberant Ctags' size))) asCollectionOfWords first. |
9891 | 1693 |
(string includes:$,) ifTrue:[ string := string copyTo:((string indexOf:$,) - 1)]. |
1694 |
indexOfPoint := string indexOf:$. ifAbsent:nil. |
|
1695 |
indexOfPoint notNil ifTrue:[ |
|
1696 |
majorVersion := (string copyFrom:1 to:indexOfPoint - 1) asInteger. |
|
1697 |
minorVersion := (string copyFrom:indexOfPoint + 1 to:string size) asInteger. |
|
1698 |
^ Array with:majorVersion with:minorVersion. |
|
1699 |
] |
|
1700 |
]. |
|
1701 |
^ nil |
|
1702 |
||
1703 |
"Modified: / 05-05-2011 / 14:48:08 / cg" |
|
1704 |
! |
|
1705 |
||
1706 |
setFilteredList:aList |
|
1707 |
filteredList := aList. |
|
1708 |
self updateContentsFromFilteredList |
|
1709 |
||
1710 |
"Created: / 05-05-2011 / 14:46:12 / cg" |
|
1711 |
! |
|
1712 |
||
1713 |
setRawList:aList |
|
1714 |
rawList := aList. |
|
1715 |
self updateContentsFromRawList |
|
1716 |
||
1717 |
"Created: / 05-05-2011 / 14:46:22 / cg" |
|
1718 |
! |
|
1719 |
||
1720 |
shellCommandFor:aFilenameString |
|
1721 |
"returns the shellCommand to be used" |
|
1722 |
||
11050 | 1723 |
|template| |
1724 |
||
1725 |
(template := self shellCommandTemplateFor:aFilenameString) isNil ifTrue:[ |
|
1726 |
^ nil |
|
1727 |
]. |
|
1728 |
^ template bindWith:aFilenameString |
|
1729 |
||
1730 |
"Modified: / 05-01-2012 / 11:10:03 / cg" |
|
1731 |
! |
|
1732 |
||
1733 |
shellCommandTemplateFor:aFilenameString |
|
12332 | 1734 |
"returns the shellCommand to be used (contains %1 for the filename). |
1735 |
When first called, looks for ctags (both a private and the system-supplied), |
|
1736 |
and tries to see what version that is. I prefer exuberant ctags version" |
|
11050 | 1737 |
|
16280 | 1738 |
|lcSuffix shellCommand isCSuffix isCPlusPlusSuffix isObjcSuffix |
1739 |
isJavaSuffix isEiffelSuffix isFortranSuffix |
|
12332 | 1740 |
isTCLSuffix isRubySuffix isPythonSuffix isPhpSuffix isJavaScriptSuffix |
12341 | 1741 |
showOnly response suff fn langValue langOption moreOptions| |
9891 | 1742 |
|
1743 |
ctagsCommand isNil ifTrue:[ |
|
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1744 |
remoteTarget isNil ifTrue:[ |
9891 | 1745 |
"/ local use |
1746 |
suff := (OperatingSystem isMSWINDOWSlike) ifTrue:'.exe' ifFalse:''. |
|
1747 |
||
14881 | 1748 |
ctagsCommand := 'ctags',suff. |
9891 | 1749 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
1750 |
ctagsCommand := fn pathName. |
|
1751 |
ctagsIsExCtags := ctagsIsExCtags5x := true. |
|
1752 |
] ifFalse:[ |
|
14881 | 1753 |
ctagsCommand := 'bin/ctags',suff. |
9891 | 1754 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
1755 |
ctagsCommand := fn pathName. |
|
14881 | 1756 |
ctagsIsExCtags := ctagsIsExCtags5x := true. |
9891 | 1757 |
] ifFalse:[ |
14881 | 1758 |
ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-5.8/ctags',suff. |
9891 | 1759 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
1760 |
ctagsCommand := fn pathName. |
|
14881 | 1761 |
ctagsIsExCtags := ctagsIsExCtags5x := true. |
9891 | 1762 |
] ifFalse:[ |
14881 | 1763 |
ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-3.2.2/ctags',suff. |
1764 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
|
1765 |
ctagsCommand := fn pathName. |
|
1766 |
ctagsIsExCtags := true. |
|
1767 |
ctagsIsExCtags5x := false. |
|
1768 |
] ifFalse:[ |
|
1769 |
ctagsIsExCtags := nil. |
|
1770 |
ctagsIsExCtags5x := nil. |
|
1771 |
ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags/ctags',suff. |
|
1772 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
|
1773 |
ctagsCommand := fn pathName. |
|
1774 |
] ifFalse:[ |
|
1775 |
"/ use systems default ctags command |
|
1776 |
ctagsCommand := 'ctags'. |
|
1777 |
] |
|
1778 |
] |
|
1779 |
]. |
|
9891 | 1780 |
] |
14881 | 1781 |
] |
9891 | 1782 |
] ifFalse:[ |
1783 |
"/ cross-development |
|
1784 |
"/ target remoteOperatingSystem = 'Linux' ifTrue:[ |
|
1785 |
"/ use systems default ctags command |
|
1786 |
ctagsCommand := 'ctags'. |
|
1787 |
ctagsIsExCtags := nil. |
|
1788 |
ctagsIsExCtags5x := nil. |
|
1789 |
"/ ] |
|
1790 |
]. |
|
1791 |
]. |
|
1792 |
||
1793 |
(ctagsIsExCtags isNil or:[ctagsIsExCtags5x isNil]) ifTrue:[ |
|
1794 |
ctagsCommand notNil ifTrue:[ |
|
1795 |
response := OperatingSystem getCommandOutputFrom:(ctagsCommand, ' --version'). |
|
1796 |
(response notNil |
|
1797 |
and:[response asLowercase startsWith:'exuberant ctags']) ifTrue:[ |
|
1798 |
ctagsIsExCtags := true. |
|
1799 |
||
1800 |
response := (response copyFrom:'exuberant ctags' size + 1) withoutSeparators. |
|
1801 |
ctagsIsExCtags5x := response startsWith:'5.' |
|
1802 |
]. |
|
1803 |
]. |
|
1804 |
]. |
|
1805 |
||
12344 | 1806 |
ctagsIsExCtags5x ifTrue:[ |
1807 |
langOption := '--language-force=%1'. |
|
1808 |
] ifFalse:[ ctagsIsExCtags ifTrue:[ |
|
1809 |
langOption := '--lang=%1'. |
|
1810 |
]]. |
|
1811 |
||
9891 | 1812 |
shellCommand := ctagsCommand. |
1813 |
(shellCommand includes:Character space) ifTrue:[ |
|
1814 |
shellCommand := '"',shellCommand,'"'. |
|
1815 |
]. |
|
12341 | 1816 |
moreOptions := ''. |
9891 | 1817 |
|
1818 |
showOnly := self showOnly. |
|
1819 |
||
1820 |
lcSuffix := aFilenameString asFilename suffix asLowercase. |
|
1821 |
isCSuffix := self class isCSuffix:lcSuffix. |
|
12344 | 1822 |
|
1823 |
"/ a hack for temporary files generated by stc |
|
1824 |
lcSuffix = 'sc' ifTrue:[ |
|
1825 |
(aFilenameString asFilename asAbsoluteFilename components includes:'stx') ifTrue:[ |
|
1826 |
isCSuffix := true |
|
1827 |
]. |
|
1828 |
]. |
|
9891 | 1829 |
isCPlusPlusSuffix := self class isCPlusPlusSuffix:lcSuffix. |
16280 | 1830 |
isObjcSuffix := self class isObjcSuffix:lcSuffix. |
9891 | 1831 |
|
1832 |
(shellCommand notNil and:[(ctagsIsExCtags ? false)]) ifTrue:[ |
|
1833 |
isJavaSuffix := self class isJavaSuffix:lcSuffix. |
|
1834 |
isEiffelSuffix := self class isEiffelSuffix:lcSuffix. |
|
1835 |
isFortranSuffix := self class isFortranSuffix:lcSuffix. |
|
1836 |
||
1837 |
"/ ex_ctags supports c, c++, java, fortran and a few others |
|
16280 | 1838 |
(isCSuffix or:[isCPlusPlusSuffix or:[isObjcSuffix |
1839 |
or:[isJavaSuffix or:[isEiffelSuffix or:[isFortranSuffix]]]]]) ifFalse:[ |
|
9891 | 1840 |
(ctagsIsExCtags5x ? false) ifFalse:[ |
1841 |
^ nil |
|
1842 |
]. |
|
12332 | 1843 |
|
1844 |
"/ ex_ctags5.x also supports: |
|
1845 |
"/ Assembler, AWK, ASP, BETA, |
|
1846 |
"/ Bourne/Korn/Z Shell, C, C++, C#, COBOL, Eiffel, Erlang, Fortran, Java, Lisp, |
|
1847 |
"/ Lua, Makefile, Pascal, Perl, PHP, PL/SQL, Python, REXX, Ruby, Scheme, |
|
1848 |
"/ S-Lang, SML (Standard ML), Tcl, Vera, Verilog, VHDL, Vim, and YACC. |
|
9891 | 1849 |
]. |
12332 | 1850 |
isTCLSuffix := self class isTCLSuffix:lcSuffix. |
1851 |
isRubySuffix := self class isRubySuffix:lcSuffix. |
|
1852 |
isPythonSuffix := self class isPythonSuffix:lcSuffix. |
|
1853 |
isPhpSuffix := self class isPhpSuffix:lcSuffix. |
|
1854 |
isJavaScriptSuffix := self class isJavaScriptSuffix:lcSuffix. |
|
9891 | 1855 |
|
1856 |
usingDefaultCTags := false. |
|
1857 |
shellCommand := shellCommand asFilename asAbsoluteFilename pathName. |
|
1858 |
"/ shellCommand := shellCommand, ' -f - --c-types=f --file-scope=no'. |
|
1859 |
"/ shellCommand := shellCommand, ' -f - --file-scope=yes'. |
|
1860 |
"/ shellCommand := shellCommand, ' -f - --file-scope=yes'. |
|
1861 |
shellCommand := shellCommand, ' -f - --file-scope=yes --excmd=number'. |
|
1862 |
||
16280 | 1863 |
(isCSuffix or:[isCPlusPlusSuffix or:[isObjcSuffix]]) ifTrue:[ |
9891 | 1864 |
isCPlusPlusSuffix |
12341 | 1865 |
ifTrue:[ langValue := 'c++'] |
1866 |
ifFalse:[ langValue := 'c']. |
|
9891 | 1867 |
|
1868 |
showOnly == #classes ifTrue:[ |
|
12341 | 1869 |
moreOptions := moreOptions, ' --c-types=c' |
9891 | 1870 |
] ifFalse:[ |
1871 |
showOnly == #functions ifTrue:[ |
|
12341 | 1872 |
moreOptions := moreOptions, ' --c-types=f' |
9891 | 1873 |
] ifFalse:[ |
1874 |
showOnly == #functionsAndVariables ifTrue:[ |
|
12341 | 1875 |
moreOptions := moreOptions, ' --c-types=fv' |
9891 | 1876 |
] ifFalse:[ |
1877 |
showOnly == #classesFunctionsAndVariables ifTrue:[ |
|
12341 | 1878 |
moreOptions := moreOptions, ' --c-types=cfv' |
9891 | 1879 |
] ifFalse:[ |
1880 |
showOnly == #variables ifTrue:[ |
|
12341 | 1881 |
moreOptions := moreOptions, ' --c-types=v' |
9891 | 1882 |
] ifFalse:[ |
1883 |
showOnly == #types ifTrue:[ |
|
12341 | 1884 |
moreOptions := moreOptions, ' --c-types=t' |
9891 | 1885 |
] |
1886 |
] |
|
1887 |
] |
|
1888 |
] |
|
1889 |
] |
|
1890 |
]. |
|
14346 | 1891 |
self hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m']. |
1892 |
self hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ]. |
|
1893 |
self hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ]. |
|
1894 |
self hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s']. |
|
1895 |
self hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v']. |
|
1896 |
self hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f']. |
|
1897 |
self hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c']. |
|
9891 | 1898 |
]. |
12332 | 1899 |
|
9891 | 1900 |
isJavaSuffix ifTrue:[ |
12341 | 1901 |
langValue := 'java'. |
9891 | 1902 |
|
1903 |
showOnly == #javaClasses ifTrue:[ |
|
12341 | 1904 |
moreOptions := moreOptions, ' --java-types=c' |
9891 | 1905 |
] ifFalse:[ |
1906 |
showOnly == #javaMethods ifTrue:[ |
|
12341 | 1907 |
moreOptions := moreOptions, ' --java-types=m' |
9891 | 1908 |
] ifFalse:[ |
1909 |
showOnly == #javaClassesAndMethods ifTrue:[ |
|
12341 | 1910 |
moreOptions := moreOptions, ' --java-types=mc' |
9891 | 1911 |
] |
1912 |
] |
|
1913 |
]. |
|
14346 | 1914 |
self hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ]. |
1915 |
self hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ]. |
|
1916 |
self hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ]. |
|
1917 |
self hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ]. |
|
1918 |
self hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ]. |
|
9891 | 1919 |
]. |
12332 | 1920 |
|
9891 | 1921 |
isEiffelSuffix ifTrue:[ |
12341 | 1922 |
langValue := 'eiffel'. |
9891 | 1923 |
|
12332 | 1924 |
showOnly == #classes ifTrue:[ |
12341 | 1925 |
moreOptions := moreOptions, ' --eiffel-types=c' |
9891 | 1926 |
] ifFalse:[ |
1927 |
showOnly == #features ifTrue:[ |
|
12341 | 1928 |
moreOptions := moreOptions, ' --eiffel-types=f' |
9891 | 1929 |
] |
1930 |
]. |
|
1931 |
"/ hideEiffelClasses == true ifTrue:[ |
|
12341 | 1932 |
"/ moreOptions := moreOptions, ' --eiffel-types=-c' |
9891 | 1933 |
"/ ]. |
1934 |
"/ hideEiffelFeatures == true ifTrue:[ |
|
12341 | 1935 |
"/ moreOptions := moreOptions, ' --eiffel-types=-m' |
9891 | 1936 |
"/ ]. |
1937 |
]. |
|
1938 |
||
1939 |
isFortranSuffix ifTrue:[ |
|
12341 | 1940 |
langValue := 'fortran'. |
9891 | 1941 |
|
1942 |
showOnly == #functions ifTrue:[ |
|
12341 | 1943 |
moreOptions := moreOptions, ' --fortran-types=f' |
9891 | 1944 |
] ifFalse:[ |
1945 |
showOnly == #interfaces ifTrue:[ |
|
12341 | 1946 |
moreOptions := moreOptions, ' --fortran-types=i' |
9891 | 1947 |
] ifFalse:[ |
1948 |
showOnly == #subroutines ifTrue:[ |
|
12341 | 1949 |
moreOptions := moreOptions, ' --fortran-types=s' |
9891 | 1950 |
] ifFalse:[ |
1951 |
showOnly == #commonBlocks == true ifTrue:[ |
|
12341 | 1952 |
moreOptions := moreOptions, ' --fortran-types=c' |
9891 | 1953 |
] |
1954 |
] |
|
1955 |
] |
|
1956 |
]. |
|
1957 |
"/ hideFortranFunctions == true ifTrue:[ |
|
12341 | 1958 |
"/ moreOptions := moreOptions, ' --fortran-types=-f' |
9891 | 1959 |
"/ ]. |
1960 |
"/ hideFortranInterfaces == true ifTrue:[ |
|
12341 | 1961 |
"/ moreOptions := moreOptions, ' --fortran-types=-i' |
9891 | 1962 |
"/ ]. |
1963 |
"/ hideFortranSubroutines == true ifTrue:[ |
|
12341 | 1964 |
"/ moreOptions := moreOptions, ' --fortran-types=-s' |
9891 | 1965 |
"/ ]. |
1966 |
"/ hideFortranCommonBlocks == true ifTrue:[ |
|
12341 | 1967 |
"/ moreOptions := moreOptions, ' --fortran-types=-c' |
9891 | 1968 |
"/ ]. |
1969 |
"/ hideFortranEntryPoints == true ifTrue:[ |
|
12341 | 1970 |
"/ moreOptions := moreOptions, ' --fortran-types=-e' |
9891 | 1971 |
"/ ]. |
1972 |
"/ hideFortranLabels == true ifTrue:[ |
|
12341 | 1973 |
"/ moreOptions := moreOptions, ' --fortran-types=-l' |
9891 | 1974 |
"/ ]. |
1975 |
"/ hideFortranDerivedTypes == true ifTrue:[ |
|
12341 | 1976 |
"/ moreOptions := moreOptions, ' --fortran-types=-t' |
9891 | 1977 |
"/ ]. |
1978 |
]. |
|
1979 |
||
1980 |
"/ shellCommand := shellCommand, ' -f -'. |
|
12341 | 1981 |
langValue notNil ifTrue:[ |
1982 |
langOption notNil ifTrue:[ |
|
1983 |
shellCommand := shellCommand , ' ' , (langOption bindWith:langValue) |
|
1984 |
]. |
|
1985 |
]. |
|
1986 |
moreOptions notEmptyOrNil ifTrue:[ |
|
1987 |
shellCommand := shellCommand , moreOptions |
|
1988 |
]. |
|
11050 | 1989 |
shellCommand := shellCommand, ' "%1"'. |
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1990 |
remoteTarget notNil ifTrue:[ |
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1991 |
^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./'). |
9891 | 1992 |
]. |
1993 |
^ shellCommand. |
|
1994 |
]. |
|
1995 |
||
1996 |
"/ regular ctags: assume supports c, c++ only |
|
1997 |
isCSuffix ifFalse:[ |
|
1998 |
^ nil |
|
1999 |
]. |
|
2000 |
||
15241 | 2001 |
usingDefaultCTags := true. |
9891 | 2002 |
|
2003 |
shellCommand := 'ctags'. |
|
2004 |
||
2005 |
"/ "sunos and realIX have no option -s" |
|
2006 |
"/ (OperatingSystem getOSType = 'linux') ifTrue:[ |
|
2007 |
"/ shellCommand := 'ctags -S' |
|
2008 |
"/ ]. |
|
15240 | 2009 |
Transcript showCR:('TagList [info]: using default ctags command (not ctags from stx): <', shellCommand, '>'). |
9891 | 2010 |
ctagsCommand := nil. "/ flush - so we will check again. |
2011 |
||
11050 | 2012 |
shellCommand := shellCommand, ' "%1"'. |
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
2013 |
remoteTarget notNil ifTrue:[ |
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
2014 |
^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./'). |
9891 | 2015 |
]. |
2016 |
^ shellCommand |
|
2017 |
||
2018 |
"Modified: / 08-07-2010 / 00:23:24 / cg" |
|
11050 | 2019 |
"Created: / 05-01-2012 / 11:07:41 / cg" |
9891 | 2020 |
! |
2021 |
||
2022 |
sortBlock |
|
2023 |
"sort AND group" |
|
2024 |
||
2025 |
|sortBlock| |
|
2026 |
||
2027 |
sortCriteria := self sortCriteria. |
|
2028 |
sortBlock := self sortBlockForSortCriteria. |
|
2029 |
||
2030 |
groupBy isNil ifTrue:[ |
|
2031 |
^ sortBlock |
|
2032 |
]. |
|
2033 |
||
2034 |
^ [:a :b| |
|
2035 |
|t1 t2 l1 l2| |
|
2036 |
||
2037 |
t1 := a typeIdentifierInList ? ' '. |
|
2038 |
t2 := b typeIdentifierInList ? ' '. |
|
2039 |
t1 = t2 ifTrue:[ |
|
2040 |
sortBlock value:a value:b |
|
2041 |
] ifFalse:[ |
|
2042 |
t1 < t2 |
|
2043 |
] |
|
2044 |
]. |
|
2045 |
||
2046 |
"Modified: / 05-05-2011 / 15:35:02 / cg" |
|
2047 |
! |
|
2048 |
||
2049 |
sortBlockForSortCriteria |
|
2050 |
sortCriteria == #byName ifTrue:[ |
|
2051 |
^ [:a :b| |
|
2052 |
|l1 l2| |
|
2053 |
||
9939
b9bfde3e776b
changed: #sortBlockForSortCriteria
Claus Gittinger <cg@exept.de>
parents:
9921
diff
changeset
|
2054 |
l1 := a label ? ''. |
b9bfde3e776b
changed: #sortBlockForSortCriteria
Claus Gittinger <cg@exept.de>
parents:
9921
diff
changeset
|
2055 |
l2 := b label ? ''. |
9891 | 2056 |
l1 = l2 ifTrue:[ |
2057 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
2058 |
] ifFalse:[ |
|
2059 |
l1 < l2 |
|
2060 |
] |
|
2061 |
] |
|
2062 |
]. |
|
2063 |
||
2064 |
sortCriteria == #byNameIgnoringCase ifTrue:[ |
|
2065 |
^ [:a :b| |
|
2066 |
|l1 l2| |
|
2067 |
||
2068 |
l1 := a label asLowercase. |
|
2069 |
l2 := b label asLowercase. |
|
2070 |
l1 = l2 ifTrue:[ |
|
2071 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
2072 |
] ifFalse:[ |
|
2073 |
l1 < l2 |
|
2074 |
] |
|
2075 |
] |
|
2076 |
]. |
|
2077 |
||
2078 |
sortCriteria == #byNameIgnoringLeadingUnderscores ifTrue:[ |
|
2079 |
^ [:a :b| |
|
2080 |
|l1 l2 i| |
|
2081 |
||
2082 |
l1 := a label. |
|
2083 |
l2 := b label. |
|
2084 |
l1 = l2 ifTrue:[ |
|
2085 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
2086 |
] ifFalse:[ |
|
2087 |
i := l1 findFirst:[:c | (c ~~ $_)]. |
|
2088 |
i > 1 ifTrue:[ |
|
2089 |
l1 := l1 copyFrom:i |
|
2090 |
]. |
|
2091 |
i := l2 findFirst:[:c | (c ~~ $_)]. |
|
2092 |
i > 1 ifTrue:[ |
|
2093 |
l2 := l2 copyFrom:i |
|
2094 |
]. |
|
2095 |
l1 < l2 |
|
2096 |
] |
|
2097 |
]. |
|
2098 |
]. |
|
2099 |
||
2100 |
sortCriteria == #byNameIgnoringLeadingUnderscoresAndCase ifTrue:[ |
|
2101 |
^ [:a :b| |
|
2102 |
|l1 l2 i| |
|
2103 |
||
2104 |
l1 := a label asLowercase. |
|
2105 |
l2 := b label asLowercase. |
|
2106 |
l1 = l2 ifTrue:[ |
|
2107 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
2108 |
] ifFalse:[ |
|
2109 |
i := l1 findFirst:[:c | (c ~~ $_)]. |
|
2110 |
i > 1 ifTrue:[ |
|
2111 |
l1 := l1 copyFrom:i |
|
2112 |
]. |
|
2113 |
i := l2 findFirst:[:c | (c ~~ $_)]. |
|
2114 |
i > 1 ifTrue:[ |
|
2115 |
l2 := l2 copyFrom:i |
|
2116 |
]. |
|
2117 |
l1 < l2 |
|
2118 |
] |
|
2119 |
]. |
|
2120 |
]. |
|
2121 |
||
2122 |
"/ sortCriteria == #byType ifTrue:[ |
|
2123 |
"/ ^ [:a :b| |
|
2124 |
"/ |t1 t2 l1 l2| |
|
2125 |
"/ t1 := a typeIdentifierInList ? ' '. |
|
2126 |
"/ t2 := b typeIdentifierInList ? ' '. |
|
2127 |
"/ t1 = t2 ifTrue:[ |
|
2128 |
"/ l1 := a label. |
|
2129 |
"/ l2 := b label. |
|
2130 |
"/ l1 = l2 ifTrue:[ |
|
2131 |
"/ (a lineNumber ? 0) < (b lineNumber ? 0) |
|
2132 |
"/ ] ifFalse:[ |
|
2133 |
"/ l1 < l2 |
|
2134 |
"/ ] |
|
2135 |
"/ ] ifFalse:[ |
|
2136 |
"/ t1 < t2 |
|
2137 |
"/ ] |
|
2138 |
"/ ]. |
|
2139 |
"/ ]. |
|
2140 |
||
2141 |
^ [:a :b| a lineNumber < b lineNumber ] |
|
2142 |
||
2143 |
"Created: / 05-05-2011 / 14:37:25 / cg" |
|
9939
b9bfde3e776b
changed: #sortBlockForSortCriteria
Claus Gittinger <cg@exept.de>
parents:
9921
diff
changeset
|
2144 |
"Modified: / 18-06-2011 / 19:30:45 / cg" |
9891 | 2145 |
! |
2146 |
||
2147 |
updateContentsFromFilteredList |
|
2148 |
"call this, if only the sort order has changed (no need to call ctags or filter again)" |
|
2149 |
||
2150 |
|list| |
|
2151 |
||
2152 |
list := filteredList. |
|
2153 |
list notEmptyOrNil ifTrue:[ |
|
2154 |
list := list asSortedCollection:(self sortBlock). |
|
2155 |
]. |
|
2156 |
self contents:(list ? #()). |
|
2157 |
||
2158 |
"Created: / 05-05-2011 / 14:45:41 / cg" |
|
2159 |
! |
|
2160 |
||
2161 |
updateContentsFromRawList |
|
2162 |
"call this, if only the filter has changed (no need to call ctags again)" |
|
2163 |
||
2164 |
filteredList := (filter isEmptyOrNil or:[rawList isNil]) |
|
2165 |
ifTrue:[ rawList ] |
|
2166 |
ifFalse:[ self applyFilterToList:rawList ]. |
|
13634 | 2167 |
filteredList notNil ifTrue:[ |
14346 | 2168 |
self hideFunctions == true ifTrue:[ |
13634 | 2169 |
filteredList := filteredList reject:[:tag | tag isFunctionTag]. |
2170 |
] ifFalse:[ |
|
2171 |
showOnly == #functions ifTrue:[ |
|
14433 | 2172 |
filteredList := filteredList select:[:tag | tag isFunctionOrMethodTag]. |
13634 | 2173 |
]. |
13631 | 2174 |
]. |
2175 |
]. |
|
9891 | 2176 |
self updateContentsFromFilteredList |
2177 |
||
2178 |
"Modified: / 05-05-2011 / 15:13:14 / cg" |
|
2179 |
! ! |
|
2180 |
||
2181 |
!TagList methodsFor:'queries'! |
|
2182 |
||
2183 |
bestTagForLine:lineNr |
|
14478 | 2184 |
"find the best tag for a given lineNr in the file" |
2185 |
||
2186 |
^ self bestTagForLine:lineNr filtering:nil |
|
2187 |
! |
|
2188 |
||
2189 |
bestTagForLine:lineNr filtering:tagFilterOrNil |
|
14479 | 2190 |
"find the best tag for a given lineNr in the file. |
2191 |
The filter can be used eg. to find only function tags |
|
2192 |
(i.e. to ignore case and goto labels in C)" |
|
14478 | 2193 |
|
9891 | 2194 |
|bestTag sortedByLineNumber| |
2195 |
||
2196 |
sortedByLineNumber := self sortedByLineNumber. |
|
2197 |
self do:[:eachTag | |
|
2198 |
eachTag notNil ifTrue:[ |
|
14478 | 2199 |
(tagFilterOrNil isNil or:[tagFilterOrNil value:eachTag]) ifTrue:[ |
2200 |
eachTag lineNumber <= lineNr ifTrue:[ |
|
2201 |
bestTag isNil ifTrue:[ |
|
2202 |
bestTag := eachTag. |
|
2203 |
"/ sortedByLineNumber ifTrue:[^ eachTag]. |
|
2204 |
] ifFalse:[ |
|
2205 |
eachTag lineNumber > bestTag lineNumber ifTrue:[ |
|
2206 |
bestTag := eachTag |
|
2207 |
] |
|
9891 | 2208 |
] |
14478 | 2209 |
]. |
9891 | 2210 |
]. |
2211 |
]. |
|
2212 |
]. |
|
2213 |
||
2214 |
^ bestTag |
|
13342 | 2215 |
! |
2216 |
||
2217 |
tagForFunction:functionName |
|
2218 |
^ rawList |
|
2219 |
detect:[:tag | |
|
2220 |
tag isFunctionTag and:[ tag label = functionName ] |
|
2221 |
] |
|
2222 |
ifNone:nil |
|
2223 |
! |
|
2224 |
||
15785 | 2225 |
tagForMacro:macroName |
2226 |
^ rawList |
|
2227 |
detect:[:tag | |
|
2228 |
tag isMacroTag and:[ tag label = macroName ] |
|
2229 |
] |
|
2230 |
ifNone:nil |
|
2231 |
! |
|
2232 |
||
15771 | 2233 |
tagForType:typeName |
2234 |
^ rawList |
|
2235 |
detect:[:tag | |
|
2236 |
tag isTypeTag and:[ tag label = typeName ] |
|
2237 |
] |
|
2238 |
ifNone:nil |
|
2239 |
! |
|
2240 |
||
13342 | 2241 |
tagsValidForFile |
2242 |
"the file, for which the tagsList is valid" |
|
2243 |
||
2244 |
^ tagsValidForFile |
|
9891 | 2245 |
! ! |
2246 |
||
2247 |
!TagList methodsFor:'tag generation'! |
|
2248 |
||
2249 |
fromFile:aFile in:aTempDirectory |
|
2250 |
"create tags from a file; |
|
15855 | 2251 |
either use the ctags/etags command, or an internal naive, simple method." |
9891 | 2252 |
|
13215 | 2253 |
|forceSimpleTagList list shellCmd numTags fileContents| |
9891 | 2254 |
|
2255 |
rawList := nil. |
|
13342 | 2256 |
tagsValidForFile := nil. |
2257 |
||
13215 | 2258 |
forceSimpleTagList := false. |
16181 | 2259 |
(self class isSmalltalkSuffix:aFile suffix) ifTrue:[ |
2260 |
forceSimpleTagList := true. |
|
2261 |
]. |
|
2262 |
||
13215 | 2263 |
"/ the simple builtin tagList generator is actually better than the ctags output for makefiles |
2264 |
(self class makeFilePatterns contains:[:aPattern | (aPattern match:aFile baseName asLowercase)]) ifTrue:[forceSimpleTagList := true]. |
|
2265 |
||
2266 |
forceSimpleTagList ifFalse:[ |
|
2267 |
shellCmd := (self shellCommandFor:aFile pathName). |
|
2268 |
shellCmd notNil ifTrue:[ |
|
2269 |
tagTypesPresent := false. "/ will be set again, when ctags command provides types |
|
16142 | 2270 |
list := ((self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory) ? #()) asOrderedCollection. |
16280 | 2271 |
"/ kludge: I am better in getting cases/switches/labels |
2272 |
list addAll:(self getAdditionalCTagsInFile:aFile withList:list). |
|
2273 |
"/ another kludge - add in my own scanned objc tags |
|
2274 |
(self class isObjcSuffix:aFile suffix) ifTrue:[ |
|
2275 |
|objcTags| |
|
2276 |
||
2277 |
objcTags := self objcTagsInFile:aFile. |
|
2278 |
list |
|
2279 |
removeAllSuchThat:[:ctag | |
|
2280 |
objcTags contains:[:objctag | objctag lineNumber = ctag lineNumber] |
|
2281 |
]. |
|
2282 |
list addAll:objcTags. |
|
2283 |
]. |
|
13215 | 2284 |
]. |
9891 | 2285 |
]. |
12334 | 2286 |
|
12343 | 2287 |
"/ in case ctags could not find anything, try our own, naive fallback (not too bad either) |
12334 | 2288 |
list isEmptyOrNil ifTrue:[ |
16142 | 2289 |
list := ((self getSimpleTagListFromFile:aFile in:aTempDirectory) ? #()) asOrderedCollection. |
12334 | 2290 |
]. |
9891 | 2291 |
tagTypesPresent := true. |
2292 |
||
2293 |
numTags := list size. |
|
2294 |
fileContents := aFile contents. |
|
2295 |
||
2296 |
(numTags > 1 and:[fileContents notEmptyOrNil]) ifTrue:[ |
|
2297 |
numTags to:1 by:-1 do:[:i| |
|
2298 |
|tag lnr| |
|
2299 |
||
2300 |
tag := list at:i ifAbsent:nil. |
|
2301 |
||
2302 |
lnr := tag lineNumberIn:fileContents. |
|
2303 |
lnr == 0 ifTrue:[ |
|
2304 |
list removeIndex:i |
|
2305 |
] ifFalse:[ |
|
2306 |
tag lineNumber:lnr |
|
2307 |
] |
|
2308 |
] |
|
2309 |
]. |
|
2310 |
self setRawList:list. |
|
13342 | 2311 |
tagsValidForFile := aFile. |
9891 | 2312 |
|
11050 | 2313 |
"Modified: / 05-01-2012 / 11:03:29 / cg" |
9891 | 2314 |
! |
2315 |
||
2316 |
fromFile:aFile in:aTempDirectory onTarget:aTarget |
|
2317 |
"create tags from a file; |
|
2318 |
either use the ctags/etags command, or an intenral naive, simple method. |
|
2319 |
" |
|
2320 |
|list| |
|
2321 |
||
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
2322 |
remoteTarget := aTarget. |
9891 | 2323 |
|
2324 |
[ |
|
2325 |
list := self fromFile:aFile in:aTempDirectory |
|
11497
b27035bd0981
#ensure instead of #valueNowOrOnUnwindDo:
Stefan Vogel <sv@exept.de>
parents:
11466
diff
changeset
|
2326 |
] ensure:[ |
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
2327 |
remoteTarget := nil. |
9891 | 2328 |
]. |
2329 |
^ list |
|
2330 |
! |
|
2331 |
||
2332 |
getModeFromFileSuffixOf:aFile |
|
2333 |
|suffix mode| |
|
2334 |
||
2335 |
suffix := aFile suffix. |
|
2336 |
(self class isCSuffix:suffix) ifTrue:[ |
|
2337 |
^ #c. |
|
2338 |
]. |
|
2339 |
(self class isCPlusPlusSuffix:suffix) ifTrue:[ |
|
2340 |
^ #c. |
|
2341 |
]. |
|
2342 |
(self class isJavaSuffix:suffix) ifTrue:[ |
|
2343 |
^ #java. |
|
2344 |
]. |
|
2345 |
(self class isFortranSuffix:suffix) ifTrue:[ |
|
2346 |
^ #fortran. |
|
2347 |
]. |
|
2348 |
(self class isEiffelSuffix:suffix) ifTrue:[ |
|
2349 |
^ #eiffel. |
|
2350 |
]. |
|
2351 |
(self class isHTMLSuffix:suffix) ifTrue:[ |
|
2352 |
^ #html. |
|
2353 |
]. |
|
2354 |
^ mode |
|
2355 |
||
2356 |
"Modified: / 20-04-2011 / 19:02:54 / cg" |
|
2357 |
! |
|
2358 |
||
11050 | 2359 |
getTagListFromFile:aFile usingCommand:scmd mode:modeOrNil in:aTempDirectory |
9891 | 2360 |
"create ctags-list from a file, using cmd (which is etags / ctags)" |
2361 |
||
2362 |
|list pipe tag tagFile contents mode infoDictionary| |
|
2363 |
||
11050 | 2364 |
(mode := modeOrNil) isNil ifTrue:[ |
2365 |
mode := self getModeFromFileSuffixOf:aFile. |
|
2366 |
]. |
|
9891 | 2367 |
list := OrderedCollection new:512. |
2368 |
||
2369 |
infoDictionary := Dictionary new. |
|
2370 |
||
2371 |
"/ Transcript showCR:'execute tags command: ', scmd. |
|
2372 |
usingDefaultCTags ifFalse:[ |
|
2373 |
(pipe := PipeStream readingFrom:scmd) notNil ifTrue:[ |
|
2374 |
[ |
|
2375 |
|line atEnd| |
|
2376 |
||
2377 |
atEnd := false. |
|
2378 |
ReadError |
|
2379 |
handle:[:ex | ] |
|
2380 |
do:[ |
|
2381 |
[atEnd] whileFalse:[ |
|
2382 |
(line := pipe nextLine) isNil ifTrue:[ |
|
2383 |
atEnd := pipe atEnd |
|
2384 |
] ifFalse:[ |
|
2385 |
"/ Transcript showCR:line. |
|
2386 |
tag := self tagFromLine:line mode:mode using:infoDictionary. |
|
2387 |
||
2388 |
tag notNil ifTrue:[ |
|
2389 |
list add:tag |
|
2390 |
] |
|
2391 |
] |
|
2392 |
] |
|
2393 |
] |
|
2394 |
] ensure:[pipe close]. |
|
2395 |
]. |
|
2396 |
^ list. |
|
2397 |
]. |
|
2398 |
||
2399 |
(OperatingSystem executeCommand:scmd inDirectory:aTempDirectory) ifTrue:[ |
|
2400 |
tagFile := aTempDirectory construct:'tags'. |
|
2401 |
||
2402 |
tagFile exists ifTrue:[ |
|
2403 |
contents := tagFile contents. |
|
2404 |
||
2405 |
contents notNil ifTrue:[ |
|
2406 |
contents do:[:aLine| |
|
2407 |
(tag := self tagFromLine:aLine mode:mode using:infoDictionary) notNil ifTrue:[list add:tag] |
|
2408 |
] |
|
2409 |
]. |
|
2410 |
Exception |
|
2411 |
handle:[:ex| ] |
|
2412 |
do:[tagFile remove]. |
|
2413 |
]. |
|
2414 |
^ list. |
|
2415 |
]. |
|
2416 |
||
2417 |
scmd = 'ctags' ifFalse:[ |
|
2418 |
"/ try default ctags without any options |
|
11050 | 2419 |
^ self getTagListFromFile:aFile usingCommand:'ctags' mode:modeOrNil in:aTempDirectory |
9891 | 2420 |
]. |
2421 |
^ #() |
|
11050 | 2422 |
|
2423 |
"Created: / 05-01-2012 / 11:03:04 / cg" |
|
9891 | 2424 |
! |
2425 |
||
2426 |
tagFromLine:aLine mode:languageMode using:infoDictionary |
|
2427 |
"analyze the line as returned from ctags and create a corresponding tag object for it" |
|
2428 |
||
2429 |
|stream word1 word2 tagType pattern key |
|
2430 |
file className lineNumber tagClass fmtString fmt |
|
2431 |
showOnly| |
|
2432 |
||
13317 | 2433 |
"/ Transcript showCR:aLine. |
9891 | 2434 |
aLine size < 6 ifTrue:[ |
2435 |
^ nil |
|
2436 |
]. |
|
2437 |
aLine first == $!! ifTrue:[ |
|
2438 |
(aLine startsWith:'!!_TAG_FILE_FORMAT') ifTrue:[ |
|
2439 |
"/ aha - ex. ctags |
|
2440 |
stream := aLine readStream. |
|
2441 |
stream upTo:Character tab. |
|
2442 |
stream skipSeparators. |
|
2443 |
fmtString := stream upTo:Character tab. |
|
2444 |
fmt := Integer readFrom:fmtString onError:nil. |
|
2445 |
fmt notNil ifTrue:[ |
|
2446 |
infoDictionary at:#formatVersion put:fmt |
|
2447 |
] |
|
2448 |
]. |
|
2449 |
^ nil |
|
2450 |
]. |
|
2451 |
||
2452 |
"/ tab separated list; except for the pattern, which might include a tab. |
|
2453 |
stream := aLine readStream. |
|
2454 |
key := stream upTo:Character tab. |
|
2455 |
stream skipSeparators. |
|
2456 |
file := stream upTo:Character tab. |
|
2457 |
stream skipSeparators. |
|
2458 |
stream peek == $/ ifTrue:[ |
|
2459 |
stream next. |
|
2460 |
pattern := stream upTo:$/. |
|
2461 |
[(pattern last) == $\] whileTrue:[ |
|
2462 |
pattern at:(pattern size) put:$/. |
|
2463 |
pattern := pattern , (stream upTo:$/). |
|
2464 |
]. |
|
2465 |
] ifFalse:[ |
|
2466 |
stream peek isDigit ifTrue:[ |
|
2467 |
lineNumber := Integer readFrom:stream onError:nil. |
|
2468 |
lineNumber isNil ifTrue:[ |
|
2469 |
self halt:'should not happen - please debug'. |
|
2470 |
] ifFalse:[ |
|
2471 |
pattern := key. |
|
2472 |
]. |
|
2473 |
] ifFalse:[ |
|
2474 |
self halt:'should not happen - please debug'. |
|
2475 |
]. |
|
2476 |
]. |
|
2477 |
stream peekFor:$;. |
|
2478 |
stream peekFor:$". |
|
2479 |
stream skipSeparators. |
|
2480 |
tagType := stream upTo:Character tab. |
|
2481 |
stream skipSeparators. |
|
2482 |
word1 := stream upTo:Character tab. "/ optional file: (scope) |
|
2483 |
stream skipSeparators. |
|
2484 |
word2 := stream upTo:Character tab. "/ optional class: |
|
2485 |
||
2486 |
(word1 startsWith:'file:') ifTrue:[ "/ file: (scope) |
|
14346 | 2487 |
self hideStatic == true ifTrue:[^ nil]. |
9891 | 2488 |
]. |
2489 |
||
2490 |
(word2 startsWith: 'class:') ifTrue:[ |
|
2491 |
className := word2 copyFrom:('class:' size) |
|
2492 |
] ifFalse:[ |
|
2493 |
(word1 startsWith: 'class:') ifTrue:[ |
|
2494 |
className := word1 copyFrom:('class:' size) |
|
2495 |
] |
|
2496 |
]. |
|
2497 |
"/ (word1 startsWith: 'class:') ifTrue:[ |
|
2498 |
"/ className := word1 copyFrom:('class:' size) |
|
2499 |
"/ ]. |
|
2500 |
"/ (word2 startsWith: 'class:') ifTrue:[ |
|
2501 |
"/ className := word2 copyFrom:('class:' size) |
|
2502 |
"/ ]. |
|
2503 |
||
2504 |
tagClass := Tag. |
|
2505 |
tagClass autoload. |
|
2506 |
||
2507 |
"/ typeCharacter to tag-Class mapping... |
|
2508 |
languageMode == #c ifTrue:[ |
|
14385 | 2509 |
"/ Transcript showCR:tagType. |
9891 | 2510 |
tagType = 'v' ifTrue:[ |
14346 | 2511 |
self hideVariables == true ifTrue:[^ nil]. |
9891 | 2512 |
tagClass := Tag::TVariable |
2513 |
] ifFalse:[ tagType = 'f' ifTrue:[ |
|
14346 | 2514 |
self hideFunctions == true ifTrue:[^ nil]. |
9891 | 2515 |
tagClass := Tag::TFunction |
2516 |
] ifFalse:[ tagType = 'd' ifTrue:[ |
|
14346 | 2517 |
self hideDefines == true ifTrue:[^ nil]. |
9891 | 2518 |
tagClass := Tag::TMacro |
2519 |
] ifFalse:[ tagType = 't' ifTrue:[ |
|
14346 | 2520 |
self hideTypedefs == true ifTrue:[^ nil]. |
9891 | 2521 |
tagClass := Tag::TTypedef |
2522 |
] ifFalse:[ tagType = 'm' ifTrue:[ |
|
14346 | 2523 |
self hideStructMembers == true ifTrue:[^ nil]. |
9891 | 2524 |
tagClass := Tag::TMember |
2525 |
] ifFalse:[ tagType = 's' ifTrue:[ |
|
14346 | 2526 |
self hideStructures == true ifTrue:[^ nil]. |
9891 | 2527 |
tagClass := Tag::TStruct |
2528 |
] ifFalse:[ tagType = 'u' ifTrue:[ |
|
14346 | 2529 |
self hideStructures == true ifTrue:[^ nil]. |
9891 | 2530 |
tagClass := Tag::TUnion |
2531 |
] ifFalse:[ tagType = 'c' ifTrue:[ |
|
14346 | 2532 |
self hideClasses == true ifTrue:[^ nil]. |
9891 | 2533 |
tagClass := Tag::TClass |
2534 |
] ifFalse:[ tagType = 'e' ifTrue:[ |
|
2535 |
tagClass := Tag::TEnumMember. |
|
2536 |
] ifFalse:[ tagType = 'g' ifTrue:[ |
|
2537 |
tagClass := Tag::TEnum. |
|
2538 |
"/ ] ifFalse:[ tagType = 'n' ifTrue:[ |
|
2539 |
"/ tagClass := Tag::TNamespace |
|
2540 |
"/ ] ifFalse:[ tagType = 'p' ifTrue:[ |
|
2541 |
"/ tagClass := Tag::TFunctionPrototype |
|
2542 |
"/ ] ifFalse:[ tagType = 'x' ifTrue:[ |
|
2543 |
"/ tagClass := Tag::TExternVariable |
|
2544 |
] ifFalse:[ |
|
13753 | 2545 |
self breakPoint:#cg. |
9891 | 2546 |
"/ add more here |
2547 |
]]]]]]]]]] |
|
2548 |
] ifFalse:[ languageMode == #java ifTrue:[ |
|
2549 |
tagType = 'c' ifTrue:[ |
|
14346 | 2550 |
self hideJavaClasses == true ifTrue:[^ nil]. |
9891 | 2551 |
tagClass := Tag::TClass |
2552 |
] ifFalse:[ tagType = 'm' ifTrue:[ |
|
14346 | 2553 |
self hideJavaMethods == true ifTrue:[^ nil]. |
9891 | 2554 |
tagClass := Tag::TMethod |
2555 |
] ifFalse:[ tagType = 'f' ifTrue:[ |
|
14346 | 2556 |
self hideJavaFields == true ifTrue:[^ nil]. |
9891 | 2557 |
tagClass := Tag::TField |
2558 |
] ifFalse:[ tagType = 'i' ifTrue:[ |
|
14346 | 2559 |
self hideJavaInterfaces == true ifTrue:[^ nil]. |
9891 | 2560 |
tagClass := Tag::TInterface |
2561 |
] ifFalse:[ tagType = 'p' ifTrue:[ |
|
14346 | 2562 |
self hideJavaPackages == true ifTrue:[^ nil]. |
9891 | 2563 |
tagClass := Tag::TPackage |
2564 |
] ifFalse:[ |
|
2565 |
"/ add more here */ |
|
2566 |
]]]]] |
|
2567 |
] ifFalse:[ languageMode == #eiffel ifTrue:[ |
|
2568 |
tagType = 'c' ifTrue:[ |
|
14346 | 2569 |
self hideClasses == true ifTrue:[^ nil]. |
9891 | 2570 |
tagClass := Tag::TClass |
2571 |
"/ ] ifFalse:[ tagType = 'f' ifTrue:[ |
|
2572 |
"/ tagClass := Tag::TFeature |
|
2573 |
"/ ] ifFalse:[ tagType = 'l' ifTrue:[ |
|
2574 |
"/ tagClass := Tag::TLocalEntity |
|
2575 |
] ifFalse:[ |
|
2576 |
"/ add more here */ |
|
2577 |
] |
|
2578 |
] ifFalse:[ languageMode == #fortran ifTrue:[ |
|
2579 |
tagType = 'f' ifTrue:[ |
|
14346 | 2580 |
self hideFunctions == true ifTrue:[^ nil]. |
9891 | 2581 |
tagClass := Tag::TFunction |
2582 |
] ifFalse:[ tagType = 'i' ifTrue:[ |
|
2583 |
"/ hideInterfaces == true ifTrue:[^ nil]. |
|
2584 |
tagClass := Tag::TInterface |
|
2585 |
] ifFalse:[ tagType = 't' ifTrue:[ |
|
14346 | 2586 |
self hideTypedefs == true ifTrue:[^ nil]. |
9891 | 2587 |
tagClass := Tag::TTypedef |
2588 |
"/ ] ifFalse:[ tagType = 'l' ifTrue:[ |
|
2589 |
"/ tagClass := Tag::TLabel |
|
2590 |
"/ ] ifFalse:[ tagType = 'm' ifTrue:[ |
|
2591 |
"/ tagClass := Tag::TModule |
|
2592 |
"/ ] ifFalse:[ tagType = 'n' ifTrue:[ |
|
2593 |
"/ tagClass := Tag::TNameList |
|
2594 |
"/ ] ifFalse:[ tagType = 'p' ifTrue:[ |
|
2595 |
"/ tagClass := Tag::TProgram |
|
2596 |
"/ ] ifFalse:[ tagType = 's' ifTrue:[ |
|
2597 |
"/ tagClass := Tag::TSubroutine |
|
2598 |
"/ ] ifFalse:[ tagType = 'b' ifTrue:[ |
|
2599 |
"/ tagClass := Tag::TBlockData |
|
2600 |
"/ ] ifFalse:[ tagType = 'c' ifTrue:[ |
|
2601 |
"/ tagClass := Tag::TCommonBlock |
|
2602 |
"/ ] ifFalse:[ tagType = 'e' ifTrue:[ |
|
2603 |
"/ tagClass := Tag::TEntryPoint |
|
2604 |
] ifFalse:[ |
|
2605 |
"/ add more here */ |
|
2606 |
]]] |
|
2607 |
]]]]. |
|
2608 |
||
2609 |
tagTypesPresent := true. |
|
2610 |
||
2611 |
tagType size == 0 ifTrue:[ |
|
2612 |
tagType := '' |
|
2613 |
] ifFalse:[ |
|
2614 |
(showOnly := self showOnly) notNil ifTrue:[ |
|
16048 | 2615 |
"/ how ugly can a piece of code get? |
9891 | 2616 |
showOnly == #classes ifTrue:[ |
2617 |
tagClass ~~ Tag::TClass ifTrue:[^ nil]. |
|
2618 |
] ifFalse:[ showOnly == #functions ifTrue:[ |
|
2619 |
tagClass ~~ Tag::TFunction ifTrue:[^ nil]. |
|
2620 |
] ifFalse:[ showOnly == #variables ifTrue:[ |
|
2621 |
tagClass ~~ Tag::TVariable ifTrue:[^ nil]. |
|
2622 |
] ifFalse:[ showOnly == #types ifTrue:[ |
|
2623 |
(tagClass ~~ Tag::TTypedef |
|
2624 |
and:[ true "tagClass ~~ Tag::TUnion" |
|
2625 |
and:[ tagClass ~~ Tag::TStruct ]])ifTrue:[^ nil]. |
|
2626 |
] ifFalse:[ showOnly == #functionsAndVariables ifTrue:[ |
|
2627 |
((tagClass ~~ Tag::TFunction) |
|
2628 |
and:[tagClass ~~ Tag::TVariable]) ifTrue:[^ nil]. |
|
2629 |
] ifFalse:[ showOnly == #classesFunctionsAndVariables ifTrue:[ |
|
2630 |
((tagClass ~~ Tag::TFunction) |
|
2631 |
and:[(tagClass ~~ Tag::TVariable) |
|
2632 |
and:[tagClass ~~ Tag::TClass]]) ifTrue:[^ nil]. |
|
2633 |
] ifFalse:[ showOnly == #defines ifTrue:[ |
|
2634 |
tagClass ~~ Tag::TMacro ifTrue:[^ nil]. |
|
2635 |
] ifFalse:[ showOnly == #structs ifTrue:[ |
|
2636 |
tagClass ~~ Tag::TStruct ifTrue:[^ nil]. |
|
2637 |
] ifFalse:[ showOnly == #everything ifTrue:[ |
|
16048 | 2638 |
] ifFalse:[ showOnly == #headlines ifTrue:[ |
2639 |
tagClass ~~ Tag::THeaderElement ifTrue:[^ nil]. |
|
2640 |
] ifFalse:[ showOnly == #anchors ifTrue:[ |
|
2641 |
tagClass ~~ Tag::TAnchorElement ifTrue:[^ nil]. |
|
17207 | 2642 |
] ifFalse:[ showOnly == #targets ifTrue:[ |
2643 |
tagClass ~~ Tag::TMakeTarget ifTrue:[^ nil]. |
|
16048 | 2644 |
] ifFalse:[ |
9891 | 2645 |
self halt:'unhandled showOnly'. |
17207 | 2646 |
]]]]]]]]]]]] |
9891 | 2647 |
] |
2648 |
]. |
|
2649 |
||
2650 |
^ tagClass label:key |
|
2651 |
pattern:pattern |
|
2652 |
type:tagType |
|
2653 |
lineNumber:lineNumber |
|
2654 |
className:className. |
|
2655 |
||
2656 |
"Modified: / 05-05-2011 / 15:45:55 / cg" |
|
2657 |
! ! |
|
2658 |
||
13153 | 2659 |
!TagList methodsFor:'tag generation - helpers'! |
2660 |
||
14345 | 2661 |
linewiseNaiveTagsInFile:aFilePath using:parseLineBlock |
2662 |
"common helper for naive linewise parsing tags" |
|
2663 |
||
2664 |
|targets line lineNr s tagOrTagCollection| |
|
2665 |
||
2666 |
Tag autoload. |
|
2667 |
||
2668 |
targets := OrderedCollection new. |
|
2669 |
s := aFilePath asFilename readStream. |
|
2670 |
s notNil ifTrue:[ |
|
2671 |
s := LineNumberReadStream readingFrom:s. |
|
2672 |
[s atEnd] whileFalse:[ |
|
2673 |
lineNr := s lineNumber. |
|
2674 |
line := s nextLine. |
|
2675 |
||
2676 |
tagOrTagCollection := parseLineBlock value:line value:lineNr. |
|
2677 |
tagOrTagCollection notNil ifTrue:[ |
|
2678 |
tagOrTagCollection isCollection ifTrue:[ |
|
2679 |
targets addAll:tagOrTagCollection |
|
2680 |
] ifFalse:[ |
|
2681 |
targets add:tagOrTagCollection |
|
2682 |
]. |
|
2683 |
]. |
|
2684 |
]. |
|
2685 |
s close |
|
2686 |
]. |
|
2687 |
^ targets |
|
2688 |
||
2689 |
"Modified: / 08-05-2011 / 10:12:29 / cg" |
|
2690 |
! |
|
2691 |
||
13153 | 2692 |
plainTextBetweenHTMLElement:startElement andElementWithTag:endTag |
2693 |
"applied to an <h1>-tag element, passing '/h1' as endTag, |
|
2694 |
this retrieves the plain text of the headline. Used by the tag list." |
|
2695 |
||
2696 |
|el collector hasSpace txt| |
|
2697 |
||
14726 | 2698 |
collector := CharacterWriteStream on:(String new:100). |
13153 | 2699 |
el := startElement next. |
2700 |
||
2701 |
hasSpace := true. |
|
2702 |
[ el notNil and:[el tag ~= endTag] ] whileTrue:[ |
|
2703 |
el isTextElement ifTrue:[ |
|
2704 |
hasSpace ifFalse:[ |
|
2705 |
collector space. |
|
2706 |
hasSpace := true. |
|
2707 |
]. |
|
2708 |
txt := el text withoutSeparators. |
|
2709 |
txt notEmpty ifTrue:[ |
|
2710 |
collector nextPutAll:txt. |
|
2711 |
hasSpace := txt endsWith:' '. |
|
2712 |
] |
|
2713 |
]. |
|
2714 |
el := el next |
|
2715 |
]. |
|
2716 |
^ collector contents |
|
2717 |
||
2718 |
"Created: / 12-09-2012 / 12:38:01 / cg" |
|
2719 |
! |
|
2720 |
||
2721 |
tagsForLinesStartingWithIdentifierAndColon:aFilePath |
|
2722 |
"helper for yacc tags (and maybe others in the future): |
|
2723 |
naive, q&d scan for lines matching: |
|
2724 |
<anything>: |
|
2725 |
" |
|
2726 |
||
2727 |
|targets line l lineNr nm s words w| |
|
2728 |
||
2729 |
Tag autoload. |
|
2730 |
||
2731 |
targets := OrderedCollection new. |
|
2732 |
s := aFilePath asFilename readStream. |
|
2733 |
s notNil ifTrue:[ |
|
2734 |
s := LineNumberReadStream readingFrom:s. |
|
2735 |
[s atEnd] whileFalse:[ |
|
2736 |
line := s nextLine. |
|
2737 |
l := line withoutSeparators. |
|
2738 |
words := l asCollectionOfWords. |
|
2739 |
||
2740 |
words size >= 1 ifTrue:[ |
|
2741 |
w := words first. |
|
2742 |
(w endsWith:$:) ifTrue:[ |
|
14579 | 2743 |
nm := w copyButLast. |
13153 | 2744 |
|
2745 |
lineNr := s lineNumber - 1. |
|
2746 |
targets add:(Tag::TLabel |
|
2747 |
label:nm |
|
2748 |
pattern:nil |
|
2749 |
type:nil |
|
2750 |
lineNumber:lineNr). |
|
2751 |
]. |
|
2752 |
] |
|
2753 |
]. |
|
2754 |
s close |
|
2755 |
]. |
|
2756 |
^ targets |
|
2757 |
||
2758 |
"Created: / 28-09-2012 / 14:45:35 / cg" |
|
2759 |
! ! |
|
2760 |
||
9891 | 2761 |
!TagList methodsFor:'tag generation - simple'! |
2762 |
||
2763 |
assemblerTagsInFile:aFilePath |
|
2764 |
"assembler tags: |
|
2765 |
naive, q&d scan for lines matching: |
|
2766 |
<anything>: |
|
2767 |
CAVEAT: |
|
2768 |
the code below handles linux-i386 assembler only (for now) |
|
2769 |
" |
|
2770 |
||
2771 |
|targets line l lineNr nm s words w directive |
|
11502 | 2772 |
hideLocals hideLocals2 hideLocals3 hideData hideText currentSegment| |
9891 | 2773 |
|
2774 |
Tag autoload. |
|
2775 |
||
2776 |
targets := OrderedCollection new. |
|
2777 |
s := aFilePath asFilename readStream. |
|
2778 |
s notNil ifTrue:[ |
|
14346 | 2779 |
hideLocals := self flagNamed:#hideLocalLabels ? false. |
2780 |
hideLocals2 := self flagNamed:#hideLocalLabels2 ? false. |
|
2781 |
hideLocals3 := self flagNamed:#hideLocalLabels3 ? false. |
|
2782 |
hideData := self flagNamed:#hideDataLabels ? false. |
|
2783 |
hideText := self flagNamed:#hideTextLabels ? false. |
|
9891 | 2784 |
currentSegment := #text. |
2785 |
||
2786 |
s := LineNumberReadStream readingFrom:s. |
|
2787 |
[s atEnd] whileFalse:[ |
|
2788 |
lineNr := s lineNumber. |
|
2789 |
line := s nextLine. |
|
2790 |
l := line withoutSeparators. |
|
2791 |
words := l asCollectionOfWords. |
|
2792 |
words size >= 1 ifTrue:[ |
|
2793 |
w := words first. |
|
2794 |
(w endsWith:$:) ifTrue:[ |
|
2795 |
(hideText and:[currentSegment == #text]) ifFalse:[ |
|
2796 |
(hideData and:[currentSegment == #data]) ifFalse:[ |
|
2797 |
(hideLocals and:[(w startsWith:$.)]) ifFalse:[ |
|
11466 | 2798 |
(hideLocals2 and:[(w startsWith:$_) not]) ifFalse:[ |
11502 | 2799 |
(hideLocals3 |
2800 |
and:[ (w startsWith:$L) |
|
2801 |
and:[ (w size > 1) |
|
2802 |
and:[ ((w copyFrom:2 to:(w size-1)) conform:[:c | c isDigit]) |
|
2803 |
]]]) ifFalse:[ |
|
14579 | 2804 |
nm := w copyButLast. |
11502 | 2805 |
targets add:(Tag::TLabel |
2806 |
label:nm |
|
2807 |
pattern:nil |
|
2808 |
type:nil |
|
2809 |
lineNumber:lineNr). |
|
2810 |
]. |
|
11466 | 2811 |
]. |
9891 | 2812 |
]. |
2813 |
]. |
|
2814 |
]. |
|
2815 |
words size >= 2 ifTrue:[ |
|
2816 |
directive := words second |
|
2817 |
] ifFalse:[ |
|
2818 |
directive := nil. |
|
2819 |
] |
|
2820 |
] ifFalse:[ |
|
2821 |
directive := w. |
|
2822 |
]. |
|
2823 |
(directive notNil and:[directive startsWith:$.]) ifTrue:[ |
|
2824 |
directive = '.text' ifTrue:[ |
|
2825 |
currentSegment := #text |
|
2826 |
] ifFalse:[ directive = '.data' ifTrue:[ |
|
2827 |
currentSegment := #data |
|
2828 |
] ifFalse:[ directive = '.bss' ifTrue:[ |
|
2829 |
currentSegment := #data |
|
2830 |
] ifFalse:[ directive = '.rodata' ifTrue:[ |
|
2831 |
currentSegment := #data |
|
2832 |
]]]] |
|
2833 |
] |
|
2834 |
] |
|
2835 |
]. |
|
2836 |
s close |
|
2837 |
]. |
|
2838 |
^ targets |
|
2839 |
||
11502 | 2840 |
"Modified: / 13-05-2012 / 11:25:49 / cg" |
9891 | 2841 |
! |
2842 |
||
11825 | 2843 |
batchTagsInFile:aFilePath |
2844 |
"batch-file |
|
2845 |
naive, q&d scan for lines matching: |
|
2846 |
:<anything> |
|
2847 |
" |
|
2848 |
||
2849 |
|targets line l lineNr nm s words| |
|
2850 |
||
2851 |
Tag autoload. |
|
2852 |
||
2853 |
targets := OrderedCollection new. |
|
2854 |
s := aFilePath asFilename readStream. |
|
2855 |
s notNil ifTrue:[ |
|
2856 |
s := LineNumberReadStream readingFrom:s. |
|
2857 |
[s atEnd] whileFalse:[ |
|
2858 |
line := s nextLine. |
|
2859 |
(line startsWith:$:) ifTrue:[ |
|
2860 |
l := line withoutSeparators. |
|
2861 |
words := (l copyFrom:2) asCollectionOfWords. |
|
2862 |
||
2863 |
words size == 1 ifTrue:[ |
|
2864 |
nm := words first. |
|
2865 |
||
2866 |
lineNr := s lineNumber - 1. |
|
2867 |
targets add:(Tag::TLabel |
|
2868 |
label:nm |
|
2869 |
pattern:nil |
|
2870 |
type:nil |
|
2871 |
lineNumber:lineNr). |
|
2872 |
]. |
|
2873 |
] |
|
2874 |
]. |
|
2875 |
s close |
|
2876 |
]. |
|
2877 |
^ targets |
|
2878 |
||
2879 |
"Created: / 28-09-2012 / 14:45:10 / cg" |
|
2880 |
! |
|
2881 |
||
11762 | 2882 |
dartTagsInFile:aFilePath |
2883 |
"dart tags: |
|
2884 |
naive, q&d scan for lines matching: |
|
2885 |
interface foo |
|
2886 |
class foo |
|
2887 |
function foo |
|
2888 |
" |
|
2889 |
||
2890 |
|targets line l lineNr nm s| |
|
2891 |
||
2892 |
Tag autoload. |
|
2893 |
||
2894 |
targets := OrderedCollection new. |
|
2895 |
s := aFilePath asFilename readStream. |
|
2896 |
s notNil ifTrue:[ |
|
2897 |
s := LineNumberReadStream readingFrom:s. |
|
2898 |
[s atEnd] whileFalse:[ |
|
2899 |
lineNr := s lineNumber. |
|
2900 |
line := s nextLine. |
|
2901 |
l := line withoutSeparators. |
|
2902 |
{ |
|
14346 | 2903 |
{ 'function ' . #functions . self hideFunctions . Tag::TFunction } . |
2904 |
{ 'var ' . #variables . self hideVariables . Tag::TVariable } . |
|
2905 |
{ 'class ' . #classes . self hideClasses . Tag::TClass } . |
|
2906 |
{ 'abstract class ' . #classes . self hideClasses . Tag::TClass } . |
|
2907 |
{ 'interface ' . #interfaces . self hideDartInterfaces . Tag::TInterface } . |
|
2908 |
{ 'factory ' . #methods . self hideMethods . Tag::TMethod } . |
|
11762 | 2909 |
} tuplesDo:[:keywordSpace :showOnlyEnum :hideVariableValue :tagType| |
2910 |
(l startsWith:keywordSpace) ifTrue:[ |
|
2911 |
(showOnly isNil or:[showOnly == showOnlyEnum]) ifTrue:[ |
|
2912 |
hideVariableValue ~~ true ifTrue:[ |
|
2913 |
nm := l copyFrom:(keywordSpace size + 1). |
|
2914 |
nm := nm copyTo:(nm |
|
11771 | 2915 |
findFirst:[:ch | (ch isLetterOrDigit or:['$_.' includes:ch]) not] |
11762 | 2916 |
ifNone:nm size+1)-1. |
2917 |
targets add:(tagType |
|
2918 |
label:nm |
|
2919 |
pattern:nil |
|
2920 |
type:nil |
|
2921 |
lineNumber:lineNr). |
|
2922 |
] |
|
2923 |
] |
|
2924 |
]. |
|
2925 |
] |
|
2926 |
]. |
|
2927 |
s close |
|
2928 |
]. |
|
2929 |
^ targets |
|
2930 |
||
2931 |
"Created: / 28-06-2010 / 12:44:25 / cg" |
|
11766 | 2932 |
"Modified: / 22-08-2012 / 21:32:33 / cg" |
11762 | 2933 |
! |
2934 |
||
15855 | 2935 |
getAdditionalCTagsInFile:aFilePath withList:ctagsList |
2936 |
"additional tags, which are not found by the standard ctags utility: |
|
2937 |
case foo: - case label tags |
|
2938 |
switch: - case label tags |
|
2939 |
label: - label tags (if there is a corresponding goto) |
|
2940 |
||
2941 |
The already generated ctagsList is passed as argument, |
|
2942 |
so duplicates etc. can be detected" |
|
2943 |
||
2944 |
|targets line lineNr s caseLabel l gotoTargets possibleLabels |
|
2945 |
addLabelTag findCurrentFunctionPrefix| |
|
2946 |
||
2947 |
self hideLabels ifTrue:[^ #()]. |
|
2948 |
showOnly notNil ifTrue:[^ #()]. |
|
2949 |
||
2950 |
Tag autoload. |
|
2951 |
||
2952 |
targets := OrderedCollection new. |
|
2953 |
gotoTargets := Set new. |
|
2954 |
possibleLabels := OrderedCollection new. |
|
2955 |
||
2956 |
findCurrentFunctionPrefix := |
|
2957 |
[:lineNr | |
|
2958 |
|bestSoFar| |
|
2959 |
||
2960 |
ctagsList do:[:each | |
|
2961 |
each isFunctionOrMethodTag ifTrue:[ |
|
2962 |
each lineNumber <= lineNr ifTrue:[ |
|
2963 |
(bestSoFar isNil or:[ each lineNumber > bestSoFar lineNumber]) ifTrue:[ |
|
2964 |
bestSoFar := each |
|
2965 |
] |
|
2966 |
]. |
|
2967 |
]. |
|
2968 |
]. |
|
2969 |
bestSoFar isNil |
|
2970 |
ifTrue:[ '' ] |
|
2971 |
ifFalse:[ bestSoFar label, ' ' ] |
|
2972 |
]. |
|
2973 |
||
2974 |
addLabelTag := |
|
2975 |
[:tagType :lineNr :label | |
|
2976 |
|fnPrefix| |
|
2977 |
||
2978 |
fnPrefix := findCurrentFunctionPrefix value:lineNr. |
|
2979 |
targets add:(tagType |
|
2980 |
label:(fnPrefix,label) |
|
2981 |
pattern:nil |
|
2982 |
type:nil |
|
2983 |
lineNumber:lineNr). |
|
2984 |
]. |
|
2985 |
||
2986 |
s := aFilePath asFilename readStream. |
|
2987 |
s notNil ifTrue:[ |
|
2988 |
lineNr := 0. |
|
2989 |
s := LineNumberReadStream readingFrom:s. |
|
2990 |
[s atEnd] whileFalse:[ |
|
2991 |
lineNr := lineNr + 1. |
|
2992 |
line := s nextLine withoutSeparators. |
|
2993 |
((line startsWith:'case ') and:[line includes:$:]) ifTrue:[ |
|
2994 |
l := line readStream. |
|
2995 |
l skip:5. |
|
2996 |
caseLabel := l upTo:$:. |
|
2997 |
addLabelTag value:(Tag::TCaseLabel) value:lineNr |
|
2998 |
value:('case ' allItalic , caseLabel",' <case>' allItalic"). |
|
2999 |
] ifFalse:[ |
|
3000 |
(line startsWith:'default:') ifTrue:[ |
|
3001 |
addLabelTag value:(Tag::TCaseLabel) value:lineNr |
|
3002 |
value:('case ' allItalic, 'default'). |
|
3003 |
] ifFalse:[ |
|
3004 |
((line startsWith:'switch') and:[line includes:$(]) ifTrue:[ |
|
3005 |
l := line readStream. |
|
3006 |
l skip:6. |
|
3007 |
l skipSeparators. |
|
3008 |
l peek == $( ifTrue:[ |
|
3009 |
l next. |
|
3010 |
caseLabel := (l upTo:$)) withoutSeparators. |
|
3011 |
caseLabel notEmpty ifTrue:[ |
|
3012 |
caseLabel := 'switch (',caseLabel,')'. |
|
3013 |
addLabelTag value:(Tag::TCaseLabel) value:lineNr |
|
3014 |
value:('case ' allItalic , caseLabel). |
|
3015 |
] |
|
3016 |
] |
|
3017 |
] ifFalse:[ |
|
3018 |
(line startsWith:'goto ') ifTrue:[ |
|
3019 |
|targetLabel| |
|
3020 |
l := line readStream. |
|
3021 |
l skip:5. |
|
3022 |
l skipSeparators. |
|
3023 |
targetLabel := (l upTo:$; ) withoutSeparators. |
|
3024 |
targetLabel notEmpty ifTrue:[ |
|
3025 |
gotoTargets add:targetLabel. |
|
3026 |
] |
|
3027 |
] ifFalse:[ |
|
3028 |
(line includes:$:) ifTrue:[ |
|
3029 |
|label| |
|
3030 |
label := (line upTo:$:) withoutSeparators. |
|
3031 |
label notEmpty ifTrue:[ |
|
3032 |
((label first isLetter or:[label first = $_]) |
|
3033 |
and:[ label conform:[:ch | ch isLetterOrDigit or:[ch = $_]]]) ifTrue:[ |
|
3034 |
|fnPrefix| |
|
3035 |
fnPrefix := findCurrentFunctionPrefix value:lineNr. |
|
3036 |
possibleLabels |
|
3037 |
add:(Tag::TCaseLabel |
|
3038 |
label:(fnPrefix,('label ' allItalic , label)) |
|
3039 |
pattern:label |
|
3040 |
type:nil |
|
3041 |
lineNumber:lineNr) |
|
3042 |
]. |
|
3043 |
]. |
|
3044 |
]. |
|
3045 |
]. |
|
3046 |
] |
|
3047 |
] |
|
3048 |
]. |
|
3049 |
]. |
|
3050 |
s close |
|
3051 |
]. |
|
3052 |
possibleLabels |
|
3053 |
select:[:lbl | gotoTargets includes:lbl pattern] |
|
3054 |
thenDo:[:lbl | targets add:lbl]. |
|
3055 |
^ targets |
|
3056 |
! |
|
3057 |
||
3058 |
getAdditionalTagsInFile:aFile withList:ctagsList |
|
3059 |
"a chance to generate a list of additional tags, |
|
3060 |
which are not found by the standard ctags utility. |
|
3061 |
For example, for C, labels and switches are detected and added. |
|
3062 |
The already generated ctagsList is passed as argument, |
|
3063 |
so duplicates etc. can be detected" |
|
3064 |
||
3065 |
(self class isCSuffix:(aFile suffix)) ifTrue:[ |
|
3066 |
^ self getAdditionalCTagsInFile:aFile withList:ctagsList |
|
3067 |
]. |
|
3068 |
^ #() |
|
3069 |
! |
|
3070 |
||
11050 | 3071 |
getSimpleTagListFromFile:aFileOrString in:aTempDirectory |
9891 | 3072 |
"fallback, if no ctags is present, or if the file is not a c-file. |
3073 |
Implemented here for some other file types (Makefiles) |
|
3074 |
" |
|
14365 | 3075 |
|file lcName pathName suffix mime| |
11050 | 3076 |
|
3077 |
file := aFileOrString asFilename. |
|
3078 |
lcName := file baseName asLowercase. |
|
3079 |
pathName := file pathName. |
|
3080 |
||
9891 | 3081 |
self class makeFilePatterns do:[:aPattern | |
3082 |
(aPattern match:lcName) ifTrue:[ |
|
3083 |
^ self class makeTargetTagsInFile:pathName filter:showOnly |
|
3084 |
] |
|
3085 |
]. |
|
3086 |
||
3087 |
suffix := lcName asFilename suffix. |
|
14365 | 3088 |
mime := TagList tagMimeTypeForFile:file. |
3089 |
||
3090 |
((self class isSmalltalkSuffix:suffix) |
|
3091 |
or:[(mime ? '') includesString:'smalltalk']) ifTrue:[ |
|
9891 | 3092 |
"/ smalltalk tags - simulated |
11050 | 3093 |
^ self stTagsInFile:pathName in:aTempDirectory |
9891 | 3094 |
]. |
14365 | 3095 |
((self class isPythonSuffix:suffix) |
3096 |
or:[(mime ? '') includesString:'python']) ifTrue:[ |
|
9891 | 3097 |
"/ python tags - simulated |
3098 |
^ self pythonTagsInFile:pathName |
|
3099 |
]. |
|
14365 | 3100 |
((self class isPhpSuffix:suffix) |
3101 |
or:[(mime ? '') includesString:'php']) ifTrue:[ |
|
9891 | 3102 |
"/ php tags - simulated |
3103 |
^ self phpTagsInFile:pathName |
|
3104 |
]. |
|
14365 | 3105 |
((self class isLispSuffix:suffix) |
3106 |
or:[(mime ? '') includesString:'lisp']) ifTrue:[ |
|
9891 | 3107 |
"/ lisp tags - simulated |
3108 |
^ self lispTagsInFile:pathName |
|
3109 |
]. |
|
16280 | 3110 |
((self class isObjcSuffix:suffix) |
3111 |
or:[(mime ? '') includesString:'objcsrc']) ifTrue:[ |
|
3112 |
"/ objc tags - simulated |
|
3113 |
^ self objcTagsInFile:pathName |
|
3114 |
]. |
|
14365 | 3115 |
((self class isOzSuffix:suffix) |
3116 |
or:[(mime ? '') includesString:'oz']) ifTrue:[ |
|
9891 | 3117 |
"/ oz tags - simulated |
3118 |
^ self ozTagsInFile:pathName |
|
3119 |
]. |
|
14365 | 3120 |
((self class isPrologSuffix:suffix) |
3121 |
or:[(mime ? '') includesString:'prolog']) ifTrue:[ |
|
9891 | 3122 |
"/ prolog tags - simulated |
3123 |
^ self prologTagsInFile:pathName |
|
3124 |
]. |
|
14365 | 3125 |
((self class isTCLSuffix:suffix) |
3126 |
or:[(mime ? '') includesString:'tcl']) ifTrue:[ |
|
9891 | 3127 |
"/ tcl tags - simulated |
3128 |
^ self tclTagsInFile:pathName |
|
3129 |
]. |
|
14365 | 3130 |
((self class isAssemblerSuffix:suffix) |
3131 |
or:[(mime ? '') includesString:'assembler']) ifTrue:[ |
|
9891 | 3132 |
"/ assembler tags - simulated |
3133 |
^ self assemblerTagsInFile:pathName |
|
3134 |
]. |
|
14365 | 3135 |
((self class isRubySuffix:suffix) |
3136 |
or:[(mime ? '') includesString:'ruby']) ifTrue:[ |
|
9891 | 3137 |
"/ ruby tags - simulated |
3138 |
^ self rubyTagsInFile:pathName |
|
3139 |
]. |
|
14365 | 3140 |
((self class isYaccSuffix:suffix) |
3141 |
or:[(mime ? '') includesString:'yacc']) ifTrue:[ |
|
9891 | 3142 |
"/ yacc tags - simulated |
3143 |
^ self yaccTagsInFile:pathName |
|
3144 |
]. |
|
14365 | 3145 |
((self class isJavaScriptSuffix:suffix) |
3146 |
or:[(mime ? '') includesString:'javascript']) ifTrue:[ |
|
9891 | 3147 |
"/ js tags - simulated |
3148 |
^ self javaScriptTagsInFile:pathName |
|
3149 |
]. |
|
14365 | 3150 |
((self class isDartSuffix:suffix) |
3151 |
or:[(mime ? '') includesString:'dart']) ifTrue:[ |
|
11766 | 3152 |
"/ dart tags - simulated |
3153 |
^ self dartTagsInFile:pathName |
|
3154 |
]. |
|
14365 | 3155 |
((self class isLuaSuffix:suffix) |
3156 |
or:[(mime ? '') includesString:'lua']) ifTrue:[ |
|
14345 | 3157 |
"/ lua tags - simulated |
3158 |
^ self luaTagsInFile:pathName |
|
3159 |
]. |
|
9891 | 3160 |
|
14365 | 3161 |
((self class isHTMLSuffix:suffix) |
3162 |
or:[(mime ? '') includesString:'html']) ifTrue:[ |
|
9891 | 3163 |
"/ html tags - simulated |
3164 |
^ self htmlTagsInFile:pathName |
|
3165 |
]. |
|
14365 | 3166 |
((self class isBatchSuffix:suffix) |
3167 |
or:[(mime ? '') includesString:'batch']) ifTrue:[ |
|
11825 | 3168 |
"/ batch tags - simulated |
3169 |
^ self batchTagsInFile:pathName |
|
3170 |
]. |
|
15685 | 3171 |
((self class isXSDSuffix:suffix) |
3172 |
or:[(mime ? '') includesString:'xsd']) ifTrue:[ |
|
3173 |
"/ xsd tags - simulated |
|
3174 |
^ self xsdTagsInFile:pathName |
|
3175 |
]. |
|
15711 | 3176 |
(suffix = 'rs') ifTrue:[ |
3177 |
^ self stxResourceTagsInFile:pathName |
|
3178 |
]. |
|
9891 | 3179 |
|
3180 |
"/ could add more here ... |
|
3181 |
^ nil. |
|
3182 |
||
11050 | 3183 |
"Created: / 05-01-2012 / 10:55:03 / cg" |
9891 | 3184 |
! |
3185 |
||
3186 |
htmlTagsInFile:aFilePath |
|
3187 |
"hatml tags: |
|
13153 | 3188 |
naive, q&d scan for lines containing: |
9891 | 3189 |
<textarea> |
3190 |
<input> |
|
3191 |
<table> |
|
3192 |
<script> |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3193 |
<hX> |
9891 | 3194 |
" |
3195 |
||
3196 |
|targets line l lineNr s tag| |
|
3197 |
||
3198 |
"/ TODO: use HTMPParser to read all of them !! |
|
3199 |
||
3200 |
Tag autoload. |
|
3201 |
||
3202 |
targets := OrderedCollection new. |
|
3203 |
s := aFilePath asFilename readStream. |
|
3204 |
s notNil ifTrue:[ |
|
3205 |
s := LineNumberReadStream readingFrom:s. |
|
3206 |
[s atEnd] whileFalse:[ |
|
3207 |
lineNr := s lineNumber. |
|
3208 |
line := s nextLine. |
|
9918 | 3209 |
line := line withoutSeparators. |
3210 |
l := line asLowercase. |
|
9891 | 3211 |
|
3212 |
#( |
|
14579 | 3213 |
'textarea' hideHTMLTextArea nil |
3214 |
'input' hideHTMLInput nil |
|
3215 |
'table' hideHTMLTable nil |
|
3216 |
'script' hideHTMLScript nil |
|
3217 |
'form' hideHTMLForm nil |
|
3218 |
'a' nil anchors |
|
3219 |
'h1' hideHTMLHeaders headlines |
|
3220 |
'h2' hideHTMLHeaders headlines |
|
3221 |
'h3' hideHTMLHeaders headlines |
|
3222 |
'h4' hideHTMLHeaders headlines |
|
3223 |
'h5' hideHTMLHeaders headlines |
|
3224 |
'h6' hideHTMLHeaders headlines |
|
3225 |
) inGroupsOf:3 do:[:nm :hideInstVarName :thisType| |
|
11802 | 3226 |
|type hideHolder idx tagText doc markup label text markupName markupType |
3227 |
isHeader| |
|
9891 | 3228 |
|
3229 |
type := hideHolder := nil. |
|
3230 |
||
3231 |
idx := l indexOfSubCollection:('<',nm). |
|
3232 |
idx ~~ 0 ifTrue:[ |
|
11802 | 3233 |
hideHolder := hideInstVarName isNil |
3234 |
ifTrue:[ false ] |
|
14382 | 3235 |
ifFalse:[ self flagNamed:hideInstVarName ]. |
9891 | 3236 |
|
9918 | 3237 |
tagText := line copyFrom:idx. |
9891 | 3238 |
doc := HTMLParser new parseText:tagText. |
3239 |
markup := doc markup. |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3240 |
markupName := markup name. |
11802 | 3241 |
markupType := "markup tag ?" markup type. |
3242 |
||
3243 |
isHeader := (#(h1 h2 h3 h4 h5 h6) includes:markupType). |
|
3244 |
isHeader ifTrue:[ |
|
3245 |
type := Tag::THeaderElement |
|
3246 |
] ifFalse: [ |
|
3247 |
markupType == #'form' ifTrue:[ |
|
3248 |
type := Tag::TFormElement |
|
3249 |
] ifFalse:[ |
|
3250 |
markupType == #'a' ifTrue:[ |
|
3251 |
type := Tag::TAnchorElement. |
|
17071 | 3252 |
markupName := markup hrefString notEmptyOrNil |
3253 |
ifTrue:['"',markup hrefString,'"'] |
|
3254 |
ifFalse:[ markup name ] |
|
11802 | 3255 |
] ifFalse:[ |
3256 |
type := Tag::TElement |
|
3257 |
] |
|
3258 |
]. |
|
3259 |
]. |
|
3260 |
||
9891 | 3261 |
markup id notEmptyOrNil ifTrue:[ |
3262 |
label := nm , ' (',markup id,')' |
|
3263 |
] ifFalse:[ |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3264 |
markupName notEmptyOrNil ifTrue:[ |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3265 |
label := nm , ' (',markupName,')' |
9891 | 3266 |
] ifFalse:[ |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3267 |
(markupType == #input and:[ markup valueString notEmptyOrNil ]) ifTrue:[ |
11802 | 3268 |
label := nm , ' ("',markup valueString,'")' |
9918 | 3269 |
] ifFalse:[ |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3270 |
(markupType == #script and:[ markup src notEmptyOrNil ]) ifTrue:[ |
9918 | 3271 |
label := nm , ' ("',markup src,'")' |
3272 |
] ifFalse:[ |
|
11802 | 3273 |
( isHeader |
3274 |
and:[text := self plainTextBetweenHTMLElement:markup andElementWithTag:('/',markupType). |
|
3275 |
text notEmpty] |
|
3276 |
) ifTrue:[ |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3277 |
label := '"',text,'" (',nm,')' |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3278 |
] ifFalse:[ |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3279 |
label := nm |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3280 |
] |
9918 | 3281 |
] |
3282 |
] |
|
9891 | 3283 |
]. |
3284 |
]. |
|
3285 |
||
14579 | 3286 |
(showOnly isNil or:[thisType isNil or:[showOnly == thisType]]) ifTrue:[ |
3287 |
hideHolder value ~~ true ifTrue:[ |
|
3288 |
tag := type |
|
3289 |
label:label |
|
3290 |
pattern:nil |
|
3291 |
type:nil |
|
3292 |
lineNumber:lineNr. |
|
3293 |
targets add:tag. |
|
3294 |
] |
|
9891 | 3295 |
] |
3296 |
]. |
|
3297 |
]. |
|
3298 |
]. |
|
3299 |
s close |
|
3300 |
]. |
|
3301 |
^ targets |
|
3302 |
||
3303 |
"Created: / 20-04-2011 / 18:59:29 / cg" |
|
11802 | 3304 |
"Modified: / 12-09-2012 / 17:54:07 / cg" |
17071 | 3305 |
"Modified (format): / 16-11-2016 / 17:17:41 / cg" |
9891 | 3306 |
! |
3307 |
||
3308 |
javaScriptTagsInFile:aFilePath |
|
3309 |
"javaScript tags: |
|
3310 |
naive, q&d scan for lines matching: |
|
3311 |
(function foo |
|
3312 |
" |
|
3313 |
||
3314 |
|targets line l lineNr nm s| |
|
3315 |
||
3316 |
Tag autoload. |
|
3317 |
||
3318 |
targets := OrderedCollection new. |
|
3319 |
s := aFilePath asFilename readStream. |
|
3320 |
s notNil ifTrue:[ |
|
3321 |
s := LineNumberReadStream readingFrom:s. |
|
3322 |
[s atEnd] whileFalse:[ |
|
3323 |
lineNr := s lineNumber. |
|
3324 |
line := s nextLine. |
|
3325 |
l := line withoutSeparators. |
|
3326 |
||
14359 | 3327 |
(l = 'function') ifTrue:[ |
3328 |
l := l , ' ' , (s nextLine withoutSeparators). |
|
3329 |
]. |
|
9891 | 3330 |
(l startsWith:'function ') ifTrue:[ |
3331 |
(showOnly isNil or:[showOnly == #functions]) ifTrue:[ |
|
14346 | 3332 |
self hideFunctions ~~ true ifTrue:[ |
9891 | 3333 |
nm := l copyFrom:('function ' size + 1). |
3334 |
nm := nm copyTo:(nm |
|
3335 |
findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] |
|
3336 |
ifNone:nm size+1)-1. |
|
3337 |
targets add:(Tag::TFunction |
|
3338 |
label:nm |
|
3339 |
pattern:nil |
|
3340 |
type:nil |
|
3341 |
lineNumber:lineNr). |
|
3342 |
] |
|
3343 |
] |
|
3344 |
] ifFalse:[ |
|
3345 |
(l startsWith:'var ') ifTrue:[ |
|
3346 |
(showOnly isNil or:[showOnly == #variables]) ifTrue:[ |
|
14346 | 3347 |
self hideVariables ~~ true ifTrue:[ |
9891 | 3348 |
nm := l copyFrom:('var ' size + 1). |
3349 |
nm := nm copyTo:(nm |
|
3350 |
findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] |
|
3351 |
ifNone:nm size+1)-1. |
|
3352 |
targets add:(Tag::TVariable |
|
3353 |
label:nm |
|
3354 |
pattern:nil |
|
3355 |
type:nil |
|
3356 |
lineNumber:lineNr). |
|
3357 |
]. |
|
3358 |
]. |
|
15072 | 3359 |
] ifFalse:[ |
3360 |
((l includesString:'=function') or:[(l includesString:'= function')]) ifTrue:[ |
|
3361 |
(showOnly isNil or:[showOnly == #functions]) ifTrue:[ |
|
3362 |
self hideFunctions ~~ true ifTrue:[ |
|
3363 |
nm := l copyTo:((l indexOf:$=) - 1). nm := nm withoutSeparators. |
|
3364 |
targets add:(Tag::TFunction |
|
3365 |
label:nm |
|
3366 |
pattern:nil |
|
3367 |
type:nil |
|
3368 |
lineNumber:lineNr). |
|
3369 |
]. |
|
3370 |
]. |
|
3371 |
]. |
|
9891 | 3372 |
]. |
3373 |
] |
|
3374 |
]. |
|
3375 |
s close |
|
3376 |
]. |
|
3377 |
^ targets |
|
3378 |
||
3379 |
"Created: / 28-06-2010 / 12:44:25 / cg" |
|
9921 | 3380 |
"Modified: / 08-05-2011 / 10:39:55 / cg" |
9891 | 3381 |
! |
3382 |
||
3383 |
lispTagFromLine:line lineNr:lineNr |
|
14344 | 3384 |
"lisp/scheme tags: |
15912 | 3385 |
naive, q&d scan for lines starting with: |
9891 | 3386 |
(define ... |
3387 |
(defun ... |
|
3388 |
(defvar ... |
|
3389 |
(defmacro ... |
|
3390 |
(defclass ... |
|
3391 |
(defmethod ... |
|
3392 |
(defpackage ... |
|
3393 |
(eval-when ... |
|
3394 |
(define- ... |
|
3395 |
(def* ... |
|
3396 |
(set ... |
|
3397 |
(constant ... |
|
3398 |
(defconstant ... |
|
15912 | 3399 |
(define-constant ... |
9921 | 3400 |
;;; more documentation |
15912 | 3401 |
|
3402 |
This is NOT syntax aware, so affected by formatting, line breaks etc. |
|
3403 |
Just enough to allow most scheme and lisp programs to be tagged and |
|
3404 |
viewed in the file browser. For real lisp work, more is needed. |
|
9891 | 3405 |
" |
3406 |
||
14352 | 3407 |
|l nm words def inParens rest| |
9891 | 3408 |
|
3409 |
l := line withoutSeparators. |
|
3410 |
||
9921 | 3411 |
(l startsWith:'(') ifFalse:[ |
3412 |
(showOnly notNil and:[showOnly ~~ #documentation]) ifTrue:[^ nil]. |
|
14346 | 3413 |
self hideDocumentation == true ifTrue:[ ^ nil ]. |
9921 | 3414 |
|
3415 |
(l startsWith:';;;') ifFalse:[^ nil]. |
|
15912 | 3416 |
|
9921 | 3417 |
rest := (l copyFrom:4) withoutSeparators. |
3418 |
rest isEmpty ifTrue:[^ nil]. |
|
15288 | 3419 |
(rest conform:[:ch | ch == $;]) ifTrue:[^ nil]. |
9921 | 3420 |
^ Tag::TDocumentation |
16509 | 3421 |
label:(rest withColor:(Color blue "grey")) |
9921 | 3422 |
pattern:nil |
3423 |
type:nil |
|
3424 |
lineNumber:lineNr. |
|
3425 |
]. |
|
9891 | 3426 |
|
3427 |
words := (l copyFrom:2) asCollectionOfWords. |
|
3428 |
words size >= 2 ifFalse:[^ nil]. |
|
3429 |
||
3430 |
def := words first. |
|
3431 |
nm := words second. |
|
15912 | 3432 |
|
3433 |
"/ inparens is true if we have (define (name |
|
3434 |
(inParens := nm = '(') ifTrue:[ |
|
3435 |
words size > 2 ifTrue:[ nm := words third ] ifFalse:[ nm := '' ]. |
|
3436 |
] ifFalse:[ |
|
9891 | 3437 |
(inParens := nm startsWith:'(') ifTrue:[ |
3438 |
nm := nm copyFrom:2. |
|
15912 | 3439 |
] ifFalse:[ |
3440 |
nm := nm upTo:$(. "/ in case it is (define foo() - without space after name |
|
3441 |
(inParens := nm startsWith:'(') ifTrue:[ |
|
3442 |
nm := nm copyFrom:2. |
|
3443 |
]. |
|
9891 | 3444 |
]. |
15912 | 3445 |
]. |
9891 | 3446 |
(nm endsWith:')') ifTrue:[ |
14579 | 3447 |
nm := nm copyButLast |
9891 | 3448 |
]. |
3449 |
||
3450 |
def = 'define' ifTrue:[ "/ scheme |
|
3451 |
inParens ifTrue:[ |
|
3452 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3453 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
9891 | 3454 |
^ Tag::TFunction |
3455 |
label:nm |
|
3456 |
pattern:nil |
|
3457 |
type:nil |
|
3458 |
lineNumber:lineNr. |
|
3459 |
] ifFalse:[ |
|
14344 | 3460 |
"/ check for (define name (lambda ... |
3461 |
"/ and (define name (macro ... |
|
3462 |
(words size > 2 |
|
3463 |
and:[ words third startsWith:'(' ]) ifTrue:[ |
|
3464 |
(words third = '(' and:[words size > 3]) ifTrue:[ |
|
3465 |
def := words fourth |
|
3466 |
] ifFalse:[ |
|
3467 |
def := words third copyFrom:2. |
|
3468 |
]. |
|
3469 |
def = 'lambda' ifTrue:[ |
|
3470 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3471 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
14344 | 3472 |
^ Tag::TFunction |
3473 |
label:nm |
|
3474 |
pattern:nil |
|
3475 |
type:nil |
|
3476 |
lineNumber:lineNr. |
|
3477 |
]. |
|
3478 |
def = 'macro' ifTrue:[ |
|
3479 |
(showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil]. |
|
14346 | 3480 |
self hideLispMacros == true ifTrue:[ ^ nil ]. |
14344 | 3481 |
^ Tag::TLispMacro |
3482 |
label:nm |
|
3483 |
pattern:nil |
|
3484 |
type:nil |
|
3485 |
lineNumber:lineNr. |
|
3486 |
]. |
|
3487 |
]. |
|
9891 | 3488 |
(showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil]. |
14346 | 3489 |
self hideVariables == true ifTrue:[ ^ nil ]. |
9891 | 3490 |
^ Tag::TVariable |
3491 |
label:nm |
|
3492 |
pattern:nil |
|
3493 |
type:nil |
|
3494 |
lineNumber:lineNr. |
|
3495 |
]. |
|
3496 |
^ nil |
|
3497 |
]. |
|
3498 |
||
15912 | 3499 |
def = 'defun' ifTrue:[ |
3500 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
3501 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
|
3502 |
||
3503 |
^ Tag::TFunction |
|
3504 |
label:nm |
|
3505 |
pattern:nil |
|
3506 |
type:nil |
|
3507 |
lineNumber:lineNr. |
|
3508 |
]. |
|
9891 | 3509 |
def = 'defvar' ifTrue:[ |
3510 |
(showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil]. |
|
14346 | 3511 |
self hideVariables == true ifTrue:[ ^ nil ]. |
9891 | 3512 |
^ Tag::TVariable |
3513 |
label:nm |
|
3514 |
pattern:nil |
|
3515 |
type:nil |
|
3516 |
lineNumber:lineNr. |
|
3517 |
]. |
|
3518 |
def = 'set' ifTrue:[ |
|
14346 | 3519 |
self hideVariables == true ifTrue:[ ^ nil ]. |
9891 | 3520 |
^ Tag::TVariable |
3521 |
label:nm |
|
3522 |
pattern:nil |
|
3523 |
type:nil |
|
3524 |
lineNumber:lineNr. |
|
3525 |
]. |
|
15912 | 3526 |
(def = 'defconstant' or:[def = 'define-constant' or:[def = 'constant']]) ifTrue:[ |
9891 | 3527 |
(showOnly notNil and:[showOnly ~~ #constants]) ifTrue:[^ nil]. |
14346 | 3528 |
self hideLispConstants == true ifTrue:[ ^ nil ]. |
9891 | 3529 |
^ Tag::TLispConstant |
3530 |
label:nm |
|
3531 |
pattern:nil |
|
3532 |
type:nil |
|
3533 |
lineNumber:lineNr. |
|
3534 |
]. |
|
3535 |
(def = 'mac' or:[def = 'defmacro' or:[def = 'define-macro']]) ifTrue:[ |
|
3536 |
(showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil]. |
|
14346 | 3537 |
self hideLispMacros == true ifTrue:[ ^ nil ]. |
9891 | 3538 |
^ Tag::TLispMacro |
3539 |
label:nm |
|
3540 |
pattern:nil |
|
3541 |
type:nil |
|
3542 |
lineNumber:lineNr. |
|
3543 |
]. |
|
3544 |
(def = 'defclass' or:[def = 'define-class']) ifTrue:[ |
|
3545 |
(showOnly notNil and:[showOnly ~~ #classes]) ifTrue:[^ nil]. |
|
14346 | 3546 |
self hideClasses == true ifTrue:[ ^ nil ]. |
9891 | 3547 |
^ Tag::TClass |
3548 |
label:nm |
|
3549 |
pattern:nil |
|
3550 |
type:nil |
|
3551 |
lineNumber:lineNr. |
|
3552 |
]. |
|
3553 |
(def = 'defmethod' or:[def = 'define-method' or:[def = 'define-generic']]) ifTrue:[ |
|
3554 |
(showOnly notNil and:[showOnly ~~ #methods]) ifTrue:[^ nil]. |
|
14346 | 3555 |
self hideLispMethods == true ifTrue:[ ^ nil ]. |
9891 | 3556 |
^ Tag::TMethod |
3557 |
label:nm |
|
3558 |
pattern:nil |
|
3559 |
type:nil |
|
3560 |
lineNumber:lineNr. |
|
3561 |
]. |
|
3562 |
(def = 'defpackage') ifTrue:[ |
|
14346 | 3563 |
self hideLispMethods == true ifTrue:[ ^ nil ]. |
9891 | 3564 |
^ Tag::TPackage |
3565 |
label:nm |
|
3566 |
pattern:nil |
|
3567 |
type:nil |
|
3568 |
lineNumber:lineNr. |
|
3569 |
]. |
|
3570 |
def = 'eval-when' ifTrue:[ |
|
14346 | 3571 |
self hideLispEvaluations == true ifTrue:[ ^ nil ]. |
9891 | 3572 |
^ Tag::TLispEval |
14352 | 3573 |
label:nm |
9891 | 3574 |
pattern:nil |
3575 |
type:nil |
|
3576 |
lineNumber:lineNr. |
|
3577 |
]. |
|
3578 |
def = 'defstruct' ifTrue:[ |
|
14346 | 3579 |
self hideStructures == true ifTrue:[ ^ nil ]. |
9891 | 3580 |
^ Tag::TStruct |
3581 |
label:nm |
|
3582 |
pattern:nil |
|
3583 |
type:nil |
|
3584 |
lineNumber:lineNr. |
|
3585 |
]. |
|
3586 |
(def startsWith:'def') ifTrue:[ |
|
3587 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3588 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
9891 | 3589 |
^ Tag::TFunction |
3590 |
label:nm |
|
3591 |
pattern:nil |
|
3592 |
type:nil |
|
3593 |
lineNumber:lineNr. |
|
3594 |
]. |
|
3595 |
^ nil |
|
3596 |
||
9921 | 3597 |
"Modified: / 08-05-2011 / 10:57:03 / cg" |
9891 | 3598 |
! |
3599 |
||
3600 |
lispTagsInFile:aFilePath |
|
3601 |
"lisp tags: |
|
3602 |
naive, q&d scan for lines starting with (not syntax-aware): |
|
3603 |
(define ... |
|
3604 |
(defun ... |
|
3605 |
(defvar ... |
|
3606 |
(defmacro ... |
|
3607 |
(defclass ... |
|
3608 |
(defmethod ... |
|
3609 |
(defpackage ... |
|
3610 |
(eval-when ... |
|
3611 |
(define- ... |
|
3612 |
(def* ... |
|
3613 |
(set ... |
|
3614 |
(constant ... |
|
3615 |
(defconstant ... |
|
9921 | 3616 |
;;; moretext documentation |
9891 | 3617 |
" |
3618 |
||
14345 | 3619 |
^ self |
3620 |
linewiseNaiveTagsInFile:aFilePath |
|
3621 |
using:[:line :lineNr | |
|
3622 |
self lispTagFromLine:line lineNr:lineNr |
|
3623 |
] |
|
9891 | 3624 |
|
9921 | 3625 |
"Modified: / 08-05-2011 / 10:12:29 / cg" |
9891 | 3626 |
! |
3627 |
||
14345 | 3628 |
luaTagFromLine:line lineNr:lineNr |
3629 |
"lua tags: |
|
3630 |
naive, q&d scan for lines starting with (not syntax-aware): |
|
3631 |
local function ... |
|
3632 |
" |
|
3633 |
||
3634 |
|l nm words def isLocal| |
|
3635 |
||
3636 |
l := line withoutSeparators. |
|
3637 |
||
3638 |
(l startsWith:'--') ifTrue:[^ nil]. "/ comment |
|
3639 |
||
3640 |
words := l splitByAny:(' (),',Character tab). |
|
3641 |
words size >= 2 ifFalse:[^ nil]. |
|
3642 |
||
3643 |
(isLocal := words first = 'local') ifTrue:[ words := words copyFrom:2 ]. |
|
3644 |
words size <= 2 ifTrue:[ ^ nil ]. |
|
3645 |
def := words first. |
|
3646 |
nm := words second. |
|
3647 |
||
3648 |
def = 'function' ifTrue:[ |
|
3649 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3650 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
14345 | 3651 |
^ Tag::TFunction |
3652 |
label:nm |
|
3653 |
pattern:nil |
|
3654 |
type:nil |
|
3655 |
lineNumber:lineNr. |
|
3656 |
]. |
|
3657 |
||
3658 |
isLocal ifTrue:[ |
|
3659 |
(words includes:'=') ifTrue:[ |
|
3660 |
words := words copyTo:(words indexOf:'=')-1 |
|
3661 |
]. |
|
3662 |
^ words |
|
3663 |
collect:[:eachVar | |
|
3664 |
Tag::TVariable |
|
3665 |
label:eachVar |
|
3666 |
pattern:nil |
|
3667 |
type:nil |
|
3668 |
lineNumber:lineNr. |
|
3669 |
] |
|
3670 |
as:Array. |
|
3671 |
]. |
|
3672 |
||
3673 |
^ nil |
|
3674 |
! |
|
3675 |
||
3676 |
luaTagsInFile:aFilePath |
|
3677 |
"lua tags: |
|
3678 |
naive, q&d scan for lines starting with (not syntax-aware): |
|
3679 |
local function ... |
|
3680 |
" |
|
3681 |
||
3682 |
^ self |
|
3683 |
linewiseNaiveTagsInFile:aFilePath |
|
3684 |
using:[:line :lineNr | |
|
3685 |
self luaTagFromLine:line lineNr:lineNr |
|
3686 |
] |
|
3687 |
! |
|
3688 |
||
16280 | 3689 |
objcTagFromLine:line lineNr:lineNr |
3690 |
"objc tags: |
|
3691 |
naive, q&d scan for lines starting with some common patterns" |
|
3692 |
||
3693 |
|l nm lineStream kwLen type hideHolder skipType| |
|
3694 |
||
3695 |
l := line withoutSeparators. |
|
3696 |
skipType := false. |
|
3697 |
||
3698 |
(l startsWith:'@interface') ifTrue:[ |
|
3699 |
kwLen := '@interface' size. |
|
3700 |
type := Tag::TInterface. |
|
3701 |
hideHolder := self hideObjcClasses. |
|
3702 |
]. |
|
3703 |
(l startsWith:'@implementation') ifTrue:[ |
|
3704 |
kwLen := '@implementation' size. |
|
3705 |
type := Tag::TClass. |
|
3706 |
hideHolder := self hideObjcClasses. |
|
3707 |
]. |
|
3708 |
(l startsWith:'@property') ifTrue:[ |
|
3709 |
kwLen := '@property' size. |
|
3710 |
type := Tag::TMacro. |
|
3711 |
]. |
|
3712 |
(l startsWithAnyOf:'+-') ifTrue:[ |
|
3713 |
kwLen := 1. |
|
3714 |
type := Tag::TMethod. |
|
3715 |
hideHolder := self hideObjcMethods. |
|
3716 |
skipType := true. |
|
3717 |
]. |
|
3718 |
hideHolder value ~~ true ifTrue:[ |
|
3719 |
kwLen notNil ifTrue:[ |
|
3720 |
lineStream := l readStream. |
|
3721 |
lineStream skip:kwLen; skipSeparators. |
|
3722 |
skipType ifTrue:[ |
|
3723 |
lineStream peek == $( ifTrue:[ |
|
3724 |
lineStream next. lineStream skipThrough:$). |
|
3725 |
lineStream skipSeparators. |
|
3726 |
]. |
|
3727 |
]. |
|
3728 |
||
3729 |
nm := lineStream upToElementForWhich:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not]. |
|
3730 |
(nm notEmpty and:[nm first isLetterOrUnderline]) ifTrue:[ |
|
3731 |
^ type |
|
3732 |
label:nm |
|
3733 |
pattern:nil |
|
3734 |
type:nil |
|
3735 |
lineNumber:lineNr. |
|
3736 |
] |
|
3737 |
]. |
|
3738 |
]. |
|
3739 |
||
3740 |
^ nil |
|
3741 |
! |
|
3742 |
||
3743 |
objcTagsInFile:aFilePath |
|
3744 |
"objc tags: |
|
3745 |
naive, q&d scan for lines starting with some wellknown patterns" |
|
3746 |
||
3747 |
^ self |
|
3748 |
linewiseNaiveTagsInFile:aFilePath |
|
3749 |
using:[:line :lineNr | |
|
3750 |
self objcTagFromLine:line lineNr:lineNr |
|
3751 |
] |
|
3752 |
! |
|
3753 |
||
14345 | 3754 |
ozTagFromLine:line lineNr:lineNr |
3755 |
"oz tags: |
|
3756 |
naive, q&d scan for lines starting with: |
|
3757 |
fun { name ... |
|
3758 |
" |
|
3759 |
||
3760 |
|l nm lineStream kwLen skipBrace type hideHolder| |
|
3761 |
||
3762 |
l := line withoutSeparators. |
|
3763 |
||
3764 |
kwLen := nil. |
|
3765 |
skipBrace := false. |
|
3766 |
||
3767 |
(l startsWith:'class') ifTrue:[ |
|
3768 |
kwLen := 5. |
|
3769 |
type := Tag::TClass. |
|
14346 | 3770 |
hideHolder := self hideOzClasses. |
14345 | 3771 |
]. |
3772 |
(l startsWith:'meth') ifTrue:[ |
|
3773 |
kwLen := 4. |
|
3774 |
type := Tag::TMethod. |
|
14346 | 3775 |
hideHolder := self hideOzMethods. |
14345 | 3776 |
]. |
3777 |
(l startsWith:'fun') ifTrue:[ |
|
3778 |
kwLen := 3. |
|
3779 |
skipBrace := true. |
|
3780 |
type := Tag::TFunction. |
|
14346 | 3781 |
hideHolder := self hideOzFunctions. |
14345 | 3782 |
]. |
3783 |
(l startsWith:'proc') ifTrue:[ |
|
3784 |
kwLen := 4. |
|
3785 |
skipBrace := true. |
|
3786 |
type := Tag::TFunction. |
|
14346 | 3787 |
hideHolder := self hideOzFunctions. |
14345 | 3788 |
]. |
3789 |
hideHolder value ~~ true ifTrue:[ |
|
3790 |
kwLen notNil ifTrue:[ |
|
3791 |
lineStream := l readStream. |
|
3792 |
lineStream skip:kwLen; skipSeparators. |
|
3793 |
||
3794 |
(skipBrace not or:[lineStream peek = ${ ]) ifTrue:[ |
|
3795 |
skipBrace ifTrue:[lineStream skip:1; skipSeparators]. |
|
14538 | 3796 |
nm := lineStream upToElementForWhich:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not]. |
15220 | 3797 |
(nm notEmpty and:[nm first isLetterOrUnderline]) ifTrue:[ |
14345 | 3798 |
^ type |
3799 |
label:nm |
|
3800 |
pattern:nil |
|
3801 |
type:nil |
|
3802 |
lineNumber:lineNr. |
|
3803 |
] |
|
3804 |
] |
|
3805 |
]. |
|
3806 |
]. |
|
3807 |
^ nil |
|
3808 |
! |
|
3809 |
||
9891 | 3810 |
ozTagsInFile:aFilePath |
3811 |
"oz tags: |
|
3812 |
naive, q&d scan for lines starting with: |
|
3813 |
fun { name ... |
|
3814 |
" |
|
3815 |
||
14345 | 3816 |
^ self |
3817 |
linewiseNaiveTagsInFile:aFilePath |
|
3818 |
using:[:line :lineNr | |
|
3819 |
self ozTagFromLine:line lineNr:lineNr |
|
3820 |
] |
|
3821 |
! |
|
3822 |
||
3823 |
phpTagFromLine:line lineNr:lineNr |
|
3824 |
"php tags: |
|
3825 |
naive, q&d scan for lines starting with: |
|
3826 |
var ... |
|
3827 |
class ... |
|
3828 |
function ... |
|
3829 |
" |
|
3830 |
||
3831 |
|l nm lineStream| |
|
3832 |
||
3833 |
l := line withoutSeparators. |
|
14669 | 3834 |
(l startsWith:'public ') ifTrue:[ l := (l copyFrom:'public ' size + 1) withoutSeparators ]. |
14681 | 3835 |
(l startsWith:'private ') ifTrue:[ l := (l copyFrom:'private ' size + 1) withoutSeparators ]. |
14345 | 3836 |
|
3837 |
(l startsWith:'var ') ifTrue:[ |
|
14669 | 3838 |
lineStream := (l copyFrom:'var ' size) readStream. |
14345 | 3839 |
lineStream skipSeparators. |
3840 |
lineStream peek == $$ ifTrue:[ |
|
3841 |
lineStream next. |
|
3842 |
nm := lineStream |
|
3843 |
nextMatching:[:c | c isLetter] |
|
3844 |
thenMatching:[:c | c isLetterOrDigit or:[c == $_]]. |
|
3845 |
^ (Tag::TVariable |
|
3846 |
label:nm |
|
3847 |
pattern:nil |
|
3848 |
type:nil |
|
3849 |
lineNumber:lineNr). |
|
3850 |
] |
|
3851 |
] ifFalse:[ |
|
14681 | 3852 |
((l startsWith:'class ') or:[l startsWith:'Class '])ifTrue:[ |
14669 | 3853 |
lineStream := (l copyFrom:'class ' size) readStream. |
14345 | 3854 |
lineStream skipSeparators. |
3855 |
nm := lineStream |
|
3856 |
nextMatching:[:c | c isLetter] |
|
3857 |
thenMatching:[:c | c isLetterOrDigit or:[c == $_]]. |
|
3858 |
^ (Tag::TClass |
|
3859 |
label:nm |
|
3860 |
pattern:nil |
|
3861 |
type:nil |
|
3862 |
lineNumber:lineNr). |
|
3863 |
] ifFalse:[ |
|
14681 | 3864 |
((l startsWith:'function ') or:[l startsWith:'Function ']) ifTrue:[ |
14669 | 3865 |
lineStream := (l copyFrom:'function ' size) readStream. |
14345 | 3866 |
lineStream skipSeparators. |
3867 |
nm := lineStream |
|
14669 | 3868 |
nextMatching:[:c | c isLetter or:[c == $_]] |
14345 | 3869 |
thenMatching:[:c | c isLetterOrDigit or:[c == $_]]. |
3870 |
^ (Tag::TFunction |
|
3871 |
label:nm |
|
3872 |
pattern:nil |
|
3873 |
type:nil |
|
3874 |
lineNumber:lineNr). |
|
9891 | 3875 |
]. |
3876 |
]. |
|
3877 |
]. |
|
14345 | 3878 |
^ nil |
9891 | 3879 |
! |
3880 |
||
3881 |
phpTagsInFile:aFilePath |
|
3882 |
"php tags: |
|
3883 |
naive, q&d scan for lines starting with: |
|
3884 |
var ... |
|
3885 |
class ... |
|
3886 |
function ... |
|
3887 |
" |
|
3888 |
||
14345 | 3889 |
^ self |
3890 |
linewiseNaiveTagsInFile:aFilePath |
|
3891 |
using:[:line :lineNr | |
|
3892 |
self phpTagFromLine:line lineNr:lineNr |
|
3893 |
] |
|
3894 |
! |
|
3895 |
||
3896 |
prologTagFromLine:line lineNr:lineNr |
|
3897 |
"prolog tags: |
|
3898 |
naive, q&d scan for lines matching: |
|
3899 |
<anything> :- |
|
3900 |
" |
|
3901 |
||
3902 |
|l nm| |
|
3903 |
||
3904 |
l := line withoutSeparators. |
|
3905 |
||
3906 |
(l includesString:':-') ifTrue:[ |
|
3907 |
(l startsWith:':-') ifFalse:[ |
|
3908 |
nm := l copyTo:(l indexOfSubCollection:':-'). |
|
3909 |
^ (Tag::TPrologClause |
|
3910 |
label:nm |
|
3911 |
pattern:nil |
|
3912 |
type:nil |
|
3913 |
lineNumber:lineNr). |
|
3914 |
] |
|
9891 | 3915 |
]. |
14345 | 3916 |
^ nil |
9891 | 3917 |
! |
3918 |
||
3919 |
prologTagsInFile:aFilePath |
|
3920 |
"prolog tags: |
|
3921 |
naive, q&d scan for lines matching: |
|
3922 |
<anything> :- |
|
3923 |
" |
|
3924 |
||
14345 | 3925 |
^ self |
3926 |
linewiseNaiveTagsInFile:aFilePath |
|
3927 |
using:[:line :lineNr | |
|
3928 |
self prologTagFromLine:line lineNr:lineNr |
|
3929 |
] |
|
9891 | 3930 |
! |
3931 |
||
3932 |
pythonTagsInFile:aFilePath |
|
3933 |
"python tags: |
|
3934 |
naive, q&d scan for lines matching |
|
3935 |
class <anything> : |
|
3936 |
or |
|
3937 |
def <anything> : |
|
3938 |
" |
|
3939 |
||
3940 |
|targets line l lineNr nm s inClass indent classIndent| |
|
3941 |
||
3942 |
Tag autoload. |
|
3943 |
||
3944 |
inClass := nil. |
|
3945 |
targets := OrderedCollection new. |
|
3946 |
s := aFilePath asFilename readStream. |
|
3947 |
inClass := OrderedCollection new. |
|
3948 |
classIndent := 0. |
|
3949 |
||
3950 |
s notNil ifTrue:[ |
|
3951 |
s := LineNumberReadStream readingFrom:s. |
|
3952 |
[s atEnd] whileFalse:[ |
|
3953 |
lineNr := s lineNumber. |
|
3954 |
line := s nextLine. |
|
3955 |
l := line withoutSeparators. |
|
3956 |
l size > 0 ifTrue:[ |
|
3957 |
||
3958 |
line := line withTabsExpanded:8. |
|
3959 |
indent := line findFirst:[:c | c ~~ Character space]. |
|
3960 |
indent := indent // 8. |
|
3961 |
indent < classIndent ifTrue:[ |
|
3962 |
inClass removeFirstIfAbsent:nil. |
|
3963 |
classIndent := classIndent - 1. |
|
3964 |
]. |
|
3965 |
||
3966 |
(l startsWith:'class ') ifTrue:[ |
|
3967 |
(l endsWith:':') ifTrue:[ |
|
3968 |
nm := l copyFrom:7 to:(l size - 1). |
|
3969 |
nm := nm withoutSeparators. |
|
3970 |
(showOnly ~~ #pythonFunctions |
|
3971 |
and:[showOnly ~~ #pythonMethods]) ifTrue:[ |
|
14346 | 3972 |
self hidePythonClasses ~~ true ifTrue:[ |
9891 | 3973 |
targets add:(Tag::TClass |
3974 |
label:nm |
|
3975 |
pattern:nil |
|
3976 |
type:nil |
|
3977 |
lineNumber:lineNr). |
|
3978 |
]. |
|
3979 |
]. |
|
3980 |
nm := nm upTo:$(. |
|
3981 |
inClass addFirst:nm. |
|
3982 |
classIndent := indent + 1. |
|
3983 |
] |
|
3984 |
] ifFalse:[ |
|
3985 |
(l startsWith:'def ') ifTrue:[ |
|
3986 |
(l endsWith:':') ifTrue:[ |
|
3987 |
nm := l copyFrom:5 to:(l size - 1). |
|
3988 |
nm := nm withoutSeparators. |
|
3989 |
||
3990 |
inClass size > 0 ifTrue:[ |
|
3991 |
(showOnly ~~ #pythonFunctions |
|
3992 |
and:[showOnly ~~ #pythonClasses]) ifTrue:[ |
|
14346 | 3993 |
self hidePythonMethods ~~ true ifTrue:[ |
9891 | 3994 |
nm := inClass first , '.' , nm. |
3995 |
targets add:(Tag::TMethod |
|
3996 |
label:nm |
|
3997 |
pattern:nil |
|
3998 |
type:nil |
|
3999 |
lineNumber:lineNr). |
|
4000 |
] |
|
4001 |
] |
|
4002 |
] ifFalse:[ |
|
4003 |
(showOnly ~~ #pythonClasses |
|
4004 |
and:[showOnly ~~ #pythonMethods]) ifTrue:[ |
|
14346 | 4005 |
self hidePythonFunctions ~~ true ifTrue:[ |
9891 | 4006 |
targets add:(Tag::TFunction |
4007 |
label:nm |
|
4008 |
pattern:nil |
|
4009 |
type:nil |
|
4010 |
lineNumber:lineNr). |
|
4011 |
] |
|
4012 |
] |
|
4013 |
] |
|
4014 |
] |
|
4015 |
] |
|
4016 |
] |
|
4017 |
] |
|
4018 |
]. |
|
4019 |
s close |
|
4020 |
]. |
|
4021 |
^ targets |
|
9921 | 4022 |
|
4023 |
"Modified: / 08-05-2011 / 10:39:10 / cg" |
|
9891 | 4024 |
! |
4025 |
||
14345 | 4026 |
rubyTagFromLine:line lineNr:lineNr |
4027 |
"ruby tags: |
|
4028 |
naive, q&d scan for lines matching: |
|
4029 |
def any |
|
4030 |
" |
|
4031 |
||
4032 |
|l nm| |
|
4033 |
||
4034 |
l := line withoutSeparators. |
|
4035 |
||
4036 |
(l startsWith:'def ') ifTrue:[ |
|
4037 |
nm := l copyFrom:5. |
|
4038 |
^ (Tag::TFunction |
|
4039 |
label:nm |
|
4040 |
pattern:nil |
|
4041 |
type:nil |
|
4042 |
lineNumber:lineNr). |
|
4043 |
] ifFalse:[ |
|
4044 |
(l startsWith:'class ') ifTrue:[ |
|
14346 | 4045 |
self hideClasses == true ifFalse:[ |
14345 | 4046 |
nm := l copyFrom:6. |
4047 |
^ (Tag::TClass |
|
4048 |
label:nm |
|
4049 |
pattern:nil |
|
4050 |
type:nil |
|
4051 |
lineNumber:lineNr). |
|
4052 |
] |
|
4053 |
]. |
|
4054 |
]. |
|
4055 |
^ nil |
|
4056 |
||
4057 |
"Modified: / 08-05-2011 / 10:38:44 / cg" |
|
4058 |
! |
|
4059 |
||
9891 | 4060 |
rubyTagsInFile:aFilePath |
4061 |
"ruby tags: |
|
4062 |
naive, q&d scan for lines matching: |
|
4063 |
def any |
|
4064 |
" |
|
4065 |
||
14345 | 4066 |
^ self |
4067 |
linewiseNaiveTagsInFile:aFilePath |
|
4068 |
using:[:line :lineNr | |
|
4069 |
self rubyTagFromLine:line lineNr:lineNr |
|
4070 |
] |
|
9921 | 4071 |
|
4072 |
"Modified: / 08-05-2011 / 10:38:44 / cg" |
|
9891 | 4073 |
! |
4074 |
||
11050 | 4075 |
stTagsInFile:aFilePath in:aTempDirectory |
9891 | 4076 |
"smalltalk tags: |
11050 | 4077 |
not so naive: generate a changeList from the contents and convert it into a tag-list |
9891 | 4078 |
" |
4079 |
||
11050 | 4080 |
|targets s anyPrimitiveDefinitions shellCmd cTagsList| |
9891 | 4081 |
|
4082 |
Tag autoload. |
|
4083 |
||
11050 | 4084 |
anyPrimitiveDefinitions := false. |
9891 | 4085 |
targets := OrderedCollection new. |
4086 |
s := aFilePath asFilename readStream. |
|
4087 |
s notNil ifTrue:[ |
|
4088 |
s := LineNumberReadStream readingFrom:s. |
|
4089 |
s skipSeparators. |
|
4090 |
||
4091 |
"/ new interface: block-arg to #changesFromStream:do: gets 3 args |
|
4092 |
[ |
|
4093 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
15168 | 4094 |
Dialog warn:('TagList [info]: Error while processing changes in "%1":\\%2' withCRs |
4095 |
bindWith:aFilePath asFilename pathName |
|
4096 |
with: ex description). |
|
9891 | 4097 |
] do:[ |
4098 |
ChangeSet changesFromStream:s do:[:aChange :lNr :pos| |
|
4099 |
aChange isClassDefinitionChange ifTrue:[ |
|
14346 | 4100 |
self hideClasses == true ifFalse:[ |
9921 | 4101 |
targets add:(Tag::TClass |
9891 | 4102 |
label:(aChange className) |
4103 |
pattern:('/subclass:') |
|
4104 |
type:nil |
|
4105 |
lineNumber:lNr). |
|
9921 | 4106 |
] |
9891 | 4107 |
] ifFalse:[ |
4108 |
aChange isMethodChange ifTrue:[ |
|
14346 | 4109 |
self hideMethods == true ifFalse:[ |
13450 | 4110 |
targets add:((Tag::TMethod |
9891 | 4111 |
label:(aChange selector) |
4112 |
pattern:('/^' , aChange selector) |
|
4113 |
type:nil |
|
13450 | 4114 |
lineNumber:lNr) |
4115 |
isMeta:(aChange className endsWith:' class')). |
|
9921 | 4116 |
] |
11050 | 4117 |
] ifFalse:[ |
4118 |
aChange isPrimitiveChange ifTrue:[ |
|
4119 |
targets add:(Tag::TMacro |
|
4120 |
label:(aChange isPrimitiveDefinitionsChange |
|
11051 | 4121 |
ifTrue:['<< primitive definitions >>'] |
11050 | 4122 |
ifFalse:[ (aChange isPrimitiveFunctionsChange |
11051 | 4123 |
ifTrue:['<< primitive functions >>'] |
4124 |
ifFalse:['<< primitive variables >>'])]) |
|
11050 | 4125 |
pattern:('/^' , aChange source asStringCollection first) |
4126 |
type:nil |
|
4127 |
lineNumber:lNr). |
|
4128 |
anyPrimitiveDefinitions := true |
|
4129 |
] |
|
9891 | 4130 |
] |
4131 |
]. |
|
4132 |
] |
|
4133 |
] |
|
4134 |
] ensure:[ |
|
4135 |
s close. |
|
4136 |
]. |
|
4137 |
]. |
|
11050 | 4138 |
|
4139 |
anyPrimitiveDefinitions ifTrue:[ |
|
4140 |
"/ also invoke ctags on the file, merge those tags. |
|
4141 |
"/ sorry: not perfect, because ctags seems to get confused by the extra %{ %} nesting. |
|
4142 |
shellCmd := (self shellCommandTemplateFor:(aFilePath asFilename withSuffix:'c') pathName) |
|
4143 |
bindWith:aFilePath. |
|
4144 |
shellCmd notNil ifTrue:[ |
|
4145 |
cTagsList := self getTagListFromFile:aFilePath asFilename usingCommand:shellCmd mode:#c in:aTempDirectory. |
|
4146 |
cTagsList notEmptyOrNil ifTrue:[ |
|
4147 |
^ cTagsList , targets |
|
4148 |
]. |
|
4149 |
]. |
|
4150 |
]. |
|
4151 |
||
9891 | 4152 |
^ targets |
9921 | 4153 |
|
11050 | 4154 |
"Created: / 05-01-2012 / 10:56:26 / cg" |
9891 | 4155 |
! |
4156 |
||
15711 | 4157 |
stxResourceTagsInFile:aFilePath |
4158 |
"resource tags: |
|
4159 |
scan for translated entries to show them alphabetically" |
|
4160 |
||
4161 |
|rsrcPack| |
|
4162 |
||
4163 |
rsrcPack := ResourcePack fromFile:aFilePath. |
|
4164 |
^ self |
|
4165 |
linewiseNaiveTagsInFile:aFilePath |
|
4166 |
using:[:rawLine :lineNr | |
|
4167 |
|line key tag| |
|
4168 |
||
4169 |
line := rawLine withoutSeparators. |
|
4170 |
(line isEmpty or:[line startsWithAnyOf:'#;']) ifFalse:[ |
|
4171 |
(line startsWith:$') ifTrue:[ |
|
4172 |
"read as smalltalk string" |
|
4173 |
key := String readFrom:line. |
|
4174 |
] ifFalse:[ |
|
4175 |
key := line upToSeparator. |
|
4176 |
]. |
|
4177 |
(rsrcPack includesKey:key) ifTrue:[ |
|
4178 |
tag := Tag::TLabel |
|
4179 |
label:key |
|
4180 |
pattern:nil |
|
4181 |
type:nil |
|
4182 |
lineNumber:lineNr. |
|
4183 |
] |
|
4184 |
]. |
|
4185 |
tag |
|
4186 |
]. |
|
4187 |
! |
|
4188 |
||
14345 | 4189 |
tclTagFromLine:line lineNr:lineNr |
4190 |
"tcl tags: |
|
4191 |
naive, q&d scan for lines matching: |
|
4192 |
proc any |
|
4193 |
" |
|
4194 |
||
4195 |
|l nm words| |
|
4196 |
||
4197 |
l := line withoutSeparators. |
|
4198 |
||
4199 |
(l startsWith:'proc ') ifTrue:[ |
|
4200 |
nm := l withoutPrefix:'proc '. |
|
4201 |
^(Tag::TFunction |
|
4202 |
label:nm |
|
4203 |
pattern:nil |
|
4204 |
type:nil |
|
4205 |
lineNumber:lineNr). |
|
4206 |
] ifFalse:[ (l startsWith:'tixWidgetClass ') ifTrue:[ |
|
4207 |
nm := l copyFrom:'tixWidgetClass ' size + 1. |
|
4208 |
(nm endsWith:'{') ifTrue:[ |
|
14579 | 4209 |
nm := (nm copyButLast) withoutSeparators. |
14345 | 4210 |
]. |
4211 |
^(Tag::TClass |
|
4212 |
label:nm |
|
4213 |
pattern:nil |
|
4214 |
type:nil |
|
4215 |
lineNumber:lineNr). |
|
4216 |
] ifFalse:[ (l startsWith:'set ') ifTrue:[ |
|
14346 | 4217 |
self hideVariables ~~ true ifTrue:[ |
14345 | 4218 |
words := l asCollectionOfWords. |
4219 |
words size >= 2 ifTrue:[ |
|
4220 |
nm := words second. |
|
4221 |
^(Tag::TVariable |
|
4222 |
label:nm |
|
4223 |
pattern:nil |
|
4224 |
type:nil |
|
4225 |
lineNumber:lineNr). |
|
4226 |
] |
|
4227 |
]]]]. |
|
4228 |
^ nil |
|
4229 |
! |
|
4230 |
||
9891 | 4231 |
tclTagsInFile:aFilePath |
4232 |
"tcl tags: |
|
4233 |
naive, q&d scan for lines matching: |
|
4234 |
proc any |
|
4235 |
" |
|
4236 |
||
14345 | 4237 |
^ self |
4238 |
linewiseNaiveTagsInFile:aFilePath |
|
4239 |
using:[:line :lineNr | |
|
4240 |
self tclTagFromLine:line lineNr:lineNr |
|
4241 |
] |
|
9891 | 4242 |
! |
4243 |
||
15685 | 4244 |
xsdTagFromLine:line lineNr:lineNr |
15711 | 4245 |
"xsd schema tags: |
15685 | 4246 |
naive, q&d scan for lines matching: |
4247 |
<xsd:complexType... |
|
4248 |
<xsd:simpleType ... |
|
4249 |
Should be replaced by a more sophisticated reader, which parses the xml first. |
|
4250 |
" |
|
4251 |
||
4252 |
|l nm i1 i2| |
|
4253 |
||
4254 |
l := line withoutSeparators. |
|
4255 |
||
15706 | 4256 |
((l includesString:':complexType ') or:[l includesString:':simpleType ']) ifTrue:[ |
15685 | 4257 |
i1 := l findString:'name="'. |
4258 |
i1 ~~ 0 ifTrue:[ |
|
4259 |
nm := l copyFrom:(i1 + 'name="' size). |
|
4260 |
i2 := nm indexOf:$". |
|
4261 |
nm := nm copyTo:i2-1. |
|
4262 |
^(Tag::TTypedef |
|
4263 |
label:nm |
|
4264 |
pattern:nil |
|
4265 |
type:nil |
|
4266 |
lineNumber:lineNr). |
|
4267 |
]. |
|
4268 |
]. |
|
15706 | 4269 |
(l includesString:':element ') ifTrue:[ |
15689 | 4270 |
i1 := l findString:'name="'. |
4271 |
i1 ~~ 0 ifTrue:[ |
|
4272 |
nm := l copyFrom:(i1 + 'name="' size). |
|
4273 |
i2 := nm indexOf:$". |
|
4274 |
nm := nm copyTo:i2-1. |
|
4275 |
^(Tag::TElement |
|
4276 |
label:nm |
|
4277 |
pattern:nil |
|
4278 |
type:nil |
|
4279 |
lineNumber:lineNr). |
|
4280 |
]. |
|
4281 |
]. |
|
15685 | 4282 |
^ nil |
4283 |
! |
|
4284 |
||
4285 |
xsdTagsInFile:aFilePath |
|
4286 |
"xsd tags: |
|
4287 |
naive, q&d scan for lines matching: |
|
4288 |
<xsd:complexType... |
|
4289 |
<xsd:simpleType ... |
|
4290 |
Should be replaced by a more sophisticated reader, which parses the xml first. |
|
4291 |
" |
|
4292 |
||
4293 |
^ self |
|
4294 |
linewiseNaiveTagsInFile:aFilePath |
|
4295 |
using:[:line :lineNr | |
|
4296 |
self xsdTagFromLine:line lineNr:lineNr |
|
4297 |
] |
|
4298 |
! |
|
4299 |
||
9891 | 4300 |
yaccTagsInFile:aFilePath |
4301 |
"yacc tags: |
|
4302 |
naive, q&d scan for lines matching: |
|
4303 |
<anything>: |
|
4304 |
" |
|
4305 |
||
11825 | 4306 |
^ self tagsForLinesStartingWithIdentifierAndColon:aFilePath |
4307 |
||
4308 |
"Modified: / 28-09-2012 / 14:45:52 / cg" |
|
9891 | 4309 |
! ! |
4310 |
||
4311 |
!TagList methodsFor:'testing'! |
|
4312 |
||
4313 |
supportsFile:aFile |
|
4314 |
"return true, if we can generate tags for a file" |
|
4315 |
||
4316 |
aFile isReadable ifFalse:[^ false]. |
|
4317 |
||
4318 |
"/ cg: now always return true - let generateTag run against the wall... |
|
4319 |
^ true. |
|
4320 |
||
13335 | 4321 |
"/ lcSuffix := aFile suffix asLowercase. |
9891 | 4322 |
"/ selfClass := self class. |
4323 |
"/ |
|
13335 | 4324 |
"/ lcSuffix size ~~ 0 ifTrue:[ |
9891 | 4325 |
"/ ((selfClass isCSuffix:lcSuffix) |
4326 |
"/ or:[(selfClass isJavaSuffix:lcSuffix) |
|
4327 |
"/ or:[(selfClass isEiffelSuffix:lcSuffix) |
|
4328 |
"/ or:[(selfClass isFortranSuffix:lcSuffix) |
|
4329 |
"/ or:[(selfClass isPythonSuffix:lcSuffix) |
|
4330 |
"/ or:[(selfClass isLispSuffix:lcSuffix) |
|
4331 |
"/ or:[(selfClass isPrologSuffix:lcSuffix) |
|
4332 |
"/ or:[(selfClass isTCLSuffix:lcSuffix) |
|
4333 |
"/ or:[(selfClass isAssemblerSuffix:lcSuffix) |
|
4334 |
"/ or:[(selfClass isSmalltalkSuffix:lcSuffix) |
|
4335 |
"/ or:[(selfClass isRubySuffix:lcSuffix)]]]]]]]]]]) |
|
4336 |
"/ ifTrue:[ |
|
4337 |
"/ ^ true |
|
4338 |
"/ ]. |
|
4339 |
"/ ]. |
|
4340 |
"/ |
|
4341 |
"/ lcName := aFile baseName asLowercase. |
|
13335 | 4342 |
"/ ^ selfClass makeFilePatterns contains:[:pattern | pattern match:lcName] |
9891 | 4343 |
! ! |
4344 |
||
4345 |
!TagList class methodsFor:'documentation'! |
|
4346 |
||
11051 | 4347 |
version |
15685 | 4348 |
^ '$Header$' |
11051 | 4349 |
! |
4350 |
||
9891 | 4351 |
version_CVS |
15685 | 4352 |
^ '$Header$' |
10054 | 4353 |
! |
4354 |
||
4355 |
version_SVN |
|
15685 | 4356 |
^ '$Id$' |
9891 | 4357 |
! ! |
12332 | 4358 |