Package: ocaml-nox Version: 3.12.1-2 Severity: normal Dear Maintainer, If you add somewhere in your code a comment with open quotation, the compiler sometimes produces binaries with partial broken functionality or aborts compilation with error message of this pattern: File "brackets.ml", line 34, characters 15-559 (end at line 60, character 0): Quotation not terminated Preprocessing error on file brackets.ml I have attached a sample file which triggers this message. If you remove the comment in line 3 (or close the quotation) the stuff will be compiled successfully. The problem with this bug is, that the error-message is completely unhelpful. I am not sure, but this comment bug could also be occure on older versions of ocaml-compiler. We hat a heisenbug where the compiler creates a working binary without any error-message, but completely different behaviour, if somewhere was a comment of form (* << *) or (* >> *), but this was very hard to reproduce and catch in an example-file. bye Andreas -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.1.0-1-amd64 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages ocaml-nox depends on: ii binutils 2.22-4 ii gcc 4:4.6.2-4 ii libc6 2.13-24 ii libncurses5 5.9-4 ii libncurses5-dev 5.9-4 ii libtinfo5 5.9-4 ii ocaml-base-nox [ocaml-base-nox-3.12.1] 3.12.1-2 ii ocaml-interp 3.12.1-2 ii zlib1g 1:1.2.3.4.dfsg-3 Versions of packages ocaml-nox recommends: ii camlp4 3.12.1-2 ii file 5.09-2 Versions of packages ocaml-nox suggests: pn libgdbm-dev <none> pn ocaml-doc <none> pn tuareg-mode | ocaml-mode <none> -- no debconf information -- Andreas Romeyke - Abteilung Blindenschrift - Deutsche Zentralbücherei für Blinde zu Leipzig (DZB) Gustav-Adolf-Straße 7, 04105 Leipzig Tel: +49 341 7113-..., Fax: +49 341 7113-125 Internet: www.dzb.de E-Mail: andreas.romeyke@dzb.de
open OcamlNG;;
(* 3" *)
let is_bracketed (s:string) =
let _test openbracket closebracket =
let openregex = Str.regexp openbracket in
let closeregex = Str.regexp closebracket in
let last_idx = (String.length s) -1 in
try
let left_idx =
Str.search_forward openregex s 0
in
let right_idx =
Str.search_backward closeregex s last_idx
in
let left = Str.string_before s left_idx in
let right = Str.string_after s right_idx in
let middle =
let tmp = Str.string_after s left_idx in
Str.string_before tmp right_idx
in
Some (left, middle, right)
with
Not_found -> None
in
let brackets =
("\\[" , "\\]" )::
("(" , ")" )::
("{" , "}" )::
("begin", "end")::
("BEGIN", "END")::
("»" , "«" )::
("<<" , ">>" )::
(">>" , "<<" )::
(">" , "<" )::
("\"" , "\"" )::
("'" , "'" )::
("„" , "”" )::
[]
in
brackets
|> List.map (
fun br ->
let (openbracket, closebracket) = br in
_test openbracket closebracket
)
|> (fun l ->
try
List.find (
function
| None -> false
| Some _ -> true
) l
with
Not_found -> None
)
;;
Attachment:
signature.asc
Description: This is a digitally signed message part