From 42afde14b0e59de2e0f938806323dad9e2e5ed06 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 May 2018 20:03:13 -0700 Subject: txr: support variable in postive match. In the @{var mod} syntax in the pattern language, allow mod to be a variable which contains a regex or integer, not just an integer or regex literal. * match.c (h_var): Check for modifier being a variable, and resolve it. * parser.y (modifiers): Allow a SYMTOK phrase. * txr.1: Documented. --- match.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'match.c') diff --git a/match.c b/match.c index 3a1024e9..a7a65098 100644 --- a/match.c +++ b/match.c @@ -596,6 +596,11 @@ static val h_var(match_line_ctx *c) sym, nao); } + if (bindable(modifier)) { + val mpair = tx_lookup_var_ubc(modifier, c->bindings, elem); + modifier = cdr(mpair); + } + if (pair) { /* If the variable already has a binding, we replace it with its value, and treat it as a string match. -- cgit v1.2.3