SystemOrganization addCategory: #PetitManifestMf! PPCompositeParser subclass: #PPManifestMfParser instanceVariableNames: 'pairs pair label value basicValue oneLinerBasicValue' classVariableNames: '' poolDictionaries: '' category: 'PetitManifestMf'! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 14:27'! basicValue ^ oneLinerBasicValue , ((#newline asParser , #space asParser) , oneLinerBasicValue ==> #second) star ==> [:token | ((OrderedCollection with: token first) addAll: token last; yourself) asArray ]! ! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 14:10'! label ^ (#letter asParser / #digit asParser / $- asParser) star token trim flatten! ! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 14:26'! oneLinerBasicValue | aCollectionOfChars | aCollectionOfChars := {$: . $, . Character cr . Character lf}. parser := PPPredicateObjectParser on: [:each | (aCollectionOfChars includes: each) not ] message: 'any except ' , aCollectionOfChars printString , ' expected'. ^ parser star flatten "anyExceptAnyOf: #($: $, )) star flatten"! ! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 13:05'! pair ^label , $: asParser token trim, value ==> [:token | (token at: 1)->(token at: 3)]! ! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 13:49'! pairs ^ pair , (#newline asParser , pair ==> [:token | token second ]) star ==> [:token | ((OrderedCollection with: token first) addAll: token last; yourself) asArray ]! ! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/9/2010 09:08'! start ^ pairs end! ! !PPManifestMfParser methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 14:13'! value ^ basicValue , (($, asParser trim token , basicValue) ==> [:token | token second] ) trim star ==> [:token | token last isEmpty ifTrue: [token first] ifFalse: [((OrderedCollection with: token first) addAll: token last; yourself) asArray ]]! ! PPCompositeParserTest subclass: #PPManifestMfParserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'PetitManifestMf'! !PPManifestMfParserTest methodsFor: 'as yet unclassified' stamp: 'tg 7/9/2010 09:12'! parserClass ^ PPManifestMfParser! ! !PPManifestMfParserTest methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 11:05'! testSinglePair self assert: 'Header: value' is: {'Header'->'value'}! ! !PPManifestMfParserTest methodsFor: 'as yet unclassified' stamp: 'tg 7/12/2010 12:46'! testSinglePairWithCollection self assert: 'Header: value1, value2' is: {'Header'->#('value1' 'value2')}! !