--- a/Tools__TagList.st Sun Jan 12 23:30:25 2014 +0000
+++ b/Tools__TagList.st Wed Apr 01 10:38:01 2015 +0100
@@ -15,20 +15,8 @@
List subclass:#TagList
instanceVariableNames:'rawList filteredList filter tagsValidForFile sortCriteria groupBy
- showOnly hideStatic hideStructMembers hideClasses hideMethods
- hideDefines hideTypedefs hideVariables hideStructures
- hideFunctions hideFunctionProtoTypes hideJavaClasses
- hideJavaMethods hideJavaInterfaces hideJavaFields
- hideJavaPackages hideDartClasses hideDartMethods
- hideDartInterfaces hideDartFields hideDartPackages hideLispMacros
- hideLispEvaluations hideLispMethods hideLispConstants
- hideLocalLabels hideLocalLabels2 hideDataLabels hideTextLabels
- tagTypesPresent hidePythonClasses hidePythonMethods
- hidePythonFunctions hideOzClasses hideOzMethods hideOzFunctions
- hideHTMLTextArea hideHTMLInput hideHTMLTable hideHTMLScript
- hideHTMLForm hideHTMLHeaders usingDefaultCTags ctagsCommand
- ctagsIsExCtags ctagsIsExCtags5x hideDocumentation remoteTarget
- hideLocalLabels3'
+ showOnly flags tagTypesPresent usingDefaultCTags ctagsCommand
+ ctagsIsExCtags ctagsIsExCtags5x remoteTarget'
classVariableNames:'Sorted CachedTagListsPerFile DefaultSortCriteria DefaultShowOnly
TagsSuffixes DefaultGroupBy'
poolDictionaries:''
@@ -63,7 +51,7 @@
"
! !
-!TagList class methodsFor:'accessing'!
+!TagList class methodsFor:'accessing - suffixes'!
tagsSuffixes
"flush with:
@@ -75,12 +63,12 @@
TagsSuffixes := IdentityDictionary new.
TagsSuffixes at:#'text/asm' put:#( 's' 'asm' ).
- TagsSuffixes at:#'text/c' put:#( 'c' 'h' 'ci' 'hi' 'sc').
+ TagsSuffixes at:#'text/c' put:#( 'c' 'h' 'ci' 'hi' 'sc' 'sth').
TagsSuffixes at:#'text/cpp' put:#( 'cc' 'cpp' 'cxx' 'c++' 'hxx' 'hpp' 'h++').
TagsSuffixes at:#'text/eiffel' put:#( 'e' 'eif' ).
TagsSuffixes at:#'text/fortran' put:#( 'f' 'for' 'ftn' 'f77' 'f90' ).
TagsSuffixes at:#'text/html' put:#( 'htm' 'html').
- TagsSuffixes at:#'text/java' put:#( 'java' 'jav').
+ TagsSuffixes at:#'text/java' put:#( 'java' 'jav' 'j').
TagsSuffixes at:#'text/javaScript' put:#( 'js' ).
TagsSuffixes at:#'text/javascript' put:#( 'js' ).
TagsSuffixes at:#'application/x-javascript' put:#( 'js' ).
@@ -94,6 +82,7 @@
TagsSuffixes at:#'text/lisp-arc' put:#( 'arc' ).
TagsSuffixes at:#'text/scheme' put:#( 'scm' 'ss' 'brg').
TagsSuffixes at:#'text/oz' put:#( 'oz').
+ TagsSuffixes at:#'text/lua' put:#( 'lua').
TagsSuffixes at:#'text/smalltalk' put:#( 'st' ).
TagsSuffixes at:#'text/tcl' put:#( 'tcl' ).
TagsSuffixes at:#'text/ruby' put:#( 'rb' ).
@@ -201,6 +190,12 @@
^ self tagsSuffixes at:#'text/java'
!
+luaSuffixes
+ "returns a list of supported lua-suffixes
+ "
+ ^ self tagsSuffixes at:#'text/lua'
+!
+
makeFilePatterns
"returns a list of makefile match patterns
"
@@ -289,6 +284,10 @@
"Created: / 28-09-2012 / 14:47:43 / cg"
!
+isCOrCPlusPlusSuffix:suffix
+ ^ (self isCSuffix:suffix) or:[self isCPlusPlusSuffix:suffix]
+!
+
isCPlusPlusSuffix:suffix
^ self isSuffix:suffix in:self cPlusPlusSuffixes
!
@@ -341,6 +340,10 @@
"Modified: / 21-10-2011 / 09:31:30 / cg"
!
+isLuaSuffix:suffix
+ ^ self isSuffix:suffix in:self luaSuffixes
+!
+
isMakefileName:fileName
|lcName|
@@ -416,7 +419,7 @@
aFile isNil ifTrue:[^ nil].
file := aFile asFilename.
- suff := aFile asFilename suffix.
+ suff := file suffix.
suff size ~~ 0 ifTrue:[
suff := suff asLowercase.
@@ -440,9 +443,12 @@
].
self tagsSuffixes keysAndValuesDo:[:mimeType :suffixes|
- (suffixes includes:suff) ifTrue:[ ^ mimeType ]
+ (suffixes includes:suff) ifTrue:[
+ ^ mimeType
+ ]
].
- ^ nil
+ ^ aFile asFilename mimeTypeOfContents
+ "/ ^ nil
! !
!TagList class methodsFor:'tag generation'!
@@ -475,6 +481,7 @@
tagList := self new.
tagList showOnly:nil.
tagList fromFile:aFilename in:aTempDirectory.
+ tagList do:[:eachTag | eachTag fileName:aFilename].
CachedTagListsPerFile at:aFilename put:(CachedTags new tagList:tagList; tagTimestamp:fileTime; yourself).
^ tagList
@@ -575,6 +582,19 @@
!TagList methodsFor:'accessing-filters'!
+anchorsOnly
+ ^ showOnly == #anchors
+!
+
+anchorsOnly:aBoolean
+ showOnly := DefaultShowOnly := nil.
+ aBoolean ifTrue:[
+ showOnly := "DefaultShowOnly :=" #anchors
+ ].
+
+ "Created: / 08-05-2011 / 10:11:39 / cg"
+!
+
classesFunctionsAndVariablesOnly
^ showOnly == #classesFunctionsAndVariables
@@ -691,6 +711,14 @@
"Modified: / 05-05-2011 / 14:43:04 / cg"
!
+flagNamed:aSymbol
+ ^ flags at:aSymbol ifAbsent:false
+!
+
+flagNamed:aSymbol put:aBoolean
+ flags at:aSymbol put:aBoolean
+!
+
functionsAndVariablesOnly
^ showOnly == #functionsAndVariables
@@ -721,436 +749,465 @@
"Modified: / 05-05-2011 / 15:22:03 / cg"
!
+headlinesOnly
+ ^ showOnly == #headlines
+!
+
+headlinesOnly:aBoolean
+ showOnly := DefaultShowOnly := nil.
+ aBoolean ifTrue:[
+ showOnly := "DefaultShowOnly :=" #headlines
+ ].
+!
+
hideClasses
- ^ hideClasses ? false
+ ^ self flagNamed:#hideClasses
!
hideClasses:aBoolean
- hideClasses := aBoolean.
+ self flagNamed:#hideClasses put:aBoolean
"Modified: / 05-05-2011 / 15:22:08 / cg"
!
hideDartClasses
- ^ hideDartClasses ? false
+ ^ self flagNamed:#hideDartClasses
!
hideDartClasses:aBoolean
- hideDartClasses := aBoolean.
+ self flagNamed:#hideDartClasses put:aBoolean
"Modified: / 05-05-2011 / 15:22:32 / cg"
!
hideDartFields
- ^ hideDartFields ? false
+ ^ self flagNamed:#hideDartFields
!
hideDartFields:aBoolean
- hideDartFields := aBoolean.
+ self flagNamed:#hideDartFields put:aBoolean
"Modified: / 05-05-2011 / 15:22:34 / cg"
!
hideDartInterfaces
- ^ hideDartInterfaces ? false
+ ^ self flagNamed:#hideDartInterfaces
!
hideDartInterfaces:aBoolean
- hideDartInterfaces := aBoolean.
+ self flagNamed:#hideDartInterfaces put:aBoolean
"Modified: / 05-05-2011 / 15:22:38 / cg"
!
hideDartMethods
- ^ hideDartMethods ? false
+ ^ self flagNamed:#hideDartMethods
!
hideDartMethods:aBoolean
- hideDartMethods := aBoolean.
+ self flagNamed:#hideDartMethods put:aBoolean.
"Modified: / 05-05-2011 / 15:22:40 / cg"
!
hideDartPackages
- ^ hideDartPackages ? false
+ ^ self flagNamed:#hideDartPackages
!
hideDartPackages:aBoolean
- hideDartPackages := aBoolean.
+ self flagNamed:#hideDartPackages put:aBoolean.
"Modified: / 05-05-2011 / 15:22:41 / cg"
!
hideDataLabels
- ^ hideDataLabels ? false
+ ^ self flagNamed:#hideDataLabels
!
hideDataLabels:aBoolean
- hideDataLabels := aBoolean.
+ self flagNamed:#hideDataLabels put:aBoolean.
"Modified: / 05-05-2011 / 15:22:10 / cg"
!
hideDefines
- ^ hideDefines ? false
+ ^ self flagNamed:#hideDefines
!
hideDefines:aBoolean
- hideDefines := aBoolean.
+ self flagNamed:#hideDefines put:aBoolean.
"Modified: / 05-05-2011 / 15:22:12 / cg"
!
hideDocumentation
- ^ hideDocumentation ? false
+ ^ self flagNamed:#hideDocumentation
"Created: / 08-05-2011 / 10:11:02 / cg"
!
hideDocumentation:aBoolean
- hideDocumentation := aBoolean.
+ self flagNamed:#hideDocumentation put:aBoolean.
"Created: / 08-05-2011 / 10:11:06 / cg"
!
hideFunctionProtoTypes
- ^ hideFunctionProtoTypes ? false
+ ^ self flagNamed:#hideFunctionProtoTypes
!
hideFunctionProtoTypes:aBoolean
- hideFunctionProtoTypes := aBoolean.
+ self flagNamed:#hideFunctionProtoTypes put:aBoolean.
"Modified: / 05-05-2011 / 15:22:14 / cg"
!
hideFunctions
- ^ hideFunctions ? false
+ ^ self flagNamed:#hideFunctions
!
hideFunctions:aBoolean
- hideFunctions := aBoolean.
+ self flagNamed:#hideFunctions put:aBoolean.
"Modified: / 05-05-2011 / 15:22:18 / cg"
!
hideHTMLHeaders
- ^ hideHTMLHeaders ? false
+ ^ self flagNamed:#hideHTMLHeaders
"Created: / 12-09-2012 / 12:29:45 / cg"
!
hideHTMLHeaders:aBoolean
- hideHTMLHeaders := aBoolean.
+ self flagNamed:#hideHTMLHeaders put:aBoolean.
"Created: / 12-09-2012 / 12:29:52 / cg"
!
hideHTMLInput
- ^ hideHTMLInput ? false
+ ^ self flagNamed:#hideHTMLInput
"Created: / 20-04-2011 / 19:01:04 / cg"
!
hideHTMLInput:aBoolean
- hideHTMLInput := aBoolean.
+ self flagNamed:#hideHTMLInput put:aBoolean.
"Created: / 20-04-2011 / 19:01:32 / cg"
"Modified: / 05-05-2011 / 15:22:21 / cg"
!
hideHTMLScript
- ^ hideHTMLScript ? false
+ ^ self flagNamed:#hideHTMLScript
"Created: / 20-04-2011 / 19:00:32 / cg"
!
hideHTMLScript:aBoolean
- hideHTMLScript := aBoolean.
+ self flagNamed:#hideHTMLScript put:aBoolean.
"Created: / 20-04-2011 / 19:01:32 / cg"
"Modified: / 05-05-2011 / 15:22:23 / cg"
!
hideHTMLTable
- ^ hideHTMLTable ? false
+ ^ self flagNamed:#hideHTMLTable
"Created: / 20-04-2011 / 19:01:23 / cg"
!
hideHTMLTable:aBoolean
- hideHTMLTable := aBoolean.
+ self flagNamed:#hideHTMLTable put:aBoolean.
"Created: / 20-04-2011 / 19:01:48 / cg"
"Modified: / 05-05-2011 / 15:22:26 / cg"
!
hideHTMLTextArea
- ^ hideHTMLTextArea ? false
+ ^ self flagNamed:#hideHTMLTextArea
"Created: / 20-04-2011 / 19:00:55 / cg"
!
hideHTMLTextArea:aBoolean
- hideHTMLTextArea := aBoolean.
+ self flagNamed:#hideHTMLTextArea put:aBoolean.
"Created: / 20-04-2011 / 19:01:58 / cg"
"Modified: / 05-05-2011 / 15:22:28 / cg"
!
hideJavaClasses
- ^ hideJavaClasses ? false
+ ^ self flagNamed:#hideJavaClasses
!
hideJavaClasses:aBoolean
- hideJavaClasses := aBoolean.
+ self flagNamed:#hideJavaClasses put:aBoolean
"Modified: / 05-05-2011 / 15:22:32 / cg"
!
hideJavaFields
- ^ hideJavaFields ? false
+ ^ self flagNamed:#hideJavaFields
!
hideJavaFields:aBoolean
- hideJavaFields := aBoolean.
+ self flagNamed:#hideJavaFields put:aBoolean.
"Modified: / 05-05-2011 / 15:22:34 / cg"
!
hideJavaInterfaces
- ^ hideJavaInterfaces ? false
+ ^ self flagNamed:#hideJavaInterfaces
!
hideJavaInterfaces:aBoolean
- hideJavaInterfaces := aBoolean.
+ self flagNamed:#hideJavaInterfaces put:aBoolean.
"Modified: / 05-05-2011 / 15:22:38 / cg"
!
hideJavaMethods
- ^ hideJavaMethods ? false
+ ^ self flagNamed:#hideJavaMethods
!
hideJavaMethods:aBoolean
- hideJavaMethods := aBoolean.
+ self flagNamed:#hideJavaMethods put:aBoolean.
"Modified: / 05-05-2011 / 15:22:40 / cg"
!
hideJavaPackages
- ^ hideJavaPackages ? false
+ ^ self flagNamed:#hideJavaPackages
!
hideJavaPackages:aBoolean
- hideJavaPackages := aBoolean.
+ self flagNamed:#hideJavaPackages put:aBoolean.
"Modified: / 05-05-2011 / 15:22:41 / cg"
!
+hideLabels
+ ^ self flagNamed:#hideLabels
+!
+
+hideLabels:aBoolean
+ self flagNamed:#hideLabels put:aBoolean.
+
+ "Modified: / 05-05-2011 / 15:22:46 / cg"
+!
+
hideLispConstants
- ^ hideLispConstants ? false
+ ^ self flagNamed:#hideLispConstants
!
hideLispConstants:aBoolean
- hideLispConstants := aBoolean.
+ self flagNamed:#hideLispConstants put:aBoolean.
"Modified: / 05-05-2011 / 15:22:46 / cg"
!
hideLispEvaluations
- ^ hideLispEvaluations ? false
+ ^ self flagNamed:#hideLispEvaluations
!
hideLispEvaluations:aBoolean
- hideLispEvaluations := aBoolean.
+ self flagNamed:#hideLispEvaluations put:aBoolean.
"Modified: / 05-05-2011 / 15:22:49 / cg"
!
hideLispMacros
- ^ hideLispMacros ? false
+ ^ self flagNamed:#hideLispMacros
!
hideLispMacros:aBoolean
- hideLispMacros := aBoolean.
+ self flagNamed:#hideLispMacros put:aBoolean.
"Modified: / 05-05-2011 / 15:22:50 / cg"
!
hideLispMethods
- ^ hideLispMethods ? false
+ ^ self flagNamed:#hideLispMethods
!
hideLispMethods:aBoolean
- hideLispMethods := aBoolean.
+ self flagNamed:#hideLispMethods put:aBoolean.
"Modified: / 05-05-2011 / 15:22:53 / cg"
!
hideLocalLabels
- ^ hideLocalLabels ? false
+ ^ self flagNamed:#hideLocalLabels
!
hideLocalLabels2
- ^ hideLocalLabels2 ? false
+ ^ self flagNamed:#hideLocalLabels2
"Created: / 24-03-2012 / 23:23:15 / cg"
!
hideLocalLabels2:aBoolean
- hideLocalLabels2 := aBoolean.
+ self flagNamed:#hideLocalLabels2 put:aBoolean.
"Modified: / 05-05-2011 / 15:22:54 / cg"
"Created: / 24-03-2012 / 23:23:20 / cg"
!
hideLocalLabels3
- ^ hideLocalLabels3 ? false
+ ^ self flagNamed:#hideLocalLabels3
"Created: / 13-05-2012 / 11:12:37 / cg"
!
hideLocalLabels3:aBoolean
- hideLocalLabels3 := aBoolean.
+ self flagNamed:#hideLocalLabels3 put:aBoolean.
"Modified: / 05-05-2011 / 15:22:54 / cg"
"Created: / 13-05-2012 / 11:12:42 / cg"
!
hideLocalLabels:aBoolean
- hideLocalLabels := aBoolean.
+ self flagNamed:#hideLocalLabels put:aBoolean.
"Modified: / 05-05-2011 / 15:22:54 / cg"
!
+hideLuaFunctions
+ ^ self flagNamed:#hideLuaFunctions
+!
+
+hideLuaFunctions:aBoolean
+ self flagNamed:#hideLuaFunctions put:aBoolean
+!
+
hideMethods
- ^ hideMethods ? false
+ ^ self flagNamed:#hideMethods
"Created: / 21-08-2012 / 21:02:24 / cg"
!
hideMethods:aBoolean
- hideMethods := aBoolean.
+ self flagNamed:#hideMethods put:aBoolean.
"Created: / 21-08-2012 / 21:01:38 / cg"
!
hideOzClasses
- ^ hideOzClasses ? false
+ ^ self flagNamed:#hideOzClasses
!
hideOzClasses:aBoolean
- hideOzClasses := aBoolean.
+ self flagNamed:#hideOzClasses put:aBoolean.
"Modified: / 05-05-2011 / 15:22:58 / cg"
!
hideOzFunctions
- ^ hideOzFunctions ? false
+ ^ self flagNamed:#hideOzFunctions
!
hideOzFunctions:aBoolean
- hideOzFunctions := aBoolean.
+ self flagNamed:#hideOzFunctions put:aBoolean.
"Modified: / 05-05-2011 / 15:23:00 / cg"
!
hideOzMethods
- ^ hideOzMethods ? false
+ ^ self flagNamed:#hideOzMethods
!
hideOzMethods:aBoolean
- hideOzMethods := aBoolean.
+ self flagNamed:#hideOzMethods put:aBoolean.
"Modified: / 05-05-2011 / 15:23:02 / cg"
!
hidePythonClasses
- ^ hidePythonClasses ? false
+ ^ self flagNamed:#hidePythonClasses
!
hidePythonClasses:aBoolean
- hidePythonClasses := aBoolean.
+ self flagNamed:#hidePythonClasses put:aBoolean.
"Modified: / 05-05-2011 / 15:23:05 / cg"
!
hidePythonFunctions
- ^ hidePythonFunctions ? false
+ ^ self flagNamed:#hidePythonFunctions
!
hidePythonFunctions:aBoolean
- hidePythonFunctions := aBoolean.
+ self flagNamed:#hidePythonFunctions put:aBoolean.
"Modified: / 05-05-2011 / 15:23:07 / cg"
!
hidePythonMethods
- ^ hidePythonMethods ? false
+ ^ self flagNamed:#hidePythonMethods
!
hidePythonMethods:aBoolean
- hidePythonMethods := aBoolean.
+ self flagNamed:#hidePythonMethods put:aBoolean.
"Modified: / 05-05-2011 / 15:23:09 / cg"
!
hideStatic
- ^ hideStatic ? false
+ ^ self flagNamed:#hideStatic
!
hideStatic:aBoolean
- hideStatic := aBoolean.
+ self flagNamed:#hideStatic put:aBoolean.
"Modified: / 05-05-2011 / 15:23:11 / cg"
!
hideStructMembers
- ^ hideStructMembers ? false
+ ^ self flagNamed:#hideStructMembers
!
hideStructMembers:aBoolean
- hideStructMembers := aBoolean.
+ self flagNamed:#hideStructMembers put:aBoolean.
"Modified: / 05-05-2011 / 15:23:15 / cg"
!
hideStructures
- ^ hideStructures ? false
+ ^ self flagNamed:#hideStructures
!
hideStructures:aBoolean
- hideStructures := aBoolean.
+ self flagNamed:#hideStructures put:aBoolean.
"Modified: / 05-05-2011 / 15:23:17 / cg"
!
hideTextLabels
- ^ hideTextLabels ? false
+ ^ self flagNamed:#hideTextLabels
!
hideTextLabels:aBoolean
- hideTextLabels := aBoolean.
+ self flagNamed:#hideTextLabels put:aBoolean.
"Modified: / 05-05-2011 / 15:23:19 / cg"
!
hideTypedefs
- ^ hideTypedefs ? false
+ ^ self flagNamed:#hideTypedefs
!
hideTypedefs:aBoolean
- hideTypedefs := aBoolean.
+ self flagNamed:#hideTypedefs put:aBoolean.
"Modified: / 05-05-2011 / 15:23:21 / cg"
!
hideVariables
- ^ hideVariables ? false
+ ^ self flagNamed:#hideVariables
!
hideVariables:aBoolean
- hideVariables := aBoolean.
+ self flagNamed:#hideVariables put:aBoolean.
"Modified: / 05-05-2011 / 15:23:23 / cg"
!
@@ -1534,18 +1591,46 @@
^ tagTypesPresent
! !
+!TagList methodsFor:'initialization'!
+
+initContents:n
+ "Invoked when a new instance is created."
+
+ super initContents:n.
+ flags isNil ifTrue:[
+ flags := IdentityDictionary new.
+ ].
+!
+
+initialize
+ "Invoked when a new instance is created."
+
+ flags := IdentityDictionary new.
+! !
+
!TagList methodsFor:'private'!
applyFilterToList:aList
- |lcFilter|
-
- filter includesMatchCharacters ifTrue:[
- lcFilter := filter asLowercase.
- ^ aList select:[:tag | lcFilter match:tag label caseSensitive:false]
+ |filters|
+
+ filters := filter splitByAny:',;'.
+ filters size == 1 ifTrue:[
+ filter includesMatchCharacters ifFalse:[
+ ^ aList select:[:tag | tag label includesString:filter caseSensitive:false]
+ ].
].
- ^ aList select:[:tag | tag label includesString:filter caseSensitive:false]
-
- "Modified: / 01-08-2012 / 16:52:02 / cg"
+
+ ^ aList
+ select:[:tag |
+ filters
+ contains:[:someFilter |
+ someFilter includesMatchCharacters ifTrue:[
+ someFilter match:tag label caseSensitive:false
+ ] ifFalse:[
+ tag label includesString:someFilter caseSensitive:false
+ ].
+ ].
+ ].
!
getCtagsVersion
@@ -1566,7 +1651,7 @@
string := stream contents.
index := string findString:'Exuberant Ctags' ifAbsent:[nil].
index notNil ifTrue:[
- string := (string copyFrom:(index + ('Exuberant Ctags' size))) asArrayOfSubstrings first.
+ string := (string copyFrom:(index + ('Exuberant Ctags' size))) asCollectionOfWords first.
(string includes:$,) ifTrue:[ string := string copyTo:((string indexOf:$,) - 1)].
indexOfPoint := string indexOf:$. ifAbsent:nil.
indexOfPoint notNil ifTrue:[
@@ -1621,28 +1706,40 @@
"/ local use
suff := (OperatingSystem isMSWINDOWSlike) ifTrue:'.exe' ifFalse:''.
- ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-5.8/ctags',suff.
+ ctagsCommand := 'ctags',suff.
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
ctagsCommand := fn pathName.
ctagsIsExCtags := ctagsIsExCtags5x := true.
] ifFalse:[
- ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-3.2.2/ctags',suff.
+ ctagsCommand := 'bin/ctags',suff.
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
ctagsCommand := fn pathName.
- ctagsIsExCtags := true.
- ctagsIsExCtags5x := false.
+ ctagsIsExCtags := ctagsIsExCtags5x := true.
] ifFalse:[
- ctagsIsExCtags := nil.
- ctagsIsExCtags5x := nil.
- ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags/ctags',suff.
+ ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-5.8/ctags',suff.
(ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
ctagsCommand := fn pathName.
+ ctagsIsExCtags := ctagsIsExCtags5x := true.
] ifFalse:[
- "/ use systems default ctags command
- ctagsCommand := 'ctags'.
- ]
+ ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags-3.2.2/ctags',suff.
+ (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
+ ctagsCommand := fn pathName.
+ ctagsIsExCtags := true.
+ ctagsIsExCtags5x := false.
+ ] ifFalse:[
+ ctagsIsExCtags := nil.
+ ctagsIsExCtags5x := nil.
+ ctagsCommand := Smalltalk getPackageFileName:'stx/support/tools/ctags/ctags',suff.
+ (ctagsCommand notNil and:[(fn := ctagsCommand asFilename) isExecutableProgram]) ifTrue:[
+ ctagsCommand := fn pathName.
+ ] ifFalse:[
+ "/ use systems default ctags command
+ ctagsCommand := 'ctags'.
+ ]
+ ]
+ ].
]
- ].
+ ]
] ifFalse:[
"/ cross-development
"/ target remoteOperatingSystem = 'Linux' ifTrue:[
@@ -1750,13 +1847,13 @@
]
]
].
- hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m'].
- hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ].
- hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ].
- hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s'].
- hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v'].
- hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f'].
- hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c'].
+ self hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m'].
+ self hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ].
+ self hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ].
+ self hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s'].
+ self hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v'].
+ self hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f'].
+ self hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c'].
].
isJavaSuffix ifTrue:[
@@ -1773,11 +1870,11 @@
]
]
].
- hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ].
- hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ].
- hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ].
- hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ].
- hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ].
+ self hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ].
+ self hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ].
+ self hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ].
+ self hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ].
+ self hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ].
].
isEiffelSuffix ifTrue:[
@@ -1860,7 +1957,7 @@
^ nil
].
- usingDefaultCTags := true.
+ usingDefaultCTags := true.
shellCommand := 'ctags'.
@@ -1868,7 +1965,7 @@
"/ (OperatingSystem getOSType = 'linux') ifTrue:[
"/ shellCommand := 'ctags -S'
"/ ].
- Transcript showCR:('using default ctags command (not ctags from stx): <', shellCommand, '>').
+ Transcript showCR:('TagList [info]: using default ctags command (not ctags from stx): <', shellCommand, '>').
ctagsCommand := nil. "/ flush - so we will check again.
shellCommand := shellCommand, ' "%1"'.
@@ -2027,11 +2124,11 @@
ifTrue:[ rawList ]
ifFalse:[ self applyFilterToList:rawList ].
filteredList notNil ifTrue:[
- hideFunctions == true ifTrue:[
+ self hideFunctions == true ifTrue:[
filteredList := filteredList reject:[:tag | tag isFunctionTag].
] ifFalse:[
showOnly == #functions ifTrue:[
- filteredList := filteredList select:[:tag | tag isFunctionTag].
+ filteredList := filteredList select:[:tag | tag isFunctionOrMethodTag].
].
].
].
@@ -2043,20 +2140,32 @@
!TagList methodsFor:'queries'!
bestTagForLine:lineNr
+ "find the best tag for a given lineNr in the file"
+
+ ^ self bestTagForLine:lineNr filtering:nil
+!
+
+bestTagForLine:lineNr filtering:tagFilterOrNil
+ "find the best tag for a given lineNr in the file.
+ The filter can be used eg. to find only function tags
+ (i.e. to ignore case and goto labels in C)"
+
|bestTag sortedByLineNumber|
sortedByLineNumber := self sortedByLineNumber.
self do:[:eachTag |
eachTag notNil ifTrue:[
- eachTag lineNumber <= lineNr ifTrue:[
- bestTag isNil ifTrue:[
- bestTag := eachTag.
- "/ sortedByLineNumber ifTrue:[^ eachTag].
- ] ifFalse:[
- eachTag lineNumber > bestTag lineNumber ifTrue:[
- bestTag := eachTag
+ (tagFilterOrNil isNil or:[tagFilterOrNil value:eachTag]) ifTrue:[
+ eachTag lineNumber <= lineNr ifTrue:[
+ bestTag isNil ifTrue:[
+ bestTag := eachTag.
+ "/ sortedByLineNumber ifTrue:[^ eachTag].
+ ] ifFalse:[
+ eachTag lineNumber > bestTag lineNumber ifTrue:[
+ bestTag := eachTag
+ ]
]
- ]
+ ].
].
].
].
@@ -2099,7 +2208,10 @@
shellCmd := (self shellCommandFor:aFile pathName).
shellCmd notNil ifTrue:[
tagTypesPresent := false. "/ will be set again, when ctags command provides types
- list := self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory
+ list := self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory.
+ (self class isCSuffix:(aFile suffix)) ifTrue:[
+ list addAll:(self additionalCTagsInFile:aFile)
+ ]
].
].
@@ -2303,7 +2415,7 @@
word2 := stream upTo:Character tab. "/ optional class:
(word1 startsWith:'file:') ifTrue:[ "/ file: (scope)
- hideStatic == true ifTrue:[^ nil].
+ self hideStatic == true ifTrue:[^ nil].
].
(word2 startsWith: 'class:') ifTrue:[
@@ -2325,29 +2437,30 @@
"/ typeCharacter to tag-Class mapping...
languageMode == #c ifTrue:[
+ "/ Transcript showCR:tagType.
tagType = 'v' ifTrue:[
- hideVariables == true ifTrue:[^ nil].
+ self hideVariables == true ifTrue:[^ nil].
tagClass := Tag::TVariable
] ifFalse:[ tagType = 'f' ifTrue:[
- hideFunctions == true ifTrue:[^ nil].
+ self hideFunctions == true ifTrue:[^ nil].
tagClass := Tag::TFunction
] ifFalse:[ tagType = 'd' ifTrue:[
- hideDefines == true ifTrue:[^ nil].
+ self hideDefines == true ifTrue:[^ nil].
tagClass := Tag::TMacro
] ifFalse:[ tagType = 't' ifTrue:[
- hideTypedefs == true ifTrue:[^ nil].
+ self hideTypedefs == true ifTrue:[^ nil].
tagClass := Tag::TTypedef
] ifFalse:[ tagType = 'm' ifTrue:[
- hideStructMembers == true ifTrue:[^ nil].
+ self hideStructMembers == true ifTrue:[^ nil].
tagClass := Tag::TMember
] ifFalse:[ tagType = 's' ifTrue:[
- hideStructures == true ifTrue:[^ nil].
+ self hideStructures == true ifTrue:[^ nil].
tagClass := Tag::TStruct
] ifFalse:[ tagType = 'u' ifTrue:[
- hideStructures == true ifTrue:[^ nil].
+ self hideStructures == true ifTrue:[^ nil].
tagClass := Tag::TUnion
] ifFalse:[ tagType = 'c' ifTrue:[
- hideClasses == true ifTrue:[^ nil].
+ self hideClasses == true ifTrue:[^ nil].
tagClass := Tag::TClass
] ifFalse:[ tagType = 'e' ifTrue:[
tagClass := Tag::TEnumMember.
@@ -2360,30 +2473,31 @@
"/ ] ifFalse:[ tagType = 'x' ifTrue:[
"/ tagClass := Tag::TExternVariable
] ifFalse:[
+ self breakPoint:#cg.
"/ add more here
]]]]]]]]]]
] ifFalse:[ languageMode == #java ifTrue:[
tagType = 'c' ifTrue:[
- hideJavaClasses == true ifTrue:[^ nil].
+ self hideJavaClasses == true ifTrue:[^ nil].
tagClass := Tag::TClass
] ifFalse:[ tagType = 'm' ifTrue:[
- hideJavaMethods == true ifTrue:[^ nil].
+ self hideJavaMethods == true ifTrue:[^ nil].
tagClass := Tag::TMethod
] ifFalse:[ tagType = 'f' ifTrue:[
- hideJavaFields == true ifTrue:[^ nil].
+ self hideJavaFields == true ifTrue:[^ nil].
tagClass := Tag::TField
] ifFalse:[ tagType = 'i' ifTrue:[
- hideJavaInterfaces == true ifTrue:[^ nil].
+ self hideJavaInterfaces == true ifTrue:[^ nil].
tagClass := Tag::TInterface
] ifFalse:[ tagType = 'p' ifTrue:[
- hideJavaPackages == true ifTrue:[^ nil].
+ self hideJavaPackages == true ifTrue:[^ nil].
tagClass := Tag::TPackage
] ifFalse:[
"/ add more here */
]]]]]
] ifFalse:[ languageMode == #eiffel ifTrue:[
tagType = 'c' ifTrue:[
- hideClasses == true ifTrue:[^ nil].
+ self hideClasses == true ifTrue:[^ nil].
tagClass := Tag::TClass
"/ ] ifFalse:[ tagType = 'f' ifTrue:[
"/ tagClass := Tag::TFeature
@@ -2394,13 +2508,13 @@
]
] ifFalse:[ languageMode == #fortran ifTrue:[
tagType = 'f' ifTrue:[
- hideFunctions == true ifTrue:[^ nil].
+ self hideFunctions == true ifTrue:[^ nil].
tagClass := Tag::TFunction
] ifFalse:[ tagType = 'i' ifTrue:[
"/ hideInterfaces == true ifTrue:[^ nil].
tagClass := Tag::TInterface
] ifFalse:[ tagType = 't' ifTrue:[
- hideTypedefs == true ifTrue:[^ nil].
+ self hideTypedefs == true ifTrue:[^ nil].
tagClass := Tag::TTypedef
"/ ] ifFalse:[ tagType = 'l' ifTrue:[
"/ tagClass := Tag::TLabel
@@ -2468,13 +2582,44 @@
!TagList methodsFor:'tag generation - helpers'!
+linewiseNaiveTagsInFile:aFilePath using:parseLineBlock
+ "common helper for naive linewise parsing tags"
+
+ |targets line lineNr s tagOrTagCollection|
+
+ Tag autoload.
+
+ targets := OrderedCollection new.
+ s := aFilePath asFilename readStream.
+ s notNil ifTrue:[
+ s := LineNumberReadStream readingFrom:s.
+ [s atEnd] whileFalse:[
+ lineNr := s lineNumber.
+ line := s nextLine.
+
+ tagOrTagCollection := parseLineBlock value:line value:lineNr.
+ tagOrTagCollection notNil ifTrue:[
+ tagOrTagCollection isCollection ifTrue:[
+ targets addAll:tagOrTagCollection
+ ] ifFalse:[
+ targets add:tagOrTagCollection
+ ].
+ ].
+ ].
+ s close
+ ].
+ ^ targets
+
+ "Modified: / 08-05-2011 / 10:12:29 / cg"
+!
+
plainTextBetweenHTMLElement:startElement andElementWithTag:endTag
"applied to an <h1>-tag element, passing '/h1' as endTag,
this retrieves the plain text of the headline. Used by the tag list."
|el collector hasSpace txt|
- collector := WriteStream on:(String new:100).
+ collector := CharacterWriteStream on:(String new:100).
el := startElement next.
hasSpace := true.
@@ -2519,7 +2664,7 @@
words size >= 1 ifTrue:[
w := words first.
(w endsWith:$:) ifTrue:[
- nm := w copyButLast:1.
+ nm := w copyButLast.
lineNr := s lineNumber - 1.
targets add:(Tag::TLabel
@@ -2539,6 +2684,50 @@
!TagList methodsFor:'tag generation - simple'!
+additionalCTagsInFile:aFilePath
+ "additional tags, which are not found by the standard ctags utility:
+ case foo: - case label tags
+ "
+
+ |targets line lineNr s caseLabel l|
+
+ self hideLabels ifTrue:[^ #()].
+ showOnly notNil ifTrue:[^ #()].
+
+ Tag autoload.
+
+ targets := OrderedCollection new.
+ s := aFilePath asFilename readStream.
+ s notNil ifTrue:[
+ s := LineNumberReadStream readingFrom:s.
+ [s atEnd] whileFalse:[
+ line := s nextLine withoutSeparators.
+ ((line startsWith:'case ') and:[line includes:$:]) ifTrue:[
+ l := line readStream.
+ l skip:5.
+ caseLabel := l upTo:$:.
+ lineNr := s lineNumber - 1.
+ targets add:(Tag::TCaseLabel
+ label:'case ' allItalic , caseLabel",' <case>' allItalic"
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ] ifFalse:[
+ (line startsWith:'default:') ifTrue:[
+ lineNr := s lineNumber - 1.
+ targets add:(Tag::TCaseLabel
+ label:'case ' allItalic, 'default'",' <case>' allItalic"
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ].
+ ].
+ ].
+ s close
+ ].
+ ^ targets
+!
+
assemblerTagsInFile:aFilePath
"assembler tags:
naive, q&d scan for lines matching:
@@ -2555,11 +2744,11 @@
targets := OrderedCollection new.
s := aFilePath asFilename readStream.
s notNil ifTrue:[
- hideLocals := hideLocalLabels ? false.
- hideLocals2 := hideLocalLabels2 ? false.
- hideLocals3 := hideLocalLabels3 ? false.
- hideData := hideDataLabels ? false.
- hideText := hideTextLabels ? false.
+ hideLocals := self flagNamed:#hideLocalLabels ? false.
+ hideLocals2 := self flagNamed:#hideLocalLabels2 ? false.
+ hideLocals3 := self flagNamed:#hideLocalLabels3 ? false.
+ hideData := self flagNamed:#hideDataLabels ? false.
+ hideText := self flagNamed:#hideTextLabels ? false.
currentSegment := #text.
s := LineNumberReadStream readingFrom:s.
@@ -2580,7 +2769,7 @@
and:[ (w size > 1)
and:[ ((w copyFrom:2 to:(w size-1)) conform:[:c | c isDigit])
]]]) ifFalse:[
- nm := w copyButLast:1.
+ nm := w copyButLast.
targets add:(Tag::TLabel
label:nm
pattern:nil
@@ -2679,12 +2868,12 @@
line := s nextLine.
l := line withoutSeparators.
{
- { 'function ' . #functions . hideFunctions . Tag::TFunction } .
- { 'var ' . #variables . hideVariables . Tag::TVariable } .
- { 'class ' . #classes . hideClasses . Tag::TClass } .
- { 'abstract class ' . #classes . hideClasses . Tag::TClass } .
- { 'interface ' . #interfaces . hideDartInterfaces . Tag::TInterface } .
- { 'factory ' . #methods . hideMethods . Tag::TMethod } .
+ { 'function ' . #functions . self hideFunctions . Tag::TFunction } .
+ { 'var ' . #variables . self hideVariables . Tag::TVariable } .
+ { 'class ' . #classes . self hideClasses . Tag::TClass } .
+ { 'abstract class ' . #classes . self hideClasses . Tag::TClass } .
+ { 'interface ' . #interfaces . self hideDartInterfaces . Tag::TInterface } .
+ { 'factory ' . #methods . self hideMethods . Tag::TMethod } .
} tuplesDo:[:keywordSpace :showOnlyEnum :hideVariableValue :tagType|
(l startsWith:keywordSpace) ifTrue:[
(showOnly isNil or:[showOnly == showOnlyEnum]) ifTrue:[
@@ -2715,7 +2904,7 @@
"fallback, if no ctags is present, or if the file is not a c-file.
Implemented here for some other file types (Makefiles)
"
- |file lcName pathName suffix|
+ |file lcName pathName suffix mime|
file := aFileOrString asFilename.
lcName := file baseName asLowercase.
@@ -2728,61 +2917,81 @@
].
suffix := lcName asFilename suffix.
-
- (self class isSmalltalkSuffix:suffix) ifTrue:[
+ mime := TagList tagMimeTypeForFile:file.
+
+ ((self class isSmalltalkSuffix:suffix)
+ or:[(mime ? '') includesString:'smalltalk']) ifTrue:[
"/ smalltalk tags - simulated
^ self stTagsInFile:pathName in:aTempDirectory
].
- (self class isPythonSuffix:suffix) ifTrue:[
+ ((self class isPythonSuffix:suffix)
+ or:[(mime ? '') includesString:'python']) ifTrue:[
"/ python tags - simulated
^ self pythonTagsInFile:pathName
].
- (self class isPhpSuffix:suffix) ifTrue:[
+ ((self class isPhpSuffix:suffix)
+ or:[(mime ? '') includesString:'php']) ifTrue:[
"/ php tags - simulated
^ self phpTagsInFile:pathName
].
- (self class isLispSuffix:suffix) ifTrue:[
+ ((self class isLispSuffix:suffix)
+ or:[(mime ? '') includesString:'lisp']) ifTrue:[
"/ lisp tags - simulated
^ self lispTagsInFile:pathName
].
- (self class isOzSuffix:suffix) ifTrue:[
+ ((self class isOzSuffix:suffix)
+ or:[(mime ? '') includesString:'oz']) ifTrue:[
"/ oz tags - simulated
^ self ozTagsInFile:pathName
].
- (self class isPrologSuffix:suffix) ifTrue:[
+ ((self class isPrologSuffix:suffix)
+ or:[(mime ? '') includesString:'prolog']) ifTrue:[
"/ prolog tags - simulated
^ self prologTagsInFile:pathName
].
- (self class isTCLSuffix:suffix) ifTrue:[
+ ((self class isTCLSuffix:suffix)
+ or:[(mime ? '') includesString:'tcl']) ifTrue:[
"/ tcl tags - simulated
^ self tclTagsInFile:pathName
].
- (self class isAssemblerSuffix:suffix) ifTrue:[
+ ((self class isAssemblerSuffix:suffix)
+ or:[(mime ? '') includesString:'assembler']) ifTrue:[
"/ assembler tags - simulated
^ self assemblerTagsInFile:pathName
].
- (self class isRubySuffix:suffix) ifTrue:[
+ ((self class isRubySuffix:suffix)
+ or:[(mime ? '') includesString:'ruby']) ifTrue:[
"/ ruby tags - simulated
^ self rubyTagsInFile:pathName
].
- (self class isYaccSuffix:suffix) ifTrue:[
+ ((self class isYaccSuffix:suffix)
+ or:[(mime ? '') includesString:'yacc']) ifTrue:[
"/ yacc tags - simulated
^ self yaccTagsInFile:pathName
].
- (self class isJavaScriptSuffix:suffix) ifTrue:[
+ ((self class isJavaScriptSuffix:suffix)
+ or:[(mime ? '') includesString:'javascript']) ifTrue:[
"/ js tags - simulated
^ self javaScriptTagsInFile:pathName
].
- (self class isDartSuffix:suffix) ifTrue:[
+ ((self class isDartSuffix:suffix)
+ or:[(mime ? '') includesString:'dart']) ifTrue:[
"/ dart tags - simulated
^ self dartTagsInFile:pathName
].
-
- (self class isHTMLSuffix:suffix) ifTrue:[
+ ((self class isLuaSuffix:suffix)
+ or:[(mime ? '') includesString:'lua']) ifTrue:[
+ "/ lua tags - simulated
+ ^ self luaTagsInFile:pathName
+ ].
+
+ ((self class isHTMLSuffix:suffix)
+ or:[(mime ? '') includesString:'html']) ifTrue:[
"/ html tags - simulated
^ self htmlTagsInFile:pathName
].
- (self class isBatchSuffix:suffix) ifTrue:[
+ ((self class isBatchSuffix:suffix)
+ or:[(mime ? '') includesString:'batch']) ifTrue:[
"/ batch tags - simulated
^ self batchTagsInFile:pathName
].
@@ -2820,19 +3029,19 @@
l := line asLowercase.
#(
- 'textarea' hideHTMLTextArea
- 'input' hideHTMLInput
- 'table' hideHTMLTable
- 'script' hideHTMLScript
- 'form' hideHTMLForm
- 'a' nil
- 'h1' hideHTMLHeaders
- 'h2' hideHTMLHeaders
- 'h3' hideHTMLHeaders
- 'h4' hideHTMLHeaders
- 'h5' hideHTMLHeaders
- 'h6' hideHTMLHeaders
- ) pairWiseDo:[:nm :hideInstVarName|
+ 'textarea' hideHTMLTextArea nil
+ 'input' hideHTMLInput nil
+ 'table' hideHTMLTable nil
+ 'script' hideHTMLScript nil
+ 'form' hideHTMLForm nil
+ 'a' nil anchors
+ 'h1' hideHTMLHeaders headlines
+ 'h2' hideHTMLHeaders headlines
+ 'h3' hideHTMLHeaders headlines
+ 'h4' hideHTMLHeaders headlines
+ 'h5' hideHTMLHeaders headlines
+ 'h6' hideHTMLHeaders headlines
+ ) inGroupsOf:3 do:[:nm :hideInstVarName :thisType|
|type hideHolder idx tagText doc markup label text markupName markupType
isHeader|
@@ -2842,7 +3051,7 @@
idx ~~ 0 ifTrue:[
hideHolder := hideInstVarName isNil
ifTrue:[ false ]
- ifFalse:[ self instVarNamed:hideInstVarName ].
+ ifFalse:[ self flagNamed:hideInstVarName ].
tagText := line copyFrom:idx.
doc := HTMLParser new parseText:tagText.
@@ -2891,13 +3100,15 @@
].
].
- hideHolder value ~~ true ifTrue:[
- tag := type
- label:label
- pattern:nil
- type:nil
- lineNumber:lineNr.
- targets add:tag.
+ (showOnly isNil or:[thisType isNil or:[showOnly == thisType]]) ifTrue:[
+ hideHolder value ~~ true ifTrue:[
+ tag := type
+ label:label
+ pattern:nil
+ type:nil
+ lineNumber:lineNr.
+ targets add:tag.
+ ]
]
].
].
@@ -2929,9 +3140,12 @@
line := s nextLine.
l := line withoutSeparators.
+ (l = 'function') ifTrue:[
+ l := l , ' ' , (s nextLine withoutSeparators).
+ ].
(l startsWith:'function ') ifTrue:[
(showOnly isNil or:[showOnly == #functions]) ifTrue:[
- hideFunctions ~~ true ifTrue:[
+ self hideFunctions ~~ true ifTrue:[
nm := l copyFrom:('function ' size + 1).
nm := nm copyTo:(nm
findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not]
@@ -2946,7 +3160,7 @@
] ifFalse:[
(l startsWith:'var ') ifTrue:[
(showOnly isNil or:[showOnly == #variables]) ifTrue:[
- hideVariables ~~ true ifTrue:[
+ self hideVariables ~~ true ifTrue:[
nm := l copyFrom:('var ' size + 1).
nm := nm copyTo:(nm
findFirst:[:ch | (ch isLetterOrDigit or:['$_' includes:ch]) not]
@@ -2958,6 +3172,19 @@
lineNumber:lineNr).
].
].
+ ] ifFalse:[
+ ((l includesString:'=function') or:[(l includesString:'= function')]) ifTrue:[
+ (showOnly isNil or:[showOnly == #functions]) ifTrue:[
+ self hideFunctions ~~ true ifTrue:[
+ nm := l copyTo:((l indexOf:$=) - 1). nm := nm withoutSeparators.
+ targets add:(Tag::TFunction
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ].
+ ].
+ ].
].
]
].
@@ -2970,7 +3197,7 @@
!
lispTagFromLine:line lineNr:lineNr
- "lisp tags:
+ "lisp/scheme tags:
naive, q&d scan for lines starting with (not syntax-aware):
(define ...
(defun ...
@@ -2988,17 +3215,18 @@
;;; more documentation
"
- |l nm words def arg inParens rest|
+ |l nm words def inParens rest|
l := line withoutSeparators.
(l startsWith:'(') ifFalse:[
(showOnly notNil and:[showOnly ~~ #documentation]) ifTrue:[^ nil].
- hideDocumentation == true ifTrue:[ ^ nil ].
+ self hideDocumentation == true ifTrue:[ ^ nil ].
(l startsWith:';;;') ifFalse:[^ nil].
rest := (l copyFrom:4) withoutSeparators.
rest isEmpty ifTrue:[^ nil].
+ (rest conform:[:ch | ch == $;]) ifTrue:[^ nil].
^ Tag::TDocumentation
label:(rest colorizeAllWith:(Color blue "grey"))
pattern:nil
@@ -3015,18 +3243,17 @@
nm := nm copyFrom:2.
] ifFalse:[
nm := nm upTo:$(. "/ in case it is (define foo() - without space after name
- arg := l copyFrom:(l indexOf:$( startingAt:2 ifAbsent:2).
(inParens := nm startsWith:'(') ifTrue:[
nm := nm copyFrom:2.
].
].
(nm endsWith:')') ifTrue:[
- nm := nm copyButLast:1
+ nm := nm copyButLast
].
def = 'defun' ifTrue:[
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
- hideFunctions == true ifTrue:[ ^ nil ].
+ self hideFunctions == true ifTrue:[ ^ nil ].
^ Tag::TFunction
label:nm
pattern:nil
@@ -3036,15 +3263,43 @@
def = 'define' ifTrue:[ "/ scheme
inParens ifTrue:[
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
- hideFunctions == true ifTrue:[ ^ nil ].
+ self hideFunctions == true ifTrue:[ ^ nil ].
^ Tag::TFunction
label:nm
pattern:nil
type:nil
lineNumber:lineNr.
] ifFalse:[
+ "/ check for (define name (lambda ...
+ "/ and (define name (macro ...
+ (words size > 2
+ and:[ words third startsWith:'(' ]) ifTrue:[
+ (words third = '(' and:[words size > 3]) ifTrue:[
+ def := words fourth
+ ] ifFalse:[
+ def := words third copyFrom:2.
+ ].
+ def = 'lambda' ifTrue:[
+ (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
+ self hideFunctions == true ifTrue:[ ^ nil ].
+ ^ Tag::TFunction
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr.
+ ].
+ def = 'macro' ifTrue:[
+ (showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil].
+ self hideLispMacros == true ifTrue:[ ^ nil ].
+ ^ Tag::TLispMacro
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr.
+ ].
+ ].
(showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
- hideVariables == true ifTrue:[ ^ nil ].
+ self hideVariables == true ifTrue:[ ^ nil ].
^ Tag::TVariable
label:nm
pattern:nil
@@ -3056,7 +3311,7 @@
def = 'defvar' ifTrue:[
(showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
- hideVariables == true ifTrue:[ ^ nil ].
+ self hideVariables == true ifTrue:[ ^ nil ].
^ Tag::TVariable
label:nm
pattern:nil
@@ -3064,7 +3319,7 @@
lineNumber:lineNr.
].
def = 'set' ifTrue:[
- hideVariables == true ifTrue:[ ^ nil ].
+ self hideVariables == true ifTrue:[ ^ nil ].
^ Tag::TVariable
label:nm
pattern:nil
@@ -3073,7 +3328,7 @@
].
(def = 'defconstant' or:[def = 'constant']) ifTrue:[
(showOnly notNil and:[showOnly ~~ #constants]) ifTrue:[^ nil].
- hideLispConstants == true ifTrue:[ ^ nil ].
+ self hideLispConstants == true ifTrue:[ ^ nil ].
^ Tag::TLispConstant
label:nm
pattern:nil
@@ -3082,7 +3337,7 @@
].
(def = 'mac' or:[def = 'defmacro' or:[def = 'define-macro']]) ifTrue:[
(showOnly notNil and:[showOnly ~~ #macros]) ifTrue:[^ nil].
- hideLispMacros == true ifTrue:[ ^ nil ].
+ self hideLispMacros == true ifTrue:[ ^ nil ].
^ Tag::TLispMacro
label:nm
pattern:nil
@@ -3091,7 +3346,7 @@
].
(def = 'defclass' or:[def = 'define-class']) ifTrue:[
(showOnly notNil and:[showOnly ~~ #classes]) ifTrue:[^ nil].
- hideClasses == true ifTrue:[ ^ nil ].
+ self hideClasses == true ifTrue:[ ^ nil ].
^ Tag::TClass
label:nm
pattern:nil
@@ -3100,7 +3355,7 @@
].
(def = 'defmethod' or:[def = 'define-method' or:[def = 'define-generic']]) ifTrue:[
(showOnly notNil and:[showOnly ~~ #methods]) ifTrue:[^ nil].
- hideLispMethods == true ifTrue:[ ^ nil ].
+ self hideLispMethods == true ifTrue:[ ^ nil ].
^ Tag::TMethod
label:nm
pattern:nil
@@ -3108,7 +3363,7 @@
lineNumber:lineNr.
].
(def = 'defpackage') ifTrue:[
- hideLispMethods == true ifTrue:[ ^ nil ].
+ self hideLispMethods == true ifTrue:[ ^ nil ].
^ Tag::TPackage
label:nm
pattern:nil
@@ -3116,15 +3371,15 @@
lineNumber:lineNr.
].
def = 'eval-when' ifTrue:[
- hideLispEvaluations == true ifTrue:[ ^ nil ].
+ self hideLispEvaluations == true ifTrue:[ ^ nil ].
^ Tag::TLispEval
- label:arg
+ label:nm
pattern:nil
type:nil
lineNumber:lineNr.
].
def = 'defstruct' ifTrue:[
- hideStructures == true ifTrue:[ ^ nil ].
+ self hideStructures == true ifTrue:[ ^ nil ].
^ Tag::TStruct
label:nm
pattern:nil
@@ -3133,7 +3388,7 @@
].
(def startsWith:'def') ifTrue:[
(showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
- hideFunctions == true ifTrue:[ ^ nil ].
+ self hideFunctions == true ifTrue:[ ^ nil ].
^ Tag::TFunction
label:nm
pattern:nil
@@ -3164,97 +3419,201 @@
;;; moretext documentation
"
- |targets line lineNr s tag|
-
- Tag autoload.
-
- targets := OrderedCollection new.
- s := aFilePath asFilename readStream.
- s notNil ifTrue:[
- s := LineNumberReadStream readingFrom:s.
- [s atEnd] whileFalse:[
- lineNr := s lineNumber.
- line := s nextLine.
-
- tag := self lispTagFromLine:line lineNr:lineNr.
- tag notNil ifTrue:[
- targets add:tag
- ].
- ].
- s close
- ].
- ^ targets
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self lispTagFromLine:line lineNr:lineNr
+ ]
"Modified: / 08-05-2011 / 10:12:29 / cg"
!
+luaTagFromLine:line lineNr:lineNr
+ "lua tags:
+ naive, q&d scan for lines starting with (not syntax-aware):
+ local function ...
+ "
+
+ |l nm words def isLocal|
+
+ l := line withoutSeparators.
+
+ (l startsWith:'--') ifTrue:[^ nil]. "/ comment
+
+ words := l splitByAny:(' (),',Character tab).
+ words size >= 2 ifFalse:[^ nil].
+
+ (isLocal := words first = 'local') ifTrue:[ words := words copyFrom:2 ].
+ words size <= 2 ifTrue:[ ^ nil ].
+ def := words first.
+ nm := words second.
+
+ def = 'function' ifTrue:[
+ (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
+ self hideFunctions == true ifTrue:[ ^ nil ].
+ ^ Tag::TFunction
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr.
+ ].
+
+ isLocal ifTrue:[
+ (words includes:'=') ifTrue:[
+ words := words copyTo:(words indexOf:'=')-1
+ ].
+ ^ words
+ collect:[:eachVar |
+ Tag::TVariable
+ label:eachVar
+ pattern:nil
+ type:nil
+ lineNumber:lineNr.
+ ]
+ as:Array.
+ ].
+
+ ^ nil
+!
+
+luaTagsInFile:aFilePath
+ "lua tags:
+ naive, q&d scan for lines starting with (not syntax-aware):
+ local function ...
+ "
+
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self luaTagFromLine:line lineNr:lineNr
+ ]
+!
+
+ozTagFromLine:line lineNr:lineNr
+ "oz tags:
+ naive, q&d scan for lines starting with:
+ fun { name ...
+ "
+
+ |l nm lineStream kwLen skipBrace type hideHolder|
+
+ l := line withoutSeparators.
+
+ kwLen := nil.
+ skipBrace := false.
+
+ (l startsWith:'class') ifTrue:[
+ kwLen := 5.
+ type := Tag::TClass.
+ hideHolder := self hideOzClasses.
+ ].
+ (l startsWith:'meth') ifTrue:[
+ kwLen := 4.
+ type := Tag::TMethod.
+ hideHolder := self hideOzMethods.
+ ].
+ (l startsWith:'fun') ifTrue:[
+ kwLen := 3.
+ skipBrace := true.
+ type := Tag::TFunction.
+ hideHolder := self hideOzFunctions.
+ ].
+ (l startsWith:'proc') ifTrue:[
+ kwLen := 4.
+ skipBrace := true.
+ type := Tag::TFunction.
+ hideHolder := self hideOzFunctions.
+ ].
+ hideHolder value ~~ true ifTrue:[
+ kwLen notNil ifTrue:[
+ lineStream := l readStream.
+ lineStream skip:kwLen; skipSeparators.
+
+ (skipBrace not or:[lineStream peek = ${ ]) ifTrue:[
+ skipBrace ifTrue:[lineStream skip:1; skipSeparators].
+ nm := lineStream upToElementForWhich:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not].
+ (nm notEmpty and:[nm first isLetterOrUnderline]) ifTrue:[
+ ^ type
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr.
+ ]
+ ]
+ ].
+ ].
+ ^ nil
+!
+
ozTagsInFile:aFilePath
"oz tags:
naive, q&d scan for lines starting with:
fun { name ...
"
- |targets line l lineNr nm s tag lineStream kwLen skipBrace type hideHolder|
-
- Tag autoload.
-
- targets := OrderedCollection new.
- s := aFilePath asFilename readStream.
- s notNil ifTrue:[
- s := LineNumberReadStream readingFrom:s.
- [s atEnd] whileFalse:[
- lineNr := s lineNumber.
- line := s nextLine.
- l := line withoutSeparators.
-
- kwLen := nil.
- skipBrace := false.
-
- (l startsWith:'class') ifTrue:[
- kwLen := 5.
- type := Tag::TClass.
- hideHolder := hideOzClasses.
- ].
- (l startsWith:'meth') ifTrue:[
- kwLen := 4.
- type := Tag::TMethod.
- hideHolder := hideOzMethods.
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self ozTagFromLine:line lineNr:lineNr
+ ]
+!
+
+phpTagFromLine:line lineNr:lineNr
+ "php tags:
+ naive, q&d scan for lines starting with:
+ var ...
+ class ...
+ function ...
+ "
+
+ |l nm lineStream|
+
+ l := line withoutSeparators.
+ (l startsWith:'public ') ifTrue:[ l := (l copyFrom:'public ' size + 1) withoutSeparators ].
+ (l startsWith:'private ') ifTrue:[ l := (l copyFrom:'private ' size + 1) withoutSeparators ].
+
+ (l startsWith:'var ') ifTrue:[
+ lineStream := (l copyFrom:'var ' size) readStream.
+ lineStream skipSeparators.
+ lineStream peek == $$ ifTrue:[
+ lineStream next.
+ nm := lineStream
+ nextMatching:[:c | c isLetter]
+ thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
+ ^ (Tag::TVariable
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ]
+ ] ifFalse:[
+ ((l startsWith:'class ') or:[l startsWith:'Class '])ifTrue:[
+ lineStream := (l copyFrom:'class ' size) readStream.
+ lineStream skipSeparators.
+ nm := lineStream
+ nextMatching:[:c | c isLetter]
+ thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
+ ^ (Tag::TClass
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ] ifFalse:[
+ ((l startsWith:'function ') or:[l startsWith:'Function ']) ifTrue:[
+ lineStream := (l copyFrom:'function ' size) readStream.
+ lineStream skipSeparators.
+ nm := lineStream
+ nextMatching:[:c | c isLetter or:[c == $_]]
+ thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
+ ^ (Tag::TFunction
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
].
- (l startsWith:'fun') ifTrue:[
- kwLen := 3.
- skipBrace := true.
- type := Tag::TFunction.
- hideHolder := hideOzFunctions.
- ].
- (l startsWith:'proc') ifTrue:[
- kwLen := 4.
- skipBrace := true.
- type := Tag::TFunction.
- hideHolder := hideOzFunctions.
- ].
- hideHolder value ~~ true ifTrue:[
- kwLen notNil ifTrue:[
- lineStream := l readStream.
- lineStream skip:kwLen; skipSeparators.
-
- (skipBrace not or:[lineStream peek = ${ ]) ifTrue:[
- skipBrace ifTrue:[lineStream skip:1; skipSeparators].
- nm := lineStream upToMatching:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not].
- (nm notEmpty and:[nm first isLetter or:[nm first = $_]]) ifTrue:[
- tag := type
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr.
- targets add:tag.
- ]
- ]
- ].
- ]
].
- s close
].
- ^ targets
+ ^ nil
!
phpTagsInFile:aFilePath
@@ -3265,64 +3624,34 @@
function ...
"
- |targets line l lineNr nm s lineStream|
-
- Tag autoload.
-
- targets := OrderedCollection new.
- s := aFilePath asFilename readStream.
- s notNil ifTrue:[
- s := LineNumberReadStream readingFrom:s.
- [s atEnd] whileFalse:[
- lineNr := s lineNumber.
- line := s nextLine.
- l := line withoutSeparators.
-
- (l startsWith:'var ') ifTrue:[
- lineStream := (l copyFrom:4) readStream.
- lineStream skipSeparators.
- lineStream peek == $$ ifTrue:[
- lineStream next.
- nm := lineStream
- nextMatching:[:c | c isLetter]
- thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
- targets add:(Tag::TVariable
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ]
- ] ifFalse:[
- (l startsWith:'class ') ifTrue:[
- lineStream := (l copyFrom:6) readStream.
- lineStream skipSeparators.
- nm := lineStream
- nextMatching:[:c | c isLetter]
- thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
- targets add:(Tag::TClass
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ] ifFalse:[
- (l startsWith:'function ') ifTrue:[
- lineStream := (l copyFrom:9) readStream.
- lineStream skipSeparators.
- nm := lineStream
- nextMatching:[:c | c isLetter]
- thenMatching:[:c | c isLetterOrDigit or:[c == $_]].
- targets add:(Tag::TFunction
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ].
- ].
- ].
- ].
- s close
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self phpTagFromLine:line lineNr:lineNr
+ ]
+!
+
+prologTagFromLine:line lineNr:lineNr
+ "prolog tags:
+ naive, q&d scan for lines matching:
+ <anything> :-
+ "
+
+ |l nm|
+
+ l := line withoutSeparators.
+
+ (l includesString:':-') ifTrue:[
+ (l startsWith:':-') ifFalse:[
+ nm := l copyTo:(l indexOfSubCollection:':-').
+ ^ (Tag::TPrologClause
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ]
].
- ^ targets
+ ^ nil
!
prologTagsInFile:aFilePath
@@ -3331,38 +3660,11 @@
<anything> :-
"
- |targets line l lineNr nm s|
-
- Tag autoload.
-
- targets := OrderedCollection new.
- s := aFilePath asFilename readStream.
- s notNil ifTrue:[
- s := LineNumberReadStream readingFrom:s.
- [s atEnd] whileFalse:[
- lineNr := s lineNumber.
- line := s nextLine.
- l := line withoutSeparators.
-
- (l includesString:':-') ifTrue:[
- (l startsWith:':-') ifFalse:[
- nm := l copyTo:(l indexOfSubCollection:':-').
- targets add:(Tag::TPrologClause
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ]
- ]
- ].
- s close
- ].
- ^ targets
-
-
-
-
-
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self prologTagFromLine:line lineNr:lineNr
+ ]
!
pythonTagsInFile:aFilePath
@@ -3405,7 +3707,7 @@
nm := nm withoutSeparators.
(showOnly ~~ #pythonFunctions
and:[showOnly ~~ #pythonMethods]) ifTrue:[
- hidePythonClasses ~~ true ifTrue:[
+ self hidePythonClasses ~~ true ifTrue:[
targets add:(Tag::TClass
label:nm
pattern:nil
@@ -3426,7 +3728,7 @@
inClass size > 0 ifTrue:[
(showOnly ~~ #pythonFunctions
and:[showOnly ~~ #pythonClasses]) ifTrue:[
- hidePythonMethods ~~ true ifTrue:[
+ self hidePythonMethods ~~ true ifTrue:[
nm := inClass first , '.' , nm.
targets add:(Tag::TMethod
label:nm
@@ -3438,7 +3740,7 @@
] ifFalse:[
(showOnly ~~ #pythonClasses
and:[showOnly ~~ #pythonMethods]) ifTrue:[
- hidePythonFunctions ~~ true ifTrue:[
+ self hidePythonFunctions ~~ true ifTrue:[
targets add:(Tag::TFunction
label:nm
pattern:nil
@@ -3459,48 +3761,51 @@
"Modified: / 08-05-2011 / 10:39:10 / cg"
!
+rubyTagFromLine:line lineNr:lineNr
+ "ruby tags:
+ naive, q&d scan for lines matching:
+ def any
+ "
+
+ |l nm|
+
+ l := line withoutSeparators.
+
+ (l startsWith:'def ') ifTrue:[
+ nm := l copyFrom:5.
+ ^ (Tag::TFunction
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ] ifFalse:[
+ (l startsWith:'class ') ifTrue:[
+ self hideClasses == true ifFalse:[
+ nm := l copyFrom:6.
+ ^ (Tag::TClass
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ]
+ ].
+ ].
+ ^ nil
+
+ "Modified: / 08-05-2011 / 10:38:44 / cg"
+!
+
rubyTagsInFile:aFilePath
"ruby tags:
naive, q&d scan for lines matching:
def any
"
- |targets line l lineNr nm s|
-
- Tag autoload.
-
- targets := OrderedCollection new.
- s := aFilePath asFilename readStream.
- s notNil ifTrue:[
- s := LineNumberReadStream readingFrom:s.
- [s atEnd] whileFalse:[
- lineNr := s lineNumber.
- line := s nextLine.
- l := line withoutSeparators.
-
- (l startsWith:'def ') ifTrue:[
- nm := l copyFrom:5.
- targets add:(Tag::TFunction
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ] ifFalse:[
- (l startsWith:'class ') ifTrue:[
- hideClasses == true ifFalse:[
- nm := l copyFrom:6.
- targets add:(Tag::TClass
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ]
- ].
- ].
- ].
- s close
- ].
- ^ targets
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self rubyTagFromLine:line lineNr:lineNr
+ ]
"Modified: / 08-05-2011 / 10:38:44 / cg"
!
@@ -3524,11 +3829,13 @@
"/ new interface: block-arg to #changesFromStream:do: gets 3 args
[
ChangeSet::InvalidChangeChunkError handle:[:ex |
- Dialog warn:('Error while processing changes - skipping: ' , aFilePath asFilename pathName).
+ Dialog warn:('TagList [info]: Error while processing changes in "%1":\\%2' withCRs
+ bindWith:aFilePath asFilename pathName
+ with: ex description).
] do:[
ChangeSet changesFromStream:s do:[:aChange :lNr :pos|
aChange isClassDefinitionChange ifTrue:[
- hideClasses == true ifFalse:[
+ self hideClasses == true ifFalse:[
targets add:(Tag::TClass
label:(aChange className)
pattern:('/subclass:')
@@ -3537,7 +3844,7 @@
]
] ifFalse:[
aChange isMethodChange ifTrue:[
- hideMethods == true ifFalse:[
+ self hideMethods == true ifFalse:[
targets add:((Tag::TMethod
label:(aChange selector)
pattern:('/^' , aChange selector)
@@ -3585,58 +3892,59 @@
"Created: / 05-01-2012 / 10:56:26 / cg"
!
+tclTagFromLine:line lineNr:lineNr
+ "tcl tags:
+ naive, q&d scan for lines matching:
+ proc any
+ "
+
+ |l nm words|
+
+ l := line withoutSeparators.
+
+ (l startsWith:'proc ') ifTrue:[
+ nm := l withoutPrefix:'proc '.
+ ^(Tag::TFunction
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ] ifFalse:[ (l startsWith:'tixWidgetClass ') ifTrue:[
+ nm := l copyFrom:'tixWidgetClass ' size + 1.
+ (nm endsWith:'{') ifTrue:[
+ nm := (nm copyButLast) withoutSeparators.
+ ].
+ ^(Tag::TClass
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ] ifFalse:[ (l startsWith:'set ') ifTrue:[
+ self hideVariables ~~ true ifTrue:[
+ words := l asCollectionOfWords.
+ words size >= 2 ifTrue:[
+ nm := words second.
+ ^(Tag::TVariable
+ label:nm
+ pattern:nil
+ type:nil
+ lineNumber:lineNr).
+ ]
+ ]]]].
+ ^ nil
+!
+
tclTagsInFile:aFilePath
"tcl tags:
naive, q&d scan for lines matching:
proc any
"
- |targets line l lineNr nm s words|
-
- Tag autoload.
-
- targets := OrderedCollection new.
- s := aFilePath asFilename readStream.
- s notNil ifTrue:[
- s := LineNumberReadStream readingFrom:s.
- [s atEnd] whileFalse:[
- lineNr := s lineNumber.
- line := s nextLine.
- l := line withoutSeparators.
-
- (l startsWith:'proc ') ifTrue:[
- nm := l withoutPrefix:'proc '.
- targets add:(Tag::TFunction
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ] ifFalse:[ (l startsWith:'tixWidgetClass ') ifTrue:[
- nm := l copyFrom:'tixWidgetClass ' size + 1.
- (nm endsWith:'{') ifTrue:[
- nm := (nm copyButLast:1) withoutSeparators.
- ].
- targets add:(Tag::TClass
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ] ifFalse:[ (l startsWith:'set ') ifTrue:[
- hideVariables value ~~ true ifTrue:[
- words := l asCollectionOfWords.
- words size >= 2 ifTrue:[
- nm := words second.
- targets add:(Tag::TVariable
- label:nm
- pattern:nil
- type:nil
- lineNumber:lineNr).
- ]
- ]]]].
- ].
- s close
- ].
- ^ targets
+ ^ self
+ linewiseNaiveTagsInFile:aFilePath
+ using:[:line :lineNr |
+ self tclTagFromLine:line lineNr:lineNr
+ ]
!
yaccTagsInFile:aFilePath
@@ -3687,19 +3995,14 @@
!TagList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.38 2013-10-15 01:30:27 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.38 2013-10-15 01:30:27 cg Exp $'
-!
-
-version_HG
-
- ^ '$Changeset: <not expanded> $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
!
version_SVN
- ^ '$Id: Tools__TagList.st,v 1.38 2013-10-15 01:30:27 cg Exp $'
+ ^ '$Id: Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
! !