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

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

PPDelegateParser subclass:#PPEndOfInputParser
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Parsers'
!

PPEndOfInputParser comment:'A parser that succeeds only at the end of the input stream.'
!


!PPEndOfInputParser methodsFor:'operations'!

end
	^ self
! !

!PPEndOfInputParser methodsFor:'parsing'!

parseOn: aStream
	| position result |
	position := aStream position.
	result := parser parseOn: aStream.
	(result isPetitFailure or: [ aStream atEnd ])
		ifTrue: [ ^ result ].
	result := PPFailure
		message: 'end of input expected'
		at: aStream position.
	aStream position: position.
	^ result
! !

!PPEndOfInputParser class methodsFor:'documentation'!

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