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