ll.ul4c

Crossplatform templating language

Home › Python software › ll.ul4cText · XIST · Python

ll.ul4c provides templating for XML/HTML as well as any other text-based format. A template defines placeholders for data output and basic logic (like loops and conditional blocks), that define how the final rendered output will look.

ll.ul4c compiles a template to a bytecode format, which makes it possible to implement template renderers in multiple programming languages.

class Location​(object):

A Location object contains information about the location of a template tag.

def __init__​(self, source, name, type, starttag, endtag, startcode, endcode):

Create a new Location object. The arguments have the following meaning:

source

The complete source string

name

The name of the template the location belongs to.

type

The tag type (i.e. "for", "if", etc. or None for literal text)

starttag

The start position of the start delimiter.

endtag

The end position of the end delimiter.

startcode

The start position of the tag code.

endcode

The end position of the tag code.

def __getitem__​(self, key):

property code:

def __get__​(self):

property tag:

def __get__​(self):

def __repr__​(self):

def pos​(self):

def __str__​(self):

class Error​(Exception):

Exception class that wraps another exception and provides a location.

def __init__​(self, location):

def __repr__​(self):

def __str__​(self):

class LexicalError​(Exception):

def __init__​(self, start, end, input):

def __str__​(self):

class SyntaxError​(Exception):

def __init__​(self, token):

def __str__​(self):

class UnterminatedStringError​(Exception):

Exception that is raised by the parser when a string constant is not terminated.

def __str__​(self):

class BlockError​(Exception):

Exception that is raised by the compiler when an illegal block structure is detected (e.g. an endif without a previous if).

def __init__​(self, message):

def __str__​(self):

class UnknownFunctionError​(Exception):

Exception that is raised by the renderer if the function to be executed by the callfunc0, callfunc1, callfunc2, callfunc3 or callfunc4 opcodes is unknown.

def __init__​(self, funcname):

def __str__​(self):

class UnknownMethodError​(Exception):

Exception that is raised by the renderer if the method to be executed by the callmeth0, callmeth1, callmeth2 or callmeth3 opcodes is unknown.

def __init__​(self, methname):

def __str__​(self):

class UnknownOpcodeError​(Exception):

Exception that is raised when an unknown opcode is encountered by the renderer.

def __init__​(self, opcode):

def __str__​(self):

class OutOfRegistersError​(Exception):

Exception that is raised by the compiler when there are no more free registers. This might happen with complex expressions in tag code.

def __str__​(self):

class Opcode​(object):

An Opcode stores an opcode. An Opcode object has the following attributes:

code (string or None)

The opcode type (see below for a list).

r1, r2, r3, r4, r5 (integer or None)

Register specifications (for the sources or the target of the opcode)

arg (string or None)

Used if the opcode requires an additional argument (like a variable name or the value of a constant).

location (Location object)

The location of the tag to which this opcode belongs.

The following opcode types are available:

None:

Print text. The text is available from location.code.

"print":

Print the content of register r1. (If the object in the register is not a string, it will be converted to a string first.)

"loadnone":

Load the constant None into register r1.

"loadfalse":

Load the constant False into register r1.

"loadtrue":

Load the constant True into register r1.

"loadstr":

Load the string arg into register r1.

"loadint":

Load the integer value arg into register r1.

"loadfloat":

Load the float value arg into register r1.

"loaddate":

Load the date value arg into register r1. arg must be in ISO format (e.g. 2008-07-02T11:05:55.460464).

"loadcolor":

Load the color value arg into register r1. arg must be in the format rrggbbaa).

"buildlist":

Load an empty list into register r1.

"builddict":

Load an empty dictionary into register r1.

"addlist"

Append the object in register r2 to the list in register r1.

"adddict"

Add a new entry to the dictionary in register r1. The object in r2 is the key and the object in register r3 is the value.

"updatedict"

Update the dictionary in register r1 with the items from the dictionary in r2.

"loadvar":

Load the variable named arg into the register r1.

"storevar":

Store the content of register r1 in the variable named arg.

"addvar":

Add the content of register r1 to the variable named arg.

"for":

Start a loop over the object in the register r2 and store the object from each loop iteration in the register r1.

"endfor":

End the innermost running for loop.

"break":

Breaks the innermost running for loop.

"continue":

Continues the innermost running for loop (i.e. jumps back to the start of the loop body).

"if":

