author | Claus Gittinger <cg@exept.de> |
Wed, 21 May 2014 11:03:22 +0200 | |
changeset 14382 | 0db5bded6291 |
parent 14365 | a6adb2b65b83 |
child 14385 | ff99b97f1273 |
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 |
||
960 |
hideLispConstants |
|
14346 | 961 |
^ self flagNamed:#hideLispConstants |
9891 | 962 |
! |
963 |
||
964 |
hideLispConstants:aBoolean |
|
14346 | 965 |
self flagNamed:#hideLispConstants put:aBoolean. |
9891 | 966 |
|
967 |
"Modified: / 05-05-2011 / 15:22:46 / cg" |
|
968 |
! |
|
969 |
||
970 |
hideLispEvaluations |
|
14346 | 971 |
^ self flagNamed:#hideLispEvaluations |
9891 | 972 |
! |
973 |
||
974 |
hideLispEvaluations:aBoolean |
|
14346 | 975 |
self flagNamed:#hideLispEvaluations put:aBoolean. |
9891 | 976 |
|
977 |
"Modified: / 05-05-2011 / 15:22:49 / cg" |
|
978 |
! |
|
979 |
||
980 |
hideLispMacros |
|
14346 | 981 |
^ self flagNamed:#hideLispMacros |
9891 | 982 |
! |
983 |
||
984 |
hideLispMacros:aBoolean |
|
14346 | 985 |
self flagNamed:#hideLispMacros put:aBoolean. |
9891 | 986 |
|
987 |
"Modified: / 05-05-2011 / 15:22:50 / cg" |
|
988 |
! |
|
989 |
||
990 |
hideLispMethods |
|
14346 | 991 |
^ self flagNamed:#hideLispMethods |
9891 | 992 |
! |
993 |
||
994 |
hideLispMethods:aBoolean |
|
14346 | 995 |
self flagNamed:#hideLispMethods put:aBoolean. |
9891 | 996 |
|
997 |
"Modified: / 05-05-2011 / 15:22:53 / cg" |
|
998 |
! |
|
999 |
||
1000 |
hideLocalLabels |
|
14346 | 1001 |
^ self flagNamed:#hideLocalLabels |
9891 | 1002 |
! |
1003 |
||
11466 | 1004 |
hideLocalLabels2 |
14346 | 1005 |
^ self flagNamed:#hideLocalLabels2 |
11466 | 1006 |
|
1007 |
"Created: / 24-03-2012 / 23:23:15 / cg" |
|
1008 |
! |
|
1009 |
||
1010 |
hideLocalLabels2:aBoolean |
|
14346 | 1011 |
self flagNamed:#hideLocalLabels2 put:aBoolean. |
11466 | 1012 |
|
1013 |
"Modified: / 05-05-2011 / 15:22:54 / cg" |
|
1014 |
"Created: / 24-03-2012 / 23:23:20 / cg" |
|
1015 |
! |
|
1016 |
||
11502 | 1017 |
hideLocalLabels3 |
14346 | 1018 |
^ self flagNamed:#hideLocalLabels3 |
11502 | 1019 |
|
1020 |
"Created: / 13-05-2012 / 11:12:37 / cg" |
|
1021 |
! |
|
1022 |
||
1023 |
hideLocalLabels3:aBoolean |
|
14346 | 1024 |
self flagNamed:#hideLocalLabels3 put:aBoolean. |
11502 | 1025 |
|
1026 |
"Modified: / 05-05-2011 / 15:22:54 / cg" |
|
1027 |
"Created: / 13-05-2012 / 11:12:42 / cg" |
|
1028 |
! |
|
1029 |
||
9891 | 1030 |
hideLocalLabels:aBoolean |
14346 | 1031 |
self flagNamed:#hideLocalLabels put:aBoolean. |
9891 | 1032 |
|
1033 |
"Modified: / 05-05-2011 / 15:22:54 / cg" |
|
1034 |
! |
|
1035 |
||
14346 | 1036 |
hideLuaFunctions |
1037 |
^ self flagNamed:#hideLuaFunctions |
|
1038 |
! |
|
1039 |
||
1040 |
hideLuaFunctions:aBoolean |
|
1041 |
self flagNamed:#hideLuaFunctions put:aBoolean |
|
1042 |
! |
|
1043 |
||
11762 | 1044 |
hideMethods |
14346 | 1045 |
^ self flagNamed:#hideMethods |
11762 | 1046 |
|
1047 |
"Created: / 21-08-2012 / 21:02:24 / cg" |
|
1048 |
! |
|
1049 |
||
1050 |
hideMethods:aBoolean |
|
14346 | 1051 |
self flagNamed:#hideMethods put:aBoolean. |
11762 | 1052 |
|
1053 |
"Created: / 21-08-2012 / 21:01:38 / cg" |
|
1054 |
! |
|
1055 |
||
9891 | 1056 |
hideOzClasses |
14346 | 1057 |
^ self flagNamed:#hideOzClasses |
9891 | 1058 |
! |
1059 |
||
1060 |
hideOzClasses:aBoolean |
|
14346 | 1061 |
self flagNamed:#hideOzClasses put:aBoolean. |
9891 | 1062 |
|
1063 |
"Modified: / 05-05-2011 / 15:22:58 / cg" |
|
1064 |
! |
|
1065 |
||
1066 |
hideOzFunctions |
|
14346 | 1067 |
^ self flagNamed:#hideOzFunctions |
9891 | 1068 |
! |
1069 |
||
1070 |
hideOzFunctions:aBoolean |
|
14346 | 1071 |
self flagNamed:#hideOzFunctions put:aBoolean. |
9891 | 1072 |
|
1073 |
"Modified: / 05-05-2011 / 15:23:00 / cg" |
|
1074 |
! |
|
1075 |
||
1076 |
hideOzMethods |
|
14346 | 1077 |
^ self flagNamed:#hideOzMethods |
9891 | 1078 |
! |
1079 |
||
1080 |
hideOzMethods:aBoolean |
|
14346 | 1081 |
self flagNamed:#hideOzMethods put:aBoolean. |
9891 | 1082 |
|
1083 |
"Modified: / 05-05-2011 / 15:23:02 / cg" |
|
1084 |
! |
|
1085 |
||
1086 |
hidePythonClasses |
|
14346 | 1087 |
^ self flagNamed:#hidePythonClasses |
9891 | 1088 |
! |
1089 |
||
1090 |
hidePythonClasses:aBoolean |
|
14346 | 1091 |
self flagNamed:#hidePythonClasses put:aBoolean. |
9891 | 1092 |
|
1093 |
"Modified: / 05-05-2011 / 15:23:05 / cg" |
|
1094 |
! |
|
1095 |
||
1096 |
hidePythonFunctions |
|
14346 | 1097 |
^ self flagNamed:#hidePythonFunctions |
9891 | 1098 |
! |
1099 |
||
1100 |
hidePythonFunctions:aBoolean |
|
14346 | 1101 |
self flagNamed:#hidePythonFunctions put:aBoolean. |
9891 | 1102 |
|
1103 |
"Modified: / 05-05-2011 / 15:23:07 / cg" |
|
1104 |
! |
|
1105 |
||
1106 |
hidePythonMethods |
|
14346 | 1107 |
^ self flagNamed:#hidePythonMethods |
9891 | 1108 |
! |
1109 |
||
1110 |
hidePythonMethods:aBoolean |
|
14346 | 1111 |
self flagNamed:#hidePythonMethods put:aBoolean. |
9891 | 1112 |
|
1113 |
"Modified: / 05-05-2011 / 15:23:09 / cg" |
|
1114 |
! |
|
1115 |
||
1116 |
hideStatic |
|
14346 | 1117 |
^ self flagNamed:#hideStatic |
9891 | 1118 |
! |
1119 |
||
1120 |
hideStatic:aBoolean |
|
14346 | 1121 |
self flagNamed:#hideStatic put:aBoolean. |
9891 | 1122 |
|
1123 |
"Modified: / 05-05-2011 / 15:23:11 / cg" |
|
1124 |
! |
|
1125 |
||
1126 |
hideStructMembers |
|
14346 | 1127 |
^ self flagNamed:#hideStructMembers |
9891 | 1128 |
! |
1129 |
||
1130 |
hideStructMembers:aBoolean |
|
14346 | 1131 |
self flagNamed:#hideStructMembers put:aBoolean. |
9891 | 1132 |
|
1133 |
"Modified: / 05-05-2011 / 15:23:15 / cg" |
|
1134 |
! |
|
1135 |
||
1136 |
hideStructures |
|
14346 | 1137 |
^ self flagNamed:#hideStructures |
9891 | 1138 |
! |
1139 |
||
1140 |
hideStructures:aBoolean |
|
14346 | 1141 |
self flagNamed:#hideStructures put:aBoolean. |
9891 | 1142 |
|
1143 |
"Modified: / 05-05-2011 / 15:23:17 / cg" |
|
1144 |
! |
|
1145 |
||
1146 |
hideTextLabels |
|
14346 | 1147 |
^ self flagNamed:#hideTextLabels |
9891 | 1148 |
! |
1149 |
||
1150 |
hideTextLabels:aBoolean |
|
14346 | 1151 |
self flagNamed:#hideTextLabels put:aBoolean. |
9891 | 1152 |
|
1153 |
"Modified: / 05-05-2011 / 15:23:19 / cg" |
|
1154 |
! |
|
1155 |
||
1156 |
hideTypedefs |
|
14346 | 1157 |
^ self flagNamed:#hideTypedefs |
9891 | 1158 |
! |
1159 |
||
1160 |
hideTypedefs:aBoolean |
|
14346 | 1161 |
self flagNamed:#hideTypedefs put:aBoolean. |
9891 | 1162 |
|
1163 |
"Modified: / 05-05-2011 / 15:23:21 / cg" |
|
1164 |
! |
|
1165 |
||
1166 |
hideVariables |
|
14346 | 1167 |
^ self flagNamed:#hideVariables |
9891 | 1168 |
! |
1169 |
||
1170 |
hideVariables:aBoolean |
|
14346 | 1171 |
self flagNamed:#hideVariables put:aBoolean. |
9891 | 1172 |
|
1173 |
"Modified: / 05-05-2011 / 15:23:23 / cg" |
|
1174 |
! |
|
1175 |
||
1176 |
javaClassesAndMethodsOnly |
|
1177 |
^ showOnly == #javaClassesAndMethods |
|
1178 |
||
1179 |
"Modified: / 07-06-2010 / 14:18:25 / cg" |
|
1180 |
! |
|
1181 |
||
1182 |
javaClassesAndMethodsOnly:aBoolean |
|
1183 |
showOnly := nil. |
|
1184 |
aBoolean ifTrue:[ |
|
1185 |
showOnly := DefaultShowOnly := #javaClassesAndMethods |
|
1186 |
]. |
|
1187 |
||
1188 |
"Modified: / 05-05-2011 / 15:23:25 / cg" |
|
1189 |
! |
|
1190 |
||
1191 |
javaClassesOnly |
|
1192 |
^ showOnly == #javaClasses |
|
1193 |
||
1194 |
"Modified: / 07-06-2010 / 14:18:28 / cg" |
|
1195 |
! |
|
1196 |
||
1197 |
javaClassesOnly:aBoolean |
|
1198 |
showOnly := nil. |
|
1199 |
aBoolean ifTrue:[ |
|
1200 |
showOnly := DefaultShowOnly := #javaClasses |
|
1201 |
]. |
|
1202 |
||
1203 |
"Modified: / 05-05-2011 / 15:23:29 / cg" |
|
1204 |
! |
|
1205 |
||
1206 |
javaMethodsOnly |
|
1207 |
^ showOnly == #javaMethods |
|
1208 |
||
1209 |
"Modified: / 07-06-2010 / 14:18:30 / cg" |
|
1210 |
! |
|
1211 |
||
1212 |
javaMethodsOnly:aBoolean |
|
1213 |
showOnly := nil. |
|
1214 |
aBoolean ifTrue:[ |
|
1215 |
showOnly := DefaultShowOnly := #javaMethods |
|
1216 |
]. |
|
1217 |
||
1218 |
"Modified: / 05-05-2011 / 15:23:31 / cg" |
|
1219 |
! |
|
1220 |
||
1221 |
macrosOnly |
|
1222 |
^ showOnly == #macros |
|
1223 |
||
1224 |
"Created: / 07-06-2010 / 12:09:22 / cg" |
|
1225 |
"Modified: / 07-06-2010 / 14:18:33 / cg" |
|
1226 |
! |
|
1227 |
||
1228 |
macrosOnly:aBoolean |
|
1229 |
showOnly := nil. |
|
1230 |
aBoolean ifTrue:[ |
|
1231 |
showOnly := DefaultShowOnly := #macros |
|
1232 |
]. |
|
1233 |
||
1234 |
"Created: / 07-06-2010 / 12:09:34 / cg" |
|
1235 |
"Modified: / 05-05-2011 / 15:23:33 / cg" |
|
1236 |
! |
|
1237 |
||
1238 |
methodsOnly |
|
1239 |
^ showOnly == #methods |
|
1240 |
||
1241 |
"Created: / 07-06-2010 / 12:12:26 / cg" |
|
1242 |
"Modified: / 07-06-2010 / 14:18:38 / cg" |
|
1243 |
! |
|
1244 |
||
1245 |
methodsOnly:aBoolean |
|
1246 |
showOnly := nil. |
|
1247 |
aBoolean ifTrue:[ |
|
1248 |
showOnly := DefaultShowOnly := #methods |
|
1249 |
]. |
|
1250 |
||
1251 |
"Created: / 07-06-2010 / 12:12:30 / cg" |
|
1252 |
"Modified: / 05-05-2011 / 15:23:35 / cg" |
|
1253 |
! |
|
1254 |
||
1255 |
ozClassesOnly |
|
1256 |
^ showOnly == #ozClasses |
|
1257 |
||
1258 |
"Modified: / 07-06-2010 / 14:18:41 / cg" |
|
1259 |
! |
|
1260 |
||
1261 |
ozClassesOnly:aBoolean |
|
1262 |
showOnly := nil. |
|
1263 |
aBoolean ifTrue:[ |
|
1264 |
showOnly := DefaultShowOnly := #ozClasses |
|
1265 |
]. |
|
1266 |
||
1267 |
"Modified: / 05-05-2011 / 15:23:38 / cg" |
|
1268 |
! |
|
1269 |
||
1270 |
ozFunctionsOnly |
|
1271 |
^ showOnly == #ozFunctions |
|
1272 |
||
1273 |
"Modified: / 07-06-2010 / 14:18:44 / cg" |
|
1274 |
! |
|
1275 |
||
1276 |
ozFunctionsOnly:aBoolean |
|
1277 |
showOnly := nil. |
|
1278 |
aBoolean ifTrue:[ |
|
1279 |
showOnly := DefaultShowOnly := #ozFunctions |
|
1280 |
]. |
|
1281 |
self updateContentsFromRawList. |
|
1282 |
||
1283 |
"Modified: / 05-05-2011 / 15:18:51 / cg" |
|
1284 |
! |
|
1285 |
||
1286 |
ozMethodsOnly |
|
1287 |
^ showOnly == #ozMethods |
|
1288 |
||
1289 |
"Modified: / 07-06-2010 / 14:18:47 / cg" |
|
1290 |
! |
|
1291 |
||
1292 |
ozMethodsOnly:aBoolean |
|
1293 |
showOnly := nil. |
|
1294 |
aBoolean ifTrue:[ |
|
1295 |
showOnly := DefaultShowOnly := #ozMethods |
|
1296 |
]. |
|
1297 |
||
1298 |
"Modified: / 05-05-2011 / 15:23:44 / cg" |
|
1299 |
! |
|
1300 |
||
1301 |
pythonClassesOnly |
|
1302 |
^ showOnly == #pythonClasses |
|
1303 |
||
1304 |
"Modified: / 07-06-2010 / 14:18:52 / cg" |
|
1305 |
! |
|
1306 |
||
1307 |
pythonClassesOnly:aBoolean |
|
1308 |
showOnly := nil. |
|
1309 |
aBoolean ifTrue:[ |
|
1310 |
showOnly := DefaultShowOnly := #pythonClasses |
|
1311 |
]. |
|
1312 |
||
1313 |
"Modified: / 05-05-2011 / 15:23:46 / cg" |
|
1314 |
! |
|
1315 |
||
1316 |
pythonFunctionsOnly |
|
1317 |
^ showOnly == #pythonFunctions |
|
1318 |
||
1319 |
"Modified: / 07-06-2010 / 14:18:55 / cg" |
|
1320 |
! |
|
1321 |
||
1322 |
pythonFunctionsOnly:aBoolean |
|
1323 |
showOnly := nil. |
|
1324 |
aBoolean ifTrue:[ |
|
1325 |
showOnly := DefaultShowOnly := #pythonFunctions |
|
1326 |
]. |
|
1327 |
||
1328 |
"Modified: / 05-05-2011 / 15:23:48 / cg" |
|
1329 |
! |
|
1330 |
||
1331 |
pythonMethodsOnly |
|
1332 |
^ showOnly == #pythonMethods |
|
1333 |
||
1334 |
"Modified: / 07-06-2010 / 14:18:58 / cg" |
|
1335 |
! |
|
1336 |
||
1337 |
pythonMethodsOnly:aBoolean |
|
1338 |
showOnly := nil. |
|
1339 |
aBoolean ifTrue:[ |
|
1340 |
showOnly := DefaultShowOnly := #pythonMethods |
|
1341 |
]. |
|
1342 |
||
1343 |
"Modified: / 05-05-2011 / 15:23:51 / cg" |
|
1344 |
! |
|
1345 |
||
1346 |
showOnly |
|
1347 |
tagTypesPresent == false ifTrue:[ |
|
1348 |
^ nil "/ showing everything |
|
1349 |
]. |
|
1350 |
^ showOnly "? DefaultShowOnly" |
|
1351 |
||
1352 |
"Modified: / 20-06-2010 / 01:44:13 / cg" |
|
1353 |
! |
|
1354 |
||
1355 |
showOnly:aSymbol |
|
1356 |
showOnly := aSymbol |
|
1357 |
||
1358 |
"Modified: / 05-05-2011 / 15:23:55 / cg" |
|
1359 |
! |
|
1360 |
||
1361 |
structsOnly |
|
1362 |
^ showOnly == #structs |
|
1363 |
||
1364 |
"Created: / 25-06-2010 / 10:42:27 / cg" |
|
1365 |
! |
|
1366 |
||
1367 |
structsOnly:aBoolean |
|
1368 |
showOnly := DefaultShowOnly := nil. |
|
1369 |
aBoolean ifTrue:[ |
|
1370 |
showOnly := "DefaultShowOnly :=" #structs |
|
1371 |
]. |
|
1372 |
||
1373 |
"Created: / 25-06-2010 / 10:42:39 / cg" |
|
1374 |
"Modified: / 05-05-2011 / 15:23:58 / cg" |
|
1375 |
! |
|
1376 |
||
1377 |
targetsOnly |
|
1378 |
^ showOnly == #targets |
|
1379 |
||
1380 |
"Modified: / 07-06-2010 / 14:19:03 / cg" |
|
1381 |
! |
|
1382 |
||
1383 |
targetsOnly:aBoolean |
|
1384 |
showOnly := DefaultShowOnly := nil. |
|
1385 |
aBoolean ifTrue:[ |
|
1386 |
showOnly := DefaultShowOnly := #targets |
|
1387 |
]. |
|
1388 |
||
1389 |
"Modified: / 05-05-2011 / 15:24:02 / cg" |
|
1390 |
! |
|
1391 |
||
1392 |
typesOnly |
|
1393 |
^ showOnly == #types |
|
1394 |
||
1395 |
"Modified: / 07-06-2010 / 14:19:06 / cg" |
|
1396 |
! |
|
1397 |
||
1398 |
typesOnly:aBoolean |
|
1399 |
showOnly := DefaultShowOnly := nil. |
|
1400 |
aBoolean ifTrue:[ |
|
1401 |
showOnly := "DefaultShowOnly :=" #types |
|
1402 |
]. |
|
1403 |
||
1404 |
"Modified: / 05-05-2011 / 15:24:04 / cg" |
|
1405 |
! |
|
1406 |
||
1407 |
variablesOnly |
|
1408 |
^ showOnly == #variables |
|
1409 |
||
1410 |
"Modified: / 07-06-2010 / 14:19:09 / cg" |
|
1411 |
! |
|
1412 |
||
1413 |
variablesOnly:aBoolean |
|
1414 |
showOnly := nil. |
|
1415 |
aBoolean ifTrue:[ |
|
1416 |
showOnly := DefaultShowOnly := #variables |
|
1417 |
]. |
|
1418 |
||
1419 |
"Modified: / 05-05-2011 / 15:24:06 / cg" |
|
1420 |
! ! |
|
1421 |
||
1422 |
!TagList methodsFor:'accessing-presentation'! |
|
1423 |
||
1424 |
groupBy |
|
1425 |
^ groupBy |
|
1426 |
||
1427 |
"Created: / 05-05-2011 / 14:31:37 / cg" |
|
1428 |
"Modified: / 05-05-2011 / 15:34:14 / cg" |
|
1429 |
! |
|
1430 |
||
1431 |
groupBy:aSymbolOrNil |
|
1432 |
groupBy ~~ aSymbolOrNil ifTrue:[ |
|
1433 |
groupBy := DefaultGroupBy := aSymbolOrNil. |
|
1434 |
self updateContentsFromFilteredList |
|
1435 |
]. |
|
1436 |
||
1437 |
"Created: / 05-05-2011 / 14:32:00 / cg" |
|
1438 |
! |
|
1439 |
||
1440 |
groupedByType |
|
1441 |
^ self groupBy == #byType |
|
1442 |
||
1443 |
"Created: / 05-05-2011 / 14:32:53 / cg" |
|
1444 |
! |
|
1445 |
||
1446 |
groupedByType:aBoolean |
|
1447 |
aBoolean == true ifTrue:[ |
|
1448 |
self groupBy:#byType |
|
1449 |
] ifFalse:[ |
|
1450 |
self groupBy:nil |
|
1451 |
]. |
|
1452 |
||
1453 |
"Created: / 05-05-2011 / 14:33:05 / cg" |
|
1454 |
! |
|
1455 |
||
1456 |
sortCriteria |
|
1457 |
^ sortCriteria ? DefaultSortCriteria |
|
1458 |
! |
|
1459 |
||
1460 |
sortCriteria:aSymbolOrNil |
|
1461 |
sortCriteria ~~ aSymbolOrNil ifTrue:[ |
|
1462 |
sortCriteria := DefaultSortCriteria := aSymbolOrNil. |
|
1463 |
Sorted := sortCriteria. |
|
1464 |
self updateContentsFromFilteredList |
|
1465 |
]. |
|
1466 |
||
1467 |
"Modified: / 05-05-2011 / 14:50:18 / cg" |
|
1468 |
! |
|
1469 |
||
1470 |
sorted |
|
1471 |
"backward compatibility" |
|
1472 |
||
1473 |
^ self sortCriteria notNil |
|
1474 |
! |
|
1475 |
||
1476 |
sorted:aBoolean |
|
1477 |
"backward compatibility" |
|
1478 |
||
1479 |
aBoolean ifTrue:[ |
|
1480 |
self sortCriteria:#byName |
|
1481 |
] ifFalse:[ |
|
1482 |
self sortCriteria:nil |
|
1483 |
]. |
|
1484 |
! |
|
1485 |
||
1486 |
sortedByLineNumber |
|
1487 |
^ self sortCriteria isNil |
|
1488 |
or:[ self sortCriteria == #lineNumber ] |
|
1489 |
||
1490 |
"Modified: / 05-05-2011 / 14:30:33 / cg" |
|
1491 |
! |
|
1492 |
||
1493 |
sortedByLineNumber:aBoolean |
|
1494 |
aBoolean == true ifTrue:[ |
|
1495 |
self sortCriteria:#lineNumber |
|
1496 |
]. |
|
1497 |
||
1498 |
"Modified: / 27-06-2010 / 21:31:44 / cg" |
|
1499 |
! |
|
1500 |
||
1501 |
sortedByName |
|
1502 |
^ self sortCriteria == #byName |
|
1503 |
! |
|
1504 |
||
1505 |
sortedByName:aBoolean |
|
1506 |
aBoolean == true ifTrue:[ |
|
1507 |
self sortCriteria:#byName |
|
1508 |
]. |
|
1509 |
! |
|
1510 |
||
1511 |
sortedByNameIgnoringCase |
|
1512 |
^ self sortCriteria == #byNameIgnoringCase |
|
1513 |
! |
|
1514 |
||
1515 |
sortedByNameIgnoringCase:aBoolean |
|
1516 |
aBoolean == true ifTrue:[ |
|
1517 |
self sortCriteria:#byNameIgnoringCase |
|
1518 |
]. |
|
1519 |
! |
|
1520 |
||
1521 |
sortedByNameIgnoringLeadingUnderscores |
|
1522 |
^ self sortCriteria == #byNameIgnoringLeadingUnderscores |
|
1523 |
! |
|
1524 |
||
1525 |
sortedByNameIgnoringLeadingUnderscores:aBoolean |
|
1526 |
aBoolean == true ifTrue:[ |
|
1527 |
self sortCriteria:#byNameIgnoringLeadingUnderscores |
|
1528 |
]. |
|
1529 |
! |
|
1530 |
||
1531 |
sortedByNameIgnoringLeadingUnderscoresAndCase |
|
1532 |
^ self sortCriteria == #byNameIgnoringLeadingUnderscoresAndCase |
|
1533 |
! |
|
1534 |
||
1535 |
sortedByNameIgnoringLeadingUnderscoresAndCase:aBoolean |
|
1536 |
aBoolean == true ifTrue:[ |
|
1537 |
self sortCriteria:#byNameIgnoringLeadingUnderscoresAndCase |
|
1538 |
]. |
|
1539 |
! |
|
1540 |
||
1541 |
sortedByType |
|
1542 |
^ self sortCriteria == #byType |
|
1543 |
! |
|
1544 |
||
1545 |
sortedByType:aBoolean |
|
1546 |
aBoolean == true ifTrue:[ |
|
1547 |
self sortCriteria:#byType |
|
1548 |
]. |
|
1549 |
! |
|
1550 |
||
1551 |
tagTypesPresent |
|
1552 |
^ tagTypesPresent |
|
1553 |
! ! |
|
1554 |
||
14346 | 1555 |
!TagList methodsFor:'initialization'! |
1556 |
||
1557 |
initContents:n |
|
1558 |
"Invoked when a new instance is created." |
|
1559 |
||
1560 |
super initContents:n. |
|
1561 |
flags := IdentityDictionary new. |
|
1562 |
! |
|
1563 |
||
1564 |
initialize |
|
1565 |
"Invoked when a new instance is created." |
|
1566 |
||
1567 |
flags := IdentityDictionary new. |
|
1568 |
! ! |
|
1569 |
||
9891 | 1570 |
!TagList methodsFor:'private'! |
1571 |
||
1572 |
applyFilterToList:aList |
|
11722
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1573 |
|lcFilter| |
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1574 |
|
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1575 |
filter includesMatchCharacters ifTrue:[ |
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1576 |
lcFilter := filter asLowercase. |
13444 | 1577 |
^ aList select:[:tag | lcFilter match:tag label caseSensitive:false] |
11722
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1578 |
]. |
13444 | 1579 |
^ aList select:[:tag | tag label includesString:filter caseSensitive:false] |
11722
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1580 |
|
f1f3a4d964ee
changed: #applyFilterToList:
Claus Gittinger <cg@exept.de>
parents:
11502
diff
changeset
|
1581 |
"Modified: / 01-08-2012 / 16:52:02 / cg" |
9891 | 1582 |
! |
1583 |
||
1584 |
getCtagsVersion |
|
1585 |
" parse major and minor version from ctags by operating system command |
|
1586 |
cehck for the 'Exuberant Ctags' string being present |
|
1587 |
return an Array with mafor and minor part of version or nil if not available" |
|
1588 |
||
1589 |
| stream string index majorVersion minorVersion indexOfPoint| |
|
1590 |
||
1591 |
stream := WriteStream on:''. |
|
1592 |
OperatingSystem |
|
1593 |
executeCommand:'ctags --version' |
|
1594 |
inputFrom:nil |
|
1595 |
outputTo:stream |
|
1596 |
errorTo:stream |
|
1597 |
inDirectory:nil |
|
1598 |
onError:[:status| false]. |
|
1599 |
string := stream contents. |
|
1600 |
index := string findString:'Exuberant Ctags' ifAbsent:[nil]. |
|
1601 |
index notNil ifTrue:[ |
|
1602 |
string := (string copyFrom:(index + ('Exuberant Ctags' size))) asArrayOfSubstrings first. |
|
1603 |
(string includes:$,) ifTrue:[ string := string copyTo:((string indexOf:$,) - 1)]. |
|
1604 |
indexOfPoint := string indexOf:$. ifAbsent:nil. |
|
1605 |
indexOfPoint notNil ifTrue:[ |
|
1606 |
majorVersion := (string copyFrom:1 to:indexOfPoint - 1) asInteger. |
|
1607 |
minorVersion := (string copyFrom:indexOfPoint + 1 to:string size) asInteger. |
|
1608 |
^ Array with:majorVersion with:minorVersion. |
|
1609 |
] |
|
1610 |
]. |
|
1611 |
^ nil |
|
1612 |
||
1613 |
"Modified: / 05-05-2011 / 14:48:08 / cg" |
|
1614 |
! |
|
1615 |
||
1616 |
setFilteredList:aList |
|
1617 |
filteredList := aList. |
|
1618 |
self updateContentsFromFilteredList |
|
1619 |
||
1620 |
"Created: / 05-05-2011 / 14:46:12 / cg" |
|
1621 |
! |
|
1622 |
||
1623 |
setRawList:aList |
|
1624 |
rawList := aList. |
|
1625 |
self updateContentsFromRawList |
|
1626 |
||
1627 |
"Created: / 05-05-2011 / 14:46:22 / cg" |
|
1628 |
! |
|
1629 |
||
1630 |
shellCommandFor:aFilenameString |
|
1631 |
"returns the shellCommand to be used" |
|
1632 |
||
11050 | 1633 |
|template| |
1634 |
||
1635 |
(template := self shellCommandTemplateFor:aFilenameString) isNil ifTrue:[ |
|
1636 |
^ nil |
|
1637 |
]. |
|
1638 |
^ template bindWith:aFilenameString |
|
1639 |
||
1640 |
"Modified: / 05-01-2012 / 11:10:03 / cg" |
|
1641 |
! |
|
1642 |
||
1643 |
shellCommandTemplateFor:aFilenameString |
|
12332 | 1644 |
"returns the shellCommand to be used (contains %1 for the filename). |
1645 |
When first called, looks for ctags (both a private and the system-supplied), |
|
1646 |
and tries to see what version that is. I prefer exuberant ctags version" |
|
11050 | 1647 |
|
9891 | 1648 |
|lcSuffix shellCommand isCSuffix isCPlusPlusSuffix isJavaSuffix isEiffelSuffix isFortranSuffix |
12332 | 1649 |
isTCLSuffix isRubySuffix isPythonSuffix isPhpSuffix isJavaScriptSuffix |
12341 | 1650 |
showOnly response suff fn langValue langOption moreOptions| |
9891 | 1651 |
|
1652 |
ctagsCommand isNil ifTrue:[ |
|
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1653 |
remoteTarget isNil ifTrue:[ |
9891 | 1654 |
"/ local use |
1655 |
suff := (OperatingSystem isMSWINDOWSlike) ifTrue:'.exe' ifFalse:''. |
|
1656 |
||
12332 | 1657 |
ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-5.8/ctags',suff. |
9891 | 1658 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
1659 |
ctagsCommand := fn pathName. |
|
1660 |
ctagsIsExCtags := ctagsIsExCtags5x := true. |
|
1661 |
] ifFalse:[ |
|
1662 |
ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-3.2.2/ctags',suff. |
|
1663 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
|
1664 |
ctagsCommand := fn pathName. |
|
1665 |
ctagsIsExCtags := true. |
|
1666 |
ctagsIsExCtags5x := false. |
|
1667 |
] ifFalse:[ |
|
1668 |
ctagsIsExCtags := nil. |
|
1669 |
ctagsIsExCtags5x := nil. |
|
1670 |
ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags/ctags',suff. |
|
1671 |
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[ |
|
1672 |
ctagsCommand := fn pathName. |
|
1673 |
] ifFalse:[ |
|
1674 |
"/ use systems default ctags command |
|
1675 |
ctagsCommand := 'ctags'. |
|
1676 |
] |
|
1677 |
] |
|
1678 |
]. |
|
1679 |
] ifFalse:[ |
|
1680 |
"/ cross-development |
|
1681 |
"/ target remoteOperatingSystem = 'Linux' ifTrue:[ |
|
1682 |
"/ use systems default ctags command |
|
1683 |
ctagsCommand := 'ctags'. |
|
1684 |
ctagsIsExCtags := nil. |
|
1685 |
ctagsIsExCtags5x := nil. |
|
1686 |
"/ ] |
|
1687 |
]. |
|
1688 |
]. |
|
1689 |
||
1690 |
(ctagsIsExCtags isNil or:[ctagsIsExCtags5x isNil]) ifTrue:[ |
|
1691 |
ctagsCommand notNil ifTrue:[ |
|
1692 |
response := OperatingSystem getCommandOutputFrom:(ctagsCommand, ' --version'). |
|
1693 |
(response notNil |
|
1694 |
and:[response asLowercase startsWith:'exuberant ctags']) ifTrue:[ |
|
1695 |
ctagsIsExCtags := true. |
|
1696 |
||
1697 |
response := (response copyFrom:'exuberant ctags' size + 1) withoutSeparators. |
|
1698 |
ctagsIsExCtags5x := response startsWith:'5.' |
|
1699 |
]. |
|
1700 |
]. |
|
1701 |
]. |
|
1702 |
||
12344 | 1703 |
ctagsIsExCtags5x ifTrue:[ |
1704 |
langOption := '--language-force=%1'. |
|
1705 |
] ifFalse:[ ctagsIsExCtags ifTrue:[ |
|
1706 |
langOption := '--lang=%1'. |
|
1707 |
]]. |
|
1708 |
||
9891 | 1709 |
shellCommand := ctagsCommand. |
1710 |
(shellCommand includes:Character space) ifTrue:[ |
|
1711 |
shellCommand := '"',shellCommand,'"'. |
|
1712 |
]. |
|
12341 | 1713 |
moreOptions := ''. |
9891 | 1714 |
|
1715 |
showOnly := self showOnly. |
|
1716 |
||
1717 |
lcSuffix := aFilenameString asFilename suffix asLowercase. |
|
1718 |
isCSuffix := self class isCSuffix:lcSuffix. |
|
12344 | 1719 |
|
1720 |
"/ a hack for temporary files generated by stc |
|
1721 |
lcSuffix = 'sc' ifTrue:[ |
|
1722 |
(aFilenameString asFilename asAbsoluteFilename components includes:'stx') ifTrue:[ |
|
1723 |
isCSuffix := true |
|
1724 |
]. |
|
1725 |
]. |
|
9891 | 1726 |
isCPlusPlusSuffix := self class isCPlusPlusSuffix:lcSuffix. |
1727 |
||
1728 |
(shellCommand notNil and:[(ctagsIsExCtags ? false)]) ifTrue:[ |
|
1729 |
isJavaSuffix := self class isJavaSuffix:lcSuffix. |
|
1730 |
isEiffelSuffix := self class isEiffelSuffix:lcSuffix. |
|
1731 |
isFortranSuffix := self class isFortranSuffix:lcSuffix. |
|
1732 |
||
1733 |
"/ ex_ctags supports c, c++, java, fortran and a few others |
|
1734 |
(isCSuffix or:[isCPlusPlusSuffix or:[isJavaSuffix or:[isEiffelSuffix or:[isFortranSuffix]]]]) ifFalse:[ |
|
1735 |
(ctagsIsExCtags5x ? false) ifFalse:[ |
|
1736 |
^ nil |
|
1737 |
]. |
|
12332 | 1738 |
|
1739 |
"/ ex_ctags5.x also supports: |
|
1740 |
"/ Assembler, AWK, ASP, BETA, |
|
1741 |
"/ Bourne/Korn/Z Shell, C, C++, C#, COBOL, Eiffel, Erlang, Fortran, Java, Lisp, |
|
1742 |
"/ Lua, Makefile, Pascal, Perl, PHP, PL/SQL, Python, REXX, Ruby, Scheme, |
|
1743 |
"/ S-Lang, SML (Standard ML), Tcl, Vera, Verilog, VHDL, Vim, and YACC. |
|
9891 | 1744 |
]. |
12332 | 1745 |
isTCLSuffix := self class isTCLSuffix:lcSuffix. |
1746 |
isRubySuffix := self class isRubySuffix:lcSuffix. |
|
1747 |
isPythonSuffix := self class isPythonSuffix:lcSuffix. |
|
1748 |
isPhpSuffix := self class isPhpSuffix:lcSuffix. |
|
1749 |
isJavaScriptSuffix := self class isJavaScriptSuffix:lcSuffix. |
|
9891 | 1750 |
|
1751 |
usingDefaultCTags := false. |
|
1752 |
shellCommand := shellCommand asFilename asAbsoluteFilename pathName. |
|
1753 |
"/ shellCommand := shellCommand, ' -f - --c-types=f --file-scope=no'. |
|
1754 |
"/ shellCommand := shellCommand, ' -f - --file-scope=yes'. |
|
1755 |
"/ shellCommand := shellCommand, ' -f - --file-scope=yes'. |
|
1756 |
shellCommand := shellCommand, ' -f - --file-scope=yes --excmd=number'. |
|
1757 |
||
1758 |
(isCSuffix or:[isCPlusPlusSuffix]) ifTrue:[ |
|
1759 |
isCPlusPlusSuffix |
|
12341 | 1760 |
ifTrue:[ langValue := 'c++'] |
1761 |
ifFalse:[ langValue := 'c']. |
|
9891 | 1762 |
|
1763 |
showOnly == #classes ifTrue:[ |
|
12341 | 1764 |
moreOptions := moreOptions, ' --c-types=c' |
9891 | 1765 |
] ifFalse:[ |
1766 |
showOnly == #functions ifTrue:[ |
|
12341 | 1767 |
moreOptions := moreOptions, ' --c-types=f' |
9891 | 1768 |
] ifFalse:[ |
1769 |
showOnly == #functionsAndVariables ifTrue:[ |
|
12341 | 1770 |
moreOptions := moreOptions, ' --c-types=fv' |
9891 | 1771 |
] ifFalse:[ |
1772 |
showOnly == #classesFunctionsAndVariables ifTrue:[ |
|
12341 | 1773 |
moreOptions := moreOptions, ' --c-types=cfv' |
9891 | 1774 |
] ifFalse:[ |
1775 |
showOnly == #variables ifTrue:[ |
|
12341 | 1776 |
moreOptions := moreOptions, ' --c-types=v' |
9891 | 1777 |
] ifFalse:[ |
1778 |
showOnly == #types ifTrue:[ |
|
12341 | 1779 |
moreOptions := moreOptions, ' --c-types=t' |
9891 | 1780 |
] |
1781 |
] |
|
1782 |
] |
|
1783 |
] |
|
1784 |
] |
|
1785 |
]. |
|
14346 | 1786 |
self hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m']. |
1787 |
self hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ]. |
|
1788 |
self hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ]. |
|
1789 |
self hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s']. |
|
1790 |
self hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v']. |
|
1791 |
self hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f']. |
|
1792 |
self hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c']. |
|
9891 | 1793 |
]. |
12332 | 1794 |
|
9891 | 1795 |
isJavaSuffix ifTrue:[ |
12341 | 1796 |
langValue := 'java'. |
9891 | 1797 |
|
1798 |
showOnly == #javaClasses ifTrue:[ |
|
12341 | 1799 |
moreOptions := moreOptions, ' --java-types=c' |
9891 | 1800 |
] ifFalse:[ |
1801 |
showOnly == #javaMethods ifTrue:[ |
|
12341 | 1802 |
moreOptions := moreOptions, ' --java-types=m' |
9891 | 1803 |
] ifFalse:[ |
1804 |
showOnly == #javaClassesAndMethods ifTrue:[ |
|
12341 | 1805 |
moreOptions := moreOptions, ' --java-types=mc' |
9891 | 1806 |
] |
1807 |
] |
|
1808 |
]. |
|
14346 | 1809 |
self hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ]. |
1810 |
self hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ]. |
|
1811 |
self hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ]. |
|
1812 |
self hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ]. |
|
1813 |
self hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ]. |
|
9891 | 1814 |
]. |
12332 | 1815 |
|
9891 | 1816 |
isEiffelSuffix ifTrue:[ |
12341 | 1817 |
langValue := 'eiffel'. |
9891 | 1818 |
|
12332 | 1819 |
showOnly == #classes ifTrue:[ |
12341 | 1820 |
moreOptions := moreOptions, ' --eiffel-types=c' |
9891 | 1821 |
] ifFalse:[ |
1822 |
showOnly == #features ifTrue:[ |
|
12341 | 1823 |
moreOptions := moreOptions, ' --eiffel-types=f' |
9891 | 1824 |
] |
1825 |
]. |
|
1826 |
"/ hideEiffelClasses == true ifTrue:[ |
|
12341 | 1827 |
"/ moreOptions := moreOptions, ' --eiffel-types=-c' |
9891 | 1828 |
"/ ]. |
1829 |
"/ hideEiffelFeatures == true ifTrue:[ |
|
12341 | 1830 |
"/ moreOptions := moreOptions, ' --eiffel-types=-m' |
9891 | 1831 |
"/ ]. |
1832 |
]. |
|
1833 |
||
1834 |
isFortranSuffix ifTrue:[ |
|
12341 | 1835 |
langValue := 'fortran'. |
9891 | 1836 |
|
1837 |
showOnly == #functions ifTrue:[ |
|
12341 | 1838 |
moreOptions := moreOptions, ' --fortran-types=f' |
9891 | 1839 |
] ifFalse:[ |
1840 |
showOnly == #interfaces ifTrue:[ |
|
12341 | 1841 |
moreOptions := moreOptions, ' --fortran-types=i' |
9891 | 1842 |
] ifFalse:[ |
1843 |
showOnly == #subroutines ifTrue:[ |
|
12341 | 1844 |
moreOptions := moreOptions, ' --fortran-types=s' |
9891 | 1845 |
] ifFalse:[ |
1846 |
showOnly == #commonBlocks == true ifTrue:[ |
|
12341 | 1847 |
moreOptions := moreOptions, ' --fortran-types=c' |
9891 | 1848 |
] |
1849 |
] |
|
1850 |
] |
|
1851 |
]. |
|
1852 |
"/ hideFortranFunctions == true ifTrue:[ |
|
12341 | 1853 |
"/ moreOptions := moreOptions, ' --fortran-types=-f' |
9891 | 1854 |
"/ ]. |
1855 |
"/ hideFortranInterfaces == true ifTrue:[ |
|
12341 | 1856 |
"/ moreOptions := moreOptions, ' --fortran-types=-i' |
9891 | 1857 |
"/ ]. |
1858 |
"/ hideFortranSubroutines == true ifTrue:[ |
|
12341 | 1859 |
"/ moreOptions := moreOptions, ' --fortran-types=-s' |
9891 | 1860 |
"/ ]. |
1861 |
"/ hideFortranCommonBlocks == true ifTrue:[ |
|
12341 | 1862 |
"/ moreOptions := moreOptions, ' --fortran-types=-c' |
9891 | 1863 |
"/ ]. |
1864 |
"/ hideFortranEntryPoints == true ifTrue:[ |
|
12341 | 1865 |
"/ moreOptions := moreOptions, ' --fortran-types=-e' |
9891 | 1866 |
"/ ]. |
1867 |
"/ hideFortranLabels == true ifTrue:[ |
|
12341 | 1868 |
"/ moreOptions := moreOptions, ' --fortran-types=-l' |
9891 | 1869 |
"/ ]. |
1870 |
"/ hideFortranDerivedTypes == true ifTrue:[ |
|
12341 | 1871 |
"/ moreOptions := moreOptions, ' --fortran-types=-t' |
9891 | 1872 |
"/ ]. |
1873 |
]. |
|
1874 |
||
1875 |
"/ shellCommand := shellCommand, ' -f -'. |
|
12341 | 1876 |
langValue notNil ifTrue:[ |
1877 |
langOption notNil ifTrue:[ |
|
1878 |
shellCommand := shellCommand , ' ' , (langOption bindWith:langValue) |
|
1879 |
]. |
|
1880 |
]. |
|
1881 |
moreOptions notEmptyOrNil ifTrue:[ |
|
1882 |
shellCommand := shellCommand , moreOptions |
|
1883 |
]. |
|
11050 | 1884 |
shellCommand := shellCommand, ' "%1"'. |
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1885 |
remoteTarget notNil ifTrue:[ |
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1886 |
^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./'). |
9891 | 1887 |
]. |
1888 |
^ shellCommand. |
|
1889 |
]. |
|
1890 |
||
1891 |
"/ regular ctags: assume supports c, c++ only |
|
1892 |
isCSuffix ifFalse:[ |
|
1893 |
^ nil |
|
1894 |
]. |
|
1895 |
||
1896 |
usingDefaultCTags := true. |
|
1897 |
||
1898 |
shellCommand := 'ctags'. |
|
1899 |
||
1900 |
"/ "sunos and realIX have no option -s" |
|
1901 |
"/ (OperatingSystem getOSType = 'linux') ifTrue:[ |
|
1902 |
"/ shellCommand := 'ctags -S' |
|
1903 |
"/ ]. |
|
1904 |
Transcript showCR:('using default ctags command (not ctags from stx): <', shellCommand, '>'). |
|
1905 |
ctagsCommand := nil. "/ flush - so we will check again. |
|
1906 |
||
11050 | 1907 |
shellCommand := shellCommand, ' "%1"'. |
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1908 |
remoteTarget notNil ifTrue:[ |
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
1909 |
^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./'). |
9891 | 1910 |
]. |
1911 |
^ shellCommand |
|
1912 |
||
1913 |
"Modified: / 08-07-2010 / 00:23:24 / cg" |
|
11050 | 1914 |
"Created: / 05-01-2012 / 11:07:41 / cg" |
9891 | 1915 |
! |
1916 |
||
1917 |
sortBlock |
|
1918 |
"sort AND group" |
|
1919 |
||
1920 |
|sortBlock| |
|
1921 |
||
1922 |
sortCriteria := self sortCriteria. |
|
1923 |
sortBlock := self sortBlockForSortCriteria. |
|
1924 |
||
1925 |
groupBy isNil ifTrue:[ |
|
1926 |
^ sortBlock |
|
1927 |
]. |
|
1928 |
||
1929 |
^ [:a :b| |
|
1930 |
|t1 t2 l1 l2| |
|
1931 |
||
1932 |
t1 := a typeIdentifierInList ? ' '. |
|
1933 |
t2 := b typeIdentifierInList ? ' '. |
|
1934 |
t1 = t2 ifTrue:[ |
|
1935 |
sortBlock value:a value:b |
|
1936 |
] ifFalse:[ |
|
1937 |
t1 < t2 |
|
1938 |
] |
|
1939 |
]. |
|
1940 |
||
1941 |
"Modified: / 05-05-2011 / 15:35:02 / cg" |
|
1942 |
! |
|
1943 |
||
1944 |
sortBlockForSortCriteria |
|
1945 |
sortCriteria == #byName ifTrue:[ |
|
1946 |
^ [:a :b| |
|
1947 |
|l1 l2| |
|
1948 |
||
9939
b9bfde3e776b
changed: #sortBlockForSortCriteria
Claus Gittinger <cg@exept.de>
parents:
9921
diff
changeset
|
1949 |
l1 := a label ? ''. |
b9bfde3e776b
changed: #sortBlockForSortCriteria
Claus Gittinger <cg@exept.de>
parents:
9921
diff
changeset
|
1950 |
l2 := b label ? ''. |
9891 | 1951 |
l1 = l2 ifTrue:[ |
1952 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
1953 |
] ifFalse:[ |
|
1954 |
l1 < l2 |
|
1955 |
] |
|
1956 |
] |
|
1957 |
]. |
|
1958 |
||
1959 |
sortCriteria == #byNameIgnoringCase ifTrue:[ |
|
1960 |
^ [:a :b| |
|
1961 |
|l1 l2| |
|
1962 |
||
1963 |
l1 := a label asLowercase. |
|
1964 |
l2 := b label asLowercase. |
|
1965 |
l1 = l2 ifTrue:[ |
|
1966 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
1967 |
] ifFalse:[ |
|
1968 |
l1 < l2 |
|
1969 |
] |
|
1970 |
] |
|
1971 |
]. |
|
1972 |
||
1973 |
sortCriteria == #byNameIgnoringLeadingUnderscores ifTrue:[ |
|
1974 |
^ [:a :b| |
|
1975 |
|l1 l2 i| |
|
1976 |
||
1977 |
l1 := a label. |
|
1978 |
l2 := b label. |
|
1979 |
l1 = l2 ifTrue:[ |
|
1980 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
1981 |
] ifFalse:[ |
|
1982 |
i := l1 findFirst:[:c | (c ~~ $_)]. |
|
1983 |
i > 1 ifTrue:[ |
|
1984 |
l1 := l1 copyFrom:i |
|
1985 |
]. |
|
1986 |
i := l2 findFirst:[:c | (c ~~ $_)]. |
|
1987 |
i > 1 ifTrue:[ |
|
1988 |
l2 := l2 copyFrom:i |
|
1989 |
]. |
|
1990 |
l1 < l2 |
|
1991 |
] |
|
1992 |
]. |
|
1993 |
]. |
|
1994 |
||
1995 |
sortCriteria == #byNameIgnoringLeadingUnderscoresAndCase ifTrue:[ |
|
1996 |
^ [:a :b| |
|
1997 |
|l1 l2 i| |
|
1998 |
||
1999 |
l1 := a label asLowercase. |
|
2000 |
l2 := b label asLowercase. |
|
2001 |
l1 = l2 ifTrue:[ |
|
2002 |
(a lineNumber ? 0) < (b lineNumber ? 0) |
|
2003 |
] ifFalse:[ |
|
2004 |
i := l1 findFirst:[:c | (c ~~ $_)]. |
|
2005 |
i > 1 ifTrue:[ |
|
2006 |
l1 := l1 copyFrom:i |
|
2007 |
]. |
|
2008 |
i := l2 findFirst:[:c | (c ~~ $_)]. |
|
2009 |
i > 1 ifTrue:[ |
|
2010 |
l2 := l2 copyFrom:i |
|
2011 |
]. |
|
2012 |
l1 < l2 |
|
2013 |
] |
|
2014 |
]. |
|
2015 |
]. |
|
2016 |
||
2017 |
"/ sortCriteria == #byType ifTrue:[ |
|
2018 |
"/ ^ [:a :b| |
|
2019 |
"/ |t1 t2 l1 l2| |
|
2020 |
"/ t1 := a typeIdentifierInList ? ' '. |
|
2021 |
"/ t2 := b typeIdentifierInList ? ' '. |
|
2022 |
"/ t1 = t2 ifTrue:[ |
|
2023 |
"/ l1 := a label. |
|
2024 |
"/ l2 := b label. |
|
2025 |
"/ l1 = l2 ifTrue:[ |
|
2026 |
"/ (a lineNumber ? 0) < (b lineNumber ? 0) |
|
2027 |
"/ ] ifFalse:[ |
|
2028 |
"/ l1 < l2 |
|
2029 |
"/ ] |
|
2030 |
"/ ] ifFalse:[ |
|
2031 |
"/ t1 < t2 |
|
2032 |
"/ ] |
|
2033 |
"/ ]. |
|
2034 |
"/ ]. |
|
2035 |
||
2036 |
^ [:a :b| a lineNumber < b lineNumber ] |
|
2037 |
||
2038 |
"Created: / 05-05-2011 / 14:37:25 / cg" |
|
9939
b9bfde3e776b
changed: #sortBlockForSortCriteria
Claus Gittinger <cg@exept.de>
parents:
9921
diff
changeset
|
2039 |
"Modified: / 18-06-2011 / 19:30:45 / cg" |
9891 | 2040 |
! |
2041 |
||
2042 |
updateContentsFromFilteredList |
|
2043 |
"call this, if only the sort order has changed (no need to call ctags or filter again)" |
|
2044 |
||
2045 |
|list| |
|
2046 |
||
2047 |
list := filteredList. |
|
2048 |
list notEmptyOrNil ifTrue:[ |
|
2049 |
list := list asSortedCollection:(self sortBlock). |
|
2050 |
]. |
|
2051 |
self contents:(list ? #()). |
|
2052 |
||
2053 |
"Created: / 05-05-2011 / 14:45:41 / cg" |
|
2054 |
! |
|
2055 |
||
2056 |
updateContentsFromRawList |
|
2057 |
"call this, if only the filter has changed (no need to call ctags again)" |
|
2058 |
||
2059 |
filteredList := (filter isEmptyOrNil or:[rawList isNil]) |
|
2060 |
ifTrue:[ rawList ] |
|
2061 |
ifFalse:[ self applyFilterToList:rawList ]. |
|
13634 | 2062 |
filteredList notNil ifTrue:[ |
14346 | 2063 |
self hideFunctions == true ifTrue:[ |
13634 | 2064 |
filteredList := filteredList reject:[:tag | tag isFunctionTag]. |
2065 |
] ifFalse:[ |
|
2066 |
showOnly == #functions ifTrue:[ |
|
2067 |
filteredList := filteredList select:[:tag | tag isFunctionTag]. |
|
2068 |
]. |
|
13631 | 2069 |
]. |
2070 |
]. |
|
9891 | 2071 |
self updateContentsFromFilteredList |
2072 |
||
2073 |
"Modified: / 05-05-2011 / 15:13:14 / cg" |
|
2074 |
! ! |
|
2075 |
||
2076 |
!TagList methodsFor:'queries'! |
|
2077 |
||
2078 |
bestTagForLine:lineNr |
|
2079 |
|bestTag sortedByLineNumber| |
|
2080 |
||
2081 |
sortedByLineNumber := self sortedByLineNumber. |
|
2082 |
self do:[:eachTag | |
|
2083 |
eachTag notNil ifTrue:[ |
|
2084 |
eachTag lineNumber <= lineNr ifTrue:[ |
|
2085 |
bestTag isNil ifTrue:[ |
|
2086 |
bestTag := eachTag. |
|
2087 |
"/ sortedByLineNumber ifTrue:[^ eachTag]. |
|
2088 |
] ifFalse:[ |
|
2089 |
eachTag lineNumber > bestTag lineNumber ifTrue:[ |
|
2090 |
bestTag := eachTag |
|
2091 |
] |
|
2092 |
] |
|
2093 |
]. |
|
2094 |
]. |
|
2095 |
]. |
|
2096 |
||
2097 |
^ bestTag |
|
13342 | 2098 |
! |
2099 |
||
2100 |
tagForFunction:functionName |
|
2101 |
^ rawList |
|
2102 |
detect:[:tag | |
|
2103 |
tag isFunctionTag and:[ tag label = functionName ] |
|
2104 |
] |
|
2105 |
ifNone:nil |
|
2106 |
! |
|
2107 |
||
2108 |
tagsValidForFile |
|
2109 |
"the file, for which the tagsList is valid" |
|
2110 |
||
2111 |
^ tagsValidForFile |
|
9891 | 2112 |
! ! |
2113 |
||
2114 |
!TagList methodsFor:'tag generation'! |
|
2115 |
||
2116 |
fromFile:aFile in:aTempDirectory |
|
2117 |
"create tags from a file; |
|
2118 |
either use the ctags/etags command, or an intenral naive, simple method." |
|
2119 |
||
13215 | 2120 |
|forceSimpleTagList list shellCmd numTags fileContents| |
9891 | 2121 |
|
2122 |
rawList := nil. |
|
13342 | 2123 |
tagsValidForFile := nil. |
2124 |
||
9891 | 2125 |
list := OrderedCollection new. |
2126 |
||
13215 | 2127 |
forceSimpleTagList := false. |
2128 |
"/ the simple builtin tagList generator is actually better than the ctags output for makefiles |
|
2129 |
(self class makeFilePatterns contains:[:aPattern | (aPattern match:aFile baseName asLowercase)]) ifTrue:[forceSimpleTagList := true]. |
|
2130 |
||
2131 |
forceSimpleTagList ifFalse:[ |
|
2132 |
shellCmd := (self shellCommandFor:aFile pathName). |
|
2133 |
shellCmd notNil ifTrue:[ |
|
2134 |
tagTypesPresent := false. "/ will be set again, when ctags command provides types |
|
13753 | 2135 |
list := self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory. |
2136 |
(self class isCSuffix:(aFile suffix)) ifTrue:[ |
|
2137 |
list addAll:(self additionalCTagsInFile:aFile) |
|
2138 |
] |
|
13215 | 2139 |
]. |
9891 | 2140 |
]. |
12334 | 2141 |
|
12343 | 2142 |
"/ in case ctags could not find anything, try our own, naive fallback (not too bad either) |
12334 | 2143 |
list isEmptyOrNil ifTrue:[ |
2144 |
list := self getSimpleTagListFromFile:aFile in:aTempDirectory. |
|
2145 |
]. |
|
9891 | 2146 |
tagTypesPresent := true. |
2147 |
||
2148 |
numTags := list size. |
|
2149 |
fileContents := aFile contents. |
|
2150 |
||
2151 |
(numTags > 1 and:[fileContents notEmptyOrNil]) ifTrue:[ |
|
2152 |
numTags to:1 by:-1 do:[:i| |
|
2153 |
|tag lnr| |
|
2154 |
||
2155 |
tag := list at:i ifAbsent:nil. |
|
2156 |
||
2157 |
lnr := tag lineNumberIn:fileContents. |
|
2158 |
lnr == 0 ifTrue:[ |
|
2159 |
list removeIndex:i |
|
2160 |
] ifFalse:[ |
|
2161 |
tag lineNumber:lnr |
|
2162 |
] |
|
2163 |
] |
|
2164 |
]. |
|
2165 |
self setRawList:list. |
|
13342 | 2166 |
tagsValidForFile := aFile. |
9891 | 2167 |
|
11050 | 2168 |
"Modified: / 05-01-2012 / 11:03:29 / cg" |
9891 | 2169 |
! |
2170 |
||
2171 |
fromFile:aFile in:aTempDirectory onTarget:aTarget |
|
2172 |
"create tags from a file; |
|
2173 |
either use the ctags/etags command, or an intenral naive, simple method. |
|
2174 |
" |
|
2175 |
|list| |
|
2176 |
||
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
2177 |
remoteTarget := aTarget. |
9891 | 2178 |
|
2179 |
[ |
|
2180 |
list := self fromFile:aFile in:aTempDirectory |
|
11497
b27035bd0981
#ensure instead of #valueNowOrOnUnwindDo:
Stefan Vogel <sv@exept.de>
parents:
11466
diff
changeset
|
2181 |
] ensure:[ |
9915
923eae65fc70
fixes for reusability in cc browser
Claus Gittinger <cg@exept.de>
parents:
9891
diff
changeset
|
2182 |
remoteTarget := nil. |
9891 | 2183 |
]. |
2184 |
^ list |
|
2185 |
! |
|
2186 |
||
2187 |
getModeFromFileSuffixOf:aFile |
|
2188 |
|suffix mode| |
|
2189 |
||
2190 |
suffix := aFile suffix. |
|
2191 |
(self class isCSuffix:suffix) ifTrue:[ |
|
2192 |
^ #c. |
|
2193 |
]. |
|
2194 |
(self class isCPlusPlusSuffix:suffix) ifTrue:[ |
|
2195 |
^ #c. |
|
2196 |
]. |
|
2197 |
(self class isJavaSuffix:suffix) ifTrue:[ |
|
2198 |
^ #java. |
|
2199 |
]. |
|
2200 |
(self class isFortranSuffix:suffix) ifTrue:[ |
|
2201 |
^ #fortran. |
|
2202 |
]. |
|
2203 |
(self class isEiffelSuffix:suffix) ifTrue:[ |
|
2204 |
^ #eiffel. |
|
2205 |
]. |
|
2206 |
(self class isHTMLSuffix:suffix) ifTrue:[ |
|
2207 |
^ #html. |
|
2208 |
]. |
|
2209 |
^ mode |
|
2210 |
||
2211 |
"Modified: / 20-04-2011 / 19:02:54 / cg" |
|
2212 |
! |
|
2213 |
||
11050 | 2214 |
getTagListFromFile:aFile usingCommand:scmd mode:modeOrNil in:aTempDirectory |
9891 | 2215 |
"create ctags-list from a file, using cmd (which is etags / ctags)" |
2216 |
||
2217 |
|list pipe tag tagFile contents mode infoDictionary| |
|
2218 |
||
11050 | 2219 |
(mode := modeOrNil) isNil ifTrue:[ |
2220 |
mode := self getModeFromFileSuffixOf:aFile. |
|
2221 |
]. |
|
9891 | 2222 |
list := OrderedCollection new:512. |
2223 |
||
2224 |
infoDictionary := Dictionary new. |
|
2225 |
||
2226 |
"/ Transcript showCR:'execute tags command: ', scmd. |
|
2227 |
usingDefaultCTags ifFalse:[ |
|
2228 |
(pipe := PipeStream readingFrom:scmd) notNil ifTrue:[ |
|
2229 |
[ |
|
2230 |
|line atEnd| |
|
2231 |
||
2232 |
atEnd := false. |
|
2233 |
ReadError |
|
2234 |
handle:[:ex | ] |
|
2235 |
do:[ |
|
2236 |
[atEnd] whileFalse:[ |
|
2237 |
(line := pipe nextLine) isNil ifTrue:[ |
|
2238 |
atEnd := pipe atEnd |
|
2239 |
] ifFalse:[ |
|
2240 |
"/ Transcript showCR:line. |
|
2241 |
tag := self tagFromLine:line mode:mode using:infoDictionary. |
|
2242 |
||
2243 |
tag notNil ifTrue:[ |
|
2244 |
list add:tag |
|
2245 |
] |
|
2246 |
] |
|
2247 |
] |
|
2248 |
] |
|
2249 |
] ensure:[pipe close]. |
|
2250 |
]. |
|
2251 |
^ list. |
|
2252 |
]. |
|
2253 |
||
2254 |
(OperatingSystem executeCommand:scmd inDirectory:aTempDirectory) ifTrue:[ |
|
2255 |
tagFile := aTempDirectory construct:'tags'. |
|
2256 |
||
2257 |
tagFile exists ifTrue:[ |
|
2258 |
contents := tagFile contents. |
|
2259 |
||
2260 |
contents notNil ifTrue:[ |
|
2261 |
contents do:[:aLine| |
|
2262 |
(tag := self tagFromLine:aLine mode:mode using:infoDictionary) notNil ifTrue:[list add:tag] |
|
2263 |
] |
|
2264 |
]. |
|
2265 |
Exception |
|
2266 |
handle:[:ex| ] |
|
2267 |
do:[tagFile remove]. |
|
2268 |
]. |
|
2269 |
^ list. |
|
2270 |
]. |
|
2271 |
||
2272 |
scmd = 'ctags' ifFalse:[ |
|
2273 |
"/ try default ctags without any options |
|
11050 | 2274 |
^ self getTagListFromFile:aFile usingCommand:'ctags' mode:modeOrNil in:aTempDirectory |
9891 | 2275 |
]. |
2276 |
^ #() |
|
11050 | 2277 |
|
2278 |
"Created: / 05-01-2012 / 11:03:04 / cg" |
|
9891 | 2279 |
! |
2280 |
||
2281 |
tagFromLine:aLine mode:languageMode using:infoDictionary |
|
2282 |
"analyze the line as returned from ctags and create a corresponding tag object for it" |
|
2283 |
||
2284 |
|stream word1 word2 tagType pattern key |
|
2285 |
file className lineNumber tagClass fmtString fmt |
|
2286 |
showOnly| |
|
2287 |
||
13317 | 2288 |
"/ Transcript showCR:aLine. |
9891 | 2289 |
aLine size < 6 ifTrue:[ |
2290 |
^ nil |
|
2291 |
]. |
|
2292 |
aLine first == $!! ifTrue:[ |
|
2293 |
(aLine startsWith:'!!_TAG_FILE_FORMAT') ifTrue:[ |
|
2294 |
"/ aha - ex. ctags |
|
2295 |
stream := aLine readStream. |
|
2296 |
stream upTo:Character tab. |
|
2297 |
stream skipSeparators. |
|
2298 |
fmtString := stream upTo:Character tab. |
|
2299 |
fmt := Integer readFrom:fmtString onError:nil. |
|
2300 |
fmt notNil ifTrue:[ |
|
2301 |
infoDictionary at:#formatVersion put:fmt |
|
2302 |
] |
|
2303 |
]. |
|
2304 |
^ nil |
|
2305 |
]. |
|
2306 |
||
2307 |
"/ tab separated list; except for the pattern, which might include a tab. |
|
2308 |
stream := aLine readStream. |
|
2309 |
key := stream upTo:Character tab. |
|
2310 |
stream skipSeparators. |
|
2311 |
file := stream upTo:Character tab. |
|
2312 |
stream skipSeparators. |
|
2313 |
stream peek == $/ ifTrue:[ |
|
2314 |
stream next. |
|
2315 |
pattern := stream upTo:$/. |
|
2316 |
[(pattern last) == $\] whileTrue:[ |
|
2317 |
pattern at:(pattern size) put:$/. |
|
2318 |
pattern := pattern , (stream upTo:$/). |
|
2319 |
]. |
|
2320 |
] ifFalse:[ |
|
2321 |
stream peek isDigit ifTrue:[ |
|
2322 |
lineNumber := Integer readFrom:stream onError:nil. |
|
2323 |
lineNumber isNil ifTrue:[ |
|
2324 |
self halt:'should not happen - please debug'. |
|
2325 |
] ifFalse:[ |
|
2326 |
pattern := key. |
|
2327 |
]. |
|
2328 |
] ifFalse:[ |
|
2329 |
self halt:'should not happen - please debug'. |
|
2330 |
]. |
|
2331 |
]. |
|
2332 |
stream peekFor:$;. |
|
2333 |
stream peekFor:$". |
|
2334 |
stream skipSeparators. |
|
2335 |
tagType := stream upTo:Character tab. |
|
2336 |
stream skipSeparators. |
|
2337 |
word1 := stream upTo:Character tab. "/ optional file: (scope) |
|
2338 |
stream skipSeparators. |
|
2339 |
word2 := stream upTo:Character tab. "/ optional class: |
|
2340 |
||
2341 |
(word1 startsWith:'file:') ifTrue:[ "/ file: (scope) |
|
14346 | 2342 |
self hideStatic == true ifTrue:[^ nil]. |
9891 | 2343 |
]. |
2344 |
||
2345 |
(word2 startsWith: 'class:') ifTrue:[ |
|
2346 |
className := word2 copyFrom:('class:' size) |
|
2347 |
] ifFalse:[ |
|
2348 |
(word1 startsWith: 'class:') ifTrue:[ |
|
2349 |
className := word1 copyFrom:('class:' size) |
|
2350 |
] |
|
2351 |
]. |
|
2352 |
"/ (word1 startsWith: 'class:') ifTrue:[ |
|
2353 |
"/ className := word1 copyFrom:('class:' size) |
|
2354 |
"/ ]. |
|
2355 |
"/ (word2 startsWith: 'class:') ifTrue:[ |
|
2356 |
"/ className := word2 copyFrom:('class:' size) |
|
2357 |
"/ ]. |
|
2358 |
||
2359 |
tagClass := Tag. |
|
2360 |
tagClass autoload. |
|
2361 |
||
2362 |
"/ typeCharacter to tag-Class mapping... |
|
2363 |
languageMode == #c ifTrue:[ |
|
2364 |
tagType = 'v' ifTrue:[ |
|
14346 | 2365 |
self hideVariables == true ifTrue:[^ nil]. |
9891 | 2366 |
tagClass := Tag::TVariable |
2367 |
] ifFalse:[ tagType = 'f' ifTrue:[ |
|
14346 | 2368 |
self hideFunctions == true ifTrue:[^ nil]. |
9891 | 2369 |
tagClass := Tag::TFunction |
2370 |
] ifFalse:[ tagType = 'd' ifTrue:[ |
|
14346 | 2371 |
self hideDefines == true ifTrue:[^ nil]. |
9891 | 2372 |
tagClass := Tag::TMacro |
2373 |
] ifFalse:[ tagType = 't' ifTrue:[ |
|
14346 | 2374 |
self hideTypedefs == true ifTrue:[^ nil]. |
9891 | 2375 |
tagClass := Tag::TTypedef |
2376 |
] ifFalse:[ tagType = 'm' ifTrue:[ |
|
14346 | 2377 |
self hideStructMembers == true ifTrue:[^ nil]. |
9891 | 2378 |
tagClass := Tag::TMember |
2379 |
] ifFalse:[ tagType = 's' ifTrue:[ |
|
14346 | 2380 |
self hideStructures == true ifTrue:[^ nil]. |
9891 | 2381 |
tagClass := Tag::TStruct |
2382 |
] ifFalse:[ tagType = 'u' ifTrue:[ |
|
14346 | 2383 |
self hideStructures == true ifTrue:[^ nil]. |
9891 | 2384 |
tagClass := Tag::TUnion |
2385 |
] ifFalse:[ tagType = 'c' ifTrue:[ |
|
14346 | 2386 |
self hideClasses == true ifTrue:[^ nil]. |
9891 | 2387 |
tagClass := Tag::TClass |
2388 |
] ifFalse:[ tagType = 'e' ifTrue:[ |
|
2389 |
tagClass := Tag::TEnumMember. |
|
2390 |
] ifFalse:[ tagType = 'g' ifTrue:[ |
|
2391 |
tagClass := Tag::TEnum. |
|
2392 |
"/ ] ifFalse:[ tagType = 'n' ifTrue:[ |
|
2393 |
"/ tagClass := Tag::TNamespace |
|
2394 |
"/ ] ifFalse:[ tagType = 'p' ifTrue:[ |
|
2395 |
"/ tagClass := Tag::TFunctionPrototype |
|
2396 |
"/ ] ifFalse:[ tagType = 'x' ifTrue:[ |
|
2397 |
"/ tagClass := Tag::TExternVariable |
|
2398 |
] ifFalse:[ |
|
13753 | 2399 |
self breakPoint:#cg. |
9891 | 2400 |
"/ add more here |
2401 |
]]]]]]]]]] |
|
2402 |
] ifFalse:[ languageMode == #java ifTrue:[ |
|
2403 |
tagType = 'c' ifTrue:[ |
|
14346 | 2404 |
self hideJavaClasses == true ifTrue:[^ nil]. |
9891 | 2405 |
tagClass := Tag::TClass |
2406 |
] ifFalse:[ tagType = 'm' ifTrue:[ |
|
14346 | 2407 |
self hideJavaMethods == true ifTrue:[^ nil]. |
9891 | 2408 |
tagClass := Tag::TMethod |
2409 |
] ifFalse:[ tagType = 'f' ifTrue:[ |
|
14346 | 2410 |
self hideJavaFields == true ifTrue:[^ nil]. |
9891 | 2411 |
tagClass := Tag::TField |
2412 |
] ifFalse:[ tagType = 'i' ifTrue:[ |
|
14346 | 2413 |
self hideJavaInterfaces == true ifTrue:[^ nil]. |
9891 | 2414 |
tagClass := Tag::TInterface |
2415 |
] ifFalse:[ tagType = 'p' ifTrue:[ |
|
14346 | 2416 |
self hideJavaPackages == true ifTrue:[^ nil]. |
9891 | 2417 |
tagClass := Tag::TPackage |
2418 |
] ifFalse:[ |
|
2419 |
"/ add more here */ |
|
2420 |
]]]]] |
|
2421 |
] ifFalse:[ languageMode == #eiffel ifTrue:[ |
|
2422 |
tagType = 'c' ifTrue:[ |
|
14346 | 2423 |
self hideClasses == true ifTrue:[^ nil]. |
9891 | 2424 |
tagClass := Tag::TClass |
2425 |
"/ ] ifFalse:[ tagType = 'f' ifTrue:[ |
|
2426 |
"/ tagClass := Tag::TFeature |
|
2427 |
"/ ] ifFalse:[ tagType = 'l' ifTrue:[ |
|
2428 |
"/ tagClass := Tag::TLocalEntity |
|
2429 |
] ifFalse:[ |
|
2430 |
"/ add more here */ |
|
2431 |
] |
|
2432 |
] ifFalse:[ languageMode == #fortran ifTrue:[ |
|
2433 |
tagType = 'f' ifTrue:[ |
|
14346 | 2434 |
self hideFunctions == true ifTrue:[^ nil]. |
9891 | 2435 |
tagClass := Tag::TFunction |
2436 |
] ifFalse:[ tagType = 'i' ifTrue:[ |
|
2437 |
"/ hideInterfaces == true ifTrue:[^ nil]. |
|
2438 |
tagClass := Tag::TInterface |
|
2439 |
] ifFalse:[ tagType = 't' ifTrue:[ |
|
14346 | 2440 |
self hideTypedefs == true ifTrue:[^ nil]. |
9891 | 2441 |
tagClass := Tag::TTypedef |
2442 |
"/ ] ifFalse:[ tagType = 'l' ifTrue:[ |
|
2443 |
"/ tagClass := Tag::TLabel |
|
2444 |
"/ ] ifFalse:[ tagType = 'm' ifTrue:[ |
|
2445 |
"/ tagClass := Tag::TModule |
|
2446 |
"/ ] ifFalse:[ tagType = 'n' ifTrue:[ |
|
2447 |
"/ tagClass := Tag::TNameList |
|
2448 |
"/ ] ifFalse:[ tagType = 'p' ifTrue:[ |
|
2449 |
"/ tagClass := Tag::TProgram |
|
2450 |
"/ ] ifFalse:[ tagType = 's' ifTrue:[ |
|
2451 |
"/ tagClass := Tag::TSubroutine |
|
2452 |
"/ ] ifFalse:[ tagType = 'b' ifTrue:[ |
|
2453 |
"/ tagClass := Tag::TBlockData |
|
2454 |
"/ ] ifFalse:[ tagType = 'c' ifTrue:[ |
|
2455 |
"/ tagClass := Tag::TCommonBlock |
|
2456 |
"/ ] ifFalse:[ tagType = 'e' ifTrue:[ |
|
2457 |
"/ tagClass := Tag::TEntryPoint |
|
2458 |
] ifFalse:[ |
|
2459 |
"/ add more here */ |
|
2460 |
]]] |
|
2461 |
]]]]. |
|
2462 |
||
2463 |
tagTypesPresent := true. |
|
2464 |
||
2465 |
tagType size == 0 ifTrue:[ |
|
2466 |
tagType := '' |
|
2467 |
] ifFalse:[ |
|
2468 |
(showOnly := self showOnly) notNil ifTrue:[ |
|
2469 |
showOnly == #classes ifTrue:[ |
|
2470 |
tagClass ~~ Tag::TClass ifTrue:[^ nil]. |
|
2471 |
] ifFalse:[ showOnly == #functions ifTrue:[ |
|
2472 |
tagClass ~~ Tag::TFunction ifTrue:[^ nil]. |
|
2473 |
] ifFalse:[ showOnly == #variables ifTrue:[ |
|
2474 |
tagClass ~~ Tag::TVariable ifTrue:[^ nil]. |
|
2475 |
] ifFalse:[ showOnly == #types ifTrue:[ |
|
2476 |
(tagClass ~~ Tag::TTypedef |
|
2477 |
and:[ true "tagClass ~~ Tag::TUnion" |
|
2478 |
and:[ tagClass ~~ Tag::TStruct ]])ifTrue:[^ nil]. |
|
2479 |
] ifFalse:[ showOnly == #functionsAndVariables ifTrue:[ |
|
2480 |
((tagClass ~~ Tag::TFunction) |
|
2481 |
and:[tagClass ~~ Tag::TVariable]) ifTrue:[^ nil]. |
|
2482 |
] ifFalse:[ showOnly == #classesFunctionsAndVariables ifTrue:[ |
|
2483 |
((tagClass ~~ Tag::TFunction) |
|
2484 |
and:[(tagClass ~~ Tag::TVariable) |
|
2485 |
and:[tagClass ~~ Tag::TClass]]) ifTrue:[^ nil]. |
|
2486 |
] ifFalse:[ showOnly == #defines ifTrue:[ |
|
2487 |
tagClass ~~ Tag::TMacro ifTrue:[^ nil]. |
|
2488 |
] ifFalse:[ showOnly == #structs ifTrue:[ |
|
2489 |
tagClass ~~ Tag::TStruct ifTrue:[^ nil]. |
|
2490 |
] ifFalse:[ showOnly == #everything ifTrue:[ |
|
2491 |
] ifFalse:[ |
|
2492 |
self halt:'unhandled showOnly'. |
|
2493 |
]]]]]]]]] |
|
2494 |
] |
|
2495 |
]. |
|
2496 |
||
2497 |
^ tagClass label:key |
|
2498 |
pattern:pattern |
|
2499 |
type:tagType |
|
2500 |
lineNumber:lineNumber |
|
2501 |
className:className. |
|
2502 |
||
2503 |
"Modified: / 05-05-2011 / 15:45:55 / cg" |
|
2504 |
! ! |
|
2505 |
||
13153 | 2506 |
!TagList methodsFor:'tag generation - helpers'! |
2507 |
||
14345 | 2508 |
linewiseNaiveTagsInFile:aFilePath using:parseLineBlock |
2509 |
"common helper for naive linewise parsing tags" |
|
2510 |
||
2511 |
|targets line lineNr s tagOrTagCollection| |
|
2512 |
||
2513 |
Tag autoload. |
|
2514 |
||
2515 |
targets := OrderedCollection new. |
|
2516 |
s := aFilePath asFilename readStream. |
|
2517 |
s notNil ifTrue:[ |
|
2518 |
s := LineNumberReadStream readingFrom:s. |
|
2519 |
[s atEnd] whileFalse:[ |
|
2520 |
lineNr := s lineNumber. |
|
2521 |
line := s nextLine. |
|
2522 |
||
2523 |
tagOrTagCollection := parseLineBlock value:line value:lineNr. |
|
2524 |
tagOrTagCollection notNil ifTrue:[ |
|
2525 |
tagOrTagCollection isCollection ifTrue:[ |
|
2526 |
targets addAll:tagOrTagCollection |
|
2527 |
] ifFalse:[ |
|
2528 |
targets add:tagOrTagCollection |
|
2529 |
]. |
|
2530 |
]. |
|
2531 |
]. |
|
2532 |
s close |
|
2533 |
]. |
|
2534 |
^ targets |
|
2535 |
||
2536 |
"Modified: / 08-05-2011 / 10:12:29 / cg" |
|
2537 |
! |
|
2538 |
||
13153 | 2539 |
plainTextBetweenHTMLElement:startElement andElementWithTag:endTag |
2540 |
"applied to an <h1>-tag element, passing '/h1' as endTag, |
|
2541 |
this retrieves the plain text of the headline. Used by the tag list." |
|
2542 |
||
2543 |
|el collector hasSpace txt| |
|
2544 |
||
2545 |
collector := WriteStream on:(String new:100). |
|
2546 |
el := startElement next. |
|
2547 |
||
2548 |
hasSpace := true. |
|
2549 |
[ el notNil and:[el tag ~= endTag] ] whileTrue:[ |
|
2550 |
el isTextElement ifTrue:[ |
|
2551 |
hasSpace ifFalse:[ |
|
2552 |
collector space. |
|
2553 |
hasSpace := true. |
|
2554 |
]. |
|
2555 |
txt := el text withoutSeparators. |
|
2556 |
txt notEmpty ifTrue:[ |
|
2557 |
collector nextPutAll:txt. |
|
2558 |
hasSpace := txt endsWith:' '. |
|
2559 |
] |
|
2560 |
]. |
|
2561 |
el := el next |
|
2562 |
]. |
|
2563 |
^ collector contents |
|
2564 |
||
2565 |
"Created: / 12-09-2012 / 12:38:01 / cg" |
|
2566 |
! |
|
2567 |
||
2568 |
tagsForLinesStartingWithIdentifierAndColon:aFilePath |
|
2569 |
"helper for yacc tags (and maybe others in the future): |
|
2570 |
naive, q&d scan for lines matching: |
|
2571 |
<anything>: |
|
2572 |
" |
|
2573 |
||
2574 |
|targets line l lineNr nm s words w| |
|
2575 |
||
2576 |
Tag autoload. |
|
2577 |
||
2578 |
targets := OrderedCollection new. |
|
2579 |
s := aFilePath asFilename readStream. |
|
2580 |
s notNil ifTrue:[ |
|
2581 |
s := LineNumberReadStream readingFrom:s. |
|
2582 |
[s atEnd] whileFalse:[ |
|
2583 |
line := s nextLine. |
|
2584 |
l := line withoutSeparators. |
|
2585 |
words := l asCollectionOfWords. |
|
2586 |
||
2587 |
words size >= 1 ifTrue:[ |
|
2588 |
w := words first. |
|
2589 |
(w endsWith:$:) ifTrue:[ |
|
2590 |
nm := w copyButLast:1. |
|
2591 |
||
2592 |
lineNr := s lineNumber - 1. |
|
2593 |
targets add:(Tag::TLabel |
|
2594 |
label:nm |
|
2595 |
pattern:nil |
|
2596 |
type:nil |
|
2597 |
lineNumber:lineNr). |
|
2598 |
]. |
|
2599 |
] |
|
2600 |
]. |
|
2601 |
s close |
|
2602 |
]. |
|
2603 |
^ targets |
|
2604 |
||
2605 |
"Created: / 28-09-2012 / 14:45:35 / cg" |
|
2606 |
! ! |
|
2607 |
||
9891 | 2608 |
!TagList methodsFor:'tag generation - simple'! |
2609 |
||
13753 | 2610 |
additionalCTagsInFile:aFilePath |
2611 |
"additional tags, which are not found by the standard ctags utility: |
|
2612 |
case foo: - case label tags |
|
2613 |
" |
|
2614 |
||
2615 |
|targets line lineNr s caseLabel l| |
|
2616 |
||
2617 |
Tag autoload. |
|
2618 |
||
2619 |
targets := OrderedCollection new. |
|
2620 |
s := aFilePath asFilename readStream. |
|
2621 |
s notNil ifTrue:[ |
|
2622 |
s := LineNumberReadStream readingFrom:s. |
|
2623 |
[s atEnd] whileFalse:[ |
|
2624 |
line := s nextLine withoutSeparators. |
|
2625 |
(line startsWith:'case ') ifTrue:[ |
|
2626 |
l := line readStream. |
|
2627 |
l skip:5. |
|
2628 |
caseLabel := l upTo:$:. |
|
2629 |
lineNr := s lineNumber - 1. |
|
13771 | 2630 |
targets add:(Tag::TCaseLabel |
2631 |
label:caseLabel,'<case>' |
|
13753 | 2632 |
pattern:nil |
2633 |
type:nil |
|
2634 |
lineNumber:lineNr). |
|
2635 |
] |
|
2636 |
]. |
|
2637 |
s close |
|
2638 |
]. |
|
2639 |
^ targets |
|
2640 |
! |
|
2641 |
||
9891 | 2642 |
assemblerTagsInFile:aFilePath |
2643 |
"assembler tags: |
|
2644 |
naive, q&d scan for lines matching: |
|
2645 |
<anything>: |
|
2646 |
CAVEAT: |
|
2647 |
the code below handles linux-i386 assembler only (for now) |
|
2648 |
" |
|
2649 |
||
2650 |
|targets line l lineNr nm s words w directive |
|
11502 | 2651 |
hideLocals hideLocals2 hideLocals3 hideData hideText currentSegment| |
9891 | 2652 |
|
2653 |
Tag autoload. |
|
2654 |
||
2655 |
targets := OrderedCollection new. |
|
2656 |
s := aFilePath asFilename readStream. |
|
2657 |
s notNil ifTrue:[ |
|
14346 | 2658 |
hideLocals := self flagNamed:#hideLocalLabels ? false. |
2659 |
hideLocals2 := self flagNamed:#hideLocalLabels2 ? false. |
|
2660 |
hideLocals3 := self flagNamed:#hideLocalLabels3 ? false. |
|
2661 |
hideData := self flagNamed:#hideDataLabels ? false. |
|
2662 |
hideText := self flagNamed:#hideTextLabels ? false. |
|
9891 | 2663 |
currentSegment := #text. |
2664 |
||
2665 |
s := LineNumberReadStream readingFrom:s. |
|
2666 |
[s atEnd] whileFalse:[ |
|
2667 |
lineNr := s lineNumber. |
|
2668 |
line := s nextLine. |
|
2669 |
l := line withoutSeparators. |
|
2670 |
words := l asCollectionOfWords. |
|
2671 |
words size >= 1 ifTrue:[ |
|
2672 |
w := words first. |
|
2673 |
(w endsWith:$:) ifTrue:[ |
|
2674 |
(hideText and:[currentSegment == #text]) ifFalse:[ |
|
2675 |
(hideData and:[currentSegment == #data]) ifFalse:[ |
|
2676 |
(hideLocals and:[(w startsWith:$.)]) ifFalse:[ |
|
11466 | 2677 |
(hideLocals2 and:[(w startsWith:$_) not]) ifFalse:[ |
11502 | 2678 |
(hideLocals3 |
2679 |
and:[ (w startsWith:$L) |
|
2680 |
and:[ (w size > 1) |
|
2681 |
and:[ ((w copyFrom:2 to:(w size-1)) conform:[:c | c isDigit]) |
|
2682 |
]]]) ifFalse:[ |
|
12714
c972f423e7a9
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12344
diff
changeset
|
2683 |
nm := w copyButLast:1. |
11502 | 2684 |
targets add:(Tag::TLabel |
2685 |
label:nm |
|
2686 |
pattern:nil |
|
2687 |
type:nil |
|
2688 |
lineNumber:lineNr). |
|
2689 |
]. |
|
11466 | 2690 |
]. |
9891 | 2691 |
]. |
2692 |
]. |
|
2693 |
]. |
|
2694 |
words size >= 2 ifTrue:[ |
|
2695 |
directive := words second |
|
2696 |
] ifFalse:[ |
|
2697 |
directive := nil. |
|
2698 |
] |
|
2699 |
] ifFalse:[ |
|
2700 |
directive := w. |
|
2701 |
]. |
|
2702 |
(directive notNil and:[directive startsWith:$.]) ifTrue:[ |
|
2703 |
directive = '.text' ifTrue:[ |
|
2704 |
currentSegment := #text |
|
2705 |
] ifFalse:[ directive = '.data' ifTrue:[ |
|
2706 |
currentSegment := #data |
|
2707 |
] ifFalse:[ directive = '.bss' ifTrue:[ |
|
2708 |
currentSegment := #data |
|
2709 |
] ifFalse:[ directive = '.rodata' ifTrue:[ |
|
2710 |
currentSegment := #data |
|
2711 |
]]]] |
|
2712 |
] |
|
2713 |
] |
|
2714 |
]. |
|
2715 |
s close |
|
2716 |
]. |
|
2717 |
^ targets |
|
2718 |
||
11502 | 2719 |
"Modified: / 13-05-2012 / 11:25:49 / cg" |
9891 | 2720 |
! |
2721 |
||
11825 | 2722 |
batchTagsInFile:aFilePath |
2723 |
"batch-file |
|
2724 |
naive, q&d scan for lines matching: |
|
2725 |
:<anything> |
|
2726 |
" |
|
2727 |
||
2728 |
|targets line l lineNr nm s words| |
|
2729 |
||
2730 |
Tag autoload. |
|
2731 |
||
2732 |
targets := OrderedCollection new. |
|
2733 |
s := aFilePath asFilename readStream. |
|
2734 |
s notNil ifTrue:[ |
|
2735 |
s := LineNumberReadStream readingFrom:s. |
|
2736 |
[s atEnd] whileFalse:[ |
|
2737 |
line := s nextLine. |
|
2738 |
(line startsWith:$:) ifTrue:[ |
|
2739 |
l := line withoutSeparators. |
|
2740 |
words := (l copyFrom:2) asCollectionOfWords. |
|
2741 |
||
2742 |
words size == 1 ifTrue:[ |
|
2743 |
nm := words first. |
|
2744 |
||
2745 |
lineNr := s lineNumber - 1. |
|
2746 |
targets add:(Tag::TLabel |
|
2747 |
label:nm |
|
2748 |
pattern:nil |
|
2749 |
type:nil |
|
2750 |
lineNumber:lineNr). |
|
2751 |
]. |
|
2752 |
] |
|
2753 |
]. |
|
2754 |
s close |
|
2755 |
]. |
|
2756 |
^ targets |
|
2757 |
||
2758 |
"Created: / 28-09-2012 / 14:45:10 / cg" |
|
2759 |
! |
|
2760 |
||
11762 | 2761 |
dartTagsInFile:aFilePath |
2762 |
"dart tags: |
|
2763 |
naive, q&d scan for lines matching: |
|
2764 |
interface foo |
|
2765 |
class foo |
|
2766 |
function foo |
|
2767 |
" |
|
2768 |
||
2769 |
|targets line l lineNr nm s| |
|
2770 |
||
2771 |
Tag autoload. |
|
2772 |
||
2773 |
targets := OrderedCollection new. |
|
2774 |
s := aFilePath asFilename readStream. |
|
2775 |
s notNil ifTrue:[ |
|
2776 |
s := LineNumberReadStream readingFrom:s. |
|
2777 |
[s atEnd] whileFalse:[ |
|
2778 |
lineNr := s lineNumber. |
|
2779 |
line := s nextLine. |
|
2780 |
l := line withoutSeparators. |
|
2781 |
{ |
|
14346 | 2782 |
{ 'function ' . #functions . self hideFunctions . Tag::TFunction } . |
2783 |
{ 'var ' . #variables . self hideVariables . Tag::TVariable } . |
|
2784 |
{ 'class ' . #classes . self hideClasses . Tag::TClass } . |
|
2785 |
{ 'abstract class ' . #classes . self hideClasses . Tag::TClass } . |
|
2786 |
{ 'interface ' . #interfaces . self hideDartInterfaces . Tag::TInterface } . |
|
2787 |
{ 'factory ' . #methods . self hideMethods . Tag::TMethod } . |
|
11762 | 2788 |
} tuplesDo:[:keywordSpace :showOnlyEnum :hideVariableValue :tagType| |
2789 |
(l startsWith:keywordSpace) ifTrue:[ |
|
2790 |
(showOnly isNil or:[showOnly == showOnlyEnum]) ifTrue:[ |
|
2791 |
hideVariableValue ~~ true ifTrue:[ |
|
2792 |
nm := l copyFrom:(keywordSpace size + 1). |
|
2793 |
nm := nm copyTo:(nm |
|
11771 | 2794 |
findFirst:[:ch | (ch isLetterOrDigit or:['$_.' includes:ch]) not] |
11762 | 2795 |
ifNone:nm size+1)-1. |
2796 |
targets add:(tagType |
|
2797 |
label:nm |
|
2798 |
pattern:nil |
|
2799 |
type:nil |
|
2800 |
lineNumber:lineNr). |
|
2801 |
] |
|
2802 |
] |
|
2803 |
]. |
|
2804 |
] |
|
2805 |
]. |
|
2806 |
s close |
|
2807 |
]. |
|
2808 |
^ targets |
|
2809 |
||
2810 |
"Created: / 28-06-2010 / 12:44:25 / cg" |
|
11766 | 2811 |
"Modified: / 22-08-2012 / 21:32:33 / cg" |
11762 | 2812 |
! |
2813 |
||
11050 | 2814 |
getSimpleTagListFromFile:aFileOrString in:aTempDirectory |
9891 | 2815 |
"fallback, if no ctags is present, or if the file is not a c-file. |
2816 |
Implemented here for some other file types (Makefiles) |
|
2817 |
" |
|
14365 | 2818 |
|file lcName pathName suffix mime| |
11050 | 2819 |
|
2820 |
file := aFileOrString asFilename. |
|
2821 |
lcName := file baseName asLowercase. |
|
2822 |
pathName := file pathName. |
|
2823 |
||
9891 | 2824 |
self class makeFilePatterns do:[:aPattern | |
2825 |
(aPattern match:lcName) ifTrue:[ |
|
2826 |
^ self class makeTargetTagsInFile:pathName filter:showOnly |
|
2827 |
] |
|
2828 |
]. |
|
2829 |
||
2830 |
suffix := lcName asFilename suffix. |
|
14365 | 2831 |
mime := TagList tagMimeTypeForFile:file. |
2832 |
||
2833 |
((self class isSmalltalkSuffix:suffix) |
|
2834 |
or:[(mime ? '') includesString:'smalltalk']) ifTrue:[ |
|
9891 | 2835 |
"/ smalltalk tags - simulated |
11050 | 2836 |
^ self stTagsInFile:pathName in:aTempDirectory |
9891 | 2837 |
]. |
14365 | 2838 |
((self class isPythonSuffix:suffix) |
2839 |
or:[(mime ? '') includesString:'python']) ifTrue:[ |
|
9891 | 2840 |
"/ python tags - simulated |
2841 |
^ self pythonTagsInFile:pathName |
|
2842 |
]. |
|
14365 | 2843 |
((self class isPhpSuffix:suffix) |
2844 |
or:[(mime ? '') includesString:'php']) ifTrue:[ |
|
9891 | 2845 |
"/ php tags - simulated |
2846 |
^ self phpTagsInFile:pathName |
|
2847 |
]. |
|
14365 | 2848 |
((self class isLispSuffix:suffix) |
2849 |
or:[(mime ? '') includesString:'lisp']) ifTrue:[ |
|
9891 | 2850 |
"/ lisp tags - simulated |
2851 |
^ self lispTagsInFile:pathName |
|
2852 |
]. |
|
14365 | 2853 |
((self class isOzSuffix:suffix) |
2854 |
or:[(mime ? '') includesString:'oz']) ifTrue:[ |
|
9891 | 2855 |
"/ oz tags - simulated |
2856 |
^ self ozTagsInFile:pathName |
|
2857 |
]. |
|
14365 | 2858 |
((self class isPrologSuffix:suffix) |
2859 |
or:[(mime ? '') includesString:'prolog']) ifTrue:[ |
|
9891 | 2860 |
"/ prolog tags - simulated |
2861 |
^ self prologTagsInFile:pathName |
|
2862 |
]. |
|
14365 | 2863 |
((self class isTCLSuffix:suffix) |
2864 |
or:[(mime ? '') includesString:'tcl']) ifTrue:[ |
|
9891 | 2865 |
"/ tcl tags - simulated |
2866 |
^ self tclTagsInFile:pathName |
|
2867 |
]. |
|
14365 | 2868 |
((self class isAssemblerSuffix:suffix) |
2869 |
or:[(mime ? '') includesString:'assembler']) ifTrue:[ |
|
9891 | 2870 |
"/ assembler tags - simulated |
2871 |
^ self assemblerTagsInFile:pathName |
|
2872 |
]. |
|
14365 | 2873 |
((self class isRubySuffix:suffix) |
2874 |
or:[(mime ? '') includesString:'ruby']) ifTrue:[ |
|
9891 | 2875 |
"/ ruby tags - simulated |
2876 |
^ self rubyTagsInFile:pathName |
|
2877 |
]. |
|
14365 | 2878 |
((self class isYaccSuffix:suffix) |
2879 |
or:[(mime ? '') includesString:'yacc']) ifTrue:[ |
|
9891 | 2880 |
"/ yacc tags - simulated |
2881 |
^ self yaccTagsInFile:pathName |
|
2882 |
]. |
|
14365 | 2883 |
((self class isJavaScriptSuffix:suffix) |
2884 |
or:[(mime ? '') includesString:'javascript']) ifTrue:[ |
|
9891 | 2885 |
"/ js tags - simulated |
2886 |
^ self javaScriptTagsInFile:pathName |
|
2887 |
]. |
|
14365 | 2888 |
((self class isDartSuffix:suffix) |
2889 |
or:[(mime ? '') includesString:'dart']) ifTrue:[ |
|
11766 | 2890 |
"/ dart tags - simulated |
2891 |
^ self dartTagsInFile:pathName |
|
2892 |
]. |
|
14365 | 2893 |
((self class isLuaSuffix:suffix) |
2894 |
or:[(mime ? '') includesString:'lua']) ifTrue:[ |
|
14345 | 2895 |
"/ lua tags - simulated |
2896 |
^ self luaTagsInFile:pathName |
|
2897 |
]. |
|
9891 | 2898 |
|
14365 | 2899 |
((self class isHTMLSuffix:suffix) |
2900 |
or:[(mime ? '') includesString:'html']) ifTrue:[ |
|
9891 | 2901 |
"/ html tags - simulated |
2902 |
^ self htmlTagsInFile:pathName |
|
2903 |
]. |
|
14365 | 2904 |
((self class isBatchSuffix:suffix) |
2905 |
or:[(mime ? '') includesString:'batch']) ifTrue:[ |
|
11825 | 2906 |
"/ batch tags - simulated |
2907 |
^ self batchTagsInFile:pathName |
|
2908 |
]. |
|
9891 | 2909 |
|
2910 |
"/ could add more here ... |
|
2911 |
^ nil. |
|
2912 |
||
11050 | 2913 |
"Created: / 05-01-2012 / 10:55:03 / cg" |
9891 | 2914 |
! |
2915 |
||
2916 |
htmlTagsInFile:aFilePath |
|
2917 |
"hatml tags: |
|
13153 | 2918 |
naive, q&d scan for lines containing: |
9891 | 2919 |
<textarea> |
2920 |
<input> |
|
2921 |
<table> |
|
2922 |
<script> |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2923 |
<hX> |
9891 | 2924 |
" |
2925 |
||
2926 |
|targets line l lineNr s tag| |
|
2927 |
||
2928 |
"/ TODO: use HTMPParser to read all of them !! |
|
2929 |
||
2930 |
Tag autoload. |
|
2931 |
||
2932 |
targets := OrderedCollection new. |
|
2933 |
s := aFilePath asFilename readStream. |
|
2934 |
s notNil ifTrue:[ |
|
2935 |
s := LineNumberReadStream readingFrom:s. |
|
2936 |
[s atEnd] whileFalse:[ |
|
2937 |
lineNr := s lineNumber. |
|
2938 |
line := s nextLine. |
|
9918 | 2939 |
line := line withoutSeparators. |
2940 |
l := line asLowercase. |
|
9891 | 2941 |
|
2942 |
#( |
|
2943 |
'textarea' hideHTMLTextArea |
|
2944 |
'input' hideHTMLInput |
|
2945 |
'table' hideHTMLTable |
|
2946 |
'script' hideHTMLScript |
|
9918 | 2947 |
'form' hideHTMLForm |
11802 | 2948 |
'a' nil |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2949 |
'h1' hideHTMLHeaders |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2950 |
'h2' hideHTMLHeaders |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2951 |
'h3' hideHTMLHeaders |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2952 |
'h4' hideHTMLHeaders |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2953 |
'h5' hideHTMLHeaders |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2954 |
'h6' hideHTMLHeaders |
9891 | 2955 |
) pairWiseDo:[:nm :hideInstVarName| |
11802 | 2956 |
|type hideHolder idx tagText doc markup label text markupName markupType |
2957 |
isHeader| |
|
9891 | 2958 |
|
2959 |
type := hideHolder := nil. |
|
2960 |
||
2961 |
idx := l indexOfSubCollection:('<',nm). |
|
2962 |
idx ~~ 0 ifTrue:[ |
|
11802 | 2963 |
hideHolder := hideInstVarName isNil |
2964 |
ifTrue:[ false ] |
|
14382 | 2965 |
ifFalse:[ self flagNamed:hideInstVarName ]. |
9891 | 2966 |
|
9918 | 2967 |
tagText := line copyFrom:idx. |
9891 | 2968 |
doc := HTMLParser new parseText:tagText. |
2969 |
markup := doc markup. |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2970 |
markupName := markup name. |
11802 | 2971 |
markupType := "markup tag ?" markup type. |
2972 |
||
2973 |
isHeader := (#(h1 h2 h3 h4 h5 h6) includes:markupType). |
|
2974 |
isHeader ifTrue:[ |
|
2975 |
type := Tag::THeaderElement |
|
2976 |
] ifFalse: [ |
|
2977 |
markupType == #'form' ifTrue:[ |
|
2978 |
type := Tag::TFormElement |
|
2979 |
] ifFalse:[ |
|
2980 |
markupType == #'a' ifTrue:[ |
|
2981 |
type := Tag::TAnchorElement. |
|
2982 |
markupName := markup hrefString notEmptyOrNil ifTrue:['"',markup hrefString,'"'] ifFalse:[ markup name ] |
|
2983 |
] ifFalse:[ |
|
2984 |
type := Tag::TElement |
|
2985 |
] |
|
2986 |
]. |
|
2987 |
]. |
|
2988 |
||
9891 | 2989 |
markup id notEmptyOrNil ifTrue:[ |
2990 |
label := nm , ' (',markup id,')' |
|
2991 |
] ifFalse:[ |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2992 |
markupName notEmptyOrNil ifTrue:[ |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2993 |
label := nm , ' (',markupName,')' |
9891 | 2994 |
] ifFalse:[ |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2995 |
(markupType == #input and:[ markup valueString notEmptyOrNil ]) ifTrue:[ |
11802 | 2996 |
label := nm , ' ("',markup valueString,'")' |
9918 | 2997 |
] ifFalse:[ |
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
2998 |
(markupType == #script and:[ markup src notEmptyOrNil ]) ifTrue:[ |
9918 | 2999 |
label := nm , ' ("',markup src,'")' |
3000 |
] ifFalse:[ |
|
11802 | 3001 |
( isHeader |
3002 |
and:[text := self plainTextBetweenHTMLElement:markup andElementWithTag:('/',markupType). |
|
3003 |
text notEmpty] |
|
3004 |
) ifTrue:[ |
|
11801
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3005 |
label := '"',text,'" (',nm,')' |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3006 |
] ifFalse:[ |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3007 |
label := nm |
18a705623785
better html tags (h-elements)
Claus Gittinger <cg@exept.de>
parents:
11771
diff
changeset
|
3008 |
] |
9918 | 3009 |
] |
3010 |
] |
|
9891 | 3011 |
]. |
3012 |
]. |
|
3013 |
||
3014 |
hideHolder value ~~ true ifTrue:[ |
|
3015 |
tag := type |
|
3016 |
label:label |
|
3017 |
pattern:nil |
|
3018 |
type:nil |
|
3019 |
lineNumber:lineNr. |
|
3020 |
targets add:tag. |
|
3021 |
] |
|
3022 |
]. |
|
3023 |
]. |
|
3024 |
]. |
|
3025 |
s close |
|
3026 |
]. |
|
3027 |
^ targets |
|
3028 |
||
3029 |
"Created: / 20-04-2011 / 18:59:29 / cg" |
|
11802 | 3030 |
"Modified: / 12-09-2012 / 17:54:07 / cg" |
9891 | 3031 |
! |
3032 |
||
3033 |
javaScriptTagsInFile:aFilePath |
|
3034 |
"javaScript tags: |
|
3035 |
naive, q&d scan for lines matching: |
|
3036 |
(function foo |
|
3037 |
" |
|
3038 |
||
3039 |
|targets line l lineNr nm s| |
|
3040 |
||
3041 |
Tag autoload. |
|
3042 |
||
3043 |
targets := OrderedCollection new. |
|
3044 |
s := aFilePath asFilename readStream. |
|
3045 |
s notNil ifTrue:[ |
|
3046 |
s := LineNumberReadStream readingFrom:s. |
|
3047 |
[s atEnd] whileFalse:[ |
|
3048 |
lineNr := s lineNumber. |
|
3049 |
line := s nextLine. |
|
3050 |
l := line withoutSeparators. |
|
3051 |
||
14359 | 3052 |
(l = 'function') ifTrue:[ |
3053 |
l := l , ' ' , (s nextLine withoutSeparators). |
|
3054 |
]. |
|
9891 | 3055 |
(l startsWith:'function ') ifTrue:[ |
3056 |
(showOnly isNil or:[showOnly == #functions]) ifTrue:[ |
|
14346 | 3057 |
self hideFunctions ~~ true ifTrue:[ |
9891 | 3058 |
nm := l copyFrom:('function ' size + 1). |
3059 |
nm := nm copyTo:(nm |
|
3060 |
findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] |
|
3061 |
ifNone:nm size+1)-1. |
|
3062 |
targets add:(Tag::TFunction |
|
3063 |
label:nm |
|
3064 |
pattern:nil |
|
3065 |
type:nil |
|
3066 |
lineNumber:lineNr). |
|
3067 |
] |
|
3068 |
] |
|
3069 |
] ifFalse:[ |
|
3070 |
(l startsWith:'var ') ifTrue:[ |
|
3071 |
(showOnly isNil or:[showOnly == #variables]) ifTrue:[ |
|
14346 | 3072 |
self hideVariables ~~ true ifTrue:[ |
9891 | 3073 |
nm := l copyFrom:('var ' 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::TVariable |
|
3078 |
label:nm |
|
3079 |
pattern:nil |
|
3080 |
type:nil |
|
3081 |
lineNumber:lineNr). |
|
3082 |
]. |
|
3083 |
]. |
|
3084 |
]. |
|
3085 |
] |
|
3086 |
]. |
|
3087 |
s close |
|
3088 |
]. |
|
3089 |
^ targets |
|
3090 |
||
3091 |
"Created: / 28-06-2010 / 12:44:25 / cg" |
|
9921 | 3092 |
"Modified: / 08-05-2011 / 10:39:55 / cg" |
9891 | 3093 |
! |
3094 |
||
3095 |
lispTagFromLine:line lineNr:lineNr |
|
14344 | 3096 |
"lisp/scheme tags: |
9891 | 3097 |
naive, q&d scan for lines starting with (not syntax-aware): |
3098 |
(define ... |
|
3099 |
(defun ... |
|
3100 |
(defvar ... |
|
3101 |
(defmacro ... |
|
3102 |
(defclass ... |
|
3103 |
(defmethod ... |
|
3104 |
(defpackage ... |
|
3105 |
(eval-when ... |
|
3106 |
(define- ... |
|
3107 |
(def* ... |
|
3108 |
(set ... |
|
3109 |
(constant ... |
|
3110 |
(defconstant ... |
|
9921 | 3111 |
;;; more documentation |
9891 | 3112 |
" |
3113 |
||
14352 | 3114 |
|l nm words def inParens rest| |
9891 | 3115 |
|
3116 |
l := line withoutSeparators. |
|
3117 |
||
9921 | 3118 |
(l startsWith:'(') ifFalse:[ |
3119 |
(showOnly notNil and:[showOnly ~~ #documentation]) ifTrue:[^ nil]. |
|
14346 | 3120 |
self hideDocumentation == true ifTrue:[ ^ nil ]. |
9921 | 3121 |
|
3122 |
(l startsWith:';;;') ifFalse:[^ nil]. |
|
3123 |
rest := (l copyFrom:4) withoutSeparators. |
|
3124 |
rest isEmpty ifTrue:[^ nil]. |
|
14352 | 3125 |
(rest conform:[:ch | ch = $;]) ifTrue:[^ nil]. |
9921 | 3126 |
^ Tag::TDocumentation |
3127 |
label:(rest colorizeAllWith:(Color blue "grey")) |
|
3128 |
pattern:nil |
|
3129 |
type:nil |
|
3130 |
lineNumber:lineNr. |
|
3131 |
]. |
|
9891 | 3132 |
|
3133 |
words := (l copyFrom:2) asCollectionOfWords. |
|
3134 |
words size >= 2 ifFalse:[^ nil]. |
|
3135 |
||
3136 |
def := words first. |
|
3137 |
nm := words second. |
|
3138 |
(inParens := nm startsWith:'(') ifTrue:[ |
|
3139 |
nm := nm copyFrom:2. |
|
3140 |
] ifFalse:[ |
|
3141 |
nm := nm upTo:$(. "/ in case it is (define foo() - without space after name |
|
3142 |
(inParens := nm startsWith:'(') ifTrue:[ |
|
3143 |
nm := nm copyFrom:2. |
|
3144 |
]. |
|
3145 |
]. |
|
3146 |
(nm endsWith:')') ifTrue:[ |
|
12714
c972f423e7a9
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12344
diff
changeset
|
3147 |
nm := nm copyButLast:1 |
9891 | 3148 |
]. |
3149 |
||
3150 |
def = 'defun' ifTrue:[ |
|
3151 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3152 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
9891 | 3153 |
^ Tag::TFunction |
3154 |
label:nm |
|
3155 |
pattern:nil |
|
3156 |
type:nil |
|
3157 |
lineNumber:lineNr. |
|
3158 |
]. |
|
3159 |
def = 'define' ifTrue:[ "/ scheme |
|
3160 |
inParens ifTrue:[ |
|
3161 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3162 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
9891 | 3163 |
^ Tag::TFunction |
3164 |
label:nm |
|
3165 |
pattern:nil |
|
3166 |
type:nil |
|
3167 |
lineNumber:lineNr. |
|
3168 |
] ifFalse:[ |
|
14344 | 3169 |
"/ check for (define name (lambda ... |
3170 |
"/ and (define name (macro ... |
|
3171 |
(words size > 2 |
|
3172 |
and:[ words third startsWith:'(' ]) ifTrue:[ |
|
3173 |
(words third = '(' and:[words size > 3]) ifTrue:[ |
|
3174 |
def := words fourth |
|
3175 |
] ifFalse:[ |
|
3176 |
def := words third copyFrom:2. |
|
3177 |
]. |
|
3178 |
def = 'lambda' ifTrue:[ |
|
3179 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3180 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
14344 | 3181 |
^ Tag::TFunction |
3182 |
label:nm |
|
3183 |
pattern:nil |
|
3184 |
type:nil |
|
3185 |
lineNumber:lineNr. |
|
3186 |
]. |
|
3187 |
def = 'macro' ifTrue:[ |
|
3188 |
(showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil]. |
|
14346 | 3189 |
self hideLispMacros == true ifTrue:[ ^ nil ]. |
14344 | 3190 |
^ Tag::TLispMacro |
3191 |
label:nm |
|
3192 |
pattern:nil |
|
3193 |
type:nil |
|
3194 |
lineNumber:lineNr. |
|
3195 |
]. |
|
3196 |
]. |
|
9891 | 3197 |
(showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil]. |
14346 | 3198 |
self hideVariables == true ifTrue:[ ^ nil ]. |
9891 | 3199 |
^ Tag::TVariable |
3200 |
label:nm |
|
3201 |
pattern:nil |
|
3202 |
type:nil |
|
3203 |
lineNumber:lineNr. |
|
3204 |
]. |
|
3205 |
^ nil |
|
3206 |
]. |
|
3207 |
||
3208 |
def = 'defvar' ifTrue:[ |
|
3209 |
(showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil]. |
|
14346 | 3210 |
self hideVariables == true ifTrue:[ ^ nil ]. |
9891 | 3211 |
^ Tag::TVariable |
3212 |
label:nm |
|
3213 |
pattern:nil |
|
3214 |
type:nil |
|
3215 |
lineNumber:lineNr. |
|
3216 |
]. |
|
3217 |
def = 'set' ifTrue:[ |
|
14346 | 3218 |
self hideVariables == true ifTrue:[ ^ nil ]. |
9891 | 3219 |
^ Tag::TVariable |
3220 |
label:nm |
|
3221 |
pattern:nil |
|
3222 |
type:nil |
|
3223 |
lineNumber:lineNr. |
|
3224 |
]. |
|
3225 |
(def = 'defconstant' or:[def = 'constant']) ifTrue:[ |
|
3226 |
(showOnly notNil and:[showOnly ~~ #constants]) ifTrue:[^ nil]. |
|
14346 | 3227 |
self hideLispConstants == true ifTrue:[ ^ nil ]. |
9891 | 3228 |
^ Tag::TLispConstant |
3229 |
label:nm |
|
3230 |
pattern:nil |
|
3231 |
type:nil |
|
3232 |
lineNumber:lineNr. |
|
3233 |
]. |
|
3234 |
(def = 'mac' or:[def = 'defmacro' or:[def = 'define-macro']]) ifTrue:[ |
|
3235 |
(showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil]. |
|
14346 | 3236 |
self hideLispMacros == true ifTrue:[ ^ nil ]. |
9891 | 3237 |
^ Tag::TLispMacro |
3238 |
label:nm |
|
3239 |
pattern:nil |
|
3240 |
type:nil |
|
3241 |
lineNumber:lineNr. |
|
3242 |
]. |
|
3243 |
(def = 'defclass' or:[def = 'define-class']) ifTrue:[ |
|
3244 |
(showOnly notNil and:[showOnly ~~ #classes]) ifTrue:[^ nil]. |
|
14346 | 3245 |
self hideClasses == true ifTrue:[ ^ nil ]. |
9891 | 3246 |
^ Tag::TClass |
3247 |
label:nm |
|
3248 |
pattern:nil |
|
3249 |
type:nil |
|
3250 |
lineNumber:lineNr. |
|
3251 |
]. |
|
3252 |
(def = 'defmethod' or:[def = 'define-method' or:[def = 'define-generic']]) ifTrue:[ |
|
3253 |
(showOnly notNil and:[showOnly ~~ #methods]) ifTrue:[^ nil]. |
|
14346 | 3254 |
self hideLispMethods == true ifTrue:[ ^ nil ]. |
9891 | 3255 |
^ Tag::TMethod |
3256 |
label:nm |
|
3257 |
pattern:nil |
|
3258 |
type:nil |
|
3259 |
lineNumber:lineNr. |
|
3260 |
]. |
|
3261 |
(def = 'defpackage') ifTrue:[ |
|
14346 | 3262 |
self hideLispMethods == true ifTrue:[ ^ nil ]. |
9891 | 3263 |
^ Tag::TPackage |
3264 |
label:nm |
|
3265 |
pattern:nil |
|
3266 |
type:nil |
|
3267 |
lineNumber:lineNr. |
|
3268 |
]. |
|
3269 |
def = 'eval-when' ifTrue:[ |
|
14346 | 3270 |
self hideLispEvaluations == true ifTrue:[ ^ nil ]. |
9891 | 3271 |
^ Tag::TLispEval |
14352 | 3272 |
label:nm |
9891 | 3273 |
pattern:nil |
3274 |
type:nil |
|
3275 |
lineNumber:lineNr. |
|
3276 |
]. |
|
3277 |
def = 'defstruct' ifTrue:[ |
|
14346 | 3278 |
self hideStructures == true ifTrue:[ ^ nil ]. |
9891 | 3279 |
^ Tag::TStruct |
3280 |
label:nm |
|
3281 |
pattern:nil |
|
3282 |
type:nil |
|
3283 |
lineNumber:lineNr. |
|
3284 |
]. |
|
3285 |
(def startsWith:'def') ifTrue:[ |
|
3286 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3287 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
9891 | 3288 |
^ Tag::TFunction |
3289 |
label:nm |
|
3290 |
pattern:nil |
|
3291 |
type:nil |
|
3292 |
lineNumber:lineNr. |
|
3293 |
]. |
|
3294 |
^ nil |
|
3295 |
||
9921 | 3296 |
"Modified: / 08-05-2011 / 10:57:03 / cg" |
9891 | 3297 |
! |
3298 |
||
3299 |
lispTagsInFile:aFilePath |
|
3300 |
"lisp tags: |
|
3301 |
naive, q&d scan for lines starting with (not syntax-aware): |
|
3302 |
(define ... |
|
3303 |
(defun ... |
|
3304 |
(defvar ... |
|
3305 |
(defmacro ... |
|
3306 |
(defclass ... |
|
3307 |
(defmethod ... |
|
3308 |
(defpackage ... |
|
3309 |
(eval-when ... |
|
3310 |
(define- ... |
|
3311 |
(def* ... |
|
3312 |
(set ... |
|
3313 |
(constant ... |
|
3314 |
(defconstant ... |
|
9921 | 3315 |
;;; moretext documentation |
9891 | 3316 |
" |
3317 |
||
14345 | 3318 |
^ self |
3319 |
linewiseNaiveTagsInFile:aFilePath |
|
3320 |
using:[:line :lineNr | |
|
3321 |
self lispTagFromLine:line lineNr:lineNr |
|
3322 |
] |
|
9891 | 3323 |
|
9921 | 3324 |
"Modified: / 08-05-2011 / 10:12:29 / cg" |
9891 | 3325 |
! |
3326 |
||
14345 | 3327 |
luaTagFromLine:line lineNr:lineNr |
3328 |
"lua tags: |
|
3329 |
naive, q&d scan for lines starting with (not syntax-aware): |
|
3330 |
local function ... |
|
3331 |
" |
|
3332 |
||
3333 |
|l nm words def isLocal| |
|
3334 |
||
3335 |
l := line withoutSeparators. |
|
3336 |
||
3337 |
(l startsWith:'--') ifTrue:[^ nil]. "/ comment |
|
3338 |
||
3339 |
words := l splitByAny:(' (),',Character tab). |
|
3340 |
words size >= 2 ifFalse:[^ nil]. |
|
3341 |
||
3342 |
(isLocal := words first = 'local') ifTrue:[ words := words copyFrom:2 ]. |
|
3343 |
words size <= 2 ifTrue:[ ^ nil ]. |
|
3344 |
def := words first. |
|
3345 |
nm := words second. |
|
3346 |
||
3347 |
def = 'function' ifTrue:[ |
|
3348 |
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil]. |
|
14346 | 3349 |
self hideFunctions == true ifTrue:[ ^ nil ]. |
14345 | 3350 |
^ Tag::TFunction |
3351 |
label:nm |
|
3352 |
pattern:nil |
|
3353 |
type:nil |
|
3354 |
lineNumber:lineNr. |
|
3355 |
]. |
|
3356 |
||
3357 |
isLocal ifTrue:[ |
|
3358 |
(words includes:'=') ifTrue:[ |
|
3359 |
words := words copyTo:(words indexOf:'=')-1 |
|
3360 |
]. |
|
3361 |
^ words |
|
3362 |
collect:[:eachVar | |
|
3363 |
Tag::TVariable |
|
3364 |
label:eachVar |
|
3365 |
pattern:nil |
|
3366 |
type:nil |
|
3367 |
lineNumber:lineNr. |
|
3368 |
] |
|
3369 |
as:Array. |
|
3370 |
]. |
|
3371 |
||
3372 |
^ nil |
|
3373 |
! |
|
3374 |
||
3375 |
luaTagsInFile:aFilePath |
|
3376 |
"lua tags: |
|
3377 |
naive, q&d scan for lines starting with (not syntax-aware): |
|
3378 |
local function ... |
|
3379 |
" |
|
3380 |
||
3381 |
^ self |
|
3382 |
linewiseNaiveTagsInFile:aFilePath |
|
3383 |
using:[:line :lineNr | |
|
3384 |
self luaTagFromLine:line lineNr:lineNr |
|
3385 |
] |
|
3386 |
! |
|
3387 |
||
3388 |
ozTagFromLine:line lineNr:lineNr |
|
3389 |
"oz tags: |
|
3390 |
naive, q&d scan for lines starting with: |
|
3391 |
fun { name ... |
|
3392 |
" |
|
3393 |
||
3394 |
|l nm lineStream kwLen skipBrace type hideHolder| |
|
3395 |
||
3396 |
l := line withoutSeparators. |
|
3397 |
||
3398 |
kwLen := nil. |
|
3399 |
skipBrace := false. |
|
3400 |
||
3401 |
(l startsWith:'class') ifTrue:[ |
|
3402 |
kwLen := 5. |
|
3403 |
type := Tag::TClass. |
|
14346 | 3404 |
hideHolder := self hideOzClasses. |
14345 | 3405 |
]. |
3406 |
(l startsWith:'meth') ifTrue:[ |
|
3407 |
kwLen := 4. |
|
3408 |
type := Tag::TMethod. |
|
14346 | 3409 |
hideHolder := self hideOzMethods. |
14345 | 3410 |
]. |
3411 |
(l startsWith:'fun') ifTrue:[ |
|
3412 |
kwLen := 3. |
|
3413 |
skipBrace := true. |
|
3414 |
type := Tag::TFunction. |
|
14346 | 3415 |
hideHolder := self hideOzFunctions. |
14345 | 3416 |
]. |
3417 |
(l startsWith:'proc') ifTrue:[ |
|
3418 |
kwLen := 4. |
|
3419 |
skipBrace := true. |
|
3420 |
type := Tag::TFunction. |
|
14346 | 3421 |
hideHolder := self hideOzFunctions. |
14345 | 3422 |
]. |
3423 |
hideHolder value ~~ true ifTrue:[ |
|
3424 |
kwLen notNil ifTrue:[ |
|
3425 |
lineStream := l readStream. |
|
3426 |
lineStream skip:kwLen; skipSeparators. |
|
3427 |
||
3428 |
(skipBrace not or:[lineStream peek = ${ ]) ifTrue:[ |
|
3429 |
skipBrace ifTrue:[lineStream skip:1; skipSeparators]. |
|
3430 |
nm := lineStream upToMatching:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not]. |
|
3431 |
(nm notEmpty and:[nm first isLetter or:[nm first = $_]]) ifTrue:[ |
|
3432 |
^ type |
|
3433 |
label:nm |
|
3434 |
pattern:nil |
|
3435 |
type:nil |
|
3436 |
lineNumber:lineNr. |
|
3437 |
] |
|
3438 |
] |
|
3439 |
]. |
|
3440 |
]. |
|
3441 |
^ nil |
|
3442 |
! |
|
3443 |
||
9891 | 3444 |
ozTagsInFile:aFilePath |
3445 |
"oz tags: |
|
3446 |
naive, q&d scan for lines starting with: |
|
3447 |
fun { name ... |
|
3448 |
" |
|
3449 |
||
14345 | 3450 |
^ self |
3451 |
linewiseNaiveTagsInFile:aFilePath |
|
3452 |
using:[:line :lineNr | |
|
3453 |
self ozTagFromLine:line lineNr:lineNr |
|
3454 |
] |
|
3455 |
! |
|
3456 |
||
3457 |
phpTagFromLine:line lineNr:lineNr |
|
3458 |
"php tags: |
|
3459 |
naive, q&d scan for lines starting with: |
|
3460 |
var ... |
|
3461 |
class ... |
|
3462 |
function ... |
|
3463 |
" |
|
3464 |
||
3465 |
|l nm lineStream| |
|
3466 |
||
3467 |
l := line withoutSeparators. |
|
3468 |
||
3469 |
(l startsWith:'var ') ifTrue:[ |
|
3470 |
lineStream := (l copyFrom:4) readStream. |
|
3471 |
lineStream skipSeparators. |
|
3472 |
lineStream peek == $$ ifTrue:[ |
|
3473 |
lineStream next. |
|
3474 |
nm := lineStream |
|
3475 |
nextMatching:[:c | c isLetter] |
|
3476 |
thenMatching:[:c | c isLetterOrDigit or:[c == $_]]. |
|
3477 |
^ (Tag::TVariable |
|
3478 |
label:nm |
|
3479 |
pattern:nil |
|
3480 |
type:nil |
|
3481 |
lineNumber:lineNr). |
|
3482 |
] |
|
3483 |
] ifFalse:[ |
|
3484 |
(l startsWith:'class ') ifTrue:[ |
|
3485 |
lineStream := (l copyFrom:6) readStream. |
|
3486 |
lineStream skipSeparators. |
|
3487 |
nm := lineStream |
|
3488 |
nextMatching:[:c | c isLetter] |
|
3489 |
thenMatching:[:c | c isLetterOrDigit or:[c == $_]]. |
|
3490 |
^ (Tag::TClass |
|
3491 |
label:nm |
|
3492 |
pattern:nil |
|
3493 |
type:nil |
|
3494 |
lineNumber:lineNr). |
|
3495 |
] ifFalse:[ |
|
3496 |
(l startsWith:'function ') ifTrue:[ |
|
3497 |
lineStream := (l copyFrom:9) readStream. |
|
3498 |
lineStream skipSeparators. |
|
3499 |
nm := lineStream |
|
3500 |
nextMatching:[:c | c isLetter] |
|
3501 |
thenMatching:[:c | c isLetterOrDigit or:[c == $_]]. |
|
3502 |
^ (Tag::TFunction |
|
3503 |
label:nm |
|
3504 |
pattern:nil |
|
3505 |
type:nil |
|
3506 |
lineNumber:lineNr). |
|
9891 | 3507 |
]. |
3508 |
]. |
|
3509 |
]. |
|
14345 | 3510 |
^ nil |
9891 | 3511 |
! |
3512 |
||
3513 |
phpTagsInFile:aFilePath |
|
3514 |
"php tags: |
|
3515 |
naive, q&d scan for lines starting with: |
|
3516 |
var ... |
|
3517 |
class ... |
|
3518 |
function ... |
|
3519 |
" |
|
3520 |
||
14345 | 3521 |
^ self |
3522 |
linewiseNaiveTagsInFile:aFilePath |
|
3523 |
using:[:line :lineNr | |
|
3524 |
self phpTagFromLine:line lineNr:lineNr |
|
3525 |
] |
|
3526 |
! |
|
3527 |
||
3528 |
prologTagFromLine:line lineNr:lineNr |
|
3529 |
"prolog tags: |
|
3530 |
naive, q&d scan for lines matching: |
|
3531 |
<anything> :- |
|
3532 |
" |
|
3533 |
||
3534 |
|l nm| |
|
3535 |
||
3536 |
l := line withoutSeparators. |
|
3537 |
||
3538 |
(l includesString:':-') ifTrue:[ |
|
3539 |
(l startsWith:':-') ifFalse:[ |
|
3540 |
nm := l copyTo:(l indexOfSubCollection:':-'). |
|
3541 |
^ (Tag::TPrologClause |
|
3542 |
label:nm |
|
3543 |
pattern:nil |
|
3544 |
type:nil |
|
3545 |
lineNumber:lineNr). |
|
3546 |
] |
|
9891 | 3547 |
]. |
14345 | 3548 |
^ nil |
9891 | 3549 |
! |
3550 |
||
3551 |
prologTagsInFile:aFilePath |
|
3552 |
"prolog tags: |
|
3553 |
naive, q&d scan for lines matching: |
|
3554 |
<anything> :- |
|
3555 |
" |
|
3556 |
||
14345 | 3557 |
^ self |
3558 |
linewiseNaiveTagsInFile:aFilePath |
|
3559 |
using:[:line :lineNr | |
|
3560 |
self prologTagFromLine:line lineNr:lineNr |
|
3561 |
] |
|
9891 | 3562 |
! |
3563 |
||
3564 |
pythonTagsInFile:aFilePath |
|
3565 |
"python tags: |
|
3566 |
naive, q&d scan for lines matching |
|
3567 |
class <anything> : |
|
3568 |
or |
|
3569 |
def <anything> : |
|
3570 |
" |
|
3571 |
||
3572 |
|targets line l lineNr nm s inClass indent classIndent| |
|
3573 |
||
3574 |
Tag autoload. |
|
3575 |
||
3576 |
inClass := nil. |
|
3577 |
targets := OrderedCollection new. |
|
3578 |
s := aFilePath asFilename readStream. |
|
3579 |
inClass := OrderedCollection new. |
|
3580 |
classIndent := 0. |
|
3581 |
||
3582 |
s notNil ifTrue:[ |
|
3583 |
s := LineNumberReadStream readingFrom:s. |
|
3584 |
[s atEnd] whileFalse:[ |
|
3585 |
lineNr := s lineNumber. |
|
3586 |
line := s nextLine. |
|
3587 |
l := line withoutSeparators. |
|
3588 |
l size > 0 ifTrue:[ |
|
3589 |
||
3590 |
line := line withTabsExpanded:8. |
|
3591 |
indent := line findFirst:[:c | c ~~ Character space]. |
|
3592 |
indent := indent // 8. |
|
3593 |
indent < classIndent ifTrue:[ |
|
3594 |
inClass removeFirstIfAbsent:nil. |
|
3595 |
classIndent := classIndent - 1. |
|
3596 |
]. |
|
3597 |
||
3598 |
(l startsWith:'class ') ifTrue:[ |
|
3599 |
(l endsWith:':') ifTrue:[ |
|
3600 |
nm := l copyFrom:7 to:(l size - 1). |
|
3601 |
nm := nm withoutSeparators. |
|
3602 |
(showOnly ~~ #pythonFunctions |
|
3603 |
and:[showOnly ~~ #pythonMethods]) ifTrue:[ |
|
14346 | 3604 |
self hidePythonClasses ~~ true ifTrue:[ |
9891 | 3605 |
targets add:(Tag::TClass |
3606 |
label:nm |
|
3607 |
pattern:nil |
|
3608 |
type:nil |
|
3609 |
lineNumber:lineNr). |
|
3610 |
]. |
|
3611 |
]. |
|
3612 |
nm := nm upTo:$(. |
|
3613 |
inClass addFirst:nm. |
|
3614 |
classIndent := indent + 1. |
|
3615 |
] |
|
3616 |
] ifFalse:[ |
|
3617 |
(l startsWith:'def ') ifTrue:[ |
|
3618 |
(l endsWith:':') ifTrue:[ |
|
3619 |
nm := l copyFrom:5 to:(l size - 1). |
|
3620 |
nm := nm withoutSeparators. |
|
3621 |
||
3622 |
inClass size > 0 ifTrue:[ |
|
3623 |
(showOnly ~~ #pythonFunctions |
|
3624 |
and:[showOnly ~~ #pythonClasses]) ifTrue:[ |
|
14346 | 3625 |
self hidePythonMethods ~~ true ifTrue:[ |
9891 | 3626 |
nm := inClass first , '.' , nm. |
3627 |
targets add:(Tag::TMethod |
|
3628 |
label:nm |
|
3629 |
pattern:nil |
|
3630 |
type:nil |
|
3631 |
lineNumber:lineNr). |
|
3632 |
] |
|
3633 |
] |
|
3634 |
] ifFalse:[ |
|
3635 |
(showOnly ~~ #pythonClasses |
|
3636 |
and:[showOnly ~~ #pythonMethods]) ifTrue:[ |
|
14346 | 3637 |
self hidePythonFunctions ~~ true ifTrue:[ |
9891 | 3638 |
targets add:(Tag::TFunction |
3639 |
label:nm |
|
3640 |
pattern:nil |
|
3641 |
type:nil |
|
3642 |
lineNumber:lineNr). |
|
3643 |
] |
|
3644 |
] |
|
3645 |
] |
|
3646 |
] |
|
3647 |
] |
|
3648 |
] |
|
3649 |
] |
|
3650 |
]. |
|
3651 |
s close |
|
3652 |
]. |
|
3653 |
^ targets |
|
9921 | 3654 |
|
3655 |
"Modified: / 08-05-2011 / 10:39:10 / cg" |
|
9891 | 3656 |
! |
3657 |
||
14345 | 3658 |
rubyTagFromLine:line lineNr:lineNr |
3659 |
"ruby tags: |
|
3660 |
naive, q&d scan for lines matching: |
|
3661 |
def any |
|
3662 |
" |
|
3663 |
||
3664 |
|l nm| |
|
3665 |
||
3666 |
l := line withoutSeparators. |
|
3667 |
||
3668 |
(l startsWith:'def ') ifTrue:[ |
|
3669 |
nm := l copyFrom:5. |
|
3670 |
^ (Tag::TFunction |
|
3671 |
label:nm |
|
3672 |
pattern:nil |
|
3673 |
type:nil |
|
3674 |
lineNumber:lineNr). |
|
3675 |
] ifFalse:[ |
|
3676 |
(l startsWith:'class ') ifTrue:[ |
|
14346 | 3677 |
self hideClasses == true ifFalse:[ |
14345 | 3678 |
nm := l copyFrom:6. |
3679 |
^ (Tag::TClass |
|
3680 |
label:nm |
|
3681 |
pattern:nil |
|
3682 |
type:nil |
|
3683 |
lineNumber:lineNr). |
|
3684 |
] |
|
3685 |
]. |
|
3686 |
]. |
|
3687 |
^ nil |
|
3688 |
||
3689 |
"Modified: / 08-05-2011 / 10:38:44 / cg" |
|
3690 |
! |
|
3691 |
||
9891 | 3692 |
rubyTagsInFile:aFilePath |
3693 |
"ruby tags: |
|
3694 |
naive, q&d scan for lines matching: |
|
3695 |
def any |
|
3696 |
" |
|
3697 |
||
14345 | 3698 |
^ self |
3699 |
linewiseNaiveTagsInFile:aFilePath |
|
3700 |
using:[:line :lineNr | |
|
3701 |
self rubyTagFromLine:line lineNr:lineNr |
|
3702 |
] |
|
9921 | 3703 |
|
3704 |
"Modified: / 08-05-2011 / 10:38:44 / cg" |
|
9891 | 3705 |
! |
3706 |
||
11050 | 3707 |
stTagsInFile:aFilePath in:aTempDirectory |
9891 | 3708 |
"smalltalk tags: |
11050 | 3709 |
not so naive: generate a changeList from the contents and convert it into a tag-list |
9891 | 3710 |
" |
3711 |
||
11050 | 3712 |
|targets s anyPrimitiveDefinitions shellCmd cTagsList| |
9891 | 3713 |
|
3714 |
Tag autoload. |
|
3715 |
||
11050 | 3716 |
anyPrimitiveDefinitions := false. |
9891 | 3717 |
targets := OrderedCollection new. |
3718 |
s := aFilePath asFilename readStream. |
|
3719 |
s notNil ifTrue:[ |
|
3720 |
s := LineNumberReadStream readingFrom:s. |
|
3721 |
s skipSeparators. |
|
3722 |
||
3723 |
"/ new interface: block-arg to #changesFromStream:do: gets 3 args |
|
3724 |
[ |
|
3725 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
3726 |
Dialog warn:('Error while processing changes - skipping: ' , aFilePath asFilename pathName). |
|
3727 |
] do:[ |
|
3728 |
ChangeSet changesFromStream:s do:[:aChange :lNr :pos| |
|
3729 |
aChange isClassDefinitionChange ifTrue:[ |
|
14346 | 3730 |
self hideClasses == true ifFalse:[ |
9921 | 3731 |
targets add:(Tag::TClass |
9891 | 3732 |
label:(aChange className) |
3733 |
pattern:('/subclass:') |
|
3734 |
type:nil |
|
3735 |
lineNumber:lNr). |
|
9921 | 3736 |
] |
9891 | 3737 |
] ifFalse:[ |
3738 |
aChange isMethodChange ifTrue:[ |
|
14346 | 3739 |
self hideMethods == true ifFalse:[ |
13450 | 3740 |
targets add:((Tag::TMethod |
9891 | 3741 |
label:(aChange selector) |
3742 |
pattern:('/^' , aChange selector) |
|
3743 |
type:nil |
|
13450 | 3744 |
lineNumber:lNr) |
3745 |
isMeta:(aChange className endsWith:' class')). |
|
9921 | 3746 |
] |
11050 | 3747 |
] ifFalse:[ |
3748 |
aChange isPrimitiveChange ifTrue:[ |
|
3749 |
targets add:(Tag::TMacro |
|
3750 |
label:(aChange isPrimitiveDefinitionsChange |
|
11051 | 3751 |
ifTrue:['<< primitive definitions >>'] |
11050 | 3752 |
ifFalse:[ (aChange isPrimitiveFunctionsChange |
11051 | 3753 |
ifTrue:['<< primitive functions >>'] |
3754 |
ifFalse:['<< primitive variables >>'])]) |
|
11050 | 3755 |
pattern:('/^' , aChange source asStringCollection first) |
3756 |
type:nil |
|
3757 |
lineNumber:lNr). |
|
3758 |
anyPrimitiveDefinitions := true |
|
3759 |
] |
|
9891 | 3760 |
] |
3761 |
]. |
|
3762 |
] |
|
3763 |
] |
|
3764 |
] ensure:[ |
|
3765 |
s close. |
|
3766 |
]. |
|
3767 |
]. |
|
11050 | 3768 |
|
3769 |
anyPrimitiveDefinitions ifTrue:[ |
|
3770 |
"/ also invoke ctags on the file, merge those tags. |
|
3771 |
"/ sorry: not perfect, because ctags seems to get confused by the extra %{ %} nesting. |
|
3772 |
shellCmd := (self shellCommandTemplateFor:(aFilePath asFilename withSuffix:'c') pathName) |
|
3773 |
bindWith:aFilePath. |
|
3774 |
shellCmd notNil ifTrue:[ |
|
3775 |
cTagsList := self getTagListFromFile:aFilePath asFilename usingCommand:shellCmd mode:#c in:aTempDirectory. |
|
3776 |
cTagsList notEmptyOrNil ifTrue:[ |
|
3777 |
^ cTagsList , targets |
|
3778 |
]. |
|
3779 |
]. |
|
3780 |
]. |
|
3781 |
||
9891 | 3782 |
^ targets |
9921 | 3783 |
|
11050 | 3784 |
"Created: / 05-01-2012 / 10:56:26 / cg" |
9891 | 3785 |
! |
3786 |
||
14345 | 3787 |
tclTagFromLine:line lineNr:lineNr |
3788 |
"tcl tags: |
|
3789 |
naive, q&d scan for lines matching: |
|
3790 |
proc any |
|
3791 |
" |
|
3792 |
||
3793 |
|l nm words| |
|
3794 |
||
3795 |
l := line withoutSeparators. |
|
3796 |
||
3797 |
(l startsWith:'proc ') ifTrue:[ |
|
3798 |
nm := l withoutPrefix:'proc '. |
|
3799 |
^(Tag::TFunction |
|
3800 |
label:nm |
|
3801 |
pattern:nil |
|
3802 |
type:nil |
|
3803 |
lineNumber:lineNr). |
|
3804 |
] ifFalse:[ (l startsWith:'tixWidgetClass ') ifTrue:[ |
|
3805 |
nm := l copyFrom:'tixWidgetClass ' size + 1. |
|
3806 |
(nm endsWith:'{') ifTrue:[ |
|
3807 |
nm := (nm copyButLast:1) withoutSeparators. |
|
3808 |
]. |
|
3809 |
^(Tag::TClass |
|
3810 |
label:nm |
|
3811 |
pattern:nil |
|
3812 |
type:nil |
|
3813 |
lineNumber:lineNr). |
|
3814 |
] ifFalse:[ (l startsWith:'set ') ifTrue:[ |
|
14346 | 3815 |
self hideVariables ~~ true ifTrue:[ |
14345 | 3816 |
words := l asCollectionOfWords. |
3817 |
words size >= 2 ifTrue:[ |
|
3818 |
nm := words second. |
|
3819 |
^(Tag::TVariable |
|
3820 |
label:nm |
|
3821 |
pattern:nil |
|
3822 |
type:nil |
|
3823 |
lineNumber:lineNr). |
|
3824 |
] |
|
3825 |
]]]]. |
|
3826 |
^ nil |
|
3827 |
! |
|
3828 |
||
9891 | 3829 |
tclTagsInFile:aFilePath |
3830 |
"tcl tags: |
|
3831 |
naive, q&d scan for lines matching: |
|
3832 |
proc any |
|
3833 |
" |
|
3834 |
||
14345 | 3835 |
^ self |
3836 |
linewiseNaiveTagsInFile:aFilePath |
|
3837 |
using:[:line :lineNr | |
|
3838 |
self tclTagFromLine:line lineNr:lineNr |
|
3839 |
] |
|
9891 | 3840 |
! |
3841 |
||
3842 |
yaccTagsInFile:aFilePath |
|
3843 |
"yacc tags: |
|
3844 |
naive, q&d scan for lines matching: |
|
3845 |
<anything>: |
|
3846 |
" |
|
3847 |
||
11825 | 3848 |
^ self tagsForLinesStartingWithIdentifierAndColon:aFilePath |
3849 |
||
3850 |
"Modified: / 28-09-2012 / 14:45:52 / cg" |
|
9891 | 3851 |
! ! |
3852 |
||
3853 |
!TagList methodsFor:'testing'! |
|
3854 |
||
3855 |
supportsFile:aFile |
|
3856 |
"return true, if we can generate tags for a file" |
|
3857 |
||
3858 |
aFile isReadable ifFalse:[^ false]. |
|
3859 |
||
3860 |
"/ cg: now always return true - let generateTag run against the wall... |
|
3861 |
^ true. |
|
3862 |
||
13335 | 3863 |
"/ lcSuffix := aFile suffix asLowercase. |
9891 | 3864 |
"/ selfClass := self class. |
3865 |
"/ |
|
13335 | 3866 |
"/ lcSuffix size ~~ 0 ifTrue:[ |
9891 | 3867 |
"/ ((selfClass isCSuffix:lcSuffix) |
3868 |
"/ or:[(selfClass isJavaSuffix:lcSuffix) |
|
3869 |
"/ or:[(selfClass isEiffelSuffix:lcSuffix) |
|
3870 |
"/ or:[(selfClass isFortranSuffix:lcSuffix) |
|
3871 |
"/ or:[(selfClass isPythonSuffix:lcSuffix) |
|
3872 |
"/ or:[(selfClass isLispSuffix:lcSuffix) |
|
3873 |
"/ or:[(selfClass isPrologSuffix:lcSuffix) |
|
3874 |
"/ or:[(selfClass isTCLSuffix:lcSuffix) |
|
3875 |
"/ or:[(selfClass isAssemblerSuffix:lcSuffix) |
|
3876 |
"/ or:[(selfClass isSmalltalkSuffix:lcSuffix) |
|
3877 |
"/ or:[(selfClass isRubySuffix:lcSuffix)]]]]]]]]]]) |
|
3878 |
"/ ifTrue:[ |
|
3879 |
"/ ^ true |
|
3880 |
"/ ]. |
|
3881 |
"/ ]. |
|
3882 |
"/ |
|
3883 |
"/ lcName := aFile baseName asLowercase. |
|
13335 | 3884 |
"/ ^ selfClass makeFilePatterns contains:[:pattern | pattern match:lcName] |
9891 | 3885 |
! ! |
3886 |
||
3887 |
!TagList class methodsFor:'documentation'! |
|
3888 |
||
11051 | 3889 |
version |
14382 | 3890 |
^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.48 2014-05-21 09:03:22 cg Exp $' |
11051 | 3891 |
! |
3892 |
||
9891 | 3893 |
version_CVS |
14382 | 3894 |
^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.48 2014-05-21 09:03:22 cg Exp $' |
10054 | 3895 |
! |
3896 |
||
3897 |
version_SVN |
|
14382 | 3898 |
^ '$Id: Tools__TagList.st,v 1.48 2014-05-21 09:03:22 cg Exp $' |
9891 | 3899 |
! ! |
12332 | 3900 |