libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

Parser Class Reference

Parser Class Reference

Public Member Functions

def __init__
def parse

Detailed Description

Parse a template into a parse-tree.

Includes a syntax-check, an optional expression-check and verbose
error-messages.

See documentation for a description of the parse-tree.

Definition at line 432 of file pyratemp.py.


Constructor & Destructor Documentation

def __init__ (   self,
  loadfunc = None,
  testexpr = None,
  escape = HTML 
)
Init the parser.

:Parameters:
    - `loadfunc`: function to load included templates
      (i.e. ``LoaderFile(...).load``)
    - `testexpr`: function to test if a template-expressions is valid
      (i.e. ``EvalPseudoSandbox().compile``)
    - `escape`:   default-escaping (may be modified by the template)
:Exceptions:
    - `ValueError`: if `testexpr` or `escape` is invalid.

Definition at line 510 of file pyratemp.py.


Member Function Documentation

def parse (   self,
  template 
)
Parse a template.

:Parameters:
    - `template`: template-unicode-string
:Returns:         the resulting parse-tree
:Exceptions:
    - `TemplateSyntaxError`: for template-syntax-errors
    - `TemplateIncludeError`: if template-inclusion failed
    - `TemplateException`

Definition at line 541 of file pyratemp.py.