Start a conditional block. If the objects in the register r1 is true the block will be executed. The "block" consists of all opcodes after the if upto the matching else or endif opcode.

"else":

Start the else branch of the previous if.

"endif":

End a conditional block.

"getattr":

Get the attribute named arg from the object in register r2 and store it in register r1.

"getitem":

Get an item from the object in register r2. If this object is a list or string the object in register r3 will be used as the index. If it is a dictionary r3 will be used as the key. The result will be stored in register r1.

"getslice12":

Get an slice from the object in register r2. The object in register r3 (which must be an int or None) specifies the start index, the object in register r4 specifies the end index. The result will be stored in register r1.

"getslice1":

Similar to getslice12 except that the end index is always the length of the object.

"getslice2":

Similar to getslice12 except that the start index is always 0 and the end index is in register r3.

"not":

Invert the truth value of the object in register r2 and stores the resulting bool in the register r1.

"eq":

Compare the objects in register r2 and r3 and store True in the register r1 if they are equal, False otherwise.

"ne":

Compare the objects in register r2 and r3 and store False in the register r1 if they are equal, True otherwise.

"lt":

Does a "<" comparison of the objects in register r2 and r3 and stores the result in register r1.

"le":

Does a "<=" comparison of the objects in register r2 and r3 and stores the result in register r1.

"gt":

Does a ">" comparison of the objects in register r2 and r3 and stores the result in register r1.

"ge":

Does a ">=" comparison of the objects in register r2 and r3 and stores the result in register r1.

"contains":

Test whether the object in register r3 contains the object in register r2 (either as a key if r3 is a dictionary or as an item if it's a list or as a substring if it's a string) and store True into the register r1 if it does, False otherwise.

"notcontains":

Test whether the object in register r3 contains the object in register r2 (either as a key if r3 is a dictionary or as an item if it's a list or as a substring if it's a string) and store False into the register r1 if it does, True otherwise.

"or":

Check the truth value of the two objects in registers r2 and r3 and store r2 in the register r1 if it is true, r3 otherwise).

"and":

Check the truth value of the two objects in registers r2 and r3 and store r3 in the register r1 if r2 is true, r3 otherwise).

"mod":

Does a modulo operation: Calculates r2 modulo r3 and stores the result in register r1.

"callfunc0":

Call the function named arg without any arguments and store the return value in register r1.

"callfunc1":

Call the function named arg with the content of register r2 as an argument and store the return value in register r1.

"callfunc2":

Call the function named arg with the contents of register r2 and r3 as the two arguments and store the return value in register r1.

"callfunc3":

Call the function named arg with the contents of register r2, r3 and r4 as the three arguments and store the return value in register r1.

"callfunc4":

Call the function named arg with the contents of register r2, r3, r4 and r5 as the four arguments and store the return value in register r1.

"callmeth0":

Call the method named arg on the object in register r2 and store the return value in register r1.

"callmeth1":

Call the method named arg on the object in register r2 using the object in register r3 as the only argument and store the return value in register r1.

"callmeth2":

Call the method named arg on the object in register r2 using the objects in register r3 and r4 as arguments and store the return value in register r1.

"callmeth3":

Call the method named arg on the object in register r2 using the objects in register r3, r4 and r5 as arguments and store the return value in register r1.

"render":

Render the template in the attribute r1. The content of register r2 (which must be a dictionary) will be passed to the template as the variable dictionary.

"def"

Begin the definition of a local template. The template will be stored in the variable named arg.

"enddef"

End the definition of a local template.

def __init__​(self, code, r1=None, r2=None, r3=None, r4=None, r5=None, arg=None, location=None):

def __getitem__​(self, key):

def __repr__​(self):

def __str__​(self):

class Template​(object):

A template object is normally creating by passing the template source to the constructor. It can also be loaded from the compiled format via the class methods load (from a stream) or loads (from a string).

The compiled format can be generated with the methods dump (which dumps the format to a stream) or dumps (which returns a string with the compiled format).

Rendering the template can be done with the methods render (which is a generator) or renders (which returns a string).

def __init__​(self, source=None, name='unnamed', startdelim='<?', enddelim='?>'):

Create a Template object. If source is None, the Template remains uninitialized, otherwise source will be compiled (using startdelim and enddelim as the tag delimiters). name is the name of the template. It will be used in exception messages and should be a valid Python identifier.

def __getitem__​(self, key):

def loads​(cls, data):

The class method loads loads the template from string data. data must contain the template in compiled format.

