class NodeVisitor:
Known subclasses: jinja2.compiler.CodeGenerator
, jinja2.compiler.DependencyFinderVisitor
, jinja2.compiler.UndeclaredNameVisitor
, jinja2.idtracking.FrameSymbolVisitor
, jinja2.idtracking.RootVisitor
, jinja2.visitor.NodeTransformer
Walks the abstract syntax tree and call visitor functions for every
node found. The visitor functions may return values which will be
forwarded by the visit
method.
Per default the visitor functions for the nodes are 'visit_' +
class name of the node. So a TryFinally
node visit function would
be visit_TryFinally
. This behavior can be changed by overriding
the get_visitor
function. If no visitor function exists for a node
(return value None
) the generic_visit
visitor is used instead.
Method | generic​_visit |
Called if no explicit visitor function exists for a node. |
Method | get​_visitor |
Return the visitor function for this node or None if no visitor exists for this node. In that case the generic visit function is used instead. |
Method | visit |
Visit a node. |
jinja2.idtracking.RootVisitor
, jinja2.visitor.NodeTransformer
Parameters | |
node:Node | Undocumented |
*args:t.Any | Undocumented |
**kwargs:t.Any | Undocumented |
Returns | |
t.Any | Undocumented |
None
if no visitor
exists for this node. In that case the generic visit function is
used instead.Parameters | |
node:Node | Undocumented |
Returns | |
t.Optional[ | Undocumented |
Parameters | |
node:Node | Undocumented |
*args:t.Any | Undocumented |
**kwargs:t.Any | Undocumented |
Returns | |
t.Any | Undocumented |