[PATCH 1/2] use Character cr for Squeak export

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

[PATCH 1/2] use Character cr for Squeak export

Tim Felgentreff
---
 packages/stinst/parser/SqueakExporter.st |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/packages/stinst/parser/SqueakExporter.st b/packages/stinst/parser/SqueakExporter.st
index ac314f8..98a62b3 100644
--- a/packages/stinst/parser/SqueakExporter.st
+++ b/packages/stinst/parser/SqueakExporter.st
@@ -30,11 +30,15 @@
 |
  ======================================================================"
 
+Stream extend [
+    nl [
+        self nextPut: Character cr
+    ]
+]
 
 OldSyntaxExporter subclass: SqueakSyntaxExporter [
     <comment: 'This class is responsible for filing out
                a given class on a given stream in Squeak format'>
-
     
     fileOutDeclaration: aBlock [
         (completeFileOut and: [ outClass environment ~= self defaultNamespace ])
@@ -46,7 +50,8 @@ OldSyntaxExporter subclass: SqueakSyntaxExporter [
     fileOutChunk: aString [
         outStream
             nl;
-            nextPutAll: (aString copyReplaceAll: '!' with: '!!');
+            nextPutAll: ((aString copyReplaceAll: '!' with: '!!')
+    replaceAll: Character lf with: Character cr);
             nextPut: $!
     ]
 

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] use Character cr for Squeak export

Paolo Bonzini-2
On 09/11/2009 09:00 AM, Tim Felgentreff wrote:
> ---
>   packages/stinst/parser/SqueakExporter.st |    9 +++++++--
>   1 files changed, 7 insertions(+), 2 deletions(-)

This unfortunately breaks all uses of #nl after Parser is loaded in the
image, for example by gst-doc.

The right way would be to write a stream decorator and make the
SqueakExporter constructor apply it to the passed stream.

You can just use tr \\n \\r for now.

Paolo


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