Index

Token

MMO\core\helpers · 1 symbol · generated 30 Sep 2026

class

Token

Tokenizer.php:453

A single lexed unit: either a "known" token from its domain's token list (id = the key it was registered under), or a run of plain, unrecognized text (id = TEXT_ID, i.e. isText true).

class MMO\core\helpers\Token implements Stringable
Namespace
MMO\core\helpers
Implements
Stringable

Index

TEXT_IDThe id used for a plain-text run (not one of the domain's known tokens).
col
domain
id
line
pos
text
is($kind)
isText()
Text($domain, $text, $line, $col, $pos) staticBuild a plain-text token (TEXT_ID).
__construct($domain, $id, $text, $line, $col, $pos)
__toString()

Constants1

TEXT_ID

The id used for a plain-text run (not one of the domain's known tokens). Reuses PHP's own T_INLINE_HTML constant as a convenient distinct integer, with no other significance.

const TEXT_ID = 267

Properties6

col

int $col
Type
int

domain

MMO\core\helpers\TokenDomain $domain
Type
TokenDomain

id

int $id
Type
int

line

int $line
Type
int

pos

int $pos
Type
int

Methods5

is($kind)

Tokenizer.php:497
function is(array|string|int $kind): bool
$kindarray | string | intone or more ids and/or literal texts to match against
returnsbooltrue if this token's id OR text matches any of $kind
$token->is(','); // true if this token's text is exactly ','$token->is(['(', ')']); // true if it's either an opening or closing paren

isText()

Tokenizer.php:487
function isText(): bool
returnsbooltrue if this is a plain-text run rather than a recognized token

Text($domain, $text, $line, $col, $pos)

staticTokenizer.php:482

Build a plain-text token (TEXT_ID).

static function Text( MMO\core\helpers\TokenDomain $domain, string $text, int $line = -1, int $col = -1, int $pos = -1 ): self
$domainTokenDomain
$textstring
$line = -1int
$col = -1int
$pos = -1int
returnsself

__construct($domain, $id, $text, $line, $col, $pos)

Tokenizer.php:472
function __construct( MMO\core\helpers\TokenDomain $domain, int $id, string $text, int $line = -1, int $col = -1, int $pos = -1 )
$domainTokenDomainthe domain this token was recognized in
$idint
$textstring
$line = -1int
$col = -1int
$pos = -1int