You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1281 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
When I compile my programs with the new ocaml-3.05, I have some irrelevant
Warning messages about "Illegal backslash escape in string". These messages are
issued on strings that are used for functions of the str library.
As these messages are just warning the programs operate correctly but the first
time I saw them, I found them obscure.
Example:
foo.ml:
let str = Str.replace_first (Str.regexp "name: ([A-Za-z]+)") "\1" "name:
Michael" in print_string str
ocamlc str.cma foo.ml
File "foo.ml", line 1, characters 47-49:
Warning: Illegal backslash escape in string
File "foo.ml", line 1, characters 58-60:
Warning: Illegal backslash escape in string
File "foo.ml", line 1, characters 64-66:
Warning: Illegal backslash escape in string
The text was updated successfully, but these errors were encountered:
When I compile my programs with the new ocaml-3.05, I have some
irrelevant Warning messages about "Illegal backslash escape in
string". These messages are issued on strings that are used for
functions of the str library.
There warnings are definitely relevant: the backslash character is an
escape character in a string, hence a \ in a string should be escaped
as \ :
let str = Str.replace_first (Str.regexp "name: ([A-Za-z]+)") "\1" ...
let str = Str.replace_first (Str.regexp "name: \([A-Za-z]+\)") "\1" ...
Since "(" isn't an escape sequence, the OCaml lexer will treat it as
a \ character followed by a ( character. However, you'll run into
troubles with e.g. "\n", which is one newline character instead of
followed by n. Hence the warning.
Original bug ID: 1281
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Michael Marchegay
Version: 3.05
OS: SunOs 5.7
Submission from: machine107.rd.francetelecom.com (193.49.124.107)
Hello,
When I compile my programs with the new ocaml-3.05, I have some irrelevant
Warning messages about "Illegal backslash escape in string". These messages are
issued on strings that are used for functions of the str library.
As these messages are just warning the programs operate correctly but the first
time I saw them, I found them obscure.
Example:
foo.ml:
let str = Str.replace_first (Str.regexp "name: ([A-Za-z]+)") "\1" "name:
Michael" in print_string str
ocamlc str.cma foo.ml
File "foo.ml", line 1, characters 47-49:
Warning: Illegal backslash escape in string
File "foo.ml", line 1, characters 58-60:
Warning: Illegal backslash escape in string
File "foo.ml", line 1, characters 64-66:
Warning: Illegal backslash escape in string
The text was updated successfully, but these errors were encountered: