New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string literals inside comments #5745
Comments
Comment author: @gasche I'm not sure why this well-known behavior should be considered a bug. It is occasionally surprising but also useful (and easy to check with syntax colouring). Are you suggesting a particular change or improvement to the documentation? |
Comment author: johnlepikhin Well, I use Ocaml in my daily work for 5 years, but seems like that was the first day when I tried to add unclosed quotation mark into comment :) Your response is surprised me. I think it's time to close this bug. |
Comment author: meyer We should provide escape of the single in form of ". Tools like ocamldoc or ocamlweb extract comments, and taken that " means inch in imperial units, it's fairly possible to hit the undesired behavior. There is an obvious workaround for that to use '' or special markup escapes. |
Comment author: @gasche In retrospect I guess that my initial answer was a bit harsh. johnlepikhin, I'm sorry for that. I understand that not everyone knows about this and that it can be surprising. I don't think we should change this (the risk of introducing a backward-incompatible lexer bug seems greater than the benefits), especially since there is already a rather explicit error raised in this case. If you want to use a single " inside a comment, I recommend '' as a workaround. I'm marking the bug as "resolved" to get it out the of hot list. If someone (meyer?) is strongly convinced that there is a better solution, don't hesitate to comment. |
Original bug ID: 5745
Reporter: johnlepikhin
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:08:02Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: meyer @gasche
Bug description
Ocaml parser doesn't ignores quotes inside comments and requires all quotations to be closed.
Error:
$ echo '(* "test *)' | ocaml
Objective Caml version 3.12.1
(* "test *)
*
Error: This comment contains an unterminated string literal
OK:
$ echo '(* "test" *)' | ocaml
Objective Caml version 3.12.1
The text was updated successfully, but these errors were encountered: