예제 #1
0
파일: highlight.py 프로젝트: hihihippp/kaa
    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
예제 #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)
예제 #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)
예제 #4
0
 def re_start(self):
     return (
         r'\b({})\b'.format('|'.join(doc_re.escape(k)
                                     for k in self._tokens))
     )
예제 #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)
예제 #6
0
 def re_start(self):
     return (r'\b({})\b'.format('|'.join(
         doc_re.escape(k) for k in self._tokens)))
예제 #7
0
파일: editorcommand.py 프로젝트: smorin/kaa
 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)