--- a/PositionableStream.st Wed Oct 15 14:32:49 1997 +0200
+++ b/PositionableStream.st Wed Oct 15 14:33:37 1997 +0200
@@ -10,7 +10,7 @@
hereby transferred.
"
-'From Smalltalk/X, Version:3.1.9 on 31-aug-1997 at 8:08:34 pm' !
+'From Smalltalk/X, Version:3.2.1 on 14-oct-1997 at 11:16:17 pm' !
PeekableStream subclass:#PositionableStream
instanceVariableNames:'collection position readLimit writeLimit'
@@ -65,16 +65,6 @@
]
! !
-!PositionableStream class methodsFor:'Signal constants'!
-
-invalidPositionErrorSignal
- "return the signal raised if positioning is attempted to an
- invalid position (i.e. before the begin of the stream or after
- the end)"
-
- ^ InvalidPositionErrorSignal
-! !
-
!PositionableStream class methodsFor:'instance creation'!
on:aCollection
@@ -97,6 +87,16 @@
^ (self basicNew) with:aCollection
! !
+!PositionableStream class methodsFor:'Signal constants'!
+
+invalidPositionErrorSignal
+ "return the signal raised if positioning is attempted to an
+ invalid position (i.e. before the begin of the stream or after
+ the end)"
+
+ ^ InvalidPositionErrorSignal
+! !
+
!PositionableStream class methodsFor:'constants'!
chunkSeparator
@@ -386,55 +386,67 @@
"read next chunk, evaluate it and return the result;
someone (which is usually some codeView) is notified of errors.
Filein is done as follows:
- read a chunk
- if it started with an excla, evaluate it, and let the resulting object
- fileIn more chunks.
- This is a nice trick, since the methodsFor: expression evaluates to
- a ClassCategoryReader which reads and compiles chunks for its class.
- However, other than methodsFor expressions are possible - you can
- (in theory) create readers for any syntax.
+ read a chunk
+ if it started with an excla, evaluate it, and let the resulting object
+ fileIn more chunks.
+ This is a nice trick, since the methodsFor: expression evaluates to
+ a ClassCategoryReader which reads and compiles chunks for its class.
+ However, other than methodsFor expressions are possible - you can
+ (in theory) create readers for any syntax.
"
|aString sawExcla rslt done|
self skipSeparators.
self atEnd ifFalse:[
- sawExcla := self peekFor:ChunkSeparator.
- aString := self nextChunk.
- aString size ~~ 0 ifTrue:[
- passChunk ifTrue:[
- someone source:aString
- ].
- sawExcla ifFalse:[
- rslt := Compiler evaluate:aString notifying:someone.
- ] ifTrue:[
- rslt := Compiler evaluate:aString notifying:someone compile:false.
+ sawExcla := self peekFor:ChunkSeparator.
+ aString := self nextChunk.
+ "/
+ "/ handle empty chunks;
+ "/ this allows for Squeak code to be filedIn
+ "/
+ [aString size == 0
+ and:[self atEnd not]] whileTrue:[
+ aString := self nextChunk.
+ ].
+ aString size ~~ 0 ifTrue:[
+ passChunk ifTrue:[
+ someone source:aString
+ ].
+ sawExcla ifFalse:[
+ rslt := Smalltalk::Compiler evaluate:aString notifying:someone.
+ ] ifTrue:[
+ Smalltalk::Compiler emptySourceNotificationSignal handle:[:ex |
+ ^ nil
+ ] do:[
+ rslt := Smalltalk::Compiler evaluate:aString notifying:someone compile:false.
+ ].
- "
- usually, the above chunk consists of some methodsFor:-expression
- in this case, the returned value is a ClassCategoryReader,
- which is used to load & compile the methods ...
- "
- rslt isNil ifTrue:[
- "
- however, if that was nil (i.e. some error), we skip chunks
- up to the next empty chunk.
- "
- Transcript showCR:'skipping chunks ...'.
- done := false.
- [done] whileFalse:[
- aString := self nextChunk.
- done := (aString size == 0) or:[aString isEmpty].
- ]
- ] ifFalse:[
- rslt := rslt fileInFrom:self notifying:someone passChunk:passChunk
- ]
- ]
- ]
+ "
+ usually, the above chunk consists of some methodsFor:-expression
+ in this case, the returned value is a ClassCategoryReader,
+ which is used to load & compile the methods ...
+ "
+ rslt isNil ifTrue:[
+ "
+ however, if that was nil (i.e. some error), we skip chunks
+ up to the next empty chunk.
+ "
+ Transcript showCR:'skipping chunks ...'.
+ done := false.
+ [done] whileFalse:[
+ aString := self nextChunk.
+ done := (aString size == 0) or:[aString isEmpty].
+ ]
+ ] ifFalse:[
+ rslt := rslt fileInFrom:self notifying:someone passChunk:passChunk
+ ]
+ ]
+ ]
].
^ rslt
- "Modified: 18.5.1996 / 15:44:21 / cg"
+ "Modified: 14.10.1997 / 17:10:35 / cg"
!
fileInNotifying:someone passChunk:passChunk
@@ -518,7 +530,7 @@
action == #abort ifTrue:[
ex return
].
- (ex signal) enterDebuggerWith:ex message:what.
+ "/ (ex signal) enterDebuggerWith:ex message:what.
ex reject
] do:[
[self atEnd] whileFalse:[
@@ -530,7 +542,7 @@
].
^ lastValue
- "Modified: 31.8.1997 / 07:39:53 / cg"
+ "Modified: 14.10.1997 / 15:55:11 / cg"
! !
!PositionableStream methodsFor:'positioning'!
@@ -724,6 +736,6 @@
!PositionableStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.58 1997-09-22 19:05:41 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.59 1997-10-15 12:33:37 cg Exp $'
! !
PositionableStream initialize!