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