class Lexer (View source)

A primitive lexer that recognizes Afx-specific characters while iterating through a string

Properties

protected string $string

The string to be iterated through

protected string $currentCharacter

The currently focused character

protected int $characterPosition

The current character position

Methods

__construct(string $string)

Constructor

bool
isWhiteSpace()

Checks if the current character is whitespace

bool
isAlpha()

Checks if the current character is a letter

bool
isAlphaNumeric()

Checks if the current character is alpha-numeric

bool
isColon()

Checks if the current character is a colon

bool
isDot()

Checks if the current character is a dot

bool
isAt()

Checks if the current character is a @

bool
isMinus()

Checks if the current character is a minus

bool
isUnderscore()

Checks if the current character is an underscore

bool
isEqualSign()

Checks if the current character is an equal sign

bool
isOpeningBracket()

Checks if the current character is an opening bracket

bool
isClosingBracket()

Checks if the current character is a closing bracket

bool
isOpeningBrace()

Checks if the current character is an opening curly brace

bool
isClosingBrace()

Checks if the current character is a closing curly brace

bool
isForwardSlash()

Checks if the current character is a forward slash

bool
isBackSlash()

Checks if the current character is a back slash

bool
isSingleQuote()

Checks if the current character is a single quote

bool
isDoubleQuote()

Checks if the current character is a double quote

bool
isExclamationMark()

Checks if the current character is an exclamation mark

bool
isEnd()

Checks if the iteration has ended

void
rewind()

Rewinds the iteration by one step

string|null
peek(int $characterNumber = 1)

Peek several characters in advance and return the next n characters

string|null
consume()

Returns the current character and moves one step forward

Details

__construct(string $string)

Constructor

Parameters

string $string

bool isWhiteSpace()

Checks if the current character is whitespace

Return Value

bool

bool isAlpha()

Checks if the current character is a letter

Return Value

bool

bool isAlphaNumeric()

Checks if the current character is alpha-numeric

Return Value

bool

bool isColon()

Checks if the current character is a colon

Return Value

bool

bool isDot()

Checks if the current character is a dot

Return Value

bool

bool isAt()

Checks if the current character is a @

Return Value

bool

bool isMinus()

Checks if the current character is a minus

Return Value

bool

bool isUnderscore()

Checks if the current character is an underscore

Return Value

bool

bool isEqualSign()

Checks if the current character is an equal sign

Return Value

bool

bool isOpeningBracket()

Checks if the current character is an opening bracket

Return Value

bool

bool isClosingBracket()

Checks if the current character is a closing bracket

Return Value

bool

bool isOpeningBrace()

Checks if the current character is an opening curly brace

Return Value

bool

bool isClosingBrace()

Checks if the current character is a closing curly brace

Return Value

bool

bool isForwardSlash()

Checks if the current character is a forward slash

Return Value

bool

bool isBackSlash()

Checks if the current character is a back slash

Return Value

bool

bool isSingleQuote()

Checks if the current character is a single quote

Return Value

bool

bool isDoubleQuote()

Checks if the current character is a double quote

Return Value

bool

bool isExclamationMark()

Checks if the current character is an exclamation mark

Return Value

bool

bool isEnd()

Checks if the iteration has ended

Return Value

bool

void rewind()

Rewinds the iteration by one step

Return Value

void

string|null peek(int $characterNumber = 1)

Peek several characters in advance and return the next n characters

Parameters

int $characterNumber

Return Value

string|null

string|null consume()

Returns the current character and moves one step forward

Return Value

string|null