2020-04-27 20:03:11 +00:00
|
|
|
"""
|
|
|
|
Utilities for Regexp in VTE
|
|
|
|
"""
|
|
|
|
|
|
|
|
import gi
|
|
|
|
gi.require_version('Vte', '2.91') # vte-0.38 (gnome-3.14)
|
|
|
|
from gi.repository import GLib, Vte
|
|
|
|
|
2020-05-24 18:17:33 +00:00
|
|
|
# constants for vte regex matching are documented in the pcre2 api:
|
|
|
|
# https://www.pcre.org/current/doc/html/pcre2api.html
|
|
|
|
# the corresponding bits are defined here:
|
|
|
|
# https://vcs.pcre.org/pcre2/code/trunk/src/pcre2.h.in?view=markup
|
2020-04-27 20:03:11 +00:00
|
|
|
PCRE2_MULTILINE = 0x00000400
|
|
|
|
FLAGS_GLIB = (GLib.RegexCompileFlags.OPTIMIZE | GLib.RegexCompileFlags.MULTILINE)
|
|
|
|
if hasattr(Vte, 'REGEX_FLAGS_DEFAULT'):
|
|
|
|
FLAGS_PCRE2 = (Vte.REGEX_FLAGS_DEFAULT | PCRE2_MULTILINE)
|
|
|
|
else:
|
|
|
|
FLAGS_PCRE2 = None
|