Tools__TagList.st
changeset 11825 c84921788303
parent 11802 79d02540b382
child 11830 b553a8ffa183
equal deleted inserted replaced
11824:8a246849d69a 11825:c84921788303
    95     TagsSuffixes at:#'text/oz'                  put:#( 'oz').
    95     TagsSuffixes at:#'text/oz'                  put:#( 'oz').
    96     TagsSuffixes at:#'text/smalltalk'           put:#( 'st' ).
    96     TagsSuffixes at:#'text/smalltalk'           put:#( 'st' ).
    97     TagsSuffixes at:#'text/tcl'                 put:#( 'tcl' ).
    97     TagsSuffixes at:#'text/tcl'                 put:#( 'tcl' ).
    98     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
    98     TagsSuffixes at:#'text/ruby'                put:#( 'rb' ).
    99     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
    99     TagsSuffixes at:#'text/yacc'                put:#( 'y' ).
       
   100     TagsSuffixes at:#'text/batch'               put:#( 'bat' ).
   100     ^ TagsSuffixes
   101     ^ TagsSuffixes
   101 
   102 
   102     "Modified: / 22-08-2012 / 21:05:15 / cg"
   103     "Modified: / 28-09-2012 / 14:48:25 / cg"
   103 ! !
   104 ! !
   104 
   105 
   105 !TagList class methodsFor:'defaults'!
   106 !TagList class methodsFor:'defaults'!
   106 
   107 
   107 arcLispSuffixes
   108 arcLispSuffixes
   112 
   113 
   113 assemblerSuffixes
   114 assemblerSuffixes
   114     "returns a list of supported assembler-suffixes"
   115     "returns a list of supported assembler-suffixes"
   115 
   116 
   116     ^ self tagsSuffixes at:#'text/asm'
   117     ^ self tagsSuffixes at:#'text/asm'
       
   118 !
       
   119 
       
   120 batchSuffixes
       
   121     "returns a list of supported batchfile-suffixes
       
   122     "
       
   123     ^ self tagsSuffixes at:#'text/batch'
       
   124 
       
   125     "Created: / 28-09-2012 / 14:48:41 / cg"
   117 !
   126 !
   118 
   127 
   119 cPlusPlusSuffixes
   128 cPlusPlusSuffixes
   120     "returns a list of supported c-suffixes"
   129     "returns a list of supported c-suffixes"
   121 
   130 
   269     ^ self isSuffix:suffix in:self arcLispSuffixes
   278     ^ self isSuffix:suffix in:self arcLispSuffixes
   270 !
   279 !
   271 
   280 
   272 isAssemblerSuffix:suffix
   281 isAssemblerSuffix:suffix
   273     ^ self isSuffix:suffix in:self assemblerSuffixes
   282     ^ self isSuffix:suffix in:self assemblerSuffixes
       
   283 !
       
   284 
       
   285 isBatchSuffix:suffix
       
   286     ^ self isSuffix:suffix in:self batchSuffixes
       
   287 
       
   288     "Created: / 28-09-2012 / 14:47:43 / cg"
   274 !
   289 !
   275 
   290 
   276 isCPlusPlusSuffix:suffix
   291 isCPlusPlusSuffix:suffix
   277     ^ self isSuffix:suffix in:self cPlusPlusSuffixes
   292     ^ self isSuffix:suffix in:self cPlusPlusSuffixes
   278 !
   293 !
  2485     ^ targets
  2500     ^ targets
  2486 
  2501 
  2487     "Modified: / 13-05-2012 / 11:25:49 / cg"
  2502     "Modified: / 13-05-2012 / 11:25:49 / cg"
  2488 !
  2503 !
  2489 
  2504 
       
  2505 batchTagsInFile:aFilePath
       
  2506     "batch-file
       
  2507      naive, q&d scan for lines matching:
       
  2508         :<anything>
       
  2509     "
       
  2510 
       
  2511     |targets line l lineNr nm s words|
       
  2512 
       
  2513     Tag autoload.
       
  2514 
       
  2515     targets := OrderedCollection new.
       
  2516     s := aFilePath asFilename readStream.
       
  2517     s notNil ifTrue:[
       
  2518         s := LineNumberReadStream readingFrom:s.
       
  2519         [s atEnd] whileFalse:[
       
  2520             line := s nextLine.
       
  2521             (line startsWith:$:) ifTrue:[
       
  2522                 l := line withoutSeparators.
       
  2523                 words := (l copyFrom:2) asCollectionOfWords.
       
  2524 
       
  2525                 words size == 1 ifTrue:[
       
  2526                     nm := words first.
       
  2527 
       
  2528                     lineNr := s lineNumber - 1.
       
  2529                     targets add:(Tag::TLabel
       
  2530                                     label:nm 
       
  2531                                     pattern:nil
       
  2532                                     type:nil
       
  2533                                     lineNumber:lineNr).
       
  2534                 ].
       
  2535             ]
       
  2536         ].
       
  2537         s close
       
  2538     ].
       
  2539     ^ targets
       
  2540 
       
  2541     "Created: / 28-09-2012 / 14:45:10 / cg"
       
  2542 !
       
  2543 
  2490 dartTagsInFile:aFilePath
  2544 dartTagsInFile:aFilePath
  2491     "dart tags:
  2545     "dart tags:
  2492      naive, q&d scan for lines matching:
  2546      naive, q&d scan for lines matching:
  2493         interface foo
  2547         interface foo
  2494         class foo
  2548         class foo
  2608     ].
  2662     ].
  2609 
  2663 
  2610     (self class isHTMLSuffix:suffix) ifTrue:[
  2664     (self class isHTMLSuffix:suffix) ifTrue:[
  2611         "/ html tags - simulated
  2665         "/ html tags - simulated
  2612         ^ self htmlTagsInFile:pathName
  2666         ^ self htmlTagsInFile:pathName
       
  2667     ].
       
  2668     (self class isBatchSuffix:suffix) ifTrue:[
       
  2669         "/ batch tags - simulated
       
  2670         ^ self batchTagsInFile:pathName
  2613     ].
  2671     ].
  2614 
  2672 
  2615     "/ could add more here ...
  2673     "/ could add more here ...
  2616     ^ nil.
  2674     ^ nil.
  2617 
  2675 
  3435     ^ targets
  3493     ^ targets
  3436 
  3494 
  3437     "Created: / 05-01-2012 / 10:56:26 / cg"
  3495     "Created: / 05-01-2012 / 10:56:26 / cg"
  3438 !
  3496 !
  3439 
  3497 
       
  3498 tagsForLinesStartingWithIdentifierAndColon:aFilePath
       
  3499     "helper for yacc tags (and maybe others in the future):
       
  3500      naive, q&d scan for lines matching:
       
  3501         <anything>:
       
  3502     "
       
  3503 
       
  3504     |targets line l lineNr nm s words w|
       
  3505 
       
  3506     Tag autoload.
       
  3507 
       
  3508     targets := OrderedCollection new.
       
  3509     s := aFilePath asFilename readStream.
       
  3510     s notNil ifTrue:[
       
  3511         s := LineNumberReadStream readingFrom:s.
       
  3512         [s atEnd] whileFalse:[
       
  3513             line := s nextLine.
       
  3514             l := line withoutSeparators.
       
  3515             words := l asCollectionOfWords.
       
  3516 
       
  3517             words size >= 1 ifTrue:[
       
  3518                 w := words first.
       
  3519                 (w endsWith:$:) ifTrue:[
       
  3520                     nm := w copyWithoutLast:1.
       
  3521 
       
  3522                     lineNr := s lineNumber - 1.
       
  3523                     targets add:(Tag::TLabel
       
  3524                                     label:nm 
       
  3525                                     pattern:nil
       
  3526                                     type:nil
       
  3527                                     lineNumber:lineNr).
       
  3528                 ].
       
  3529             ]
       
  3530         ].
       
  3531         s close
       
  3532     ].
       
  3533     ^ targets
       
  3534 
       
  3535     "Created: / 28-09-2012 / 14:45:35 / cg"
       
  3536 !
       
  3537 
  3440 tclTagsInFile:aFilePath
  3538 tclTagsInFile:aFilePath
  3441     "tcl tags:
  3539     "tcl tags:
  3442      naive, q&d scan for lines matching:
  3540      naive, q&d scan for lines matching:
  3443         proc any
  3541         proc any
  3444     "
  3542     "
  3500     "yacc tags:
  3598     "yacc tags:
  3501      naive, q&d scan for lines matching:
  3599      naive, q&d scan for lines matching:
  3502         <anything>:
  3600         <anything>:
  3503     "
  3601     "
  3504 
  3602 
  3505     |targets line l lineNr nm s words w 
  3603     ^ self tagsForLinesStartingWithIdentifierAndColon:aFilePath
  3506        |
  3604 
  3507 
  3605     "Modified: / 28-09-2012 / 14:45:52 / cg"
  3508     Tag autoload.
       
  3509 
       
  3510     targets := OrderedCollection new.
       
  3511     s := aFilePath asFilename readStream.
       
  3512     s notNil ifTrue:[
       
  3513         s := LineNumberReadStream readingFrom:s.
       
  3514         [s atEnd] whileFalse:[
       
  3515             line := s nextLine.
       
  3516             l := line withoutSeparators.
       
  3517             words := l asCollectionOfWords.
       
  3518 
       
  3519             words size >= 1 ifTrue:[
       
  3520                 w := words first.
       
  3521                 (w endsWith:$:) ifTrue:[
       
  3522                     nm := w copyWithoutLast:1.
       
  3523 
       
  3524                     lineNr := s lineNumber - 1.
       
  3525                     targets add:(Tag::TLabel
       
  3526                                     label:nm 
       
  3527                                     pattern:nil
       
  3528                                     type:nil
       
  3529                                     lineNumber:lineNr).
       
  3530                 ].
       
  3531             ]
       
  3532         ].
       
  3533         s close
       
  3534     ].
       
  3535     ^ targets
       
  3536 ! !
  3606 ! !
  3537 
  3607 
  3538 !TagList methodsFor:'testing'!
  3608 !TagList methodsFor:'testing'!
  3539 
  3609 
  3540 supportsFile:aFile
  3610 supportsFile:aFile
  3577 ! !
  3647 ! !
  3578 
  3648 
  3579 !TagList class methodsFor:'documentation'!
  3649 !TagList class methodsFor:'documentation'!
  3580 
  3650 
  3581 version
  3651 version
  3582     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.18 2012-09-12 15:59:53 cg Exp $'
  3652     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.19 2012-09-28 12:52:41 cg Exp $'
  3583 !
  3653 !
  3584 
  3654 
  3585 version_CVS
  3655 version_CVS
  3586     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.18 2012-09-12 15:59:53 cg Exp $'
  3656     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.19 2012-09-28 12:52:41 cg Exp $'
  3587 !
  3657 !
  3588 
  3658 
  3589 version_SVN
  3659 version_SVN
  3590     ^ '§Id§'
  3660     ^ '§Id§'
  3591 ! !
  3661 ! !