def load​(cls, stream):

The class method load loads the template from the stream stream. The stream must contain the template in compiled format.

def iterdump​(self):

This generator outputs the template in compiled format.

def dump​(self, stream):

dump dumps the template in compiled format to the stream stream.

def dumps​(self):

dumps returns the template in compiled format (as a string).

def render​(self, **variables):

Render the template iteratively (i.e. this is a generator). variables contains the top level variables available to the template code.

def renders​(self, **variables):

Render the template as a string. variables contains the top level variables available to the template code.

def pythonfunction​(self):

Return a Python generator that can be called to render the template. The argument signature of the function will be **variables.

def __call__​(self, **variables):

def pythonsource​(self, *args, **kwargs):

Return the template as Python source code. All arguments in args and kwargs will be passed on to the PythonSource object which creates the sourcecode. See its constructor for more info.

def jssource​(self):

Return the template as the source code of a Javascript function. A JavascriptSource object will be used to generated the sourcecode.

def javasource​(self, *args, **kwargs):

Return the template as Java source code. All arguments in args and kwargs will be passed on to the JavaSource object which creates the sourcecode. See its constructor for more info.

def format​(self, indent='\t'):

Format the list of opcodes. This is a generator yielding lines to be output (but without trailing newlines). indent can be used to specify how to indent blocks (defaulting to "\t").

def _tokenize​(self, source, name, startdelim, enddelim):

Tokenize the template source code source into tags and non-tag text. startdelim and enddelim are used as the tag delimiters.

This is a generator which produces Location objects for each tag or non-tag text. It will be called by _compile internally.

def _allocreg​(self):

Allocates a free register from the pool of available registers.

def _freereg​(self, register):

Returns the register register to the pool of available registers.

def opcode​(self, code, r1=None, r2=None, r3=None, r4=None, r5=None, arg=None):

Creates an Opcode object and appends it to selfs list of opcodes.

def _compile​(self, source, name, startdelim, enddelim):

Compile the template source code source into opcodes. startdelim and enddelim are used as the tag delimiters.

def __str__​(self):

def __unicode__​(self):

def __repr__​(self):

class PythonSource​(object):

A PythonSource object generates Python sourcecode from a UL4 template.

def __init__​(self, template):

Create a PythonSource object. template is the Template object.

def __unicode__​(self):

Return the Python sourcecode for the Template object passed to the constructor.

def _line​(self, location, line):

def _dispatch_None​(self, opcode):

def _dispatch_loadstr​(self, opcode):

def _dispatch_loadint​(self, opcode):

def _dispatch_loadfloat​(self, opcode):

def _dispatch_loadnone​(self, opcode):

def _dispatch_loadfalse​(self, opcode):

def _dispatch_loadtrue​(self, opcode):

def _dispatch_loaddate​(self, opcode):

def _dispatch_loadcolor​(self, opcode):

def _dispatch_buildlist​(self, opcode):

def _dispatch_builddict​(self, opcode):

def _dispatch_addlist​(self, opcode):

def _dispatch_adddict​(self, opcode):

def _dispatch_updatedict​(self, opcode):

def _dispatch_loadvar​(self, opcode):

def _dispatch_storevar​(self, opcode):

def _dispatch_addvar​(self, opcode):

def _dispatch_subvar​(self, opcode):

def _dispatch_mulvar​(self, opcode):

def _dispatch_truedivvar​(self, opcode):

def _dispatch_floordivvar​(self, opcode):

def _dispatch_modvar​(self, opcode):

def _dispatch_delvar​(self, opcode):

def _dispatch_getattr​(self, opcode):

def _dispatch_getitem​(self, opcode):

def _dispatch_getslice12​(self, opcode):

def _dispatch_getslice1​(self, opcode):

def _dispatch_getslice2​(self, opcode):

def _dispatch_print​(self, opcode):

def _dispatch_printx​(self, opcode):

def _dispatch_for​(self, opcode):

def _dispatch_endfor​(self, opcode):

def _dispatch_break​(self, opcode):

def _dispatch_continue​(self, opcode):

def _dispatch_not​(self, opcode):

def _dispatch_neg​(self, opcode):

def _dispatch_contains​(self, opcode):

def _dispatch_notcontains​(self, opcode):

def _dispatch_eq​(self, opcode):

def _dispatch_ne​(self, opcode):

def _dispatch_lt​(self, opcode):

def _dispatch_le​(self, opcode):

def _dispatch_gt​(self, opcode):

def _dispatch_ge​(self, opcode):

def _dispatch_add​(self, opcode):

def _dispatch_sub​(self, opcode):

def _dispatch_mul​(self, opcode):

def _dispatch_floordiv​(self, opcode):

def _dispatch_truediv​(self, opcode):

def _dispatch_and​(self, opcode):

def _dispatch_or​(self, opcode):

def _dispatch_mod​(self, opcode):

def _dispatch_callfunc0​(self, opcode):

def _dispatch_callfunc1​(self, opcode):

def _dispatch_callfunc2​(self, opcode):

def _dispatch_callfunc3​(self, opcode):

def _dispatch_callfunc4​(self, opcode):

def _dispatch_callmeth0​(self, opcode):

def _dispatch_callmeth1​(self, opcode):

def _dispatch_callmeth2​(self, opcode):

def _dispatch_callmeth3​(self, opcode):

def _dispatch_callmethkw​(self, opcode):

def _dispatch_if​(self, opcode):

def _dispatch_else​(self, opcode):

def _dispatch_endif​(self, opcode):

def _dispatch_def​(self, opcode):

def _dispatch_enddef​(self, opcode):

def _dispatch_render​(self, opcode):

def _dispatch_callfunc0_now​(self, opcode):

def _dispatch_callfunc0_utcnow​(self, opcode):

def _dispatch_callfunc0_vars​(self, opcode):

def _dispatch_callfunc0_random​(self, opcode):

def _dispatch_callfunc1_xmlescape​(self, opcode):

def _dispatch_callfunc1_csv​(self, opcode):

def _dispatch_callfunc1_json​(self, opcode):

def _dispatch_callfunc1_str​(self, opcode):

def _dispatch_callfunc1_int​(self, opcode):

def _dispatch_callfunc1_float​(self, opcode):

def _dispatch_callfunc1_bool​(self, opcode):

def _dispatch_callfunc1_len​(self, opcode):

def _dispatch_callfunc1_abs​(self, opcode):

def _dispatch_callfunc1_enumerate​(self, opcode):

def _dispatch_callfunc1_isnone​(self, opcode):

def _dispatch_callfunc1_isstr​(self, opcode):

def _dispatch_callfunc1_isint​(self, opcode):

def _dispatch_callfunc1_isfloat​(self, opcode):

def _dispatch_callfunc1_isbool​(self, opcode):

def _dispatch_callfunc1_isdate​(self, opcode):

def _dispatch_callfunc1_islist​(self, opcode):

def _dispatch_callfunc1_isdict​(self, opcode):

def _dispatch_callfunc1_istemplate​(self, opcode):

def _dispatch_callfunc1_iscolor​(self, opcode):

def _dispatch_callfunc1_repr​(self, opcode):

def _dispatch_callfunc1_get​(self, opcode):

def _dispatch_callfunc1_chr​(self, opcode):

def _dispatch_callfunc1_ord​(self, opcode):

def _dispatch_callfunc1_hex​(self, opcode):

def _dispatch_callfunc1_oct​(self, opcode):

def _dispatch_callfunc1_bin​(self, opcode):

def _dispatch_callfunc1_sorted​(self, opcode):

def _dispatch_callfunc1_range​(self, opcode):

def _dispatch_callfunc1_type​(self, opcode):

def _dispatch_callfunc1_reversed​(self, opcode):

def _dispatch_callfunc1_randrange​(self, opcode):

def _dispatch_callfunc1_randchoice​(self, opcode):

def _dispatch_callfunc2_format​(self, opcode):

def _dispatch_callfunc2_range​(self, opcode):

def _dispatch_callfunc2_get​(self, opcode):

def _dispatch_callfunc2_zip​(self, opcode):

def _dispatch_callfunc2_int​(self, opcode):

def _dispatch_callfunc2_randrange​(self, opcode):

def _dispatch_callfunc3_range​(self, opcode):

def _dispatch_callfunc3_zip​(self, opcode):

def _dispatch_callfunc3_rgb​(self, opcode):

def _dispatch_callfunc3_hls​(self, opcode):

def _dispatch_callfunc3_hsv​(self, opcode):

def _dispatch_callfunc3_randrange​(self, opcode):

def _dispatch_callfunc4_rgb​(self, opcode):

def _dispatch_callfunc4_hls​(self, opcode):

