aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-12-06 17:20:52 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-12-06 17:20:52 +0300
commite5884ab2166ab5a03294baa54601b8785e6d9727 (patch)
tree0013120eed3e407cd047b734082d7011b9bab94f /src/parser.c
parentc4e73ae7ef24796cf1f24f0c30d93f2ab21a4572 (diff)
downloadsciteco-e5884ab2166ab5a03294baa54601b8785e6d9727.tar.gz
support the ::S anchored search (string comparison) command (and ::FD, ::FR, ::FS as well)
* The colon modifier can now occur 2 times. Specifying `@` more than once or `:` more than twice is an error now. * Commands do not check for excess colon modifiers - almost every command would have to check it. Instead, a double colon will simply behave like a single colon on most commands. * All search commands inherit the anchored semantics, but it's not very useful in some combinations like -::S, ::N or ::FK. That's why the `::` variants are not documented everywhere. * The lexer.checkheader macro could be simplified and should also be faster now, speeding up startup. Eventually this macro can be made superfluous, e.g. by using 1:FB or 0,1^Q::S.
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/parser.c b/src/parser.c
index e1bf576..018e35f 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -320,16 +320,17 @@ teco_machine_main_init(teco_machine_main_t *ctx, teco_qreg_table_t *qreg_table_l
teco_machine_stringbuilding_init(&ctx->expectstring.machine, '\e', qreg_table_locals, must_undo);
}
-gboolean
+guint
teco_machine_main_eval_colon(teco_machine_main_t *ctx)
{
- if (!ctx->modifier_colon)
- return FALSE;
+ guint c = ctx->modifier_colon;
+ if (c == 0)
+ return 0;
if (ctx->parent.must_undo)
teco_undo_guint(ctx->__flags);
- ctx->modifier_colon = FALSE;
- return TRUE;
+ ctx->modifier_colon = 0;
+ return c;
}
gboolean