Inherits from NSObject
Declared in PXStylesheetLexer.h

Overview

PXStylesheetLexer is responsible for converting an NSString into a stream of PXLexemes. Eacn PXLexeme represents an instance of a CSS token.

Tasks

  •   source

    The source string being tokenized by this lexer. Note that setting this value resets the lexer state

    property
  •   delegate

    A delegate to call when various events occur within the lexer

    property
  • – initWithString:

    Initializer a new instance with the specified source value

  • – nextLexeme

    Return the next lexeme in the source string from where the last lex ended. This will return nil once the source string has been completed consumed.

  • – pushLexeme:

    Push the specified lexeme onto internal stack. Lexemes will first be removed from this stack when calling nextLexeme. Once the stack has been depleted, lexing continues from the last successful scan not involving the lexeme stack.

  • – increaseNesting

    This lexer returns different lexemes for the same source depending on if the lexer is inside or outside of a delcaration body. This method allows code to indicate that lexing should proceed as if the lexer is inside a block. This is typically used when processing styles that are associated directly with a styleable object as opposed to coming from a stylesheet.

  • – decreaseNesting

    This is the complementary method to increaseNesting. This is used to indicate that a block has been completely lexed.

  • – pushSource:

    Save the current context of the lexer, re-initialize the lexer, and begin lexing the specified source. This is useful for handling “import” statements, where another file needs to be processed inline with the current file being processed

Properties

delegate

A delegate to call when various events occur within the lexer

@property (nonatomic, strong) id<PXStylesheetLexerDelegate> delegate

Discussion

A delegate to call when various events occur within the lexer

Declared In

PXStylesheetLexer.h

source

The source string being tokenized by this lexer. Note that setting this value resets the lexer state

@property (nonatomic, strong) NSString *source

Discussion

The source string being tokenized by this lexer. Note that setting this value resets the lexer state

Declared In

PXStylesheetLexer.h

Instance Methods

decreaseNesting

This is the complementary method to increaseNesting. This is used to indicate that a block has been completely lexed.

- (void)decreaseNesting

Discussion

This is the complementary method to increaseNesting. This is used to indicate that a block has been completely lexed.

Declared In

PXStylesheetLexer.h

increaseNesting

This lexer returns different lexemes for the same source depending on if the lexer is inside or outside of a delcaration body. This method allows code to indicate that lexing should proceed as if the lexer is inside a block. This is typically used when processing styles that are associated directly with a styleable object as opposed to coming from a stylesheet.

- (void)increaseNesting

Discussion

This lexer returns different lexemes for the same source depending on if the lexer is inside or outside of a delcaration body. This method allows code to indicate that lexing should proceed as if the lexer is inside a block. This is typically used when processing styles that are associated directly with a styleable object as opposed to coming from a stylesheet.

Declared In

PXStylesheetLexer.h

initWithString:

Initializer a new instance with the specified source value

- (id)initWithString:(NSString *)source

Parameters

source

The source string to lex

Discussion

Initializer a new instance with the specified source value

Declared In

PXStylesheetLexer.h

nextLexeme

Return the next lexeme in the source string from where the last lex ended. This will return nil once the source string has been completed consumed.

- (PXStylesheetLexeme *)nextLexeme

Discussion

Return the next lexeme in the source string from where the last lex ended. This will return nil once the source string has been completed consumed.

Declared In

PXStylesheetLexer.h

pushLexeme:

Push the specified lexeme onto internal stack. Lexemes will first be removed from this stack when calling nextLexeme. Once the stack has been depleted, lexing continues from the last successful scan not involving the lexeme stack.

- (void)pushLexeme:(PXStylesheetLexeme *)lexeme

Parameters

lexeme

The lexeme to push on to the stack

Discussion

Push the specified lexeme onto internal stack. Lexemes will first be removed from this stack when calling nextLexeme. Once the stack has been depleted, lexing continues from the last successful scan not involving the lexeme stack.

Declared In

PXStylesheetLexer.h

pushSource:

Save the current context of the lexer, re-initialize the lexer, and begin lexing the specified source. This is useful for handling “import” statements, where another file needs to be processed inline with the current file being processed

- (void)pushSource:(NSString *)source

Parameters

source

The new source

Discussion

Save the current context of the lexer, re-initialize the lexer, and begin lexing the specified source. This is useful for handling “import” statements, where another file needs to be processed inline with the current file being processed

Declared In

PXStylesheetLexer.h