Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
jinja2.parser.Parser Class Reference
Inheritance diagram for jinja2.parser.Parser:
Inheritance graph
[legend]

Public Member Functions

None __init__ (self, "Environment" environment, str source, t.Optional[str] name=None, t.Optional[str] filename=None, t.Optional[str] state=None)
 
"te.NoReturn" fail (self, str msg, t.Optional[int] lineno=None, t.Type[TemplateSyntaxError] exc=TemplateSyntaxError)
 
"te.NoReturn" fail_unknown_tag (self, str name, t.Optional[int] lineno=None)
 
"te.NoReturn" fail_eof (self, t.Optional[t.Tuple[str,...]] end_tokens=None, t.Optional[int] lineno=None)
 
bool is_tuple_end (self, t.Optional[t.Tuple[str,...]] extra_end_rules=None)
 
nodes.InternalName free_identifier (self, t.Optional[int] lineno=None)
 
t.Union[nodes.Node, t.List[nodes.Node]] parse_statement (self)
 
t.List[nodes.Nodeparse_statements (self, t.Tuple[str,...] end_tokens, bool drop_needle=False)
 
t.Union[nodes.Assign, nodes.AssignBlockparse_set (self)
 
nodes.For parse_for (self)
 
nodes.If parse_if (self)
 
nodes.With parse_with (self)
 
nodes.Scope parse_autoescape (self)
 
nodes.Block parse_block (self)
 
nodes.Extends parse_extends (self)
 
_ImportInclude parse_import_context (self, _ImportInclude node, bool default)
 
nodes.Include parse_include (self)
 
nodes.Import parse_import (self)
 
nodes.FromImport parse_from (self)
 
None parse_signature (self, _MacroCall node)
 
nodes.CallBlock parse_call_block (self)
 
nodes.FilterBlock parse_filter_block (self)
 
nodes.Macro parse_macro (self)
 
nodes.Output parse_print (self)
 
nodes.Name parse_assign_target (self, bool with_tuple=..., "te.Literal[True]" name_only=...)
 
t.Union[nodes.NSRef, nodes.Name, nodes.Tupleparse_assign_target (self, bool with_tuple=True, bool name_only=False, t.Optional[t.Tuple[str,...]] extra_end_rules=None, bool with_namespace=False)
 
t.Union[nodes.NSRef, nodes.Name, nodes.Tupleparse_assign_target (self, bool with_tuple=True, bool name_only=False, t.Optional[t.Tuple[str,...]] extra_end_rules=None, bool with_namespace=False)
 
nodes.Expr parse_expression (self, bool with_condexpr=True)
 
nodes.Expr parse_condexpr (self)
 
nodes.Expr parse_or (self)
 
nodes.Expr parse_and (self)
 
nodes.Expr parse_not (self)
 
nodes.Expr parse_compare (self)
 
nodes.Expr parse_math1 (self)
 
nodes.Expr parse_concat (self)
 
nodes.Expr parse_math2 (self)
 
nodes.Expr parse_pow (self)
 
nodes.Expr parse_unary (self, bool with_filter=True)
 
nodes.Expr parse_primary (self, bool with_namespace=False)
 
t.Union[nodes.Tuple, nodes.Exprparse_tuple (self, bool simplified=False, bool with_condexpr=True, t.Optional[t.Tuple[str,...]] extra_end_rules=None, bool explicit_parentheses=False, bool with_namespace=False)
 
nodes.List parse_list (self)
 
nodes.Dict parse_dict (self)
 
nodes.Expr parse_postfix (self, nodes.Expr node)
 
nodes.Expr parse_filter_expr (self, nodes.Expr node)
 
t.Union[nodes.Getattr, nodes.Getitemparse_subscript (self, nodes.Expr node)
 
nodes.Expr parse_subscribed (self)
 
t.Tuple[ t.List[nodes.Expr], t.List[nodes.Keyword], t.Optional[nodes.Expr], t.Optional[nodes.Expr],] parse_call_args (self)
 
nodes.Call parse_call (self, nodes.Expr node)
 
t.Optional[nodes.Exprparse_filter (self, t.Optional[nodes.Expr] node, bool start_inline=False)
 
nodes.Expr parse_test (self, nodes.Expr node)
 
t.List[nodes.Nodesubparse (self, t.Optional[t.Tuple[str,...]] end_tokens=None)
 
nodes.Template parse (self)
 

Public Attributes

 environment
 
 stream
 
 name
 
 filename
 
 closed
 

Protected Member Functions

"te.NoReturn" _fail_ut_eof (self, t.Optional[str] name, t.List[t.Tuple[str,...]] end_token_stack, t.Optional[int] lineno)
 

Protected Attributes

 _last_identifier
 
 _end_token_stack
 

Detailed Description

This is the central parsing class Jinja uses.  It's passed to
extensions and can be used to parse expressions or statements.

Member Function Documentation

◆ fail()

"te.NoReturn" jinja2.parser.Parser.fail (   self,
str  msg,
t.Optional[int]   lineno = None,
t.Type[TemplateSyntaxError]   exc = TemplateSyntaxError 
)
Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename.

◆ fail_eof()

"te.NoReturn" jinja2.parser.Parser.fail_eof (   self,
t.Optional[t.Tuple[str, ...]]   end_tokens = None,
t.Optional[int]   lineno = None 
)
Like fail_unknown_tag but for end of template situations.

◆ fail_unknown_tag()

"te.NoReturn" jinja2.parser.Parser.fail_unknown_tag (   self,
str  name,
t.Optional[int]   lineno = None 
)
Called if the parser encounters an unknown tag.  Tries to fail
with a human readable error message that could help to identify
the problem.

◆ free_identifier()

nodes.InternalName jinja2.parser.Parser.free_identifier (   self,
t.Optional[int]   lineno = None 
)
Return a new free identifier as :class:`~jinja2.nodes.InternalName`.

◆ is_tuple_end()

bool jinja2.parser.Parser.is_tuple_end (   self,
t.Optional[t.Tuple[str, ...]]   extra_end_rules = None 
)
Are we at the end of a tuple?

◆ parse()

nodes.Template jinja2.parser.Parser.parse (   self)
Parse the whole template into a `Template` node.

◆ parse_assign_target()

t.Union[nodes.NSRef, nodes.Name, nodes.Tuple] jinja2.parser.Parser.parse_assign_target (   self,
bool   with_tuple = True,
bool   name_only = False,
t.Optional[t.Tuple[str, ...]]   extra_end_rules = None,
bool   with_namespace = False 
)
Parse an assignment target.  As Jinja allows assignments to
tuples, this function can parse all allowed assignment targets.  Per
default assignments to tuples are parsed, that can be disable however
by setting `with_tuple` to `False`.  If only assignments to names are
wanted `name_only` can be set to `True`.  The `extra_end_rules`
parameter is forwarded to the tuple parsing function.  If
`with_namespace` is enabled, a namespace assignment may be parsed.

◆ parse_expression()

nodes.Expr jinja2.parser.Parser.parse_expression (   self,
bool   with_condexpr = True 
)
Parse an expression.  Per default all expressions are parsed, if
the optional `with_condexpr` parameter is set to `False` conditional
expressions are not parsed.

◆ parse_for()

nodes.For jinja2.parser.Parser.parse_for (   self)
Parse a for loop.

◆ parse_if()

nodes.If jinja2.parser.Parser.parse_if (   self)
Parse an if construct.

◆ parse_primary()

nodes.Expr jinja2.parser.Parser.parse_primary (   self,
bool   with_namespace = False 
)
Parse a name or literal value. If ``with_namespace`` is enabled, also
parse namespace attr refs, for use in assignments.

◆ parse_set()

t.Union[nodes.Assign, nodes.AssignBlock] jinja2.parser.Parser.parse_set (   self)
Parse an assign statement.

◆ parse_statement()

t.Union[nodes.Node, t.List[nodes.Node]] jinja2.parser.Parser.parse_statement (   self)
Parse a single statement.

◆ parse_statements()

t.List[nodes.Node] jinja2.parser.Parser.parse_statements (   self,
t.Tuple[str, ...]  end_tokens,
bool   drop_needle = False 
)
Parse multiple statements into a list until one of the end tokens
is reached.  This is used to parse the body of statements as it also
parses template data if appropriate.  The parser checks first if the
current token is a colon and skips it if there is one.  Then it checks
for the block end and parses until if one of the `end_tokens` is
reached.  Per default the active token in the stream at the end of
the call is the matched end token.  If this is not wanted `drop_needle`
can be set to `True` and the end token is removed.

◆ parse_tuple()

t.Union[nodes.Tuple, nodes.Expr] jinja2.parser.Parser.parse_tuple (   self,
bool   simplified = False,
bool   with_condexpr = True,
t.Optional[t.Tuple[str, ...]]   extra_end_rules = None,
bool   explicit_parentheses = False,
bool   with_namespace = False 
)
Works like `parse_expression` but if multiple expressions are
delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
This method could also return a regular expression instead of a tuple
if no commas where found.

The default parsing mode is a full tuple.  If `simplified` is `True`
only names and literals are parsed; ``with_namespace`` allows namespace
attr refs as well. The `no_condexpr` parameter is forwarded to
:meth:`parse_expression`.

Because tuples do not require delimiters and may end in a bogus comma
an extra hint is needed that marks the end of a tuple.  For example
for loops support tuples between `for` and `in`.  In that case the
`extra_end_rules` is set to ``['name:in']``.

`explicit_parentheses` is true if the parsing was triggered by an
expression in parentheses.  This is used to figure out if an empty
tuple is a valid expression or not.

The documentation for this class was generated from the following file: