'Parse a mixed list of declarations and at rules, as found eg.
in the body of an @page rule.
Note that to add supported at-rules inside @page,
:class:`~.page3.CSSPage3Parser` extends :meth:`parse_at_rule`,
not this method.
:param tokens:
An iterable of token, typically from the  ``body`` attribute of
an unparsed :class:`AtRule`.
:param context:
An at-keyword such as ``\'@page\'``.
(Most at-rules are only allowed in some contexts.)
:returns:
A tuple of:
* A list of :class:`Declaration`
* A list of parsed at-rules (empty for CSS 2.1)
* A list of :class:`~.parsing.ParseError`'

def parse_declarations_and_at_rules(self, tokens, context):

    at_rules = []
    declarations = []
    errors = []
    tokens = iter(tokens)
    for token in tokens:
        if (token.type == u'ATKEYWORD'):
            try:
                rule = self.read_at_rule(token, tokens)
                result = self.parse_at_rule(rule, at_rules, errors, context)
                at_rules.append(result)
            except ParseError as err:
                errors.append(err)
        elif (token.type != u'S'):
            declaration_tokens = []
            while (token and (token.type != u';')):
                declaration_tokens.append(token)
                token = next(tokens, None)
            if declaration_tokens:
                try:
                    declarations.append(self.parse_declaration(declaration_tokens))
                except ParseError as err:
                    errors.append(err)
    return (declarations, at_rules, errors)
