(self)
Parse a single statement.
Parse a single statement.
Parse a single statement .
def parse_statement(self):
        """Parse a single statement."""
        token = self.stream.current
        if token.type != 'name':
            self.fail('tag name expected', token.lineno)
        self._tag_stack.append(token.value)
        pop_tag = True
        try:
            if token.value in _statement_keywords:
                return getattr(self, 'parse_' + self.stream.current.value)()
            if token.value == 'call':
                return self.parse_call_block()
            if token.value == 'filter':
                return self.parse_filter_block()
            ext = self.extensions.get(token.value)
            if ext is not None:
                return ext(self)

            # did not work out, remove the token we pushed by accident
            # from the stack so that the unknown tag fail function can
            # produce a proper error message.
            self._tag_stack.pop()
            pop_tag = False
            self.fail_unknown_tag(token.value, token.lineno)
        finally:
            if pop_tag:
                self._tag_stack.pop()
def parse_statement ( self ) : token = self . stream . current if token . type != 'name' : self . fail ( 'tag name expected' , token . lineno ) self . _tag_stack . append ( token . value ) pop_tag = True try : if token . value in _statement_keywords : return getattr ( self , 'parse_' + self . stream . current . value ) ( ) if token . value == 'call' : return self . parse_call_block ( ) if token . value == 'filter' : return self . parse_filter_block ( ) ext = self . extensions . get ( token . value ) if ext is not None : return ext ( self ) # did not work out, remove the token we pushed by accident # from the stack so that the unknown tag fail function can # produce a proper error message. self . _tag_stack . pop ( ) pop_tag = False self . fail_unknown_tag ( token . value , token . lineno ) finally : if pop_tag : self . _tag_stack . pop ( )