[PATCH] convert: Convert carriage returns to newlines in comments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] convert: Convert carriage returns to newlines in comments

Holger Freyther
Pharo started to use only a carriage return in class comments,
re-add the SyntaxConverter and replace the cr with a nl. This
is not the best place to do (as it impacts all conversions) but
it is not clear where one could at it.

2013-08-10  Holger Hans Peter Freyther  <[hidden email]>

        * scripts/Convert.st: Replace \r with \n in class comments.
---
 ChangeLog          |  4 ++++
 scripts/Convert.st | 20 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 614902d..106a397 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-08-10  Holger Hans Peter Freyther  <[hidden email]>
 
+ * scripts/Convert.st: Replace \r with \n in class comments.
+
+2013-08-10  Holger Hans Peter Freyther  <[hidden email]>
+
  * scripts/Convert.st: Use the STTools tools instead of the
  current code.
 
diff --git a/scripts/Convert.st b/scripts/Convert.st
index a7a402e..41f109f 100644
--- a/scripts/Convert.st
+++ b/scripts/Convert.st
@@ -81,17 +81,35 @@ String extend [
     ]
 ]
 
+
+STTools.Loader subclass: SyntaxConverter [
+    <category: 'Converter'>
+
+    doEmitStuff [
+        classesToEmit keysAndValuesDo: [:key :value |
+            | comment |
+            "Fixes for carriage return in Pharo"
+            comment := key comment.
+            comment ifNotNil: [
+                comment := comment replaceAll: Character cr with: Character nl.
+                key comment: comment.
+            ]].
+
+        super doEmitStuff.
+    ]
+]
 
 Eval [
     | helpString inFile outFile quiet verbose converter filter parser
  args inFormats outFormats rules |
+
     args := OrderedCollection new.
     parser := STInST.STFileInParser.
     quiet := false.
     verbose := false.
     outFile := nil.
     filter := [ :class | true ].
-    converter := STTools.Loader new.
+    converter := SyntaxConverter new.
     STInST.FileOutExporter defaultExporter: STInST.FormattingExporter.
     outFormats := Dictionary from: {
  'gst2' -> STInST.OldSyntaxExporter.
--
1.8.3.2


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk