Tools__TagList.st
changeset 18829 4a741083fc89
parent 18806 e4993db9f737
child 19290 37cb0da26b1f
equal deleted inserted replaced
18828:89ad6f8245e2 18829:4a741083fc89
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2002 by eXept Software AG 
     4  COPYRIGHT (c) 2002 by eXept Software AG 
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
  2486 
  2488 
  2487 fromFile:aFile in:aTempDirectory
  2489 fromFile:aFile in:aTempDirectory
  2488     "create tags from a file;
  2490     "create tags from a file;
  2489      either use the ctags/etags command, or an internal naive, simple method."
  2491      either use the ctags/etags command, or an internal naive, simple method."
  2490 
  2492 
  2491     |forceSimpleTagList list shellCmd numTags fileContentsOrFilename|
  2493     |forceSimpleTagList list shellCmd numTags fileContentsOrFilename moreTags lineNrsAlready|
  2492 
  2494 
  2493     rawList := nil.
  2495     rawList := nil.
  2494     tagsValidForFile := nil.
  2496     tagsValidForFile := nil.
  2495 
  2497 
  2496     forceSimpleTagList := false.
  2498     forceSimpleTagList := false.
  2520                 list addAll:objcTags.    
  2522                 list addAll:objcTags.    
  2521             ].    
  2523             ].    
  2522         ].
  2524         ].
  2523     ].
  2525     ].
  2524     list isNil ifTrue:[list := OrderedCollection new].
  2526     list isNil ifTrue:[list := OrderedCollection new].
       
  2527 
       
  2528     lineNrsAlready := list collect:[:tag | tag lineNumber] as:Set.
  2525     
  2529     
  2526     "/ in case ctags could not find anything, try our own, naive fallback (not too bad either)
  2530     "/ in case ctags could not find anything, try our own, naive fallback (not too bad either)
  2527     "/ list isEmptyOrNil ifTrue:[
  2531     "/ list isEmptyOrNil ifTrue:[
  2528         list addAll: ((self getSimpleTagListFromFile:aFile in:aTempDirectory) ? #()).
  2532         moreTags := ((self getSimpleTagListFromFile:aFile in:aTempDirectory) ? #()).
       
  2533         moreTags removeAllSuchThat:[:newTag | lineNrsAlready includes:newTag lineNumber].
       
  2534         list addAll:moreTags.
  2529     "/ ].
  2535     "/ ].
  2530     tagTypesPresent := true.
  2536     tagTypesPresent := true.
  2531 
  2537 
  2532     numTags := list size.
  2538     numTags := list size.
  2533     aFile fileSize <= (1024*1024) ifTrue:[
  2539     aFile fileSize <= (1024*1024) ifTrue:[
  2552     ].    
  2558     ].    
  2553     self setRawList:list.
  2559     self setRawList:list.
  2554     tagsValidForFile := aFile.
  2560     tagsValidForFile := aFile.
  2555 
  2561 
  2556     "Modified: / 15-05-2017 / 00:56:22 / cg"
  2562     "Modified: / 15-05-2017 / 00:56:22 / cg"
  2557     "Modified: / 12-03-2019 / 15:11:27 / Claus Gittinger"
  2563     "Modified: / 21-06-2019 / 12:03:59 / Claus Gittinger"
  2558 !
  2564 !
  2559 
  2565 
  2560 fromFile:aFile in:aTempDirectory onTarget:aTarget
  2566 fromFile:aFile in:aTempDirectory onTarget:aTarget
  2561     "create tags from a file;
  2567     "create tags from a file;
  2562      either use the ctags/etags command, or an intenral naive, simple method.
  2568      either use the ctags/etags command, or an intenral naive, simple method.