class documentation
class Tokenizer(ITokenizer[
Constructor: Tokenizer(annotation, warns_on_unknown_tokens)
A tokenizer for string annotations.
| Class Method | build |
Undocumented |
| Static Method | recombine |
Merge the special literal choices tokens together. |
| Static Method | tokenize |
Split the string in tokens for further processing. |
| Method | __init__ |
Undocumented |
| Instance Variable | tokens |
The tokens. |
| Instance Variable | warnings |
The warnings trigered during the tokenization. |
| Static Method | _additional |
Some more warnings. |
| Static Method | _token |
Find the type of a token. Types are defined in TokenType enum. |
def build(cls, raw_tokens:
list[ object], warnings: list[ str], warns_on_unknown_tokens: bool) -> list[ Token]:
(source)
¶
Undocumented
Merge the special literal choices tokens together.
Example
>>> tokens = ["{", "1", ", ", "2", "}"] >>> Tokenizer.recombine_sets(tokens) ['{1, 2}']