class: PeekableStream
authorStefan Vogel <sv@exept.de>
Wed, 22 Apr 2015 20:01:58 +0200
changeset 18273 7f1f1a4eef6b
parent 18272 d04d39e0f8cb
child 18274 042d13555f1f
child 18275 c6ecb8ecff3e
class: PeekableStream changed: #nextAlphaNumericWord #nextDelimited: Unicode compatibility
PeekableStream.st
--- a/PeekableStream.st	Wed Apr 22 19:59:59 2015 +0200
+++ b/PeekableStream.st	Wed Apr 22 20:01:58 2015 +0200
@@ -558,9 +558,9 @@
 
     | out ch |
 
-    out := WriteStream on: (String uninitializedNew: 1000).
     self atEnd ifTrue: [^ ''].
     self next == terminator ifFalse: [self skip: -1].       "absorb initial terminator"
+    out := WriteStream on:(self contentsSpecies new).
     [(ch := self next) == nil] whileFalse: [
         (ch == terminator) ifTrue: [
             self peek == terminator ifFalse: [
@@ -710,7 +710,9 @@
 nextAlphaNumericWord
     "read the next word (i.e. up to non letter-or-digit).
      Return a string containing those characters.
-     Any leading non-alphaNumeric chars are skipped."
+     Any leading non-alphaNumeric chars are skipped.
+
+     National letters or digits in unicode are not treated as letters."
 
     |s c|
 
@@ -725,7 +727,7 @@
     ] whileFalse.
 
     "second: get the alphanumeric word"
-    s := WriteStream on:(String new:128).
+    s := WriteStream on:(self contentsSpecies new:100).
 
     [
         s nextPut:c.
@@ -740,7 +742,7 @@
 
     ^ s contents.
 
-    "Use UnicodString in the examples, to avoid the optimization in ReadStream for Strings"
+    "Use UnicodeString in the examples, to avoid the optimization in ReadStream for Strings"
 
     "
      |s|
@@ -845,11 +847,11 @@
 !PeekableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.54 2015-04-14 11:04:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.55 2015-04-22 18:01:58 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.54 2015-04-14 11:04:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.55 2015-04-22 18:01:58 stefan Exp $'
 ! !