Tokens
tokenize() returns a flat, lossless
list of Token objects; concatenating every token’s
value reproduces the original source exactly.
Token model shared by the tokenizer and the match/extract APIs.
- class PyReprism.tokens.Token(type: TokenType, value: str, start: int, end: int, line: int)
Bases:
objectA single lexical token located within a source string.
- Parameters:
type – the
TokenTypeof the token.value – the exact substring the token spans.
start – 0-based start offset in the source.
end – 0-based end offset (exclusive) in the source.
line – 1-based line number of
start.