klyn.code.TokenSpan.slice
method
public slice(line as String) as String
Description

Extracts the substring covered by this span from line.

Parameters
ParameterDescription
lineSource line from which the span was produced.
Returns

Extracted token text, or "" if out of bounds.

Example
import klyn.code

span = TokenSpan(4, 7, TokenKind.IDENTIFIER)
assert span.slice("def run():") == "run"