Parser.st
changeset 2991 035114ac9b4b
parent 2985 960039f26733
child 2995 ced78dd20036
--- a/Parser.st	Wed Jan 02 14:38:23 2013 +0100
+++ b/Parser.st	Wed Jan 02 14:42:29 2013 +0100
@@ -4364,6 +4364,10 @@
 
 !Parser methodsFor:'evaluating expressions'!
 
+defaultFailBlock
+    ^ [:msg | self error:(msg ? 'error in eval') ]
+!
+ 
 evaluate:aStringOrStream
     "return the result of evaluating aStringOrStream, errors are reported to requestor. 
      Allow access to anObject as self and to its instVars (used in the inspector).
@@ -4383,7 +4387,7 @@
         receiver:nil 
         notifying:requestor 
         logged:logged 
-        ifFail:[ self error:'error in eval' ] 
+        ifFail:(self defaultFailBlock)
         compile:false 
         checkForEndOfInput:true
 !
@@ -4407,7 +4411,7 @@
         receiver:nil 
         notifying:requestor 
         logged:logged 
-        ifFail:[ self error:'error in eval' ] 
+        ifFail:(self defaultFailBlock)
         compile:compile
         checkForEndOfInput:true
 
@@ -4457,7 +4461,7 @@
         receiver:anObject 
         notifying:requestor 
         logged:logged 
-        ifFail:[ self error:'error in eval' ] 
+        ifFail:(self defaultFailBlock)
         compile:false 
         checkForEndOfInput:true
 !
@@ -4585,7 +4589,7 @@
         tree := self parseMethodBodyOrEmpty.
     ] ifFalse:[
         ParseError handle:[:ex |
-            ^ failBlock value
+            ^ failBlock valueWithOptionalArgument:ex description
         ] do:[
             tree := self parseMethodBodyOrEmpty.
         ].
@@ -4599,7 +4603,7 @@
 
     (self errorFlag or:[tree == #Error]) ifTrue:[
         failBlock notNil ifTrue:[
-            ^ failBlock value
+            ^ failBlock valueWithOptionalArgument:'parse error'
         ].
         ^ #Error
     ].
@@ -4648,7 +4652,7 @@
         failBlock isNil ifTrue:[
             ex reject.
         ] ifFalse:[
-            ^ failBlock value.
+            ^ failBlock valueWithOptionalArgument:ex description.
         ].
     ] do:[
         nameSpaceQuerySignal answer:spc
@@ -4754,7 +4758,7 @@
         receiver:nil 
         notifying:nil 
         logged:logged 
-        ifFail:[ self error:'error in eval' ] 
+        ifFail:(self defaultFailBlock)
         compile:true 
 !
 
@@ -4801,7 +4805,7 @@
         receiver:anObject 
         notifying:requestor 
         logged:logged 
-        ifFail:[ self error:'error in eval' ] 
+        ifFail:(self defaultFailBlock)
         compile:false 
         checkForEndOfInput:true
 !
@@ -10886,11 +10890,11 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.732 2012-11-23 12:26:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.733 2013-01-02 13:42:29 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.732 2012-11-23 12:26:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.733 2013-01-02 13:42:29 cg Exp $'
 !
 
 version_SVN