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
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)
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)
def re_start(self): return ( r'\b({})\b'.format('|'.join(doc_re.escape(k) for k in self._tokens)) )
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)
def re_start(self): return (r'\b({})\b'.format('|'.join( doc_re.escape(k) for k in self._tokens)))