# Path: tinycsscheme/tinycss/css21.py
# class Stylesheet(object):
# class AtRule(object):
# class RuleSet(object):
# class Declaration(object):
# class PageRule(object):
# class MediaRule(object):
# class ImportRule(object):
# class CSS21Parser(object):
#     def __init__(self, rules, errors, encoding):
#     def __repr__(self):
#     def __init__(self, at_keyword, head, body, line, column):
#     def __repr__(self):
#     def __init__(self, selector, declarations, line, column):
#     def __repr__(self):
#     def __init__(self, name, value, priority, line, column):
#     def __repr__(self):
#     def __init__(self, selector, specificity, declarations, at_rules,
#                  line, column):
#     def __repr__(self):
#     def __init__(self, media, rules, line, column):
#     def __repr__(self):
#     def __init__(self, uri, media, line, column):
#     def __repr__(self):
# def _remove_at_charset(tokens):
#     def parse_stylesheet_file(self, css_file, protocol_encoding=None,
#                              linking_encoding=None, document_encoding=None):
#     def parse_stylesheet_bytes(self, css_bytes, protocol_encoding=None,
#                                linking_encoding=None, document_encoding=None):
#     def parse_stylesheet(self, css_unicode, encoding=None):
#     def parse_style_attr(self, css_source):
#     def parse_rules(self, tokens, context):
#     def read_at_rule(self, at_keyword_token, tokens):
#     def parse_at_rule(self, rule, previous_rules, errors, context):
#     def parse_media(self, tokens):
#     def parse_page_selector(self, tokens):
#     def parse_declarations_and_at_rules(self, tokens, context):
#     def parse_ruleset(self, first_token, tokens):
#     def parse_declaration_list(self, tokens):
#     def parse_declaration(self, tokens):
#     def parse_value_priority(self, tokens):


import re
from itertools import chain
from .tinycss.css21 import (ParseError, Declaration, RuleSet, CSS21Parser,
                            strip_whitespace, validate_any)
    """Any parsed rule with a single STRING head (e.g. @comment).

    .. attribute:: at_keyword

        The at-keyword for this rule.

    .. attribute:: value

        The value for this rule (a Token).
    """
    at_keyword = ''

    def __init__(self, keyword, value, line, column):
        self.at_keyword = keyword
        self.value      = value
        self.line       = line
        self.column     = column

    def __repr__(self):
        return ('<{0.__class__.__name__} {0.at_keyword} {0.line}:{0.column} '
                '{0.value}>'.format(self))


class CSSchemeParser(CSS21Parser):
    """Documentation to be here.
    """

    def _check_at_rule_occurences(self, rule, previous_rules):
        for previous_rule in previous_rules:
            if previous_rule.at_keyword == rule.at_keyword:

# Path: tinycsscheme/tinycss/css21.py
# class Stylesheet(object):
# class AtRule(object):
# class RuleSet(object):
# class Declaration(object):
# class PageRule(object):
# class MediaRule(object):
# class ImportRule(object):
# class CSS21Parser(object):
#     def __init__(self, rules, errors, encoding):
#     def __repr__(self):
#     def __init__(self, at_keyword, head, body, line, column):
#     def __repr__(self):
#     def __init__(self, selector, declarations, line, column):
#     def __repr__(self):
#     def __init__(self, name, value, priority, line, column):
#     def __repr__(self):
#     def __init__(self, selector, specificity, declarations, at_rules,
#                  line, column):
#     def __repr__(self):
#     def __init__(self, media, rules, line, column):
#     def __repr__(self):
#     def __init__(self, uri, media, line, column):
#     def __repr__(self):
# def _remove_at_charset(tokens):
#     def parse_stylesheet_file(self, css_file, protocol_encoding=None,
#                              linking_encoding=None, document_encoding=None):
#     def parse_stylesheet_bytes(self, css_bytes, protocol_encoding=None,
#                                linking_encoding=None, document_encoding=None):
#     def parse_stylesheet(self, css_unicode, encoding=None):
#     def parse_style_attr(self, css_source):
#     def parse_rules(self, tokens, context):
#     def read_at_rule(self, at_keyword_token, tokens):
#     def parse_at_rule(self, rule, previous_rules, errors, context):
#     def parse_media(self, tokens):
#     def parse_page_selector(self, tokens):
#     def parse_declarations_and_at_rules(self, tokens, context):
#     def parse_ruleset(self, first_token, tokens):
#     def parse_declaration_list(self, tokens):
#     def parse_declaration(self, tokens):
#     def parse_value_priority(self, tokens):


# Path: tinycsscheme/parser.py
import re
from itertools import chain
from .tinycss.css21 import (ParseError, Declaration, RuleSet, CSS21Parser,
                            strip_whitespace, validate_any)

    """Any parsed rule with a single STRING head (e.g. @comment).

    .. attribute:: at_keyword

        The at-keyword for this rule.

    .. attribute:: value

        The value for this rule (a Token).
    """
    at_keyword = ''

    def __init__(self, keyword, value, line, column):
        self.at_keyword = keyword
        self.value      = value
        self.line       = line
        self.column     = column

    def __repr__(self):
        return ('<{0.__class__.__name__} {0.at_keyword} {0.line}:{0.column} '
                '{0.value}>'.format(self))


class CSSchemeParser(CSS21Parser):
    """Documentation to be here.
    """

    def _check_at_rule_occurences(self, rule, previous_rules):
        for previous_rule in previous_rules:
            if previous_rule.at_keyword == rule.at_keyword:

                raise ParseError(rule,