" Replaces replacee with the replacement and evaluates its child.The replacee is restored after the child is evaluated. WARNING: IMO does not work with memoization " Class { #name : 'PPReplaceParser', #superclass : 'PPDelegateParser', #instVars : [ 'replacee', 'replacement' ], #category : 'PetitMarkdown-Parser' } { #category : 'as yet unclassified' } PPReplaceParser >> children [ ^ Array with: parser with: replacee with: replacement ] { #category : 'as yet unclassified' } PPReplaceParser >> parseOn: aPPContext [ | tmp retval | self assert: (replacee isKindOf: PPDelegateParser). tmp := replacee children first. replacee setParser: replacement. retval := parser parseOn: aPPContext. replacee setParser: tmp. ^ retval ] { #category : 'as yet unclassified' } PPReplaceParser >> replace: aParser with: anotherParser [ super replace: aParser with: anotherParser. (replacee == aParser) ifTrue: [ replacee := anotherParser ]. (replacement == aParser) ifTrue: [ replacement := anotherParser ]. ] { #category : 'accessing' } PPReplaceParser >> replacee [ ^ replacee ] { #category : 'accessing' } PPReplaceParser >> replacee: anObject [ replacee := anObject ] { #category : 'accessing' } PPReplaceParser >> replacement [ ^ replacement ] { #category : 'accessing' } PPReplaceParser >> replacement: anObject [ replacement := anObject ]