author Claus Gittinger <cg@exept.de>
Fri, 13 Jan 2012 12:22:50 +0100
changeset 4 90de244a7fa2
parent 0 739fe9b7253e
child 45 ca9fad0faa21
permissions -rw-r--r--
move to package

"{ Package: 'stx:goodies/petitparser' }"

Object subclass:#PPFailure
	instanceVariableNames:'message position'

PPFailure comment:'The failure object in PetitParser. It is the only class that responds to #isPetitFailure with true. It contains an error message and a position of the occurrence of the failure.
Instance Variables:
	message <String>        The error message of this failure.
	position        <Integer>       The position of this failure in the input stream.

!PPFailure class methodsFor:'instance creation'!

message: aString at: anInteger
	^ self basicNew initializeMessage: aString at: anInteger
! !

!PPFailure methodsFor:'accessing'!

	"Answer a human readable error message of this parse failure."

	^ message

	"Answer the position in the source string that caused this parse failure."

	^ position
! !

!PPFailure methodsFor:'initialization'!

initializeMessage: aString at: anInteger
	message := aString.
	position := anInteger
! !

!PPFailure methodsFor:'printing'!

printOn: aStream
	aStream nextPutAll: self message; nextPutAll: ' at '; print: position
! !

!PPFailure methodsFor:'testing'!

	"I am the only class that should implement this method to return true."

	^ true
! !

!PPFailure class methodsFor:'documentation'!

    ^ '$Id: PPFailure.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
! !