Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: "'Hendrik Tews'" <tews@os.inf.tu-dresden.de>,
	"'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: RE: [Caml-list] quotations inside comments?
Date: Tue, 31 Aug 2010 08:25:08 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D928F805@Remus.metastack.local> (raw)
In-Reply-To: <19580.45516.666334.202997@blau.inf.tu-dresden.de>

> Hi,
> 
> why does camlp4 parse quotations inside comments? Eg

I don't know for certain, but I guess it might be for the same reason as the compiler which checks string literals (amongst other things) inside comments e.g.

(* This will not compile " *)

File "foo.ml", line 1, characters 0-2:
Error: This comment contains an unterminated string literal

The compiler does this to ensure that you can consistently nest comments (i.e. that commenting out a block actually comments the entire block out), without it you could write:

(*
let foo = "*)" in ()
*)

which wouldn't behave as you'd expect (and the syntax error could be a lot further down the file!) 


David

> 
>     echo "(* << *)" | camlp4o -impl -
> 
> gives
> 
>     File "-", line 1, characters 3-9 (end at line 2, character 0):
>     Quotation not terminated
> 
> Quotation parsing/lexing seems to be controlled by context.quotations. How
> can I switch this off?
> 
> Wouldn't it make more sense to have quotations and antiquotation
> parsing/lexing switched off in freshly created parsers/lexers and switch
> them only on when a syntax extension with quotations is installed (eg,
> inside Camlp4QuotationCommon.Make)?
> 
> Bye,
> 
> Hendrik
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


      reply	other threads:[~2010-08-31  8:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31  7:39 Hendrik Tews
2010-08-31  8:25 ` David Allsopp [this message]

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=E51C5B015DBD1348A1D85763337FB6D928F805@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=caml-list@inria.fr \
    --cc=tews@os.inf.tu-dresden.de \
    /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