diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-12-27 07:36:01 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-12-27 07:36:01 -0800 |
commit | f9bcbd884bb1cd60144f13df3de00516b731827c (patch) | |
tree | 0d8f9badb6203c43652853bf8c127f8b1cc53114 /tests | |
parent | 8ccf4c0a9076c957a5ed58f6ccc6ede7f71644a3 (diff) | |
download | txr-f9bcbd884bb1cd60144f13df3de00516b731827c.tar.gz txr-f9bcbd884bb1cd60144f13df3de00516b731827c.tar.bz2 txr-f9bcbd884bb1cd60144f13df3de00516b731827c.zip |
txr: do not ignore regex in positive match.
* match.c (h_var): Refactor the logic here a bit. Without
regard for whether the variable has a value, we dispatch the
regex, fixed field and function cases. These handle the
binding against the existing value. Then before all other
cases, we check for the existing value and convert that to a
literal text match. The effect of this is that now the regular
expression is processed even if the variable has a value.
* tests/010/span-var.txr: Last two test cases hardened a bit
so they cannot fall through to a successful exit, if
they invoke the wrong case. This is not related to this
change. New test cases for regex span.
* txr.1: Updated documentation and compatibility notes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/010/span-var.txr | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/010/span-var.txr b/tests/010/span-var.txr index b7142b79..036acc6a 100644 --- a/tests/010/span-var.txr +++ b/tests/010/span-var.txr @@ -17,12 +17,23 @@ @(bind d ("d")) @(cases) @ {d (fun "x" "a")} +@ {require (not "get here")} @(or) @ (require "get here") @(end) @(next :string "ab") @(cases) @ {d (fun2 "x" "a")} +@ {require (not "get here")} @(or) @ (require "get here") @(end) +@(bind n "123") +@(next :string "123456") +@(cases) +@ {n /\d+/} +@ {require (not "get here")} +@(or) +@ {m /\d+/} +@ (require (equal m "123456")) +@(end) |