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