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