Tools__TagList.st
branchjv
changeset 15913 e04d90e07439
parent 15856 8436d7f427c9
parent 15912 6edd447ce2c8
child 16053 85a1b78120ab
--- a/Tools__TagList.st	Thu Oct 22 06:46:29 2015 +0200
+++ b/Tools__TagList.st	Tue Oct 27 06:40:43 2015 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2002 by eXept Software AG 
 	      All Rights Reserved
@@ -3325,7 +3323,7 @@
 
 lispTagFromLine:line lineNr:lineNr
     "lisp/scheme tags:
-     naive, q&d scan for lines starting with (not syntax-aware):
+     naive, q&d scan for lines starting with:
         (define ...
         (defun ...
         (defvar ...
@@ -3339,7 +3337,12 @@
         (set ...
         (constant ...
         (defconstant ...
+        (define-constant ...
         ;;; more        documentation
+    
+     This is NOT syntax aware, so affected by formatting, line breaks etc.
+     Just enough to allow most scheme and lisp programs to be tagged and
+     viewed in the file browser. For real lisp work, more is needed.    
     "
 
     |l nm words def inParens rest|
@@ -3351,6 +3354,7 @@
         self hideDocumentation == true ifTrue:[ ^ nil ].
 
         (l startsWith:';;;') ifFalse:[^ nil].
+
         rest := (l copyFrom:4) withoutSeparators.
         rest isEmpty ifTrue:[^ nil].
         (rest conform:[:ch | ch == $;]) ifTrue:[^ nil].
@@ -3366,27 +3370,24 @@
 
     def := words first.
     nm := words second.
-    (inParens := nm startsWith:'(') ifTrue:[
-        nm := nm copyFrom:2.
-    ] ifFalse:[
-        nm := nm upTo:$(.    "/ in case it is (define foo() - without space after name
+
+    "/ inparens is true if we have (define (name
+    (inParens := nm = '(') ifTrue:[
+        words size > 2 ifTrue:[ nm := words third ] ifFalse:[ nm := '' ].
+    ] ifFalse:[    
         (inParens := nm startsWith:'(') ifTrue:[
             nm := nm copyFrom:2.
+        ] ifFalse:[
+            nm := nm upTo:$(.    "/ in case it is (define foo() - without space after name
+            (inParens := nm startsWith:'(') ifTrue:[
+                nm := nm copyFrom:2.
+            ].
         ].
-    ].
+    ].    
     (nm endsWith:')') ifTrue:[
         nm := nm copyButLast
     ].
 
-    def = 'defun' ifTrue:[
-        (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
-        self hideFunctions == true ifTrue:[ ^ nil ].
-        ^ Tag::TFunction 
-                        label:nm 
-                        pattern:nil
-                        type:nil
-                        lineNumber:lineNr.
-    ].
     def = 'define' ifTrue:[             "/ scheme
         inParens ifTrue:[
             (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
@@ -3436,6 +3437,16 @@
         ^ nil
     ].
 
+    def = 'defun' ifTrue:[
+        (showOnly notNil and:[showOnly ~~ #functions]) ifTrue:[^ nil].
+        self hideFunctions == true ifTrue:[ ^ nil ].
+
+        ^ Tag::TFunction 
+                        label:nm 
+                        pattern:nil
+                        type:nil
+                        lineNumber:lineNr.
+    ].
     def = 'defvar' ifTrue:[
         (showOnly notNil and:[showOnly ~~ #variables]) ifTrue:[^ nil].
         self hideVariables == true ifTrue:[ ^ nil ].
@@ -3453,7 +3464,7 @@
                         type:nil
                         lineNumber:lineNr.
     ].
-    (def = 'defconstant' or:[def = 'constant']) ifTrue:[
+    (def = 'defconstant' or:[def = 'define-constant' or:[def = 'constant']]) ifTrue:[
         (showOnly notNil and:[showOnly ~~ #constants]) ifTrue:[^ nil].
         self hideLispConstants == true ifTrue:[ ^ nil ].
         ^ Tag::TLispConstant