PPPossessiveRepeatingParser.st
author sr
Wed, 04 Jul 2018 15:30:19 +0200
changeset 611 38338f2de417
parent 175 3affa13c4553
child 377 6112a403a52d
permissions -rw-r--r--
build order was wrong

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

PPRepeatingParser subclass:#PPPossessiveRepeatingParser
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Parsers'
!


!PPPossessiveRepeatingParser methodsFor:'parsing'!

parseOn: aStream
	| start element elements |
	start := aStream position.
	elements := OrderedCollection new.
	[ elements size < min ] whileTrue: [
		(element := parser parseOn: aStream) isPetitFailure ifTrue: [
			aStream position: start.
			^ element ].
		elements addLast: element ].
	[ elements size < max ] whileTrue: [
	 	(element := parser parseOn: aStream) isPetitFailure
			ifTrue: [ ^ elements asArray ].
		elements addLast: element ].
	^ elements asArray
! !

!PPPossessiveRepeatingParser class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPossessiveRepeatingParser.st,v 1.1 2014-03-04 14:33:19 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPossessiveRepeatingParser.st,v 1.1 2014-03-04 14:33:19 cg Exp $'
! !