PPPredicateSequenceParser.st
changeset 377 6112a403a52d
parent 178 992088772705
equal deleted inserted replaced
376:a2656b27cace 377:6112a403a52d
    16 
    16 
    17 on: aBlock message: aString size: anInteger
    17 on: aBlock message: aString size: anInteger
    18 	^ self on: aBlock message: aString negated: [ :each | (aBlock value: each) not ] message: 'no ' , aString size: anInteger 
    18 	^ self on: aBlock message: aString negated: [ :each | (aBlock value: each) not ] message: 'no ' , aString size: anInteger 
    19 ! !
    19 ! !
    20 
    20 
    21 !PPPredicateSequenceParser methodsFor:'*petitanalyzer-matching'!
       
    22 
       
    23 match: aParser inContext: aDictionary seen: anIdentitySet
       
    24 	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self size = aParser size ]
       
    25 ! !
       
    26 
    21 
    27 !PPPredicateSequenceParser methodsFor:'accessing'!
    22 !PPPredicateSequenceParser methodsFor:'accessing'!
    28 
    23 
    29 size
    24 size
    30 	"Answer the sequence size of the receiver."
    25 	"Answer the sequence size of the receiver."
    53 		size: size
    48 		size: size
    54 ! !
    49 ! !
    55 
    50 
    56 !PPPredicateSequenceParser methodsFor:'parsing'!
    51 !PPPredicateSequenceParser methodsFor:'parsing'!
    57 
    52 
    58 parseOn: aStream
    53 parseOn: aPPContext
    59 	| position result |
    54 	| memento result |
    60 	position := aStream position.
    55 	memento := aPPContext remember.
    61 	result := aStream next: size.
    56 	result := aPPContext stream next: size.
    62 	(result size = size and: [ predicate value: result ])
    57 	(result size = size and: [ predicate value: result ])
    63 		ifTrue: [ ^ result ].
    58 		ifTrue: [ ^ result ].
    64 	aStream position: position.
    59 	aPPContext restore: memento.
    65 	^ PPFailure message: predicateMessage at: aStream position
    60 	^ PPFailure message: predicateMessage context: aPPContext
    66 ! !
    61 ! !
    67 
    62 
    68 !PPPredicateSequenceParser class methodsFor:'documentation'!
    63 !PPPredicateSequenceParser class methodsFor:'documentation'!
    69 
    64 
    70 version
    65 version