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:
iska
2014-09-20 23:05:55 +02:00
parent 28623d951c
commit 5cc13d0b2a
2 changed files with 19 additions and 0 deletions
+6
View File
@@ -23,4 +23,10 @@
- (UTF32Char)currentInputCharacter;
- (UTF32Char)nextInputCharacter;
- (UTF32Char)consumeNextInputCharacter;
- (void)unconsumeCurrentInputCharacter;
- (void)markCurrentLocation;
- (void)rewindToMarkedLocation;
@end
+13
View File
@@ -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