CRSTextReader

Objective-C

@interface CRSTextReader : NSObject

Swift

class CRSTextReader : NSObject

Read through text string

  • Parameter name

    Declaration

    Objective-C

    @property (nonatomic) BOOL includeQuotes;

    Swift

    var includeQuotes: Bool { get set }
  • Initialize

    Declaration

    Objective-C

    + (CRSTextReader *)createWithText:(NSString *)text;

    Swift

    class func create(withText text: String!) -> CRSTextReader!

    Parameters

    text

    text

    Return Value

    new text reader

  • Initialize

    Declaration

    Objective-C

    + (CRSTextReader *)createWithText:(NSString *)text
                     andIncludeQuotes:(BOOL)includeQuotes;

    Swift

    class func create(withText text: String!, andIncludeQuotes includeQuotes: Bool) -> CRSTextReader!

    Parameters

    text

    text

    includeQuotes

    include quotes

    Return Value

    new text reader

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithText:(NSString *)text;

    Swift

    init!(text: String!)

    Parameters

    text

    text

    Return Value

    new text reader

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithText:(NSString *)text
                andIncludeQuotes:(BOOL)includeQuotes;

    Swift

    init!(text: String!, andIncludeQuotes includeQuotes: Bool)

    Parameters

    text

    text

    includeQuotes

    include quotes

    Return Value

    new text reader

  • Get the text

    Declaration

    Objective-C

    - (NSString *)text;

    Swift

    func text() -> String!

    Return Value

    text

  • Reset the reader

    Declaration

    Objective-C

    - (void)reset;

    Swift

    func reset()
  • Read the next token. Ignores whitespace until a non whitespace character is encountered. Returns a contiguous block of token characters ( [a-z] | [A-Z] | [0-9] | - | . | + | : | _ ) or a non whitespace single character.

    Declaration

    Objective-C

    - (NSString *)readToken;

    Swift

    func readToken() -> String!

    Return Value

    token

  • Peek at the next token without reading past it

    Declaration

    Objective-C

    - (NSString *)peekToken;

    Swift

    func peekToken() -> String!

    Return Value

    next token

  • Peek at a token without reading past it

    Declaration

    Objective-C

    - (NSString *)peekTokenAtNum:(int)num;

    Swift

    func peekToken(atNum num: Int32) -> String!

    Parameters

    num

    number of tokens out to peek at

    Return Value

    token @throws IOException upon read error

  • Push a token back onto the read cache

    Declaration

    Objective-C

    - (void)pushToken:(NSString *)token;

    Swift

    func pushToken(_ token: String!)

    Parameters

    token

    token

  • Read an expected token

    Declaration

    Objective-C

    - (NSString *)readExpectedToken;

    Swift

    func readExpectedToken() -> String!

    Return Value

    token

  • Peek at the next expected token without reading past it

    Declaration

    Objective-C

    - (NSString *)peekExpectedToken;

    Swift

    func peekExpectedToken() -> String!

    Return Value

    next token

  • Peek at the next expected token without reading past it

    Declaration

    Objective-C

    - (NSString *)peekExpectedTokenAtNum:(int)num;

    Swift

    func peekExpectedToken(atNum num: Int32) -> String!

    Parameters

    num

    number of tokens out to peek at

    Return Value

    token

  • Read a signed number as a double

    Declaration

    Objective-C

    - (double)readNumber;

    Swift

    func readNumber() -> Double

    Return Value

    signed double

  • Read an unsigned number as a double

    Declaration

    Objective-C

    - (double)readUnsignedNumber;

    Swift

    func readUnsignedNumber() -> Double

    Return Value

    unsigned double

  • Read a signed integer

    Declaration

    Objective-C

    - (int)readInteger;

    Swift

    func readInteger() -> Int32

    Return Value

    signed integer

  • Read an unsigned integer

    Declaration

    Objective-C

    - (int)readUnsignedInteger;

    Swift

    func readUnsignedInteger() -> Int32

    Return Value

    unsigned integer