# Path: plugins/lib/syntax_paths.py
# _BASE_TMPL = "Packages/{package_name}/Package/{sub_package_name}/{file_name}{ext}"
# PLIST              = _build_path("Property List")
# BUILD_SYSTEM       = _build_path("Sublime Text Build System")
# COLOR_SCHEME       = _build_path("Sublime Text Color Scheme")
# COMMANDS           = _build_path("Sublime Text Commands")
# COMPLETIONS        = _build_path("Sublime Text Completions")
# KEYMAP             = _build_path("Sublime Text Keymap")
# MACROS             = _build_path("Sublime Text Macros")
# MENU               = _build_path("Sublime Text Menu")
# MOUSEMAP           = _build_path("Sublime Text Mousemap")
# SETTINGS           = _build_path("Sublime Text Settings")
# SNIPPET            = _build_path("Sublime Text Snippet")
# SNIPPET_RAW        = _build_path("Sublime Text Snippet", "Sublime Text Snippet (Raw)")
# SYNTAX_DEF         = _build_path("Sublime Text Syntax Definition")
# THEME              = _build_path("Sublime Text Theme")
# TM_PREFERENCES     = _build_path("TextMate Preferences")
# TM_SYNTAX_DEF_JSON = _build_path("TextMate Syntax Definition (JSON)", textmate=True)
# TM_SYNTAX_DEF_YAML = _build_path("TextMate Syntax Definition (YAML)", textmate=True)
# XML = "Packages/XML/XML.tmLanguage"
# def _build_path(sub_package_name, file_name=None, textmate=False):


import re
import sublime
import sublime_plugin
from sublime_lib.flags import RegionOption
from ..lib import syntax_paths
            )
            for region in self.view.split_by_newlines(selection)
        ]

        for loc in locations:
            # Find the line number.
            match = re.search(r'(\d+):', self.view.substr(self.view.line(loc)))
            if not match:
                continue
            n = int(match.group(1))

            # Find the associated regexp. Assume it's the preceding one.
            try:
                regexp_region = [
                    region
                    for region in self.view.find_by_selector('source.regexp.oniguruma')
                    if region.end() < loc
                ][-1]
            except IndexError:
                continue

            if n == 0:
                yield regexp_region
                continue

            # Find parens that define capture groups.
            regexp_offset = regexp_region.begin()
            parens = iter(
                (match.group(), match.start() + regexp_offset)
                for match in re.finditer(r'\(\??|\)', self.view.substr(regexp_region))

# Path: plugins/lib/syntax_paths.py
# _BASE_TMPL = "Packages/{package_name}/Package/{sub_package_name}/{file_name}{ext}"
# PLIST              = _build_path("Property List")
# BUILD_SYSTEM       = _build_path("Sublime Text Build System")
# COLOR_SCHEME       = _build_path("Sublime Text Color Scheme")
# COMMANDS           = _build_path("Sublime Text Commands")
# COMPLETIONS        = _build_path("Sublime Text Completions")
# KEYMAP             = _build_path("Sublime Text Keymap")
# MACROS             = _build_path("Sublime Text Macros")
# MENU               = _build_path("Sublime Text Menu")
# MOUSEMAP           = _build_path("Sublime Text Mousemap")
# SETTINGS           = _build_path("Sublime Text Settings")
# SNIPPET            = _build_path("Sublime Text Snippet")
# SNIPPET_RAW        = _build_path("Sublime Text Snippet", "Sublime Text Snippet (Raw)")
# SYNTAX_DEF         = _build_path("Sublime Text Syntax Definition")
# THEME              = _build_path("Sublime Text Theme")
# TM_PREFERENCES     = _build_path("TextMate Preferences")
# TM_SYNTAX_DEF_JSON = _build_path("TextMate Syntax Definition (JSON)", textmate=True)
# TM_SYNTAX_DEF_YAML = _build_path("TextMate Syntax Definition (YAML)", textmate=True)
# XML = "Packages/XML/XML.tmLanguage"
# def _build_path(sub_package_name, file_name=None, textmate=False):


# Path: plugins/syntax_dev/highlighter.py
import re
import sublime
import sublime_plugin
from sublime_lib.flags import RegionOption
from ..lib import syntax_paths

            )
            for region in self.view.split_by_newlines(selection)
        ]

        for loc in locations:
            # Find the line number.
            match = re.search(r'(\d+):', self.view.substr(self.view.line(loc)))
            if not match:
                continue
            n = int(match.group(1))

            # Find the associated regexp. Assume it's the preceding one.
            try:
                regexp_region = [
                    region
                    for region in self.view.find_by_selector('source.regexp.oniguruma')
                    if region.end() < loc
                ][-1]
            except IndexError:
                continue

            if n == 0:
                yield regexp_region
                continue

            # Find parens that define capture groups.
            regexp_offset = regexp_region.begin()
            parens = iter(
                (match.group(), match.start() + regexp_offset)
                for match in re.finditer(r'\(\??|\)', self.view.substr(regexp_region))

                if self.view.match_selector(