lexer – Lexical analyser
Lexing rules for Tayra Template Language. Lexer uses
PLY.
Module contents
-
class tayra.lexer.TTLLexer(compiler)[source]
Bases: builtins.object
Lexical analyser for tayra templates. This class is initialized
with tayra.compiler.TTLCompiler instance.
-
build(**kwargs)[source]
Builds the lexer from this class specification. Must be called
after the lexer object is created. This method exists separately,
because the PLY manual warns against calling lex.lex inside __init__
-
input(text)[source]
Set the input text for tokenising. Input text is pre-processed
before. A line separator is automatically appended at the end of
text for convenient parsing.
-
reset_lineno()[source]
Resets the internal line number counter of the lexer.
-
token()[source]
Get next token. Primary interface for the parser.