The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Support continuation characters in ocamltest

Allows strings to be entered on multiple lines by permitting backslash
to escape the newline sequence and optionally a backslash to escape a
space at the start of the following line.

+24 -6
+24 -6
ocamltest/tsl_lexer.mll
··· 54 54 comment_start_pos := [Lexing.lexeme_start_p lexbuf]; 55 55 comment lexbuf 56 56 } 57 - | "\"" [^'"']* "\"" 58 - { let s = Lexing.lexeme lexbuf in 59 - let string_length = (String.length s) -2 in 60 - let s' = String.sub s 1 string_length in 61 - STRING s' 62 - } 57 + | '"' 58 + { STRING (string "" lexbuf) } 63 59 | _ 64 60 { 65 61 let pos = Lexing.lexeme_start_p lexbuf in ··· 70 66 file line column (Lexing.lexeme lexbuf) in 71 67 lexer_error message 72 68 } 69 + (* Backslashes are ignored in strings except at the end of lines where they 70 + cause the newline to be ignored. After an escaped newline, any blank 71 + characters at the start of the line are ignored and optionally one blank 72 + character may be escaped with a backslash. 73 + 74 + In particular, this means that the following: 75 + script = "some-directory\\ 76 + \ foo" 77 + is interpreted as the OCaml string "some-directory\\ foo". 78 + *) 79 + and string acc = parse 80 + | [^ '\\' '"' ]+ 81 + { string (acc ^ Lexing.lexeme lexbuf) lexbuf } 82 + | '\\' newline blank* ('\\' (blank as blank))? 83 + { let space = 84 + match blank with None -> "" | Some blank -> String.make 1 blank 85 + in 86 + string (acc ^ space) lexbuf } 87 + | '\\' 88 + {string (acc ^ "\\") lexbuf} 89 + | '"' 90 + {acc} 73 91 and comment = parse 74 92 | "(*" 75 93 {