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