By the way, squeak already has some of this stuff. For instance, nextLine and nextWord.
Lex
Stephen Travis Pope stp@create.ucsb.edu wrote:
This is a multi-part message in MIME format. --------------3C7A918CACB687B1CA8BBCA7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
(This time *with* the promised attachment...)
Adds a number of string-reading methods such as nextLineString and nextWordObject (evaluates the next word) to PositionableStream.
--
stp Stephen Travis Pope stp@create.ucsb.edu -- http://www.create.ucsb.edu/~stp --------------3C7A918CACB687B1CA8BBCA7 Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="522A6368"; name="streamIO.cs" Content-Transfer-Encoding: 7bit Content-Description: Unknown Document Content-Disposition: inline; filename="streamIO.cs"
"Change Set: streamIO.cs Date: 23 Feb 2000 Author: Stephen Travis Pope
Adds a number of string-reading methods such as nextLineString and nextWordObject to PositionableStream."
'From Squeak2.8alpha of 13 January 2000 [latest update: #1852] on 19 February 2000 at 10:35:55 pm'!
!PositionableStream methodsFor: 'fileIn/Out' stamp: 'stp 02/18/2000 16:40'! nextLineObject "Deliver the next line string as an object."
| string | string := self nextLineString. ((string == nil) or: [string isEmpty]) ifTrue: [^nil]. ^Compiler evaluate: string! !
!PositionableStream methodsFor: 'fileIn/Out' stamp: 'stp 02/18/2000 16:23'! nextLineString "Deliver the next line (up to CR, possibly empty) as a String."
self skipSeparators. ^self upTo: Character cr ! !
!PositionableStream methodsFor: 'fileIn/Out' stamp: 'stp 02/18/2000 16:43'! nextParagraphObject "Deliver the next whole paragraph as an object."
| string | string := self nextParagraphString. ((string == nil) or: [string isEmpty]) ifTrue: [^nil]. ^Compiler evaluate: string! !
!PositionableStream methodsFor: 'fileIn/Out' stamp: 'stp 02/19/2000 21:24'! nextParagraphString "Deliver the next text block (up to CR/CR, possibly empty) as a String."
self skipSeparators. ^self upToAll: (String with: Character cr with: Character cr)! !
!PositionableStream methodsFor: 'fileIn/Out' stamp: 'stp 02/18/2000 16:41'! nextWordObject "Deliver the next ascii word as an object."
| string | string := self nextWordString. ((string == nil) or: [string isEmpty]) ifTrue: [^nil]. ^Compiler evaluate: string! !
!PositionableStream methodsFor: 'fileIn/Out' stamp: 'stp 02/19/2000 21:24'! nextWordString "Deliver the next 'word' (up to and separator, possibly empty) as a String."
| newStream element | self skipSeparators. newStream _ WriteStream on: (collection species new: 100). [self atEnd or: [(element _ self next) isSeparator]] whileFalse: [newStream nextPut: element]. ^newStream contents! !
--------------3C7A918CACB687B1CA8BBCA7--
squeak-dev@lists.squeakfoundation.org