Add HTML stream method to consume a decimal number
This commit is contained in:
@@ -88,6 +88,15 @@ typedef void (^ HTMLStreamReaderErrorCallback)(NSString *reason);
|
||||
*/
|
||||
- (BOOL)consumeCharacter:(UTF32Char)character;
|
||||
|
||||
/**
|
||||
Consumes characters at the current location matching an unsigned number.
|
||||
|
||||
@param result Upon return, contains the consumed unsigned number. Pass `NULL` to skip over an unsigned number at the
|
||||
current location.
|
||||
@returns YES if an unsigned number could be consumed at the current location, NO otherwise.
|
||||
*/
|
||||
- (BOOL)consumeNumber:(unsigned long long *)result;
|
||||
|
||||
/**
|
||||
Consumes characters at the current location matching a decimal number.
|
||||
|
||||
@@ -95,7 +104,7 @@ typedef void (^ HTMLStreamReaderErrorCallback)(NSString *reason);
|
||||
current location.
|
||||
@returns YES if a decimal number could be consumed at the current location, NO otherwise.
|
||||
*/
|
||||
- (BOOL)consumeNumber:(unsigned long long *)result;
|
||||
- (BOOL)consumeDecimalNumber:(NSDecimal *)result;
|
||||
|
||||
/**
|
||||
Consumes characters at the current location matching a hexadecimal number.
|
||||
|
||||
@@ -152,6 +152,17 @@
|
||||
return success;
|
||||
}
|
||||
|
||||
- (BOOL)consumeDecimalNumber:(NSDecimal *)result
|
||||
{
|
||||
NSDecimal scanned;
|
||||
BOOL success = [_scanner scanDecimal:&scanned];
|
||||
if (success == NO) return NO;
|
||||
|
||||
*result = scanned;
|
||||
_location = _scanner.scanLocation;
|
||||
return success;
|
||||
}
|
||||
|
||||
- (BOOL)consumeHexNumber:(unsigned long long *)result
|
||||
{
|
||||
NSCharacterSet *set = [NSCharacterSet HTMLHexNumberCharacterSet];
|
||||
|
||||
Reference in New Issue
Block a user