|
@@ -617,6 +617,22 @@ let unescape s =
|
|
let c = (try char_of_int (int_of_string ("0x" ^ String.sub s (i+1) 2)) with _ -> raise Exit) in
|
|
let c = (try char_of_int (int_of_string ("0x" ^ String.sub s (i+1) 2)) with _ -> raise Exit) in
|
|
Buffer.add_char b c;
|
|
Buffer.add_char b c;
|
|
inext := !inext + 2;
|
|
inext := !inext + 2;
|
|
|
|
+ | 'u' ->
|
|
|
|
+ let (u, a) =
|
|
|
|
+ (try
|
|
|
|
+ (int_of_string ("0x" ^ String.sub s (i+1) 4), 4)
|
|
|
|
+ with
|
|
|
|
+ _ -> try
|
|
|
|
+ assert (s.[i+1] = '{');
|
|
|
|
+ let l = String.index_from s (i+3) '}' - (i+2) in
|
|
|
|
+ let u = int_of_string ("0x" ^ String.sub s (i+2) l) in
|
|
|
|
+ assert (u <= 0x10FFFF);
|
|
|
|
+ (u, l+2)
|
|
|
|
+ with _ -> raise Exit) in
|
|
|
|
+ let ub = UTF8.Buf.create 0 in
|
|
|
|
+ UTF8.Buf.add_char ub (UChar.uchar_of_int u);
|
|
|
|
+ Buffer.add_string b (UTF8.Buf.contents ub);
|
|
|
|
+ inext := !inext + a;
|
|
| _ ->
|
|
| _ ->
|
|
raise Exit);
|
|
raise Exit);
|
|
loop false !inext;
|
|
loop false !inext;
|