PPEndOfInputParser.st
author Claus Gittinger <cg@exept.de>
Mon, 12 Sep 2011 19:48:53 +0200
changeset 3 e1b11f74e142
parent 0 739fe9b7253e
child 4 90de244a7fa2
permissions -rw-r--r--
initial checkin

"{ Package: 'squeak: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.1 2011-08-18 18:56:17 cg Exp $'
! !