diff --git a/HTMLKit/HTMLInputStreamReader.h b/HTMLKit/HTMLInputStreamReader.h index f59d394..0ae10cd 100644 --- a/HTMLKit/HTMLInputStreamReader.h +++ b/HTMLKit/HTMLInputStreamReader.h @@ -23,4 +23,10 @@ - (UTF32Char)currentInputCharacter; - (UTF32Char)nextInputCharacter; +- (UTF32Char)consumeNextInputCharacter; +- (void)unconsumeCurrentInputCharacter; + +- (void)markCurrentLocation; +- (void)rewindToMarkedLocation; + @end diff --git a/HTMLKit/HTMLInputStreamReader.m b/HTMLKit/HTMLInputStreamReader.m index e373791..beb18a6 100644 --- a/HTMLKit/HTMLInputStreamReader.m +++ b/HTMLKit/HTMLInputStreamReader.m @@ -65,6 +65,7 @@ NS_INLINE BOOL isControlOrUndefinedCharacter(UTF32Char character) NSScanner *_scanner; CFStringInlineBuffer _buffer; NSUInteger _location; + NSUInteger _mark; UTF32Char _currentInputCharacter; NSUInteger _consume; HTMLStreamReaderErrorCallback _errorCallback; @@ -153,4 +154,16 @@ NS_INLINE BOOL isControlOrUndefinedCharacter(UTF32Char character) _consume = 0; } +- (void)markCurrentLocation +{ + _mark = _location; +} + +- (void)rewindToMarkedLocation +{ + _location = _mark; + _scanner.scanLocation = _mark; + _consume = 0; +} + @end