From 0ad6edc1d088385ffe90f1a4dd1bddc04cb31b07 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Sat, 5 Nov 2016 10:55:55 +0100 Subject: Removing obsolete parsing of strings à la v7 in comments. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was for the translator and is not relevant for the beautifier. --- parsing/cLexer.ml4 | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'parsing') diff --git a/parsing/cLexer.ml4 b/parsing/cLexer.ml4 index a0cf631ea..d570f015e 100644 --- a/parsing/cLexer.ml4 +++ b/parsing/cLexer.ml4 @@ -408,24 +408,6 @@ let comment_stop ep = comment_begin := None; between_commands := false -(* Does not unescape!!! *) -let rec comm_string loc bp = parser - | [< ''"' >] -> push_string "\""; loc - | [< ''\\'; loc = - (parser [< ' ('"' | '\\' as c) >] -> - let () = match c with - | '"' -> real_push_char c - | _ -> () - in - real_push_char c; loc - | [< >] -> real_push_char '\\'; loc); s >] - -> comm_string loc bp s - | [< _ = Stream.empty >] ep -> - let loc = set_loc_pos loc bp ep in - err loc Unterminated_string - | [< ''\n' as c; s >] ep -> real_push_char c; comm_string (bump_loc_line loc ep) bp s - | [< 'c; s >] -> real_push_char c; comm_string loc bp s - let rec comment loc bp = parser bp2 | [< ''('; loc = (parser @@ -437,11 +419,7 @@ let rec comment loc bp = parser bp2 | [< '')' >] -> push_string "*)"; loc | [< s >] -> real_push_char '*'; comment loc bp s >] -> loc | [< ''"'; s >] -> - let loc = - (* In beautify mode, the lexing differs between strings in comments and - regular strings (e.g. escaping). It seems wrong. *) - if !Flags.beautify then (push_string"\""; comm_string loc bp2 s) - else fst (string loc ~comm_level:(Some 0) bp2 0 s) + let loc = fst (string loc ~comm_level:(Some 0) bp2 0 s) in comment loc bp s | [< _ = Stream.empty >] ep -> -- cgit v1.2.3