diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-01-26 14:15:53 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-01-26 14:15:53 -0800 |
commit | a2b16d316cf9201fa27d35766f5f245c2c9a6b26 (patch) | |
tree | ca0187364399db8811ab2a595f82b13dd55ed08a /match.c | |
parent | b58791b726228b97297cc4512476f6016b9346a2 (diff) | |
download | txr-a2b16d316cf9201fa27d35766f5f245c2c9a6b26.tar.gz txr-a2b16d316cf9201fa27d35766f5f245c2c9a6b26.tar.bz2 txr-a2b16d316cf9201fa27d35766f5f245c2c9a6b26.zip |
* match.c (format_field): Removed useless use of cat_str (no longer
needed because str is already a string). The purpose was to reduce
character to strings.
(subst_vars): Some of the new logic in format_field must be replicated
in the case when format_field is not called because the variable
has no modifiers. Lists must be converted to a space-separated string.
Bugfix here: occurence of pat and modifiers is not mutually exclusive.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -1273,8 +1273,7 @@ val format_field(val obj, val modifier, val filter, val eval_fun) } if (filter) - str = filter_string(filter, cat_str(list(str, nao), - nil)); + str = filter_string(filter, str); } { @@ -1321,13 +1320,21 @@ static val subst_vars(val spec, val bindings, val filter) str = format(nil, lit("~a"), str, nao); if (pat) - spec = cons(filter_string(filter, str), cons(pat, rest(spec))); - else if (modifiers) + spec = cons(pat, rest(spec)); + + if (modifiers) { spec = cons(format_field(str, modifiers, filter, curry_123_2(func_n3(txeval), spec, bindings)), rest(spec)); - else + } else { + if (listp(str)) + str = cat_str(mapcar(func_n1(tostringp), str), lit(" ")); + else + str = if3(stringp(str), str, tostringp(str)); + spec = cons(filter_string(filter, str), rest(spec)); + } + continue; } uw_throwf(query_error_s, lit("unbound variable ~a"), |