def _parse(self, tokens, info):
    'Parses the list of input tokens passed by reference and returns\n        an object which contains the compiled representation of the\n        template.\n\n        This is the main parser DFA loop.  See embedded comments for\n        further details.\n        '
    self.grammar.install_factory(self.factory)
    stack = [[0, None]]
    coderet = None
    token = None
    in_string = False
    in_python = False
    status = CONTINUE
    lhs = None
    text = None
    self.line = 0
    self.file = (info and info.name)
    self.inpython = 0
    value = None
    while True:
        stateno = stack[(- 1)][0]
        state = self.states[stateno]
        if ('ACTIONS' in state):
            while ((token is None) and tokens):
                token = tokens.pop(0)
                if isinstance(token, (list, tuple)):
                    (text, self.line, token) = util.unpack(token, 3)
                    if isinstance(token, (list, tuple)):
                        tokens[:0] = (token + [';', ';'])
                        token = None
                    elif (token == 'ITEXT'):
                        if in_python:
                            token = 'TEXT'
                            value = text
                        else:
                            tokens[:0] = self.interpolate_text(text, self.line)
                            token = None
                else:
                    if (token == '"'):
                        in_string = (not in_string)
                    value = ((tokens and tokens.pop(0)) or None)
            if (token is None):
                token = ''
            lookup = state['ACTIONS'].get(token)
            if lookup:
                action = lookup
            else:
                action = state.get('DEFAULT')
        else:
            action = state.get('DEFAULT')
        if (action is None):
            break
        if (action > 0):
            stack.append([action, value])
            token = value = None
        else:
            (lhs, len_, code) = self.rules[(- action)]
            if (not action):
                status = ACCEPT
            if (not code):
                code = (lambda *arg: (((len(arg) >= 2) and arg[1]) or None))
            if (len_ > 0):
                codevars = [x[1] for x in stack[(- len_):]]
            else:
                codevars = []
            try:
                coderet = code(self, *codevars)
            except TemplateException as e:
                self._parse_error(str(e), info.name)
            if (len_ > 0):
                stack[(- len_):] = []
            if (status == ACCEPT):
                return coderet
            elif (status == ABORT):
                return None
            elif (status == ERROR):
                break
            stack.append([self.states[stack[(- 1)][0]].get('GOTOS', {}).get(lhs), coderet])
    if (value is None):
        self._parse_error('unexpected end of input', info.name)
    elif (value == ';'):
        self._parse_error('unexpected end of directive', info.name, text)
    else:
        self._parse_error(('unexpected token (%s)' % util.unscalar_lex(value)), info.name, text)
Parses the list of input tokens passed by reference and returns
an object which contains the compiled representation of the
template.

This is the main parser DFA loop.  See embedded comments for
further details.
def _parse(self, tokens, info):
    'Parses the list of input tokens passed by reference and returns\n        an object which contains the compiled representation of the\n        template.\n\n        This is the main parser DFA loop.  See embedded comments for\n        further details.\n        '
    self.grammar.install_factory(self.factory)
    stack = [[0, None]]
    coderet = None
    token = None
    in_string = False
    in_python = False
    status = CONTINUE
    lhs = None
    text = None
    self.line = 0
    self.file = (info and info.name)
    self.inpython = 0
    value = None
    while True:
        stateno = stack[(- 1)][0]
        state = self.states[stateno]
        if ('ACTIONS' in state):
            while ((token is None) and tokens):
                token = tokens.pop(0)
                if isinstance(token, (list, tuple)):
                    (text, self.line, token) = util.unpack(token, 3)
                    if isinstance(token, (list, tuple)):
                        tokens[:0] = (token + [';', ';'])
                        token = None
                    elif (token == 'ITEXT'):
                        if in_python:
                            token = 'TEXT'
                            value = text
                        else:
                            tokens[:0] = self.interpolate_text(text, self.line)
                            token = None
                else:
                    if (token == '"'):
                        in_string = (not in_string)
                    value = ((tokens and tokens.pop(0)) or None)
            if (token is None):
                token = 
            lookup = state['ACTIONS'].get(token)
            if lookup:
                action = lookup
            else:
                action = state.get('DEFAULT')
        else:
            action = state.get('DEFAULT')
        if (action is None):
            break
        if (action > 0):
            stack.append([action, value])
            token = value = None
        else:
            (lhs, len_, code) = self.rules[(- action)]
            if (not action):
                status = ACCEPT
            if (not code):
                code = (lambda *arg: (((len(arg) >= 2) and arg[1]) or None))
            if (len_ > 0):
                codevars = [x[1] for x in stack[(- len_):]]
            else:
                codevars = []
            try:
                coderet = code(self, *codevars)
            except TemplateException as e:
                self._parse_error(str(e), info.name)
            if (len_ > 0):
                stack[(- len_):] = []
            if (status == ACCEPT):
                return coderet
            elif (status == ABORT):
                return None
            elif (status == ERROR):
                break
            stack.append([self.states[stack[(- 1)][0]].get('GOTOS', {}).get(lhs), coderet])
    if (value is None):
        self._parse_error('unexpected end of input', info.name)
    elif (value == ';'):
        self._parse_error('unexpected end of directive', info.name, text)
    else:
        self._parse_error(('unexpected token (%s)' % util.unscalar_lex(value)), info.name, text)