class Token

Represents a Token.

Constants

EOF_TYPE

NAME_TYPE

NUMBER_TYPE

STRING_TYPE

OPERATOR_TYPE

PUNCTUATION_TYPE

Properties

$value
$type
$cursor

Methods

__construct(int $type, string $value, int $cursor)

Constructor.

string
__toString()

Returns a string representation of the token.

bool
test(array|int $type, string|null $value = null)

Tests the current token for a type and/or a value.

Details

at line line 39
__construct(int $type, string $value, int $cursor)

Constructor.

Parameters

int $type The type of the token
string $value The token value
int $cursor The cursor position in the source

at line line 51
string __toString()

Returns a string representation of the token.

Return Value

string A string representation of the token

at line line 64
bool test(array|int $type, string|null $value = null)

Tests the current token for a type and/or a value.

Parameters

array|int $type The type to test
string|null $value The token value

Return Value

bool