summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Weis <Pierre.Weis@inria.fr>2015-09-13 13:17:23 +0000
committerPierre Weis <Pierre.Weis@inria.fr>2015-09-13 13:17:23 +0000
commit24b8bf59f9988d492e0281522a3545937ef43702 (patch)
tree26804a2041a3489ee58ae878c18bcfa6665cc3fe
parentb3b3cd32f606acd8cff57f69bab9ca0cb1718fbe (diff)
downloadocaml-24b8bf59f9988d492e0281522a3545937ef43702.tar.gz
Escaping " in character constants
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16420 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--stdlib/bytes.ml4
-rw-r--r--stdlib/string.ml2
2 files changed, 3 insertions, 3 deletions
diff --git a/stdlib/bytes.ml b/stdlib/bytes.ml
index 32d4468c34..6997a78bd0 100644
--- a/stdlib/bytes.ml
+++ b/stdlib/bytes.ml
@@ -149,7 +149,7 @@ let escaped s =
for i = 0 to length s - 1 do
n := !n +
(match unsafe_get s i with
- | '"' | '\\' | '\n' | '\t' | '\r' | '\b' -> 2
+ | '\"' | '\\' | '\n' | '\t' | '\r' | '\b' -> 2
| ' ' .. '~' -> 1
| _ -> 4)
done;
@@ -158,7 +158,7 @@ let escaped s =
n := 0;
for i = 0 to length s - 1 do
begin match unsafe_get s i with
- | ('"' | '\\') as c ->
+ | ('\"' | '\\') as c ->
unsafe_set s' !n '\\'; incr n; unsafe_set s' !n c
| '\n' ->
unsafe_set s' !n '\\'; incr n; unsafe_set s' !n 'n'
diff --git a/stdlib/string.ml b/stdlib/string.ml
index ecb1be3c3b..1b9ab0f357 100644
--- a/stdlib/string.ml
+++ b/stdlib/string.ml
@@ -87,7 +87,7 @@ let escaped s =
let rec needs_escape i =
if i >= length s then false else
match unsafe_get s i with
- | '"' | '\\' | '\n' | '\t' | '\r' | '\b' -> true
+ | '\"' | '\\' | '\n' | '\t' | '\r' | '\b' -> true
| ' ' .. '~' -> needs_escape (i+1)
| _ -> true
in