caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jérémie Dimino" <jeremie@dimino.org>
To: Jun Furuse <jun.furuse@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Is it possible to extend OCaml lexer rules via Camlp4?
Date: Thu, 3 Nov 2011 10:16:46 +0100	[thread overview]
Message-ID: <20111103091646.GA24501@solaria.dimino.org> (raw)
In-Reply-To: <CAAoLEWu6wL5twx2Dwgs5DSwwj2yAYyvoaZ7dtDKsdJB6=CaxjQ@mail.gmail.com>

Hi,

On Thu, Nov 03, 2011 at 04:12:29PM +0900, Jun Furuse wrote:
> I want to have pcre regexp literals in the same syntax as Perl i.e.
> /hello\sworld\\n/. Currently what we do in OCaml is Pcre.regexp
> "hello\\sworld\\\\n", where the backslash char must be escaped in a
> OCaml string literal. This is lousy for scripting in OCaml.

Have you look at camlp4 quotations ? Basically you can define a new
quotation named "foo" and in you code you can write:

  <:foo<...>>

The ... can be any string, except that it cannot contains >>.

Also you may be interested in the Mikmatch syntax extension:

  http://martin.jambon.free.fr/micmatch.html

Cheers,

-- 
Jérémie

  reply	other threads:[~2011-11-03  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 20:34 Jun Furuse
2011-11-02 22:52 ` Gabriel Scherer
2011-11-03  7:12   ` Jun Furuse
2011-11-03  9:16     ` Jérémie Dimino [this message]
2011-11-05 21:19       ` Nicolas Pouillard
2011-11-06  0:58         ` Jun Furuse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111103091646.GA24501@solaria.dimino.org \
    --to=jeremie@dimino.org \
    --cc=caml-list@inria.fr \
    --cc=jun.furuse@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).