diff options
author | Tom Kelly <ctk21@cl.cam.ac.uk> | 2021-10-01 10:47:55 +0100 |
---|---|---|
committer | Tom Kelly <ctk21@cl.cam.ac.uk> | 2021-10-01 10:47:55 +0100 |
commit | ec296cb5f2d62b56c73197d71e60ec7850363bba (patch) | |
tree | 4af7809c736f2ad1583cc9d8970134eb64c53e9e /ocamltest | |
parent | 00da680acd07ef216a7faf99d51e7d9548b40def (diff) | |
parent | 9818f7aaa2a64a3b3d99ab73dd02caa5645ab9c0 (diff) | |
download | ocaml-ec296cb5f2d62b56c73197d71e60ec7850363bba.tar.gz |
Merge commit '9818f7aaa2a64a3b3d99ab73dd02caa5645ab9c0' into parallel_minor_gc_4_13
Diffstat (limited to 'ocamltest')
-rw-r--r-- | ocamltest/ocamltest_stdlib.ml | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ocamltest/ocamltest_stdlib.ml b/ocamltest/ocamltest_stdlib.ml index 274e234527..ff9198e31d 100644 --- a/ocamltest/ocamltest_stdlib.ml +++ b/ocamltest/ocamltest_stdlib.ml @@ -65,20 +65,33 @@ module String = struct end else begin let j = i+1 in match s.[i] with - | '\'' -> f (not quote) w ws j + | '\'' + | '"' as c -> + begin + match quote with + | None -> + (* Begin quoted word *) + f (Some c) w ws j + | Some quote_char when quote_char = c -> + (* End quoted word *) + f None w ws j + | _ -> + (* Continue string *) + f quote (w ^ (string_of_char c)) ws j + end | ' ' -> begin - if quote - then f true (w ^ (string_of_char ' ')) ws j + if quote <> None + then f quote (w ^ (string_of_char ' ')) ws j else begin if w="" - then f false w ws j - else f false "" (w::ws) j + then f None w ws j + else f None "" (w::ws) j end end | _ as c -> f quote (w ^ (string_of_char c)) ws j end in - if l=0 then [] else f false "" [] 0 + if l=0 then [] else f None "" [] 0 end module Sys = struct |