PPStartOfLogicalLineParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 26 Aug 2015 23:34:48 +0100
changeset 533 666372dbe307
parent 427 a7f5e6de19d2
permissions -rw-r--r--
PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions. So it's more clear for what the option is and how to use it. This is a base for user-documentation as options are meant to be set by the end user.

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

"{ NameSpace: Smalltalk }"

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

!PPStartOfLogicalLineParser methodsFor:'as yet unclassified'!

isBlank: character
	^ (character == Character space or: [character == Character tab])
!

parseOn: aPPContext
	aPPContext peek isAlphaNumeric ifFalse: [ 
		^ PPFailure message: 'Start of logical line expected' context: aPPContext 
	].

	aPPContext isStartOfLine ifTrue: [ ^ #startOfLogicalLine ].
	
	
	[ aPPContext position ~= 0 ] whileTrue: [  
		aPPContext back.
		(self isBlank: aPPContext peek) ifFalse: [ 
			^ PPFailure message: 'Start of logical line expected' context: aPPContext
		].
		aPPContext isStartOfLine ifTrue: [ ^ #startOfLogicalLine ].
	]
! !