ReadEvalPrintLoop.st
changeset 10628 284266d54dbe
parent 10500 3106f50bd9d7
child 10631 39ebd04452ac
--- a/ReadEvalPrintLoop.st	Wed Jul 04 17:07:44 2007 +0200
+++ b/ReadEvalPrintLoop.st	Wed Jul 04 17:36:42 2007 +0200
@@ -13,7 +13,7 @@
 
 Object subclass:#ReadEvalPrintLoop
 	instanceVariableNames:'inputStream outputStream errorStream compiler prompt
-		doChunkFormat traceFlag timingFlag'
+		doChunkFormat traceFlag timingFlag exitAction'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Support'
@@ -38,6 +38,10 @@
 documentation
 "
     A simple read-eval-print loop for non-GUI or stscript operation.
+    A line starting with '?' shows the usage message.
+    Lines starting with '#' are directives:
+        #exit   - exit the rep-loop
+
 "
 ! !
 
@@ -102,7 +106,7 @@
 !
 
 cmd_exit:lineStream
-    Smalltalk exit
+    exitAction value
 
     "Created: / 07-12-2006 / 18:55:46 / cg"
 !
@@ -235,6 +239,8 @@
      If the chunkFormat-argument is true, chunks are read.
      Otherwise, lines up to an empty line (or EOF) are read."
 
+    exitAction := [^ self].
+
     ControlInterrupt handle:[:ex |
         self errorStream nextPutLine:('Cought: ', ex description).
         ex restart.
@@ -324,5 +330,5 @@
 !ReadEvalPrintLoop class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ReadEvalPrintLoop.st,v 1.22 2007-04-04 16:32:57 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ReadEvalPrintLoop.st,v 1.23 2007-07-04 15:36:42 cg Exp $'
 ! !