Lexer
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
Constructor
Checks if the current character is whitespace
Checks if the current character is a letter
Checks if the current character is alpha-numeric
Checks if the current character is a colon
Checks if the current character is a dot
Checks if the current character is a @
Checks if the current character is a minus
Checks if the current character is an underscore
Checks if the current character is an equal sign
Checks if the current character is an opening bracket
Checks if the current character is a closing bracket
Checks if the current character is an opening curly brace
Checks if the current character is a closing curly brace
Checks if the current character is a forward slash
Checks if the current character is a back slash
Checks if the current character is a single quote
Checks if the current character is a double quote
Checks if the current character is an exclamation mark
Checks if the iteration has ended
Rewinds the iteration by one step
Peek several characters in advance and return the next n characters
Returns the current character and moves one step forward
Details
__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