Token
in package
Represents a Token.
Tags
Table of Contents
- EOF_TYPE = 'end of expression'
- NAME_TYPE = 'name'
- NUMBER_TYPE = 'number'
- OPERATOR_TYPE = 'operator'
- PUNCTUATION_TYPE = 'punctuation'
- STRING_TYPE = 'string'
- $cursor : mixed
- $type : mixed
- $value : mixed
- __construct() : mixed
- __toString() : string
- Returns a string representation of the token.
- test() : bool
- Tests the current token for a type and/or a value.
Constants
EOF_TYPE
public
mixed
EOF_TYPE
= 'end of expression'
NAME_TYPE
public
mixed
NAME_TYPE
= 'name'
NUMBER_TYPE
public
mixed
NUMBER_TYPE
= 'number'
OPERATOR_TYPE
public
mixed
OPERATOR_TYPE
= 'operator'
PUNCTUATION_TYPE
public
mixed
PUNCTUATION_TYPE
= 'punctuation'
STRING_TYPE
public
mixed
STRING_TYPE
= 'string'
Properties
$cursor
public
mixed
$cursor
$type
public
mixed
$type
$value
public
mixed
$value
Methods
__construct()
public
__construct(string $type, string|int|float|null $value, int|null $cursor) : mixed
Parameters
- $type : string
-
The type of the token (self::*_TYPE)
- $value : string|int|float|null
-
The token value
- $cursor : int|null
-
The cursor position in the source
Return values
mixed —__toString()
Returns a string representation of the token.
public
__toString() : string
Return values
string —test()
Tests the current token for a type and/or a value.
public
test(string $type[, string|null $value = null ]) : bool
Parameters
- $type : string
- $value : string|null = null