# 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
            if self.quirks:
                print('## QUIRKS MODE: Throwing out the spec!')
            print('## PARSING: {!r}'.format(pattern))
        while index <= end:
            m = None
            for k, v in self.css_tokens.items():
                if not v.enabled(self.flags):  # pragma: no cover
                    continue
                m = v.pattern.match(pattern, index)
                if m:
                    if self.debug:  # pragma: no cover
                        print("TOKEN: '{}' --> {!r} at position {}".format(k, m.group(0), m.start(0)))
                    index = m.end(0)
                    yield k, m
                    break
            if m is None:
                c = pattern[index]
                # If the character represents the start of one of the known selector types,
                # throw an exception mentioning that the known selector type is in error;
                # otherwise, report the invalid character.
                if c == '[':
                    msg = "Malformed attribute selector at position {}".format(index)
                elif c == '.':
                    msg = "Malformed class selector at position {}".format(index)
                elif c == '#':
                    msg = "Malformed id selector at position {}".format(index)
                elif c == ':':
                    msg = "Malformed pseudo-class selector at position {}".format(index)
                else:
                    msg = "Invalid character {!r} position {}".format(c, index)

# 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

            if self.quirks:
                print('## QUIRKS MODE: Throwing out the spec!')
            print('## PARSING: {!r}'.format(pattern))
        while index <= end:
            m = None
            for k, v in self.css_tokens.items():
                if not v.enabled(self.flags):  # pragma: no cover
                    continue
                m = v.pattern.match(pattern, index)
                if m:
                    if self.debug:  # pragma: no cover
                        print("TOKEN: '{}' --> {!r} at position {}".format(k, m.group(0), m.start(0)))
                    index = m.end(0)
                    yield k, m
                    break
            if m is None:
                c = pattern[index]
                # If the character represents the start of one of the known selector types,
                # throw an exception mentioning that the known selector type is in error;
                # otherwise, report the invalid character.
                if c == '[':
                    msg = "Malformed attribute selector at position {}".format(index)
                elif c == '.':
                    msg = "Malformed class selector at position {}".format(index)
                elif c == '#':
                    msg = "Malformed id selector at position {}".format(index)
                elif c == ':':
                    msg = "Malformed pseudo-class selector at position {}".format(index)
                else:
                    msg = "Invalid character {!r} position {}".format(c, index)

                raise SelectorSyntaxError(msg, self.pattern, index)