--- a/PPContext.st Wed Nov 19 10:52:37 2014 +0000
+++ b/PPContext.st Mon Nov 24 00:09:23 2014 +0000
@@ -198,9 +198,17 @@
restoreProperties: aPPContextMemento
aPPContextMemento stream == stream ifFalse: [ self error: 'Oops!!' ].
+ properties ifNil: [ ^ self ].
+
+ properties keysDo: [ :key |
+ (aPPContextMemento hasProperty: key)
+ ifTrue: [ properties at: key put: (aPPContextMemento propertyAt: key) ]
+ ifFalse: [ properties removeKey: key ].
+ ].
+
aPPContextMemento keysAndValuesDo: [ :key :value |
- self propertyAt: key put: value
- ].
+ properties at: key put: value
+ ]
! !
!PPContext methodsFor:'stream mimicry'!
@@ -257,6 +265,36 @@
^ stream skip: anInteger
!
+skipTo: anObject
+ ^ stream skipTo: anObject
+!
+
+skipToAll: aString
+ "Set the access position of the receiver to be past the next occurrence of the subCollection. Answer whether subCollection is found. No wildcards, and case does matter."
+ | pattern startMatch |
+ pattern := aString readStream.
+ startMatch := nil.
+ [ pattern atEnd ] whileFalse:
+ [ stream atEnd ifTrue: [ ^ false ].
+ stream next = pattern next
+ ifTrue: [ pattern position = 1 ifTrue: [ startMatch := stream position ] ]
+ ifFalse:
+ [ pattern position: 0.
+ startMatch ifNotNil:
+ [ stream position: startMatch.
+ startMatch := nil ] ] ].
+ ^ true
+!
+
+skipToAnyOf: aCharacterSet
+ "Set the access position of the receiver to be past the next occurrence of
+ a character in the character set. Answer whether a fitting character is found."
+
+ [stream atEnd]
+ whileFalse: [ (aCharacterSet includes: stream next) ifTrue: [^true]].
+ ^false
+!
+
uncheckedPeek
^ stream uncheckedPeek
!