Public Member Functions | |
def | __init__ (self, loadfunc=None, testexpr=None, escape=HTML) |
def | parse (self, template) |
Public Attributes | |
escape | |
Private Member Functions | |
def | _errpos (self, fpos) |
def | _parse (self, template, fpos=0) |
def | _parse_sub (self, parsetree, text, fpos=0) |
def | _testexpr (self, expr, fpos=0) |
Private Attributes | |
_includestack | |
_load | |
_testexprfunc | |
Static Private Attributes | |
string | _block_end = ")-->" |
string | _block_start = "<!--(" |
string | _comment_end = "!#" |
string | _comment_start = "#!" |
_e = re.escape(_block_end) | |
_reBlock = re.compile(_strBlock, re.X|re.M) | |
_reComment = re.compile(_strComment, re.M) | |
_reForParam = re.compile(_strForParam) | |
_reMacroParam = re.compile() | |
_reSubstitution = re.compile(_strSubstitution, re.X|re.M) | |
_s = re.escape(_block_start) | |
string | _strBlock |
string | _strComment = r"""%s(?P<content>.*?)(?P<end>%s|\n|$)""" \ |
string | _strForParam = r"""^(?P<names>\w+(?:\s*,\s*\w+)*)\s+in\s+(?P<iter>.+)$""" |
string | _strSubstitution |
string | _sub_end = "!$" |
string | _sub_start = "$!" |
string | _subesc_end = "!@" |
string | _subesc_start = "@!" |
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.
def libuavcan_dsdl_compiler.pyratemp.Parser.__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.
|
private |
Convert `fpos` to ``(filename,row,column)`` for error-messages.
Definition at line 555 of file pyratemp.py.
|
private |
Recursive part of `parse()`. :Parameters: - template - fpos: position of ``template`` in the complete template (for error-messages)
Definition at line 599 of file pyratemp.py.
|
private |
Parse substitutions, and append them to the parse-tree. Additionally, remove comments.
Definition at line 567 of file pyratemp.py.
|
private |
Test a template-expression to detect errors.
Definition at line 560 of file pyratemp.py.
def libuavcan_dsdl_compiler.pyratemp.Parser.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.
|
staticprivate |
Definition at line 448 of file pyratemp.py.
|
staticprivate |
Definition at line 447 of file pyratemp.py.
|
staticprivate |
Definition at line 442 of file pyratemp.py.
|
staticprivate |
Definition at line 441 of file pyratemp.py.
|
staticprivate |
Definition at line 480 of file pyratemp.py.
|
private |
Definition at line 539 of file pyratemp.py.
|
private |
Definition at line 523 of file pyratemp.py.
|
staticprivate |
Definition at line 500 of file pyratemp.py.
|
staticprivate |
Definition at line 455 of file pyratemp.py.
|
staticprivate |
Definition at line 504 of file pyratemp.py.
|
staticprivate |
Definition at line 507 of file pyratemp.py.
|
staticprivate |
Definition at line 467 of file pyratemp.py.
|
staticprivate |
Definition at line 479 of file pyratemp.py.
|
staticprivate |
Definition at line 481 of file pyratemp.py.
|
staticprivate |
Definition at line 453 of file pyratemp.py.
|
staticprivate |
Definition at line 503 of file pyratemp.py.
|
staticprivate |
Definition at line 459 of file pyratemp.py.
|
staticprivate |
Definition at line 444 of file pyratemp.py.
|
staticprivate |
Definition at line 443 of file pyratemp.py.
|
staticprivate |
Definition at line 446 of file pyratemp.py.
|
staticprivate |
Definition at line 445 of file pyratemp.py.
|
private |
Definition at line 528 of file pyratemp.py.
libuavcan_dsdl_compiler.pyratemp.Parser.escape |
Definition at line 538 of file pyratemp.py.