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