--- a/Scanner.st Wed May 13 15:50:13 1998 +0200
+++ b/Scanner.st Wed May 13 19:58:56 1998 +0200
@@ -11,15 +11,15 @@
"
Object subclass:#Scanner
- instanceVariableNames:'typeArray actionArray source lineNr
- token tokenType tokenPosition
+ instanceVariableNames:'typeArray actionArray source lineNr token tokenType tokenPosition
tokenValue tokenName tokenLineNr hereChar peekChar peekChar2
requestor exitBlock errorFlag ignoreErrors ignoreWarnings
saveComments currentComments collectedSource
- allowUnderscoreInIdentifier allowDollarInIdentifier warnSTXSpecialComment
- warnUnderscoreInIdentifier warnOldStyleAssignment
- warnCommonMistakes outStream outCol warnSTXNameSpaceUse
- warnPossibleIncompatibilities warnDollarInIdentifier'
+ allowUnderscoreInIdentifier allowDollarInIdentifier
+ warnSTXSpecialComment warnUnderscoreInIdentifier
+ warnOldStyleAssignment warnCommonMistakes outStream outCol
+ warnSTXNameSpaceUse warnPossibleIncompatibilities
+ warnDollarInIdentifier'
classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings
WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier
WarnCommonMistakes WarnPossibleIncompatibilities
@@ -608,6 +608,26 @@
!Scanner methodsFor:'error handling'!
+correctableError:message position:pos1 to:pos2
+ "report an error which can be corrected by compiler -
+ return true if correction is wanted"
+
+ |correctIt|
+
+ requestor isNil ifTrue:[
+ self showErrorMessage:message position:pos1.
+ correctIt := false
+ ] ifFalse:[
+ correctIt := requestor correctableError:message position:pos1 to:pos2 from:self
+ ].
+ correctIt ifFalse:[
+ exitBlock notNil ifTrue:[exitBlock value]
+ ].
+ ^ correctIt
+
+ "Created: / 13.5.1998 / 16:45:56 / cg"
+!
+
lastTokenLineNumber
"return the line number of the token which was just read."
@@ -650,6 +670,36 @@
^ false
!
+parseError:aMessage
+ "report an error"
+
+ ^ self parseError:aMessage position:tokenPosition to:nil
+
+ "Created: / 13.5.1998 / 16:45:13 / cg"
+!
+
+parseError:aMessage position:position
+ "report an error"
+
+ ^ self parseError:aMessage position:position to:nil
+
+ "Created: / 13.5.1998 / 16:45:05 / cg"
+!
+
+parseError:aMessage position:position to:endPos
+ "report an error"
+
+ |m|
+
+ errorFlag := true.
+ m := 'Error: ' , aMessage.
+ self notifyError:m position:position to:endPos.
+ exitBlock notNil ifTrue:[exitBlock value].
+ ^ false
+
+ "Created: / 13.5.1998 / 16:44:55 / cg"
+!
+
showErrorMessage:aMessage position:pos
"show an errormessage on the Transcript"
@@ -1744,6 +1794,6 @@
!Scanner class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.81 1998-05-13 13:50:13 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.82 1998-05-13 17:58:56 cg Exp $'
! !
Scanner initialize!