#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sat, 03 Mar 2018 10:02:41 +0100
changeset 4218 e4fa8813bc4e
parent 4217 b6310fa467f2
child 4219 6c713d7fde5e
#FEATURE by cg class: Parser changed: #evaluate:in:receiver:notifying:logged:ifFail:compile:checkForEndOfInput: class: Parser class added: #evaluate:for:notifying:logged: error notification if there is a requestor
Parser.st
--- a/Parser.st	Mon Feb 19 14:35:37 2018 +0100
+++ b/Parser.st	Sat Mar 03 10:02:41 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -440,6 +442,17 @@
 
 
 
+!
+
+evaluate:aStringOrStream for:aReceiver notifying:someone logged:logged
+    ^ self 
+        evaluate:aStringOrStream
+        in:nil
+        receiver:aReceiver
+        notifying:someone
+        logged:logged
+        ifFail:[ParseError raiseRequestWith:self]
+        compile:true
 ! !
 
 !Parser class methodsFor:'Signal constants'!
@@ -5167,6 +5180,9 @@
     ].
 
     (self errorFlag or:[tree == #Error]) ifTrue:[
+        requestor notNil ifTrue:[
+            requestor error:'parse error' position:1 to:(source position) from:self.
+        ].
         failBlock notNil ifTrue:[
             ^ failBlock valueWithOptionalArgument:'parse error'
         ].
@@ -5439,7 +5455,6 @@
     selector := aParser selector.
 ! !
 
-
 !Parser methodsFor:'obsolete'!
 
 correctByDeleting