PPEndOfFileParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 21 May 2015 15:35:26 +0100
changeset 467 dd13296df294
parent 427 a7f5e6de19d2
permissions -rw-r--r--
Fixed code generation for deterministic choice w.r.t inlining For PPCDeterministicChoiceNode generate code in form if () else if () else if () else error instead of sequence of ifs. The former is safe w.r.t inlining.

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

"{ NameSpace: Smalltalk }"

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

!PPEndOfFileParser methodsFor:'as yet unclassified'!

acceptsEpsilon
	^ true
!

exampleOn: aStream 
	aStream nextPutAll: #'end-of-input'
!

isNullable 
	^ true
!

nonEmpty
	"I know I am empty, but it does not count in my case, I represent virtual non-existent character"
	^ self
!

parseOn: aPPContext
	(aPPContext atEnd) ifFalse:
	[
		^ PPFailure message: 'end of input expected' context: aPPContext.
	].
	^ #'end-of-input'
! !