Add methods to mark location and rewind-to-mark in HTML stream reader
This will allows us to unconsume/reconsume characters during tokenization
This commit is contained in:
@@ -23,4 +23,10 @@
|
||||
- (UTF32Char)currentInputCharacter;
|
||||
- (UTF32Char)nextInputCharacter;
|
||||
|
||||
- (UTF32Char)consumeNextInputCharacter;
|
||||
- (void)unconsumeCurrentInputCharacter;
|
||||
|
||||
- (void)markCurrentLocation;
|
||||
- (void)rewindToMarkedLocation;
|
||||
|
||||
@end
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user