def _dispatch_callfunc4_hsv​(self, opcode):

class JavascriptSource​(object):

A JavascriptSource object generates javascript sourcecode from a UL4 template.

The signature of the generated Javascript function will be function(vars), i.e. all template variables will be attributes of the object vars.

Note that the generated code will require the ul4 Javascript support library.

def __init__​(self, template):

Create a JavascriptSource object. template is the Template object.

def __unicode__​(self):

Return the Javascript sourcecode for the Template object passed to the constructor.

def _line​(self, line):

def _dispatch_None​(self, opcode):

def _dispatch_loadstr​(self, opcode):

def _dispatch_loadint​(self, opcode):

def _dispatch_loadfloat​(self, opcode):

def _dispatch_loadnone​(self, opcode):

def _dispatch_loadfalse​(self, opcode):

def _dispatch_loadtrue​(self, opcode):

def _dispatch_loaddate​(self, opcode):

def _dispatch_loadcolor​(self, opcode):

def _dispatch_buildlist​(self, opcode):

def _dispatch_builddict​(self, opcode):

def _dispatch_addlist​(self, opcode):

def _dispatch_adddict​(self, opcode):

def _dispatch_updatedict​(self, opcode):

def _dispatch_loadvar​(self, opcode):

def _dispatch_storevar​(self, opcode):

def _dispatch_addvar​(self, opcode):

def _dispatch_subvar​(self, opcode):

def _dispatch_mulvar​(self, opcode):

def _dispatch_truedivvar​(self, opcode):

def _dispatch_floordivvar​(self, opcode):

def _dispatch_modvar​(self, opcode):

def _dispatch_delvar​(self, opcode):

def _dispatch_getattr​(self, opcode):

def _dispatch_getitem​(self, opcode):

def _dispatch_getslice12​(self, opcode):

def _dispatch_getslice1​(self, opcode):

def _dispatch_getslice2​(self, opcode):

def _dispatch_print​(self, opcode):

def _dispatch_printx​(self, opcode):

def _dispatch_for​(self, opcode):

def _dispatch_endfor​(self, opcode):

def _dispatch_def​(self, opcode):

def _dispatch_enddef​(self, opcode):

def _dispatch_break​(self, opcode):

def _dispatch_continue​(self, opcode):

def _dispatch_not​(self, opcode):

def _dispatch_neg​(self, opcode):

def _dispatch_contains​(self, opcode):

def _dispatch_notcontains​(self, opcode):

def _dispatch_eq​(self, opcode):

def _dispatch_ne​(self, opcode):

def _dispatch_lt​(self, opcode):

def _dispatch_le​(self, opcode):

def _dispatch_gt​(self, opcode):

def _dispatch_ge​(self, opcode):

def _dispatch_add​(self, opcode):

def _dispatch_sub​(self, opcode):

def _dispatch_mul​(self, opcode):

def _dispatch_floordiv​(self, opcode):

def _dispatch_truediv​(self, opcode):

def _dispatch_and​(self, opcode):

def _dispatch_or​(self, opcode):

def _dispatch_mod​(self, opcode):

def _dispatch_callfunc0​(self, opcode):

def _dispatch_callfunc1​(self, opcode):

def _dispatch_callfunc2​(self, opcode):

def _dispatch_callfunc3​(self, opcode):

def _dispatch_callfunc4​(self, opcode):

def _dispatch_callmeth0​(self, opcode):

def _dispatch_callmeth1​(self, opcode):

def _dispatch_callmeth2​(self, opcode):

def _dispatch_callmeth3​(self, opcode):

def _dispatch_callmethkw​(self, opcode):

def _dispatch_if​(self, opcode):

def _dispatch_else​(self, opcode):

def _dispatch_endif​(self, opcode):

def _dispatch_render​(self, opcode):

class _JavaTemplateLevel​(object):

def __init__​(self, variables, name=None):

class JavaSource​(object):

A JavaSource object generates Java sourcecode from a UL4 template.

The code produced requires the UL4 Java package.

def __init__​(self, template, indent=2, variables='variables'):

Create a JavaSource object. template is the Template object.

indent is the current indent level (defaulting to 2 for normal method source code).

variables is the variable name of a Map object containing the template variables.

def __unicode__​(self):

Return the Java sourcecode for the Template object passed to the constructor.

def output​(self, expression):

Return a statement for outputting the Java expression expression. This uses out.write() (for JSP etc.) but can be overwritten in subclasses.

