#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Tue, 12 Feb 2019 00:13:44 +0100
changeset 4398 7b8a930e2477
parent 4397 7c728af1ad07
child 4399 253988bc5ff2
#FEATURE by cg class: AbstractSourceCodeManager class comment/format in: #ensureDollarsInVersionMethod: #ensureKeywordInVersionMethod: changed: #ensureKeywordExpansionWith:inVersionMethod:
AbstractSourceCodeManager.st
--- a/AbstractSourceCodeManager.st	Sun Feb 10 23:18:24 2019 +0100
+++ b/AbstractSourceCodeManager.st	Tue Feb 12 00:13:44 2019 +0100
@@ -4116,10 +4116,12 @@
      self ensureDollarsInVersionMethod:'foo ^ ''§hello§'' ' 
      self ensureDollarsInVersionMethod:'foo ^ ''   hello   '' '    
      self ensureDollarsInVersionMethod:'foo ^ ''$','Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.228 2009/10/20 09:55:58 fm Exp $'' '      
+     self ensureDollarsInVersionMethod:'foo ^ ''$Head'' '    
     -- errors:
-     self ensureDollarsInVersionMethod:'foo ^ ''$Head'' '    
      self ensureDollarsInVersionMethod:'foo ^ ''Header$'' '    
     "
+
+    "Modified (comment): / 12-02-2019 / 00:03:45 / Claus Gittinger"
 !
 
 ensureKeyword: keyword inVersionMethod: source
@@ -4170,7 +4172,8 @@
     "given the source code of my version method, ensure that it contains aCharacter for
      proper keyword expansion"
 
-    |indexOfFirstQuote indexOfNextAfterFirstQuote indexOfSecondDollar indexOfNextAfterSecondDollar indexOfLastQuote|
+    |indexOfFirstQuote indexOfSecondQuote
+     indexOfNextAfterFirstQuote indexOfSecondDollar indexOfNextAfterSecondDollar indexOfLastQuote|
 
     indexOfFirstQuote := aString indexOf:$'.
     indexOfFirstQuote == 0 ifTrue:[
@@ -4184,6 +4187,10 @@
         or:[ indexOfNextAfterSecondDollar := aString indexOfNonSeparatorStartingAt:indexOfSecondDollar+1.
              (aString at:indexOfNextAfterSecondDollar) ~= $' 
         ]) ifTrue:[ 
+            indexOfSecondQuote := aString indexOf:$' startingAt:indexOfFirstQuote+1.
+            indexOfSecondQuote ~~ 0 ifTrue:[
+                ^ (aString copyTo:indexOfSecondQuote-1),aCharacter asString,(aString copyFrom:indexOfSecondQuote)   
+            ].
             self error:'invalid source (no valid version method string)' 
         ].
         "/ fine
@@ -4206,17 +4213,19 @@
      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''   hello   '' '
      self ensureKeywordExpansionWith: $$ inVersionMethod: 'foo ^ ''$','Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.228 2009/10/20 09:55:58 fm Exp $'' '    
 
-    -- errors:
      self ensureKeywordExpansionWith: $§ inVersionMethod: 'foo ^ ''§Head'' '  
      self ensureKeywordExpansionWith: $§ inVersionMethod: 'foo ^ ''Header§'' '   
     "
+
+    "Modified: / 12-02-2019 / 00:12:06 / Claus Gittinger"
 !
 
 ensureKeywordInVersionMethod: source
 
-    ^self ensureKeyword: self versionMethodKeyword inVersionMethod: source
+    ^self ensureKeyword:(self versionMethodKeyword) inVersionMethod: source
 
     "Created: / 27-09-2011 / 14:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 12-02-2019 / 00:04:07 / Claus Gittinger"
 !
 
 ensureNoDollarsInVersionMethod:aString