X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Futf8_macros%2Futf8Macro.ml;h=e5fca10c48cc06e3a428865ea94190758f7cbc3f;hb=771ee8b9d122fa963881c876e86f90531bb7434f;hp=4e0bc9498992a7d14ef22b53992c6c7f5998eec8;hpb=708d2e2da7e5cfae98d69b325db56960e33fd38f;p=helm.git diff --git a/helm/ocaml/utf8_macros/utf8Macro.ml b/helm/ocaml/utf8_macros/utf8Macro.ml index 4e0bc9498..e5fca10c4 100644 --- a/helm/ocaml/utf8_macros/utf8Macro.ml +++ b/helm/ocaml/utf8_macros/utf8Macro.ml @@ -23,6 +23,8 @@ * http://helm.cs.unibo.it/ *) +(* $Id$ *) + exception Macro_not_found of string exception Utf8_not_found of string @@ -31,3 +33,15 @@ let expand macro = Hashtbl.find Utf8MacroTable.macro2utf8 macro with Not_found -> raise (Macro_not_found macro) +let unicode_of_tex s = + try + if s.[0] = '\\' then + expand (String.sub s 1 (String.length s - 1)) + else s + with Macro_not_found _ -> s + +let tex_of_unicode s = + try + "\\" ^ Hashtbl.find Utf8MacroTable.utf82macro s + with Not_found -> s +