Tools__TagList.st
changeset 15685 cb80119a7e8b
parent 15328 a0b7e6d0e919
child 15686 4b9d86489538
child 15689 b4c8ceff3fe5
equal deleted inserted replaced
15683:dbf1e874fc93 15685:cb80119a7e8b
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2002 by eXept Software AG 
     4  COPYRIGHT (c) 2002 by eXept Software AG 
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
    86     TagsSuffixes at:#'text/smalltalk'           put:#( 'st' ).
    88     TagsSuffixes at:#'text/smalltalk'           put:#( 'st' ).
    87     TagsSuffixes at:#'text/tcl'                 put:#( 'tcl' ).
    89     TagsSuffixes at:#'text/tcl'                 put:#( 'tcl' ).
    88     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
    90     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
    89     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
    91     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
    90     TagsSuffixes at:#'text/batch'               put:#( 'bat' ).
    92     TagsSuffixes at:#'text/batch'               put:#( 'bat' ).
       
    93     TagsSuffixes at:#'text/xml-xsd'             put:#( 'xsd' ).
    91     ^ TagsSuffixes
    94     ^ TagsSuffixes
    92 
    95 
    93     "Modified: / 28-09-2012 / 14:48:25 / cg"
    96     "Modified: / 28-09-2012 / 14:48:25 / cg"
    94 ! !
    97 ! !
    95 
    98 
   260     "returns a list of supported tcl-suffixes
   263     "returns a list of supported tcl-suffixes
   261     "
   264     "
   262     ^ self tagsSuffixes at:#'text/tcl'
   265     ^ self tagsSuffixes at:#'text/tcl'
   263 !
   266 !
   264 
   267 
       
   268 xsdSuffixes
       
   269     "returns a list of supported xsd-suffixes
       
   270     "
       
   271     ^ self tagsSuffixes at:#'text/xml-xsd'
       
   272 !
       
   273 
   265 yaccSuffixes
   274 yaccSuffixes
   266     "returns a list of supported yacc-suffixes
   275     "returns a list of supported yacc-suffixes
   267     "
   276     "
   268     ^ self tagsSuffixes at:#'text/yacc'
   277     ^ self tagsSuffixes at:#'text/yacc'
   269 ! !
   278 ! !
   394     ^ self isSuffix:suffix in:self smalltalkSuffixes
   403     ^ self isSuffix:suffix in:self smalltalkSuffixes
   395 !
   404 !
   396 
   405 
   397 isTCLSuffix:suffix
   406 isTCLSuffix:suffix
   398     ^ self isSuffix:suffix in:self tclSuffixes
   407     ^ self isSuffix:suffix in:self tclSuffixes
       
   408 !
       
   409 
       
   410 isXSDSuffix:suffix
       
   411     ^ self isSuffix:suffix in:self xsdSuffixes
   399 !
   412 !
   400 
   413 
   401 isYaccSuffix:suffix
   414 isYaccSuffix:suffix
   402     ^ self isSuffix:suffix in:self yaccSuffixes
   415     ^ self isSuffix:suffix in:self yaccSuffixes
   403 ! !
   416 ! !
  2993     ((self class isBatchSuffix:suffix)
  3006     ((self class isBatchSuffix:suffix)
  2994     or:[(mime ? '') includesString:'batch']) ifTrue:[
  3007     or:[(mime ? '') includesString:'batch']) ifTrue:[
  2995         "/ batch tags - simulated
  3008         "/ batch tags - simulated
  2996         ^ self batchTagsInFile:pathName
  3009         ^ self batchTagsInFile:pathName
  2997     ].
  3010     ].
       
  3011     ((self class isXSDSuffix:suffix)
       
  3012     or:[(mime ? '') includesString:'xsd']) ifTrue:[
       
  3013         "/ xsd tags - simulated
       
  3014         ^ self xsdTagsInFile:pathName
       
  3015     ].
  2998 
  3016 
  2999     "/ could add more here ...
  3017     "/ could add more here ...
  3000     ^ nil.
  3018     ^ nil.
  3001 
  3019 
  3002     "Created: / 05-01-2012 / 10:55:03 / cg"
  3020     "Created: / 05-01-2012 / 10:55:03 / cg"
  3945         using:[:line :lineNr |
  3963         using:[:line :lineNr |
  3946                 self tclTagFromLine:line lineNr:lineNr
  3964                 self tclTagFromLine:line lineNr:lineNr
  3947               ]
  3965               ]
  3948 !
  3966 !
  3949 
  3967 
       
  3968 xsdTagFromLine:line lineNr:lineNr
       
  3969     "tcl tags:
       
  3970      naive, q&d scan for lines matching:
       
  3971         <xsd:complexType...
       
  3972         <xsd:simpleType ...
       
  3973      Should be replaced by a more sophisticated reader, which parses the xml first.    
       
  3974     "
       
  3975 
       
  3976     |l nm i1 i2|
       
  3977 
       
  3978     l := line withoutSeparators.
       
  3979 
       
  3980     ((l startsWith:'<xsd:complexType ') or:[l startsWith:'<xsd:simpleType ']) ifTrue:[
       
  3981         i1 := l findString:'name="'.        
       
  3982         i1 ~~ 0 ifTrue:[
       
  3983             nm := l copyFrom:(i1 + 'name="' size).
       
  3984             i2 := nm indexOf:$".
       
  3985             nm := nm copyTo:i2-1.
       
  3986             ^(Tag::TTypedef 
       
  3987                             label:nm 
       
  3988                             pattern:nil
       
  3989                             type:nil
       
  3990                             lineNumber:lineNr).
       
  3991         ].
       
  3992     ].
       
  3993     ^ nil
       
  3994 !
       
  3995 
       
  3996 xsdTagsInFile:aFilePath
       
  3997     "xsd tags:
       
  3998      naive, q&d scan for lines matching:
       
  3999         <xsd:complexType...
       
  4000         <xsd:simpleType ...
       
  4001      Should be replaced by a more sophisticated reader, which parses the xml first.    
       
  4002     "
       
  4003 
       
  4004     ^ self
       
  4005         linewiseNaiveTagsInFile:aFilePath 
       
  4006         using:[:line :lineNr |
       
  4007                 self xsdTagFromLine:line lineNr:lineNr
       
  4008               ]
       
  4009 !
       
  4010 
  3950 yaccTagsInFile:aFilePath
  4011 yaccTagsInFile:aFilePath
  3951     "yacc tags:
  4012     "yacc tags:
  3952      naive, q&d scan for lines matching:
  4013      naive, q&d scan for lines matching:
  3953         <anything>:
  4014         <anything>:
  3954     "
  4015     "
  3993 ! !
  4054 ! !
  3994 
  4055 
  3995 !TagList class methodsFor:'documentation'!
  4056 !TagList class methodsFor:'documentation'!
  3996 
  4057 
  3997 version
  4058 version
  3998     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
  4059     ^ '$Header$'
  3999 !
  4060 !
  4000 
  4061 
  4001 version_CVS
  4062 version_CVS
  4002     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
  4063     ^ '$Header$'
  4003 !
  4064 !
  4004 
  4065 
  4005 version_SVN
  4066 version_SVN
  4006     ^ '$Id: Tools__TagList.st,v 1.72 2015-02-19 20:39:05 cg Exp $'
  4067     ^ '$Id$'
  4007 ! !
  4068 ! !
  4008 
  4069