Token¶
A leaf node in the parse tree representing a span of matched source text. The token stores a reference to the source and the byte offset/length of the match rather than copying the text.
Constructors¶
create¶
new val create(
label': Label val,
source': Source val,
offset': USize val,
length': USize val)
: Token val^
Parameters¶
Returns¶
- Token val^
Public fields¶
let source: Source val¶
let offset: USize val¶
let length: USize val¶
Public Functions¶
label¶
This token's label.
Returns¶
- Label val
string¶
The full matched text.
Returns¶
- String iso^
substring¶
A substring of the matched text. Negative indices count from the end.
Parameters¶
Returns¶
- String iso^
offset_to_index¶
Convert a relative index to an absolute source position.
Parameters¶
- i: ISize val
Returns¶
- USize val