AbstractSourceCodeManager.st
changeset 4398 7b8a930e2477
parent 4350 f1a7e2ceb439
child 4399 253988bc5ff2
equal deleted inserted replaced
4397:7c728af1ad07 4398:7b8a930e2477
  4114     "
  4114     "
  4115      self ensureDollarsInVersionMethod:'foo ^ ''hello'' ' 
  4115      self ensureDollarsInVersionMethod:'foo ^ ''hello'' ' 
  4116      self ensureDollarsInVersionMethod:'foo ^ ''§hello§'' ' 
  4116      self ensureDollarsInVersionMethod:'foo ^ ''§hello§'' ' 
  4117      self ensureDollarsInVersionMethod:'foo ^ ''   hello   '' '    
  4117      self ensureDollarsInVersionMethod:'foo ^ ''   hello   '' '    
  4118      self ensureDollarsInVersionMethod:'foo ^ ''$','Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.228 2009/10/20 09:55:58 fm Exp $'' '      
  4118      self ensureDollarsInVersionMethod:'foo ^ ''$','Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.228 2009/10/20 09:55:58 fm Exp $'' '      
       
  4119      self ensureDollarsInVersionMethod:'foo ^ ''$Head'' '    
  4119     -- errors:
  4120     -- errors:
  4120      self ensureDollarsInVersionMethod:'foo ^ ''$Head'' '    
       
  4121      self ensureDollarsInVersionMethod:'foo ^ ''Header$'' '    
  4121      self ensureDollarsInVersionMethod:'foo ^ ''Header$'' '    
  4122     "
  4122     "
       
  4123 
       
  4124     "Modified (comment): / 12-02-2019 / 00:03:45 / Claus Gittinger"
  4123 !
  4125 !
  4124 
  4126 
  4125 ensureKeyword: keyword inVersionMethod: source
  4127 ensureKeyword: keyword inVersionMethod: source
  4126 
  4128 
  4127     | startQuote endQuote doubleColon |
  4129     | startQuote endQuote doubleColon |
  4168 
  4170 
  4169 ensureKeywordExpansionWith: aCharacter inVersionMethod:aString
  4171 ensureKeywordExpansionWith: aCharacter inVersionMethod:aString
  4170     "given the source code of my version method, ensure that it contains aCharacter for
  4172     "given the source code of my version method, ensure that it contains aCharacter for
  4171      proper keyword expansion"
  4173      proper keyword expansion"
  4172 
  4174 
  4173     |indexOfFirstQuote indexOfNextAfterFirstQuote indexOfSecondDollar indexOfNextAfterSecondDollar indexOfLastQuote|
  4175     |indexOfFirstQuote indexOfSecondQuote
       
  4176      indexOfNextAfterFirstQuote indexOfSecondDollar indexOfNextAfterSecondDollar indexOfLastQuote|
  4174 
  4177 
  4175     indexOfFirstQuote := aString indexOf:$'.
  4178     indexOfFirstQuote := aString indexOf:$'.
  4176     indexOfFirstQuote == 0 ifTrue:[
  4179     indexOfFirstQuote == 0 ifTrue:[
  4177         "/ no ' found - mhmh is this a valid version method's source ?
  4180         "/ no ' found - mhmh is this a valid version method's source ?
  4178         ^ aString
  4181         ^ aString
  4182         indexOfSecondDollar := aString indexOf:aCharacter startingAt:indexOfNextAfterFirstQuote+1.
  4185         indexOfSecondDollar := aString indexOf:aCharacter startingAt:indexOfNextAfterFirstQuote+1.
  4183         ((indexOfSecondDollar == 0) 
  4186         ((indexOfSecondDollar == 0) 
  4184         or:[ indexOfNextAfterSecondDollar := aString indexOfNonSeparatorStartingAt:indexOfSecondDollar+1.
  4187         or:[ indexOfNextAfterSecondDollar := aString indexOfNonSeparatorStartingAt:indexOfSecondDollar+1.
  4185              (aString at:indexOfNextAfterSecondDollar) ~= $' 
  4188              (aString at:indexOfNextAfterSecondDollar) ~= $' 
  4186         ]) ifTrue:[ 
  4189         ]) ifTrue:[ 
       
  4190             indexOfSecondQuote := aString indexOf:$' startingAt:indexOfFirstQuote+1.
       
  4191             indexOfSecondQuote ~~ 0 ifTrue:[
       
  4192                 ^ (aString copyTo:indexOfSecondQuote-1),aCharacter asString,(aString copyFrom:indexOfSecondQuote)   
       
  4193             ].
  4187             self error:'invalid source (no valid version method string)' 
  4194             self error:'invalid source (no valid version method string)' 
  4188         ].
  4195         ].
  4189         "/ fine
  4196         "/ fine
  4190         ^ aString
  4197         ^ aString
  4191     ].
  4198     ].
  4204 
  4211 
  4205      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''hello'' '  
  4212      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''hello'' '  
  4206      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''   hello   '' '
  4213      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''   hello   '' '
  4207      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''$','Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.228 2009/10/20 09:55:58 fm Exp $'' '    
  4214      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''$','Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.228 2009/10/20 09:55:58 fm Exp $'' '    
  4208 
  4215 
  4209     -- errors:
       
  4210      self ensureKeywordExpansionWith: $§ inVersionMethod: 'foo ^ ''§Head'' '  
  4216      self ensureKeywordExpansionWith: $§ inVersionMethod: 'foo ^ ''§Head'' '  
  4211      self ensureKeywordExpansionWith: $§ inVersionMethod: 'foo ^ ''Header§'' '   
  4217      self ensureKeywordExpansionWith: $§ inVersionMethod: 'foo ^ ''Header§'' '   
  4212     "
  4218     "
       
  4219 
       
  4220     "Modified: / 12-02-2019 / 00:12:06 / Claus Gittinger"
  4213 !
  4221 !
  4214 
  4222 
  4215 ensureKeywordInVersionMethod: source
  4223 ensureKeywordInVersionMethod: source
  4216 
  4224 
  4217     ^self ensureKeyword: self versionMethodKeyword inVersionMethod: source
  4225     ^self ensureKeyword:(self versionMethodKeyword) inVersionMethod: source
  4218 
  4226 
  4219     "Created: / 27-09-2011 / 14:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  4227     "Created: / 27-09-2011 / 14:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  4228     "Modified (format): / 12-02-2019 / 00:04:07 / Claus Gittinger"
  4220 !
  4229 !
  4221 
  4230 
  4222 ensureNoDollarsInVersionMethod:aString
  4231 ensureNoDollarsInVersionMethod:aString
  4223     "given the source code of another manager's version method, ensure that it does NOT
  4232     "given the source code of another manager's version method, ensure that it does NOT
  4224      contain dollars and add $§ instead, to avoid that CVS expands keywords in it"
  4233      contain dollars and add $§ instead, to avoid that CVS expands keywords in it"