Tools__TagList.st
branchjv
changeset 15566 184cea584be5
parent 13657 fdc78070d46d
parent 15328 a0b7e6d0e919
child 15686 4b9d86489538
equal deleted inserted replaced
13752:25c2a13f00c5 15566:184cea584be5
    13 
    13 
    14 "{ NameSpace: Tools }"
    14 "{ NameSpace: Tools }"
    15 
    15 
    16 List subclass:#TagList
    16 List subclass:#TagList
    17 	instanceVariableNames:'rawList filteredList filter tagsValidForFile sortCriteria groupBy
    17 	instanceVariableNames:'rawList filteredList filter tagsValidForFile sortCriteria groupBy
    18 		showOnly hideStatic hideStructMembers hideClasses hideMethods
    18 		showOnly flags tagTypesPresent usingDefaultCTags ctagsCommand
    19 		hideDefines hideTypedefs hideVariables hideStructures
    19 		ctagsIsExCtags ctagsIsExCtags5x remoteTarget'
    20 		hideFunctions hideFunctionProtoTypes hideJavaClasses
       
    21 		hideJavaMethods hideJavaInterfaces hideJavaFields
       
    22 		hideJavaPackages hideDartClasses hideDartMethods
       
    23 		hideDartInterfaces hideDartFields hideDartPackages hideLispMacros
       
    24 		hideLispEvaluations hideLispMethods hideLispConstants
       
    25 		hideLocalLabels hideLocalLabels2 hideDataLabels hideTextLabels
       
    26 		tagTypesPresent hidePythonClasses hidePythonMethods
       
    27 		hidePythonFunctions hideOzClasses hideOzMethods hideOzFunctions
       
    28 		hideHTMLTextArea hideHTMLInput hideHTMLTable hideHTMLScript
       
    29 		hideHTMLForm hideHTMLHeaders usingDefaultCTags ctagsCommand
       
    30 		ctagsIsExCtags ctagsIsExCtags5x hideDocumentation remoteTarget
       
    31 		hideLocalLabels3'
       
    32 	classVariableNames:'Sorted CachedTagListsPerFile DefaultSortCriteria DefaultShowOnly
    20 	classVariableNames:'Sorted CachedTagListsPerFile DefaultSortCriteria DefaultShowOnly
    33 		TagsSuffixes DefaultGroupBy'
    21 		TagsSuffixes DefaultGroupBy'
    34 	poolDictionaries:''
    22 	poolDictionaries:''
    35 	category:'Interface-Tools-File-Tags'
    23 	category:'Interface-Tools-File-Tags'
    36 !
    24 !
    61     The tags are used bz the tagList or to navigate quickly to some
    49     The tags are used bz the tagList or to navigate quickly to some
    62     function in the C-browser.
    50     function in the C-browser.
    63 "
    51 "
    64 ! !
    52 ! !
    65 
    53 
    66 !TagList class methodsFor:'accessing'!
    54 !TagList class methodsFor:'accessing - suffixes'!
    67 
    55 
    68 tagsSuffixes
    56 tagsSuffixes
    69 "flush with:
    57 "flush with:
    70 TagsSuffixes := nil
    58 TagsSuffixes := nil
    71 "
    59 "
    73         ^ TagsSuffixes
    61         ^ TagsSuffixes
    74     ].
    62     ].
    75     TagsSuffixes := IdentityDictionary new.
    63     TagsSuffixes := IdentityDictionary new.
    76 
    64 
    77     TagsSuffixes at:#'text/asm'                 put:#( 's' 'asm' ).
    65     TagsSuffixes at:#'text/asm'                 put:#( 's' 'asm' ).
    78     TagsSuffixes at:#'text/c'                   put:#( 'c' 'h' 'ci' 'hi' 'sc').
    66     TagsSuffixes at:#'text/c'                   put:#( 'c' 'h' 'ci' 'hi' 'sc' 'sth').
    79     TagsSuffixes at:#'text/cpp'                 put:#( 'cc' 'cpp' 'cxx' 'c++' 'hxx' 'hpp' 'h++').
    67     TagsSuffixes at:#'text/cpp'                 put:#( 'cc' 'cpp' 'cxx' 'c++' 'hxx' 'hpp' 'h++').
    80     TagsSuffixes at:#'text/eiffel'              put:#( 'e' 'eif' ).
    68     TagsSuffixes at:#'text/eiffel'              put:#( 'e' 'eif' ).
    81     TagsSuffixes at:#'text/fortran'             put:#( 'f' 'for' 'ftn' 'f77' 'f90' ).
    69     TagsSuffixes at:#'text/fortran'             put:#( 'f' 'for' 'ftn' 'f77' 'f90' ).
    82     TagsSuffixes at:#'text/html'                put:#( 'htm' 'html').
    70     TagsSuffixes at:#'text/html'                put:#( 'htm' 'html').
    83     TagsSuffixes at:#'text/java'                put:#( 'java' 'jav').
    71     TagsSuffixes at:#'text/java'                put:#( 'java' 'jav' 'j').
    84     TagsSuffixes at:#'text/javaScript'          put:#( 'js' ).
    72     TagsSuffixes at:#'text/javaScript'          put:#( 'js' ).
    85     TagsSuffixes at:#'text/javascript'          put:#( 'js' ).
    73     TagsSuffixes at:#'text/javascript'          put:#( 'js' ).
    86     TagsSuffixes at:#'application/x-javascript' put:#( 'js' ).
    74     TagsSuffixes at:#'application/x-javascript' put:#( 'js' ).
    87     TagsSuffixes at:#'text/dart'                put:#( 'dart' ).
    75     TagsSuffixes at:#'text/dart'                put:#( 'dart' ).
    88     TagsSuffixes at:#'application/x-dart'       put:#( 'dart' ).
    76     TagsSuffixes at:#'application/x-dart'       put:#( 'dart' ).
    92     TagsSuffixes at:#'text/php'                 put:#( 'php' ).
    80     TagsSuffixes at:#'text/php'                 put:#( 'php' ).
    93     TagsSuffixes at:#'text/lisp'                put:#( 'lisp' 'el' 'lsp' 'cl').
    81     TagsSuffixes at:#'text/lisp'                put:#( 'lisp' 'el' 'lsp' 'cl').
    94     TagsSuffixes at:#'text/lisp-arc'            put:#( 'arc' ).
    82     TagsSuffixes at:#'text/lisp-arc'            put:#( 'arc' ).
    95     TagsSuffixes at:#'text/scheme'              put:#( 'scm' 'ss' 'brg').
    83     TagsSuffixes at:#'text/scheme'              put:#( 'scm' 'ss' 'brg').
    96     TagsSuffixes at:#'text/oz'                  put:#( 'oz').
    84     TagsSuffixes at:#'text/oz'                  put:#( 'oz').
       
    85     TagsSuffixes at:#'text/lua'                 put:#( 'lua').
    97     TagsSuffixes at:#'text/smalltalk'           put:#( 'st' ).
    86     TagsSuffixes at:#'text/smalltalk'           put:#( 'st' ).
    98     TagsSuffixes at:#'text/tcl'                 put:#( 'tcl' ).
    87     TagsSuffixes at:#'text/tcl'                 put:#( 'tcl' ).
    99     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
    88     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
   100     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
    89     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
   101     TagsSuffixes at:#'text/batch'               put:#( 'bat' ).
    90     TagsSuffixes at:#'text/batch'               put:#( 'bat' ).
   199     "returns a list of supported java-suffixes
   188     "returns a list of supported java-suffixes
   200     "
   189     "
   201     ^ self tagsSuffixes at:#'text/java'
   190     ^ self tagsSuffixes at:#'text/java'
   202 !
   191 !
   203 
   192 
       
   193 luaSuffixes
       
   194     "returns a list of supported lua-suffixes
       
   195     "
       
   196     ^ self tagsSuffixes at:#'text/lua'
       
   197 !
       
   198 
   204 makeFilePatterns
   199 makeFilePatterns
   205     "returns a list of makefile match patterns
   200     "returns a list of makefile match patterns
   206     "
   201     "
   207     ^ self tagsSuffixes at:#'text/make'
   202     ^ self tagsSuffixes at:#'text/make'
   208 !
   203 !
   285 
   280 
   286 isBatchSuffix:suffix
   281 isBatchSuffix:suffix
   287     ^ self isSuffix:suffix in:self batchSuffixes
   282     ^ self isSuffix:suffix in:self batchSuffixes
   288 
   283 
   289     "Created: / 28-09-2012 / 14:47:43 / cg"
   284     "Created: / 28-09-2012 / 14:47:43 / cg"
       
   285 !
       
   286 
       
   287 isCOrCPlusPlusSuffix:suffix
       
   288     ^ (self isCSuffix:suffix) or:[self isCPlusPlusSuffix:suffix]
   290 !
   289 !
   291 
   290 
   292 isCPlusPlusSuffix:suffix
   291 isCPlusPlusSuffix:suffix
   293     ^ self isSuffix:suffix in:self cPlusPlusSuffixes
   292     ^ self isSuffix:suffix in:self cPlusPlusSuffixes
   294 !
   293 !
   339     or:[(self isRacketSchemeLispSuffix:suffix)]]]]
   338     or:[(self isRacketSchemeLispSuffix:suffix)]]]]
   340 
   339 
   341     "Modified: / 21-10-2011 / 09:31:30 / cg"
   340     "Modified: / 21-10-2011 / 09:31:30 / cg"
   342 !
   341 !
   343 
   342 
       
   343 isLuaSuffix:suffix
       
   344     ^ self isSuffix:suffix in:self luaSuffixes
       
   345 !
       
   346 
   344 isMakefileName:fileName
   347 isMakefileName:fileName
   345     |lcName|
   348     |lcName|
   346 
   349 
   347     lcName := fileName asFilename baseName asLowercase.
   350     lcName := fileName asFilename baseName asLowercase.
   348     self makeFilePatterns do:[:aPattern |
   351     self makeFilePatterns do:[:aPattern |
   414     |suff file list name mimeMake|
   417     |suff file list name mimeMake|
   415 
   418 
   416     aFile isNil ifTrue:[^ nil].
   419     aFile isNil ifTrue:[^ nil].
   417 
   420 
   418     file := aFile asFilename.
   421     file := aFile asFilename.
   419     suff := aFile asFilename suffix.
   422     suff := file suffix.
   420 
   423 
   421     suff size ~~ 0 ifTrue:[
   424     suff size ~~ 0 ifTrue:[
   422         suff := suff asLowercase.
   425         suff := suff asLowercase.
   423 
   426 
   424         (suff = 'bak' or:[suff = 'sav']) ifTrue:[
   427         (suff = 'bak' or:[suff = 'sav']) ifTrue:[
   438     ((list at:mimeMake) contains:[:pattern | pattern match:name]) ifTrue:[
   441     ((list at:mimeMake) contains:[:pattern | pattern match:name]) ifTrue:[
   439         ^ mimeMake
   442         ^ mimeMake
   440     ].
   443     ].
   441 
   444 
   442     self tagsSuffixes keysAndValuesDo:[:mimeType :suffixes|
   445     self tagsSuffixes keysAndValuesDo:[:mimeType :suffixes|
   443         (suffixes includes:suff) ifTrue:[ ^ mimeType ]
   446         (suffixes includes:suff) ifTrue:[ 
   444     ].
   447             ^ mimeType 
   445     ^ nil
   448         ]
       
   449     ].
       
   450     ^ aFile asFilename mimeTypeOfContents
       
   451     "/ ^ nil
   446 ! !
   452 ! !
   447 
   453 
   448 !TagList class methodsFor:'tag generation'!
   454 !TagList class methodsFor:'tag generation'!
   449 
   455 
   450 cachedTagsFromFile:aFilename in:aTempDirectory
   456 cachedTagsFromFile:aFilename in:aTempDirectory
   473 "/        ^ #()
   479 "/        ^ #()
   474 "/    ].
   480 "/    ].
   475     tagList := self new.
   481     tagList := self new.
   476     tagList showOnly:nil.
   482     tagList showOnly:nil.
   477     tagList fromFile:aFilename in:aTempDirectory.
   483     tagList fromFile:aFilename in:aTempDirectory.
       
   484     tagList do:[:eachTag | eachTag fileName:aFilename].
   478 
   485 
   479     CachedTagListsPerFile at:aFilename put:(CachedTags new tagList:tagList; tagTimestamp:fileTime; yourself).
   486     CachedTagListsPerFile at:aFilename put:(CachedTags new tagList:tagList; tagTimestamp:fileTime; yourself).
   480     ^ tagList
   487     ^ tagList
   481 
   488 
   482     "Modified: / 07-06-2010 / 12:13:25 / cg"
   489     "Modified: / 07-06-2010 / 12:13:25 / cg"
   573     tagTypesPresent := aBoolean.
   580     tagTypesPresent := aBoolean.
   574 ! !
   581 ! !
   575 
   582 
   576 !TagList methodsFor:'accessing-filters'!
   583 !TagList methodsFor:'accessing-filters'!
   577 
   584 
       
   585 anchorsOnly
       
   586     ^ showOnly == #anchors
       
   587 !
       
   588 
       
   589 anchorsOnly:aBoolean
       
   590     showOnly := DefaultShowOnly := nil.
       
   591     aBoolean ifTrue:[
       
   592         showOnly := "DefaultShowOnly :=" #anchors
       
   593     ].
       
   594 
       
   595     "Created: / 08-05-2011 / 10:11:39 / cg"
       
   596 !
       
   597 
   578 classesFunctionsAndVariablesOnly
   598 classesFunctionsAndVariablesOnly
   579     ^ showOnly == #classesFunctionsAndVariables
   599     ^ showOnly == #classesFunctionsAndVariables
   580 
   600 
   581     "Modified: / 07-06-2010 / 14:18:09 / cg"
   601     "Modified: / 07-06-2010 / 14:18:09 / cg"
   582 !
   602 !
   689     ].
   709     ].
   690 
   710 
   691     "Modified: / 05-05-2011 / 14:43:04 / cg"
   711     "Modified: / 05-05-2011 / 14:43:04 / cg"
   692 !
   712 !
   693 
   713 
       
   714 flagNamed:aSymbol
       
   715     ^ flags at:aSymbol ifAbsent:false
       
   716 !
       
   717 
       
   718 flagNamed:aSymbol put:aBoolean
       
   719     flags at:aSymbol put:aBoolean
       
   720 !
       
   721 
   694 functionsAndVariablesOnly
   722 functionsAndVariablesOnly
   695     ^ showOnly == #functionsAndVariables
   723     ^ showOnly == #functionsAndVariables
   696 
   724 
   697     "Modified: / 07-06-2010 / 14:18:05 / cg"
   725     "Modified: / 07-06-2010 / 14:18:05 / cg"
   698 !
   726 !
   719     ].
   747     ].
   720 
   748 
   721     "Modified: / 05-05-2011 / 15:22:03 / cg"
   749     "Modified: / 05-05-2011 / 15:22:03 / cg"
   722 !
   750 !
   723 
   751 
       
   752 headlinesOnly
       
   753     ^ showOnly == #headlines
       
   754 !
       
   755 
       
   756 headlinesOnly:aBoolean
       
   757     showOnly := DefaultShowOnly := nil.
       
   758     aBoolean ifTrue:[
       
   759         showOnly := "DefaultShowOnly :=" #headlines
       
   760     ].
       
   761 !
       
   762 
   724 hideClasses
   763 hideClasses
   725     ^ hideClasses ? false
   764     ^ self flagNamed:#hideClasses
   726 !
   765 !
   727 
   766 
   728 hideClasses:aBoolean
   767 hideClasses:aBoolean
   729     hideClasses := aBoolean.
   768     self flagNamed:#hideClasses put:aBoolean
   730 
   769 
   731     "Modified: / 05-05-2011 / 15:22:08 / cg"
   770     "Modified: / 05-05-2011 / 15:22:08 / cg"
   732 !
   771 !
   733 
   772 
   734 hideDartClasses
   773 hideDartClasses
   735     ^ hideDartClasses ? false
   774     ^ self flagNamed:#hideDartClasses
   736 !
   775 !
   737 
   776 
   738 hideDartClasses:aBoolean
   777 hideDartClasses:aBoolean
   739     hideDartClasses := aBoolean.
   778     self flagNamed:#hideDartClasses put:aBoolean
   740 
   779 
   741     "Modified: / 05-05-2011 / 15:22:32 / cg"
   780     "Modified: / 05-05-2011 / 15:22:32 / cg"
   742 !
   781 !
   743 
   782 
   744 hideDartFields
   783 hideDartFields
   745     ^ hideDartFields ? false
   784     ^ self flagNamed:#hideDartFields
   746 !
   785 !
   747 
   786 
   748 hideDartFields:aBoolean
   787 hideDartFields:aBoolean
   749     hideDartFields := aBoolean.
   788     self flagNamed:#hideDartFields put:aBoolean
   750 
   789 
   751     "Modified: / 05-05-2011 / 15:22:34 / cg"
   790     "Modified: / 05-05-2011 / 15:22:34 / cg"
   752 !
   791 !
   753 
   792 
   754 hideDartInterfaces
   793 hideDartInterfaces
   755     ^ hideDartInterfaces ? false
   794     ^ self flagNamed:#hideDartInterfaces
   756 !
   795 !
   757 
   796 
   758 hideDartInterfaces:aBoolean
   797 hideDartInterfaces:aBoolean
   759     hideDartInterfaces := aBoolean.
   798     self flagNamed:#hideDartInterfaces put:aBoolean
   760 
   799 
   761     "Modified: / 05-05-2011 / 15:22:38 / cg"
   800     "Modified: / 05-05-2011 / 15:22:38 / cg"
   762 !
   801 !
   763 
   802 
   764 hideDartMethods
   803 hideDartMethods
   765     ^ hideDartMethods ? false
   804     ^ self flagNamed:#hideDartMethods
   766 !
   805 !
   767 
   806 
   768 hideDartMethods:aBoolean
   807 hideDartMethods:aBoolean
   769     hideDartMethods := aBoolean.
   808     self flagNamed:#hideDartMethods put:aBoolean.
   770 
   809 
   771     "Modified: / 05-05-2011 / 15:22:40 / cg"
   810     "Modified: / 05-05-2011 / 15:22:40 / cg"
   772 !
   811 !
   773 
   812 
   774 hideDartPackages
   813 hideDartPackages
   775     ^ hideDartPackages ? false
   814     ^ self flagNamed:#hideDartPackages 
   776 !
   815 !
   777 
   816 
   778 hideDartPackages:aBoolean
   817 hideDartPackages:aBoolean
   779     hideDartPackages := aBoolean.
   818     self flagNamed:#hideDartPackages put:aBoolean.
   780 
   819 
   781     "Modified: / 05-05-2011 / 15:22:41 / cg"
   820     "Modified: / 05-05-2011 / 15:22:41 / cg"
   782 !
   821 !
   783 
   822 
   784 hideDataLabels
   823 hideDataLabels
   785     ^ hideDataLabels ? false
   824     ^ self flagNamed:#hideDataLabels
   786 !
   825 !
   787 
   826 
   788 hideDataLabels:aBoolean
   827 hideDataLabels:aBoolean
   789     hideDataLabels := aBoolean.
   828     self flagNamed:#hideDataLabels put:aBoolean.
   790 
   829 
   791     "Modified: / 05-05-2011 / 15:22:10 / cg"
   830     "Modified: / 05-05-2011 / 15:22:10 / cg"
   792 !
   831 !
   793 
   832 
   794 hideDefines
   833 hideDefines
   795     ^ hideDefines ? false
   834     ^ self flagNamed:#hideDefines 
   796 !
   835 !
   797 
   836 
   798 hideDefines:aBoolean
   837 hideDefines:aBoolean
   799     hideDefines := aBoolean.
   838     self flagNamed:#hideDefines put:aBoolean.
   800 
   839 
   801     "Modified: / 05-05-2011 / 15:22:12 / cg"
   840     "Modified: / 05-05-2011 / 15:22:12 / cg"
   802 !
   841 !
   803 
   842 
   804 hideDocumentation
   843 hideDocumentation
   805     ^ hideDocumentation ? false
   844     ^ self flagNamed:#hideDocumentation
   806 
   845 
   807     "Created: / 08-05-2011 / 10:11:02 / cg"
   846     "Created: / 08-05-2011 / 10:11:02 / cg"
   808 !
   847 !
   809 
   848 
   810 hideDocumentation:aBoolean
   849 hideDocumentation:aBoolean
   811     hideDocumentation := aBoolean.
   850     self flagNamed:#hideDocumentation put:aBoolean.
   812 
   851 
   813     "Created: / 08-05-2011 / 10:11:06 / cg"
   852     "Created: / 08-05-2011 / 10:11:06 / cg"
   814 !
   853 !
   815 
   854 
   816 hideFunctionProtoTypes
   855 hideFunctionProtoTypes
   817     ^ hideFunctionProtoTypes ? false
   856     ^ self flagNamed:#hideFunctionProtoTypes
   818 !
   857 !
   819 
   858 
   820 hideFunctionProtoTypes:aBoolean
   859 hideFunctionProtoTypes:aBoolean
   821     hideFunctionProtoTypes := aBoolean.
   860     self flagNamed:#hideFunctionProtoTypes put:aBoolean.
   822 
   861 
   823     "Modified: / 05-05-2011 / 15:22:14 / cg"
   862     "Modified: / 05-05-2011 / 15:22:14 / cg"
   824 !
   863 !
   825 
   864 
   826 hideFunctions
   865 hideFunctions
   827     ^ hideFunctions ? false
   866     ^ self flagNamed:#hideFunctions
   828 !
   867 !
   829 
   868 
   830 hideFunctions:aBoolean
   869 hideFunctions:aBoolean
   831     hideFunctions := aBoolean.
   870     self flagNamed:#hideFunctions put:aBoolean.
   832 
   871 
   833     "Modified: / 05-05-2011 / 15:22:18 / cg"
   872     "Modified: / 05-05-2011 / 15:22:18 / cg"
   834 !
   873 !
   835 
   874 
   836 hideHTMLHeaders
   875 hideHTMLHeaders
   837     ^ hideHTMLHeaders ? false
   876     ^ self flagNamed:#hideHTMLHeaders 
   838 
   877 
   839     "Created: / 12-09-2012 / 12:29:45 / cg"
   878     "Created: / 12-09-2012 / 12:29:45 / cg"
   840 !
   879 !
   841 
   880 
   842 hideHTMLHeaders:aBoolean
   881 hideHTMLHeaders:aBoolean
   843     hideHTMLHeaders := aBoolean.
   882     self flagNamed:#hideHTMLHeaders put:aBoolean.
   844 
   883 
   845     "Created: / 12-09-2012 / 12:29:52 / cg"
   884     "Created: / 12-09-2012 / 12:29:52 / cg"
   846 !
   885 !
   847 
   886 
   848 hideHTMLInput
   887 hideHTMLInput
   849     ^ hideHTMLInput ? false
   888     ^ self flagNamed:#hideHTMLInput 
   850 
   889 
   851     "Created: / 20-04-2011 / 19:01:04 / cg"
   890     "Created: / 20-04-2011 / 19:01:04 / cg"
   852 !
   891 !
   853 
   892 
   854 hideHTMLInput:aBoolean
   893 hideHTMLInput:aBoolean
   855     hideHTMLInput := aBoolean.
   894     self flagNamed:#hideHTMLInput put:aBoolean.
   856 
   895 
   857     "Created: / 20-04-2011 / 19:01:32 / cg"
   896     "Created: / 20-04-2011 / 19:01:32 / cg"
   858     "Modified: / 05-05-2011 / 15:22:21 / cg"
   897     "Modified: / 05-05-2011 / 15:22:21 / cg"
   859 !
   898 !
   860 
   899 
   861 hideHTMLScript
   900 hideHTMLScript
   862     ^ hideHTMLScript ? false
   901     ^ self flagNamed:#hideHTMLScript 
   863 
   902 
   864     "Created: / 20-04-2011 / 19:00:32 / cg"
   903     "Created: / 20-04-2011 / 19:00:32 / cg"
   865 !
   904 !
   866 
   905 
   867 hideHTMLScript:aBoolean
   906 hideHTMLScript:aBoolean
   868     hideHTMLScript := aBoolean.
   907     self flagNamed:#hideHTMLScript put:aBoolean.
   869 
   908 
   870     "Created: / 20-04-2011 / 19:01:32 / cg"
   909     "Created: / 20-04-2011 / 19:01:32 / cg"
   871     "Modified: / 05-05-2011 / 15:22:23 / cg"
   910     "Modified: / 05-05-2011 / 15:22:23 / cg"
   872 !
   911 !
   873 
   912 
   874 hideHTMLTable
   913 hideHTMLTable
   875     ^ hideHTMLTable ? false
   914     ^ self flagNamed:#hideHTMLTable
   876 
   915 
   877     "Created: / 20-04-2011 / 19:01:23 / cg"
   916     "Created: / 20-04-2011 / 19:01:23 / cg"
   878 !
   917 !
   879 
   918 
   880 hideHTMLTable:aBoolean
   919 hideHTMLTable:aBoolean
   881     hideHTMLTable := aBoolean.
   920     self flagNamed:#hideHTMLTable put:aBoolean.
   882 
   921 
   883     "Created: / 20-04-2011 / 19:01:48 / cg"
   922     "Created: / 20-04-2011 / 19:01:48 / cg"
   884     "Modified: / 05-05-2011 / 15:22:26 / cg"
   923     "Modified: / 05-05-2011 / 15:22:26 / cg"
   885 !
   924 !
   886 
   925 
   887 hideHTMLTextArea
   926 hideHTMLTextArea
   888     ^ hideHTMLTextArea ? false
   927     ^ self flagNamed:#hideHTMLTextArea 
   889 
   928 
   890     "Created: / 20-04-2011 / 19:00:55 / cg"
   929     "Created: / 20-04-2011 / 19:00:55 / cg"
   891 !
   930 !
   892 
   931 
   893 hideHTMLTextArea:aBoolean
   932 hideHTMLTextArea:aBoolean
   894     hideHTMLTextArea := aBoolean.
   933     self flagNamed:#hideHTMLTextArea put:aBoolean.
   895 
   934 
   896     "Created: / 20-04-2011 / 19:01:58 / cg"
   935     "Created: / 20-04-2011 / 19:01:58 / cg"
   897     "Modified: / 05-05-2011 / 15:22:28 / cg"
   936     "Modified: / 05-05-2011 / 15:22:28 / cg"
   898 !
   937 !
   899 
   938 
   900 hideJavaClasses
   939 hideJavaClasses
   901     ^ hideJavaClasses ? false
   940     ^ self flagNamed:#hideJavaClasses 
   902 !
   941 !
   903 
   942 
   904 hideJavaClasses:aBoolean
   943 hideJavaClasses:aBoolean
   905     hideJavaClasses := aBoolean.
   944     self flagNamed:#hideJavaClasses put:aBoolean
   906 
   945 
   907     "Modified: / 05-05-2011 / 15:22:32 / cg"
   946     "Modified: / 05-05-2011 / 15:22:32 / cg"
   908 !
   947 !
   909 
   948 
   910 hideJavaFields
   949 hideJavaFields
   911     ^ hideJavaFields ? false
   950     ^ self flagNamed:#hideJavaFields 
   912 !
   951 !
   913 
   952 
   914 hideJavaFields:aBoolean
   953 hideJavaFields:aBoolean
   915     hideJavaFields := aBoolean.
   954     self flagNamed:#hideJavaFields put:aBoolean.
   916 
   955 
   917     "Modified: / 05-05-2011 / 15:22:34 / cg"
   956     "Modified: / 05-05-2011 / 15:22:34 / cg"
   918 !
   957 !
   919 
   958 
   920 hideJavaInterfaces
   959 hideJavaInterfaces
   921     ^ hideJavaInterfaces ? false
   960     ^ self flagNamed:#hideJavaInterfaces 
   922 !
   961 !
   923 
   962 
   924 hideJavaInterfaces:aBoolean
   963 hideJavaInterfaces:aBoolean
   925     hideJavaInterfaces := aBoolean.
   964     self flagNamed:#hideJavaInterfaces put:aBoolean.
   926 
   965 
   927     "Modified: / 05-05-2011 / 15:22:38 / cg"
   966     "Modified: / 05-05-2011 / 15:22:38 / cg"
   928 !
   967 !
   929 
   968 
   930 hideJavaMethods
   969 hideJavaMethods
   931     ^ hideJavaMethods ? false
   970     ^ self flagNamed:#hideJavaMethods
   932 !
   971 !
   933 
   972 
   934 hideJavaMethods:aBoolean
   973 hideJavaMethods:aBoolean
   935     hideJavaMethods := aBoolean.
   974     self flagNamed:#hideJavaMethods put:aBoolean.
   936 
   975 
   937     "Modified: / 05-05-2011 / 15:22:40 / cg"
   976     "Modified: / 05-05-2011 / 15:22:40 / cg"
   938 !
   977 !
   939 
   978 
   940 hideJavaPackages
   979 hideJavaPackages
   941     ^ hideJavaPackages ? false
   980     ^ self flagNamed:#hideJavaPackages 
   942 !
   981 !
   943 
   982 
   944 hideJavaPackages:aBoolean
   983 hideJavaPackages:aBoolean
   945     hideJavaPackages := aBoolean.
   984     self flagNamed:#hideJavaPackages put:aBoolean.
   946 
   985 
   947     "Modified: / 05-05-2011 / 15:22:41 / cg"
   986     "Modified: / 05-05-2011 / 15:22:41 / cg"
   948 !
   987 !
   949 
   988 
       
   989 hideLabels
       
   990     ^ self flagNamed:#hideLabels 
       
   991 !
       
   992 
       
   993 hideLabels:aBoolean
       
   994     self flagNamed:#hideLabels put:aBoolean.
       
   995 
       
   996     "Modified: / 05-05-2011 / 15:22:46 / cg"
       
   997 !
       
   998 
   950 hideLispConstants
   999 hideLispConstants
   951     ^ hideLispConstants ? false
  1000     ^ self flagNamed:#hideLispConstants 
   952 !
  1001 !
   953 
  1002 
   954 hideLispConstants:aBoolean
  1003 hideLispConstants:aBoolean
   955     hideLispConstants := aBoolean.
  1004     self flagNamed:#hideLispConstants put:aBoolean.
   956 
  1005 
   957     "Modified: / 05-05-2011 / 15:22:46 / cg"
  1006     "Modified: / 05-05-2011 / 15:22:46 / cg"
   958 !
  1007 !
   959 
  1008 
   960 hideLispEvaluations
  1009 hideLispEvaluations
   961     ^ hideLispEvaluations ? false
  1010     ^ self flagNamed:#hideLispEvaluations 
   962 !
  1011 !
   963 
  1012 
   964 hideLispEvaluations:aBoolean
  1013 hideLispEvaluations:aBoolean
   965     hideLispEvaluations := aBoolean.
  1014     self flagNamed:#hideLispEvaluations put:aBoolean.
   966 
  1015 
   967     "Modified: / 05-05-2011 / 15:22:49 / cg"
  1016     "Modified: / 05-05-2011 / 15:22:49 / cg"
   968 !
  1017 !
   969 
  1018 
   970 hideLispMacros
  1019 hideLispMacros
   971     ^ hideLispMacros ? false
  1020     ^ self flagNamed:#hideLispMacros 
   972 !
  1021 !
   973 
  1022 
   974 hideLispMacros:aBoolean
  1023 hideLispMacros:aBoolean
   975     hideLispMacros := aBoolean.
  1024     self flagNamed:#hideLispMacros put:aBoolean.
   976 
  1025 
   977     "Modified: / 05-05-2011 / 15:22:50 / cg"
  1026     "Modified: / 05-05-2011 / 15:22:50 / cg"
   978 !
  1027 !
   979 
  1028 
   980 hideLispMethods
  1029 hideLispMethods
   981     ^ hideLispMethods ? false
  1030     ^ self flagNamed:#hideLispMethods 
   982 !
  1031 !
   983 
  1032 
   984 hideLispMethods:aBoolean
  1033 hideLispMethods:aBoolean
   985     hideLispMethods := aBoolean.
  1034     self flagNamed:#hideLispMethods put:aBoolean.
   986 
  1035 
   987     "Modified: / 05-05-2011 / 15:22:53 / cg"
  1036     "Modified: / 05-05-2011 / 15:22:53 / cg"
   988 !
  1037 !
   989 
  1038 
   990 hideLocalLabels
  1039 hideLocalLabels
   991     ^ hideLocalLabels ? false
  1040     ^ self flagNamed:#hideLocalLabels 
   992 !
  1041 !
   993 
  1042 
   994 hideLocalLabels2
  1043 hideLocalLabels2
   995     ^ hideLocalLabels2 ? false
  1044     ^ self flagNamed:#hideLocalLabels2 
   996 
  1045 
   997     "Created: / 24-03-2012 / 23:23:15 / cg"
  1046     "Created: / 24-03-2012 / 23:23:15 / cg"
   998 !
  1047 !
   999 
  1048 
  1000 hideLocalLabels2:aBoolean
  1049 hideLocalLabels2:aBoolean
  1001     hideLocalLabels2 := aBoolean.
  1050     self flagNamed:#hideLocalLabels2 put:aBoolean.
  1002 
  1051 
  1003     "Modified: / 05-05-2011 / 15:22:54 / cg"
  1052     "Modified: / 05-05-2011 / 15:22:54 / cg"
  1004     "Created: / 24-03-2012 / 23:23:20 / cg"
  1053     "Created: / 24-03-2012 / 23:23:20 / cg"
  1005 !
  1054 !
  1006 
  1055 
  1007 hideLocalLabels3
  1056 hideLocalLabels3
  1008     ^ hideLocalLabels3 ? false
  1057     ^ self flagNamed:#hideLocalLabels3 
  1009 
  1058 
  1010     "Created: / 13-05-2012 / 11:12:37 / cg"
  1059     "Created: / 13-05-2012 / 11:12:37 / cg"
  1011 !
  1060 !
  1012 
  1061 
  1013 hideLocalLabels3:aBoolean
  1062 hideLocalLabels3:aBoolean
  1014     hideLocalLabels3 := aBoolean.
  1063     self flagNamed:#hideLocalLabels3 put:aBoolean.
  1015 
  1064 
  1016     "Modified: / 05-05-2011 / 15:22:54 / cg"
  1065     "Modified: / 05-05-2011 / 15:22:54 / cg"
  1017     "Created: / 13-05-2012 / 11:12:42 / cg"
  1066     "Created: / 13-05-2012 / 11:12:42 / cg"
  1018 !
  1067 !
  1019 
  1068 
  1020 hideLocalLabels:aBoolean
  1069 hideLocalLabels:aBoolean
  1021     hideLocalLabels := aBoolean.
  1070     self flagNamed:#hideLocalLabels put:aBoolean.
  1022 
  1071 
  1023     "Modified: / 05-05-2011 / 15:22:54 / cg"
  1072     "Modified: / 05-05-2011 / 15:22:54 / cg"
  1024 !
  1073 !
  1025 
  1074 
       
  1075 hideLuaFunctions
       
  1076     ^ self flagNamed:#hideLuaFunctions
       
  1077 !
       
  1078 
       
  1079 hideLuaFunctions:aBoolean
       
  1080     self flagNamed:#hideLuaFunctions put:aBoolean
       
  1081 !
       
  1082 
  1026 hideMethods
  1083 hideMethods
  1027     ^ hideMethods ? false
  1084     ^ self flagNamed:#hideMethods 
  1028 
  1085 
  1029     "Created: / 21-08-2012 / 21:02:24 / cg"
  1086     "Created: / 21-08-2012 / 21:02:24 / cg"
  1030 !
  1087 !
  1031 
  1088 
  1032 hideMethods:aBoolean
  1089 hideMethods:aBoolean
  1033     hideMethods := aBoolean.
  1090     self flagNamed:#hideMethods put:aBoolean.
  1034 
  1091 
  1035     "Created: / 21-08-2012 / 21:01:38 / cg"
  1092     "Created: / 21-08-2012 / 21:01:38 / cg"
  1036 !
  1093 !
  1037 
  1094 
  1038 hideOzClasses
  1095 hideOzClasses
  1039     ^ hideOzClasses ? false
  1096     ^ self flagNamed:#hideOzClasses 
  1040 !
  1097 !
  1041 
  1098 
  1042 hideOzClasses:aBoolean
  1099 hideOzClasses:aBoolean
  1043     hideOzClasses := aBoolean.
  1100     self flagNamed:#hideOzClasses put:aBoolean.
  1044 
  1101 
  1045     "Modified: / 05-05-2011 / 15:22:58 / cg"
  1102     "Modified: / 05-05-2011 / 15:22:58 / cg"
  1046 !
  1103 !
  1047 
  1104 
  1048 hideOzFunctions
  1105 hideOzFunctions
  1049     ^ hideOzFunctions ? false
  1106     ^ self flagNamed:#hideOzFunctions
  1050 !
  1107 !
  1051 
  1108 
  1052 hideOzFunctions:aBoolean
  1109 hideOzFunctions:aBoolean
  1053     hideOzFunctions := aBoolean.
  1110     self flagNamed:#hideOzFunctions put:aBoolean.
  1054 
  1111 
  1055     "Modified: / 05-05-2011 / 15:23:00 / cg"
  1112     "Modified: / 05-05-2011 / 15:23:00 / cg"
  1056 !
  1113 !
  1057 
  1114 
  1058 hideOzMethods
  1115 hideOzMethods
  1059     ^ hideOzMethods ? false
  1116     ^ self flagNamed:#hideOzMethods 
  1060 !
  1117 !
  1061 
  1118 
  1062 hideOzMethods:aBoolean
  1119 hideOzMethods:aBoolean
  1063     hideOzMethods := aBoolean.
  1120     self flagNamed:#hideOzMethods put:aBoolean.
  1064 
  1121 
  1065     "Modified: / 05-05-2011 / 15:23:02 / cg"
  1122     "Modified: / 05-05-2011 / 15:23:02 / cg"
  1066 !
  1123 !
  1067 
  1124 
  1068 hidePythonClasses
  1125 hidePythonClasses
  1069     ^ hidePythonClasses ? false
  1126     ^ self flagNamed:#hidePythonClasses 
  1070 !
  1127 !
  1071 
  1128 
  1072 hidePythonClasses:aBoolean
  1129 hidePythonClasses:aBoolean
  1073     hidePythonClasses := aBoolean.
  1130     self flagNamed:#hidePythonClasses put:aBoolean.
  1074 
  1131 
  1075     "Modified: / 05-05-2011 / 15:23:05 / cg"
  1132     "Modified: / 05-05-2011 / 15:23:05 / cg"
  1076 !
  1133 !
  1077 
  1134 
  1078 hidePythonFunctions
  1135 hidePythonFunctions
  1079     ^ hidePythonFunctions ? false
  1136     ^ self flagNamed:#hidePythonFunctions 
  1080 !
  1137 !
  1081 
  1138 
  1082 hidePythonFunctions:aBoolean
  1139 hidePythonFunctions:aBoolean
  1083     hidePythonFunctions := aBoolean.
  1140     self flagNamed:#hidePythonFunctions put:aBoolean.
  1084 
  1141 
  1085     "Modified: / 05-05-2011 / 15:23:07 / cg"
  1142     "Modified: / 05-05-2011 / 15:23:07 / cg"
  1086 !
  1143 !
  1087 
  1144 
  1088 hidePythonMethods
  1145 hidePythonMethods
  1089     ^ hidePythonMethods ? false
  1146     ^ self flagNamed:#hidePythonMethods 
  1090 !
  1147 !
  1091 
  1148 
  1092 hidePythonMethods:aBoolean
  1149 hidePythonMethods:aBoolean
  1093     hidePythonMethods := aBoolean.
  1150     self flagNamed:#hidePythonMethods put:aBoolean.
  1094 
  1151 
  1095     "Modified: / 05-05-2011 / 15:23:09 / cg"
  1152     "Modified: / 05-05-2011 / 15:23:09 / cg"
  1096 !
  1153 !
  1097 
  1154 
  1098 hideStatic
  1155 hideStatic
  1099     ^ hideStatic ? false
  1156     ^ self flagNamed:#hideStatic 
  1100 !
  1157 !
  1101 
  1158 
  1102 hideStatic:aBoolean
  1159 hideStatic:aBoolean
  1103     hideStatic := aBoolean.
  1160     self flagNamed:#hideStatic put:aBoolean.
  1104 
  1161 
  1105     "Modified: / 05-05-2011 / 15:23:11 / cg"
  1162     "Modified: / 05-05-2011 / 15:23:11 / cg"
  1106 !
  1163 !
  1107 
  1164 
  1108 hideStructMembers
  1165 hideStructMembers
  1109     ^ hideStructMembers ? false
  1166     ^ self flagNamed:#hideStructMembers 
  1110 !
  1167 !
  1111 
  1168 
  1112 hideStructMembers:aBoolean
  1169 hideStructMembers:aBoolean
  1113     hideStructMembers := aBoolean.
  1170     self flagNamed:#hideStructMembers put:aBoolean.
  1114 
  1171 
  1115     "Modified: / 05-05-2011 / 15:23:15 / cg"
  1172     "Modified: / 05-05-2011 / 15:23:15 / cg"
  1116 !
  1173 !
  1117 
  1174 
  1118 hideStructures
  1175 hideStructures
  1119     ^ hideStructures ? false
  1176     ^ self flagNamed:#hideStructures
  1120 !
  1177 !
  1121 
  1178 
  1122 hideStructures:aBoolean
  1179 hideStructures:aBoolean
  1123     hideStructures := aBoolean.
  1180     self flagNamed:#hideStructures put:aBoolean.
  1124 
  1181 
  1125     "Modified: / 05-05-2011 / 15:23:17 / cg"
  1182     "Modified: / 05-05-2011 / 15:23:17 / cg"
  1126 !
  1183 !
  1127 
  1184 
  1128 hideTextLabels
  1185 hideTextLabels
  1129     ^ hideTextLabels ? false
  1186     ^ self flagNamed:#hideTextLabels 
  1130 !
  1187 !
  1131 
  1188 
  1132 hideTextLabels:aBoolean
  1189 hideTextLabels:aBoolean
  1133     hideTextLabels := aBoolean.
  1190     self flagNamed:#hideTextLabels put:aBoolean.
  1134 
  1191 
  1135     "Modified: / 05-05-2011 / 15:23:19 / cg"
  1192     "Modified: / 05-05-2011 / 15:23:19 / cg"
  1136 !
  1193 !
  1137 
  1194 
  1138 hideTypedefs
  1195 hideTypedefs
  1139     ^ hideTypedefs ? false
  1196     ^ self flagNamed:#hideTypedefs 
  1140 !
  1197 !
  1141 
  1198 
  1142 hideTypedefs:aBoolean
  1199 hideTypedefs:aBoolean
  1143     hideTypedefs := aBoolean.
  1200     self flagNamed:#hideTypedefs put:aBoolean.
  1144 
  1201 
  1145     "Modified: / 05-05-2011 / 15:23:21 / cg"
  1202     "Modified: / 05-05-2011 / 15:23:21 / cg"
  1146 !
  1203 !
  1147 
  1204 
  1148 hideVariables
  1205 hideVariables
  1149     ^ hideVariables ? false
  1206     ^ self flagNamed:#hideVariables 
  1150 !
  1207 !
  1151 
  1208 
  1152 hideVariables:aBoolean
  1209 hideVariables:aBoolean
  1153     hideVariables := aBoolean.
  1210     self flagNamed:#hideVariables put:aBoolean.
  1154 
  1211 
  1155     "Modified: / 05-05-2011 / 15:23:23 / cg"
  1212     "Modified: / 05-05-2011 / 15:23:23 / cg"
  1156 !
  1213 !
  1157 
  1214 
  1158 javaClassesAndMethodsOnly
  1215 javaClassesAndMethodsOnly
  1532 
  1589 
  1533 tagTypesPresent
  1590 tagTypesPresent
  1534     ^ tagTypesPresent
  1591     ^ tagTypesPresent
  1535 ! !
  1592 ! !
  1536 
  1593 
       
  1594 !TagList methodsFor:'initialization'!
       
  1595 
       
  1596 initContents:n
       
  1597     "Invoked when a new instance is created."
       
  1598 
       
  1599     super initContents:n.
       
  1600     flags isNil ifTrue:[
       
  1601         flags := IdentityDictionary new.
       
  1602     ].
       
  1603 !
       
  1604 
       
  1605 initialize
       
  1606     "Invoked when a new instance is created."
       
  1607 
       
  1608     flags := IdentityDictionary new.
       
  1609 ! !
       
  1610 
  1537 !TagList methodsFor:'private'!
  1611 !TagList methodsFor:'private'!
  1538 
  1612 
  1539 applyFilterToList:aList
  1613 applyFilterToList:aList
  1540     |lcFilter|
  1614     |filters|
  1541 
  1615 
  1542     filter includesMatchCharacters ifTrue:[
  1616     filters := filter splitByAny:',;'.
  1543         lcFilter := filter asLowercase.
  1617     filters size == 1 ifTrue:[
  1544         ^ aList select:[:tag | lcFilter match:tag label caseSensitive:false]
  1618         filter includesMatchCharacters ifFalse:[
  1545     ].
  1619             ^ aList select:[:tag | tag label includesString:filter caseSensitive:false]
  1546     ^ aList select:[:tag | tag label includesString:filter caseSensitive:false]
  1620         ].
  1547 
  1621     ].
  1548     "Modified: / 01-08-2012 / 16:52:02 / cg"
  1622 
       
  1623     ^ aList 
       
  1624         select:[:tag |
       
  1625             filters 
       
  1626                 contains:[:someFilter |
       
  1627                     someFilter includesMatchCharacters ifTrue:[
       
  1628                         someFilter match:tag label caseSensitive:false
       
  1629                     ] ifFalse:[
       
  1630                         tag label includesString:someFilter caseSensitive:false
       
  1631                     ].
       
  1632                 ].
       
  1633         ].
  1549 !
  1634 !
  1550 
  1635 
  1551 getCtagsVersion
  1636 getCtagsVersion
  1552     " parse major and minor version from ctags by operating system command
  1637     " parse major and minor version from ctags by operating system command
  1553       cehck for the 'Exuberant Ctags' string being present
  1638       cehck for the 'Exuberant Ctags' string being present
  1564         inDirectory:nil
  1649         inDirectory:nil
  1565         onError:[:status| false].
  1650         onError:[:status| false].
  1566     string := stream contents.
  1651     string := stream contents.
  1567     index := string findString:'Exuberant Ctags' ifAbsent:[nil].
  1652     index := string findString:'Exuberant Ctags' ifAbsent:[nil].
  1568     index notNil ifTrue:[
  1653     index notNil ifTrue:[
  1569         string := (string copyFrom:(index + ('Exuberant Ctags' size))) asArrayOfSubstrings first.
  1654         string := (string copyFrom:(index + ('Exuberant Ctags' size))) asCollectionOfWords first.
  1570         (string includes:$,) ifTrue:[ string := string copyTo:((string indexOf:$,) - 1)].
  1655         (string includes:$,) ifTrue:[ string := string copyTo:((string indexOf:$,) - 1)].
  1571         indexOfPoint := string indexOf:$. ifAbsent:nil.
  1656         indexOfPoint := string indexOf:$. ifAbsent:nil.
  1572         indexOfPoint notNil ifTrue:[
  1657         indexOfPoint notNil ifTrue:[
  1573             majorVersion := (string copyFrom:1 to:indexOfPoint - 1) asInteger.
  1658             majorVersion := (string copyFrom:1 to:indexOfPoint - 1) asInteger.
  1574             minorVersion := (string copyFrom:indexOfPoint + 1 to:string size) asInteger.
  1659             minorVersion := (string copyFrom:indexOfPoint + 1 to:string size) asInteger.
  1619     ctagsCommand isNil ifTrue:[
  1704     ctagsCommand isNil ifTrue:[
  1620         remoteTarget isNil ifTrue:[
  1705         remoteTarget isNil ifTrue:[
  1621             "/ local use
  1706             "/ local use
  1622             suff := (OperatingSystem isMSWINDOWSlike) ifTrue:'.exe' ifFalse:''.
  1707             suff := (OperatingSystem isMSWINDOWSlike) ifTrue:'.exe' ifFalse:''.
  1623 
  1708 
  1624             ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-5.8/ctags',suff.
  1709             ctagsCommand := 'ctags',suff.
  1625             (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1710             (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1626                 ctagsCommand := fn pathName.
  1711                 ctagsCommand := fn pathName.
  1627                 ctagsIsExCtags := ctagsIsExCtags5x := true.
  1712                 ctagsIsExCtags := ctagsIsExCtags5x := true.
  1628             ] ifFalse:[
  1713             ] ifFalse:[
  1629                 ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-3.2.2/ctags',suff.
  1714                 ctagsCommand := 'bin/ctags',suff.
  1630                 (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1715                 (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1631                     ctagsCommand := fn pathName.
  1716                     ctagsCommand := fn pathName.
  1632                     ctagsIsExCtags := true.
  1717                     ctagsIsExCtags := ctagsIsExCtags5x := true.
  1633                     ctagsIsExCtags5x := false.
       
  1634                 ] ifFalse:[
  1718                 ] ifFalse:[
  1635                     ctagsIsExCtags := nil.
  1719                     ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-5.8/ctags',suff.
  1636                     ctagsIsExCtags5x := nil.
       
  1637                     ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags/ctags',suff.
       
  1638                     (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1720                     (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1639                         ctagsCommand := fn pathName.
  1721                         ctagsCommand := fn pathName.
       
  1722                         ctagsIsExCtags := ctagsIsExCtags5x := true.
  1640                     ] ifFalse:[
  1723                     ] ifFalse:[
  1641                         "/ use systems default ctags command
  1724                         ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-3.2.2/ctags',suff.
  1642                         ctagsCommand := 'ctags'.
  1725                         (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
  1643                     ]
  1726                             ctagsCommand := fn pathName.
       
  1727                             ctagsIsExCtags := true.
       
  1728                             ctagsIsExCtags5x := false.
       
  1729                         ] ifFalse:[
       
  1730                             ctagsIsExCtags := nil.
       
  1731                             ctagsIsExCtags5x := nil.
       
  1732                             ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags/ctags',suff.
       
  1733                             (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
       
  1734                                 ctagsCommand := fn pathName.
       
  1735                             ] ifFalse:[
       
  1736                                 "/ use systems default ctags command
       
  1737                                 ctagsCommand := 'ctags'.
       
  1738                             ]
       
  1739                         ]
       
  1740                     ].
  1644                 ]
  1741                 ]
  1645             ].
  1742             ]
  1646         ] ifFalse:[
  1743         ] ifFalse:[
  1647             "/ cross-development
  1744             "/ cross-development
  1648 "/            target remoteOperatingSystem = 'Linux' ifTrue:[
  1745 "/            target remoteOperatingSystem = 'Linux' ifTrue:[
  1649                 "/ use systems default ctags command
  1746                 "/ use systems default ctags command
  1650                 ctagsCommand := 'ctags'.
  1747                 ctagsCommand := 'ctags'.
  1748                             ] 
  1845                             ] 
  1749                         ] 
  1846                         ] 
  1750                     ] 
  1847                     ] 
  1751                 ] 
  1848                 ] 
  1752             ]. 
  1849             ]. 
  1753             hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m'].
  1850             self hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m'].
  1754             hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ].
  1851             self hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ].
  1755             hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ].
  1852             self hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ].
  1756             hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s'].
  1853             self hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s'].
  1757             hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v'].
  1854             self hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v'].
  1758             hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f'].
  1855             self hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f'].
  1759             hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c'].
  1856             self hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c'].
  1760         ].
  1857         ].
  1761 
  1858 
  1762         isJavaSuffix ifTrue:[
  1859         isJavaSuffix ifTrue:[
  1763             langValue := 'java'.
  1860             langValue := 'java'.
  1764 
  1861 
  1771                     showOnly == #javaClassesAndMethods ifTrue:[
  1868                     showOnly == #javaClassesAndMethods ifTrue:[
  1772                         moreOptions := moreOptions, ' --java-types=mc'
  1869                         moreOptions := moreOptions, ' --java-types=mc'
  1773                     ]
  1870                     ]
  1774                 ]
  1871                 ]
  1775             ]. 
  1872             ]. 
  1776             hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ].
  1873             self hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ].
  1777             hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ].
  1874             self hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ].
  1778             hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ].
  1875             self hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ].
  1779             hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ].
  1876             self hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ].
  1780             hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ].
  1877             self hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ].
  1781         ].
  1878         ].
  1782 
  1879 
  1783         isEiffelSuffix ifTrue:[
  1880         isEiffelSuffix ifTrue:[
  1784             langValue := 'eiffel'.
  1881             langValue := 'eiffel'.
  1785 
  1882 
  1858     "/ regular ctags: assume supports c, c++ only
  1955     "/ regular ctags: assume supports c, c++ only
  1859     isCSuffix ifFalse:[
  1956     isCSuffix ifFalse:[
  1860         ^ nil
  1957         ^ nil
  1861     ].
  1958     ].
  1862 
  1959 
  1863     usingDefaultCTags    := true.
  1960     usingDefaultCTags := true.
  1864 
  1961 
  1865     shellCommand := 'ctags'.
  1962     shellCommand := 'ctags'.
  1866 
  1963 
  1867 "/   "sunos and realIX have no option -s"
  1964 "/   "sunos and realIX have no option -s"
  1868 "/    (OperatingSystem getOSType  = 'linux') ifTrue:[
  1965 "/    (OperatingSystem getOSType  = 'linux') ifTrue:[
  1869 "/        shellCommand := 'ctags -S'
  1966 "/        shellCommand := 'ctags -S'
  1870 "/    ].
  1967 "/    ].
  1871     Transcript showCR:('using default ctags command (not ctags from stx): <', shellCommand, '>').
  1968     Transcript showCR:('TagList [info]: using default ctags command (not ctags from stx): <', shellCommand, '>').
  1872     ctagsCommand := nil. "/ flush - so we will check again.
  1969     ctagsCommand := nil. "/ flush - so we will check again.
  1873 
  1970 
  1874     shellCommand := shellCommand, ' "%1"'.
  1971     shellCommand := shellCommand, ' "%1"'.
  1875     remoteTarget notNil ifTrue:[
  1972     remoteTarget notNil ifTrue:[
  1876         ^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./').
  1973         ^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./').
  2025 
  2122 
  2026     filteredList := (filter isEmptyOrNil or:[rawList isNil])
  2123     filteredList := (filter isEmptyOrNil or:[rawList isNil])
  2027                         ifTrue:[ rawList ]
  2124                         ifTrue:[ rawList ]
  2028                         ifFalse:[ self applyFilterToList:rawList ].
  2125                         ifFalse:[ self applyFilterToList:rawList ].
  2029     filteredList notNil ifTrue:[
  2126     filteredList notNil ifTrue:[
  2030         hideFunctions == true ifTrue:[
  2127         self hideFunctions == true ifTrue:[
  2031             filteredList := filteredList reject:[:tag | tag isFunctionTag].
  2128             filteredList := filteredList reject:[:tag | tag isFunctionTag].
  2032         ] ifFalse:[
  2129         ] ifFalse:[
  2033             showOnly == #functions ifTrue:[
  2130             showOnly == #functions ifTrue:[
  2034                 filteredList := filteredList select:[:tag | tag isFunctionTag].
  2131                 filteredList := filteredList select:[:tag | tag isFunctionOrMethodTag].
  2035             ].
  2132             ].
  2036         ].
  2133         ].
  2037     ].
  2134     ].
  2038     self updateContentsFromFilteredList
  2135     self updateContentsFromFilteredList
  2039 
  2136 
  2041 ! !
  2138 ! !
  2042 
  2139 
  2043 !TagList methodsFor:'queries'!
  2140 !TagList methodsFor:'queries'!
  2044 
  2141 
  2045 bestTagForLine:lineNr 
  2142 bestTagForLine:lineNr 
       
  2143     "find the best tag for a given lineNr in the file"
       
  2144 
       
  2145     ^ self bestTagForLine:lineNr filtering:nil
       
  2146 !
       
  2147 
       
  2148 bestTagForLine:lineNr filtering:tagFilterOrNil
       
  2149     "find the best tag for a given lineNr in the file.
       
  2150      The filter can be used eg. to find only function tags
       
  2151      (i.e. to ignore case and goto labels in C)"
       
  2152 
  2046     |bestTag sortedByLineNumber|
  2153     |bestTag sortedByLineNumber|
  2047 
  2154 
  2048     sortedByLineNumber := self sortedByLineNumber.
  2155     sortedByLineNumber := self sortedByLineNumber.
  2049     self do:[:eachTag |
  2156     self do:[:eachTag |
  2050         eachTag notNil ifTrue:[
  2157         eachTag notNil ifTrue:[
  2051             eachTag lineNumber <= lineNr ifTrue:[
  2158             (tagFilterOrNil isNil or:[tagFilterOrNil value:eachTag]) ifTrue:[
  2052                 bestTag isNil ifTrue:[
  2159                 eachTag lineNumber <= lineNr ifTrue:[
  2053                     bestTag := eachTag.
  2160                     bestTag isNil ifTrue:[
  2054                     "/ sortedByLineNumber ifTrue:[^ eachTag].
  2161                         bestTag := eachTag.
  2055                 ] ifFalse:[
  2162                         "/ sortedByLineNumber ifTrue:[^ eachTag].
  2056                     eachTag lineNumber > bestTag lineNumber ifTrue:[
  2163                     ] ifFalse:[
  2057                         bestTag := eachTag    
  2164                         eachTag lineNumber > bestTag lineNumber ifTrue:[
       
  2165                             bestTag := eachTag    
       
  2166                         ]
  2058                     ]
  2167                     ]
  2059                 ]
  2168                 ].
  2060             ].
  2169             ].
  2061         ].
  2170         ].
  2062     ].
  2171     ].
  2063 
  2172 
  2064     ^ bestTag
  2173     ^ bestTag
  2097 
  2206 
  2098     forceSimpleTagList ifFalse:[
  2207     forceSimpleTagList ifFalse:[
  2099         shellCmd := (self shellCommandFor:aFile pathName).
  2208         shellCmd := (self shellCommandFor:aFile pathName).
  2100         shellCmd notNil ifTrue:[
  2209         shellCmd notNil ifTrue:[
  2101             tagTypesPresent := false.     "/ will be set again, when ctags command provides types
  2210             tagTypesPresent := false.     "/ will be set again, when ctags command provides types
  2102             list := self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory
  2211             list := self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory.
       
  2212             (self class isCSuffix:(aFile suffix)) ifTrue:[
       
  2213                 list addAll:(self additionalCTagsInFile:aFile)
       
  2214             ]
  2103         ].
  2215         ].
  2104     ].
  2216     ].
  2105 
  2217 
  2106     "/ in case ctags could not find anything, try our own, naive fallback (not too bad either)
  2218     "/ in case ctags could not find anything, try our own, naive fallback (not too bad either)
  2107     list isEmptyOrNil ifTrue:[
  2219     list isEmptyOrNil ifTrue:[
  2301     word1 := stream upTo:Character tab.     "/ optional file: (scope)
  2413     word1 := stream upTo:Character tab.     "/ optional file: (scope)
  2302     stream skipSeparators.
  2414     stream skipSeparators.
  2303     word2 := stream upTo:Character tab.     "/ optional class:
  2415     word2 := stream upTo:Character tab.     "/ optional class:
  2304 
  2416 
  2305     (word1 startsWith:'file:') ifTrue:[     "/ file: (scope)
  2417     (word1 startsWith:'file:') ifTrue:[     "/ file: (scope)
  2306         hideStatic == true ifTrue:[^ nil].
  2418         self hideStatic == true ifTrue:[^ nil].
  2307     ].
  2419     ].
  2308 
  2420 
  2309     (word2 startsWith: 'class:') ifTrue:[
  2421     (word2 startsWith: 'class:') ifTrue:[
  2310         className := word2 copyFrom:('class:' size)
  2422         className := word2 copyFrom:('class:' size)
  2311     ] ifFalse:[
  2423     ] ifFalse:[
  2323     tagClass := Tag.
  2435     tagClass := Tag.
  2324     tagClass autoload.
  2436     tagClass autoload.
  2325 
  2437 
  2326     "/ typeCharacter to tag-Class mapping...
  2438     "/ typeCharacter to tag-Class mapping...
  2327     languageMode == #c ifTrue:[
  2439     languageMode == #c ifTrue:[
       
  2440         "/ Transcript showCR:tagType.
  2328         tagType = 'v' ifTrue:[ 
  2441         tagType = 'v' ifTrue:[ 
  2329             hideVariables == true ifTrue:[^ nil].
  2442             self hideVariables == true ifTrue:[^ nil].
  2330             tagClass := Tag::TVariable 
  2443             tagClass := Tag::TVariable 
  2331         ] ifFalse:[ tagType = 'f' ifTrue:[ 
  2444         ] ifFalse:[ tagType = 'f' ifTrue:[ 
  2332             hideFunctions == true ifTrue:[^ nil].
  2445             self hideFunctions == true ifTrue:[^ nil].
  2333             tagClass := Tag::TFunction 
  2446             tagClass := Tag::TFunction 
  2334         ] ifFalse:[ tagType = 'd' ifTrue:[ 
  2447         ] ifFalse:[ tagType = 'd' ifTrue:[ 
  2335             hideDefines == true ifTrue:[^ nil].
  2448             self hideDefines == true ifTrue:[^ nil].
  2336             tagClass := Tag::TMacro 
  2449             tagClass := Tag::TMacro 
  2337         ] ifFalse:[ tagType = 't' ifTrue:[ 
  2450         ] ifFalse:[ tagType = 't' ifTrue:[ 
  2338             hideTypedefs == true ifTrue:[^ nil].
  2451             self hideTypedefs == true ifTrue:[^ nil].
  2339             tagClass := Tag::TTypedef 
  2452             tagClass := Tag::TTypedef 
  2340         ] ifFalse:[ tagType = 'm' ifTrue:[ 
  2453         ] ifFalse:[ tagType = 'm' ifTrue:[ 
  2341             hideStructMembers == true ifTrue:[^ nil].
  2454             self hideStructMembers == true ifTrue:[^ nil].
  2342             tagClass := Tag::TMember
  2455             tagClass := Tag::TMember
  2343         ] ifFalse:[ tagType = 's' ifTrue:[ 
  2456         ] ifFalse:[ tagType = 's' ifTrue:[ 
  2344             hideStructures == true ifTrue:[^ nil].
  2457             self hideStructures == true ifTrue:[^ nil].
  2345             tagClass := Tag::TStruct
  2458             tagClass := Tag::TStruct
  2346         ] ifFalse:[ tagType = 'u' ifTrue:[ 
  2459         ] ifFalse:[ tagType = 'u' ifTrue:[ 
  2347             hideStructures == true ifTrue:[^ nil].
  2460             self hideStructures == true ifTrue:[^ nil].
  2348             tagClass := Tag::TUnion
  2461             tagClass := Tag::TUnion
  2349         ] ifFalse:[ tagType = 'c' ifTrue:[ 
  2462         ] ifFalse:[ tagType = 'c' ifTrue:[ 
  2350             hideClasses == true ifTrue:[^ nil].
  2463             self hideClasses == true ifTrue:[^ nil].
  2351             tagClass := Tag::TClass
  2464             tagClass := Tag::TClass
  2352         ] ifFalse:[ tagType = 'e' ifTrue:[ 
  2465         ] ifFalse:[ tagType = 'e' ifTrue:[ 
  2353             tagClass := Tag::TEnumMember. 
  2466             tagClass := Tag::TEnumMember. 
  2354         ] ifFalse:[ tagType = 'g' ifTrue:[ 
  2467         ] ifFalse:[ tagType = 'g' ifTrue:[ 
  2355             tagClass := Tag::TEnum. 
  2468             tagClass := Tag::TEnum. 
  2358 "/        ] ifFalse:[ tagType = 'p' ifTrue:[ 
  2471 "/        ] ifFalse:[ tagType = 'p' ifTrue:[ 
  2359 "/            tagClass := Tag::TFunctionPrototype
  2472 "/            tagClass := Tag::TFunctionPrototype
  2360 "/        ] ifFalse:[ tagType = 'x' ifTrue:[ 
  2473 "/        ] ifFalse:[ tagType = 'x' ifTrue:[ 
  2361 "/            tagClass := Tag::TExternVariable
  2474 "/            tagClass := Tag::TExternVariable
  2362         ] ifFalse:[ 
  2475         ] ifFalse:[ 
       
  2476             self breakPoint:#cg.
  2363             "/ add more here 
  2477             "/ add more here 
  2364         ]]]]]]]]]]
  2478         ]]]]]]]]]]
  2365     ] ifFalse:[ languageMode == #java ifTrue:[
  2479     ] ifFalse:[ languageMode == #java ifTrue:[
  2366         tagType = 'c' ifTrue:[ 
  2480         tagType = 'c' ifTrue:[ 
  2367             hideJavaClasses == true ifTrue:[^ nil].
  2481             self hideJavaClasses == true ifTrue:[^ nil].
  2368             tagClass := Tag::TClass 
  2482             tagClass := Tag::TClass 
  2369         ] ifFalse:[ tagType = 'm' ifTrue:[ 
  2483         ] ifFalse:[ tagType = 'm' ifTrue:[ 
  2370             hideJavaMethods == true ifTrue:[^ nil].
  2484             self hideJavaMethods == true ifTrue:[^ nil].
  2371             tagClass := Tag::TMethod
  2485             tagClass := Tag::TMethod
  2372         ] ifFalse:[ tagType = 'f' ifTrue:[ 
  2486         ] ifFalse:[ tagType = 'f' ifTrue:[ 
  2373             hideJavaFields == true ifTrue:[^ nil].
  2487             self hideJavaFields == true ifTrue:[^ nil].
  2374             tagClass := Tag::TField
  2488             tagClass := Tag::TField
  2375         ] ifFalse:[ tagType = 'i' ifTrue:[ 
  2489         ] ifFalse:[ tagType = 'i' ifTrue:[ 
  2376             hideJavaInterfaces == true ifTrue:[^ nil].
  2490             self hideJavaInterfaces == true ifTrue:[^ nil].
  2377             tagClass := Tag::TInterface
  2491             tagClass := Tag::TInterface
  2378         ] ifFalse:[ tagType = 'p' ifTrue:[ 
  2492         ] ifFalse:[ tagType = 'p' ifTrue:[ 
  2379             hideJavaPackages == true ifTrue:[^ nil].
  2493             self hideJavaPackages == true ifTrue:[^ nil].
  2380             tagClass := Tag::TPackage
  2494             tagClass := Tag::TPackage
  2381         ] ifFalse:[
  2495         ] ifFalse:[
  2382             "/ add more here */
  2496             "/ add more here */
  2383         ]]]]]
  2497         ]]]]]
  2384     ] ifFalse:[ languageMode == #eiffel ifTrue:[
  2498     ] ifFalse:[ languageMode == #eiffel ifTrue:[
  2385         tagType = 'c' ifTrue:[ 
  2499         tagType = 'c' ifTrue:[ 
  2386             hideClasses == true ifTrue:[^ nil].
  2500             self hideClasses == true ifTrue:[^ nil].
  2387             tagClass := Tag::TClass 
  2501             tagClass := Tag::TClass 
  2388 "/        ] ifFalse:[ tagType = 'f' ifTrue:[ 
  2502 "/        ] ifFalse:[ tagType = 'f' ifTrue:[ 
  2389 "/            tagClass := Tag::TFeature
  2503 "/            tagClass := Tag::TFeature
  2390 "/        ] ifFalse:[ tagType = 'l' ifTrue:[ 
  2504 "/        ] ifFalse:[ tagType = 'l' ifTrue:[ 
  2391 "/            tagClass := Tag::TLocalEntity
  2505 "/            tagClass := Tag::TLocalEntity
  2392         ] ifFalse:[
  2506         ] ifFalse:[
  2393             "/ add more here */
  2507             "/ add more here */
  2394         ]
  2508         ]
  2395     ] ifFalse:[ languageMode == #fortran ifTrue:[
  2509     ] ifFalse:[ languageMode == #fortran ifTrue:[
  2396         tagType = 'f' ifTrue:[ 
  2510         tagType = 'f' ifTrue:[ 
  2397             hideFunctions == true ifTrue:[^ nil].
  2511             self hideFunctions == true ifTrue:[^ nil].
  2398             tagClass := Tag::TFunction 
  2512             tagClass := Tag::TFunction 
  2399         ] ifFalse:[ tagType = 'i' ifTrue:[ 
  2513         ] ifFalse:[ tagType = 'i' ifTrue:[ 
  2400 "/            hideInterfaces == true ifTrue:[^ nil].
  2514 "/            hideInterfaces == true ifTrue:[^ nil].
  2401             tagClass := Tag::TInterface
  2515             tagClass := Tag::TInterface
  2402         ] ifFalse:[ tagType = 't' ifTrue:[ 
  2516         ] ifFalse:[ tagType = 't' ifTrue:[ 
  2403             hideTypedefs == true ifTrue:[^ nil].
  2517             self hideTypedefs == true ifTrue:[^ nil].
  2404             tagClass := Tag::TTypedef 
  2518             tagClass := Tag::TTypedef 
  2405 "/        ] ifFalse:[ tagType = 'l' ifTrue:[ 
  2519 "/        ] ifFalse:[ tagType = 'l' ifTrue:[ 
  2406 "/            tagClass := Tag::TLabel
  2520 "/            tagClass := Tag::TLabel
  2407 "/        ] ifFalse:[ tagType = 'm' ifTrue:[ 
  2521 "/        ] ifFalse:[ tagType = 'm' ifTrue:[ 
  2408 "/            tagClass := Tag::TModule
  2522 "/            tagClass := Tag::TModule
  2466     "Modified: / 05-05-2011 / 15:45:55 / cg"
  2580     "Modified: / 05-05-2011 / 15:45:55 / cg"
  2467 ! !
  2581 ! !
  2468 
  2582 
  2469 !TagList methodsFor:'tag generation - helpers'!
  2583 !TagList methodsFor:'tag generation - helpers'!
  2470 
  2584 
       
  2585 linewiseNaiveTagsInFile:aFilePath using:parseLineBlock
       
  2586     "common helper for naive linewise parsing tags"
       
  2587 
       
  2588     |targets line lineNr s tagOrTagCollection|
       
  2589 
       
  2590     Tag autoload.
       
  2591 
       
  2592     targets := OrderedCollection new.
       
  2593     s := aFilePath asFilename readStream.
       
  2594     s notNil ifTrue:[
       
  2595         s := LineNumberReadStream readingFrom:s.
       
  2596         [s atEnd] whileFalse:[
       
  2597             lineNr := s lineNumber.
       
  2598             line := s nextLine.
       
  2599 
       
  2600             tagOrTagCollection := parseLineBlock value:line value:lineNr.
       
  2601             tagOrTagCollection notNil ifTrue:[
       
  2602                 tagOrTagCollection isCollection ifTrue:[
       
  2603                     targets addAll:tagOrTagCollection
       
  2604                 ] ifFalse:[
       
  2605                     targets add:tagOrTagCollection
       
  2606                 ].
       
  2607             ].
       
  2608         ].
       
  2609         s close
       
  2610     ].
       
  2611     ^ targets
       
  2612 
       
  2613     "Modified: / 08-05-2011 / 10:12:29 / cg"
       
  2614 !
       
  2615 
  2471 plainTextBetweenHTMLElement:startElement andElementWithTag:endTag
  2616 plainTextBetweenHTMLElement:startElement andElementWithTag:endTag
  2472     "applied to an <h1>-tag element, passing '/h1' as endTag,
  2617     "applied to an <h1>-tag element, passing '/h1' as endTag,
  2473      this retrieves the plain text of the headline. Used by the tag list."
  2618      this retrieves the plain text of the headline. Used by the tag list."
  2474 
  2619 
  2475     |el collector hasSpace txt|
  2620     |el collector hasSpace txt|
  2476 
  2621 
  2477     collector := WriteStream on:(String new:100).
  2622     collector := CharacterWriteStream on:(String new:100).
  2478     el := startElement next.
  2623     el := startElement next.
  2479 
  2624 
  2480     hasSpace := true.
  2625     hasSpace := true.
  2481     [ el notNil and:[el tag ~= endTag] ] whileTrue:[
  2626     [ el notNil and:[el tag ~= endTag] ] whileTrue:[
  2482         el isTextElement ifTrue:[
  2627         el isTextElement ifTrue:[
  2517             words := l asCollectionOfWords.
  2662             words := l asCollectionOfWords.
  2518 
  2663 
  2519             words size >= 1 ifTrue:[
  2664             words size >= 1 ifTrue:[
  2520                 w := words first.
  2665                 w := words first.
  2521                 (w endsWith:$:) ifTrue:[
  2666                 (w endsWith:$:) ifTrue:[
  2522                     nm := w copyButLast:1.
  2667                     nm := w copyButLast.
  2523 
  2668 
  2524                     lineNr := s lineNumber - 1.
  2669                     lineNr := s lineNumber - 1.
  2525                     targets add:(Tag::TLabel
  2670                     targets add:(Tag::TLabel
  2526                                     label:nm 
  2671                                     label:nm 
  2527                                     pattern:nil
  2672                                     pattern:nil
  2537     "Created: / 28-09-2012 / 14:45:35 / cg"
  2682     "Created: / 28-09-2012 / 14:45:35 / cg"
  2538 ! !
  2683 ! !
  2539 
  2684 
  2540 !TagList methodsFor:'tag generation - simple'!
  2685 !TagList methodsFor:'tag generation - simple'!
  2541 
  2686 
       
  2687 additionalCTagsInFile:aFilePath
       
  2688     "additional tags, which are not found by the standard ctags utility:
       
  2689         case foo:   - case label tags
       
  2690     "
       
  2691 
       
  2692     |targets line lineNr s caseLabel l|
       
  2693 
       
  2694     self hideLabels ifTrue:[^ #()].
       
  2695     showOnly notNil ifTrue:[^ #()].
       
  2696 
       
  2697     Tag autoload.
       
  2698 
       
  2699     targets := OrderedCollection new.
       
  2700     s := aFilePath asFilename readStream.
       
  2701     s notNil ifTrue:[
       
  2702         s := LineNumberReadStream readingFrom:s.
       
  2703         [s atEnd] whileFalse:[
       
  2704             line := s nextLine withoutSeparators.
       
  2705             ((line startsWith:'case ') and:[line includes:$:]) ifTrue:[
       
  2706                 l := line readStream. 
       
  2707                 l skip:5.
       
  2708                 caseLabel := l upTo:$:.
       
  2709                 lineNr := s lineNumber - 1.
       
  2710                 targets add:(Tag::TCaseLabel
       
  2711                                 label:'case ' allItalic , caseLabel",' <case>' allItalic"
       
  2712                                 pattern:nil
       
  2713                                 type:nil
       
  2714                                 lineNumber:lineNr).
       
  2715             ] ifFalse:[
       
  2716                 (line startsWith:'default:') ifTrue:[
       
  2717                     lineNr := s lineNumber - 1.
       
  2718                     targets add:(Tag::TCaseLabel
       
  2719                                     label:'case ' allItalic, 'default'",' <case>' allItalic"
       
  2720                                     pattern:nil
       
  2721                                     type:nil
       
  2722                                     lineNumber:lineNr).
       
  2723                 ].
       
  2724             ].
       
  2725         ].
       
  2726         s close
       
  2727     ].
       
  2728     ^ targets
       
  2729 !
       
  2730 
  2542 assemblerTagsInFile:aFilePath
  2731 assemblerTagsInFile:aFilePath
  2543     "assembler tags:
  2732     "assembler tags:
  2544      naive, q&d scan for lines matching:
  2733      naive, q&d scan for lines matching:
  2545         <anything>:
  2734         <anything>:
  2546      CAVEAT:
  2735      CAVEAT:
  2553     Tag autoload.
  2742     Tag autoload.
  2554 
  2743 
  2555     targets := OrderedCollection new.
  2744     targets := OrderedCollection new.
  2556     s := aFilePath asFilename readStream.
  2745     s := aFilePath asFilename readStream.
  2557     s notNil ifTrue:[
  2746     s notNil ifTrue:[
  2558         hideLocals := hideLocalLabels ? false.
  2747         hideLocals := self flagNamed:#hideLocalLabels ? false.
  2559         hideLocals2 := hideLocalLabels2 ? false.
  2748         hideLocals2 := self flagNamed:#hideLocalLabels2 ? false.
  2560         hideLocals3 := hideLocalLabels3 ? false.
  2749         hideLocals3 := self flagNamed:#hideLocalLabels3 ? false.
  2561         hideData := hideDataLabels ? false.
  2750         hideData := self flagNamed:#hideDataLabels ? false.
  2562         hideText := hideTextLabels ? false.
  2751         hideText := self flagNamed:#hideTextLabels ? false.
  2563         currentSegment := #text.
  2752         currentSegment := #text.
  2564 
  2753 
  2565         s := LineNumberReadStream readingFrom:s.
  2754         s := LineNumberReadStream readingFrom:s.
  2566         [s atEnd] whileFalse:[
  2755         [s atEnd] whileFalse:[
  2567             lineNr := s lineNumber.
  2756             lineNr := s lineNumber.
  2578                                     (hideLocals3 
  2767                                     (hideLocals3 
  2579                                         and:[ (w startsWith:$L) 
  2768                                         and:[ (w startsWith:$L) 
  2580                                         and:[ (w size > 1) 
  2769                                         and:[ (w size > 1) 
  2581                                         and:[ ((w copyFrom:2 to:(w size-1)) conform:[:c | c isDigit])
  2770                                         and:[ ((w copyFrom:2 to:(w size-1)) conform:[:c | c isDigit])
  2582                                      ]]]) ifFalse:[
  2771                                      ]]]) ifFalse:[
  2583                                         nm := w copyButLast:1.
  2772                                         nm := w copyButLast.
  2584                                         targets add:(Tag::TLabel 
  2773                                         targets add:(Tag::TLabel 
  2585                                                         label:nm 
  2774                                                         label:nm 
  2586                                                         pattern:nil
  2775                                                         pattern:nil
  2587                                                         type:nil
  2776                                                         type:nil
  2588                                                         lineNumber:lineNr).
  2777                                                         lineNumber:lineNr).
  2677         [s atEnd] whileFalse:[
  2866         [s atEnd] whileFalse:[
  2678             lineNr := s lineNumber.
  2867             lineNr := s lineNumber.
  2679             line := s nextLine.
  2868             line := s nextLine.
  2680             l := line withoutSeparators.
  2869             l := line withoutSeparators.
  2681             {
  2870             {
  2682                 { 'function '  . #functions  . hideFunctions . Tag::TFunction } .
  2871                 { 'function '  . #functions  . self hideFunctions . Tag::TFunction } .
  2683                 { 'var '       . #variables  . hideVariables . Tag::TVariable } .
  2872                 { 'var '       . #variables  . self hideVariables . Tag::TVariable } .
  2684                 { 'class '     . #classes    . hideClasses . Tag::TClass      } .
  2873                 { 'class '     . #classes    . self hideClasses . Tag::TClass      } .
  2685                 { 'abstract class '     . #classes    . hideClasses . Tag::TClass      } .
  2874                 { 'abstract class '     . #classes    . self hideClasses . Tag::TClass      } .
  2686                 { 'interface ' . #interfaces . hideDartInterfaces . Tag::TInterface } .
  2875                 { 'interface ' . #interfaces . self hideDartInterfaces . Tag::TInterface } .
  2687                 { 'factory '   . #methods .    hideMethods . Tag::TMethod } .
  2876                 { 'factory '   . #methods .    self hideMethods . Tag::TMethod } .
  2688             } tuplesDo:[:keywordSpace :showOnlyEnum :hideVariableValue :tagType|
  2877             } tuplesDo:[:keywordSpace :showOnlyEnum :hideVariableValue :tagType|
  2689                 (l startsWith:keywordSpace) ifTrue:[
  2878                 (l startsWith:keywordSpace) ifTrue:[
  2690                     (showOnly isNil or:[showOnly == showOnlyEnum]) ifTrue:[
  2879                     (showOnly isNil or:[showOnly == showOnlyEnum]) ifTrue:[
  2691                         hideVariableValue ~~ true ifTrue:[
  2880                         hideVariableValue ~~ true ifTrue:[
  2692                             nm := l copyFrom:(keywordSpace size + 1).
  2881                             nm := l copyFrom:(keywordSpace size + 1).
  2713 
  2902 
  2714 getSimpleTagListFromFile:aFileOrString in:aTempDirectory
  2903 getSimpleTagListFromFile:aFileOrString in:aTempDirectory
  2715     "fallback, if no ctags is present, or if the file is not a c-file.
  2904     "fallback, if no ctags is present, or if the file is not a c-file.
  2716      Implemented here for some other file types (Makefiles)
  2905      Implemented here for some other file types (Makefiles)
  2717     "
  2906     "
  2718     |file lcName pathName suffix|
  2907     |file lcName pathName suffix mime|
  2719 
  2908 
  2720     file := aFileOrString asFilename.
  2909     file := aFileOrString asFilename.
  2721     lcName := file baseName asLowercase.
  2910     lcName := file baseName asLowercase.
  2722     pathName := file pathName.
  2911     pathName := file pathName.
  2723 
  2912 
  2726             ^ self class makeTargetTagsInFile:pathName filter:showOnly
  2915             ^ self class makeTargetTagsInFile:pathName filter:showOnly
  2727         ]
  2916         ]
  2728     ].
  2917     ].
  2729 
  2918 
  2730     suffix := lcName asFilename suffix.
  2919     suffix := lcName asFilename suffix.
  2731 
  2920     mime := TagList tagMimeTypeForFile:file.
  2732     (self class isSmalltalkSuffix:suffix) ifTrue:[
  2921 
       
  2922     ((self class isSmalltalkSuffix:suffix)
       
  2923     or:[(mime ? '') includesString:'smalltalk']) ifTrue:[
  2733         "/ smalltalk tags - simulated
  2924         "/ smalltalk tags - simulated
  2734         ^ self stTagsInFile:pathName in:aTempDirectory
  2925         ^ self stTagsInFile:pathName in:aTempDirectory
  2735     ].
  2926     ].
  2736     (self class isPythonSuffix:suffix) ifTrue:[
  2927     ((self class isPythonSuffix:suffix)
       
  2928     or:[(mime ? '') includesString:'python']) ifTrue:[
  2737         "/ python tags - simulated
  2929         "/ python tags - simulated
  2738         ^ self pythonTagsInFile:pathName
  2930         ^ self pythonTagsInFile:pathName
  2739     ].
  2931     ].
  2740     (self class isPhpSuffix:suffix) ifTrue:[
  2932     ((self class isPhpSuffix:suffix)
       
  2933     or:[(mime ? '') includesString:'php']) ifTrue:[
  2741         "/ php tags - simulated
  2934         "/ php tags - simulated
  2742         ^ self phpTagsInFile:pathName
  2935         ^ self phpTagsInFile:pathName
  2743     ].
  2936     ].
  2744     (self class isLispSuffix:suffix) ifTrue:[
  2937     ((self class isLispSuffix:suffix)
       
  2938     or:[(mime ? '') includesString:'lisp']) ifTrue:[
  2745         "/ lisp tags - simulated
  2939         "/ lisp tags - simulated
  2746         ^ self lispTagsInFile:pathName
  2940         ^ self lispTagsInFile:pathName
  2747     ].
  2941     ].
  2748     (self class isOzSuffix:suffix) ifTrue:[
  2942     ((self class isOzSuffix:suffix)
       
  2943     or:[(mime ? '') includesString:'oz']) ifTrue:[
  2749         "/ oz tags - simulated
  2944         "/ oz tags - simulated
  2750         ^ self ozTagsInFile:pathName
  2945         ^ self ozTagsInFile:pathName
  2751     ].
  2946     ].
  2752     (self class isPrologSuffix:suffix) ifTrue:[
  2947     ((self class isPrologSuffix:suffix)
       
  2948     or:[(mime ? '') includesString:'prolog']) ifTrue:[
  2753         "/ prolog tags - simulated
  2949         "/ prolog tags - simulated
  2754         ^ self prologTagsInFile:pathName
  2950         ^ self prologTagsInFile:pathName
  2755     ].
  2951     ].
  2756     (self class isTCLSuffix:suffix) ifTrue:[
  2952     ((self class isTCLSuffix:suffix)
       
  2953     or:[(mime ? '') includesString:'tcl']) ifTrue:[
  2757         "/ tcl tags - simulated
  2954         "/ tcl tags - simulated
  2758         ^ self tclTagsInFile:pathName
  2955         ^ self tclTagsInFile:pathName
  2759     ].
  2956     ].
  2760     (self class isAssemblerSuffix:suffix) ifTrue:[
  2957     ((self class isAssemblerSuffix:suffix)
       
  2958     or:[(mime ? '') includesString:'assembler']) ifTrue:[
  2761         "/ assembler tags - simulated
  2959         "/ assembler tags - simulated
  2762         ^ self assemblerTagsInFile:pathName
  2960         ^ self assemblerTagsInFile:pathName
  2763     ].
  2961     ].
  2764     (self class isRubySuffix:suffix) ifTrue:[
  2962     ((self class isRubySuffix:suffix)
       
  2963     or:[(mime ? '') includesString:'ruby']) ifTrue:[
  2765         "/ ruby tags - simulated
  2964         "/ ruby tags - simulated
  2766         ^ self rubyTagsInFile:pathName
  2965         ^ self rubyTagsInFile:pathName
  2767     ].
  2966     ].
  2768     (self class isYaccSuffix:suffix) ifTrue:[
  2967     ((self class isYaccSuffix:suffix)
       
  2968     or:[(mime ? '') includesString:'yacc']) ifTrue:[
  2769         "/ yacc tags - simulated
  2969         "/ yacc tags - simulated
  2770         ^ self yaccTagsInFile:pathName
  2970         ^ self yaccTagsInFile:pathName
  2771     ].
  2971     ].
  2772     (self class isJavaScriptSuffix:suffix) ifTrue:[
  2972     ((self class isJavaScriptSuffix:suffix)
       
  2973     or:[(mime ? '') includesString:'javascript']) ifTrue:[
  2773         "/ js tags - simulated
  2974         "/ js tags - simulated
  2774         ^ self javaScriptTagsInFile:pathName
  2975         ^ self javaScriptTagsInFile:pathName
  2775     ].
  2976     ].
  2776     (self class isDartSuffix:suffix) ifTrue:[
  2977     ((self class isDartSuffix:suffix)
       
  2978     or:[(mime ? '') includesString:'dart']) ifTrue:[
  2777         "/ dart tags - simulated
  2979         "/ dart tags - simulated
  2778         ^ self dartTagsInFile:pathName
  2980         ^ self dartTagsInFile:pathName
  2779     ].
  2981     ].
  2780 
  2982     ((self class isLuaSuffix:suffix)
  2781     (self class isHTMLSuffix:suffix) ifTrue:[
  2983     or:[(mime ? '') includesString:'lua']) ifTrue:[
       
  2984         "/ lua tags - simulated
       
  2985         ^ self luaTagsInFile:pathName
       
  2986     ].
       
  2987 
       
  2988     ((self class isHTMLSuffix:suffix)
       
  2989     or:[(mime ? '') includesString:'html']) ifTrue:[
  2782         "/ html tags - simulated
  2990         "/ html tags - simulated
  2783         ^ self htmlTagsInFile:pathName
  2991         ^ self htmlTagsInFile:pathName
  2784     ].
  2992     ].
  2785     (self class isBatchSuffix:suffix) ifTrue:[
  2993     ((self class isBatchSuffix:suffix)
       
  2994     or:[(mime ? '') includesString:'batch']) ifTrue:[
  2786         "/ batch tags - simulated
  2995         "/ batch tags - simulated
  2787         ^ self batchTagsInFile:pathName
  2996         ^ self batchTagsInFile:pathName
  2788     ].
  2997     ].
  2789 
  2998 
  2790     "/ could add more here ...
  2999     "/ could add more here ...
  2818             line := s nextLine.
  3027             line := s nextLine.
  2819             line := line withoutSeparators.
  3028             line := line withoutSeparators.
  2820             l := line asLowercase.
  3029             l := line asLowercase.
  2821 
  3030 
  2822             #(
  3031             #(
  2823                 'textarea'      hideHTMLTextArea
  3032                 'textarea'      hideHTMLTextArea    nil
  2824                 'input'         hideHTMLInput
  3033                 'input'         hideHTMLInput       nil
  2825                 'table'         hideHTMLTable
  3034                 'table'         hideHTMLTable       nil
  2826                 'script'        hideHTMLScript  
  3035                 'script'        hideHTMLScript      nil
  2827                 'form'          hideHTMLForm  
  3036                 'form'          hideHTMLForm        nil
  2828                 'a'             nil  
  3037                 'a'             nil                 anchors
  2829                 'h1'            hideHTMLHeaders  
  3038                 'h1'            hideHTMLHeaders     headlines
  2830                 'h2'            hideHTMLHeaders  
  3039                 'h2'            hideHTMLHeaders     headlines
  2831                 'h3'            hideHTMLHeaders  
  3040                 'h3'            hideHTMLHeaders     headlines
  2832                 'h4'            hideHTMLHeaders  
  3041                 'h4'            hideHTMLHeaders     headlines
  2833                 'h5'            hideHTMLHeaders  
  3042                 'h5'            hideHTMLHeaders     headlines
  2834                 'h6'            hideHTMLHeaders  
  3043                 'h6'            hideHTMLHeaders     headlines
  2835             ) pairWiseDo:[:nm :hideInstVarName|
  3044             ) inGroupsOf:3 do:[:nm :hideInstVarName :thisType|
  2836                 |type hideHolder idx tagText doc markup label text markupName markupType
  3045                 |type hideHolder idx tagText doc markup label text markupName markupType
  2837                  isHeader|
  3046                  isHeader|
  2838 
  3047 
  2839                 type := hideHolder := nil.
  3048                 type := hideHolder := nil.
  2840 
  3049 
  2841                 idx := l indexOfSubCollection:('<',nm).
  3050                 idx := l indexOfSubCollection:('<',nm).
  2842                 idx ~~ 0 ifTrue:[
  3051                 idx ~~ 0 ifTrue:[
  2843                     hideHolder := hideInstVarName isNil 
  3052                     hideHolder := hideInstVarName isNil 
  2844                                     ifTrue:[ false ]
  3053                                     ifTrue:[ false ]
  2845                                     ifFalse:[ self instVarNamed:hideInstVarName ].
  3054                                     ifFalse:[ self flagNamed:hideInstVarName ].
  2846 
  3055 
  2847                     tagText := line copyFrom:idx.
  3056                     tagText := line copyFrom:idx.
  2848                     doc := HTMLParser new parseText:tagText.
  3057                     doc := HTMLParser new parseText:tagText.
  2849                     markup := doc markup.
  3058                     markup := doc markup.
  2850                     markupName := markup name.
  3059                     markupName := markup name.
  2889                                 ]
  3098                                 ]
  2890                             ]
  3099                             ]
  2891                         ].
  3100                         ].
  2892                     ].
  3101                     ].
  2893 
  3102 
  2894                     hideHolder value ~~ true ifTrue:[
  3103                     (showOnly isNil or:[thisType isNil or:[showOnly == thisType]]) ifTrue:[
  2895                         tag := type 
  3104                         hideHolder value ~~ true ifTrue:[
  2896                                     label:label 
  3105                             tag := type 
  2897                                     pattern:nil
  3106                                         label:label 
  2898                                     type:nil
  3107                                         pattern:nil
  2899                                     lineNumber:lineNr.
  3108                                         type:nil
  2900                         targets add:tag.
  3109                                         lineNumber:lineNr.
       
  3110                             targets add:tag.
       
  3111                         ]
  2901                     ]
  3112                     ]
  2902                 ].
  3113                 ].
  2903             ].
  3114             ].
  2904         ].
  3115         ].
  2905         s close
  3116         s close
  2927         [s atEnd] whileFalse:[
  3138         [s atEnd] whileFalse:[
  2928             lineNr := s lineNumber.
  3139             lineNr := s lineNumber.
  2929             line := s nextLine.
  3140             line := s nextLine.
  2930             l := line withoutSeparators.
  3141             l := line withoutSeparators.
  2931 
  3142 
       
  3143             (l = 'function') ifTrue:[
       
  3144                 l := l , ' ' , (s nextLine withoutSeparators).
       
  3145             ].
  2932             (l startsWith:'function ') ifTrue:[
  3146             (l startsWith:'function ') ifTrue:[
  2933                 (showOnly isNil or:[showOnly == #functions]) ifTrue:[
  3147                 (showOnly isNil or:[showOnly == #functions]) ifTrue:[
  2934                     hideFunctions ~~ true ifTrue:[
  3148                     self hideFunctions ~~ true ifTrue:[
  2935                         nm := l copyFrom:('function ' size + 1).
  3149                         nm := l copyFrom:('function ' size + 1).
  2936                         nm := nm copyTo:(nm 
  3150                         nm := nm copyTo:(nm 
  2937                                             findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] 
  3151                                             findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] 
  2938                                             ifNone:nm size+1)-1.
  3152                                             ifNone:nm size+1)-1.
  2939                         targets add:(Tag::TFunction 
  3153                         targets add:(Tag::TFunction 
  2944                     ]
  3158                     ]
  2945                 ]
  3159                 ]
  2946             ] ifFalse:[
  3160             ] ifFalse:[
  2947                 (l startsWith:'var ') ifTrue:[
  3161                 (l startsWith:'var ') ifTrue:[
  2948                     (showOnly isNil or:[showOnly == #variables]) ifTrue:[
  3162                     (showOnly isNil or:[showOnly == #variables]) ifTrue:[
  2949                         hideVariables ~~ true ifTrue:[
  3163                         self hideVariables ~~ true ifTrue:[
  2950                             nm := l copyFrom:('var ' size + 1).
  3164                             nm := l copyFrom:('var ' size + 1).
  2951                             nm := nm copyTo:(nm 
  3165                             nm := nm copyTo:(nm 
  2952                                                 findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] 
  3166                                                 findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not] 
  2953                                                 ifNone:nm size+1)-1.
  3167                                                 ifNone:nm size+1)-1.
  2954                             targets add:(Tag::TVariable 
  3168                             targets add:(Tag::TVariable 
  2956                                             pattern:nil
  3170                                             pattern:nil
  2957                                             type:nil
  3171                                             type:nil
  2958                                             lineNumber:lineNr).
  3172                                             lineNumber:lineNr).
  2959                         ].
  3173                         ].
  2960                     ].
  3174                     ].
       
  3175                 ] ifFalse:[
       
  3176                     ((l includesString:'=function') or:[(l includesString:'= function')]) ifTrue:[
       
  3177                         (showOnly isNil or:[showOnly == #functions]) ifTrue:[
       
  3178                             self hideFunctions ~~ true ifTrue:[
       
  3179                                 nm := l copyTo:((l indexOf:$=) - 1). nm := nm withoutSeparators.
       
  3180                                 targets add:(Tag::TFunction 
       
  3181                                                 label:nm 
       
  3182                                                 pattern:nil
       
  3183                                                 type:nil
       
  3184                                                 lineNumber:lineNr).
       
  3185                             ].
       
  3186                         ].
       
  3187                     ].
  2961                 ].
  3188                 ].
  2962             ]
  3189             ]
  2963         ].
  3190         ].
  2964         s close
  3191         s close
  2965     ].
  3192     ].
  2968     "Created: / 28-06-2010 / 12:44:25 / cg"
  3195     "Created: / 28-06-2010 / 12:44:25 / cg"
  2969     "Modified: / 08-05-2011 / 10:39:55 / cg"
  3196     "Modified: / 08-05-2011 / 10:39:55 / cg"
  2970 !
  3197 !
  2971 
  3198 
  2972 lispTagFromLine:line lineNr:lineNr
  3199 lispTagFromLine:line lineNr:lineNr
  2973     "lisp tags:
  3200     "lisp/scheme tags:
  2974      naive, q&d scan for lines starting with (not syntax-aware):
  3201      naive, q&d scan for lines starting with (not syntax-aware):
  2975         (define ...
  3202         (define ...
  2976         (defun ...
  3203         (defun ...
  2977         (defvar ...
  3204         (defvar ...
  2978         (defmacro ...
  3205         (defmacro ...
  2986         (constant ...
  3213         (constant ...
  2987         (defconstant ...
  3214         (defconstant ...
  2988         ;;; more        documentation
  3215         ;;; more        documentation
  2989     "
  3216     "
  2990 
  3217 
  2991     |l nm words def arg inParens rest|
  3218     |l nm words def inParens rest|
  2992 
  3219 
  2993     l := line withoutSeparators.
  3220     l := line withoutSeparators.
  2994 
  3221 
  2995     (l startsWith:'(') ifFalse:[  
  3222     (l startsWith:'(') ifFalse:[  
  2996         (showOnly notNil and:[showOnly ~~ #documentation]) ifTrue:[^ nil].
  3223         (showOnly notNil and:[showOnly ~~ #documentation]) ifTrue:[^ nil].
  2997         hideDocumentation == true ifTrue:[ ^ nil ].
  3224         self hideDocumentation == true ifTrue:[ ^ nil ].
  2998 
  3225 
  2999         (l startsWith:';;;') ifFalse:[^ nil].
  3226         (l startsWith:';;;') ifFalse:[^ nil].
  3000         rest := (l copyFrom:4) withoutSeparators.
  3227         rest := (l copyFrom:4) withoutSeparators.
  3001         rest isEmpty ifTrue:[^ nil].
  3228         rest isEmpty ifTrue:[^ nil].
       
  3229         (rest conform:[:ch | ch == $;]) ifTrue:[^ nil].
  3002         ^ Tag::TDocumentation 
  3230         ^ Tag::TDocumentation 
  3003                         label:(rest colorizeAllWith:(Color blue "grey")) 
  3231                         label:(rest colorizeAllWith:(Color blue "grey")) 
  3004                         pattern:nil
  3232                         pattern:nil
  3005                         type:nil
  3233                         type:nil
  3006                         lineNumber:lineNr.
  3234                         lineNumber:lineNr.
  3013     nm := words second.
  3241     nm := words second.
  3014     (inParens := nm startsWith:'(') ifTrue:[
  3242     (inParens := nm startsWith:'(') ifTrue:[
  3015         nm := nm copyFrom:2.
  3243         nm := nm copyFrom:2.
  3016     ] ifFalse:[
  3244     ] ifFalse:[
  3017         nm := nm upTo:$(.    "/ in case it is (define foo() - without space after name
  3245         nm := nm upTo:$(.    "/ in case it is (define foo() - without space after name
  3018         arg := l copyFrom:(l indexOf:$( startingAt:2 ifAbsent:2).   
       
  3019         (inParens := nm startsWith:'(') ifTrue:[
  3246         (inParens := nm startsWith:'(') ifTrue:[
  3020             nm := nm copyFrom:2.
  3247             nm := nm copyFrom:2.
  3021         ].
  3248         ].
  3022     ].
  3249     ].
  3023     (nm endsWith:')') ifTrue:[
  3250     (nm endsWith:')') ifTrue:[
  3024         nm := nm copyButLast:1
  3251         nm := nm copyButLast
  3025     ].
  3252     ].
  3026 
  3253 
  3027     def = 'defun' ifTrue:[
  3254     def = 'defun' ifTrue:[
  3028         (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
  3255         (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
  3029         hideFunctions == true ifTrue:[ ^ nil ].
  3256         self hideFunctions == true ifTrue:[ ^ nil ].
  3030         ^ Tag::TFunction 
  3257         ^ Tag::TFunction 
  3031                         label:nm 
  3258                         label:nm 
  3032                         pattern:nil
  3259                         pattern:nil
  3033                         type:nil
  3260                         type:nil
  3034                         lineNumber:lineNr.
  3261                         lineNumber:lineNr.
  3035     ].
  3262     ].
  3036     def = 'define' ifTrue:[             "/ scheme
  3263     def = 'define' ifTrue:[             "/ scheme
  3037         inParens ifTrue:[
  3264         inParens ifTrue:[
  3038             (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
  3265             (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
  3039             hideFunctions == true ifTrue:[ ^ nil ].
  3266             self hideFunctions == true ifTrue:[ ^ nil ].
  3040             ^ Tag::TFunction 
  3267             ^ Tag::TFunction 
  3041                             label:nm 
  3268                             label:nm 
  3042                             pattern:nil
  3269                             pattern:nil
  3043                             type:nil
  3270                             type:nil
  3044                             lineNumber:lineNr.
  3271                             lineNumber:lineNr.
  3045         ] ifFalse:[
  3272         ] ifFalse:[
       
  3273             "/ check for (define name (lambda ...
       
  3274             "/ and (define name (macro ...
       
  3275             (words size > 2
       
  3276               and:[ words third startsWith:'(' ]) ifTrue:[
       
  3277                 (words third = '(' and:[words size > 3]) ifTrue:[
       
  3278                     def := words fourth
       
  3279                 ] ifFalse:[
       
  3280                     def := words third copyFrom:2.
       
  3281                 ].
       
  3282                 def = 'lambda' ifTrue:[
       
  3283                     (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
       
  3284                     self hideFunctions == true ifTrue:[ ^ nil ].
       
  3285                     ^ Tag::TFunction 
       
  3286                                     label:nm 
       
  3287                                     pattern:nil
       
  3288                                     type:nil
       
  3289                                     lineNumber:lineNr.
       
  3290                 ].
       
  3291                 def = 'macro' ifTrue:[
       
  3292                     (showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil].
       
  3293                     self hideLispMacros == true ifTrue:[ ^ nil ].
       
  3294                     ^ Tag::TLispMacro 
       
  3295                                     label:nm 
       
  3296                                     pattern:nil
       
  3297                                     type:nil
       
  3298                                     lineNumber:lineNr.
       
  3299                 ].
       
  3300             ].
  3046             (showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
  3301             (showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
  3047             hideVariables == true ifTrue:[ ^ nil ].
  3302             self hideVariables == true ifTrue:[ ^ nil ].
  3048             ^ Tag::TVariable 
  3303             ^ Tag::TVariable 
  3049                             label:nm 
  3304                             label:nm 
  3050                             pattern:nil
  3305                             pattern:nil
  3051                             type:nil
  3306                             type:nil
  3052                             lineNumber:lineNr.
  3307                             lineNumber:lineNr.
  3054         ^ nil
  3309         ^ nil
  3055     ].
  3310     ].
  3056 
  3311 
  3057     def = 'defvar' ifTrue:[
  3312     def = 'defvar' ifTrue:[
  3058         (showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
  3313         (showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
  3059         hideVariables == true ifTrue:[ ^ nil ].
  3314         self hideVariables == true ifTrue:[ ^ nil ].
  3060         ^ Tag::TVariable 
  3315         ^ Tag::TVariable 
  3061                         label:nm 
  3316                         label:nm 
  3062                         pattern:nil
  3317                         pattern:nil
  3063                         type:nil
  3318                         type:nil
  3064                         lineNumber:lineNr.
  3319                         lineNumber:lineNr.
  3065     ].
  3320     ].
  3066     def = 'set' ifTrue:[
  3321     def = 'set' ifTrue:[
  3067         hideVariables == true ifTrue:[ ^ nil ].
  3322         self hideVariables == true ifTrue:[ ^ nil ].
  3068         ^ Tag::TVariable 
  3323         ^ Tag::TVariable 
  3069                         label:nm 
  3324                         label:nm 
  3070                         pattern:nil
  3325                         pattern:nil
  3071                         type:nil
  3326                         type:nil
  3072                         lineNumber:lineNr.
  3327                         lineNumber:lineNr.
  3073     ].
  3328     ].
  3074     (def = 'defconstant' or:[def = 'constant']) ifTrue:[
  3329     (def = 'defconstant' or:[def = 'constant']) ifTrue:[
  3075         (showOnly notNil and:[showOnly ~~ #constants]) ifTrue:[^ nil].
  3330         (showOnly notNil and:[showOnly ~~ #constants]) ifTrue:[^ nil].
  3076         hideLispConstants == true ifTrue:[ ^ nil ].
  3331         self hideLispConstants == true ifTrue:[ ^ nil ].
  3077         ^ Tag::TLispConstant 
  3332         ^ Tag::TLispConstant 
  3078                         label:nm 
  3333                         label:nm 
  3079                         pattern:nil
  3334                         pattern:nil
  3080                         type:nil
  3335                         type:nil
  3081                         lineNumber:lineNr.
  3336                         lineNumber:lineNr.
  3082     ].
  3337     ].
  3083     (def = 'mac' or:[def = 'defmacro' or:[def = 'define-macro']]) ifTrue:[
  3338     (def = 'mac' or:[def = 'defmacro' or:[def = 'define-macro']]) ifTrue:[
  3084         (showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil].
  3339         (showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil].
  3085         hideLispMacros == true ifTrue:[ ^ nil ].
  3340         self hideLispMacros == true ifTrue:[ ^ nil ].
  3086         ^ Tag::TLispMacro 
  3341         ^ Tag::TLispMacro 
  3087                         label:nm 
  3342                         label:nm 
  3088                         pattern:nil
  3343                         pattern:nil
  3089                         type:nil
  3344                         type:nil
  3090                         lineNumber:lineNr.
  3345                         lineNumber:lineNr.
  3091     ].
  3346     ].
  3092     (def = 'defclass' or:[def = 'define-class']) ifTrue:[
  3347     (def = 'defclass' or:[def = 'define-class']) ifTrue:[
  3093         (showOnly notNil and:[showOnly ~~ #classes]) ifTrue:[^ nil].
  3348         (showOnly notNil and:[showOnly ~~ #classes]) ifTrue:[^ nil].
  3094         hideClasses == true ifTrue:[ ^ nil ].
  3349         self hideClasses == true ifTrue:[ ^ nil ].
  3095         ^ Tag::TClass 
  3350         ^ Tag::TClass 
  3096                         label:nm 
  3351                         label:nm 
  3097                         pattern:nil
  3352                         pattern:nil
  3098                         type:nil
  3353                         type:nil
  3099                         lineNumber:lineNr.
  3354                         lineNumber:lineNr.
  3100     ].
  3355     ].
  3101     (def = 'defmethod' or:[def = 'define-method' or:[def = 'define-generic']]) ifTrue:[
  3356     (def = 'defmethod' or:[def = 'define-method' or:[def = 'define-generic']]) ifTrue:[
  3102         (showOnly notNil and:[showOnly ~~ #methods]) ifTrue:[^ nil].
  3357         (showOnly notNil and:[showOnly ~~ #methods]) ifTrue:[^ nil].
  3103         hideLispMethods == true ifTrue:[ ^ nil ].
  3358         self hideLispMethods == true ifTrue:[ ^ nil ].
  3104         ^ Tag::TMethod 
  3359         ^ Tag::TMethod 
  3105                         label:nm 
  3360                         label:nm 
  3106                         pattern:nil
  3361                         pattern:nil
  3107                         type:nil
  3362                         type:nil
  3108                         lineNumber:lineNr.
  3363                         lineNumber:lineNr.
  3109     ].
  3364     ].
  3110     (def = 'defpackage') ifTrue:[
  3365     (def = 'defpackage') ifTrue:[
  3111         hideLispMethods == true ifTrue:[ ^ nil ].
  3366         self hideLispMethods == true ifTrue:[ ^ nil ].
  3112         ^ Tag::TPackage 
  3367         ^ Tag::TPackage 
  3113                         label:nm 
  3368                         label:nm 
  3114                         pattern:nil
  3369                         pattern:nil
  3115                         type:nil
  3370                         type:nil
  3116                         lineNumber:lineNr.
  3371                         lineNumber:lineNr.
  3117     ].
  3372     ].
  3118     def = 'eval-when' ifTrue:[
  3373     def = 'eval-when' ifTrue:[
  3119         hideLispEvaluations == true ifTrue:[ ^ nil ].
  3374         self hideLispEvaluations == true ifTrue:[ ^ nil ].
  3120         ^ Tag::TLispEval 
  3375         ^ Tag::TLispEval 
  3121                         label:arg 
  3376                         label:nm 
  3122                         pattern:nil
  3377                         pattern:nil
  3123                         type:nil
  3378                         type:nil
  3124                         lineNumber:lineNr.
  3379                         lineNumber:lineNr.
  3125     ].
  3380     ].
  3126     def = 'defstruct' ifTrue:[
  3381     def = 'defstruct' ifTrue:[
  3127         hideStructures == true ifTrue:[ ^ nil ].
  3382         self hideStructures == true ifTrue:[ ^ nil ].
  3128         ^ Tag::TStruct 
  3383         ^ Tag::TStruct 
  3129                         label:nm 
  3384                         label:nm 
  3130                         pattern:nil
  3385                         pattern:nil
  3131                         type:nil
  3386                         type:nil
  3132                         lineNumber:lineNr.
  3387                         lineNumber:lineNr.
  3133     ].
  3388     ].
  3134     (def startsWith:'def') ifTrue:[
  3389     (def startsWith:'def') ifTrue:[
  3135         (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
  3390         (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
  3136         hideFunctions == true ifTrue:[ ^ nil ].
  3391         self hideFunctions == true ifTrue:[ ^ nil ].
  3137         ^ Tag::TFunction 
  3392         ^ Tag::TFunction 
  3138                         label:nm 
  3393                         label:nm 
  3139                         pattern:nil
  3394                         pattern:nil
  3140                         type:nil
  3395                         type:nil
  3141                         lineNumber:lineNr.
  3396                         lineNumber:lineNr.
  3162         (constant ...
  3417         (constant ...
  3163         (defconstant ...
  3418         (defconstant ...
  3164         ;;; moretext     documentation
  3419         ;;; moretext     documentation
  3165     "
  3420     "
  3166 
  3421 
  3167     |targets line lineNr s tag|
  3422     ^ self
  3168 
  3423         linewiseNaiveTagsInFile:aFilePath 
  3169     Tag autoload.
  3424         using:[:line :lineNr |
  3170 
  3425                 self lispTagFromLine:line lineNr:lineNr
  3171     targets := OrderedCollection new.
  3426               ]
  3172     s := aFilePath asFilename readStream.
  3427 
  3173     s notNil ifTrue:[
  3428     "Modified: / 08-05-2011 / 10:12:29 / cg"
  3174         s := LineNumberReadStream readingFrom:s.
  3429 !
  3175         [s atEnd] whileFalse:[
  3430 
  3176             lineNr := s lineNumber.
  3431 luaTagFromLine:line lineNr:lineNr
  3177             line := s nextLine.
  3432     "lua tags:
  3178 
  3433      naive, q&d scan for lines starting with (not syntax-aware):
  3179             tag := self lispTagFromLine:line lineNr:lineNr.
  3434         local function ...
  3180             tag notNil ifTrue:[
  3435     "
  3181                 targets add:tag
  3436 
  3182             ].
  3437     |l nm words def isLocal|
       
  3438 
       
  3439     l := line withoutSeparators.
       
  3440 
       
  3441     (l startsWith:'--') ifTrue:[^ nil].     "/ comment  
       
  3442 
       
  3443     words := l splitByAny:(' (),',Character tab).
       
  3444     words size >= 2 ifFalse:[^ nil].
       
  3445 
       
  3446     (isLocal := words first = 'local') ifTrue:[ words := words copyFrom:2 ].
       
  3447     words size <= 2 ifTrue:[ ^ nil ]. 
       
  3448     def := words first.
       
  3449     nm := words second.
       
  3450 
       
  3451     def = 'function' ifTrue:[
       
  3452         (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
       
  3453         self hideFunctions == true ifTrue:[ ^ nil ].
       
  3454         ^ Tag::TFunction 
       
  3455                         label:nm 
       
  3456                         pattern:nil
       
  3457                         type:nil
       
  3458                         lineNumber:lineNr.
       
  3459     ].
       
  3460 
       
  3461     isLocal ifTrue:[
       
  3462         (words includes:'=') ifTrue:[
       
  3463             words := words copyTo:(words indexOf:'=')-1
  3183         ].
  3464         ].
  3184         s close
  3465         ^ words 
  3185     ].
  3466             collect:[:eachVar |
  3186     ^ targets
  3467                 Tag::TVariable 
  3187 
  3468                             label:eachVar 
  3188     "Modified: / 08-05-2011 / 10:12:29 / cg"
  3469                             pattern:nil
       
  3470                             type:nil
       
  3471                             lineNumber:lineNr.
       
  3472             ]
       
  3473             as:Array.
       
  3474     ].
       
  3475 
       
  3476     ^ nil
       
  3477 !
       
  3478 
       
  3479 luaTagsInFile:aFilePath
       
  3480     "lua tags:
       
  3481      naive, q&d scan for lines starting with (not syntax-aware):
       
  3482         local function ...
       
  3483     "
       
  3484 
       
  3485     ^ self
       
  3486         linewiseNaiveTagsInFile:aFilePath 
       
  3487         using:[:line :lineNr |
       
  3488                 self luaTagFromLine:line lineNr:lineNr
       
  3489               ]
       
  3490 !
       
  3491 
       
  3492 ozTagFromLine:line lineNr:lineNr
       
  3493     "oz tags:
       
  3494      naive, q&d scan for lines starting with:
       
  3495         fun { name ...
       
  3496     "
       
  3497 
       
  3498     |l nm lineStream kwLen skipBrace type hideHolder|
       
  3499 
       
  3500     l := line withoutSeparators.
       
  3501 
       
  3502     kwLen := nil.
       
  3503     skipBrace := false.
       
  3504 
       
  3505     (l startsWith:'class') ifTrue:[
       
  3506         kwLen := 5.
       
  3507         type := Tag::TClass.
       
  3508         hideHolder := self hideOzClasses.
       
  3509     ].
       
  3510     (l startsWith:'meth') ifTrue:[
       
  3511         kwLen := 4.
       
  3512         type := Tag::TMethod.
       
  3513         hideHolder := self hideOzMethods.
       
  3514     ].
       
  3515     (l startsWith:'fun') ifTrue:[
       
  3516         kwLen := 3.
       
  3517         skipBrace := true.
       
  3518         type := Tag::TFunction.
       
  3519         hideHolder := self hideOzFunctions.
       
  3520     ].
       
  3521     (l startsWith:'proc') ifTrue:[
       
  3522         kwLen := 4.
       
  3523         skipBrace := true.
       
  3524         type := Tag::TFunction.
       
  3525         hideHolder := self hideOzFunctions.
       
  3526     ].
       
  3527     hideHolder value ~~ true ifTrue:[
       
  3528         kwLen notNil ifTrue:[
       
  3529             lineStream := l readStream.
       
  3530             lineStream skip:kwLen; skipSeparators.
       
  3531 
       
  3532             (skipBrace not or:[lineStream peek = ${ ]) ifTrue:[
       
  3533                 skipBrace ifTrue:[lineStream skip:1; skipSeparators].  
       
  3534                 nm := lineStream upToElementForWhich:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not].
       
  3535                 (nm notEmpty and:[nm first isLetterOrUnderline]) ifTrue:[    
       
  3536                     ^ type 
       
  3537                                     label:nm 
       
  3538                                     pattern:nil
       
  3539                                     type:nil
       
  3540                                     lineNumber:lineNr.
       
  3541                 ]
       
  3542             ]
       
  3543         ].
       
  3544     ].
       
  3545     ^ nil
  3189 !
  3546 !
  3190 
  3547 
  3191 ozTagsInFile:aFilePath
  3548 ozTagsInFile:aFilePath
  3192     "oz tags:
  3549     "oz tags:
  3193      naive, q&d scan for lines starting with:
  3550      naive, q&d scan for lines starting with:
  3194         fun { name ...
  3551         fun { name ...
  3195     "
  3552     "
  3196 
  3553 
  3197     |targets line l lineNr nm s tag lineStream kwLen skipBrace type hideHolder|
  3554     ^ self
  3198 
  3555         linewiseNaiveTagsInFile:aFilePath 
  3199     Tag autoload.
  3556         using:[:line :lineNr |
  3200 
  3557                 self ozTagFromLine:line lineNr:lineNr
  3201     targets := OrderedCollection new.
  3558               ]
  3202     s := aFilePath asFilename readStream.
  3559 !
  3203     s notNil ifTrue:[
  3560 
  3204         s := LineNumberReadStream readingFrom:s.
  3561 phpTagFromLine:line lineNr:lineNr
  3205         [s atEnd] whileFalse:[
  3562     "php tags:
  3206             lineNr := s lineNumber.
  3563      naive, q&d scan for lines starting with:
  3207             line := s nextLine.
  3564         var ...
  3208             l := line withoutSeparators.
  3565         class ...
  3209 
  3566         function ...
  3210             kwLen := nil.
  3567     "
  3211             skipBrace := false.
  3568 
  3212 
  3569     |l nm lineStream|
  3213             (l startsWith:'class') ifTrue:[
  3570 
  3214                 kwLen := 5.
  3571     l := line withoutSeparators.
  3215                 type := Tag::TClass.
  3572     (l startsWith:'public ') ifTrue:[ l := (l copyFrom:'public ' size + 1) withoutSeparators ].
  3216                 hideHolder := hideOzClasses.
  3573     (l startsWith:'private ') ifTrue:[ l := (l copyFrom:'private ' size + 1) withoutSeparators ].
       
  3574 
       
  3575     (l startsWith:'var ') ifTrue:[
       
  3576         lineStream := (l copyFrom:'var ' size) readStream.
       
  3577         lineStream skipSeparators.
       
  3578         lineStream peek == $$ ifTrue:[
       
  3579             lineStream next.
       
  3580             nm := lineStream 
       
  3581                     nextMatching:[:c | c isLetter] 
       
  3582                     thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
       
  3583             ^ (Tag::TVariable 
       
  3584                         label:nm 
       
  3585                         pattern:nil
       
  3586                         type:nil
       
  3587                         lineNumber:lineNr).
       
  3588         ]
       
  3589     ] ifFalse:[
       
  3590         ((l startsWith:'class ') or:[l startsWith:'Class '])ifTrue:[
       
  3591             lineStream := (l copyFrom:'class ' size) readStream.
       
  3592             lineStream skipSeparators.
       
  3593             nm := lineStream 
       
  3594                     nextMatching:[:c | c isLetter] 
       
  3595                     thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
       
  3596             ^ (Tag::TClass 
       
  3597                             label:nm 
       
  3598                             pattern:nil
       
  3599                             type:nil
       
  3600                             lineNumber:lineNr).
       
  3601         ] ifFalse:[
       
  3602             ((l startsWith:'function ') or:[l startsWith:'Function ']) ifTrue:[
       
  3603                 lineStream := (l copyFrom:'function ' size) readStream.
       
  3604                 lineStream skipSeparators.
       
  3605                 nm := lineStream 
       
  3606                         nextMatching:[:c | c isLetter or:[c == $_]] 
       
  3607                         thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
       
  3608                  ^ (Tag::TFunction
       
  3609                                 label:nm 
       
  3610                                 pattern:nil
       
  3611                                 type:nil
       
  3612                                 lineNumber:lineNr).
  3217             ].
  3613             ].
  3218             (l startsWith:'meth') ifTrue:[
       
  3219                 kwLen := 4.
       
  3220                 type := Tag::TMethod.
       
  3221                 hideHolder := hideOzMethods.
       
  3222             ].
       
  3223             (l startsWith:'fun') ifTrue:[
       
  3224                 kwLen := 3.
       
  3225                 skipBrace := true.
       
  3226                 type := Tag::TFunction.
       
  3227                 hideHolder := hideOzFunctions.
       
  3228             ].
       
  3229             (l startsWith:'proc') ifTrue:[
       
  3230                 kwLen := 4.
       
  3231                 skipBrace := true.
       
  3232                 type := Tag::TFunction.
       
  3233                 hideHolder := hideOzFunctions.
       
  3234             ].
       
  3235             hideHolder value ~~ true ifTrue:[
       
  3236                 kwLen notNil ifTrue:[
       
  3237                     lineStream := l readStream.
       
  3238                     lineStream skip:kwLen; skipSeparators.
       
  3239 
       
  3240                     (skipBrace not or:[lineStream peek = ${ ]) ifTrue:[
       
  3241                         skipBrace ifTrue:[lineStream skip:1; skipSeparators].  
       
  3242                         nm := lineStream upToMatching:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not].
       
  3243                         (nm notEmpty and:[nm first isLetter or:[nm first = $_]]) ifTrue:[    
       
  3244                             tag := type 
       
  3245                                             label:nm 
       
  3246                                             pattern:nil
       
  3247                                             type:nil
       
  3248                                             lineNumber:lineNr.
       
  3249                             targets add:tag.
       
  3250                         ]
       
  3251                     ]
       
  3252                 ].
       
  3253             ]
       
  3254         ].
  3614         ].
  3255         s close
  3615     ].
  3256     ].
  3616     ^ nil
  3257     ^ targets
       
  3258 !
  3617 !
  3259 
  3618 
  3260 phpTagsInFile:aFilePath
  3619 phpTagsInFile:aFilePath
  3261     "php tags:
  3620     "php tags:
  3262      naive, q&d scan for lines starting with:
  3621      naive, q&d scan for lines starting with:
  3263         var ...
  3622         var ...
  3264         class ...
  3623         class ...
  3265         function ...
  3624         function ...
  3266     "
  3625     "
  3267 
  3626 
  3268     |targets line l lineNr nm s lineStream|
  3627     ^ self
  3269 
  3628         linewiseNaiveTagsInFile:aFilePath 
  3270     Tag autoload.
  3629         using:[:line :lineNr |
  3271 
  3630                 self phpTagFromLine:line lineNr:lineNr
  3272     targets := OrderedCollection new.
  3631               ]
  3273     s := aFilePath asFilename readStream.
  3632 !
  3274     s notNil ifTrue:[
  3633 
  3275         s := LineNumberReadStream readingFrom:s.
  3634 prologTagFromLine:line lineNr:lineNr
  3276         [s atEnd] whileFalse:[
  3635     "prolog tags:
  3277             lineNr := s lineNumber.
  3636      naive, q&d scan for lines matching:
  3278             line := s nextLine.
  3637         <anything> :-
  3279             l := line withoutSeparators.
  3638     "
  3280 
  3639 
  3281             (l startsWith:'var ') ifTrue:[
  3640     |l nm|
  3282                 lineStream := (l copyFrom:4) readStream.
  3641 
  3283                 lineStream skipSeparators.
  3642     l := line withoutSeparators.
  3284                 lineStream peek == $$ ifTrue:[
  3643 
  3285                     lineStream next.
  3644     (l includesString:':-') ifTrue:[
  3286                     nm := lineStream 
  3645         (l startsWith:':-') ifFalse:[
  3287                             nextMatching:[:c | c isLetter] 
  3646             nm := l copyTo:(l indexOfSubCollection:':-').
  3288                             thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
  3647             ^ (Tag::TPrologClause 
  3289                     targets add:(Tag::TVariable 
  3648                             label:nm 
  3290                                 label:nm 
  3649                             pattern:nil
  3291                                 pattern:nil
  3650                             type:nil
  3292                                 type:nil
  3651                             lineNumber:lineNr).
  3293                                 lineNumber:lineNr).
  3652         ]
  3294                 ]
  3653     ].
  3295             ] ifFalse:[
  3654     ^ nil
  3296                 (l startsWith:'class ') ifTrue:[
       
  3297                     lineStream := (l copyFrom:6) readStream.
       
  3298                     lineStream skipSeparators.
       
  3299                     nm := lineStream 
       
  3300                             nextMatching:[:c | c isLetter] 
       
  3301                             thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
       
  3302                     targets add:(Tag::TClass 
       
  3303                                     label:nm 
       
  3304                                     pattern:nil
       
  3305                                     type:nil
       
  3306                                     lineNumber:lineNr).
       
  3307                 ] ifFalse:[
       
  3308                     (l startsWith:'function ') ifTrue:[
       
  3309                         lineStream := (l copyFrom:9) readStream.
       
  3310                         lineStream skipSeparators.
       
  3311                         nm := lineStream 
       
  3312                                 nextMatching:[:c | c isLetter] 
       
  3313                                 thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
       
  3314                         targets add:(Tag::TFunction
       
  3315                                         label:nm 
       
  3316                                         pattern:nil
       
  3317                                         type:nil
       
  3318                                         lineNumber:lineNr).
       
  3319                     ].
       
  3320                 ].
       
  3321             ].
       
  3322         ].
       
  3323         s close
       
  3324     ].
       
  3325     ^ targets
       
  3326 !
  3655 !
  3327 
  3656 
  3328 prologTagsInFile:aFilePath
  3657 prologTagsInFile:aFilePath
  3329     "prolog tags:
  3658     "prolog tags:
  3330      naive, q&d scan for lines matching:
  3659      naive, q&d scan for lines matching:
  3331         <anything> :-
  3660         <anything> :-
  3332     "
  3661     "
  3333 
  3662 
  3334     |targets line l lineNr nm s|
  3663     ^ self
  3335 
  3664         linewiseNaiveTagsInFile:aFilePath 
  3336     Tag autoload.
  3665         using:[:line :lineNr |
  3337 
  3666                 self prologTagFromLine:line lineNr:lineNr
  3338     targets := OrderedCollection new.
  3667               ]
  3339     s := aFilePath asFilename readStream.
       
  3340     s notNil ifTrue:[
       
  3341         s := LineNumberReadStream readingFrom:s.
       
  3342         [s atEnd] whileFalse:[
       
  3343             lineNr := s lineNumber.
       
  3344             line := s nextLine.
       
  3345             l := line withoutSeparators.
       
  3346 
       
  3347             (l includesString:':-') ifTrue:[
       
  3348                 (l startsWith:':-') ifFalse:[
       
  3349                     nm := l copyTo:(l indexOfSubCollection:':-').
       
  3350                     targets add:(Tag::TPrologClause 
       
  3351                                     label:nm 
       
  3352                                     pattern:nil
       
  3353                                     type:nil
       
  3354                                     lineNumber:lineNr).
       
  3355                 ]
       
  3356             ]
       
  3357         ].
       
  3358         s close
       
  3359     ].
       
  3360     ^ targets
       
  3361 
       
  3362 
       
  3363 
       
  3364 
       
  3365 
       
  3366 !
  3668 !
  3367 
  3669 
  3368 pythonTagsInFile:aFilePath
  3670 pythonTagsInFile:aFilePath
  3369     "python tags:
  3671     "python tags:
  3370      naive, q&d scan for lines matching
  3672      naive, q&d scan for lines matching
  3403                     (l endsWith:':') ifTrue:[
  3705                     (l endsWith:':') ifTrue:[
  3404                         nm := l copyFrom:7 to:(l size - 1).
  3706                         nm := l copyFrom:7 to:(l size - 1).
  3405                         nm := nm withoutSeparators.
  3707                         nm := nm withoutSeparators.
  3406                         (showOnly ~~ #pythonFunctions
  3708                         (showOnly ~~ #pythonFunctions
  3407                         and:[showOnly ~~ #pythonMethods]) ifTrue:[
  3709                         and:[showOnly ~~ #pythonMethods]) ifTrue:[
  3408                             hidePythonClasses ~~ true ifTrue:[
  3710                             self hidePythonClasses ~~ true ifTrue:[
  3409                                 targets add:(Tag::TClass 
  3711                                 targets add:(Tag::TClass 
  3410                                                 label:nm 
  3712                                                 label:nm 
  3411                                                 pattern:nil
  3713                                                 pattern:nil
  3412                                                 type:nil
  3714                                                 type:nil
  3413                                                 lineNumber:lineNr).
  3715                                                 lineNumber:lineNr).
  3424                             nm := nm withoutSeparators.
  3726                             nm := nm withoutSeparators.
  3425 
  3727 
  3426                             inClass size > 0 ifTrue:[
  3728                             inClass size > 0 ifTrue:[
  3427                                 (showOnly ~~ #pythonFunctions
  3729                                 (showOnly ~~ #pythonFunctions
  3428                                 and:[showOnly ~~ #pythonClasses]) ifTrue:[
  3730                                 and:[showOnly ~~ #pythonClasses]) ifTrue:[
  3429                                     hidePythonMethods ~~ true ifTrue:[
  3731                                     self hidePythonMethods ~~ true ifTrue:[
  3430                                         nm := inClass first , '.' , nm.
  3732                                         nm := inClass first , '.' , nm.
  3431                                         targets add:(Tag::TMethod 
  3733                                         targets add:(Tag::TMethod 
  3432                                                         label:nm 
  3734                                                         label:nm 
  3433                                                         pattern:nil
  3735                                                         pattern:nil
  3434                                                         type:nil
  3736                                                         type:nil
  3436                                     ]
  3738                                     ]
  3437                                 ]
  3739                                 ]
  3438                             ] ifFalse:[
  3740                             ] ifFalse:[
  3439                                 (showOnly ~~ #pythonClasses
  3741                                 (showOnly ~~ #pythonClasses
  3440                                 and:[showOnly ~~ #pythonMethods]) ifTrue:[
  3742                                 and:[showOnly ~~ #pythonMethods]) ifTrue:[
  3441                                     hidePythonFunctions ~~ true ifTrue:[
  3743                                     self hidePythonFunctions ~~ true ifTrue:[
  3442                                         targets add:(Tag::TFunction 
  3744                                         targets add:(Tag::TFunction 
  3443                                                         label:nm 
  3745                                                         label:nm 
  3444                                                         pattern:nil
  3746                                                         pattern:nil
  3445                                                         type:nil
  3747                                                         type:nil
  3446                                                         lineNumber:lineNr).
  3748                                                         lineNumber:lineNr).
  3457     ^ targets
  3759     ^ targets
  3458 
  3760 
  3459     "Modified: / 08-05-2011 / 10:39:10 / cg"
  3761     "Modified: / 08-05-2011 / 10:39:10 / cg"
  3460 !
  3762 !
  3461 
  3763 
       
  3764 rubyTagFromLine:line lineNr:lineNr
       
  3765     "ruby tags:
       
  3766      naive, q&d scan for lines matching:
       
  3767         def any
       
  3768     "
       
  3769 
       
  3770     |l nm|
       
  3771 
       
  3772     l := line withoutSeparators.
       
  3773 
       
  3774     (l startsWith:'def ') ifTrue:[
       
  3775         nm := l copyFrom:5.
       
  3776         ^ (Tag::TFunction 
       
  3777                         label:nm 
       
  3778                         pattern:nil
       
  3779                         type:nil
       
  3780                         lineNumber:lineNr).
       
  3781     ] ifFalse:[
       
  3782         (l startsWith:'class ') ifTrue:[
       
  3783             self hideClasses == true ifFalse:[
       
  3784                 nm := l copyFrom:6.
       
  3785                 ^ (Tag::TClass 
       
  3786                                 label:nm 
       
  3787                                 pattern:nil
       
  3788                                 type:nil
       
  3789                                 lineNumber:lineNr).
       
  3790             ]
       
  3791         ].
       
  3792     ].
       
  3793     ^ nil
       
  3794 
       
  3795     "Modified: / 08-05-2011 / 10:38:44 / cg"
       
  3796 !
       
  3797 
  3462 rubyTagsInFile:aFilePath
  3798 rubyTagsInFile:aFilePath
  3463     "ruby tags:
  3799     "ruby tags:
  3464      naive, q&d scan for lines matching:
  3800      naive, q&d scan for lines matching:
  3465         def any
  3801         def any
  3466     "
  3802     "
  3467 
  3803 
  3468     |targets line l lineNr nm s|
  3804     ^ self
  3469 
  3805         linewiseNaiveTagsInFile:aFilePath 
  3470     Tag autoload.
  3806         using:[:line :lineNr |
  3471 
  3807                 self rubyTagFromLine:line lineNr:lineNr
  3472     targets := OrderedCollection new.
  3808               ]
  3473     s := aFilePath asFilename readStream.
       
  3474     s notNil ifTrue:[
       
  3475         s := LineNumberReadStream readingFrom:s.
       
  3476         [s atEnd] whileFalse:[
       
  3477             lineNr := s lineNumber.
       
  3478             line := s nextLine.
       
  3479             l := line withoutSeparators.
       
  3480 
       
  3481             (l startsWith:'def ') ifTrue:[
       
  3482                 nm := l copyFrom:5.
       
  3483                 targets add:(Tag::TFunction 
       
  3484                                 label:nm 
       
  3485                                 pattern:nil
       
  3486                                 type:nil
       
  3487                                 lineNumber:lineNr).
       
  3488             ] ifFalse:[
       
  3489                 (l startsWith:'class ') ifTrue:[
       
  3490                     hideClasses == true ifFalse:[
       
  3491                         nm := l copyFrom:6.
       
  3492                         targets add:(Tag::TClass 
       
  3493                                         label:nm 
       
  3494                                         pattern:nil
       
  3495                                         type:nil
       
  3496                                         lineNumber:lineNr).
       
  3497                     ]
       
  3498                 ].
       
  3499             ].
       
  3500         ].
       
  3501         s close
       
  3502     ].
       
  3503     ^ targets
       
  3504 
  3809 
  3505     "Modified: / 08-05-2011 / 10:38:44 / cg"
  3810     "Modified: / 08-05-2011 / 10:38:44 / cg"
  3506 !
  3811 !
  3507 
  3812 
  3508 stTagsInFile:aFilePath in:aTempDirectory
  3813 stTagsInFile:aFilePath in:aTempDirectory
  3522         s skipSeparators.
  3827         s skipSeparators.
  3523 
  3828 
  3524         "/ new interface: block-arg to #changesFromStream:do: gets 3 args
  3829         "/ new interface: block-arg to #changesFromStream:do: gets 3 args
  3525         [
  3830         [
  3526             ChangeSet::InvalidChangeChunkError handle:[:ex |
  3831             ChangeSet::InvalidChangeChunkError handle:[:ex |
  3527                 Dialog warn:('Error while processing changes - skipping: ' , aFilePath asFilename pathName).
  3832                 Dialog warn:('TagList [info]: Error while processing changes in "%1":\\%2' withCRs
       
  3833                                 bindWith:aFilePath asFilename pathName
       
  3834                                 with: ex description).
  3528             ] do:[
  3835             ] do:[
  3529                 ChangeSet changesFromStream:s do:[:aChange :lNr :pos|
  3836                 ChangeSet changesFromStream:s do:[:aChange :lNr :pos|
  3530                     aChange isClassDefinitionChange ifTrue:[
  3837                     aChange isClassDefinitionChange ifTrue:[
  3531                         hideClasses == true ifFalse:[
  3838                         self hideClasses == true ifFalse:[
  3532                             targets add:(Tag::TClass 
  3839                             targets add:(Tag::TClass 
  3533                                         label:(aChange className) 
  3840                                         label:(aChange className) 
  3534                                         pattern:('/subclass:')
  3841                                         pattern:('/subclass:')
  3535                                         type:nil
  3842                                         type:nil
  3536                                         lineNumber:lNr).
  3843                                         lineNumber:lNr).
  3537                         ]
  3844                         ]
  3538                     ] ifFalse:[
  3845                     ] ifFalse:[
  3539                         aChange isMethodChange ifTrue:[
  3846                         aChange isMethodChange ifTrue:[
  3540                             hideMethods == true ifFalse:[
  3847                             self hideMethods == true ifFalse:[
  3541                                 targets add:((Tag::TMethod
  3848                                 targets add:((Tag::TMethod
  3542                                             label:(aChange selector) 
  3849                                             label:(aChange selector) 
  3543                                             pattern:('/^' , aChange selector)
  3850                                             pattern:('/^' , aChange selector)
  3544                                             type:nil
  3851                                             type:nil
  3545                                             lineNumber:lNr)
  3852                                             lineNumber:lNr)
  3583     ^ targets
  3890     ^ targets
  3584 
  3891 
  3585     "Created: / 05-01-2012 / 10:56:26 / cg"
  3892     "Created: / 05-01-2012 / 10:56:26 / cg"
  3586 !
  3893 !
  3587 
  3894 
       
  3895 tclTagFromLine:line lineNr:lineNr
       
  3896     "tcl tags:
       
  3897      naive, q&d scan for lines matching:
       
  3898         proc any
       
  3899     "
       
  3900 
       
  3901     |l nm words|
       
  3902 
       
  3903     l := line withoutSeparators.
       
  3904 
       
  3905     (l startsWith:'proc ') ifTrue:[
       
  3906         nm := l withoutPrefix:'proc '.
       
  3907         ^(Tag::TFunction 
       
  3908                         label:nm 
       
  3909                         pattern:nil
       
  3910                         type:nil
       
  3911                         lineNumber:lineNr).
       
  3912     ] ifFalse:[ (l startsWith:'tixWidgetClass ') ifTrue:[
       
  3913         nm := l copyFrom:'tixWidgetClass ' size + 1.
       
  3914         (nm endsWith:'{') ifTrue:[
       
  3915             nm := (nm copyButLast) withoutSeparators.
       
  3916         ].
       
  3917         ^(Tag::TClass 
       
  3918                         label:nm 
       
  3919                         pattern:nil
       
  3920                         type:nil
       
  3921                         lineNumber:lineNr).
       
  3922     ] ifFalse:[ (l startsWith:'set ') ifTrue:[
       
  3923         self hideVariables ~~ true ifTrue:[
       
  3924             words := l asCollectionOfWords.
       
  3925             words size >= 2 ifTrue:[
       
  3926                 nm := words second.
       
  3927                 ^(Tag::TVariable 
       
  3928                                 label:nm 
       
  3929                                 pattern:nil
       
  3930                                 type:nil
       
  3931                                 lineNumber:lineNr).
       
  3932         ]
       
  3933     ]]]].
       
  3934     ^ nil
       
  3935 !
       
  3936 
  3588 tclTagsInFile:aFilePath
  3937 tclTagsInFile:aFilePath
  3589     "tcl tags:
  3938     "tcl tags:
  3590      naive, q&d scan for lines matching:
  3939      naive, q&d scan for lines matching:
  3591         proc any
  3940         proc any
  3592     "
  3941     "
  3593 
  3942 
  3594     |targets line l lineNr nm s words|
  3943     ^ self
  3595 
  3944         linewiseNaiveTagsInFile:aFilePath 
  3596     Tag autoload.
  3945         using:[:line :lineNr |
  3597 
  3946                 self tclTagFromLine:line lineNr:lineNr
  3598     targets := OrderedCollection new.
  3947               ]
  3599     s := aFilePath asFilename readStream.
       
  3600     s notNil ifTrue:[
       
  3601         s := LineNumberReadStream readingFrom:s.
       
  3602         [s atEnd] whileFalse:[
       
  3603             lineNr := s lineNumber.
       
  3604             line := s nextLine.
       
  3605             l := line withoutSeparators.
       
  3606 
       
  3607             (l startsWith:'proc ') ifTrue:[
       
  3608                 nm := l withoutPrefix:'proc '.
       
  3609                 targets add:(Tag::TFunction 
       
  3610                                 label:nm 
       
  3611                                 pattern:nil
       
  3612                                 type:nil
       
  3613                                 lineNumber:lineNr).
       
  3614             ] ifFalse:[ (l startsWith:'tixWidgetClass ') ifTrue:[
       
  3615                 nm := l copyFrom:'tixWidgetClass ' size + 1.
       
  3616                 (nm endsWith:'{') ifTrue:[
       
  3617                     nm := (nm copyButLast:1) withoutSeparators.
       
  3618                 ].
       
  3619                 targets add:(Tag::TClass 
       
  3620                                 label:nm 
       
  3621                                 pattern:nil
       
  3622                                 type:nil
       
  3623                                 lineNumber:lineNr).
       
  3624             ] ifFalse:[ (l startsWith:'set ') ifTrue:[
       
  3625                 hideVariables value ~~ true ifTrue:[
       
  3626                     words := l asCollectionOfWords.
       
  3627                     words size >= 2 ifTrue:[
       
  3628                         nm := words second.
       
  3629                         targets add:(Tag::TVariable 
       
  3630                                         label:nm 
       
  3631                                         pattern:nil
       
  3632                                         type:nil
       
  3633                                         lineNumber:lineNr).
       
  3634                 ]
       
  3635             ]]]].
       
  3636         ].
       
  3637         s close
       
  3638     ].
       
  3639     ^ targets
       
  3640 !
  3948 !
  3641 
  3949 
  3642 yaccTagsInFile:aFilePath
  3950 yaccTagsInFile:aFilePath
  3643     "yacc tags:
  3951     "yacc tags:
  3644      naive, q&d scan for lines matching:
  3952      naive, q&d scan for lines matching:
  3685 ! !
  3993 ! !
  3686 
  3994 
  3687 !TagList class methodsFor:'documentation'!
  3995 !TagList class methodsFor:'documentation'!
  3688 
  3996 
  3689 version
  3997 version
  3690     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.38 2013-10-15 01:30:27 cg Exp $'
  3998     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
  3691 !
  3999 !
  3692 
  4000 
  3693 version_CVS
  4001 version_CVS
  3694     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.38 2013-10-15 01:30:27 cg Exp $'
  4002     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
  3695 !
       
  3696 
       
  3697 version_HG
       
  3698 
       
  3699     ^ '$Changeset: <not expanded> $'
       
  3700 !
  4003 !
  3701 
  4004 
  3702 version_SVN
  4005 version_SVN
  3703     ^ '$Id: Tools__TagList.st,v 1.38 2013-10-15 01:30:27 cg Exp $'
  4006     ^ '$Id: Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
  3704 ! !
  4007 ! !
  3705 
  4008