Token
in package
FinalYes
A single lexical token. `value` is the raw source text; `literal` is the parsed value for value tokens (string content, number int/float, bool, null, or the dot count for DOT_DOT) and null otherwise.
No position field: the 4-language token contract excludes positions (the Rust AST holds none), matching the shared fixture's token shape.
Table of Contents
Properties
Methods
- __construct() : mixed
- Build a token from its type, raw text, and parsed literal (or null).
- toArray() : array{type: string, value: string, literal: string|int|float|bool|null}
- Serialize to the shared-fixture token shape: {type, value, literal}.
Properties
$literal read-only
public
string|int|float|bool|null
$literal
$type read-only
public
TokenType
$type
$value read-only
public
string
$value
Methods
__construct()
Build a token from its type, raw text, and parsed literal (or null).
public
__construct(TokenType $type, string $value, string|int|float|bool|null $literal) : mixed
Parameters
- $type : TokenType
- $value : string
- $literal : string|int|float|bool|null
toArray()
Serialize to the shared-fixture token shape: {type, value, literal}.
public
toArray() : array{type: string, value: string, literal: string|int|float|bool|null}