PPFailingParser.st
author sr
Thu, 05 Jul 2018 09:23:25 +0200
changeset 626 5159b1039a8f
parent 164 36ec78ddf4fe
child 377 6112a403a52d
permissions -rw-r--r--
order

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

PPParser subclass:#PPFailingParser
	instanceVariableNames:'message'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Parsers'
!


!PPFailingParser class methodsFor:'instance creation'!

message: aString
	^ self new setMessage: aString
! !

!PPFailingParser methodsFor:'*petitanalyzer-matching'!

match: aParser inContext: aDictionary seen: anIdentitySet
	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self message = aParser message ]
! !

!PPFailingParser methodsFor:'accessing'!

message
	"Answer the error message of the receiving parser."

	^ message
! !

!PPFailingParser methodsFor:'initialization'!

setMessage: aString
	message := aString
! !

!PPFailingParser methodsFor:'parsing'!

parseOn: aStream
	^ PPFailure message: message at: aStream position
! !

!PPFailingParser methodsFor:'printing'!

printNameOn: aStream
	super printNameOn: aStream.
	aStream nextPutAll: ', '; print: message
! !

!PPFailingParser class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPFailingParser.st,v 1.4 2014-03-04 14:32:28 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPFailingParser.st,v 1.4 2014-03-04 14:32:28 cg Exp $'
!

version_SVN
    ^ '$Id: PPFailingParser.st,v 1.4 2014-03-04 14:32:28 cg Exp $'
! !