Tools__TagList.st
branchjv
changeset 15686 4b9d86489538
parent 15566 184cea584be5
parent 15685 cb80119a7e8b
child 15690 1afab78e235e
--- a/Tools__TagList.st	Wed Jun 10 06:37:08 2015 +0200
+++ b/Tools__TagList.st	Sat Jun 13 07:00:47 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG 
 	      All Rights Reserved
@@ -88,6 +90,7 @@
     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
     TagsSuffixes at:#'text/batch'               put:#( 'bat' ).
+    TagsSuffixes at:#'text/xml-xsd'             put:#( 'xsd' ).
     ^ TagsSuffixes
 
     "Modified: / 28-09-2012 / 14:48:25 / cg"
@@ -262,6 +265,12 @@
     ^ self tagsSuffixes at:#'text/tcl'
 !
 
+xsdSuffixes
+    "returns a list of supported xsd-suffixes
+    "
+    ^ self tagsSuffixes at:#'text/xml-xsd'
+!
+
 yaccSuffixes
     "returns a list of supported yacc-suffixes
     "
@@ -398,6 +407,10 @@
     ^ self isSuffix:suffix in:self tclSuffixes
 !
 
+isXSDSuffix:suffix
+    ^ self isSuffix:suffix in:self xsdSuffixes
+!
+
 isYaccSuffix:suffix
     ^ self isSuffix:suffix in:self yaccSuffixes
 ! !
@@ -2995,6 +3008,11 @@
         "/ batch tags - simulated
         ^ self batchTagsInFile:pathName
     ].
+    ((self class isXSDSuffix:suffix)
+    or:[(mime ? '') includesString:'xsd']) ifTrue:[
+        "/ xsd tags - simulated
+        ^ self xsdTagsInFile:pathName
+    ].
 
     "/ could add more here ...
     ^ nil.
@@ -3947,6 +3965,49 @@
               ]
 !
 
+xsdTagFromLine:line lineNr:lineNr
+    "tcl tags:
+     naive, q&d scan for lines matching:
+        <xsd:complexType...
+        <xsd:simpleType ...
+     Should be replaced by a more sophisticated reader, which parses the xml first.    
+    "
+
+    |l nm i1 i2|
+
+    l := line withoutSeparators.
+
+    ((l startsWith:'<xsd:complexType ') or:[l startsWith:'<xsd:simpleType ']) ifTrue:[
+        i1 := l findString:'name="'.        
+        i1 ~~ 0 ifTrue:[
+            nm := l copyFrom:(i1 + 'name="' size).
+            i2 := nm indexOf:$".
+            nm := nm copyTo:i2-1.
+            ^(Tag::TTypedef 
+                            label:nm 
+                            pattern:nil
+                            type:nil
+                            lineNumber:lineNr).
+        ].
+    ].
+    ^ nil
+!
+
+xsdTagsInFile:aFilePath
+    "xsd tags:
+     naive, q&d scan for lines matching:
+        <xsd:complexType...
+        <xsd:simpleType ...
+     Should be replaced by a more sophisticated reader, which parses the xml first.    
+    "
+
+    ^ self
+        linewiseNaiveTagsInFile:aFilePath 
+        using:[:line :lineNr |
+                self xsdTagFromLine:line lineNr:lineNr
+              ]
+!
+
 yaccTagsInFile:aFilePath
     "yacc tags:
      naive, q&d scan for lines matching:
@@ -3995,14 +4056,14 @@
 !TagList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
+    ^ '$Header$'
 !
 
 version_SVN
-    ^ '$Id: Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
+    ^ '$Id$'
 ! !