def _usereg​(self, r):

def _do​(self, line):

def _dispatch_None​(self, opcode):

def _dispatch_loadstr​(self, opcode):

def _dispatch_loadint​(self, opcode):

def _dispatch_loadfloat​(self, opcode):

def _dispatch_loadnone​(self, opcode):

def _dispatch_loadfalse​(self, opcode):

def _dispatch_loadtrue​(self, opcode):

def _dispatch_loaddate​(self, opcode):

def _dispatch_loadcolor​(self, opcode):

def _dispatch_buildlist​(self, opcode):

def _dispatch_builddict​(self, opcode):

def _dispatch_addlist​(self, opcode):

def _dispatch_adddict​(self, opcode):

def _dispatch_updatedict​(self, opcode):

def _dispatch_loadvar​(self, opcode):

def _dispatch_storevar​(self, opcode):

def _dispatch_addvar​(self, opcode):

def _dispatch_subvar​(self, opcode):

def _dispatch_mulvar​(self, opcode):

def _dispatch_truedivvar​(self, opcode):

def _dispatch_floordivvar​(self, opcode):

def _dispatch_modvar​(self, opcode):

def _dispatch_delvar​(self, opcode):

def _dispatch_getattr​(self, opcode):

def _dispatch_getitem​(self, opcode):

def _dispatch_getslice12​(self, opcode):

def _dispatch_getslice1​(self, opcode):

def _dispatch_getslice2​(self, opcode):

def _dispatch_print​(self, opcode):

def _dispatch_printx​(self, opcode):

def _dispatch_for​(self, opcode):

def _dispatch_endfor​(self, opcode):

def _dispatch_def​(self, opcode):

def _dispatch_enddef​(self, opcode):

def _dispatch_break​(self, opcode):

def _dispatch_continue​(self, opcode):

def _dispatch_not​(self, opcode):

def _dispatch_neg​(self, opcode):

def _dispatch_contains​(self, opcode):

def _dispatch_notcontains​(self, opcode):

def _dispatch_eq​(self, opcode):

def _dispatch_ne​(self, opcode):

def _dispatch_lt​(self, opcode):

def _dispatch_le​(self, opcode):

def _dispatch_gt​(self, opcode):

def _dispatch_ge​(self, opcode):

def _dispatch_add​(self, opcode):

def _dispatch_sub​(self, opcode):

def _dispatch_mul​(self, opcode):

def _dispatch_floordiv​(self, opcode):

def _dispatch_truediv​(self, opcode):

def _dispatch_and​(self, opcode):

def _dispatch_or​(self, opcode):

def _dispatch_mod​(self, opcode):

def _dispatch_callfunc0​(self, opcode):

def _dispatch_callfunc1​(self, opcode):

def _dispatch_callfunc2​(self, opcode):

def _dispatch_callfunc3​(self, opcode):

def _dispatch_callfunc4​(self, opcode):

def _dispatch_callmeth0​(self, opcode):

def _dispatch_callmeth1​(self, opcode):

def _dispatch_callmeth2​(self, opcode):

def _dispatch_callmeth3​(self, opcode):

def _dispatch_callmethkw​(self, opcode):

def _dispatch_if​(self, opcode):

def _dispatch_else​(self, opcode):

def _dispatch_endif​(self, opcode):

def _dispatch_render​(self, opcode):

class Token​(object):

def __init__​(self, start, end, type):

def __repr__​(self):

def __str__​(self):

class AST​(object):

Baseclass for all syntax tree nodes.

def __init__​(self, start, end):

class Const​(AST):

Common baseclass for all constants (used for type testing in constant folding)

def __repr__​(self):

def compile​(self, template):

class None_​(Const):

class True_​(Const):

class False_​(Const):

class Value​(Const):

def __init__​(self, start, end, value):

def __repr__​(self):

def compile​(self, template):

class Int​(Value):

class Float​(Value):

def compile​(self, template):

class Str​(Value):

class Date​(Value):

def compile​(self, template):

class Color​(Value):

def compile​(self, template):

class List​(AST):

def __init__​(self, start, end, *items):

def __repr__​(self):

def compile​(self, template):

class Dict​(AST):

def __init__​(self, start, end, *items):

def __repr__​(self):

def compile​(self, template):

class Name​(AST):

def __init__​(self, start, end, name):

def __repr__​(self):

def compile​(self, template):

class For​(AST):

