diff --git a/ast.ml b/ast.ml index ff60f2a878f..78fd0b508dc 100755 --- a/ast.ml +++ b/ast.ml @@ -617,6 +617,20 @@ let unescape s = 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; 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 + (int_of_string ("0x" ^ String.sub s (i+2) l), 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); loop false !inext;