summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-11-10 17:24:14 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-11-10 17:24:14 -0800
commit959b2af05ba8b7907a74407f0f8e187e4ae8ca4c (patch)
tree2dd4519823b830b84dce126ff2db5a87948b78d8 /match.c
parent8bef574c2fc8d99301f2ebbbaad2acc6e9e8891a (diff)
downloadtxr-959b2af05ba8b7907a74407f0f8e187e4ae8ca4c.tar.gz
txr-959b2af05ba8b7907a74407f0f8e187e4ae8ca4c.tar.bz2
txr-959b2af05ba8b7907a74407f0f8e187e4ae8ca4c.zip
* match.c (opt_nobindings, opt_arraydims): Global
variables moved from parser.l. (opt_lisp_bindings): New variable. (dump_bindings): Dump Lisp syntax bindings on standard output if opt_lisp_bindings is set. (v_cat): Do not complain about trailing material; this is not compatible with horizontal cat. * parser.l (opt_nobindings, opt_arraydims): Moved to match.c. * txr.c (txr_main): New options, --lisp-bindings and the equivalent -l. * txr.h: opt_lisp_bindings declared.
Diffstat (limited to 'match.c')
-rw-r--r--match.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/match.c b/match.c
index 9021c7c1..85558f1c 100644
--- a/match.c
+++ b/match.c
@@ -47,6 +47,9 @@
#include "match.h"
int output_produced;
+int opt_nobindings = 0;
+int opt_lisp_bindings = 0;
+int opt_arraydims = 1;
val decline_k, next_spec_k, repeat_spec_k;
val mingap_k, maxgap_k, gap_k, mintimes_k, maxtimes_k, times_k;
@@ -182,18 +185,20 @@ static void dump_var(val var, char *pfx1, size_t len1,
static void dump_bindings(val bindings)
{
- if (opt_loglevel >= 2) {
- put_line(std_error, lit("raw_bindings:"));
- dump(bindings, std_error);
- }
-
- while (bindings) {
- char pfx1[128], pfx2[128];
- val var = car(car(bindings));
- val value = cdr(car(bindings));
- *pfx1 = 0; *pfx2 = 0;
- dump_var(var, pfx1, 0, pfx2, 0, value, 0);
- bindings = cdr(bindings);
+ if (opt_lisp_bindings) {
+ val iter;
+ for (iter = bindings; iter; iter = cdr(iter)) {
+ dump(car(iter), std_output);
+ }
+ } else {
+ while (bindings) {
+ char pfx1[128], pfx2[128];
+ val var = car(car(bindings));
+ val value = cdr(car(bindings));
+ *pfx1 = 0; *pfx2 = 0;
+ dump_var(var, pfx1, 0, pfx2, 0, value, 0);
+ bindings = cdr(bindings);
+ }
}
}
@@ -2463,9 +2468,6 @@ static val v_cat(match_files_ctx *c)
val sym = second(first_spec);
val sep_form = third(first_spec);
- if (rest(specline))
- sem_error(spec_linenum, lit("obsolete cat syntax: trailing material"), nao);
-
if (!bindable(sym)) {
sem_error(spec_linenum,
lit("cat: ~s is not a bindable symbol"), sym, nao);