def __init__​(self, start, end, iter, cont):

def __repr__​(self):

def compile​(self, template):

class GetAttr​(AST):

def __init__​(self, start, end, obj, attr):

def __repr__​(self):

def compile​(self, template):

class GetSlice12​(AST):

def __init__​(self, start, end, obj, index1, index2):

def __repr__​(self):

def compile​(self, template):

class Unary​(AST):

def __init__​(self, start, end, obj):

def __repr__​(self):

def compile​(self, template):

class Not​(Unary):

class Neg​(Unary):

class Binary​(AST):

def __init__​(self, start, end, obj1, obj2):

def __repr__​(self):

def compile​(self, template):

class GetItem​(Binary):

class GetSlice1​(Binary):

class GetSlice2​(Binary):

class EQ​(Binary):

class NE​(Binary):

class LT​(Binary):

class LE​(Binary):

class GT​(Binary):

class GE​(Binary):

class Contains​(Binary):

class NotContains​(Binary):

class Add​(Binary):

class Sub​(Binary):

class Mul​(Binary):

class FloorDiv​(Binary):

class TrueDiv​(Binary):

class Or​(Binary):

class And​(Binary):

class Mod​(Binary):

class ChangeVar​(AST):

def __init__​(self, start, end, name, value):

def __repr__​(self):

def compile​(self, template):

class StoreVar​(ChangeVar):

class AddVar​(ChangeVar):

class SubVar​(ChangeVar):

class MulVar​(ChangeVar):

class TrueDivVar​(ChangeVar):

class FloorDivVar​(ChangeVar):

class ModVar​(ChangeVar):

class DelVar​(AST):

def __init__​(self, start, end, name):

def __repr__​(self):

def compile​(self, template):

class CallFunc​(AST):

def __init__​(self, start, end, name, args):

def __repr__​(self):

def compile​(self, template):

class CallMeth​(AST):

def __init__​(self, start, end, name, obj, args):

def __repr__​(self):

def compile​(self, template):

class CallMethKeywords​(AST):

def __init__​(self, start, end, name, obj, args):

def __repr__​(self):

def compile​(self, template):

class Render​(AST):

def __init__​(self, start, end, template, *variables):

def __repr__​(self):

def compile​(self, template):

class Scanner​(ll.spark.Scanner):

def tokenize​(self, location):

def color8​(self, start, end, s):

def color6​(self, start, end, s):

def color4​(self, start, end, s):

def color3​(self, start, end, s):

def date​(self, start, end, s):

def token​(self, start, end, s):

def name​(self, start, end, s):

def float​(self, start, end, s):

def hexint​(self, start, end, s):

def octint​(self, start, end, s):

def binint​(self, start, end, s):

def int​(self, start, end, s):

def beginstr1​(self, start, end, s):

def beginstr2​(self, start, end, s):

def endstr​(self, start, end, s):

def whitespace​(self, start, end, s):

def escapedbackslash​(self, start, end, s):

def escapedapos​(self, start, end, s):

def escapedquot​(self, start, end, s):

def escapedbell​(self, start, end, s):

def escapedbackspace​(self, start, end, s):

def escapedformfeed​(self, start, end, s):

def escapedlinefeed​(self, start, end, s):

def escapedcarriagereturn​(self, start, end, s):

def escapedtab​(self, start, end, s):

def escapedverticaltab​(self, start, end, s):

def escapedescape​(self, start, end, s):

def escaped8bitchar​(self, start, end, s):

def escaped16bitchar​(self, start, end, s):

def text​(self, start, end, s):

def default​(self, start, end, s):

def error​(self, start, end, s):

class ExprParser​(ll.spark.Parser):

def __init__​(self, scanner):

def compile​(self, template):

def typestring​(self, token):

def error​(self, token):

def makeconst​(self, start, end, value):

def expr_atom​(self, atom):

def expr_emptylist​(self, _0, _1):

def expr_buildlist​(self, _0, expr):

def expr_addlist​(self, list, _0, expr):

def expr_finishlist​(self, list, _0):

def expr_finishlist1​(self, list, _0, _1):

def expr_emptydict​(self, _0, _1):

def expr_builddict​(self, _0, exprkey, _1, exprvalue):

def expr_builddictupdate​(self, _0, _1, expr):

def expr_adddict​(self, dict, _0, exprkey, _1, exprvalue):

def expr_updatedict​(self, dict, _0, _1, expr):

