Files
HTMLKit/HTMLKit/HTMLInputStreamReader.h
T
iska a23e1a13c9 Fix surrogate pair handling and remove Input Stream's separate error-reporting class
Upon reading a surrogate pair the scan location should be advanced by two characters instead of one
2014-10-31 22:32:34 +01:00

43 lines
1.3 KiB
Objective-C

//
// HTMLInputStreamReader.h
// HTMLKit
//
// Created by Iska on 15/09/14.
// Copyright (c) 2014 BrainCookie. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^ HTMLStreamReaderErrorCallback)(NSString *reason);
/**
* HTML Input Stream Reader processor conforming to the HTML standard
* http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#preprocessing-the-input-stream
*/
@interface HTMLInputStreamReader : NSObject
@property (nonatomic, readonly) NSString *string;
@property (nonatomic, readonly) NSUInteger currentLocation;
@property (nonatomic, copy) HTMLStreamReaderErrorCallback errorCallback;
- (id)initWithString:(NSString *)string;
- (UTF32Char)currentInputCharacter;
- (UTF32Char)nextInputCharacter;
- (UTF32Char)consumeNextInputCharacter;
- (void)unconsumeCurrentInputCharacter;
- (BOOL)consumeCharacter:(UTF32Char)character;
- (BOOL)consumeNumber:(unsigned long long *)result;
- (BOOL)consumeHexNumber:(unsigned long long *)result;
- (BOOL)consumeString:(NSString *)string caseSensitive:(BOOL)caseSensitive;
- (NSString *)consumeCharactersUpToCharactersInString:(NSString *)characters;
- (NSString *)consumeCharactersUpToString:(NSString *)string;
- (NSString *)consumeAlphanumericCharacters;
- (void)markCurrentLocation;
- (void)rewindToMarkedLocation;
@end