From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pB9ITrwn024836 for ; Fri, 9 Dec 2011 19:29:53 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwDAEtT4k5QDPJ8k2dsb2JhbABDmkmQUQEBAQEJCQsJFAMigXIBAQQBOjQLBQsLJSFFEgYlh3UCBrVlg3iHF2MEiDCSC4x9 X-IronPort-AV: E=Sophos;i="4.71,327,1320620400"; d="scan'208";a="122790581" Received: from smtp02.smtpout.orange.fr (HELO smtp.smtpout.orange.fr) ([80.12.242.124]) by mail4-smtp-sop.national.inria.fr with ESMTP; 09 Dec 2011 19:29:38 +0100 Received: from [172.24.130.98] ([66.220.144.74]) by mwinf5d03 with ME id 76Vc1i00B1cXi5u036VdMF; Fri, 09 Dec 2011 19:29:38 +0100 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Yoann Padioleau In-Reply-To: <6FE3D3B5-3EF3-4B72-B2D0-E068AAA2F397@inria.fr> Date: Fri, 9 Dec 2011 10:29:36 -0800 Cc: caml users Message-Id: <4053752C-FA20-4B93-97CC-9B12FA19C7BD@wanadoo.fr> References: <6FE3D3B5-3EF3-4B72-B2D0-E068AAA2F397@inria.fr> To: Damien Doligez X-Mailer: Apple Mail (2.1084) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id pB9ITrwn024836 Subject: Re: [Caml-list] perfect syntax coloring in emacs There is perfect syntax coloring in Codemap for OCaml :) https://github.com/facebook/pfff/wiki/CodeMap It even colorizes differently identifiers for functions, variables, types, etc. On Dec 9, 2011, at 7:23 AM, Damien Doligez wrote: > Dear OCaml users, > > I have implemented emacs-lisp code that correctly recognizes all > comments and strings in OCaml code, and interfaced it with the > fontification features of Emacs. The code is committed in the > SVN repository, but if you want to try it before the next > release, I'm including it in attachment. > > If you want to know why this is not a trivial problem, consider > the following OCaml program. > > ======================================================= > let l' _ = ();; > let _' _ = ();; > let l' = ();; > let b2_' = ();; > let a'a' = ();; > let f2 _ _ = ();; > let f3 _ _ _ = ();; > > (* ==== easy stuff ==== *) > > (* a comment *) > (* "a string" in a comment *) > (* "another string *)" in a comment *) > (* not a string '"' in a comment *) > "a string";; > '"';; (* not a string *) > > (* ==== hard stuff ==== *) > > l'"' not not a string ";; > _'"' also not not a string";; > f2 0l'"';; (* not not not a string *) > f2 0_'"';; (* also not not not a string *) > f3 0.0l'"' not not not not a string ";; > f3 0.0_'"';; (* not not not not not a string *) > f2 0b1_'"';; (* not not not a string *) > f3 0b2_'"' not not not not a string ";; > f3 0b02_'"';; (* not not not not not a string *) > '\'';; (* a char *) > ' > ';; (* a char *) > '^M > ';; (* also a char [replace ^M with one CR character] *) > a'a';; (* not a char *) > type ' > a' t = X;; (* also not a char *) > ======================================================= > > > Obligatory troll: try to do the same in vim! > > -- Damien > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > >