PositionableStream>>nextWord
Martin Pammer
mpammer at vrz.net
Thu Jul 2 08:16:21 UTC 1998
I would suggest to rename two methods of PositionableStream:
nextWord
"Answer the next two bytes from the receiver as an Integer."
nextWordPut: aWord
"Append to the receiver an Integer as the next two bytes."
to
next2Bytes or nextTwoBytes
and
next2BytesPut: or nextTwoBytesPut:
The reason for this suggestion is that I would like to see a method
nextWord to return the next word from aStream in a literal sense.
I remember that at least VSE has a method like this
!PositionableStream methodsFor: 'accessing' stamp: 'pm 6/14/1998 22:24'!
nextWord
"Answer a String containing the next word in the
receiver stream. A word starts with a letter,
followed by a sequence of letters and digits."
| first |
[self atEnd ifTrue: [^ nil].
self next isAlphaNumeric] whileFalse: []. "skip separators"
first _ self position.
[self atEnd
ifTrue: [^ collection copyFrom: first to: self position].
self next isAlphaNumeric] whileTrue: [].
position _ position - 1.
^ collection copyFrom: first to: self position! !
With best regards
Martin Pammer
mpammer at vrz.net
VRZ Informatik
More information about the Squeak-dev
mailing list
|