# HG changeset patch # User Adam Chlipala # Date 1306762310 14400 # Node ID 8fce8593925963e4795d1565a8b4cfd96b61f51a # Parent e2d7bd41f527af8790ecfd731edc4e9932216c4d Fix bug with string literals in unAs diff -r e2d7bd41f527 -r 8fce85939259 src/c/urweb.c --- a/src/c/urweb.c Mon May 30 07:48:08 2011 -0400 +++ b/src/c/urweb.c Mon May 30 09:31:50 2011 -0400 @@ -3562,7 +3562,7 @@ } uw_Basis_string uw_Basis_unAs(uw_context ctx, uw_Basis_string s) { - uw_Basis_string r = uw_malloc(ctx, strlen(s) + 1); + uw_Basis_string ret = uw_malloc(ctx, strlen(s) + 1), r = ret; for (; *s; ++s) { if (s[0] == '\'') { @@ -3572,27 +3572,21 @@ *r++ = '\''; break; } else if (s[0] == '\\') { - if (s[1] == '\\') { - *r++ = '\\'; - *r++ = '\\'; - ++s; - } else if (s[1] == '\'') { - *r++ = '\\'; - *r++ = '\''; - ++s; - } else - *r++ = '\''; + *r++ = '\\'; + *r++ = s[1]; + ++s; } else *r++ = s[0]; } if (*s == 0) break; - } else if (s[0] == 'T' && s[1] == '.') - ++s; + } else if (s[0] == 'T' && s[1] == '_' && s[2] == 'T' && s[3] == '.') + s += 3; else *r++ = s[0]; } - return r; + *r = 0; + return ret; } uw_Basis_string uw_Basis_mstrcat(uw_context ctx, ...) { diff -r e2d7bd41f527 -r 8fce85939259 src/mono_opt.sml --- a/src/mono_opt.sml Mon May 30 07:48:08 2011 -0400 +++ b/src/mono_opt.sml Mon May 30 09:31:50 2011 -0400 @@ -102,7 +102,7 @@ fun doChars (cs, acc) = case cs of #"T" :: #"_" :: #"T" :: #"." :: cs => doChars (cs, acc) - | #"'" :: cs => doString (cs, acc) + | #"'" :: cs => doString (cs, #"'" :: acc) | ch :: cs => doChars (cs, ch :: acc) | [] => String.implode (rev acc) diff -r e2d7bd41f527 -r 8fce85939259 tests/t_t.ur --- a/tests/t_t.ur Mon May 30 07:48:08 2011 -0400 +++ b/tests/t_t.ur Mon May 30 09:31:50 2011 -0400 @@ -1,3 +1,4 @@ -table t : {A : int} +table t : {A : int, B : string} -task initialize = fn () => dml (UPDATE t SET A = A + 1 WHERE TRUE) +task initialize = fn () => dml (UPDATE t SET A = A + 1 WHERE TRUE); + dml (UPDATE t SET B = 'q' WHERE TRUE)