PPStartOfWordParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 04 Sep 2015 14:06:56 +0100
changeset 535 a8feb0f47574
parent 427 a7f5e6de19d2
permissions -rw-r--r--
PPCConfiguration refactoring: [7/10]: allow to configure passes ...run during compilation by setting a collection of passes to run. Got rid of PPCPluggableConfiguration and PPCConfiguration subclasses. Removed a bunch of options used to suppress certain passes.

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

"{ NameSpace: Smalltalk }"

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

!PPStartOfWordParser methodsFor:'as yet unclassified'!

acceptsEpsilon
	^ true
!

parseOn: aPPContext
	aPPContext atEnd ifTrue: [  
		^ PPFailure message: 'Start of word expected' context: aPPContext at: aPPContext position 
	].

	(aPPContext position == 0) ifTrue: [ 
		(aPPContext peek isAlphaNumeric) ifTrue: [ 
			^ #startOfWord
		] ifFalse: [ 
			^ PPFailure message: 'Start of word expected' context: aPPContext at: aPPContext position 
	 	]
	].

	aPPContext back.
	aPPContext peek isAlphaNumeric ifTrue: [
		^ PPFailure message: 'Start of word expected' context: aPPContext at: aPPContext position 
	].
	aPPContext next.
	
	^ aPPContext peek isAlphaNumeric ifTrue: [ #startOfWord ] ifFalse: [ 
		PPFailure message: 'Start of word expected' context: aPPContext at: aPPContext position 
	]
	
! !