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