Instruction generator for tayra.runtime.StackMachine. Generates intermediate python file.
Bases: builtins.object
Instruction generator to compile template script to an intermediate python file. This file can be loaded as template module and executed in the context of a HTTP request to generate the final HTML response. Since creating an instance of this class every time can be a costly operation, create it once and use _init() to initialize for subsequent uses.
Increase or decrease python code-indentation for subsequently generated code.
Optionally create a comment line inside the python code. Happens only when TTLCompiler[‘debug’] option is set true.
Generate a new-line (along with current indentation level) in python generated text.
Evaluate a string as python expression and append the result into the stack buffer.
Call this when there is no more instruction to generate. Before calling this footer() method must have been called.
puttext() method’s text string are not immediately appended to the stack buffer. They are accumulated and appended only when this method is called.
Add the footer python code.
Pop the last two buffers from the stack and supply them to ITayraTags plugins. The returned HTML text from the plugin is only again pushed into the stack buffer.
Special method to handle @implement directive and @interface functions implementations.
Initialize and begin generating the intermediate python file. Generates import statements and in debug mode generate trace-back generator.
Pop the last buffer in the stack and append the text into the previous buffer in the stack.
Some times a function might want to return something else other than stacked buffers.
Create a new buffer in the stack. The newly created buffer will start accumulated text string.