# Path: lib/soupsieve/util.py
# class SelectorSyntaxError(SyntaxError):
#     """Syntax error in a CSS selector."""
# 
#     def __init__(self, msg, pattern=None, index=None):
#         """Initialize."""
# 
#         self.line = None
#         self.col = None
#         self.context = None
# 
#         if pattern is not None and index is not None:
#             # Format pattern to show line and column position
#             self.context, self.line, self.col = get_pattern_context(pattern, index)
#             msg = '{}\n  line {}:\n{}'.format(msg, self.line, self.context)
# 
#         super(SelectorSyntaxError, self).__init__(msg)


import re
from . import util
from . import css_match as cm
from . import css_types as ct
from collections import OrderedDict
from .util import SelectorSyntaxError
    ':host',
    ':host-context'
}

# Complex pseudo classes that take very specific parameters and are handled special
PSEUDO_SPECIAL = {
    ':dir',
    ':lang',
    ':nth-child',
    ':nth-last-child',
    ':nth-last-of-type',
    ':nth-of-type'
}

PSEUDO_SUPPORTED = PSEUDO_SIMPLE | PSEUDO_SIMPLE_NO_MATCH | PSEUDO_COMPLEX | PSEUDO_COMPLEX_NO_MATCH | PSEUDO_SPECIAL

# Sub-patterns parts
# Whitespace
NEWLINE = r'(?:\r\n|(?!\r\n)[\n\f\r])'
WS = r'(?:[ \t]|{})'.format(NEWLINE)
# Comments
COMMENTS = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
# Whitespace with comments included
WSC = r'(?:{ws}|{comments})'.format(ws=WS, comments=COMMENTS)
# CSS escapes
CSS_ESCAPES = r'(?:\\(?:[a-f0-9]{{1,6}}{ws}?|[^\r\n\f]|$))'.format(ws=WS)
CSS_STRING_ESCAPES = r'(?:\\(?:[a-f0-9]{{1,6}}{ws}?|[^\r\n\f]|$|{nl}))'.format(ws=WS, nl=NEWLINE)
# CSS Identifier
IDENTIFIER = r'''
(?:(?:-?(?:[^\x00-\x2f\x30-\x40\x5B-\x5E\x60\x7B-\x9f]|{esc})+|--)

# Path: lib/soupsieve/util.py
# class SelectorSyntaxError(SyntaxError):
#     """Syntax error in a CSS selector."""
# 
#     def __init__(self, msg, pattern=None, index=None):
#         """Initialize."""
# 
#         self.line = None
#         self.col = None
#         self.context = None
# 
#         if pattern is not None and index is not None:
#             # Format pattern to show line and column position
#             self.context, self.line, self.col = get_pattern_context(pattern, index)
#             msg = '{}\n  line {}:\n{}'.format(msg, self.line, self.context)
# 
#         super(SelectorSyntaxError, self).__init__(msg)


# Path: lib/soupsieve/css_parser.py
import re
from . import util
from . import css_match as cm
from . import css_types as ct
from collections import OrderedDict
from .util import SelectorSyntaxError

    ':host',
    ':host-context'
}

# Complex pseudo classes that take very specific parameters and are handled special
PSEUDO_SPECIAL = {
    ':dir',
    ':lang',
    ':nth-child',
    ':nth-last-child',
    ':nth-last-of-type',
    ':nth-of-type'
}

PSEUDO_SUPPORTED = PSEUDO_SIMPLE | PSEUDO_SIMPLE_NO_MATCH | PSEUDO_COMPLEX | PSEUDO_COMPLEX_NO_MATCH | PSEUDO_SPECIAL

# Sub-patterns parts
# Whitespace
NEWLINE = r'(?:\r\n|(?!\r\n)[\n\f\r])'
WS = r'(?:[ \t]|{})'.format(NEWLINE)
# Comments
COMMENTS = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
# Whitespace with comments included
WSC = r'(?:{ws}|{comments})'.format(ws=WS, comments=COMMENTS)
# CSS escapes
CSS_ESCAPES = r'(?:\\(?:[a-f0-9]{{1,6}}{ws}?|[^\r\n\f]|$))'.format(ws=WS)
CSS_STRING_ESCAPES = r'(?:\\(?:[a-f0-9]{{1,6}}{ws}?|[^\r\n\f]|$|{nl}))'.format(ws=WS, nl=NEWLINE)
# CSS Identifier
IDENTIFIER = r'''
(?:(?:-?(?:[^\x00-\x2f\x30-\x40\x5B-\x5E\x60\x7B-\x9f]|{esc})+|--)

(?:[^\x00-\x2c\x2e\x2f\x3A-\x40\x5B-\x5E\x60\x7B-\x9f]|{esc})*)