summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-05-10 17:54:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-05-10 17:54:32 -0700
commit19ec71ba06fb953d9838a930ee5e1522092a8493 (patch)
tree362fee756ad5ef486d7b8e4f5a909507dac7e5ca /lib.c
parent12b74f698287f2fb4b5d6b20d02f810d808a45f6 (diff)
downloadtxr-19ec71ba06fb953d9838a930ee5e1522092a8493.tar.gz
txr-19ec71ba06fb953d9838a930ee5e1522092a8493.tar.bz2
txr-19ec71ba06fb953d9838a930ee5e1522092a8493.zip
String type related bugfixes: neglecting to handle all three kinds in
some places. In particular, the test case echo : | ./txr -c '@a:@a' - breaks because of neglected LIT in do_match_line. * arith.c (tofloat, toint): Handle LIT type in switch. * lib.c (ref, refset, replace, update): Handle LSTR type. * match.c (do_match_line, do_output_line): Handle LSTR and LIT objects in switch.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 5bf37ed4..fed06664 100644
--- a/lib.c
+++ b/lib.c
@@ -5017,6 +5017,7 @@ val ref(val seq, val ind)
return listref(seq, ind);
case LIT:
case STR:
+ case LSTR:
return chr_str(seq, ind);
case VEC:
return vecref(seq, ind);
@@ -5034,6 +5035,7 @@ val refset(val seq, val ind, val newval)
return set(listref_l(seq, ind), newval);
case LIT:
case STR:
+ case LSTR:
return chr_str_set(seq, ind, newval);
case VEC:
return set(vecref_l(seq, ind), newval);
@@ -5052,6 +5054,7 @@ val replace(val seq, val items, val from, val to)
return replace_list(seq, items, from, to);
case LIT:
case STR:
+ case LSTR:
return replace_str(seq, items, from, to);
case VEC:
return replace_vec(seq, items, from, to);
@@ -5078,6 +5081,7 @@ val update(val seq, val fun)
break;
case LIT:
case STR:
+ case LSTR:
case VEC:
{
val len = length(seq);