caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Jan Rehders <wurstgebaeck@googlemail.com>,
	 caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Beta release of ppx_string_interpolate, and help needed with ocamlfind/opam
Date: Mon, 27 Oct 2014 17:01:07 +0100	[thread overview]
Message-ID: <544E6C43.6090201@frisch.fr> (raw)
In-Reply-To: <CAJwN6-0i1BBOQ1Z5Y0VTikhZeNpJF8q4OoAY05KtnLiL33zHWg@mail.gmail.com>

On 10/26/2014 07:20 PM, Jan Rehders wrote:
> = Using \ instead of $ =
> Using Swift style \(foo) instead of $(foo) would be nice but will
> produce warnings from the lexer which I can't suppress w/o suppressing
> all warnings about invalid escape sequences. Also this requires doing
> this from the makefile so every user would have to do it. Is there
> some API I’ve missed to suppress specific warnings on the code inside
> [%str ..] from ppx filters?

You might want to use the new syntax for string literals:

   {| .... |}

or:

   {id| .... |id}

(for an arbitrary id).  Contrary to regular string literals, OCaml 
doesn't apply any lexing convention to the string contents: what you 
have in the Parsetree is exactly the sequence of bytes from the source 
file.  This allows you to use you own conventions:

    \(foo)

Also, you can map in an exact way between from an index in the string to 
a location in the source code (in a regular string, you cannot 
distinguish \065 from A in the Parsetree, which makes this exact mapping 
impossible).


Combined with an extension node, this would give:

  [%str{| blabla \(x) blabla |}]

-- Alain

  reply	other threads:[~2014-10-27 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 18:20 Jan Rehders
2014-10-27 16:01 ` Alain Frisch [this message]
2014-10-27 23:36   ` Jan Rehders
2014-10-28  8:18     ` Török Edwin
2014-10-28  9:13     ` Francois Berenger
2014-10-31 12:49       ` Jan Rehders

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=544E6C43.6090201@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=wurstgebaeck@googlemail.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).