示例#1
0
    def parse(self, parser: Any) -> Node:
        lineno = next(parser.stream).lineno
        args: List[Any] = [parser.parse_expression()]

        return ExprStmt(
            self.call_method("_function_tag_handler", args, lineno=lineno),
            lineno=lineno,
        )
示例#2
0
    def parse(self, parser: Any) -> Node:
        lineno = next(parser.stream).lineno

        args = [DerivedContextReference(), parser.parse_expression()]

        handler = self.call_method("_function_tag_handler",
                                   args,
                                   lineno=lineno)
        return ExprStmt(handler, lineno=lineno)
示例#3
0
def noop_node(lineno):
    """
    Return a no-op node (compiled into a single `0`).

    :param lineno: Line number for the node
    :type lineno: int
    :return: Node
    :rtype: jinja2.nodes.ExprStmt
    """
    return ExprStmt(Const(0)).set_lineno(lineno)