PPFlexiblePredicateSequenceParser
I needed a parser that would match input against a predicate block, like PPPredicateSequenceParser, but for an unknown/variable length. For example, whereas for fixed-length matches you can already: parser := PPPredicateSequenceParser on: [ :value | value first isUppercase ] message: 'uppercase 3 letter words' size: 3. (parser parse: 'Abc') isPetitFailure not. Now you can: parser := PPFlexiblePredicateSequenceParser on: [ :value | Object canUnderstand: value asSymbol ] message: 'message to an object' while: [ :e | e ~= Character space ]. (parser parse: 'hash ijk') isPetitFailure not. (parser parse: '99 ijk') isPetitFailure. Is this generally useful enough to add to PetitParser? For now, you can get it via: Gofer it smalltalkhubUser: 'SeanDeNigris' project: 'SeansPlayground'; package: 'PPFlexiblePredicateSequenceParser'; load. ----- Cheers, Sean -- View this message in context: http://forum.world.st/PPFlexiblePredicateSequenceParser-tp4759616.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (1)
-
Sean P. DeNigris