def expr_finishdict​(self, dict, _0):

def expr_finishdict1​(self, dict, _0, _1):

def expr_bracket​(self, _0, expr, _1):

def expr_callfunc0​(self, name, _0, _1):

def expr_callfunc1​(self, name, _0, arg0, _1):

def expr_callfunc2​(self, name, _0, arg0, _1, arg1, _2):

def expr_callfunc3​(self, name, _0, arg0, _1, arg1, _2, arg2, _3):

def expr_callfunc4​(self, name, _0, arg0, _1, arg1, _2, arg2, _3, arg3, _4):

def expr_getattr​(self, expr, _0, name):

def expr_callmeth0​(self, expr, _0, name, _1, _2):

def expr_callmeth1​(self, expr, _0, name, _1, arg1, _2):

def expr_callmeth2​(self, expr, _0, name, _1, arg1, _2, arg2, _3):

def expr_callmeth3​(self, expr, _0, name, _1, arg1, _2, arg2, _3, arg3, _4):

def methkw_startname​(self, expr, _0, methname, _1, argname, _2, argvalue):

def methkw_startdict​(self, expr, _0, methname, _1, _2, argvalue):

def methkw_buildname​(self, call, _0, argname, _1, argvalue):

def methkw_builddict​(self, call, _0, _1, argvalue):

def methkw_finish​(self, call, _0):

def expr_getitem​(self, expr, _0, key, _1):

def expr_getslice12​(self, expr, _0, index1, _1, index2, _2):

def expr_getslice1​(self, expr, _0, index1, _1, _2):

def expr_getslice2​(self, expr, _0, _1, index2, _2):

def expr_neg​(self, _0, expr):

def expr_mul​(self, obj1, _0, obj2):

def expr_floordiv​(self, obj1, _0, obj2):

def expr_truediv​(self, obj1, _0, obj2):

def expr_mod​(self, obj1, _0, obj2):

def expr_add​(self, obj1, _0, obj2):

def expr_sub​(self, obj1, _0, obj2):

def expr_eq​(self, obj1, _0, obj2):

def expr_ne​(self, obj1, _0, obj2):

def expr_lt​(self, obj1, _0, obj2):

def expr_le​(self, obj1, _0, obj2):

def expr_gt​(self, obj1, _0, obj2):

def expr_ge​(self, obj1, _0, obj2):

def expr_contains​(self, obj, _0, container):

def expr_notcontains​(self, obj, _0, _1, container):

def expr_not​(self, _0, expr):

def expr_and​(self, obj1, _0, obj2):

def expr_or​(self, obj1, _0, obj2):

def expr_dropprecedence​(self, expr):

class ForParser​(ExprParser):

def for0​(self, iter, _0, cont):

def for1​(self, _0, iter, _1, _2, _3, cont):

def for2a​(self, _0, iter1, _1, iter2, _2, _3, cont):

def for2b​(self, _0, iter1, _1, iter2, _2, _3, _4, cont):

def for3a​(self, _0, iter1, _1, iter2, _2, iter3, _3, _4, cont):

def for3b​(self, _0, iter1, _1, iter2, _2, iter3, _3, _4, _5, cont):

class StmtParser​(ExprParser):

def stmt_assign​(self, name, _0, value):

def stmt_iadd​(self, name, _0, value):

def stmt_isub​(self, name, _0, value):

def stmt_imul​(self, name, _0, value):

def stmt_itruediv​(self, name, _0, value):

def stmt_ifloordiv​(self, name, _0, value):

def stmt_imod​(self, name, _0, value):

def stmt_del​(self, _0, name):

class RenderParser​(ExprParser):

def emptyrender​(self, template, _0, _1):

def startrender​(self, template, _0, argname, _1, argvalue):

def startrenderupdate​(self, template, _0, _1, arg):

def buildrender​(self, render, _0, argname, _1, argvalue):

def buildrenderupdate​(self, render, _0, _1, arg):

def finishrender​(self, render, _0):

def finishrender1​(self, render, _0, _1):

def _repr​(obj):

Helper for the repr function.

def _json​(obj):

Helper for the json function.

def _oct​(value):

Helper for the oct function.

def _csv​(obj):

Helper for the csv function.

def _type​(obj):

Helper for the type function.

def _mimeformat​(obj):

Helper for the mimeformat method.

def _yearday​(obj):

Helper for the yearday method.

def _isoformat​(obj):

Helper for the isoformat method.