summaryrefslogtreecommitdiffstats
path: root/camlp4/Camlp4
diff options
context:
space:
mode:
authorJérémie Dimino <jeremie@dimino.org>2011-12-23 16:30:23 +0000
committerJérémie Dimino <jeremie@dimino.org>2011-12-23 16:30:23 +0000
commit3bea22baaf50f90fd6ec6b51754afe9c7ba910d3 (patch)
tree4a091867651722f561d61f07c0d3806a53b9a124 /camlp4/Camlp4
parent632cea70f81920082c1321fa2588790a6aaa37e6 (diff)
PR#5442: strings must be escaped when the ast meta-expansed by Camlp4
Because strings in the Camlp4 Ast are escaped. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11948 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4/Camlp4')
-rw-r--r--camlp4/Camlp4/Printers/OCaml.ml9
1 files changed, 3 insertions, 6 deletions
diff --git a/camlp4/Camlp4/Printers/OCaml.ml b/camlp4/Camlp4/Printers/OCaml.ml
index a524915a3..def7f196a 100644
--- a/camlp4/Camlp4/Printers/OCaml.ml
+++ b/camlp4/Camlp4/Printers/OCaml.ml
@@ -106,10 +106,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
"Cannot print %S this identifier does not respect OCaml lexing rules (%s)"
str (Lexer.Error.to_string exn)) ];
- value ocaml_char =
- fun
- [ "'" -> "\\'"
- | c -> c ];
+ value ocaml_char x = x;
value rec get_expr_args a al =
match a with
@@ -559,7 +556,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| <:expr< $int64:s$ >> -> o#numeric f s "L"
| <:expr< $int32:s$ >> -> o#numeric f s "l"
| <:expr< $flo:s$ >> -> o#numeric f s ""
- | <:expr< $chr:s$ >> -> pp f "'%s'" (ocaml_char s)
+ | <:expr< $chr:s$ >> -> pp f "'%s'" s
| <:expr< $id:i$ >> -> o#var_ident f i
| <:expr< { $b$ } >> ->
pp f "@[<hv0>@[<hv2>{%a@]@ }@]" o#record_binding b
@@ -669,7 +666,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| <:patt< $int32:s$ >> -> o#numeric f s "l"
| <:patt< $int:s$ >> -> o#numeric f s ""
| <:patt< $flo:s$ >> -> o#numeric f s ""
- | <:patt< $chr:s$ >> -> pp f "'%s'" (ocaml_char s)
+ | <:patt< $chr:s$ >> -> pp f "'%s'" s
| <:patt< ~ $s$ >> -> pp f "~%s" s
| <:patt< ` $uid:s$ >> -> pp f "`%a" o#var s
| <:patt< # $i$ >> -> pp f "@[<2>#%a@]" o#ident i