Support for quoted strings within comments.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13469 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
1a63c4659c
commit
f510f9b4a1
|
@ -473,6 +473,28 @@ and comment = parse
|
|||
is_in_string := false;
|
||||
store_string_char '"';
|
||||
comment lexbuf }
|
||||
| "{" lowercase* "|"
|
||||
{
|
||||
let delim = Lexing.lexeme lexbuf in
|
||||
let delim = String.sub delim 1 (String.length delim - 2) in
|
||||
string_start_loc := Location.curr lexbuf;
|
||||
store_lexeme lexbuf;
|
||||
is_in_string := true;
|
||||
begin try quoted_string delim lexbuf
|
||||
with Error (Unterminated_string, _) ->
|
||||
match !comment_start_loc with
|
||||
| [] -> assert false
|
||||
| loc :: _ ->
|
||||
let start = List.hd (List.rev !comment_start_loc) in
|
||||
comment_start_loc := [];
|
||||
raise (Error (Unterminated_string_in_comment start, loc))
|
||||
end;
|
||||
is_in_string := false;
|
||||
store_string_char '|';
|
||||
store_string delim;
|
||||
store_string_char '}';
|
||||
comment lexbuf }
|
||||
|
||||
| "''"
|
||||
{ store_lexeme lexbuf; comment lexbuf }
|
||||
| "'" newline "'"
|
||||
|
|
Loading…
Reference in New Issue