summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--arith.c2
-rw-r--r--lib.c4
-rw-r--r--match.c4
4 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 62f01872..6a06645c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-05-10 Kaz Kylheku <kaz@kylheku.com>
+
+ 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.
+
2014-04-14 Kaz Kylheku <kaz@kylheku.com>
* stream.c (get_line, get_char, get_byte): Fix outdated, incorrect
diff --git a/arith.c b/arith.c
index d207579a..b90f79bc 100644
--- a/arith.c
+++ b/arith.c
@@ -1945,6 +1945,7 @@ val tofloat(val obj)
return obj;
case STR:
case LSTR:
+ case LIT:
return flo_str(obj);
default:
break;
@@ -1970,6 +1971,7 @@ val toint(val obj, val base)
return int_flo(obj);
case STR:
case LSTR:
+ case LIT:
return int_str(obj, base);
default:
break;
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);
diff --git a/match.c b/match.c
index 25b7c4db..acd82b1d 100644
--- a/match.c
+++ b/match.c
@@ -1234,6 +1234,8 @@ static val do_match_line(match_line_ctx *c)
}
break;
case STR:
+ case LSTR:
+ case LIT:
{
val newpos;
if (!match_str(c->dataline, elem, c->pos)) {
@@ -1767,6 +1769,8 @@ static void do_output_line(val bindings, val specline, val filter, val out)
}
break;
case STR:
+ case LSTR:
+ case LIT:
put_string(elem, out);
break;
case 0: