class Lexer:
Class that implements a lexer for a given environment. Automatically created by the environment class, usually you don't have to do that.
Note that the lexer is not automatically bound to an environment. Multiple environments can share the same lexer.
Method | __init__ |
Undocumented |
Method | _normalize_newlines |
Replace all newlines with the configured sequence in strings and template data. |
Method | tokeniter |
This method tokenizes the text and returns the tokens in a generator. Use this method if you just want to tokenize a template. |
Method | tokenize |
Calls tokeniter + tokenize and wraps it in a token stream. |
Method | wrap |
This is called with the stream as returned by tokenize and wraps every token in a Token and converts the value. |
Instance Variable | keep_trailing_newline |
Undocumented |
Instance Variable | lstrip_unless_re |
Undocumented |
Instance Variable | newline_sequence |
Undocumented |
Instance Variable | rules |
Undocumented |
Parameters | |
value:str | Undocumented |
Returns | |
str | Undocumented |
This method tokenizes the text and returns the tokens in a generator. Use this method if you just want to tokenize a template.
Parameters | |
source:str | Undocumented |
name:t.Optional[ | Undocumented |
filename:t.Optional[ | Undocumented |
state:t.Optional[ | Undocumented |
Returns | |
t.Iterator[ | Undocumented |
Parameters | |
source:str | Undocumented |
name:t.Optional[ | Undocumented |
filename:t.Optional[ | Undocumented |
state:t.Optional[ | Undocumented |
Returns | |
TokenStream | Undocumented |