aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-06-26 23:20:37 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-06-26 23:20:37 +0200
commitbda12e168733451328e39aceb6b2625f6b28e29c (patch)
tree710e7d304e80ac329c3ea97ab3ff11785f55e644
parenteb1fcdf5d1058f4fbdf3a2661573dd7e4d3976f3 (diff)
downloadterex-bda12e168733451328e39aceb6b2625f6b28e29c.tar.gz
added new project README
The original hsrex README has been re-added as README.old.
-rw-r--r--README.md41
-rw-r--r--README.old (renamed from README)16
2 files changed, 49 insertions, 8 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f3b39ab
--- /dev/null
+++ b/README.md
@@ -0,0 +1,41 @@
+# TECO Regular Expression Engine
+
+This is a regular expression engine, derived from the standalone
+[hsrex](https://github.com/garyhouston/hsrex) library, which
+is based on Henry Spencer's implementation of advanced regular expressions
+(ARE) in the Tcl language.
+This library therefore also provides AREs
+(see [re_syntax](https://www.tcl-lang.org/man/tcl/TclCmd/re_syntax.html)).
+In contrast to [PCRE](https://www.pcre.org/) terex' stack
+use cannot grow arbitrarily and it has polynomial worst-case runtime.
+terex is the regular expression engine used by the [SciTECO](https://sciteco.fmsbw.de)
+editor and motivated by its needs.
+It is still kept as a standalone library and may be useful to other projects as well.
+
+Compared to hsrex, this library has the following changes:
+
+* Native UTF-8 support - no need to convert UTF-8 to UTF-32 first.
+ You no longer need to compile a special version of the library.
+ It expects Unicode strings by default unless specifying the `REG_RAW`
+ compilation and execution flag.
+
+## TODO
+
+* Hook into the matching algorithm.
+ Even though runtime cannot be as catastrophically bad as in pure
+ backtracking engines like PCRE, `re_exec()` calls can still be slow
+ on extremely large texts.
+ The hook allows interruptions.
+* Expose enough API to swap out the regular expression lexer.
+ Useful for custom DSLs like glob patterns or TECO patterns.
+* Support splitting the subject string into two halves, so we can
+ preserve the buffer gap when used in SciTECO.
+* Check for useful changes in the Tcl codebase.
+* Check against a proper regular expression test suite.
+
+## Building
+
+ make -f Makefile.linux
+
+There is also an Automake file (Makefile.am) for integration into an existing
+Autotools build system.
diff --git a/README b/README.old
index 981a113..7a823b9 100644
--- a/README
+++ b/README.old
@@ -8,18 +8,18 @@ possible. Some *.h files suffered dirty updates for the same reasons.
To build and test
make
- ./regtest_terex.sh
+ ./regtest_hsrex.sh
To rebuild
make clean
make
To build against the other library uncomment the proper line in the file
-regtest_terex.sh and execute again.
+regtest_hsrex.sh and execute again.
# Either this one
- $CC -I. -I$H/inc -L. -lterex -o $rgbin $rgsrc
+ $CC -I. -I$H/inc -L. -lhsrex -o $rgbin $rgsrc
# or this one
- #$CC -I. -I$H/inc -L. -lteurex -DREGEX_UTF8 -o $rgbin $rgsrc
+ #$CC -I. -I$H/inc -L. -lhswrex -DREGEX_WCHAR -o $rgbin $rgsrc
You would like to test with debuging information. Uncomment the proper line in
the Makefile and rebuild.
@@ -28,14 +28,14 @@ the Makefile and rebuild.
# Or this one
CFLAGS = -DREGEX_STANDALONE -fPIC -D_NDEBUG -O3
-Two libraries are provided, libterex.so and libteurex.so. The first one is for
+Two libraries are provided, libhsrex.so and libhswrex.so. The first one is for
ascii character code and the second one for wide characters. Both libraries
were tested in Linux and Solaris. Compiling and runing in Window$ should be
easy.
The following entry point where defined in each library:
-re_comp() (re_ucomp() for wide char) to compile a RE
-re_exec() (re_uexec() for wide char) to parse data against a compiled RE.
+re_comp() (re_wcomp() for wide char) to compile a RE
+re_exec() (re_wexec() for wide char) to parse data against a compiled RE.
regfree() To dispose the memory of a compiled RE.
regerror() Translates error codes to ascii strings.
@@ -43,7 +43,7 @@ It is pretty easy to add support for a regcomp() regexec() front end. That
front end functions should take care of UTF-8 to wide charater conversion, for
instance.
-The regression test script regtest_terex.sh contains an example of how to use
+The regression test script regtest_hsrex.sh contains an example of how to use
the libraries. It just test cases I was interested on. Adding more use cases to
that script should be easy.