optional lineNumber info added to parseError
authorClaus Gittinger <cg@exept.de>
Wed, 18 Jun 2003 17:36:09 +0200
changeset 1434 e7d527d493d3
parent 1433 867b7e92f7c0
child 1435 be9680c6145c
optional lineNumber info added to parseError
Parser.st
Scanner.st
--- a/Parser.st	Tue Jun 17 14:23:32 2003 +0200
+++ b/Parser.st	Wed Jun 18 17:36:09 2003 +0200
@@ -44,7 +44,7 @@
 !
 
 ProceedableError subclass:#ParseError
-	instanceVariableNames:'errorMessage startPosition endPosition'
+	instanceVariableNames:'errorMessage startPosition endPosition lineNumber'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:Parser
@@ -3517,7 +3517,7 @@
                     value := method 
                                 valueWithReceiver:anObject 
                                 arguments:nil  "/ (Array with:m) 
-                                selector:#doIt "/ #doIt: 
+                                selector:(requestor isNil ifTrue:#doItX ifFalse:#doIt) "/ #doIt: 
                                 search:nil
                                 sender:nil.
                 ] ifFalse:[
@@ -7334,7 +7334,13 @@
 !Parser::ParseError methodsFor:'accessing'!
 
 description
-    ^ super description , (errorMessage ? '')
+    |s|
+
+    s := super description , (errorMessage ? '').
+    lineNumber notNil ifTrue:[
+        s := s , ' [' , lineNumber asString , ']'
+    ].
+    ^ s
 !
 
 endPosition
@@ -7357,6 +7363,12 @@
     endPosition := endPositionArg.
 !
 
+lineNumber:something
+    "set the value of the instance variable 'lineNumber' (automatically generated)"
+
+    lineNumber := something.
+!
+
 parser
     ^ originator
 !
@@ -7388,7 +7400,7 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.396 2003-06-17 12:10:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.397 2003-06-18 15:35:47 cg Exp $'
 ! !
 
 Parser initialize!
--- a/Scanner.st	Tue Jun 17 14:23:32 2003 +0200
+++ b/Scanner.st	Wed Jun 18 17:36:09 2003 +0200
@@ -985,6 +985,7 @@
                 err := Parser::ParseError new.
                 err errorMessage:aMessage startPosition:position endPosition:endPos.
                 err parameter:self.
+                err lineNumber:lineNr.
                 ^ err raiseRequest.
             ] ifFalse:[
                 self showErrorMessage:aMessage position:position.
@@ -2615,7 +2616,7 @@
 !Scanner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.173 2003-06-17 12:23:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.174 2003-06-18 15:36:09 cg Exp $'
 ! !
 
 Scanner initialize!