ReadEvalPrintLoop.st
changeset 20912 fc5c40cbdb26
parent 20911 1c11be64f4a1
child 20913 58dc377d1211
equal deleted inserted replaced
20911:1c11be64f4a1 20912:fc5c40cbdb26
   354 
   354 
   355     "Created: / 07-12-2006 / 18:54:20 / cg"
   355     "Created: / 07-12-2006 / 18:54:20 / cg"
   356 !
   356 !
   357 
   357 
   358 cmd_read:lineStream
   358 cmd_read:lineStream
   359     |filename newInput savedPrompt savedPrint savedInput savedCurrentDirectory|
   359     |filename newInput savedPrompt savedPrint savedInput savedCurrentDirectory savedDoChunkFormat|
   360 
   360 
   361     lineStream skipSeparators.
   361     lineStream skipSeparators.
   362     filename := lineStream upToEnd withoutSeparators.
   362     filename := lineStream upToEnd withoutSeparators.
   363     filename isNil ifTrue:[
   363     filename isNil ifTrue:[
   364         '? which file?' errorPrintCR.
   364         '? which file?' errorPrintCR.
   382         ^ self.
   382         ^ self.
   383     ].
   383     ].
   384 
   384 
   385     [
   385     [
   386         savedCurrentDirectory := currentDirectory.
   386         savedCurrentDirectory := currentDirectory.
       
   387         savedDoChunkFormat := doChunkFormat.
   387         savedInput := inputStream.
   388         savedInput := inputStream.
   388         savedPrint := printFlag.
   389         savedPrint := printFlag.
   389         savedPrompt := prompt.
   390         savedPrompt := prompt.
   390 
   391 
   391         currentDirectory := filename directory.
   392         currentDirectory := filename directory.
   396             output:outputStream
   397             output:outputStream
   397             error:errorStream
   398             error:errorStream
   398             compiler:(compiler ? Compiler ? Parser)
   399             compiler:(compiler ? Compiler ? Parser)
   399             prompt:false
   400             prompt:false
   400             print:false.
   401             print:false.
       
   402         'after read1' errorPrintCR.
   401     ] ensure:[
   403     ] ensure:[
       
   404         doChunkFormat := savedDoChunkFormat.
   402         currentDirectory := savedCurrentDirectory.
   405         currentDirectory := savedCurrentDirectory.
   403         inputStream := savedInput.
   406         inputStream := savedInput.
   404         printFlag := savedPrint.
   407         printFlag := savedPrint.
   405         prompt := savedPrompt
   408         prompt := savedPrompt.
   406     ].
   409         
       
   410         'ensure done' errorPrintCR.
       
   411     ].
       
   412     'after read2' errorPrintCR.
   407 !
   413 !
   408 
   414 
   409 cmd_set:lineStream
   415 cmd_set:lineStream
   410     self cmd_setOrClear:lineStream to:true
   416     self cmd_setOrClear:lineStream to:true
   411 
   417 
   657         prompt notNil ifTrue:[
   663         prompt notNil ifTrue:[
   658             error nextPutAll:prompt.
   664             error nextPutAll:prompt.
   659         ].
   665         ].
   660 
   666 
   661         input atEnd ifTrue:[
   667         input atEnd ifTrue:[
   662             error cr.
   668             doPrint ifTrue:[ error cr ].
   663             ^ self.
   669             ^ self.
   664         ].
   670         ].
   665 
   671 
   666         input peek == $# ifTrue:[
   672         input peek == $# ifTrue:[
   667             self doChunkFormat:false.
   673             self doChunkFormat:false.