jinja2.lexer.Lexer

class jinja2.lexer.Lexer(environment)[source]

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.

Methods

__init__(environment)
tokeniter(source, name[, filename, state]) This method tokenizes the text and returns the tokens in a generator.
tokenize(source[, name, filename, state]) Calls tokeniter + tokenize and wraps it in a token stream.
wrap(stream[, name, filename]) This is called with the stream as returned by tokenize and wraps every token in a Token and converts the value.