Hi, I've got a problem with antiquotations and strings in camlp4. I've got a parser (xmlp4, used in Ocsigen) written with camlp4 which has to deal with strings. This parser provides a quotation mechanism to let the user input XML in a natural way within an Ocaml program. Basically, the problem is the following expression (in the parser's code): | PCData(s) -> [ <:expr< XHTML.EncodedPCData $str:s$ >> ] where s is a (potentially unescaped) string. Here is a typical output: [XML.EncodedPCDATA " "bar \" ] corresponding to the following input file: <:xml< "bar\ >> (assuming that this quotation is parsed as PCData of course) As you can see, it's weird and it took me some time to find out what was happening (real-life examples being much more intricate). Of course, I would like to get: [XML.EncodedPCDATA "\"bar \\" ] instead, and of course, I could obtain it through: | PCData(s) -> [<:expr< XHTML.EncodedPCData $str:String.escaped s$ >>] But I wonder whether this should be considered as a camlp4 bug (or possible enhancement). When I write << EncodedPCData $str:s$ >>, I expect to get something consistent, not some kind of "let's evaluate s and copy/paste it blindly there". Shall I submit a bug report? Or is there something I got wrong in my code (which is very likely)? Anyway, if this is an intended behavior, the explanation should be put in BIG BOLD RED letters on the camlp4 wiki, on the quotation page. This would help a lot (plus I would like to understand what is exactly going on there). NB: I simplified the examples for the shake of clarity. You can find the relevant code here: http://ocsigen.org/trac/browser/xmlp4/newocaml/xhtmlparser.ml You may also want to have a look at: http://ocsigen.org/trac/browser/xmlp4/newocaml/xmllexer.mll and http://ocsigen.org/trac/browser/xmlp4/newocaml/xhtmlsyntax.ml I'd welcome any remark regarding this code. Kind regards, -- Gabriel Kerneis