Example #1
0
    def __init__(self, name, stylename, start, end, escape=None,
                 capture_end=True):

        super().__init__(name, stylename)

        self.start = start
        self.escape = escape
        if escape:
            end = '({}.)|({})'.format(doc_re.escape(escape), end)
        self.end = doc_re.compile(end, doc_re.X + doc_re.M + doc_re.S)
        self._capture_end = capture_end
Example #2
0
    def prepare(self):
        self.register_styles([(self._stylename, "styleid_span")])

        end = self._end
        if self.tokenizer.terminates:
            end = '(?P<TERMINATES>{})|({})'.format(
                self.tokenizer.terminates, end)

        if self._terminate_tokens:
            end = '(?P<TERMINATES2>{})|({})'.format(
                self._terminate_tokens, end)

        if self._escape:
            end = '(?P<ESCAPE>{}.)|({})'.format(
                doc_re.escape(self._escape), end)
        self._re_end = doc_re.compile(end, doc_re.X + doc_re.M + doc_re.S)
Example #3
0
    def prepare(self):
        self.register_styles([(self._stylename, "styleid_span")])

        end = self._end
        if self.tokenizer.terminates:
            end = '(?P<TERMINATES>{})|({})'.format(self.tokenizer.terminates,
                                                   end)

        if self._terminate_tokens:
            end = '(?P<TERMINATES2>{})|({})'.format(self._terminate_tokens,
                                                    end)

        if self._escape:
            end = '(?P<ESCAPE>{}.)|({})'.format(doc_re.escape(self._escape),
                                                end)
        self._re_end = doc_re.compile(end, doc_re.X + doc_re.M + doc_re.S)
Example #4
0
 def re_start(self):
     return (
         r'\b({})\b'.format('|'.join(doc_re.escape(k)
                                     for k in self._tokens))
     )
Example #5
0
 def _is_comment_line(self, wnd, pos):
     reobj = doc_re.compile(r'[ \t]*({})'.format(
         doc_re.escape(wnd.document.mode.LINE_COMMENT)))
     return reobj.match(wnd.document, pos)
Example #6
0
 def re_start(self):
     return (r'\b({})\b'.format('|'.join(
         doc_re.escape(k) for k in self._tokens)))
Example #7
0
 def _is_comment_line(self, wnd, pos):
     reobj = doc_re.compile(r'[ \t]*({})'.format(
         doc_re.escape(wnd.document.mode.LINE_COMMENT)))
     return reobj.match(wnd.document, pos)