PPLimitedRepeatingParser.st
changeset 377 6112a403a52d
parent 168 9fa394e40830
equal deleted inserted replaced
376:a2656b27cace 377:6112a403a52d
    11 !PPLimitedRepeatingParser class methodsFor:'instance creation'!
    11 !PPLimitedRepeatingParser class methodsFor:'instance creation'!
    12 
    12 
    13 on: aParser limit: aLimitParser
    13 on: aParser limit: aLimitParser
    14 	^ (self on: aParser) setLimit: aLimitParser
    14 	^ (self on: aParser) setLimit: aLimitParser
    15 ! !
    15 ! !
       
    16 
    16 
    17 
    17 !PPLimitedRepeatingParser methodsFor:'accessing'!
    18 !PPLimitedRepeatingParser methodsFor:'accessing'!
    18 
    19 
    19 children
    20 children
    20 	^ Array with: parser with: limit
    21 	^ Array with: parser with: limit
    30 
    31 
    31 setLimit: aParser
    32 setLimit: aParser
    32 	limit := aParser
    33 	limit := aParser
    33 ! !
    34 ! !
    34 
    35 
    35 !PPLimitedRepeatingParser methodsFor:'private'!
    36 !PPLimitedRepeatingParser methodsFor:'parsing'!
    36 
    37 
    37 matchesLimitOn: aStream
    38 matchesLimitOn: aPPContext
    38 	| element position |
    39 	| element position |
    39 	position := aStream position.
    40 	position := aPPContext remember.
    40 	element := limit parseOn: aStream.
    41 	element := limit parseOn: aPPContext.
    41 	aStream position: position.
    42 	aPPContext restore: position.
    42 	^ element isPetitFailure not
    43 	^ element isPetitFailure not
    43 ! !
    44 ! !
    44 
    45 
    45 !PPLimitedRepeatingParser class methodsFor:'documentation'!
    46 !PPLimitedRepeatingParser class methodsFor:'documentation'!
    46 
    47