Constants

EOF_TYPE

EOF_TYPE = -1

TEXT_TYPE

TEXT_TYPE = 0

BLOCK_START_TYPE

BLOCK_START_TYPE = 1

VAR_START_TYPE

VAR_START_TYPE = 2

BLOCK_END_TYPE

BLOCK_END_TYPE = 3

VAR_END_TYPE

VAR_END_TYPE = 4

NAME_TYPE

NAME_TYPE = 5

NUMBER_TYPE

NUMBER_TYPE = 6

STRING_TYPE

STRING_TYPE = 7

OPERATOR_TYPE

OPERATOR_TYPE = 8

PUNCTUATION_TYPE

PUNCTUATION_TYPE = 9

INTERPOLATION_START_TYPE

INTERPOLATION_START_TYPE = 10

INTERPOLATION_END_TYPE

INTERPOLATION_END_TYPE = 11

Properties

$value

$value : 

Type

$type

$type : 

Type

$lineno

$lineno : 

Type

Methods

__construct()

__construct(integer  $type, string  $value, integer  $lineno) 

Parameters

integer $type

The type of the token

string $value

The token value

integer $lineno

The line position in the source

__toString()

__toString() 

test()

test(array|string|integer  $type, array|string|null  $values = null) : boolean

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

Parameters may be:

  • just type
  • type and value (or array of possible values)
  • just value (or array of possible values) (NAME_TYPE is used as type)

Parameters

array|string|integer $type

The type to test

array|string|null $values

The token value

Returns

boolean

getLine()

getLine() : integer

Returns

integer

getType()

getType() : integer

Returns

integer

getValue()

getValue() : string

Returns

string

typeToString()

typeToString(integer  $type, boolean  $short = false) : string

Returns the constant representation (internal) of a given type.

Parameters

integer $type

The type as an integer

boolean $short

Whether to return a short representation or not

Returns

string —

The string representation

typeToEnglish()

typeToEnglish(integer  $type) : string

Returns the English representation of a given type.

Parameters

integer $type

The type as an integer

Returns

string —

The string representation