From ab0d97147d8c19eabc41b11698dff13cd04d67ae Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 14 Sep 2024 19:00:01 +0200 Subject: imported Henry Spencer's regex implementation from Tcl Source: github.com/garyhouston/hsrex * This version should be a Thompson NFA, using backtracking only for backreferences, so it should be much safer than PCRE (GRegex). Search times should be linear and there should be no way to cause stack overflows (unless we would generate backreferences). * Importing the lib makes sure we don't add another compile-time dependency. Also, we could implement our own regcomp() which translates directly from TECO patterns. * This is still WIP and currently only works with the ASCII version. The widechar version does not define re_comp() and re_exec(). * Apparently we can't have an ASCII and widechar version at the same time, so we must build two libtool libraries and somehow mangle the names. * Ideally the widechar version will also work with UTF-8 strings. * An alternative might be to import the Gnulib regex module. How does it choose the encoding anyway? * Or we could just use Oniguruma - but this would have to be a new external library dependency. --- contrib/hsrex/Makefile.am | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 contrib/hsrex/Makefile.am (limited to 'contrib/hsrex/Makefile.am') diff --git a/contrib/hsrex/Makefile.am b/contrib/hsrex/Makefile.am new file mode 100644 index 0000000..11b979a --- /dev/null +++ b/contrib/hsrex/Makefile.am @@ -0,0 +1,10 @@ +# FIXME: We probably need both ASCII and widechar versions +# as separate libraries. +AM_CPPFLAGS = -DREGEX_STANDALONE +# -DREGEX_WCHAR + +noinst_LTLIBRARIES = libhswrex.la +libhswrex_la_SOURCES = regcomp.c regexec.c regerror.c regfree.c regalone.c \ + regalone.h regcustom.h regerrs.h regex.h regguts.h +# included from regcomp.c and regexec.c +EXTRA_libhswrex_la_SOURCES = regc_color.c regc_cvec.c regc_lex.c regc_locale.c regc_nfa.c -- cgit v1.2.3