This comment is ok:
(* "\z" foo *)
This comment results in an error:
(* "\" foo *)
Is there a way to include a literal quoted single backslash in an OCaml comment? Why doesn't the obvious approach work? I would expect escapes in comments to simply be ignored.
For what it's worth, I'm trying to document tests for code that handles backslash escaping for its own purposes.
Thanks for reading.
Edit: The plot thickens. The following comments are acceptable:
(* "\" "\" notice-> " *)
(* "\" " "\" notice-> " *)
(* "\" foo "\" notice-> " " " *)
(* "\" " " "\" notice-> " *)
(* "\" "" " "\" notice-> " *)
(* "\" arbitrary "s "\" notice-> " *)
(* " \" note the spacing " \" notice-> " *)
(* "\" <- notice-> " *)
(* "\" " <- notice -> " " *)
(* "" *) (* """" *)
But add or take one at the ends, and it breaks. The following all fail (ask for more input in the REPL):
(* "\" "\" *)
(* "\" foo "\" notice-> *)
(* "\" foo "\" notice-> " " *)
(* "\" foo "\" notice-> " " " " *)
(* "\" foo " "\" notice-> " " *)
(* "\" foo " " "\" notice-> " " *)
(* " *) (* """ *) (* """"" *)
I'm pretty lost. It seems like it's trying to balance quotes, but the escaped quotes throw it for a loop.