From 7607456620fe72051607621df6a1c320f718c2bb Mon Sep 17 00:00:00 2001 From: Kate F Date: Sat, 17 Aug 2024 10:32:24 +0100 Subject: [PATCH 1/3] -Fb for consistency wrt -Fi. --- src/re/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/re/main.c b/src/re/main.c index 53abe2d52..78bc77a2f 100644 --- a/src/re/main.c +++ b/src/re/main.c @@ -465,6 +465,10 @@ parse_flags(const char *arg, enum re_flags *flags) { for (; *arg; arg++) { switch (*arg) { + case 'b': + *flags = *flags | RE_ANCHORED; + break; + case 'i': *flags = *flags | RE_ICASE; break; From a925708bdc0df11c3433d25fd325e7a87fedffa9 Mon Sep 17 00:00:00 2001 From: Kate F Date: Sat, 17 Aug 2024 10:33:44 +0100 Subject: [PATCH 2/3] Documentation for -F flags and -k io api. --- man/lx.1/lx.1.xml | 13 +++++++++ man/re.1/re.1.xml | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/man/lx.1/lx.1.xml b/man/lx.1/lx.1.xml index 19423e67b..b9af035c1 100644 --- a/man/lx.1/lx.1.xml +++ b/man/lx.1/lx.1.xml @@ -18,12 +18,14 @@ tokbuf"> getc"> + io"> -n"> -Q"> -X"> -b &api_tokbuf.arg;"> -g &api_getc.arg;"> + -k &api_io.arg;"> -l &lang.arg;"> -e &prefix.arg;"> -t &prefix.arg;"> @@ -62,6 +64,7 @@ &X.opt; &b.opt; &g.opt; + &k.opt; &l.opt; &e.opt; &t.opt; @@ -223,6 +226,16 @@ Dot output is not subject to checks for semantic errors + + &k.opt; + + + Set the IO &api; for output, + per the io option for &fsm_print.3;. + The default is getc. + + + &e.opt; diff --git a/man/re.1/re.1.xml b/man/re.1/re.1.xml index ef2112500..1e01795f9 100644 --- a/man/re.1/re.1.xml +++ b/man/re.1/re.1.xml @@ -13,8 +13,10 @@ stdout"> + io"> re"> file"> + flags"> dialect"> prefix"> length"> @@ -33,7 +35,9 @@ -X"> -e &prefix.arg;"> -E &prefix.arg;"> + -F &flags.arg;"> -G &length.arg;"> + -k &io.arg;"> -a"> -d"> @@ -97,6 +101,7 @@ query &a.opt; &c.opt; + &k.opt; &w.opt; &X.opt; &e.opt; @@ -299,6 +304,60 @@ group (for dialects which have them) (rather than a "whole" regexp) + + &F.opt; + + + Set RE_* flags per &re.3;. + Note not all enum re_flags constants are meaningful + to expose to the &cli;. + The default is no flags set. + The available flags are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagValueMeaning
b (&b.opt;)RE_ANCHOREDAnchor patterns at both start and end, + as if by ^ and $ + (\Z for PCRE).
i (&i.opt;)RE_ICASEPatterns are case insensitive.
sRE_SINGLESingle-line mode. + Equivalent to PCRE_DOTALL.
xRE_EXTENDED + Eextended mode. + Equivalent to PCRE_EXTENDED.
+
+
+ &G.opt; @@ -307,6 +366,16 @@ group (for dialects which have them) (rather than a "whole" regexp) + + &k.opt; + + + Set the IO &api; for output, + per the io option for &fsm_print.3;. + The default is getc. + + + &q.opt; From c26c5fd649c821fcbd81bd077b46acdb71b01e80 Mon Sep 17 00:00:00 2001 From: Kate F Date: Sat, 17 Aug 2024 11:28:48 +0100 Subject: [PATCH 3/3] A little more progress on invocation. --- man/re.1/re.1.xml | 49 +++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/man/re.1/re.1.xml b/man/re.1/re.1.xml index 1e01795f9..ad5254348 100644 --- a/man/re.1/re.1.xml +++ b/man/re.1/re.1.xml @@ -53,7 +53,6 @@ -x"> -h"> - -v"> ]> @@ -174,9 +173,6 @@ query &h.opt; - @@ -189,6 +185,8 @@ query which are “executed” to match against input strings, or used to provide example strings which would match when given as input. + This tool provides an interface to the &re.3; &api;. + The &re.1; tool constructs a Finite State Machine from Regular Expression syntax. - -XXX: when executing, -strings are single or multiple with --. -can't we feed a string to stdin, too? -XXX: now with -x instead: Unlike &grep.1;, strings are matched from -command line arguments rather than &stdin.lit;. -TODO: with no strings to match, will just validate fsm instead. -validate is the wrong word - - + When executing, text to match is given either as strings + from command line arguments, or is given as filenames with &x.opt;. + Multiple arguments may be given using --. + Unlike &grep.1;, &re.1; does not read text from &stdin.lit;. + + With no text to match, &re.1; will just validate + + the pattern syntax instead. + + @@ -536,17 +538,6 @@ group (for dialects which have them) (rather than a "whole" regexp) - - &h.opt;