class Token

This class represents one token of an arithmetic or a logical expression.

Constants

T_UNDEFINED

T_NUMBER

T_DATE

T_BOOLEAN

T_TEXT

T_ANY

T_IDENT

T_FUNCTION

T_ARRAY

T_POPEN

T_PCLOSE

T_SBOPEN

T_SBCLOSE

T_COMMA

T_NOOP

T_PLUS

T_MINUS

T_TIMES

T_DIV

T_MOD

T_POW

T_UNARY_PLUS

T_UNARY_MINUS

T_NOT

T_FIELD

T_EQUAL

T_NOT_EQUAL

T_LESS_THAN

T_LESS_OR_EQUAL

T_GREATER_THAN

T_GREATER_OR_EQUAL

T_CONTAINS

T_NOT_CONTAINS

T_BITWISE_AND

T_BITWISE_OR

T_BITWISE_XOR

T_LOGICAL_AND

T_LOGICAL_OR

T_TERNARY

T_TERNARY_ELSE

T_DEGRE

A_NONE

A_LEFT

A_RIGHT

Properties

int $type
mixed $value
int $arity

Methods

void
__construct(int $type, mixed $value)

Constructor of class Token

bool
isUnaryOperator()

Determines whether this token represents an unary operator or not.

bool
isBinaryOperator()

Determines whether this token represents a binary operator or not.

bool
isTernaryOperator()

Determines whether this token represents a ternary operator or not.

bool
isOperator()

Determines whether this token represents an operator or not.

bool
isComparator()

Determines whether this token represents a comparison operator or not.

bool
isVariable()

Determines whether this token represents a variable identifier or not.

bool
isUndefined()

Determines whether this token represents an undefined value or not.

bool
isBeforeFunctionArgument()

Determines whether this token is just before a function argument or not.

int
precedence()

Returns the priority of the operator represented by this token

int
associativity()

Determines if the operator represented by this token is right-associative, left-associative or non-associative

string
__toString()

Returns a string representation of this token.

Details

at line 123
void __construct(int $type, mixed $value)

Constructor of class Token

Parameters

int $type The type of this token
mixed $value The value of this token

Return Value

void

at line 136
bool isUnaryOperator()

Determines whether this token represents an unary operator or not.

Return Value

bool true if this token represents an unary operator, false otherwise

at line 155
bool isBinaryOperator()

Determines whether this token represents a binary operator or not.

Return Value

bool true if this token represents a binary operator, false otherwise

at line 180
bool isTernaryOperator()

Determines whether this token represents a ternary operator or not.

Return Value

bool true if this token represents a ternary operator, false otherwise

at line 195
bool isOperator()

Determines whether this token represents an operator or not.

Return Value

bool true if this token represents an operator, false otherwise

at line 208
bool isComparator()

Determines whether this token represents a comparison operator or not.

Return Value

bool true if this token represents a comparison operator, false otherwise

at line 230
bool isVariable()

Determines whether this token represents a variable identifier or not.

Return Value

bool true if this token represents a variable identifier, false otherwise

at line 247
bool isUndefined()

Determines whether this token represents an undefined value or not.

Return Value

bool true if this token represents an undefined value, false otherwise

at line 258
bool isBeforeFunctionArgument()

Determines whether this token is just before a function argument or not.

Return Value

bool true if this token is just before a function argument, false otherwise

at line 275
int precedence()

Returns the priority of the operator represented by this token

Return Value

int The priority of the operator

at line 331
int associativity()

Determines if the operator represented by this token is right-associative, left-associative or non-associative

Return Value

int One of the associativity constant: A_RIGHT, A_LEFT or A_NONE

at line 375
string __toString()

Returns a string representation of this token.

Return Value

string